	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ng_btsocket_l2cap_disconnect   ## -- Begin function ng_btsocket_l2cap_disconnect
	.p2align	4, 0x90
_ng_btsocket_l2cap_disconnect:          ## @ng_btsocket_l2cap_disconnect
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	callq	_so2l2cap_pcb
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movq	_ng_btsocket_l2cap_node@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_1
## %bb.3:
	movq	%r12, %r14
	addq	$12, %r14
	movq	%r14, %rdi
	callq	_mtx_lock
	movq	(%r12), %rax
	movq	_NG_BTSOCKET_L2CAP_DISCONNECTING@GOTPCREL(%rip), %r13
	cmpq	(%r13), %rax
	jne	LBB0_5
## %bb.4:
	movq	%r14, %rdi
	callq	_mtx_unlock
	movq	_EINPROGRESS@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_11
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_11
LBB0_5:
	movq	_NG_BTSOCKET_L2CAP_CLOSED@GOTPCREL(%rip), %rcx
	xorl	%ebx, %ebx
	cmpq	(%rcx), %rax
	je	LBB0_10
## %bb.6:
	movq	_NG_BTSOCKET_L2CAP_TIMO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%r12)
	je	LBB0_8
## %bb.7:
	movq	%r12, %rdi
	callq	_ng_btsocket_l2cap_untimeout
LBB0_8:
	movl	16(%r12), %edi
	movq	%r12, %rsi
	callq	_ng_btsocket_l2cap_send_l2ca_discon_req
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_10
## %bb.9:
	movq	(%r13), %rax
	movq	%rax, (%r12)
	movq	%r15, %rdi
	callq	_soisdisconnecting
	movq	%r12, %rdi
	callq	_ng_btsocket_l2cap_timeout
	xorl	%ebx, %ebx
LBB0_10:
	movq	%r14, %rdi
	callq	_mtx_unlock
LBB0_11:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ng_btsocket_l2cap_node,8,3     ## @ng_btsocket_l2cap_node
	.comm	_NG_BTSOCKET_L2CAP_DISCONNECTING,8,3 ## @NG_BTSOCKET_L2CAP_DISCONNECTING
	.comm	_EINPROGRESS,4,2                ## @EINPROGRESS
	.comm	_NG_BTSOCKET_L2CAP_CLOSED,8,3   ## @NG_BTSOCKET_L2CAP_CLOSED
	.comm	_NG_BTSOCKET_L2CAP_TIMO,4,2     ## @NG_BTSOCKET_L2CAP_TIMO
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ng_btsocket_l2cap_disconnect   ; -- Begin function ng_btsocket_l2cap_disconnect
	.p2align	2
_ng_btsocket_l2cap_disconnect:          ; @ng_btsocket_l2cap_disconnect
	.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
	mov	x20, x0
	bl	_so2l2cap_pcb
	cbz	x0, LBB0_4
; %bb.1:
Lloh0:
	adrp	x8, _ng_btsocket_l2cap_node@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ng_btsocket_l2cap_node@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cbz	x8, LBB0_4
; %bb.2:
	mov	x21, x0
	add	x19, x0, #12
	mov	x0, x19
	bl	_mtx_lock
	ldr	x8, [x21]
Lloh3:
	adrp	x23, _NG_BTSOCKET_L2CAP_DISCONNECTING@GOTPAGE
Lloh4:
	ldr	x23, [x23, _NG_BTSOCKET_L2CAP_DISCONNECTING@GOTPAGEOFF]
	ldr	x9, [x23]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.3:
	mov	x0, x19
	bl	_mtx_unlock
Lloh5:
	adrp	x8, _EINPROGRESS@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINPROGRESS@GOTPAGEOFF]
Lloh7:
	ldr	w22, [x8]
	b	LBB0_12
LBB0_4:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh10:
	ldr	w22, [x8]
	b	LBB0_12
LBB0_5:
Lloh11:
	adrp	x9, _NG_BTSOCKET_L2CAP_CLOSED@GOTPAGE
Lloh12:
	ldr	x9, [x9, _NG_BTSOCKET_L2CAP_CLOSED@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.6:
	mov	w22, #0
	b	LBB0_11
LBB0_7:
	ldr	w8, [x21, #8]
Lloh14:
	adrp	x9, _NG_BTSOCKET_L2CAP_TIMO@GOTPAGE
Lloh15:
	ldr	x9, [x9, _NG_BTSOCKET_L2CAP_TIMO@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.8:
	mov	x0, x21
	bl	_ng_btsocket_l2cap_untimeout
LBB0_9:
	ldr	w0, [x21, #16]
	mov	x1, x21
	bl	_ng_btsocket_l2cap_send_l2ca_discon_req
	mov	x22, x0
	cbnz	w0, LBB0_11
; %bb.10:
	ldr	x8, [x23]
	str	x8, [x21]
	mov	x0, x20
	bl	_soisdisconnecting
	mov	x0, x21
	bl	_ng_btsocket_l2cap_timeout
LBB0_11:
	mov	x0, x19
	bl	_mtx_unlock
LBB0_12:
	mov	x0, x22
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ng_btsocket_l2cap_node,8,3     ; @ng_btsocket_l2cap_node
	.comm	_NG_BTSOCKET_L2CAP_DISCONNECTING,8,3 ; @NG_BTSOCKET_L2CAP_DISCONNECTING
	.comm	_EINPROGRESS,4,2                ; @EINPROGRESS
	.comm	_NG_BTSOCKET_L2CAP_CLOSED,8,3   ; @NG_BTSOCKET_L2CAP_CLOSED
	.comm	_NG_BTSOCKET_L2CAP_TIMO,4,2     ; @NG_BTSOCKET_L2CAP_TIMO
.subsections_via_symbols
