	.file	"extr_Proto_IkePacket.c_IkeBuildEx.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"ISAKMP: Packet Encrypt Failed\n"
	.text
	.p2align 4
	.globl	IkeBuildEx
	.type	IkeBuildEx, @function
IkeBuildEx:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	sub	rsp, 64
	.cfi_def_cfa_offset 112
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 56[rsp], rax
	xor	eax, eax
	test	rdi, rdi
	je	.L12
	mov	r12, QWORD PTR 16[rdi]
	mov	rbx, rdi
	test	r12, r12
	je	.L1
	mov	r13, rsp
	mov	r14, rsi
	mov	esi, 56
	mov	ebp, edx
	mov	rdi, r13
	call	Zero@PLT
	mov	edi, DWORD PTR 56[rbx]
	call	Endian64@PLT
	mov	edi, DWORD PTR 52[rbx]
	mov	QWORD PTR 48[rsp], rax
	call	Endian64@PLT
	mov	rdi, QWORD PTR 16[rbx]
	mov	QWORD PTR 40[rsp], rax
	call	IkeGetFirstPayloadType@PLT
	mov	DWORD PTR 32[rsp], eax
	mov	eax, DWORD PTR IKE_VERSION[rip]
	mov	DWORD PTR 28[rsp], eax
	mov	eax, DWORD PTR 48[rbx]
	mov	DWORD PTR 24[rsp], eax
	xor	eax, eax
	cmp	QWORD PTR [rbx], 0
	je	.L3
	mov	eax, DWORD PTR IKE_HEADER_FLAG_ENCRYPTED[rip]
.L3:
	cmp	QWORD PTR 40[rbx], 0
	je	.L4
	or	eax, DWORD PTR IKE_HEADER_FLAG_COMMIT[rip]
.L4:
	cmp	QWORD PTR 32[rbx], 0
	je	.L5
	or	eax, DWORD PTR IKE_HEADER_FLAG_AUTH_ONLY[rip]
.L5:
	mov	rdi, QWORD PTR 24[rbx]
	mov	DWORD PTR [rsp], eax
	call	Endian32@PLT
	mov	rdi, QWORD PTR 8[rbx]
	mov	QWORD PTR 16[rsp], rax
	test	ebp, ebp
	je	.L6
	test	rdi, rdi
	je	.L6
	call	CloneBuf@PLT
	mov	rdi, QWORD PTR 8[rbx]
	mov	rbp, rax
	test	rdi, rdi
	je	.L8
	call	FreeBuf@PLT
	.p2align 4,,10
	.p2align 3
.L8:
	mov	rdi, rbp
	call	CloneBuf@PLT
	cmp	QWORD PTR [rbx], 0
	mov	QWORD PTR 8[rbx], rax
	jne	.L28
.L9:
	mov	rax, QWORD PTR 0[rbp]
	lea	rdi, 56[rax]
	call	Endian32@PLT
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	call	NewBuf@PLT
	mov	edx, 56
	mov	rsi, r13
	mov	r12, rax
	mov	rdi, rax
	call	WriteBuf@PLT
	mov	rsi, rbp
	mov	rdi, r12
	call	WriteBufBuf@PLT
	mov	rdi, rbp
	call	FreeBuf@PLT
	xor	edx, edx
	xor	esi, esi
	mov	rdi, r12
	call	SeekBuf@PLT
.L1:
	mov	rax, QWORD PTR 56[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L29
	add	rsp, 64
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	mov	rax, r12
	pop	rbx
	.cfi_def_cfa_offset 40
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_restore_state
	mov	rdi, QWORD PTR 16[rbx]
	call	IkeBuildPayloadList@PLT
	mov	rdi, QWORD PTR 8[rbx]
	mov	rbp, rax
	test	rdi, rdi
	je	.L8
	call	FreeBuf@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L28:
	mov	edi, DWORD PTR 8[rbp]
	mov	rsi, QWORD PTR 0[rbp]
	mov	rdx, r14
	call	IkeEncryptWithPadding@PLT
	mov	r12, rax
	test	rax, rax
	je	.L30
	mov	rdi, rbp
	mov	rbp, r12
	call	FreeBuf@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L12:
	xor	r12d, r12d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L30:
	lea	rdi, .LC0[rip]
	call	Debug@PLT
	mov	rdi, rbp
	call	FreeBuf@PLT
	jmp	.L1
.L29:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	IkeBuildEx, .-IkeBuildEx
	.comm	IKE_VERSION,4,4
	.comm	IKE_HEADER_FLAG_ENCRYPTED,4,4
	.comm	IKE_HEADER_FLAG_COMMIT,4,4
	.comm	IKE_HEADER_FLAG_AUTH_ONLY,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_Proto_IkePacket.c_IkeBuildEx.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"ISAKMP: Packet Encrypt Failed\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	IkeBuildEx
	.syntax unified
	.arm
	.fpu softvfp
	.type	IkeBuildEx, %function
IkeBuildEx:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, lr}
	ldr	r3, .L37
	sub	sp, sp, #44
	subs	r4, r0, #0
	ldr	r3, [r3]
	str	r3, [sp, #36]
	mov	r3,#0
	beq	.L12
	ldr	r5, [r4, #8]
	cmp	r5, #0
	beq	.L1
	mov	r7, r1
	add	r0, sp, #4
	mov	r1, #32
	mov	r6, r2
	bl	Zero
	ldr	r0, [r4, #32]
	bl	Endian64
	mov	r3, r0
	ldr	r0, [r4, #28]
	str	r3, [sp, #32]
	bl	Endian64
	mov	r3, r0
	ldr	r0, [r4, #8]
	str	r3, [sp, #28]
	bl	IkeGetFirstPayloadType
	ldr	r2, .L37+4
	ldr	r3, [r4]
	ldr	r1, [r2]
	ldr	r2, [r4, #24]
	cmp	r3, #0
	ldrne	r3, .L37+8
	str	r2, [sp, #16]
	ldr	r2, [r4, #20]
	ldrne	r3, [r3]
	cmp	r2, #0
	ldrne	r2, .L37+12
	str	r0, [sp, #24]
	ldrne	r2, [r2]
	ldr	r0, [r4, #12]
	orrne	r3, r3, r2
	ldr	r2, [r4, #16]
	str	r1, [sp, #20]
	cmp	r2, #0
	ldrne	r2, .L37+16
	ldrne	r2, [r2]
	orrne	r3, r3, r2
	str	r3, [sp, #4]
	bl	Endian32
	ldr	r3, [r4, #4]
	str	r0, [sp, #12]
	cmp	r6, #0
	cmpne	r3, #0
	bne	.L33
	ldr	r0, [r4, #8]
	bl	IkeBuildPayloadList
	mov	r6, r0
.L7:
	ldr	r0, [r4, #4]
	cmp	r0, #0
	beq	.L8
	bl	FreeBuf
.L8:
	mov	r0, r6
	bl	CloneBuf
	ldr	r3, [r4]
	str	r0, [r4, #4]
	cmp	r3, #0
	bne	.L34
.L9:
	ldr	r0, [r6]
	add	r0, r0, #32
	bl	Endian32
	str	r0, [sp, #8]
	bl	NewBuf
	mov	r5, r0
	mov	r2, #32
	add	r1, sp, #4
	bl	WriteBuf
	mov	r1, r6
	mov	r0, r5
	bl	WriteBufBuf
	mov	r0, r6
	bl	FreeBuf
	mov	r2, #0
	mov	r0, r5
	mov	r1, r2
	bl	SeekBuf
.L1:
	ldr	r3, .L37
	ldr	r2, [r3]
	ldr	r3, [sp, #36]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L35
	mov	r0, r5
	add	sp, sp, #44
	@ sp needed
	pop	{r4, r5, r6, r7, pc}
.L34:
	mov	r2, r7
	ldr	r1, [r6]
	ldr	r0, [r6, #4]
	bl	IkeEncryptWithPadding
	subs	r5, r0, #0
	beq	.L36
	mov	r0, r6
	bl	FreeBuf
	mov	r6, r5
	b	.L9
.L33:
	mov	r0, r3
	bl	CloneBuf
	mov	r6, r0
	b	.L7
.L12:
	mov	r5, r4
	b	.L1
.L36:
	ldr	r0, .L37+20
	bl	Debug
	mov	r0, r6
	bl	FreeBuf
	b	.L1
.L35:
	bl	__stack_chk_fail
.L38:
	.align	2
.L37:
	.word	.LC1
	.word	IKE_VERSION
	.word	IKE_HEADER_FLAG_ENCRYPTED
	.word	IKE_HEADER_FLAG_COMMIT
	.word	IKE_HEADER_FLAG_AUTH_ONLY
	.word	.LC0
	.size	IkeBuildEx, .-IkeBuildEx
	.comm	IKE_VERSION,4,4
	.comm	IKE_HEADER_FLAG_ENCRYPTED,4,4
	.comm	IKE_HEADER_FLAG_COMMIT,4,4
	.comm	IKE_HEADER_FLAG_AUTH_ONLY,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
