	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hci_switch_role
_hci_switch_role:                       ## @hci_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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$536, %rsp                      ## imm = 0x218
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	cmpl	$2, %esi
	jne	LBB0_3
## %bb.1:
	movq	%rdx, %rbx
	movl	%edi, %r14d
	movq	(%rdx), %rdi
	leaq	-572(%rbp), %r15
	movq	%r15, %rsi
	callq	_bt_aton
	testl	%eax, %eax
	jne	LBB0_5
## %bb.2:
	movq	(%rbx), %rdi
	callq	_bt_gethostbyname
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	$4, %edx
	callq	_memcpy
LBB0_5:
	movq	8(%rbx), %rdi
	leaq	L_.str(%rip), %rsi
	leaq	-564(%rbp), %rdx
	callq	_sscanf
	cmpl	$1, %eax
	jne	LBB0_3
## %bb.6:
	cmpl	$0, -564(%rbp)
	jne	LBB0_7
## %bb.8:
	movq	_NG_HCI_ROLE_MASTER@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_3:
	movq	_USAGE@GOTPCREL(%rip), %rax
LBB0_21:
	movl	(%rax), %eax
LBB0_22:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_25
## %bb.23:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$536, %rsp                      ## imm = 0x218
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_NG_HCI_ROLE_SLAVE@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %eax
	movl	%eax, -576(%rbp)
	movl	$512, -564(%rbp)                ## imm = 0x200
	movq	_NG_HCI_OGF_LINK_POLICY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_NG_HCI_OCF_SWITCH_ROLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_NG_HCI_OPCODE
	leaq	-576(%rbp), %rdx
	leaq	-560(%rbp), %r8
	leaq	-564(%rbp), %r9
	movl	%r14d, %edi
	movl	%eax, %esi
	movl	$8, %ecx
	callq	_hci_request
	movq	_ERROR@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rax
	je	LBB0_22
## %bb.10:
	cmpb	$0, -560(%rbp)
	je	LBB0_11
## %bb.24:
	movq	_FAILED@GOTPCREL(%rip), %rax
	jmp	LBB0_21
LBB0_11:
	leaq	-560(%rbp), %r15
	leaq	-564(%rbp), %r12
	movq	_NG_HCI_EVENT_ROLE_CHANGE@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movl	$512, -564(%rbp)                ## imm = 0x200
	movl	%r14d, %edi
	movq	%r15, %rsi
	movq	%r12, %rdx
	callq	_hci_recv
	movq	(%rbx), %rcx
	cmpq	%rcx, %rax
	je	LBB0_22
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	cmpl	$7, -564(%rbp)
	jbe	LBB0_14
## %bb.15:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	-560(%rbp), %rax
	cmpq	(%r13), %rax
	jne	LBB0_12
## %bb.16:
	movl	-552(%rbp), %ebx
	movq	_stdout@GOTPCREL(%rip), %r15
	movl	(%r15), %r14d
	testl	%ebx, %ebx
	je	LBB0_18
## %bb.17:
	movl	%ebx, %edi
	callq	_hci_status2str
	movl	-552(%rbp), %ecx
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	_fprintf
	movq	_FAILED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_19
LBB0_14:
	movq	_EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_errno@GOTPCREL(%rip), %rdx
	movl	%eax, (%rdx)
	movl	%ecx, %eax
	jmp	LBB0_22
LBB0_18:
	leaq	-544(%rbp), %rdi
	callq	_hci_bdaddr2str
	leaq	L_.str.2(%rip), %rsi
	movl	%r14d, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	_fprintf
	movl	(%r15), %edi
	movl	-548(%rbp), %ecx
	movq	_NG_HCI_ROLE_MASTER@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ecx
	leaq	L_.str.4(%rip), %rax
	leaq	L_.str.5(%rip), %rdx
	cmoveq	%rax, %rdx
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf
                                        ## implicit-def: $eax
LBB0_19:
	testl	%ebx, %ebx
	jne	LBB0_22
## %bb.20:
	movq	_OK@GOTPCREL(%rip), %rax
	jmp	LBB0_21
LBB0_25:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_USAGE,4,2                      ## @USAGE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%d"

	.comm	_NG_HCI_ROLE_SLAVE,4,2          ## @NG_HCI_ROLE_SLAVE
	.comm	_NG_HCI_ROLE_MASTER,4,2         ## @NG_HCI_ROLE_MASTER
	.comm	_NG_HCI_OGF_LINK_POLICY,4,2     ## @NG_HCI_OGF_LINK_POLICY
	.comm	_NG_HCI_OCF_SWITCH_ROLE,4,2     ## @NG_HCI_OCF_SWITCH_ROLE
	.comm	_ERROR,8,3                      ## @ERROR
	.comm	_FAILED,4,2                     ## @FAILED
	.comm	_EIO,4,2                        ## @EIO
	.comm	_errno,4,2                      ## @errno
	.comm	_NG_HCI_EVENT_ROLE_CHANGE,8,3   ## @NG_HCI_EVENT_ROLE_CHANGE
	.comm	_stdout,4,2                     ## @stdout
L_.str.1:                               ## @.str.1
	.asciz	"Status: %s [%#02x]\n"

L_.str.2:                               ## @.str.2
	.asciz	"BD_ADDR: %s\n"

L_.str.3:                               ## @.str.3
	.asciz	"Role: %s [%#x]\n"

L_.str.4:                               ## @.str.4
	.asciz	"Master"

L_.str.5:                               ## @.str.5
	.asciz	"Slave"

	.comm	_OK,4,2                         ## @OK
	.no_dead_strip	_hci_switch_role
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hci_switch_role
_hci_switch_role:                       ; @hci_switch_role
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	sub	sp, sp, #544
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-56]
	cmp	w1, #2
	b.ne	LBB0_8
; %bb.1:
	mov	x20, x2
	mov	x19, x0
	ldr	x0, [x2]
	add	x8, sp, #8
	orr	x21, x8, #0x4
	mov	x1, x21
	bl	_bt_aton
	cbnz	w0, LBB0_4
; %bb.2:
	ldr	x0, [x20]
	bl	_bt_gethostbyname
	cbz	x0, LBB0_8
; %bb.3:
	ldr	w1, [x0]
	mov	x0, x21
	mov	w2, #4
	bl	_memcpy
LBB0_4:
	ldr	x0, [x20, #8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	add	x2, sp, #20
	bl	_sscanf
	cmp	w0, #1
	b.ne	LBB0_8
; %bb.5:
	ldr	w8, [sp, #20]
Lloh5:
	adrp	x9, _NG_HCI_ROLE_SLAVE@GOTPAGE
Lloh6:
	ldr	x9, [x9, _NG_HCI_ROLE_SLAVE@GOTPAGEOFF]
Lloh7:
	adrp	x21, _NG_HCI_ROLE_MASTER@GOTPAGE
Lloh8:
	ldr	x21, [x21, _NG_HCI_ROLE_MASTER@GOTPAGEOFF]
	cmp	w8, #0
	csel	x8, x21, x9, eq
	ldr	w8, [x8]
	str	w8, [sp, #8]
	mov	w8, #512
	str	w8, [sp, #20]
Lloh9:
	adrp	x8, _NG_HCI_OGF_LINK_POLICY@GOTPAGE
Lloh10:
	ldr	x8, [x8, _NG_HCI_OGF_LINK_POLICY@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
Lloh12:
	adrp	x8, _NG_HCI_OCF_SWITCH_ROLE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _NG_HCI_OCF_SWITCH_ROLE@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	bl	_NG_HCI_OPCODE
	mov	x1, x0
	add	x2, sp, #8
	add	x4, sp, #24
	add	x5, sp, #20
	mov	x0, x19
	mov	w3, #8
	bl	_hci_request
Lloh15:
	adrp	x20, _ERROR@GOTPAGE
Lloh16:
	ldr	x20, [x20, _ERROR@GOTPAGEOFF]
	ldr	x8, [x20]
	cmp	x0, x8
	b.eq	LBB0_10
; %bb.6:
	ldrb	w8, [sp, #24]
	cbz	w8, LBB0_12
; %bb.7:
Lloh17:
	adrp	x8, _FAILED@GOTPAGE
Lloh18:
	ldr	x8, [x8, _FAILED@GOTPAGEOFF]
	b	LBB0_9
LBB0_8:
Lloh19:
	adrp	x8, _USAGE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _USAGE@GOTPAGEOFF]
LBB0_9:
	ldr	w0, [x8]
LBB0_10:
	ldur	x8, [x29, #-56]
Lloh21:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh22:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_22
; %bb.11:
                                        ; kill: def $w0 killed $w0 killed $x0
	add	sp, sp, #544
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_12:
	mov	w22, #512
Lloh24:
	adrp	x23, _NG_HCI_EVENT_ROLE_CHANGE@GOTPAGE
Lloh25:
	ldr	x23, [x23, _NG_HCI_EVENT_ROLE_CHANGE@GOTPAGEOFF]
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	str	w22, [sp, #20]
	add	x1, sp, #24
	add	x2, sp, #20
	mov	x0, x19
	bl	_hci_recv
	ldr	x8, [x20]
	cmp	x0, x8
	b.eq	LBB0_18
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	w9, [sp, #20]
	cmp	w9, #7
	b.ls	LBB0_19
; %bb.15:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	x8, [sp, #24]
	ldr	x9, [x23]
	cmp	x8, x9
	b.ne	LBB0_13
; %bb.16:
	ldr	w19, [sp, #32]
Lloh26:
	adrp	x22, _stdout@GOTPAGE
Lloh27:
	ldr	x22, [x22, _stdout@GOTPAGEOFF]
	ldr	w20, [x22]
	cbz	w19, LBB0_20
; %bb.17:
	mov	x0, x19
	bl	_hci_status2str
	mov	x2, x0
	ldr	w8, [sp, #32]
	str	x8, [sp]
Lloh28:
	adrp	x1, l_.str.1@PAGE
Lloh29:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_fprintf
Lloh30:
	adrp	x8, _FAILED@GOTPAGE
Lloh31:
	ldr	x8, [x8, _FAILED@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	b	LBB0_21
LBB0_18:
                                        ; kill: def $w0 killed $w0 killed $x0 def $x0
	b	LBB0_10
LBB0_19:
Lloh33:
	adrp	x9, _EIO@GOTPAGE
Lloh34:
	ldr	x9, [x9, _EIO@GOTPAGEOFF]
Lloh35:
	ldr	w9, [x9]
Lloh36:
	adrp	x10, _errno@GOTPAGE
Lloh37:
	ldr	x10, [x10, _errno@GOTPAGEOFF]
Lloh38:
	str	w9, [x10]
	mov	x0, x8
	b	LBB0_10
LBB0_20:
	add	x8, sp, #24
	add	x0, x8, #16
	bl	_hci_bdaddr2str
	mov	x2, x0
Lloh39:
	adrp	x1, l_.str.2@PAGE
Lloh40:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_fprintf
	ldr	w0, [x22]
	ldr	w8, [sp, #36]
	ldr	w9, [x21]
Lloh41:
	adrp	x10, l_.str.5@PAGE
Lloh42:
	add	x10, x10, l_.str.5@PAGEOFF
Lloh43:
	adrp	x11, l_.str.4@PAGE
Lloh44:
	add	x11, x11, l_.str.4@PAGEOFF
	cmp	w8, w9
	csel	x2, x11, x10, eq
	str	x8, [sp]
Lloh45:
	adrp	x1, l_.str.3@PAGE
Lloh46:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_fprintf
                                        ; implicit-def: $w8
LBB0_21:
Lloh47:
	adrp	x9, _OK@GOTPAGE
Lloh48:
	ldr	x9, [x9, _OK@GOTPAGEOFF]
Lloh49:
	ldr	w9, [x9]
	cmp	w19, #0
	csel	w0, w9, w8, eq
	b	LBB0_10
LBB0_22:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGotStr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpAdd	Lloh45, Lloh46
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpAdd	Lloh41, Lloh42
	.loh AdrpAdd	Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh49
	.cfi_endproc
                                        ; -- End function
	.comm	_USAGE,4,2                      ; @USAGE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%d"

	.comm	_NG_HCI_ROLE_SLAVE,4,2          ; @NG_HCI_ROLE_SLAVE
	.comm	_NG_HCI_ROLE_MASTER,4,2         ; @NG_HCI_ROLE_MASTER
	.comm	_NG_HCI_OGF_LINK_POLICY,4,2     ; @NG_HCI_OGF_LINK_POLICY
	.comm	_NG_HCI_OCF_SWITCH_ROLE,4,2     ; @NG_HCI_OCF_SWITCH_ROLE
	.comm	_ERROR,8,3                      ; @ERROR
	.comm	_FAILED,4,2                     ; @FAILED
	.comm	_EIO,4,2                        ; @EIO
	.comm	_errno,4,2                      ; @errno
	.comm	_NG_HCI_EVENT_ROLE_CHANGE,8,3   ; @NG_HCI_EVENT_ROLE_CHANGE
	.comm	_stdout,4,2                     ; @stdout
l_.str.1:                               ; @.str.1
	.asciz	"Status: %s [%#02x]\n"

l_.str.2:                               ; @.str.2
	.asciz	"BD_ADDR: %s\n"

l_.str.3:                               ; @.str.3
	.asciz	"Role: %s [%#x]\n"

l_.str.4:                               ; @.str.4
	.asciz	"Master"

l_.str.5:                               ; @.str.5
	.asciz	"Slave"

	.comm	_OK,4,2                         ; @OK
	.no_dead_strip	_hci_switch_role
.subsections_via_symbols
