	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nsim_ipsec_add_sa
_nsim_ipsec_add_sa:                     ## @nsim_ipsec_add_sa
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	movq	16(%rdi), %r15
	movq	%r15, %rdi
	callq	_netdev_priv
	movq	%rax, %r14
	movl	24(%r12), %edx
	movq	_IPPROTO_ESP@GOTPCREL(%rip), %r13
	cmpl	(%r13), %edx
	je	LBB0_4
## %bb.1:
	movq	_IPPROTO_AH@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	je	LBB0_4
## %bb.2:
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_netdev_err
	jmp	LBB0_3
LBB0_4:
	cmpq	$0, 136(%r12)
	je	LBB0_6
## %bb.5:
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_netdev_err
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
LBB0_20:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	%r14, %rdi
	callq	_nsim_ipsec_find_empty_idx
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_7
## %bb.8:
	leaq	-80(%rbp), %rdi
	xorl	%esi, %esi
	movl	$40, %edx
	callq	_memset
	movl	$1, -80(%rbp)
	movq	%r12, -48(%rbp)
	movl	(%r13), %eax
	testl	%eax, 24(%r12)
	je	LBB0_12
## %bb.9:
	movl	$1, %eax
	cmpq	$0, 128(%r12)
	jne	LBB0_11
## %bb.10:
	xorl	%eax, %eax
	cmpq	$0, 120(%r12)
	setne	%al
LBB0_11:
	movl	%eax, -76(%rbp)
LBB0_12:
	movl	-52(%rbp), %esi
	leaq	-56(%rbp), %rdx
	movq	%r12, %rdi
	callq	_nsim_ipsec_parse_proto_keys
	testl	%eax, %eax
	je	LBB0_14
## %bb.13:
	movl	%eax, %r13d
	leaq	L_.str.3(%rip), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_netdev_err
	movl	%r13d, %ebx
	jmp	LBB0_20
LBB0_7:
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_netdev_err
	jmp	LBB0_20
LBB0_14:
	movl	%ebx, %ebx
	movq	_XFRM_OFFLOAD_INBOUND@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_19
## %bb.15:
	movl	$1, -72(%rbp)
	movq	112(%r12), %rax
	movq	_AF_INET6@GOTPCREL(%rip), %rcx
	movq	-64(%rbp), %rdi
	cmpq	(%rcx), %rax
	jne	LBB0_17
## %bb.16:
	leaq	72(%r12), %rsi
	movl	$16, %edx
	jmp	LBB0_18
LBB0_17:
	addq	$12, %rdi
	leaq	32(%r12), %rsi
	movl	$4, %edx
LBB0_18:
	callq	_memcpy
LBB0_19:
	leaq	(,%rbx,4), %rdi
	addq	8(%r14), %rdi
	leaq	-80(%rbp), %rsi
	movl	$40, %edx
	callq	_memcpy
	movq	_NSIM_IPSEC_VALID@GOTPCREL(%rip), %rax
	orq	(%rax), %rbx
	movq	%rbx, 8(%r12)
	incl	(%r14)
	xorl	%ebx, %ebx
	jmp	LBB0_20
	.cfi_endproc
                                        ## -- End function
	.comm	_IPPROTO_ESP,4,2                ## @IPPROTO_ESP
	.comm	_IPPROTO_AH,4,2                 ## @IPPROTO_AH
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unsupported protocol 0x%04x for ipsec offload\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"Compression offload not supported\n"

L_.str.2:                               ## @.str.2
	.asciz	"No space for SA in Rx table!\n"

L_.str.3:                               ## @.str.3
	.asciz	"Failed to get key data for SA table\n"

	.comm	_XFRM_OFFLOAD_INBOUND,4,2       ## @XFRM_OFFLOAD_INBOUND
	.comm	_AF_INET6,8,3                   ## @AF_INET6
	.comm	_NSIM_IPSEC_VALID,8,3           ## @NSIM_IPSEC_VALID
	.no_dead_strip	_nsim_ipsec_add_sa
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nsim_ipsec_add_sa
_nsim_ipsec_add_sa:                     ; @nsim_ipsec_add_sa
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
	ldr	x21, [x0, #16]
	mov	x0, x21
	bl	_netdev_priv
	ldr	w8, [x19, #24]
Lloh0:
	adrp	x23, _IPPROTO_ESP@GOTPAGE
Lloh1:
	ldr	x23, [x23, _IPPROTO_ESP@GOTPAGEOFF]
	ldr	w9, [x23]
Lloh2:
	adrp	x10, _IPPROTO_AH@GOTPAGE
Lloh3:
	ldr	x10, [x10, _IPPROTO_AH@GOTPAGEOFF]
Lloh4:
	ldr	w10, [x10]
	cmp	w8, w9
	ccmp	w8, w10, #4, ne
	b.ne	LBB0_3
; %bb.1:
	ldr	x8, [x19, #136]
	cbz	x8, LBB0_6
; %bb.2:
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_4
LBB0_3:
	str	x8, [sp]
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
LBB0_4:
	mov	x0, x21
	bl	_netdev_err
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_5:
	mov	x0, x22
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_6:
	mov	x20, x0
	bl	_nsim_ipsec_find_empty_idx
	mov	x22, x0
	tbnz	w0, #31, LBB0_10
; %bb.7:
	add	x24, sp, #8
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #40
	bl	_memset
	mov	w8, #1
	str	w8, [sp, #8]
	str	x19, [sp, #40]
	ldr	w8, [x19, #24]
	ldr	w9, [x23]
	tst	w9, w8
	b.eq	LBB0_13
; %bb.8:
	ldr	x8, [x19, #128]
	cbz	x8, LBB0_11
; %bb.9:
	mov	w8, #1
	b	LBB0_12
LBB0_10:
Lloh12:
	adrp	x1, l_.str.2@PAGE
Lloh13:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x21
	bl	_netdev_err
	b	LBB0_5
LBB0_11:
	ldr	x8, [x19, #120]
	cmp	x8, #0
	cset	w8, ne
LBB0_12:
	str	w8, [sp, #12]
LBB0_13:
	ldr	w1, [sp, #36]
	add	x2, x24, #24
	mov	x0, x19
	bl	_nsim_ipsec_parse_proto_keys
	cbz	w0, LBB0_15
; %bb.14:
	mov	x23, x0
Lloh14:
	adrp	x1, l_.str.3@PAGE
Lloh15:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x21
	bl	_netdev_err
	mov	x22, x23
	b	LBB0_5
LBB0_15:
	mov	w21, w22
	ldr	w8, [x19]
Lloh16:
	adrp	x9, _XFRM_OFFLOAD_INBOUND@GOTPAGE
Lloh17:
	ldr	x9, [x9, _XFRM_OFFLOAD_INBOUND@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_20
; %bb.16:
	mov	w8, #1
	str	w8, [sp, #16]
	ldr	x8, [x19, #112]
Lloh19:
	adrp	x9, _AF_INET6@GOTPAGE
Lloh20:
	ldr	x9, [x9, _AF_INET6@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	ldr	x0, [sp, #24]
	cmp	x8, x9
	b.ne	LBB0_18
; %bb.17:
	add	x1, x19, #72
	mov	w2, #16
	b	LBB0_19
LBB0_18:
	add	x0, x0, #12
	add	x1, x19, #32
	mov	w2, #4
LBB0_19:
	bl	_memcpy
LBB0_20:
	ldr	x8, [x20, #8]
	add	x0, x8, x21, lsl #2
	add	x1, sp, #8
	mov	w2, #40
	bl	_memcpy
	mov	w22, #0
Lloh22:
	adrp	x8, _NSIM_IPSEC_VALID@GOTPAGE
Lloh23:
	ldr	x8, [x8, _NSIM_IPSEC_VALID@GOTPAGEOFF]
Lloh24:
	ldr	x8, [x8]
	orr	x8, x8, x21
	str	x8, [x19, #8]
	ldr	w8, [x20]
	add	w8, w8, #1
	str	w8, [x20]
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_IPPROTO_ESP,4,2                ; @IPPROTO_ESP
	.comm	_IPPROTO_AH,4,2                 ; @IPPROTO_AH
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unsupported protocol 0x%04x for ipsec offload\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"Compression offload not supported\n"

l_.str.2:                               ; @.str.2
	.asciz	"No space for SA in Rx table!\n"

l_.str.3:                               ; @.str.3
	.asciz	"Failed to get key data for SA table\n"

	.comm	_XFRM_OFFLOAD_INBOUND,4,2       ; @XFRM_OFFLOAD_INBOUND
	.comm	_AF_INET6,8,3                   ; @AF_INET6
	.comm	_NSIM_IPSEC_VALID,8,3           ; @NSIM_IPSEC_VALID
	.no_dead_strip	_nsim_ipsec_add_sa
.subsections_via_symbols
