	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ipsec_delete_tunnel
_ipsec_delete_tunnel:                   ## @ipsec_delete_tunnel
	.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
	movq	_SA_XLOCKED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ipsec_ioctl_sx@GOTPCREL(%rip), %rdi
	callq	_sx_assert
	movq	_IFF_DRV_RUNNING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	movq	16(%r15), %rcx
	andl	%eax, (%rcx)
	cmpq	$0, (%r15)
	je	LBB0_4
## %bb.1:
	movq	_srchash@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_CK_LIST_REMOVE
	movq	$0, (%r15)
	xorl	%eax, %eax
	callq	_IPSEC_WAIT
	movq	8(%r15), %rdi
	movq	_IPSEC_SPCOUNT@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	callq	_key_unregister_ifnet
	cmpl	$0, (%r14)
	jle	LBB0_4
## %bb.2:
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r15), %rdi
	addq	%r12, %rdi
	callq	_key_freesp
	incq	%rbx
	movslq	(%r14), %rax
	addq	$4, %r12
	cmpq	%rax, %rbx
	jl	LBB0_3
LBB0_4:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ipsec_ioctl_sx,4,2             ## @ipsec_ioctl_sx
	.comm	_SA_XLOCKED,4,2                 ## @SA_XLOCKED
	.comm	_IFF_DRV_RUNNING,4,2            ## @IFF_DRV_RUNNING
	.comm	_srchash,4,2                    ## @srchash
	.comm	_IPSEC_SPCOUNT,4,2              ## @IPSEC_SPCOUNT
	.no_dead_strip	_ipsec_delete_tunnel
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ipsec_delete_tunnel
_ipsec_delete_tunnel:                   ; @ipsec_delete_tunnel
	.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, x0
Lloh0:
	adrp	x8, _SA_XLOCKED@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SA_XLOCKED@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x0, _ipsec_ioctl_sx@GOTPAGE
Lloh4:
	ldr	x0, [x0, _ipsec_ioctl_sx@GOTPAGEOFF]
	bl	_sx_assert
Lloh5:
	adrp	x8, _IFF_DRV_RUNNING@GOTPAGE
Lloh6:
	ldr	x8, [x8, _IFF_DRV_RUNNING@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	ldr	x9, [x19, #16]
	ldr	w10, [x9]
	bic	w8, w10, w8
	str	w8, [x9]
	ldr	x8, [x19]
	cbz	x8, LBB0_4
; %bb.1:
Lloh8:
	adrp	x8, _srchash@GOTPAGE
Lloh9:
	ldr	x8, [x8, _srchash@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_CK_LIST_REMOVE
	str	xzr, [x19]
	bl	_IPSEC_WAIT
	ldr	x0, [x19, #8]
Lloh11:
	adrp	x20, _IPSEC_SPCOUNT@GOTPAGE
Lloh12:
	ldr	x20, [x20, _IPSEC_SPCOUNT@GOTPAGEOFF]
	ldr	w1, [x20]
	bl	_key_unregister_ifnet
	ldr	w8, [x20]
	cmp	w8, #1
	b.lt	LBB0_4
; %bb.2:
	mov	x21, #0
	mov	x22, #0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #8]
	add	x0, x8, x21
	bl	_key_freesp
	add	x22, x22, #1
	ldrsw	x8, [x20]
	add	x21, x21, #4
	cmp	x22, x8
	b.lt	LBB0_3
LBB0_4:
	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	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_ipsec_ioctl_sx,4,2             ; @ipsec_ioctl_sx
	.comm	_SA_XLOCKED,4,2                 ; @SA_XLOCKED
	.comm	_IFF_DRV_RUNNING,4,2            ; @IFF_DRV_RUNNING
	.comm	_srchash,4,2                    ; @srchash
	.comm	_IPSEC_SPCOUNT,4,2              ; @IPSEC_SPCOUNT
	.no_dead_strip	_ipsec_delete_tunnel
.subsections_via_symbols
