	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function find_hci_nodes
_find_hci_nodes:                        ## @find_hci_nodes
	.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	$40, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	_MAX_NODE_NUM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%edi, -56(%rbp)
	movl	$4, %esi
	callq	_calloc
	movq	%rax, -48(%rbp)
	testq	%rax, %rax
	jne	LBB0_2
## %bb.1:
	leaq	L_.str.1(%rip), %rsi
	movl	$8, %edi
	callq	_err
LBB0_2:
	movq	_PF_BLUETOOTH@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_SOCK_RAW@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_BLUETOOTH_PROTO_HCI@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_socket
	movl	%eax, %ebx
	testl	%eax, %eax
	jns	LBB0_4
## %bb.3:
	leaq	L_.str.2(%rip), %rsi
	movl	$9, %edi
	callq	_err
LBB0_4:
	leaq	-40(%rbp), %r15
	movq	%r15, %rdi
	xorl	%esi, %esi
	movl	$12, %edx
	callq	_memset
	movl	$12, -40(%rbp)
	movq	_AF_BLUETOOTH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %edi
	leaq	L_.str(%rip), %rsi
	movl	$4, %edx
	callq	_strncpy
	movl	%ebx, %edi
	movq	%r15, %rsi
	movl	$12, %edx
	callq	_bind
	testq	%rax, %rax
	jns	LBB0_6
## %bb.5:
	leaq	L_.str.3(%rip), %rsi
	movl	$10, %edi
	callq	_err
LBB0_6:
	movq	_SIOC_HCI_RAW_NODE_LIST_NAMES@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-56(%rbp), %rdx
	movl	%ebx, %edi
	movl	$16, %ecx
	callq	_ioctl
	testq	%rax, %rax
	jns	LBB0_8
## %bb.7:
	leaq	L_.str.4(%rip), %rsi
	movl	$11, %edi
	callq	_err
LBB0_8:
	movl	%ebx, %edi
	callq	_close
	movq	-48(%rbp), %rax
	movq	%rax, (%r14)
	movl	-56(%rbp), %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ubt0hci"

	.comm	_MAX_NODE_NUM,4,2               ## @MAX_NODE_NUM
L_.str.1:                               ## @.str.1
	.asciz	"Could not allocate memory"

	.comm	_PF_BLUETOOTH,4,2               ## @PF_BLUETOOTH
	.comm	_SOCK_RAW,4,2                   ## @SOCK_RAW
	.comm	_BLUETOOTH_PROTO_HCI,4,2        ## @BLUETOOTH_PROTO_HCI
L_.str.2:                               ## @.str.2
	.asciz	"Could not create socket"

	.comm	_AF_BLUETOOTH,4,2               ## @AF_BLUETOOTH
L_.str.3:                               ## @.str.3
	.asciz	"Could not bind socket"

	.comm	_SIOC_HCI_RAW_NODE_LIST_NAMES,4,2 ## @SIOC_HCI_RAW_NODE_LIST_NAMES
L_.str.4:                               ## @.str.4
	.asciz	"Could not get list of HCI nodes"

	.no_dead_strip	_find_hci_nodes
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function find_hci_nodes
_find_hci_nodes:                        ; @find_hci_nodes
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x19, x0
Lloh0:
	adrp	x8, _MAX_NODE_NUM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_NODE_NUM@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	str	w0, [sp, #16]
	mov	w1, #4
	bl	_calloc
	str	x0, [sp, #24]
	cbnz	x0, LBB0_2
; %bb.1:
Lloh3:
	adrp	x1, l_.str.1@PAGE
Lloh4:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #8
	bl	_err
LBB0_2:
Lloh5:
	adrp	x8, _PF_BLUETOOTH@GOTPAGE
Lloh6:
	ldr	x8, [x8, _PF_BLUETOOTH@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
Lloh8:
	adrp	x8, _SOCK_RAW@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SOCK_RAW@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
Lloh11:
	adrp	x8, _BLUETOOTH_PROTO_HCI@GOTPAGE
Lloh12:
	ldr	x8, [x8, _BLUETOOTH_PROTO_HCI@GOTPAGEOFF]
Lloh13:
	ldr	w2, [x8]
	bl	_socket
	mov	x20, x0
	tbz	w0, #31, LBB0_4
; %bb.3:
Lloh14:
	adrp	x1, l_.str.2@PAGE
Lloh15:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #9
	bl	_err
LBB0_4:
	mov	w21, #12
	mov	x0, sp
	mov	w1, #0
	mov	w2, #12
	bl	_memset
Lloh16:
	adrp	x8, _AF_BLUETOOTH@GOTPAGE
Lloh17:
	ldr	x8, [x8, _AF_BLUETOOTH@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	str	w21, [sp]
	str	w8, [sp, #8]
	ldr	w0, [sp, #4]
Lloh19:
	adrp	x1, l_.str@PAGE
Lloh20:
	add	x1, x1, l_.str@PAGEOFF
	mov	w2, #4
	bl	_strncpy
	mov	x1, sp
	mov	x0, x20
	mov	w2, #12
	bl	_bind
	tbz	x0, #63, LBB0_6
; %bb.5:
Lloh21:
	adrp	x1, l_.str.3@PAGE
Lloh22:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #10
	bl	_err
LBB0_6:
Lloh23:
	adrp	x8, _SIOC_HCI_RAW_NODE_LIST_NAMES@GOTPAGE
Lloh24:
	ldr	x8, [x8, _SIOC_HCI_RAW_NODE_LIST_NAMES@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	add	x2, sp, #16
	mov	x0, x20
	mov	w3, #16
	bl	_ioctl
	tbz	x0, #63, LBB0_8
; %bb.7:
Lloh26:
	adrp	x1, l_.str.4@PAGE
Lloh27:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	w0, #11
	bl	_err
LBB0_8:
	mov	x0, x20
	bl	_close
	ldr	x8, [sp, #24]
	str	x8, [x19]
	ldr	w0, [sp, #16]
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ubt0hci"

	.comm	_MAX_NODE_NUM,4,2               ; @MAX_NODE_NUM
l_.str.1:                               ; @.str.1
	.asciz	"Could not allocate memory"

	.comm	_PF_BLUETOOTH,4,2               ; @PF_BLUETOOTH
	.comm	_SOCK_RAW,4,2                   ; @SOCK_RAW
	.comm	_BLUETOOTH_PROTO_HCI,4,2        ; @BLUETOOTH_PROTO_HCI
l_.str.2:                               ; @.str.2
	.asciz	"Could not create socket"

	.comm	_AF_BLUETOOTH,4,2               ; @AF_BLUETOOTH
l_.str.3:                               ; @.str.3
	.asciz	"Could not bind socket"

	.comm	_SIOC_HCI_RAW_NODE_LIST_NAMES,4,2 ; @SIOC_HCI_RAW_NODE_LIST_NAMES
l_.str.4:                               ; @.str.4
	.asciz	"Could not get list of HCI nodes"

	.no_dead_strip	_find_hci_nodes
.subsections_via_symbols
