	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ng_btsocket_hci_raw_detach     ## -- Begin function ng_btsocket_hci_raw_detach
	.p2align	4, 0x90
_ng_btsocket_hci_raw_detach:            ## @ng_btsocket_hci_raw_detach
	.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	%rdi, %r14
	callq	_so2hci_raw_pcb
	movq	%rax, %rbx
	xorl	%edi, %edi
	testq	%rax, %rax
	setne	%dil
	leaq	L_.str(%rip), %rsi
	callq	_KASSERT
	movq	_ng_btsocket_hci_raw_node@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_2
## %bb.1:
	movq	_ng_btsocket_hci_raw_sockets_mtx@GOTPCREL(%rip), %r15
	movq	%r15, %rdi
	callq	_mtx_lock
	movq	%rbx, %rdi
	callq	_mtx_lock
	movq	_next@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_LIST_REMOVE
	movq	%rbx, %rdi
	callq	_mtx_unlock
	movq	%r15, %rdi
	callq	_mtx_unlock
	movq	%rbx, %rdi
	callq	_mtx_destroy
	movq	%rbx, %rdi
	movl	$4, %esi
	callq	_bzero
	movq	_M_NETGRAPH_BTSOCKET_HCI_RAW@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_free
	movq	$0, (%r14)
LBB0_2:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ng_btsocket_hci_raw_detach: pcb == NULL"

	.comm	_ng_btsocket_hci_raw_node,8,3   ## @ng_btsocket_hci_raw_node
	.comm	_ng_btsocket_hci_raw_sockets_mtx,4,2 ## @ng_btsocket_hci_raw_sockets_mtx
	.comm	_next,4,2                       ## @next
	.comm	_M_NETGRAPH_BTSOCKET_HCI_RAW,4,2 ## @M_NETGRAPH_BTSOCKET_HCI_RAW
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ng_btsocket_hci_raw_detach     ; -- Begin function ng_btsocket_hci_raw_detach
	.p2align	2
_ng_btsocket_hci_raw_detach:            ; @ng_btsocket_hci_raw_detach
	.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
	mov	x19, x0
	bl	_so2hci_raw_pcb
	mov	x20, x0
	cmp	x0, #0
	cset	w0, ne
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_KASSERT
Lloh2:
	adrp	x8, _ng_btsocket_hci_raw_node@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ng_btsocket_hci_raw_node@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cbz	x8, LBB0_2
; %bb.1:
Lloh5:
	adrp	x21, _ng_btsocket_hci_raw_sockets_mtx@GOTPAGE
Lloh6:
	ldr	x21, [x21, _ng_btsocket_hci_raw_sockets_mtx@GOTPAGEOFF]
	mov	x0, x21
	bl	_mtx_lock
	mov	x0, x20
	bl	_mtx_lock
Lloh7:
	adrp	x8, _next@GOTPAGE
Lloh8:
	ldr	x8, [x8, _next@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_LIST_REMOVE
	mov	x0, x20
	bl	_mtx_unlock
	mov	x0, x21
	bl	_mtx_unlock
	mov	x0, x20
	bl	_mtx_destroy
	mov	x0, x20
	mov	w1, #4
	bl	_bzero
Lloh10:
	adrp	x8, _M_NETGRAPH_BTSOCKET_HCI_RAW@GOTPAGE
Lloh11:
	ldr	x8, [x8, _M_NETGRAPH_BTSOCKET_HCI_RAW@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_free
	str	xzr, [x19]
LBB0_2:
	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	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ng_btsocket_hci_raw_detach: pcb == NULL"

	.comm	_ng_btsocket_hci_raw_node,8,3   ; @ng_btsocket_hci_raw_node
	.comm	_ng_btsocket_hci_raw_sockets_mtx,4,2 ; @ng_btsocket_hci_raw_sockets_mtx
	.comm	_next,4,2                       ; @next
	.comm	_M_NETGRAPH_BTSOCKET_HCI_RAW,4,2 ; @M_NETGRAPH_BTSOCKET_HCI_RAW
.subsections_via_symbols
