	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hci_conn_switch_role           ## -- Begin function hci_conn_switch_role
	.p2align	4, 0x90
_hci_conn_switch_role:                  ## @hci_conn_switch_role
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %rbx
	leaq	L_.str(%rip), %rdi
	movq	%rbx, %rsi
	callq	_BT_DBG
	testq	%r14, %r14
	je	LBB0_1
LBB0_2:
	movq	_HCI_CONN_RSWITCH_PEND@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	12(%rbx), %rsi
	callq	_test_and_set_bit
	xorl	%r15d, %r15d
	testl	%eax, %eax
	jne	LBB0_4
## %bb.3:
	leaq	-32(%rbp), %rdi
	leaq	8(%rbx), %rsi
	callq	_bacpy
	movq	%r14, -40(%rbp)
	movl	4(%rbx), %edi
	movq	_HCI_OP_SWITCH_ROLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-40(%rbp), %rcx
	movl	$16, %edx
	callq	_hci_send_cmd
	jmp	LBB0_4
LBB0_1:
	movq	_HCI_LM_MASTER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	$1, %r15d
	testl	%eax, (%rbx)
	je	LBB0_2
LBB0_4:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"conn %p"

	.comm	_HCI_LM_MASTER,4,2              ## @HCI_LM_MASTER
	.comm	_HCI_CONN_RSWITCH_PEND,4,2      ## @HCI_CONN_RSWITCH_PEND
	.comm	_HCI_OP_SWITCH_ROLE,4,2         ## @HCI_OP_SWITCH_ROLE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hci_conn_switch_role           ; -- Begin function hci_conn_switch_role
	.p2align	2
_hci_conn_switch_role:                  ; @hci_conn_switch_role
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_BT_DBG
	cbz	x20, LBB0_4
LBB0_1:
Lloh2:
	adrp	x8, _HCI_CONN_RSWITCH_PEND@GOTPAGE
Lloh3:
	ldr	x8, [x8, _HCI_CONN_RSWITCH_PEND@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	add	x1, x19, #12
	bl	_test_and_set_bit
	cbnz	w0, LBB0_3
; %bb.2:
	mov	x8, sp
	add	x0, x8, #8
	add	x1, x19, #8
	bl	_bacpy
	str	x20, [sp]
	ldr	w0, [x19, #4]
Lloh5:
	adrp	x8, _HCI_OP_SWITCH_ROLE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _HCI_OP_SWITCH_ROLE@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x3, sp
	mov	w2, #16
	bl	_hci_send_cmd
LBB0_3:
	mov	w0, #0
	b	LBB0_6
LBB0_4:
	ldr	w8, [x19]
Lloh8:
	adrp	x9, _HCI_LM_MASTER@GOTPAGE
Lloh9:
	ldr	x9, [x9, _HCI_LM_MASTER@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_1
; %bb.5:
	mov	w0, #1
LBB0_6:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"conn %p"

	.comm	_HCI_LM_MASTER,4,2              ; @HCI_LM_MASTER
	.comm	_HCI_CONN_RSWITCH_PEND,4,2      ; @HCI_CONN_RSWITCH_PEND
	.comm	_HCI_OP_SWITCH_ROLE,4,2         ; @HCI_OP_SWITCH_ROLE
.subsections_via_symbols
