	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function key_attach
_key_attach:                            ## @key_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, %rbx
	movl	%esi, %r14d
	movq	%rdi, %r15
	xorl	%edi, %edi
	cmpq	$0, 8(%r15)
	sete	%dil
	leaq	L_.str(%rip), %rsi
	callq	_KASSERT
	testq	%rbx, %rbx
	je	LBB0_2
## %bb.1:
	movq	_PRIV_NET_RAW@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_priv_check
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_9
LBB0_2:
	movq	_M_PCB@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	_M_WAITOK@GOTPCREL(%rip), %rax
	movq	_M_ZERO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movl	$24, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, 8(%r15)
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_raw_attach
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_sotorawcb
	testl	%ebx, %ebx
	je	LBB0_6
## %bb.5:
	movl	(%r12), %esi
	movq	%rax, %rdi
	callq	_free
	movq	$0, 8(%r15)
	jmp	LBB0_9
LBB0_3:
	movq	_ENOBUFS@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_9
LBB0_6:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 8(%rax)
	movq	(%rax), %rax
	movq	_PF_KEY@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_8
## %bb.7:
	movq	_V_key_cb@GOTPCREL(%rip), %rax
	incl	4(%rax)
LBB0_8:
	movq	_V_key_cb@GOTPCREL(%rip), %rax
	incl	(%rax)
	movq	%r15, %rdi
	callq	_soisconnected
	movq	_SO_USELOOPBACK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%r15)
	xorl	%ebx, %ebx
LBB0_9:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"key_attach: so_pcb != NULL"

	.comm	_PRIV_NET_RAW,4,2               ## @PRIV_NET_RAW
	.comm	_M_PCB,4,2                      ## @M_PCB
	.comm	_M_WAITOK,4,2                   ## @M_WAITOK
	.comm	_M_ZERO,4,2                     ## @M_ZERO
	.comm	_ENOBUFS,4,2                    ## @ENOBUFS
	.comm	_PF_KEY,8,3                     ## @PF_KEY
	.comm	_V_key_cb,8,2                   ## @V_key_cb
	.comm	_SO_USELOOPBACK,4,2             ## @SO_USELOOPBACK
	.no_dead_strip	_key_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function key_attach
_key_attach:                            ; @key_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	x21, x2
	mov	x20, x1
	mov	x19, x0
	ldr	x8, [x0, #8]
	cmp	x8, #0
	cset	w0, eq
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_KASSERT
	cbz	x21, LBB0_2
; %bb.1:
Lloh2:
	adrp	x8, _PRIV_NET_RAW@GOTPAGE
Lloh3:
	ldr	x8, [x8, _PRIV_NET_RAW@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_priv_check
	mov	x21, x0
	cbnz	w0, LBB0_9
LBB0_2:
Lloh5:
	adrp	x22, _M_PCB@GOTPAGE
Lloh6:
	ldr	x22, [x22, _M_PCB@GOTPAGEOFF]
Lloh7:
	adrp	x8, _M_WAITOK@GOTPAGE
Lloh8:
	ldr	x8, [x8, _M_WAITOK@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh9:
	ldr	w8, [x8]
Lloh10:
	adrp	x9, _M_ZERO@GOTPAGE
Lloh11:
	ldr	x9, [x9, _M_ZERO@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	w0, #24
	bl	_malloc
	cbz	x0, LBB0_5
; %bb.3:
	str	x0, [x19, #8]
	mov	x0, x19
	mov	x1, x20
	bl	_raw_attach
	mov	x21, x0
	mov	x0, x19
	bl	_sotorawcb
	cbz	w21, LBB0_6
; %bb.4:
	ldr	w1, [x22]
	bl	_free
	str	xzr, [x19, #8]
	b	LBB0_9
LBB0_5:
Lloh13:
	adrp	x8, _ENOBUFS@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOBUFS@GOTPAGEOFF]
Lloh15:
	ldr	w21, [x8]
	b	LBB0_9
LBB0_6:
	stp	xzr, xzr, [x0, #8]
	ldr	x9, [x0]
Lloh16:
	adrp	x8, _PF_KEY@GOTPAGE
Lloh17:
	ldr	x8, [x8, _PF_KEY@GOTPAGEOFF]
Lloh18:
	ldr	x10, [x8]
Lloh19:
	adrp	x8, _V_key_cb@GOTPAGE
Lloh20:
	ldr	x8, [x8, _V_key_cb@GOTPAGEOFF]
	cmp	x9, x10
	b.ne	LBB0_8
; %bb.7:
	ldr	w9, [x8, #4]
	add	w9, w9, #1
	str	w9, [x8, #4]
LBB0_8:
	ldr	w9, [x8]
	add	w9, w9, #1
	str	w9, [x8]
	mov	x0, x19
	bl	_soisconnected
	mov	w21, #0
Lloh21:
	adrp	x8, _SO_USELOOPBACK@GOTPAGE
Lloh22:
	ldr	x8, [x8, _SO_USELOOPBACK@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	ldr	w9, [x19]
	orr	w8, w9, w8
	str	w8, [x19]
LBB0_9:
	mov	x0, x21
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"key_attach: so_pcb != NULL"

	.comm	_PRIV_NET_RAW,4,2               ; @PRIV_NET_RAW
	.comm	_M_PCB,4,2                      ; @M_PCB
	.comm	_M_WAITOK,4,2                   ; @M_WAITOK
	.comm	_M_ZERO,4,2                     ; @M_ZERO
	.comm	_ENOBUFS,4,2                    ; @ENOBUFS
	.comm	_PF_KEY,8,3                     ; @PF_KEY
	.comm	_V_key_cb,8,2                   ; @V_key_cb
	.comm	_SO_USELOOPBACK,4,2             ; @SO_USELOOPBACK
	.no_dead_strip	_key_attach
.subsections_via_symbols
