	.file	"extr_picotls.c_buffer_encrypt_record.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	buffer_encrypt_record, @function
buffer_encrypt_record:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	lea	rax, 0[0+rsi*8]
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	mov	r14, rdx
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rsi
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	r13, QWORD PTR [rdi]
	mov	rdx, QWORD PTR 8[rdi]
	mov	QWORD PTR 16[rsp], rax
	sub	r13, rsi
	mov	rax, QWORD PTR [rdx+rsi*8]
	lea	r12, -5[r13]
	cmp	QWORD PTR PTLS_MAX_PLAINTEXT_RECORD_SIZE[rip], r12
	mov	QWORD PTR 8[rsp], rax
	jb	.L2
	mov	rax, QWORD PTR [r14]
	mov	rax, QWORD PTR [rax]
	mov	r13d, DWORD PTR [rax]
	add	r13d, 1
	movsx	r13, r13d
	mov	rsi, r13
	call	ptls_buffer_reserve@PLT
	mov	r9d, eax
	test	eax, eax
	je	.L7
.L1:
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r9d
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	rdi, r12
	mov	QWORD PTR 16[rsp], rdx
	call	malloc@PLT
	mov	rdx, QWORD PTR 16[rsp]
	test	rax, rax
	mov	r15, rax
	je	.L8
	lea	rax, 0[0+rbx*8]
	mov	rdi, r15
	lea	rsi, 40[rdx+rax]
	mov	rdx, r12
	call	memcpy@PLT
	mov	rsi, r13
	lea	rdi, 0[0+rbx*8]
	add	rdi, QWORD PTR 8[rbp]
	call	ptls_clear_memory@PLT
	mov	QWORD PTR 0[rbp], rbx
	mov	r8, r14
	mov	rcx, r12
	mov	rsi, QWORD PTR 8[rsp]
	mov	rdx, r15
	mov	rdi, rbp
	call	buffer_push_encrypted_records@PLT
	mov	rsi, r12
	mov	rdi, r15
	mov	DWORD PTR 8[rsp], eax
	call	ptls_clear_memory@PLT
	mov	rdi, r15
	call	free@PLT
	mov	r9d, DWORD PTR 8[rsp]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L7:
	mov	DWORD PTR 28[rsp], eax
	mov	rax, QWORD PTR 8[rbp]
	lea	rcx, 0[0+rbx*8]
	mov	rdi, r14
	mov	r8, QWORD PTR 8[rsp]
	lea	rsi, 40[rax+rcx]
	mov	rcx, r12
	add	r12, r13
	mov	rdx, rsi
	call	aead_encrypt@PLT
	xor	edi, edi
	cmp	r12, rax
	mov	r15, rax
	sete	dil
	call	assert@PLT
	mov	rax, QWORD PTR 8[rbp]
	mov	rcx, r15
	add	QWORD PTR 0[rbp], r13
	mov	rdx, QWORD PTR PTLS_CONTENT_TYPE_APPDATA[rip]
	and	r15d, 255
	mov	r9d, DWORD PTR 28[rsp]
	mov	QWORD PTR [rax+rbx*8], rdx
	movzx	edx, ch
	mov	rcx, QWORD PTR 16[rsp]
	mov	QWORD PTR 24[rax+rcx], rdx
	mov	QWORD PTR 32[rax+rcx], r15
	jmp	.L1
.L8:
	mov	r9d, DWORD PTR PTLS_ERROR_NO_MEMORY[rip]
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	buffer_encrypt_record, .-buffer_encrypt_record
	.comm	PTLS_MAX_PLAINTEXT_RECORD_SIZE,8,8
	.comm	PTLS_ERROR_NO_MEMORY,4,4
	.comm	PTLS_CONTENT_TYPE_APPDATA,8,8
	.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_picotls.c_buffer_encrypt_record.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	buffer_encrypt_record, %function
buffer_encrypt_record:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r4, r1
	ldr	r3, [r0]
	ldr	r1, .L8
	sub	fp, r3, r4
	ldr	ip, [r1]
	ldr	r1, [r0, #4]
	sub	r6, fp, #5
	sub	sp, sp, #20
	add	r3, r1, r4, lsl #2
	cmp	ip, r6
	mov	r5, r0
	mov	r7, r2
	ldr	r10, [r1, r4, lsl #2]
	str	r3, [sp, #8]
	lsl	r9, r4, #2
	bcc	.L2
	ldr	r3, [r2]
	ldr	r3, [r3]
	ldr	r8, [r3]
	add	r8, r8, #1
	mov	r1, r8
	bl	ptls_buffer_reserve
	subs	fp, r0, #0
	beq	.L7
.L1:
	mov	r0, fp
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L2:
	mov	r0, r6
	str	r1, [sp, #12]
	bl	malloc
	subs	r8, r0, #0
	ldreq	r3, .L8+4
	ldr	r1, [sp, #12]
	ldreq	fp, [r3]
	beq	.L1
	add	r9, r9, #20
	mov	r2, r6
	add	r1, r1, r9
	bl	memcpy
	mov	r1, fp
	ldr	r0, [sp, #8]
	bl	ptls_clear_memory
	mov	r3, r6
	mov	r2, r8
	mov	r1, r10
	str	r4, [r5]
	mov	r0, r5
	str	r7, [sp]
	bl	buffer_push_encrypted_records
	mov	fp, r0
	mov	r1, r6
	mov	r0, r8
	bl	ptls_clear_memory
	mov	r0, r8
	bl	free
	mov	r0, fp
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L7:
	ldr	r2, [r5, #4]
	add	r3, r9, #20
	add	r2, r2, r3
	mov	r1, r2
	mov	r3, r6
	mov	r0, r7
	str	r10, [sp]
	bl	aead_encrypt
	mov	r7, r0
	add	r0, r6, r8
	sub	r0, r0, r7
	clz	r0, r0
	lsr	r0, r0, #5
	bl	assert
	ldr	r0, .L8+8
	ldr	r2, [r5]
	ldr	r0, [r0]
	ldr	r1, [r5, #4]
	add	r8, r2, r8
	str	r8, [r5]
	str	r0, [r1, r4, lsl #2]
	mov	r0, fp
	lsr	r3, r7, #8
	add	r9, r1, r9
	and	r3, r3, #255
	and	r7, r7, #255
	str	r3, [r9, #12]
	str	r7, [r9, #16]
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L9:
	.align	2
.L8:
	.word	PTLS_MAX_PLAINTEXT_RECORD_SIZE
	.word	PTLS_ERROR_NO_MEMORY
	.word	PTLS_CONTENT_TYPE_APPDATA
	.size	buffer_encrypt_record, .-buffer_encrypt_record
	.comm	PTLS_MAX_PLAINTEXT_RECORD_SIZE,4,4
	.comm	PTLS_ERROR_NO_MEMORY,4,4
	.comm	PTLS_CONTENT_TYPE_APPDATA,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
