	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bluecard_close
_bluecard_close:                        ## @bluecard_close
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	8(%rdi), %r14
	testq	%r14, %r14
	je	LBB0_1
## %bb.2:
	movq	%rdi, %rbx
	movq	16(%rdi), %rax
	movl	(%rax), %r15d
	movq	%r14, %rdi
	callq	_bluecard_hci_close
	movq	_CARD_READY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	4(%rbx), %rsi
	callq	_clear_bit
	movq	_REG_CONTROL_BT_RESET@GOTPCREL(%rip), %rax
	movq	_REG_CONTROL_CARD_RESET@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	movl	%edi, (%rbx)
	movq	_REG_CONTROL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	addl	%r15d, %esi
	callq	_outb
	addl	$48, %r15d
	movl	$128, %edi
	movl	%r15d, %esi
	callq	_outb
	movq	%r14, %rdi
	callq	_hci_unregister_dev
	testq	%rax, %rax
	jns	LBB0_4
## %bb.3:
	movl	(%r14), %esi
	leaq	L_.str(%rip), %rdi
	callq	_BT_ERR
LBB0_4:
	movq	%r14, %rdi
	callq	_hci_free_dev
	xorl	%eax, %eax
	jmp	LBB0_5
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_5:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_CARD_READY,4,2                 ## @CARD_READY
	.comm	_REG_CONTROL_BT_RESET,4,2       ## @REG_CONTROL_BT_RESET
	.comm	_REG_CONTROL_CARD_RESET,4,2     ## @REG_CONTROL_CARD_RESET
	.comm	_REG_CONTROL,4,2                ## @REG_CONTROL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Can't unregister HCI device %s"

	.no_dead_strip	_bluecard_close
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bluecard_close
_bluecard_close:                        ; @bluecard_close
	.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
	ldr	x19, [x0, #8]
	cbz	x19, LBB0_4
; %bb.1:
	mov	x20, x0
	ldr	x8, [x0, #16]
	ldr	w21, [x8]
	mov	x0, x19
	bl	_bluecard_hci_close
Lloh0:
	adrp	x8, _CARD_READY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CARD_READY@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	add	x1, x20, #4
	bl	_clear_bit
Lloh3:
	adrp	x8, _REG_CONTROL_BT_RESET@GOTPAGE
Lloh4:
	ldr	x8, [x8, _REG_CONTROL_BT_RESET@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _REG_CONTROL_CARD_RESET@GOTPAGE
Lloh7:
	ldr	x9, [x9, _REG_CONTROL_CARD_RESET@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w0, w9, w8
	str	w0, [x20]
Lloh9:
	adrp	x8, _REG_CONTROL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _REG_CONTROL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	add	w1, w8, w21
	bl	_outb
	add	w1, w21, #48
	mov	w0, #128
	bl	_outb
	mov	x0, x19
	bl	_hci_unregister_dev
	tbz	x0, #63, LBB0_3
; %bb.2:
	ldr	w1, [x19]
Lloh12:
	adrp	x0, l_.str@PAGE
Lloh13:
	add	x0, x0, l_.str@PAGEOFF
	bl	_BT_ERR
LBB0_3:
	mov	x0, x19
	bl	_hci_free_dev
	mov	w0, #0
	b	LBB0_5
LBB0_4:
Lloh14:
	adrp	x8, _ENODEV@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_5:
	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 AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_CARD_READY,4,2                 ; @CARD_READY
	.comm	_REG_CONTROL_BT_RESET,4,2       ; @REG_CONTROL_BT_RESET
	.comm	_REG_CONTROL_CARD_RESET,4,2     ; @REG_CONTROL_CARD_RESET
	.comm	_REG_CONTROL,4,2                ; @REG_CONTROL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Can't unregister HCI device %s"

	.no_dead_strip	_bluecard_close
.subsections_via_symbols
