// File: /workspace/github_c_makefile_star2_O3/albinoloverats[P]hide/src/jpeg-load.c
// Function: jpeg_decode_data
extern bool jpeg_decode_data(FILE *file, jpeg_message_t *msg, jpeg_image_t *info, jpeg_load_e a, bool fill)
{
	message = msg;
	action = a;

	fseek(file, 0, SEEK_END);
	int64_t length = ftell(file);
	fseek(file, 0, SEEK_SET);
	uint8_t *buf = malloc(length);
	fread(buf, length, 1, file);

	// Allocate memory for our decoded jpg structure, all our data will be
	// decompressed and stored in here for the various stages of our jpeg decoding
	stJpegData jdec;
	memset(&jdec, 0x00, sizeof jdec);

	// Start Parsing.....reading & storing data
	if (JpegParseHeader(&jdec, buf) < 0)
	{
		free(buf);
		return false;
	}

	if (fill)
		fill_size = jdec.m_width * jdec.m_height * 3;

	// We've read it all in, now start using it, to decompress and create rgb values
	JpegDecode(&jdec);

	// Get the size of the image
	info->width = jdec.m_width;
	info->height = jdec.m_height;

	info->rgb = calloc(info->height, sizeof (uint8_t *));
	for (uint32_t i = 0; i < info->height; i++)
	{
		info->rgb[i] = calloc(info->width, 3);
		memcpy(info->rgb[i], jdec.m_rgb + i * info->width * 3, info->width * 3);
	}

	// Release the memory for our jpeg decoder structure jdec
	free(jdec.m_rgb);
	free(buf);

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x195a8, %rsp          # imm = 0x195A8
movl %r8d, 0x4(%rsp)
movq %rdx, 0x8(%rsp)
movq %rdi, %rbx
movq %rsi, 0x584b(%rip)      # 0x7108
movl %ecx, 0x584d(%rip)      # 0x7110
xorl %esi, %esi
movl $0x2, %edx
callq 0x1130
movq %rbx, %rdi
callq 0x10e0
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1130
movq %r14, %rdi
callq 0x1110
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rcx
callq 0x1060
leaq 0xa0(%rsp), %rdi
movl $0x19508, %edx          # imm = 0x19508
xorl %esi, %esi
callq 0x1090
cmpb $-0x1, (%r15)
jne 0x22b8
cmpb $-0x28, 0x1(%r15)
jne 0x22b8
movq %r15, 0x30(%rsp)
cmpb $-0x1, 0x2(%r15)
jne 0x1cd6
movq 0x30(%rsp), %r8
addq $0x2, %r8
leaq 0xcfc0(%rsp), %rax
leaq 0x360(%rsp), %r13
xorl %r10d, %r10d
xorpd %xmm0, %xmm0
leaq 0x36fc(%rip), %rdi      # 0x5060
leaq 0x7(%r8), %rdx
addq $0x5, %r8
movq %r8, %r11
movzbl -0x6(%rdx), %ecx
incq %rdx
incq %r8
cmpl $0xff, %ecx
je 0x196c
movzwl -0x6(%rdx), %esi
rolw $0x8, %si
movzwl %si, %r8d
leal -0xd8(%rcx), %esi
cmpl $0x5, %esi
ja 0x19a9
movslq (%rdi,%rsi,4), %rcx
addq %rdi, %rcx
jmpq *%rcx
xorl %r8d, %r8d
jmp 0x1cc1
cmpl $0xc4, %ecx
je 0x1ae6
cmpl $0xc0, %ecx
jne 0x1cc1
movq %r8, %r9
movzbl -0x3(%rdx), %r11d
movzbl -0x2(%rdx), %ebx
movzbl -0x1(%rdx), %ebp
movzbl (%rdx), %r8d
movzbl 0x1(%rdx), %r14d
testl %r14d, %r14d
je 0x1a28
leaq 0x2(%rdx), %r15
movzbl (%r15), %ecx
movzbl 0x1(%r15), %esi
movzbl 0x2(%r15), %edi
imulq $0xa8, %rcx, %rcx
movl %esi, %r12d
andl $0xf, %r12d
movl %r12d, -0xcefc(%rax,%rcx)
shrl $0x4, %esi
movl %esi, -0xcf00(%rax,%rcx)
shll $0x9, %edi
addq %r13, %rdi
movq %rdi, -0xcef8(%rax,%rcx)
addq $0x3, %r15
decl %r14d
jne 0x19e3
shll $0x8, %ebp
orl %r8d, %ebp
shll $0x8, %r11d
orl %ebx, %r11d
movl %ebp, 0xa8(%rsp)
movl %r11d, 0xac(%rsp)
jmp 0x1aca
cmpl $0x3, %r8d
jb 0x1cc1
movq %r8, %r9
leal -0x2(%r8), %r14d
leaq -0x4(%rdx), %rbx
movzbl (%rbx), %r15d
cmpb $0x10, %r15b
jae 0x229f
andl $0xf, %r15d
cmpb $0x3, %r15b
ja 0x229a
shll $0x9, %r15d
addq %r13, %r15
xorl %r8d, %r8d
movq %r11, %r12
xorl %ecx, %ecx
movzbl (%r12,%rcx), %esi
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
movsd %xmm1, (%r15,%rcx,8)
incq %rcx
cmpq $0x8, %rcx
jne 0x1a89
incl %r8d
addq $0x40, %r15
addq $0x8, %r12
cmpl $0x8, %r8d
jne 0x1a87
addq $0x41, %rbx
leal -0x41(%r14), %ecx
addq $0x41, %r11
cmpl $0x41, %r14d
movl %ecx, %r14d
jg 0x1a5e
leaq 0x358f(%rip), %rdi      # 0x5060
movq %r9, %r8
jmp 0x1cc1
movl %r8d, 0xb8(%rsp)
jmp 0x1cc1
movq %r8, 0x18(%rsp)
cmpl $0x3, %r8d
jb 0x1caf
movq 0x18(%rsp), %rcx
leal -0x2(%rcx), %r10d
leaq -0x4(%rdx), %r11
movzbl (%r11), %r8d
movb $0x0, 0x80(%rsp)
incq %r11
xorl %r14d, %r14d
xorl %ebx, %ebx
movzbl (%r11,%r14), %ecx
movb %cl, 0x81(%rsp,%r14)
addl %ecx, %ebx
incq %r14
cmpq $0x10, %r14
jne 0x1b16
cmpl $0x100, %ebx            # imm = 0x100
ja 0x22a4
movl %r8d, %ecx
andl $0xf, %ecx
cmpb $0x4, %cl
jae 0x22a9
addq %r14, %r11
imulq $0x3118, %rcx, %rcx     # imm = 0x3118
cmpb $0x10, %r8b
jae 0x1b85
leaq 0xb60(%rsp), %rsi
leaq (%rsi,%rcx), %r14
testl %ebx, %ebx
je 0x1ba7
addq %rsi, %rcx
addq $0x11, %rcx
movl %ebx, %edi
movb (%r11), %sil
incq %r11
movb %sil, (%rcx)
incq %rcx
decq %rdi
jne 0x1b72
jmp 0x1ba7
leaq (%rax,%rcx), %r14
testl %ebx, %ebx
je 0x1ba7
addq %rax, %rcx
addq $0x11, %rcx
movl %ebx, %edi
movb (%r11), %sil
incq %r11
movb %sil, (%rcx)
incq %rcx
decq %rdi
jne 0x1b96
movq %r13, %r9
leaq 0x1(%r14), %rcx
leaq 0x81(%rsp), %rsi
movdqu (%rsi), %xmm1
movdqu %xmm1, 0x1(%r14)
pxor %xmm1, %xmm1
xorl %edi, %edi
movd (%rcx,%rdi), %xmm2
punpcklbw %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7]
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
paddd %xmm2, %xmm1
addq $0x4, %rdi
cmpq $0x10, %rdi
jne 0x1bc6
pshufd $0xee, %xmm1, %xmm2     # xmm2 = xmm1[2,3,2,3]
paddd %xmm1, %xmm2
pshufd $0x55, %xmm2, %xmm1     # xmm1 = xmm2[1,1,1,1]
paddd %xmm2, %xmm1
movd %xmm1, %r12d
movd %xmm1, 0x114(%r14)
leaq 0x118(%r14), %r15
leaq 0x11c(%r14), %r13
xorl %ebp, %ebp
movl $0x1, %r8d
cmpb $0x0, (%r14,%r8)
je 0x1c46
movslq %ebp, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (,%rcx,4), %rdi
addq %r13, %rdi
xorl %ecx, %ecx
movl %r8d, (%rdi)
incl %ecx
movzbl (%r14,%r8), %esi
addq $0xc, %rdi
cmpl %esi, %ecx
jb 0x1c32
addl %ecx, %ebp
incq %r8
cmpq $0x11, %r8
jne 0x1c17
testl %r12d, %r12d
je 0x1c9c
movl %r12d, %r12d
movl $0x1, %esi
xorl %r13d, %r13d
xorl %ebp, %ebp
leaq (,%r13,2), %rcx
addq %r13, %rcx
movl 0x4(%r15,%rcx,4), %edi
movl %edi, %r8d
subl %esi, %r8d
jle 0x1c82
addl %ebp, %ebp
decl %r8d
jne 0x1c79
movl %edi, %esi
leaq (%r15,%rcx,4), %rcx
movw %bp, 0x8(%rcx)
movzbl 0x11(%r14,%r13), %edi
movl %edi, (%rcx)
incq %r13
incl %ebp
cmpq %r12, %r13
jne 0x1c61
subl %ebx, %r10d
addl $-0x11, %r10d
testl %r10d, %r10d
movq %r9, %r13
jg 0x1b02
movl $0x1, %r10d
leaq 0x33a4(%rip), %rdi      # 0x5060
movq 0x18(%rsp), %r8
movl %r8d, %ecx
leaq (%rdx,%rcx), %r8
addq $-0x6, %r8
cmpb $-0x1, (%r8)
je 0x1964
callq 0x12f5
cmpb $0x3, -0x4(%rdx)
jne 0x22bd
movl $0x3, %esi
leaq 0xb60(%rsp), %r9
movzbl -0x2(%rdx), %ecx
movl %ecx, %edi
andl $0xf, %edi
cmpl $0x4, %edi
jae 0x22ae
cmpb $0x40, %cl
jae 0x22b3
movzbl -0x3(%rdx), %r8d
shrl $0x4, %ecx
imulq $0x3118, %rdi, %rdi     # imm = 0x3118
addq %rax, %rdi
imulq $0xa8, %r8, %r8
movq %rdi, -0xcef0(%rax,%r8)
imulq $0x3118, %rcx, %rcx     # imm = 0x3118
addq %r9, %rcx
movq %rcx, -0xcee8(%rax,%r8)
addq $0x2, %rdx
decl %esi
jne 0x1cf2
movq %rdx, 0xb0(%rsp)
testl %r10d, %r10d
je 0x22c2
movl 0xac(%rsp), %r14d
cmpb $0x0, 0x4(%rsp)
je 0x1d7d
movl 0xa8(%rsp), %eax
imull %r14d, %eax
leal (%rax,%rax,2), %eax
movq %rax, 0x539b(%rip)      # 0x7118
xorl %eax, %eax
movl %eax, 0x539b(%rip)      # 0x7120
movl %eax, 0x5399(%rip)      # 0x7124
movl 0x168(%rsp), %r12d
movl 0x16c(%rsp), %ebp
cmpq $0x0, 0xa0(%rsp)
je 0x1dbf
leal (,%r12,8), %ebx
leal (,%rbp,8), %r15d
movl 0xa8(%rsp), %r13d
jmp 0x1e0c
leal (%r14,%r14,2), %eax
movl 0xa8(%rsp), %r13d
leal (%r13,%r13,2), %ecx
leal (,%r12,8), %ebx
leal (%rax,%r12,8), %esi
cltd
idivl %ebx
subl %edx, %esi
leal (,%rbp,8), %r15d
leal (%rcx,%rbp,8), %edi
movl %ecx, %eax
cltd
idivl %r15d
subl %edx, %edi
imull %esi, %edi
movslq %edi, %rdi
movl $0x1, %esi
callq 0x10c0
movq %rax, 0xa0(%rsp)
xorl %eax, %eax
movl %eax, 0x164(%rsp)
movl %eax, 0x20c(%rsp)
movl %eax, 0x2b4(%rsp)
movl %eax, 0x35c(%rsp)
testl %r14d, %r14d
jle 0x21ed
movl %r12d, %eax
shll $0x6, %eax
movl %eax, 0x28(%rsp)
cvtsi2sd %r12d, %xmm0
movsd 0x31e6(%rip), %xmm2     # 0x5030
movapd %xmm2, %xmm3
cvtsi2sd %ebp, %xmm1
divsd %xmm0, %xmm3
movsd %xmm3, 0x58(%rsp)
divsd %xmm1, %xmm2
movsd %xmm2, 0x60(%rsp)
cmpl $0x2, %ebx
movl $0x1, %eax
movl $0x1, %ecx
cmovgel %ebx, %ecx
movq %rcx, 0x18(%rsp)
movl %ebx, %ecx
movq %rcx, 0x70(%rsp)
cmpl $0x2, %r15d
cmovgel %r15d, %eax
movl %ebx, 0x2c(%rsp)
movslq %ebx, %rcx
movq %rcx, 0x68(%rsp)
movslq %r15d, %rcx
movq %rcx, 0x48(%rsp)
leaq 0xa0(%rsp), %rcx
movq $0x0, 0x10(%rsp)
movq %r12, 0x40(%rsp)
movq %rbp, 0x78(%rsp)
movq %rax, 0x50(%rsp)
testl %r13d, %r13d
jle 0x21d2
movq 0x10(%rsp), %rax
leal (%rax,%rax,2), %eax
movl %eax, 0x24(%rsp)
xorl %eax, %eax
movq %rax, 0x38(%rsp)
leaq (%rax,%rax,2), %rax
addq 0xa0(%rsp), %rax
imull 0x24(%rsp), %r13d
addq %rax, %r13
movq %r13, 0x195a0(%rsp)
testl %ebp, %ebp
jle 0x2156
xorl %eax, %eax
xorl %r12d, %r12d
movl %eax, 0x4(%rsp)
movl %eax, %ebx
movq 0x40(%rsp), %rax
movq %rax, %rbp
testl %eax, %eax
movl 0x2c(%rsp), %r13d
leaq 0x168(%rsp), %r15
leaq 0x19420(%rsp), %r14
jle 0x1f5f
leaq 0xa0(%rsp), %rdi
movl $0x1, %esi
callq 0x22c7
movslq %ebx, %rbx
leaq (%r14,%rbx), %rsi
movq %r15, %rdi
movl %r13d, %edx
callq 0x27a7
leaq 0xa0(%rsp), %rcx
addl $0x8, %ebx
decq %rbp
jne 0x1f2b
incl %r12d
movl 0x4(%rsp), %eax
addl 0x28(%rsp), %eax
movq 0x78(%rsp), %rbp
cmpl %ebp, %r12d
jne 0x1f04
movq %rcx, %rbx
movq %rcx, %rdi
movl $0x2, %esi
callq 0x22c7
leaq 0x210(%rsp), %rdi
leaq 0x19560(%rsp), %rsi
movl $0x8, %edx
callq 0x27a7
movq %rbx, %rdi
movl $0x3, %esi
callq 0x22c7
leaq 0x2b8(%rsp), %rdi
leaq 0x19520(%rsp), %rsi
movl $0x8, %edx
callq 0x27a7
movslq 0xac(%rsp), %rax
movslq 0xa8(%rsp), %rcx
subq 0x10(%rsp), %rax
subq 0x38(%rsp), %rcx
leaq 0x19420(%rsp), %rdx
xorl %esi, %esi
movq 0x40(%rsp), %r12
xorl %r13d, %r13d
movsd 0x60(%rsp), %xmm4
movsd 0x58(%rsp), %xmm5
movq 0x50(%rsp), %r15
movsd 0x302e(%rip), %xmm6     # 0x5038
movsd 0x302e(%rip), %xmm7     # 0x5040
movsd 0x302d(%rip), %xmm8     # 0x5048
movsd 0x302c(%rip), %xmm9     # 0x5050
testl %r12d, %r12d
jle 0x2143
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
mulsd %xmm4, %xmm0
cvttsd2si %xmm0, %edi
shll $0x3, %edi
xorl %r8d, %r8d
cmpq %rcx, %r8
jge 0x2135
cmpq %rax, %rsi
jge 0x2135
movl 0xa8(%rsp), %r9d
imull %esi, %r9d
xorps %xmm0, %xmm0
cvtsi2sd %r8d, %xmm0
mulsd %xmm5, %xmm0
cvttsd2si %xmm0, %r10d
addl %edi, %r10d
movzbl (%rdx,%r8), %r11d
movslq %r10d, %rbx
movzbl 0x19520(%rsp,%rbx), %r10d
xorps %xmm0, %xmm0
cvtsi2sd %r11d, %xmm0
addl $-0x80, %r10d
xorps %xmm1, %xmm1
cvtsi2sd %r10d, %xmm1
movapd %xmm1, %xmm2
mulsd %xmm6, %xmm2
addsd %xmm0, %xmm2
cvttsd2si %xmm2, %r10d
addl %r8d, %r9d
movl $0xff, %r14d
cmpl %r14d, %r10d
cmovgel %r14d, %r10d
testl %r10d, %r10d
cmovlel %r13d, %r10d
movzbl 0x19560(%rsp,%rbx), %r11d
addl $-0x80, %r11d
xorps %xmm2, %xmm2
cvtsi2sd %r11d, %xmm2
movapd %xmm2, %xmm3
mulsd %xmm7, %xmm3
addsd %xmm0, %xmm3
mulsd %xmm8, %xmm1
addsd %xmm3, %xmm1
cvttsd2si %xmm1, %r11d
cmpl %r14d, %r11d
cmovgel %r14d, %r11d
testl %r11d, %r11d
cmovlel %r13d, %r11d
mulsd %xmm9, %xmm2
addsd %xmm0, %xmm2
cvttsd2si %xmm2, %ebx
leal (%r9,%r9,2), %r9d
cmpl %r14d, %ebx
cmovgel %r14d, %ebx
movq 0x195a0(%rsp), %r14
testl %ebx, %ebx
cmovlel %r13d, %ebx
movslq %r9d, %r9
movb %r10b, (%r14,%r9)
movb %r11b, 0x1(%r14,%r9)
movb %bl, 0x2(%r14,%r9)
incq %r8
cmpq %r8, 0x18(%rsp)
jne 0x2042
incq %rsi
addq 0x70(%rsp), %rdx
cmpq %r15, %rsi
jne 0x2024
jmp 0x21a7
movq %rcx, %rbx
movq %rcx, %rdi
movl $0x2, %esi
callq 0x22c7
leaq 0x210(%rsp), %rdi
leaq 0x19560(%rsp), %rsi
movl $0x8, %edx
callq 0x27a7
movq %rbx, %rdi
movl $0x3, %esi
callq 0x22c7
leaq 0x2b8(%rsp), %rdi
leaq 0x19520(%rsp), %rsi
movl $0x8, %edx
callq 0x27a7
movq 0x38(%rsp), %rax
addq 0x68(%rsp), %rax
movslq 0xa8(%rsp), %r13
cmpq %r13, %rax
leaq 0xa0(%rsp), %rcx
jl 0x1ed5
movl 0xac(%rsp), %r14d
movq 0x10(%rsp), %rsi
addq 0x48(%rsp), %rsi
movslq %r14d, %rax
movq %rsi, 0x10(%rsp)
cmpq %rax, %rsi
jl 0x1ebe
movq 0x8(%rsp), %rbx
movl %r13d, 0x8(%rbx)
movl %r14d, 0xc(%rbx)
movl %r14d, %edi
movl $0x8, %esi
callq 0x10c0
movq %rax, (%rbx)
testl %r14d, %r14d
je 0x226f
movq %rbx, %rax
xorl %r14d, %r14d
xorl %r15d, %r15d
movl 0x8(%rax), %ebx
movl $0x3, %esi
movq %rbx, %rdi
callq 0x10c0
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movq %rax, (%rcx,%r15,8)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r15,8), %rdi
movl %r14d, %esi
imull %ebx, %esi
addq 0xa0(%rsp), %rsi
leal (%rbx,%rbx,2), %edx
callq 0x1100
incq %r15
movq 0x8(%rsp), %rax
movl 0xc(%rax), %eax
addl $0x3, %r14d
cmpq %rax, %r15
movq 0x8(%rsp), %rax
jb 0x2218
movq 0xa0(%rsp), %rdi
callq 0x1040
movq 0x30(%rsp), %rdi
callq 0x1040
movb $0x1, %al
addq $0x195a8, %rsp          # imm = 0x195A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x12c8
callq 0x129b
callq 0x11ba
callq 0x118d
callq 0x126e
callq 0x1241
callq 0x1160
callq 0x11e7
callq 0x1214