	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ng_btsocket_rfcomm_attach      ## -- Begin function ng_btsocket_rfcomm_attach
	.p2align	4, 0x90
_ng_btsocket_rfcomm_attach:             ## @ng_btsocket_rfcomm_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	callq	_so2rfcomm_pcb
	movq	(%rbx), %rcx
	movq	_SOCK_STREAM@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_3
## %bb.1:
	testq	%rax, %rax
	je	LBB0_6
## %bb.2:
	movq	_EISCONN@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_3:
	movq	_ESOCKTNOSUPPORT@GOTPCREL(%rip), %rax
LBB0_4:
	movl	(%rax), %r15d
LBB0_5:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	cmpq	$0, 24(%rbx)
	je	LBB0_8
## %bb.7:
	cmpq	$0, 16(%rbx)
	jne	LBB0_9
LBB0_8:
	movq	_NG_BTSOCKET_RFCOMM_SENDSPACE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_NG_BTSOCKET_RFCOMM_RECVSPACE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_soreserve
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_5
LBB0_9:
	movq	_M_NETGRAPH_BTSOCKET_RFCOMM@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	$56, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_11
## %bb.10:
	movq	%rax, %r14
	movq	%rax, 8(%rbx)
	movq	%rbx, 48(%rax)
	movq	_NG_BTSOCKET_RFCOMM_DLC_CLOSED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 40(%r14)
	movq	_NG_BTSOCKET_RFCOMM_DLC_CFC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 36(%r14)
	movq	_RFCOMM_MODEM_RTC@GOTPCREL(%rip), %rax
	movq	_RFCOMM_MODEM_RTR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	_RFCOMM_MODEM_DV@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, 4(%r14)
	movl	%ecx, (%r14)
	movq	_RFCOMM_DEFAULT_MTU@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%r14)
	movq	$0, 24(%r14)
	movq	_RFCOMM_DEFAULT_CREDITS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%r14)
	leaq	8(%r14), %rbx
	movq	_MTX_DEF@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	L_.str(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_mtx_init
	movq	%r14, %rdi
	addq	$12, %rdi
	movq	%rbx, %rsi
	xorl	%edx, %edx
	callq	_callout_init_mtx
	movq	_ng_btsocket_rfcomm_sockets_mtx@GOTPCREL(%rip), %rbx
	movq	%rbx, %rdi
	callq	_mtx_lock
	movq	_next@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_ng_btsocket_rfcomm_sockets@GOTPCREL(%rip), %rdi
	movq	%r14, %rsi
	callq	_LIST_INSERT_HEAD
	movq	%rbx, %rdi
	callq	_mtx_unlock
	jmp	LBB0_5
LBB0_11:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.comm	_SOCK_STREAM,8,3                ## @SOCK_STREAM
	.comm	_ESOCKTNOSUPPORT,4,2            ## @ESOCKTNOSUPPORT
	.comm	_EISCONN,4,2                    ## @EISCONN
	.comm	_NG_BTSOCKET_RFCOMM_SENDSPACE,4,2 ## @NG_BTSOCKET_RFCOMM_SENDSPACE
	.comm	_NG_BTSOCKET_RFCOMM_RECVSPACE,4,2 ## @NG_BTSOCKET_RFCOMM_RECVSPACE
	.comm	_M_NETGRAPH_BTSOCKET_RFCOMM,4,2 ## @M_NETGRAPH_BTSOCKET_RFCOMM
	.comm	_M_NOWAIT,4,2                   ## @M_NOWAIT
	.comm	_M_ZERO,4,2                     ## @M_ZERO
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_NG_BTSOCKET_RFCOMM_DLC_CLOSED,4,2 ## @NG_BTSOCKET_RFCOMM_DLC_CLOSED
	.comm	_NG_BTSOCKET_RFCOMM_DLC_CFC,4,2 ## @NG_BTSOCKET_RFCOMM_DLC_CFC
	.comm	_RFCOMM_MODEM_RTC,4,2           ## @RFCOMM_MODEM_RTC
	.comm	_RFCOMM_MODEM_RTR,4,2           ## @RFCOMM_MODEM_RTR
	.comm	_RFCOMM_MODEM_DV,4,2            ## @RFCOMM_MODEM_DV
	.comm	_RFCOMM_DEFAULT_MTU,4,2         ## @RFCOMM_DEFAULT_MTU
	.comm	_RFCOMM_DEFAULT_CREDITS,4,2     ## @RFCOMM_DEFAULT_CREDITS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"btsocks_rfcomm_pcb_mtx"

	.comm	_MTX_DEF,4,2                    ## @MTX_DEF
	.comm	_ng_btsocket_rfcomm_sockets_mtx,4,2 ## @ng_btsocket_rfcomm_sockets_mtx
	.comm	_ng_btsocket_rfcomm_sockets,4,2 ## @ng_btsocket_rfcomm_sockets
	.comm	_next,4,2                       ## @next
	.comm	_BLUETOOTH_PROTO_RFCOMM,4,2     ## @BLUETOOTH_PROTO_RFCOMM
	.comm	_EPROTONOSUPPORT,4,2            ## @EPROTONOSUPPORT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ng_btsocket_rfcomm_attach      ; -- Begin function ng_btsocket_rfcomm_attach
	.p2align	2
_ng_btsocket_rfcomm_attach:             ; @ng_btsocket_rfcomm_attach
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	bl	_so2rfcomm_pcb
	ldr	x8, [x19]
Lloh0:
	adrp	x9, _SOCK_STREAM@GOTPAGE
Lloh1:
	ldr	x9, [x9, _SOCK_STREAM@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.1:
	cbz	x0, LBB0_6
; %bb.2:
Lloh3:
	adrp	x8, _EISCONN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EISCONN@GOTPAGEOFF]
	b	LBB0_4
LBB0_3:
Lloh5:
	adrp	x8, _ESOCKTNOSUPPORT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ESOCKTNOSUPPORT@GOTPAGEOFF]
LBB0_4:
	ldr	w0, [x8]
LBB0_5:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_6:
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_8
; %bb.7:
	ldr	x8, [x19, #16]
	cbnz	x8, LBB0_9
LBB0_8:
Lloh7:
	adrp	x8, _NG_BTSOCKET_RFCOMM_SENDSPACE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _NG_BTSOCKET_RFCOMM_SENDSPACE@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
Lloh10:
	adrp	x8, _NG_BTSOCKET_RFCOMM_RECVSPACE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _NG_BTSOCKET_RFCOMM_RECVSPACE@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_soreserve
	cbnz	w0, LBB0_5
LBB0_9:
Lloh13:
	adrp	x8, _M_NETGRAPH_BTSOCKET_RFCOMM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _M_NETGRAPH_BTSOCKET_RFCOMM@GOTPAGEOFF]
Lloh15:
	adrp	x9, _M_NOWAIT@GOTPAGE
Lloh16:
	ldr	x9, [x9, _M_NOWAIT@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
Lloh18:
	ldr	w8, [x9]
Lloh19:
	adrp	x9, _M_ZERO@GOTPAGE
Lloh20:
	ldr	x9, [x9, _M_ZERO@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	w0, #56
	bl	_malloc
	cbz	x0, LBB0_11
; %bb.10:
	mov	x20, x0
	str	x0, [x19, #8]
	str	x19, [x0, #48]
Lloh22:
	adrp	x8, _NG_BTSOCKET_RFCOMM_DLC_CLOSED@GOTPAGE
Lloh23:
	ldr	x8, [x8, _NG_BTSOCKET_RFCOMM_DLC_CLOSED@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	str	w8, [x0, #40]
Lloh25:
	adrp	x8, _NG_BTSOCKET_RFCOMM_DLC_CFC@GOTPAGE
Lloh26:
	ldr	x8, [x8, _NG_BTSOCKET_RFCOMM_DLC_CFC@GOTPAGEOFF]
Lloh27:
	adrp	x9, _RFCOMM_MODEM_RTC@GOTPAGE
Lloh28:
	ldr	x9, [x9, _RFCOMM_MODEM_RTC@GOTPAGEOFF]
Lloh29:
	adrp	x10, _RFCOMM_MODEM_RTR@GOTPAGE
Lloh30:
	ldr	x10, [x10, _RFCOMM_MODEM_RTR@GOTPAGEOFF]
Lloh31:
	ldr	w9, [x9]
Lloh32:
	ldr	w10, [x10]
	orr	w9, w10, w9
Lloh33:
	adrp	x10, _RFCOMM_MODEM_DV@GOTPAGE
Lloh34:
	ldr	x10, [x10, _RFCOMM_MODEM_DV@GOTPAGEOFF]
Lloh35:
	ldr	w10, [x10]
	orr	w9, w9, w10
Lloh36:
	ldr	w8, [x8]
	stp	w9, w9, [x0]
Lloh37:
	adrp	x9, _RFCOMM_DEFAULT_MTU@GOTPAGE
Lloh38:
	ldr	x9, [x9, _RFCOMM_DEFAULT_MTU@GOTPAGEOFF]
Lloh39:
	ldr	w9, [x9]
	stp	w9, w8, [x0, #32]
	str	xzr, [x0, #24]
Lloh40:
	adrp	x8, _RFCOMM_DEFAULT_CREDITS@GOTPAGE
Lloh41:
	ldr	x8, [x8, _RFCOMM_DEFAULT_CREDITS@GOTPAGEOFF]
Lloh42:
	ldr	w8, [x8]
	str	w8, [x0, #16]
	add	x19, x0, #8
Lloh43:
	adrp	x8, _MTX_DEF@GOTPAGE
Lloh44:
	ldr	x8, [x8, _MTX_DEF@GOTPAGEOFF]
Lloh45:
	ldr	w3, [x8]
Lloh46:
	adrp	x1, l_.str@PAGE
Lloh47:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, #0
	bl	_mtx_init
	add	x0, x20, #12
	mov	x1, x19
	mov	w2, #0
	bl	_callout_init_mtx
Lloh48:
	adrp	x19, _ng_btsocket_rfcomm_sockets_mtx@GOTPAGE
Lloh49:
	ldr	x19, [x19, _ng_btsocket_rfcomm_sockets_mtx@GOTPAGEOFF]
	mov	x0, x19
	bl	_mtx_lock
Lloh50:
	adrp	x8, _next@GOTPAGE
Lloh51:
	ldr	x8, [x8, _next@GOTPAGEOFF]
Lloh52:
	ldr	w2, [x8]
Lloh53:
	adrp	x0, _ng_btsocket_rfcomm_sockets@GOTPAGE
Lloh54:
	ldr	x0, [x0, _ng_btsocket_rfcomm_sockets@GOTPAGEOFF]
	mov	x1, x20
	bl	_LIST_INSERT_HEAD
	mov	x0, x19
	bl	_mtx_unlock
	mov	w0, #0
	b	LBB0_5
LBB0_11:
Lloh55:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh56:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh17
	.loh AdrpLdrGot	Lloh53, Lloh54
	.loh AdrpLdrGotLdr	Lloh50, Lloh51, Lloh52
	.loh AdrpLdrGot	Lloh48, Lloh49
	.loh AdrpAdd	Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh31
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh36
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh55, Lloh56
	.cfi_endproc
                                        ; -- End function
	.comm	_SOCK_STREAM,8,3                ; @SOCK_STREAM
	.comm	_ESOCKTNOSUPPORT,4,2            ; @ESOCKTNOSUPPORT
	.comm	_EISCONN,4,2                    ; @EISCONN
	.comm	_NG_BTSOCKET_RFCOMM_SENDSPACE,4,2 ; @NG_BTSOCKET_RFCOMM_SENDSPACE
	.comm	_NG_BTSOCKET_RFCOMM_RECVSPACE,4,2 ; @NG_BTSOCKET_RFCOMM_RECVSPACE
	.comm	_M_NETGRAPH_BTSOCKET_RFCOMM,4,2 ; @M_NETGRAPH_BTSOCKET_RFCOMM
	.comm	_M_NOWAIT,4,2                   ; @M_NOWAIT
	.comm	_M_ZERO,4,2                     ; @M_ZERO
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_NG_BTSOCKET_RFCOMM_DLC_CLOSED,4,2 ; @NG_BTSOCKET_RFCOMM_DLC_CLOSED
	.comm	_NG_BTSOCKET_RFCOMM_DLC_CFC,4,2 ; @NG_BTSOCKET_RFCOMM_DLC_CFC
	.comm	_RFCOMM_MODEM_RTC,4,2           ; @RFCOMM_MODEM_RTC
	.comm	_RFCOMM_MODEM_RTR,4,2           ; @RFCOMM_MODEM_RTR
	.comm	_RFCOMM_MODEM_DV,4,2            ; @RFCOMM_MODEM_DV
	.comm	_RFCOMM_DEFAULT_MTU,4,2         ; @RFCOMM_DEFAULT_MTU
	.comm	_RFCOMM_DEFAULT_CREDITS,4,2     ; @RFCOMM_DEFAULT_CREDITS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"btsocks_rfcomm_pcb_mtx"

	.comm	_MTX_DEF,4,2                    ; @MTX_DEF
	.comm	_ng_btsocket_rfcomm_sockets_mtx,4,2 ; @ng_btsocket_rfcomm_sockets_mtx
	.comm	_ng_btsocket_rfcomm_sockets,4,2 ; @ng_btsocket_rfcomm_sockets
	.comm	_next,4,2                       ; @next
	.comm	_BLUETOOTH_PROTO_RFCOMM,4,2     ; @BLUETOOTH_PROTO_RFCOMM
	.comm	_EPROTONOSUPPORT,4,2            ; @EPROTONOSUPPORT
.subsections_via_symbols
