	.file	"166807.c"
	.intel_syntax noprefix
	.text
	.type	CVE_2013_3670_VULN_rle_unpack, @function
CVE_2013_3670_VULN_rle_unpack:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 80
	mov	QWORD PTR -56[rbp], rdi
	mov	DWORD PTR -60[rbp], esi
	mov	DWORD PTR -64[rbp], edx
	mov	QWORD PTR -72[rbp], rcx
	mov	DWORD PTR -76[rbp], r8d
	mov	eax, DWORD PTR -76[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -72[rbp]
	add	rax, rdx
	mov	QWORD PTR -16[rbp], rax
	mov	rax, QWORD PTR -56[rbp]
	mov	QWORD PTR -32[rbp], rax
	mov	eax, DWORD PTR -60[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -56[rbp]
	add	rax, rdx
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -72[rbp]
	mov	QWORD PTR -24[rbp], rax
	mov	eax, DWORD PTR -64[rbp]
	and	eax, 1
	test	eax, eax
	je	.L2
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR -32[rbp]
	test	rax, rax
	jg	.L3
	mov	eax, 0
	jmp	.L4
.L3:
	mov	rdx, QWORD PTR -32[rbp]
	lea	rax, 1[rdx]
	mov	QWORD PTR -32[rbp], rax
	mov	rax, QWORD PTR -24[rbp]
	lea	rcx, 1[rax]
	mov	QWORD PTR -24[rbp], rcx
	movzx	edx, BYTE PTR [rdx]
	mov	BYTE PTR [rax], dl
.L2:
	sar	DWORD PTR -64[rbp]
	mov	DWORD PTR -40[rbp], 0
.L15:
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR -32[rbp]
	test	rax, rax
	jle	.L16
	mov	rax, QWORD PTR -32[rbp]
	lea	rdx, 1[rax]
	mov	QWORD PTR -32[rbp], rdx
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	mov	DWORD PTR -36[rbp], eax
	mov	eax, DWORD PTR -36[rbp]
	and	eax, 128
	test	eax, eax
	je	.L7
	mov	eax, DWORD PTR -36[rbp]
	and	eax, 127
	add	eax, eax
	mov	DWORD PTR -36[rbp], eax
	mov	rax, QWORD PTR -16[rbp]
	sub	rax, QWORD PTR -24[rbp]
	mov	rdx, rax
	mov	eax, DWORD PTR -36[rbp]
	cdqe
	cmp	rdx, rax
	jl	.L8
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR -32[rbp]
	mov	rdx, rax
	mov	eax, DWORD PTR -36[rbp]
	cdqe
	cmp	rdx, rax
	jge	.L9
.L8:
	mov	rax, QWORD PTR -32[rbp]
	sub	rax, QWORD PTR -56[rbp]
	jmp	.L4
.L9:
	mov	eax, DWORD PTR -36[rbp]
	movsx	rdx, eax
	mov	rcx, QWORD PTR -32[rbp]
	mov	rax, QWORD PTR -24[rbp]
	mov	rsi, rcx
	mov	rdi, rax
	call	memcpy@PLT
	mov	eax, DWORD PTR -36[rbp]
	cdqe
	add	QWORD PTR -32[rbp], rax
	mov	eax, DWORD PTR -36[rbp]
	cdqe
	add	QWORD PTR -24[rbp], rax
	jmp	.L10
.L7:
	mov	rax, QWORD PTR -16[rbp]
	sub	rax, QWORD PTR -24[rbp]
	mov	rdx, rax
	mov	eax, DWORD PTR -40[rbp]
	cdqe
	cmp	rdx, rax
	jl	.L11
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR -32[rbp]
	cmp	rax, 1
	jg	.L12
.L11:
	mov	rax, QWORD PTR -32[rbp]
	sub	rax, QWORD PTR -56[rbp]
	jmp	.L4
.L12:
	mov	DWORD PTR -40[rbp], 0
	jmp	.L13
.L14:
	mov	rax, QWORD PTR -24[rbp]
	lea	rdx, 1[rax]
	mov	QWORD PTR -24[rbp], rdx
	mov	rdx, QWORD PTR -32[rbp]
	movzx	edx, BYTE PTR [rdx]
	mov	BYTE PTR [rax], dl
	mov	rax, QWORD PTR -24[rbp]
	lea	rdx, 1[rax]
	mov	QWORD PTR -24[rbp], rdx
	mov	rdx, QWORD PTR -32[rbp]
	movzx	edx, BYTE PTR 1[rdx]
	mov	BYTE PTR [rax], dl
	add	DWORD PTR -40[rbp], 1
.L13:
	mov	eax, DWORD PTR -40[rbp]
	cmp	eax, DWORD PTR -36[rbp]
	jl	.L14
	add	QWORD PTR -32[rbp], 2
.L10:
	mov	eax, DWORD PTR -36[rbp]
	add	DWORD PTR -40[rbp], eax
	mov	eax, DWORD PTR -40[rbp]
	cmp	eax, DWORD PTR -64[rbp]
	jl	.L15
	jmp	.L6
.L16:
	nop
.L6:
	mov	rax, QWORD PTR -32[rbp]
	sub	rax, QWORD PTR -56[rbp]
.L4:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	CVE_2013_3670_VULN_rle_unpack, .-CVE_2013_3670_VULN_rle_unpack
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.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, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"166807.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	CVE_2013_3670_VULN_rle_unpack, %function
CVE_2013_3670_VULN_rle_unpack:
	@ args = 4, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #40
	str	r0, [fp, #-32]
	str	r1, [fp, #-36]
	str	r2, [fp, #-40]
	str	r3, [fp, #-44]
	ldr	r3, [fp, #4]
	ldr	r2, [fp, #-44]
	add	r3, r2, r3
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-32]
	str	r3, [fp, #-28]
	ldr	r3, [fp, #-36]
	ldr	r2, [fp, #-32]
	add	r3, r2, r3
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-44]
	str	r3, [fp, #-24]
	ldr	r3, [fp, #-40]
	and	r3, r3, #1
	cmp	r3, #0
	beq	.L2
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-28]
	sub	r3, r2, r3
	cmp	r3, #0
	bgt	.L3
	mov	r3, #0
	b	.L4
.L3:
	ldr	r2, [fp, #-28]
	add	r3, r2, #1
	str	r3, [fp, #-28]
	ldr	r3, [fp, #-24]
	add	r1, r3, #1
	str	r1, [fp, #-24]
	ldrb	r2, [r2]	@ zero_extendqisi2
	strb	r2, [r3]
.L2:
	ldr	r3, [fp, #-40]
	asr	r3, r3, #1
	str	r3, [fp, #-40]
	mov	r3, #0
	str	r3, [fp, #-20]
.L15:
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-28]
	sub	r3, r2, r3
	cmp	r3, #0
	ble	.L16
	ldr	r3, [fp, #-28]
	add	r2, r3, #1
	str	r2, [fp, #-28]
	ldrb	r3, [r3]	@ zero_extendqisi2
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-16]
	and	r3, r3, #128
	cmp	r3, #0
	beq	.L7
	ldr	r3, [fp, #-16]
	and	r3, r3, #127
	lsl	r3, r3, #1
	str	r3, [fp, #-16]
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-24]
	sub	r3, r2, r3
	ldr	r2, [fp, #-16]
	cmp	r2, r3
	bgt	.L8
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-28]
	sub	r3, r2, r3
	ldr	r2, [fp, #-16]
	cmp	r2, r3
	ble	.L9
.L8:
	ldr	r2, [fp, #-28]
	ldr	r3, [fp, #-32]
	sub	r3, r2, r3
	b	.L4
.L9:
	ldr	r3, [fp, #-16]
	mov	r2, r3
	ldr	r1, [fp, #-28]
	ldr	r0, [fp, #-24]
	bl	memcpy
	ldr	r3, [fp, #-16]
	ldr	r2, [fp, #-28]
	add	r3, r2, r3
	str	r3, [fp, #-28]
	ldr	r3, [fp, #-16]
	ldr	r2, [fp, #-24]
	add	r3, r2, r3
	str	r3, [fp, #-24]
	b	.L10
.L7:
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-24]
	sub	r3, r2, r3
	ldr	r2, [fp, #-20]
	cmp	r2, r3
	bgt	.L11
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-28]
	sub	r3, r2, r3
	cmp	r3, #1
	bgt	.L12
.L11:
	ldr	r2, [fp, #-28]
	ldr	r3, [fp, #-32]
	sub	r3, r2, r3
	b	.L4
.L12:
	mov	r3, #0
	str	r3, [fp, #-20]
	b	.L13
.L14:
	ldr	r3, [fp, #-24]
	add	r2, r3, #1
	str	r2, [fp, #-24]
	ldr	r2, [fp, #-28]
	ldrb	r2, [r2]	@ zero_extendqisi2
	strb	r2, [r3]
	ldr	r3, [fp, #-24]
	add	r2, r3, #1
	str	r2, [fp, #-24]
	ldr	r2, [fp, #-28]
	ldrb	r2, [r2, #1]	@ zero_extendqisi2
	strb	r2, [r3]
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
.L13:
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	blt	.L14
	ldr	r3, [fp, #-28]
	add	r3, r3, #2
	str	r3, [fp, #-28]
.L10:
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-16]
	add	r3, r2, r3
	str	r3, [fp, #-20]
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-40]
	cmp	r2, r3
	blt	.L15
	b	.L6
.L16:
	nop
.L6:
	ldr	r2, [fp, #-28]
	ldr	r3, [fp, #-32]
	sub	r3, r2, r3
.L4:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	CVE_2013_3670_VULN_rle_unpack, .-CVE_2013_3670_VULN_rle_unpack
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
