	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function btsdio_open
_btsdio_open:                           ## @btsdio_open
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	8(%rdi), %r15
	movl	4(%rdi), %esi
	leaq	L_.str(%rip), %rdi
	callq	_BT_DBG
	movq	_HCI_RUNNING@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	movq	%rbx, %rsi
	callq	_test_and_set_bit
	xorl	%r14d, %r14d
	testq	%rax, %rax
	jne	LBB0_10
## %bb.1:
	movq	(%r15), %rdi
	callq	_sdio_claim_host
	movq	(%r15), %rdi
	callq	_sdio_enable_func
	testl	%eax, %eax
	js	LBB0_2
## %bb.4:
	movq	(%r15), %rdi
	movq	_btsdio_interrupt@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_sdio_claim_irq
	movl	%eax, %r14d
	movq	(%r15), %rdi
	testl	%eax, %eax
	js	LBB0_5
## %bb.6:
	movq	(%rdi), %rax
	movq	_SDIO_CLASS_BT_B@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_8
## %bb.7:
	movq	_REG_MD_STAT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	callq	_sdio_writeb
	movq	(%r15), %rdi
LBB0_8:
	movq	_REG_EN_INTRD@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$1, %esi
	xorl	%ecx, %ecx
	callq	_sdio_writeb
	jmp	LBB0_9
LBB0_2:
	movl	%eax, %r14d
	jmp	LBB0_3
LBB0_5:
	callq	_sdio_disable_func
LBB0_3:
	movl	(%r12), %edi
	movq	%rbx, %rsi
	callq	_clear_bit
LBB0_9:
	movq	(%r15), %rdi
	callq	_sdio_release_host
LBB0_10:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s"

	.comm	_HCI_RUNNING,4,2                ## @HCI_RUNNING
	.comm	_btsdio_interrupt,4,2           ## @btsdio_interrupt
	.comm	_SDIO_CLASS_BT_B,8,3            ## @SDIO_CLASS_BT_B
	.comm	_REG_MD_STAT,4,2                ## @REG_MD_STAT
	.comm	_REG_EN_INTRD,4,2               ## @REG_EN_INTRD
	.no_dead_strip	_btsdio_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function btsdio_open
_btsdio_open:                           ; @btsdio_open
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x20, x0
	ldr	x21, [x0, #8]
	ldr	w1, [x0, #4]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_BT_DBG
Lloh2:
	adrp	x22, _HCI_RUNNING@GOTPAGE
Lloh3:
	ldr	x22, [x22, _HCI_RUNNING@GOTPAGEOFF]
	ldr	w0, [x22]
	mov	x1, x20
	bl	_test_and_set_bit
	cbz	x0, LBB0_2
; %bb.1:
	mov	w19, #0
	b	LBB0_11
LBB0_2:
	ldr	x0, [x21]
	bl	_sdio_claim_host
	ldr	x0, [x21]
	bl	_sdio_enable_func
	tbnz	w0, #31, LBB0_7
; %bb.3:
	ldr	x0, [x21]
Lloh4:
	adrp	x8, _btsdio_interrupt@GOTPAGE
Lloh5:
	ldr	x8, [x8, _btsdio_interrupt@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	bl	_sdio_claim_irq
	mov	x19, x0
	ldr	x0, [x21]
	tbnz	w19, #31, LBB0_8
; %bb.4:
	ldr	x8, [x0]
Lloh7:
	adrp	x9, _SDIO_CLASS_BT_B@GOTPAGE
Lloh8:
	ldr	x9, [x9, _SDIO_CLASS_BT_B@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_6
; %bb.5:
Lloh10:
	adrp	x8, _REG_MD_STAT@GOTPAGE
Lloh11:
	ldr	x8, [x8, _REG_MD_STAT@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
	mov	w1, #0
	mov	x3, #0
	bl	_sdio_writeb
	ldr	x0, [x21]
LBB0_6:
Lloh13:
	adrp	x8, _REG_EN_INTRD@GOTPAGE
Lloh14:
	ldr	x8, [x8, _REG_EN_INTRD@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
	mov	w1, #1
	mov	x3, #0
	bl	_sdio_writeb
	b	LBB0_10
LBB0_7:
	mov	x19, x0
	b	LBB0_9
LBB0_8:
	bl	_sdio_disable_func
LBB0_9:
	ldr	w0, [x22]
	mov	x1, x20
	bl	_clear_bit
LBB0_10:
	ldr	x0, [x21]
	bl	_sdio_release_host
LBB0_11:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s"

	.comm	_HCI_RUNNING,4,2                ; @HCI_RUNNING
	.comm	_btsdio_interrupt,4,2           ; @btsdio_interrupt
	.comm	_SDIO_CLASS_BT_B,8,3            ; @SDIO_CLASS_BT_B
	.comm	_REG_MD_STAT,4,2                ; @REG_MD_STAT
	.comm	_REG_EN_INTRD,4,2               ; @REG_EN_INTRD
	.no_dead_strip	_btsdio_open
.subsections_via_symbols
