	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hci_role_discovery
_hci_role_discovery:                    ## @hci_role_discovery
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	cmpl	$1, %esi
	jne	LBB0_4
## %bb.1:
	movl	%edi, %ebx
	movq	(%rdx), %rdi
	leaq	L_.str(%rip), %rsi
	leaq	-20(%rbp), %rdx
	callq	_sscanf
	cmpl	$1, %eax
	jne	LBB0_4
## %bb.2:
	movl	-20(%rbp), %edi
	testl	%edi, %edi
	jle	LBB0_4
## %bb.3:
	cmpl	$3840, %edi                     ## imm = 0xF00
	jge	LBB0_4
## %bb.5:
	callq	_htole16
	movl	%eax, -24(%rbp)
	movl	$12, -20(%rbp)
	movq	_NG_HCI_OGF_LINK_POLICY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_NG_HCI_OCF_ROLE_DISCOVERY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_NG_HCI_OPCODE
	leaq	-24(%rbp), %rdx
	leaq	-40(%rbp), %r8
	leaq	-20(%rbp), %r9
	movl	%ebx, %edi
	movl	%eax, %esi
	movl	$4, %ecx
	callq	_hci_request
	movq	_ERROR@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_10
## %bb.6:
	movl	-40(%rbp), %edi
	movq	_stdout@GOTPCREL(%rip), %r14
	movl	(%r14), %ebx
	testl	%edi, %edi
	je	LBB0_8
## %bb.7:
	callq	_hci_status2str
	movl	-40(%rbp), %ecx
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	_fprintf
	movq	_FAILED@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_4:
	movq	_USAGE@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %eax
LBB0_10:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$32, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_8:
	movl	-32(%rbp), %edi
	callq	_le16toh
	leaq	L_.str.2(%rip), %rsi
	movl	%ebx, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_fprintf
	movl	(%r14), %edi
	movl	-36(%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
	movq	_OK@GOTPCREL(%rip), %rax
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%d"

	.comm	_USAGE,4,2                      ## @USAGE
	.comm	_NG_HCI_OGF_LINK_POLICY,4,2     ## @NG_HCI_OGF_LINK_POLICY
	.comm	_NG_HCI_OCF_ROLE_DISCOVERY,4,2  ## @NG_HCI_OCF_ROLE_DISCOVERY
	.comm	_ERROR,8,3                      ## @ERROR
	.comm	_stdout,4,2                     ## @stdout
L_.str.1:                               ## @.str.1
	.asciz	"Status: %s [%#02x]\n"

	.comm	_FAILED,4,2                     ## @FAILED
L_.str.2:                               ## @.str.2
	.asciz	"Connection handle: %d\n"

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

	.comm	_NG_HCI_ROLE_MASTER,4,2         ## @NG_HCI_ROLE_MASTER
L_.str.4:                               ## @.str.4
	.asciz	"Master"

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

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

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hci_role_discovery
_hci_role_discovery:                    ; @hci_role_discovery
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	cmp	w1, #1
	b.ne	LBB0_6
; %bb.1:
	mov	x19, x0
	ldr	x0, [x2]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	add	x2, sp, #20
	bl	_sscanf
	mov	x8, x0
	ldr	w0, [sp, #20]
	cmp	w8, #1
	ccmp	w0, #1, #8, eq
	b.lt	LBB0_6
; %bb.2:
	cmp	w0, #3840
	b.ge	LBB0_6
; %bb.3:
	bl	_htole16
	stur	w0, [x29, #-24]
	mov	w8, #12
	str	w8, [sp, #20]
Lloh2:
	adrp	x8, _NG_HCI_OGF_LINK_POLICY@GOTPAGE
Lloh3:
	ldr	x8, [x8, _NG_HCI_OGF_LINK_POLICY@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
Lloh5:
	adrp	x8, _NG_HCI_OCF_ROLE_DISCOVERY@GOTPAGE
Lloh6:
	ldr	x8, [x8, _NG_HCI_OCF_ROLE_DISCOVERY@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	bl	_NG_HCI_OPCODE
	mov	x1, x0
	sub	x2, x29, #24
	add	x4, sp, #24
	add	x5, sp, #20
	mov	x0, x19
	mov	w3, #4
	bl	_hci_request
Lloh8:
	adrp	x8, _ERROR@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ERROR@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	cmp	x0, x8
	b.eq	LBB0_8
; %bb.4:
	ldr	w0, [sp, #24]
Lloh11:
	adrp	x20, _stdout@GOTPAGE
Lloh12:
	ldr	x20, [x20, _stdout@GOTPAGEOFF]
	ldr	w19, [x20]
	cbz	w0, LBB0_9
; %bb.5:
	bl	_hci_status2str
	ldr	w8, [sp, #24]
	stp	x0, x8, [sp]
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_fprintf
Lloh15:
	adrp	x8, _FAILED@GOTPAGE
Lloh16:
	ldr	x8, [x8, _FAILED@GOTPAGEOFF]
	b	LBB0_7
LBB0_6:
Lloh17:
	adrp	x8, _USAGE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _USAGE@GOTPAGEOFF]
LBB0_7:
	ldr	w0, [x8]
LBB0_8:
                                        ; kill: def $w0 killed $w0 killed $x0
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_9:
	ldr	w0, [sp, #32]
	bl	_le16toh
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh19:
	adrp	x1, l_.str.2@PAGE
Lloh20:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_fprintf
	ldr	w0, [x20]
	ldr	w8, [sp, #28]
Lloh21:
	adrp	x9, _NG_HCI_ROLE_MASTER@GOTPAGE
Lloh22:
	ldr	x9, [x9, _NG_HCI_ROLE_MASTER@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
Lloh24:
	adrp	x10, l_.str.5@PAGE
Lloh25:
	add	x10, x10, l_.str.5@PAGEOFF
Lloh26:
	adrp	x11, l_.str.4@PAGE
Lloh27:
	add	x11, x11, l_.str.4@PAGEOFF
	cmp	w8, w9
	csel	x9, x11, x10, eq
	stp	x9, x8, [sp]
Lloh28:
	adrp	x1, l_.str.3@PAGE
Lloh29:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_fprintf
Lloh30:
	adrp	x8, _OK@GOTPAGE
Lloh31:
	ldr	x8, [x8, _OK@GOTPAGEOFF]
	b	LBB0_7
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%d"

	.comm	_USAGE,4,2                      ; @USAGE
	.comm	_NG_HCI_OGF_LINK_POLICY,4,2     ; @NG_HCI_OGF_LINK_POLICY
	.comm	_NG_HCI_OCF_ROLE_DISCOVERY,4,2  ; @NG_HCI_OCF_ROLE_DISCOVERY
	.comm	_ERROR,8,3                      ; @ERROR
	.comm	_stdout,4,2                     ; @stdout
l_.str.1:                               ; @.str.1
	.asciz	"Status: %s [%#02x]\n"

	.comm	_FAILED,4,2                     ; @FAILED
l_.str.2:                               ; @.str.2
	.asciz	"Connection handle: %d\n"

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

	.comm	_NG_HCI_ROLE_MASTER,4,2         ; @NG_HCI_ROLE_MASTER
l_.str.4:                               ; @.str.4
	.asciz	"Master"

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

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