	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ng_btsocket_sco_disconnect     ## -- Begin function ng_btsocket_sco_disconnect
	.p2align	4, 0x90
_ng_btsocket_sco_disconnect:            ## @ng_btsocket_sco_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	callq	_so2sco_pcb
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %rbx
	movq	_ng_btsocket_sco_node@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_1
## %bb.3:
	movq	%rbx, %r14
	addq	$12, %r14
	movq	%r14, %rdi
	callq	_mtx_lock
	movq	(%rbx), %rax
	movq	_NG_BTSOCKET_SCO_DISCONNECTING@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rax
	jne	LBB0_5
## %bb.4:
	movq	%r14, %rdi
	callq	_mtx_unlock
	movq	_EINPROGRESS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_11
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_11
LBB0_5:
	movq	_NG_BTSOCKET_SCO_TIMO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, 8(%rbx)
	je	LBB0_7
## %bb.6:
	movq	%rbx, %rdi
	callq	_ng_btsocket_sco_untimeout
	movq	(%rbx), %rax
LBB0_7:
	movq	_NG_BTSOCKET_SCO_OPEN@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.8:
	movq	%rbx, %rdi
	callq	_ng_btsocket_sco_send_lp_discon_req
	movq	(%r12), %rax
	movq	%rax, (%rbx)
	movq	%r15, %rdi
	callq	_soisdisconnecting
	movq	%rbx, %rdi
	callq	_ng_btsocket_sco_timeout
	jmp	LBB0_10
LBB0_9:
	movq	_NG_BTSOCKET_SCO_CLOSED@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%rbx)
	movq	%r15, %rdi
	callq	_soisdisconnected
LBB0_10:
	movq	%r14, %rdi
	callq	_mtx_unlock
	xorl	%eax, %eax
LBB0_11:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ng_btsocket_sco_node,8,3       ## @ng_btsocket_sco_node
	.comm	_NG_BTSOCKET_SCO_DISCONNECTING,8,3 ## @NG_BTSOCKET_SCO_DISCONNECTING
	.comm	_EINPROGRESS,4,2                ## @EINPROGRESS
	.comm	_NG_BTSOCKET_SCO_TIMO,4,2       ## @NG_BTSOCKET_SCO_TIMO
	.comm	_NG_BTSOCKET_SCO_OPEN,8,3       ## @NG_BTSOCKET_SCO_OPEN
	.comm	_NG_BTSOCKET_SCO_CLOSED,8,3     ## @NG_BTSOCKET_SCO_CLOSED
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ng_btsocket_sco_disconnect     ; -- Begin function ng_btsocket_sco_disconnect
	.p2align	2
_ng_btsocket_sco_disconnect:            ; @ng_btsocket_sco_disconnect
	.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	x20, x0
	bl	_so2sco_pcb
	cbz	x0, LBB0_4
; %bb.1:
Lloh0:
	adrp	x8, _ng_btsocket_sco_node@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ng_btsocket_sco_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	x22, _NG_BTSOCKET_SCO_DISCONNECTING@GOTPAGE
Lloh4:
	ldr	x22, [x22, _NG_BTSOCKET_SCO_DISCONNECTING@GOTPAGEOFF]
	ldr	x9, [x22]
	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	w0, [x8]
	b	LBB0_11
LBB0_4:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	b	LBB0_11
LBB0_5:
	ldr	w9, [x21, #8]
Lloh11:
	adrp	x10, _NG_BTSOCKET_SCO_TIMO@GOTPAGE
Lloh12:
	ldr	x10, [x10, _NG_BTSOCKET_SCO_TIMO@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
	tst	w10, w9
	b.eq	LBB0_7
; %bb.6:
	mov	x0, x21
	bl	_ng_btsocket_sco_untimeout
	ldr	x8, [x21]
LBB0_7:
Lloh14:
	adrp	x9, _NG_BTSOCKET_SCO_OPEN@GOTPAGE
Lloh15:
	ldr	x9, [x9, _NG_BTSOCKET_SCO_OPEN@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_9
; %bb.8:
	mov	x0, x21
	bl	_ng_btsocket_sco_send_lp_discon_req
	ldr	x8, [x22]
	str	x8, [x21]
	mov	x0, x20
	bl	_soisdisconnecting
	mov	x0, x21
	bl	_ng_btsocket_sco_timeout
	b	LBB0_10
LBB0_9:
Lloh17:
	adrp	x8, _NG_BTSOCKET_SCO_CLOSED@GOTPAGE
Lloh18:
	ldr	x8, [x8, _NG_BTSOCKET_SCO_CLOSED@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
	str	x8, [x21]
	mov	x0, x20
	bl	_soisdisconnected
LBB0_10:
	mov	x0, x19
	bl	_mtx_unlock
	mov	w0, #0
LBB0_11:
	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	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
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ng_btsocket_sco_node,8,3       ; @ng_btsocket_sco_node
	.comm	_NG_BTSOCKET_SCO_DISCONNECTING,8,3 ; @NG_BTSOCKET_SCO_DISCONNECTING
	.comm	_EINPROGRESS,4,2                ; @EINPROGRESS
	.comm	_NG_BTSOCKET_SCO_TIMO,4,2       ; @NG_BTSOCKET_SCO_TIMO
	.comm	_NG_BTSOCKET_SCO_OPEN,8,3       ; @NG_BTSOCKET_SCO_OPEN
	.comm	_NG_BTSOCKET_SCO_CLOSED,8,3     ; @NG_BTSOCKET_SCO_CLOSED
.subsections_via_symbols
