	.file	"extr_lodepng.c_lodepng_chunk_append.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	lodepng_chunk_append
	.type	lodepng_chunk_append, @function
lodepng_chunk_append:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13, rdi
	mov	rdi, rdx
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12, rsi
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdx
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	call	lodepng_chunk_length@PLT
	mov	rbp, QWORD PTR [r12]
	mov	r8d, 77
	mov	r14d, eax
	add	eax, 12
	cmp	rbp, rax
	mov	DWORD PTR 12[rsp], eax
	lea	r15, 0[rbp+rax]
	cmovnb	rax, rbp
	cmp	rax, r15
	ja	.L1
	mov	rdi, QWORD PTR 0[r13]
	mov	rsi, r15
	call	lodepng_realloc@PLT
	mov	r8d, 83
	test	rax, rax
	je	.L1
	mov	edx, DWORD PTR 12[rsp]
	mov	QWORD PTR 0[r13], rax
	mov	QWORD PTR [r12], r15
	test	edx, edx
	je	.L5
	lea	edx, 11[r14]
	lea	rsi, 1[rbp+rdx]
	add	rsi, rax
	add	rax, rbp
	sub	rbx, rax
	mov	rdx, rbx
	.p2align 4,,10
	.p2align 3
.L4:
	movzx	ecx, BYTE PTR [rdx+rax]
	add	rax, 1
	mov	BYTE PTR -1[rax], cl
	cmp	rax, rsi
	jne	.L4
.L5:
	xor	r8d, r8d
.L1:
	add	rsp, 24
	.cfi_def_cfa_offset 56
	mov	eax, r8d
	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
	.cfi_endproc
.LFE0:
	.size	lodepng_chunk_append, .-lodepng_chunk_append
	.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_lodepng.c_lodepng_chunk_append.c"
	.text
	.align	2
	.global	lodepng_chunk_append
	.syntax unified
	.arm
	.fpu softvfp
	.type	lodepng_chunk_append, %function
lodepng_chunk_append:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r6, r1
	mov	r9, r0
	mov	r0, r2
	mov	r4, r2
	bl	lodepng_chunk_length
	ldr	r5, [r6]
	add	r7, r0, #12
	cmp	r5, r7
	movcs	r3, r5
	movcc	r3, r7
	add	r10, r5, r7
	cmp	r3, r10
	bhi	.L6
	mov	r8, r0
	mov	r1, r10
	ldr	r0, [r9]
	bl	lodepng_realloc
	cmp	r0, #0
	beq	.L7
	cmp	r7, #0
	str	r0, [r9]
	str	r10, [r6]
	beq	.L5
	mov	r3, r4
	add	r4, r4, #12
	sub	r1, r5, r3
	add	r1, r1, r0
	add	r0, r4, r8
.L4:
	add	r2, r1, r3
	ldrb	ip, [r3], #1	@ zero_extendqisi2
	cmp	r3, r0
	strb	ip, [r2]
	bne	.L4
.L5:
	mov	r0, #0
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L6:
	mov	r0, #77
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L7:
	mov	r0, #83
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
	.size	lodepng_chunk_append, .-lodepng_chunk_append
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
