// File: /workspace/github_c_makefile_star2_O2/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 $0x19598, %rsp          # imm = 0x19598
movl %r8d, 0x14(%rsp)
movq %rdx, 0x28(%rsp)
movq %rdi, %rbx
movq %rsi, 0x4a77(%rip)      # 0x6108
movl %ecx, 0x4a79(%rip)      # 0x6110
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x1140
movq %rbx, %rdi
callq 0x10e0
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1140
movq %r14, %rdi
callq 0x1110
movq %rax, %r15
pushq $0x1
popq %rdx
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rcx
callq 0x1060
leaq 0x90(%rsp), %rdi
movl $0x19508, %edx          # imm = 0x19508
xorl %esi, %esi
callq 0x1090
cmpb $-0x1, (%r15)
jne 0x206d
cmpb $-0x28, 0x1(%r15)
jne 0x206d
movq %r15, 0x48(%rsp)
addq $0x2, %r15
leaq 0xb50(%rsp), %rdx
leaq 0x350(%rsp), %r13
xorl %eax, %eax
xorl %ebx, %ebx
testl %eax, %eax
jne 0x1ae7
cmpb $-0x1, (%r15)
jne 0x2022
leaq 0x4(%r15), %r9
leaq 0x8(%r15), %rcx
addq $0x5, %r15
movq %rcx, %r12
movq %r15, %r14
movzbl -0x3(%r9), %esi
incq %r9
incq %rcx
incq %r15
cmpl $0xff, %esi
je 0x1738
movzwl -0x3(%r9), %ecx
rolw $0x8, %cx
movzwl %cx, %eax
movq %rax, 0x8(%rsp)
leal -0xd8(%rsi), %ecx
cmpl $0x5, %ecx
ja 0x1788
leaq 0x28e9(%rip), %rax      # 0x4060
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
xorl %r10d, %r10d
jmp 0x1ad5
cmpl $0xc4, %esi
je 0x1928
cmpl $0xc0, %esi
jne 0x1ad0
movzbl (%r9), %edi
movzbl 0x1(%r9), %r8d
movzbl 0x2(%r9), %ebp
movzbl 0x3(%r9), %esi
movzbl 0x4(%r9), %r14d
leaq 0x5(%r9), %r15
subl $0x1, %r14d
jb 0x1ab2
movzbl (%r15), %ecx
movzbl 0x1(%r15), %r10d
movzbl 0x2(%r15), %r11d
imulq $0xa8, %rcx, %rcx
movl %r10d, %r12d
andl $0xf, %r12d
leaq 0xcfb0(%rsp), %rax
movl %r12d, -0xcefc(%rax,%rcx)
shrl $0x4, %r10d
movl %r10d, -0xcf00(%rax,%rcx)
shll $0x9, %r11d
addq %r13, %r11
movq %r11, -0xcef8(%rax,%rcx)
addq $0x3, %r15
jmp 0x17bc
movq 0x8(%rsp), %rax
leal -0x2(%rax), %ebp
leaq -0x1(%r9), %r12
testl %ebp, %ebp
jle 0x1ad0
movzbl (%r12), %r8d
cmpb $0x10, %r8b
jae 0x1f62
andl $0xf, %r8d
cmpb $0x3, %r8b
ja 0x1f84
shll $0x9, %r8d
addq %r13, %r8
xorl %esi, %esi
movq %r14, %rdi
cmpl $0x8, %esi
je 0x187e
xorl %ecx, %ecx
cmpq $0x8, %rcx
je 0x1872
movzbl (%rdi,%rcx), %r10d
cvtsi2sd %r10d, %xmm0
movsd %xmm0, (%r8,%rcx,8)
incq %rcx
jmp 0x1857
incl %esi
addq $0x40, %r8
addq $0x8, %rdi
jmp 0x1850
addq $0x41, %r12
addl $-0x41, %ebp
addq $0x41, %r14
jmp 0x181f
movq 0x8(%rsp), %r10
movl %r10d, 0xa8(%rsp)
jmp 0x1ad5
cmpb $0x3, -0x1(%r9)
jne 0x204e
pushq $0x3
popq %rdi
movq 0x8(%rsp), %r10
subl $0x1, %edi
jb 0x1918
movzbl -0x2(%r12), %esi
movl %esi, %r8d
andl $0xf, %r8d
cmpl $0x4, %r8d
jae 0x1fa6
cmpb $0x40, %sil
jae 0x1fc5
movzbl -0x3(%r12), %ecx
shrl $0x4, %esi
imulq $0x3118, %r8, %r8       # imm = 0x3118
leaq 0xcfb0(%rsp), %rax
addq %rax, %r8
imulq $0xa8, %rcx, %rcx
movq %r8, -0xcef0(%rax,%rcx)
imulq $0x3118, %rsi, %rsi     # imm = 0x3118
addq %rdx, %rsi
movq %rsi, -0xcee8(%rax,%rcx)
addq $0x2, %r12
jmp 0x18b0
movq %r12, 0xa0(%rsp)
pushq $0x1
popq %rax
jmp 0x1ad7
movq 0x8(%rsp), %rax
leal -0x2(%rax), %ebx
leaq -0x1(%r9), %r14
testl %ebx, %ebx
jle 0x1acd
movzbl (%r14), %esi
movb $0x0, 0x70(%rsp)
xorl %edi, %edi
xorl %r12d, %r12d
cmpq $0x10, %rdi
je 0x1962
movzbl 0x1(%r14,%rdi), %ecx
movb %cl, 0x71(%rsp,%rdi)
addl %ecx, %r12d
incq %rdi
jmp 0x194a
cmpl $0x100, %r12d           # imm = 0x100
ja 0x1fe4
movl %esi, %ecx
andl $0xf, %ecx
cmpb $0x4, %cl
jae 0x2003
movq %r13, %rax
addq %rdi, %r14
incq %r14
movl %r12d, %r8d
imulq $0x3118, %rcx, %rcx     # imm = 0x3118
cmpb $0x10, %sil
jae 0x19b5
leaq (%rdx,%rcx), %r13
leaq (%rdx,%rcx), %rsi
addq $0x11, %rsi
subq $0x1, %r8
jb 0x19db
movb (%r14), %cl
incq %r14
movb %cl, (%rsi)
incq %rsi
jmp 0x19a2
leaq 0xcfb0(%rsp), %rsi
leaq (%rsi,%rcx), %r13
addq %rcx, %rsi
addq $0x11, %rsi
subq $0x1, %r8
jb 0x19db
movb (%r14), %cl
incq %r14
movb %cl, (%rsi)
incq %rsi
jmp 0x19c8
xorl %ecx, %ecx
cmpq $0x10, %rcx
je 0x19f2
movb 0x71(%rsp,%rcx), %sil
movb %sil, 0x1(%r13,%rcx)
incq %rcx
jmp 0x19dd
xorl %esi, %esi
xorl %r8d, %r8d
cmpq $0x10, %rsi
je 0x1a0b
movzbl 0x1(%r13,%rsi), %ecx
addl %ecx, %r8d
incq %rsi
jmp 0x19f7
movl %r8d, 0x114(%r13)
leaq 0x118(%r13), %rbp
leaq 0x11c(%r13), %rdi
pushq $0x1
popq %r15
xorl %esi, %esi
cmpq $0x11, %r15
je 0x1a58
movslq %esi, %rsi
imulq $0xc, %rsi, %r10
addq %rdi, %r10
xorl %r11d, %r11d
movzbl (%r13,%r15), %ecx
cmpl %ecx, %r11d
jae 0x1a50
movl %r15d, (%r10)
incq %r11
addq $0xc, %r10
jmp 0x1a39
incq %r15
addq %r11, %rsi
jmp 0x1a26
movl %r8d, %r8d
xorl %edi, %edi
xorl %r15d, %r15d
pushq $0x1
popq %rcx
cmpq %r8, %rdi
je 0x1aa4
imulq $0xc, %rdi, %rsi
leaq (%rsi,%rbp), %r10
movl 0x4(%rbp,%rsi), %r11d
cmpl %r11d, %ecx
cmovgl %ecx, %r11d
movl %r11d, %esi
subl %ecx, %esi
subl $0x1, %esi
jb 0x1a8b
addl %r15d, %r15d
jmp 0x1a81
movw %r15w, 0x8(%r10)
movzbl 0x11(%r13,%rdi), %ecx
movl %ecx, (%r10)
incq %rdi
incl %r15d
movl %r11d, %ecx
jmp 0x1a63
subl %r12d, %ebx
addl $-0x11, %ebx
movq %rax, %r13
jmp 0x1934
shll $0x8, %ebp
orl %esi, %ebp
shll $0x8, %edi
orl %r8d, %edi
movl %ebp, 0x98(%rsp)
movl %edi, 0x9c(%rsp)
jmp 0x1ad0
pushq $0x1
popq %rbx
movq 0x8(%rsp), %r10
xorl %eax, %eax
movl %r10d, %ecx
leaq (%r9,%rcx), %r15
addq $-0x3, %r15
jmp 0x171a
testl %ebx, %ebx
je 0x208c
cmpb $0x0, 0x14(%rsp)
je 0x1b0f
movl 0x98(%rsp), %eax
imull 0x9c(%rsp), %eax
leal (%rax,%rax,2), %eax
movq %rax, 0x4609(%rip)      # 0x6118
andl $0x0, 0x460a(%rip)      # 0x6120
andl $0x0, 0x4607(%rip)      # 0x6124
movl 0x158(%rsp), %r15d
movl 0x15c(%rsp), %r14d
cmpq $0x0, 0x90(%rsp)
je 0x1b4a
leal (,%r15,8), %ebp
leal (,%r14,8), %r12d
jmp 0x1b95
imull $0x3, 0x9c(%rsp), %eax
imull $0x3, 0x98(%rsp), %ecx
leal (,%r15,8), %ebp
leal (%rax,%r15,8), %esi
cltd
idivl %ebp
subl %edx, %esi
leal (,%r14,8), %r12d
leal (%rcx,%r14,8), %edi
movl %ecx, %eax
cltd
idivl %r12d
subl %edx, %edi
imull %esi, %edi
movslq %edi, %rdi
pushq $0x1
popq %rsi
callq 0x10c0
movq %rax, 0x90(%rsp)
leaq 0x158(%rsp), %rax
andl $0x0, -0x4(%rax)
andl $0x0, 0xa4(%rax)
andl $0x0, 0x14c(%rax)
andl $0x0, 0x1f4(%rax)
movl %r15d, %eax
shll $0x6, %eax
movl %eax, 0x1c(%rsp)
xorl %ebx, %ebx
testl %r15d, %r15d
movl $0x0, %eax
cmovgl %r15d, %eax
movq %rax, 0x60(%rsp)
testl %r14d, %r14d
movl $0x0, %eax
cmovgl %r14d, %eax
movl %eax, 0x20(%rsp)
cvtsi2sd %r15d, %xmm0
movsd 0x2440(%rip), %xmm1     # 0x4030
movapd %xmm1, %xmm2
divsd %xmm0, %xmm2
movsd %xmm2, 0x8(%rsp)
cvtsi2sd %r14d, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x58(%rsp)
testl %ebp, %ebp
movl $0x0, %r15d
cmovgl %ebp, %r15d
movslq %ebp, %rax
movq %rax, 0x40(%rsp)
testl %r12d, %r12d
movl $0x0, %eax
cmovgl %r12d, %eax
movq %rax, 0x68(%rsp)
movslq %r12d, %rax
movq %rax, 0x50(%rsp)
movl $0xff, %r14d
xorl %eax, %eax
movslq 0x9c(%rsp), %r13
cmpq %r13, %rax
jge 0x1ebc
movq %rax, 0x30(%rsp)
leal (%rax,%rax,2), %eax
movl %eax, 0x18(%rsp)
xorl %ecx, %ecx
movslq 0x98(%rsp), %rax
cmpq %rax, %rcx
jge 0x1ead
movq %rcx, 0x38(%rsp)
leaq (%rcx,%rcx,2), %rcx
addq 0x90(%rsp), %rcx
imull 0x18(%rsp), %eax
addq %rcx, %rax
movq %rax, 0x19590(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpl 0x20(%rsp), %ecx
je 0x1cf7
movl %ecx, 0x24(%rsp)
movq 0x60(%rsp), %r12
movl %eax, 0x14(%rsp)
movl %eax, %r13d
subq $0x1, %r12
jb 0x1ce7
leaq 0x90(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x20ab
movslq %r13d, %r13
leaq 0x19410(%rsp), %rax
leaq (%rax,%r13), %rsi
leaq 0x158(%rsp), %rdi
movl %ebp, %edx
callq 0x2430
addl $0x8, %r13d
jmp 0x1cad
movl 0x24(%rsp), %ecx
incl %ecx
movl 0x14(%rsp), %eax
addl 0x1c(%rsp), %eax
jmp 0x1c97
leaq 0x90(%rsp), %r12
movq %r12, %rdi
pushq $0x2
popq %rsi
callq 0x20ab
leaq 0x200(%rsp), %rdi
leaq 0x19550(%rsp), %rsi
pushq $0x8
popq %r13
movl %r13d, %edx
callq 0x2430
movq %r12, %rdi
pushq $0x3
popq %rsi
callq 0x20ab
leaq 0x2a8(%rsp), %rdi
leaq 0x19510(%rsp), %rsi
movl %r13d, %edx
callq 0x2430
movslq 0x98(%rsp), %rax
movslq 0x9c(%rsp), %rcx
subq 0x30(%rsp), %rcx
subq 0x38(%rsp), %rax
leaq 0x19410(%rsp), %rdx
xorl %esi, %esi
cmpq 0x68(%rsp), %rsi
je 0x1e9e
cvtsi2sd %esi, %xmm0
mulsd 0x58(%rsp), %xmm0
cvttsd2si %xmm0, %edi
shll $0x3, %edi
xorl %r8d, %r8d
cmpq %r8, %r15
je 0x1e91
cmpq %rax, %r8
jge 0x1e89
cmpq %rcx, %rsi
jge 0x1e89
movl 0x98(%rsp), %r9d
imull %esi, %r9d
cvtsi2sd %r8d, %xmm0
mulsd 0x8(%rsp), %xmm0
cvttsd2si %xmm0, %r10d
addl %edi, %r10d
movzbl (%rdx,%r8), %r11d
movslq %r10d, %r12
movzbl 0x19510(%rsp,%r12), %r10d
cvtsi2sd %r11d, %xmm0
addl $-0x80, %r10d
cvtsi2sd %r10d, %xmm1
movapd %xmm1, %xmm2
mulsd 0x2247(%rip), %xmm2     # 0x4038
addsd %xmm0, %xmm2
cvttsd2si %xmm2, %r10d
addl %r8d, %r9d
cmpl %r14d, %r10d
cmovgel %r14d, %r10d
testl %r10d, %r10d
cmovlel %ebx, %r10d
movzbl 0x19550(%rsp,%r12), %r11d
addl $-0x80, %r11d
cvtsi2sd %r11d, %xmm2
movapd %xmm2, %xmm3
mulsd 0x2217(%rip), %xmm3     # 0x4040
addsd %xmm0, %xmm3
mulsd 0x2213(%rip), %xmm1     # 0x4048
addsd %xmm3, %xmm1
cvttsd2si %xmm1, %r11d
cmpl %r14d, %r11d
cmovgel %r14d, %r11d
testl %r11d, %r11d
cmovlel %ebx, %r11d
mulsd 0x21fc(%rip), %xmm2     # 0x4050
addsd %xmm0, %xmm2
cvttsd2si %xmm2, %r12d
leal (%r9,%r9,2), %r9d
cmpl %r14d, %r12d
cmovgel %r14d, %r12d
movq 0x19590(%rsp), %r13
testl %r12d, %r12d
cmovlel %ebx, %r12d
movslq %r9d, %r9
movb %r10b, (%r13,%r9)
movb %r11b, 0x1(%r13,%r9)
movb %r12b, 0x2(%r13,%r9)
incq %r8
jmp 0x1d8c
incq %rsi
addq 0x40(%rsp), %rdx
jmp 0x1d6d
movq 0x38(%rsp), %rcx
addq 0x40(%rsp), %rcx
jmp 0x1c61
movq 0x30(%rsp), %rax
addq 0x50(%rsp), %rax
jmp 0x1c42
movl %r13d, %edi
movl 0x98(%rsp), %eax
movq 0x28(%rsp), %rbx
movl %eax, 0x8(%rbx)
movl %r13d, 0xc(%rbx)
pushq $0x8
popq %rsi
callq 0x10c0
movq %rax, (%rbx)
xorl %r15d, %r15d
pushq $0x3
popq %rbx
xorl %r12d, %r12d
movl %r13d, %eax
cmpq %rax, %r12
jae 0x1f37
movq 0x28(%rsp), %r13
movl 0x8(%r13), %r14d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x10c0
movq (%r13), %rcx
movq %rax, (%rcx,%r12,8)
movq (%r13), %rax
movq (%rax,%r12,8), %rdi
movl %r15d, %esi
imull %r14d, %esi
addq 0x90(%rsp), %rsi
leal (%r14,%r14,2), %edx
callq 0x1100
incq %r12
movl 0xc(%r13), %r13d
addl $0x3, %r15d
jmp 0x1ee6
movq 0x90(%rsp), %rdi
callq 0x1040
movq 0x48(%rsp), %rdi
callq 0x1040
movb $0x1, %al
addq $0x19598, %rsp          # imm = 0x19598
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x408f(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x221d(%rip), %rsi      # 0x4190
leaq 0x2224(%rip), %rdx      # 0x419e
movl $0x166, %ecx            # imm = 0x166
jmp 0x203f
movq 0x406d(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x21fb(%rip), %rsi      # 0x4190
leaq 0x2202(%rip), %rdx      # 0x419e
movl $0x16b, %ecx            # imm = 0x16B
jmp 0x203f
movq 0x404b(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x21d9(%rip), %rsi      # 0x4190
leaq 0x21e0(%rip), %rdx      # 0x419e
movl $0x19a, %ecx            # imm = 0x19A
jmp 0x203f
movq 0x402c(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x21ba(%rip), %rsi      # 0x4190
leaq 0x21c1(%rip), %rdx      # 0x419e
movl $0x19f, %ecx            # imm = 0x19F
jmp 0x203f
movq 0x400d(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x219b(%rip), %rsi      # 0x4190
leaq 0x21a2(%rip), %rdx      # 0x419e
movl $0x1ca, %ecx            # imm = 0x1CA
jmp 0x203f
movq 0x3fee(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x217c(%rip), %rsi      # 0x4190
leaq 0x2183(%rip), %rdx      # 0x419e
movl $0x1cf, %ecx            # imm = 0x1CF
jmp 0x203f
movq 0x3fcf(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x215d(%rip), %rsi      # 0x4190
leaq 0x2164(%rip), %rdx      # 0x419e
movl $0x235, %ecx            # imm = 0x235
xorl %eax, %eax
callq 0x10d0
pushq $-0x1
popq %rdi
callq 0x1150
movq 0x3fa3(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x2131(%rip), %rsi      # 0x4190
leaq 0x2138(%rip), %rdx      # 0x419e
movl $0x18e, %ecx            # imm = 0x18E
jmp 0x203f
movq 0x3f84(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x2112(%rip), %rsi      # 0x4190
leaq 0x2119(%rip), %rdx      # 0x419e
movl $0x241, %ecx            # imm = 0x241
jmp 0x203f
movq 0x3f65(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x20f3(%rip), %rsi      # 0x4190
leaq 0x20fa(%rip), %rdx      # 0x419e
movl $0x22e, %ecx            # imm = 0x22E
jmp 0x203f