	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function ng_btsocket_l2cap_attach
LCPI0_0:
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	4294967295                      ## 0xffffffff
	.long	4294967295                      ## 0xffffffff
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_ng_btsocket_l2cap_attach
	.p2align	4, 0x90
_ng_btsocket_l2cap_attach:              ## @ng_btsocket_l2cap_attach
	.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	%rdx, %r14
	movq	%rdi, %r12
	callq	_so2l2cap_pcb
	movq	_ng_btsocket_l2cap_node@GOTPCREL(%rip), %rcx
	cmpq	$0, (%rcx)
	je	LBB0_4
## %bb.1:
	movq	(%r12), %rcx
	movq	_SOCK_SEQPACKET@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_5
## %bb.2:
	testq	%rax, %rax
	je	LBB0_8
## %bb.3:
	movq	_EISCONN@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_4:
	movq	_EPROTONOSUPPORT@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_5:
	movq	_ESOCKTNOSUPPORT@GOTPCREL(%rip), %rax
LBB0_6:
	movl	(%rax), %ebx
LBB0_7:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	cmpq	$0, 24(%r12)
	je	LBB0_10
## %bb.9:
	cmpq	$0, 16(%r12)
	jne	LBB0_11
LBB0_10:
	movq	_NG_BTSOCKET_L2CAP_SENDSPACE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_NG_BTSOCKET_L2CAP_RECVSPACE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_soreserve
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_7
LBB0_11:
	movq	_M_NETGRAPH_BTSOCKET_L2CAP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_M_NOWAIT@GOTPCREL(%rip), %rax
	movq	_M_ZERO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movl	$80, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_14
## %bb.12:
	movq	%rax, %r15
	movq	%rax, 8(%r12)
	movq	%r12, 72(%rax)
	movq	_NG_BTSOCKET_L2CAP_CLOSED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 64(%r15)
	movq	_NG_L2CAP_MTU_DEFAULT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 56(%r15)
	movl	%eax, 60(%r15)
	movq	_NG_HCI_SERVICE_TYPE_BEST_EFFORT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 52(%r15)
	movabsq	$-4294967296, %rax              ## imm = 0xFFFFFFFF00000000
	movq	%rax, 40(%r15)
	movl	$-1, 48(%r15)
	movaps	LCPI0_0(%rip), %xmm0            ## xmm0 = [0,0,4294967295,4294967295]
	movups	%xmm0, 24(%r15)
	movq	_NG_L2CAP_FLUSH_TIMO_DEFAULT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%r15)
	movq	_NG_L2CAP_LINK_TIMO_DEFAULT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%r15)
	leaq	8(%r15), %rbx
	movq	_MTX_DEF@GOTPCREL(%rip), %rax
	movq	_MTX_DUPOK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_mtx_init
	movq	%r15, %rdi
	addq	$12, %rdi
	movq	%rbx, %rsi
	xorl	%edx, %edx
	callq	_callout_init_mtx
	testq	%r14, %r14
	je	LBB0_15
## %bb.13:
	movq	_ng_btsocket_l2cap_sockets_mtx@GOTPCREL(%rip), %rdi
	callq	_mtx_lock
	jmp	LBB0_16
LBB0_14:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_15:
	movq	_MA_OWNED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ng_btsocket_l2cap_sockets_mtx@GOTPCREL(%rip), %rdi
	callq	_mtx_assert
LBB0_16:
	movq	_ng_btsocket_l2cap_attach.token(%rip), %rax
	incq	%rax
	movl	$1, %ecx
	cmovneq	%rax, %rcx
	movq	%rcx, _ng_btsocket_l2cap_attach.token(%rip)
	movq	%rcx, (%r15)
	movq	_next@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_ng_btsocket_l2cap_sockets@GOTPCREL(%rip), %rdi
	movq	%r15, %rsi
	callq	_LIST_INSERT_HEAD
	xorl	%ebx, %ebx
	testq	%r14, %r14
	je	LBB0_7
## %bb.17:
	movq	_ng_btsocket_l2cap_sockets_mtx@GOTPCREL(%rip), %rdi
	callq	_mtx_unlock
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_ng_btsocket_l2cap_attach.token,8,3 ## @ng_btsocket_l2cap_attach.token
	.comm	_ng_btsocket_l2cap_node,8,3     ## @ng_btsocket_l2cap_node
	.comm	_EPROTONOSUPPORT,4,2            ## @EPROTONOSUPPORT
	.comm	_SOCK_SEQPACKET,8,3             ## @SOCK_SEQPACKET
	.comm	_ESOCKTNOSUPPORT,4,2            ## @ESOCKTNOSUPPORT
	.comm	_EISCONN,4,2                    ## @EISCONN
	.comm	_NG_BTSOCKET_L2CAP_SENDSPACE,4,2 ## @NG_BTSOCKET_L2CAP_SENDSPACE
	.comm	_NG_BTSOCKET_L2CAP_RECVSPACE,4,2 ## @NG_BTSOCKET_L2CAP_RECVSPACE
	.comm	_M_NETGRAPH_BTSOCKET_L2CAP,4,2  ## @M_NETGRAPH_BTSOCKET_L2CAP
	.comm	_M_NOWAIT,4,2                   ## @M_NOWAIT
	.comm	_M_ZERO,4,2                     ## @M_ZERO
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_NG_BTSOCKET_L2CAP_CLOSED,4,2   ## @NG_BTSOCKET_L2CAP_CLOSED
	.comm	_NG_L2CAP_MTU_DEFAULT,4,2       ## @NG_L2CAP_MTU_DEFAULT
	.comm	_NG_HCI_SERVICE_TYPE_BEST_EFFORT,4,2 ## @NG_HCI_SERVICE_TYPE_BEST_EFFORT
	.comm	_NG_L2CAP_FLUSH_TIMO_DEFAULT,4,2 ## @NG_L2CAP_FLUSH_TIMO_DEFAULT
	.comm	_NG_L2CAP_LINK_TIMO_DEFAULT,4,2 ## @NG_L2CAP_LINK_TIMO_DEFAULT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"btsocks_l2cap_pcb_mtx"

	.comm	_MTX_DEF,4,2                    ## @MTX_DEF
	.comm	_MTX_DUPOK,4,2                  ## @MTX_DUPOK
	.comm	_ng_btsocket_l2cap_sockets_mtx,4,2 ## @ng_btsocket_l2cap_sockets_mtx
	.comm	_MA_OWNED,4,2                   ## @MA_OWNED
	.comm	_ng_btsocket_l2cap_sockets,4,2  ## @ng_btsocket_l2cap_sockets
	.comm	_next,4,2                       ## @next
	.comm	_BLUETOOTH_PROTO_L2CAP,4,2      ## @BLUETOOTH_PROTO_L2CAP
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ; -- Begin function ng_btsocket_l2cap_attach
lCPI0_0:
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	4294967295                      ; 0xffffffff
	.long	4294967295                      ; 0xffffffff
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_ng_btsocket_l2cap_attach
	.p2align	2
_ng_btsocket_l2cap_attach:              ; @ng_btsocket_l2cap_attach
	.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, x2
	mov	x21, x0
	bl	_so2l2cap_pcb
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.1:
	ldr	x8, [x21]
Lloh3:
	adrp	x9, _SOCK_SEQPACKET@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SOCK_SEQPACKET@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.2:
	cbz	x0, LBB0_8
; %bb.3:
Lloh6:
	adrp	x8, _EISCONN@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EISCONN@GOTPAGEOFF]
	b	LBB0_6
LBB0_4:
Lloh8:
	adrp	x8, _EPROTONOSUPPORT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EPROTONOSUPPORT@GOTPAGEOFF]
	b	LBB0_6
LBB0_5:
Lloh10:
	adrp	x8, _ESOCKTNOSUPPORT@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ESOCKTNOSUPPORT@GOTPAGEOFF]
LBB0_6:
	ldr	w0, [x8]
LBB0_7:
	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
LBB0_8:
	ldr	x8, [x21, #24]
	cbz	x8, LBB0_10
; %bb.9:
	ldr	x8, [x21, #16]
	cbnz	x8, LBB0_11
LBB0_10:
Lloh12:
	adrp	x8, _NG_BTSOCKET_L2CAP_SENDSPACE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _NG_BTSOCKET_L2CAP_SENDSPACE@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
Lloh15:
	adrp	x8, _NG_BTSOCKET_L2CAP_RECVSPACE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _NG_BTSOCKET_L2CAP_RECVSPACE@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	mov	x0, x21
	bl	_soreserve
	cbnz	w0, LBB0_7
LBB0_11:
Lloh18:
	adrp	x8, _M_NETGRAPH_BTSOCKET_L2CAP@GOTPAGE
Lloh19:
	ldr	x8, [x8, _M_NETGRAPH_BTSOCKET_L2CAP@GOTPAGEOFF]
Lloh20:
	adrp	x9, _M_NOWAIT@GOTPAGE
Lloh21:
	ldr	x9, [x9, _M_NOWAIT@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
Lloh23:
	ldr	w8, [x9]
Lloh24:
	adrp	x9, _M_ZERO@GOTPAGE
Lloh25:
	ldr	x9, [x9, _M_ZERO@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	w0, #80
	bl	_malloc
	cbz	x0, LBB0_14
; %bb.12:
	mov	x20, x0
	str	x0, [x21, #8]
	str	x21, [x0, #72]
Lloh27:
	adrp	x8, _NG_BTSOCKET_L2CAP_CLOSED@GOTPAGE
Lloh28:
	ldr	x8, [x8, _NG_BTSOCKET_L2CAP_CLOSED@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	str	w8, [x0, #64]
Lloh30:
	adrp	x8, _NG_L2CAP_MTU_DEFAULT@GOTPAGE
Lloh31:
	ldr	x8, [x8, _NG_L2CAP_MTU_DEFAULT@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	stp	w8, w8, [x0, #56]
Lloh33:
	adrp	x8, _NG_HCI_SERVICE_TYPE_BEST_EFFORT@GOTPAGE
Lloh34:
	ldr	x8, [x8, _NG_HCI_SERVICE_TYPE_BEST_EFFORT@GOTPAGEOFF]
Lloh35:
	ldr	w8, [x8]
	movi	d0, #0xffffffff00000000
	str	d0, [x0, #40]
	mov	w9, #-1
	stp	w9, w8, [x0, #48]
Lloh36:
	adrp	x8, lCPI0_0@PAGE
Lloh37:
	ldr	q0, [x8, lCPI0_0@PAGEOFF]
	stur	q0, [x0, #24]
Lloh38:
	adrp	x8, _NG_L2CAP_FLUSH_TIMO_DEFAULT@GOTPAGE
Lloh39:
	ldr	x8, [x8, _NG_L2CAP_FLUSH_TIMO_DEFAULT@GOTPAGEOFF]
Lloh40:
	adrp	x9, _NG_L2CAP_LINK_TIMO_DEFAULT@GOTPAGE
Lloh41:
	ldr	x9, [x9, _NG_L2CAP_LINK_TIMO_DEFAULT@GOTPAGEOFF]
Lloh42:
	ldr	w8, [x8]
Lloh43:
	ldr	w9, [x9]
Lloh44:
	adrp	x10, _MTX_DEF@GOTPAGE
Lloh45:
	ldr	x10, [x10, _MTX_DEF@GOTPAGEOFF]
Lloh46:
	adrp	x11, _MTX_DUPOK@GOTPAGE
Lloh47:
	ldr	x11, [x11, _MTX_DUPOK@GOTPAGEOFF]
Lloh48:
	ldr	w10, [x10]
Lloh49:
	ldr	w11, [x11]
	orr	w3, w11, w10
	add	x21, x0, #8
	stp	w9, w8, [x0, #16]
Lloh50:
	adrp	x1, l_.str@PAGE
Lloh51:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	mov	x2, #0
	bl	_mtx_init
	add	x0, x20, #12
	mov	x1, x21
	mov	w2, #0
	bl	_callout_init_mtx
	cbz	x19, LBB0_15
; %bb.13:
Lloh52:
	adrp	x0, _ng_btsocket_l2cap_sockets_mtx@GOTPAGE
Lloh53:
	ldr	x0, [x0, _ng_btsocket_l2cap_sockets_mtx@GOTPAGEOFF]
	bl	_mtx_lock
	b	LBB0_16
LBB0_14:
Lloh54:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh55:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_6
LBB0_15:
Lloh56:
	adrp	x8, _MA_OWNED@GOTPAGE
Lloh57:
	ldr	x8, [x8, _MA_OWNED@GOTPAGEOFF]
Lloh58:
	ldr	w1, [x8]
Lloh59:
	adrp	x0, _ng_btsocket_l2cap_sockets_mtx@GOTPAGE
Lloh60:
	ldr	x0, [x0, _ng_btsocket_l2cap_sockets_mtx@GOTPAGEOFF]
	bl	_mtx_assert
LBB0_16:
Lloh61:
	adrp	x8, _ng_btsocket_l2cap_attach.token@PAGE
	ldr	x9, [x8, _ng_btsocket_l2cap_attach.token@PAGEOFF]
	adds	x9, x9, #1
	csinc	x9, x9, xzr, lo
	str	x9, [x8, _ng_btsocket_l2cap_attach.token@PAGEOFF]
	str	x9, [x20]
Lloh62:
	adrp	x8, _next@GOTPAGE
Lloh63:
	ldr	x8, [x8, _next@GOTPAGEOFF]
Lloh64:
	ldr	w2, [x8]
Lloh65:
	adrp	x0, _ng_btsocket_l2cap_sockets@GOTPAGE
Lloh66:
	ldr	x0, [x0, _ng_btsocket_l2cap_sockets@GOTPAGEOFF]
	mov	x1, x20
	bl	_LIST_INSERT_HEAD
	cbz	x19, LBB0_18
; %bb.17:
Lloh67:
	adrp	x0, _ng_btsocket_l2cap_sockets_mtx@GOTPAGE
Lloh68:
	ldr	x0, [x0, _ng_btsocket_l2cap_sockets_mtx@GOTPAGEOFF]
	bl	_mtx_unlock
LBB0_18:
	mov	w0, #0
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh22
	.loh AdrpAdd	Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh49
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh48
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh43
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh42
	.loh AdrpAdrp	Lloh36, Lloh38
	.loh AdrpLdr	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh52, Lloh53
	.loh AdrpLdrGot	Lloh54, Lloh55
	.loh AdrpLdrGot	Lloh59, Lloh60
	.loh AdrpLdrGotLdr	Lloh56, Lloh57, Lloh58
	.loh AdrpLdrGot	Lloh65, Lloh66
	.loh AdrpLdrGotLdr	Lloh62, Lloh63, Lloh64
	.loh AdrpAdrp	Lloh61, Lloh62
	.loh AdrpLdrGot	Lloh67, Lloh68
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_ng_btsocket_l2cap_attach.token,8,3 ; @ng_btsocket_l2cap_attach.token
	.comm	_ng_btsocket_l2cap_node,8,3     ; @ng_btsocket_l2cap_node
	.comm	_EPROTONOSUPPORT,4,2            ; @EPROTONOSUPPORT
	.comm	_SOCK_SEQPACKET,8,3             ; @SOCK_SEQPACKET
	.comm	_ESOCKTNOSUPPORT,4,2            ; @ESOCKTNOSUPPORT
	.comm	_EISCONN,4,2                    ; @EISCONN
	.comm	_NG_BTSOCKET_L2CAP_SENDSPACE,4,2 ; @NG_BTSOCKET_L2CAP_SENDSPACE
	.comm	_NG_BTSOCKET_L2CAP_RECVSPACE,4,2 ; @NG_BTSOCKET_L2CAP_RECVSPACE
	.comm	_M_NETGRAPH_BTSOCKET_L2CAP,4,2  ; @M_NETGRAPH_BTSOCKET_L2CAP
	.comm	_M_NOWAIT,4,2                   ; @M_NOWAIT
	.comm	_M_ZERO,4,2                     ; @M_ZERO
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_NG_BTSOCKET_L2CAP_CLOSED,4,2   ; @NG_BTSOCKET_L2CAP_CLOSED
	.comm	_NG_L2CAP_MTU_DEFAULT,4,2       ; @NG_L2CAP_MTU_DEFAULT
	.comm	_NG_HCI_SERVICE_TYPE_BEST_EFFORT,4,2 ; @NG_HCI_SERVICE_TYPE_BEST_EFFORT
	.comm	_NG_L2CAP_FLUSH_TIMO_DEFAULT,4,2 ; @NG_L2CAP_FLUSH_TIMO_DEFAULT
	.comm	_NG_L2CAP_LINK_TIMO_DEFAULT,4,2 ; @NG_L2CAP_LINK_TIMO_DEFAULT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"btsocks_l2cap_pcb_mtx"

	.comm	_MTX_DEF,4,2                    ; @MTX_DEF
	.comm	_MTX_DUPOK,4,2                  ; @MTX_DUPOK
	.comm	_ng_btsocket_l2cap_sockets_mtx,4,2 ; @ng_btsocket_l2cap_sockets_mtx
	.comm	_MA_OWNED,4,2                   ; @MA_OWNED
	.comm	_ng_btsocket_l2cap_sockets,4,2  ; @ng_btsocket_l2cap_sockets
	.comm	_next,4,2                       ; @next
	.comm	_BLUETOOTH_PROTO_L2CAP,4,2      ; @BLUETOOTH_PROTO_L2CAP
.subsections_via_symbols
