// File: /workspace/github_c_makefile_star2_O1/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, 0x8(%rsp)
movq %rdx, 0x40(%rsp)
movq %rdi, %rbx
movq %rsi, 0x582f(%rip)      # 0x7108
movl %ecx, 0x5831(%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 0x222d
cmpb $-0x28, 0x1(%r15)
jne 0x222d
movq %r15, 0x38(%rsp)
movq %r15, %rsi
addq $0x2, %rsi
leaq 0xcfc0(%rsp), %rbx
leaq 0xb60(%rsp), %r12
leaq 0x360(%rsp), %r15
xorl %eax, %eax
leaq 0x36ea(%rip), %r14      # 0x5060
movl $0x0, 0x4(%rsp)
cmpb $-0x1, (%rsi)
jne 0x2223
leaq 0x4(%rsi), %rbp
leaq 0x8(%rsi), %r8
addq $0x5, %rsi
movq %r8, %rdx
movq %rsi, %rcx
movzbl -0x3(%rbp), %edi
incq %rbp
incq %r8
incq %rsi
cmpl $0xff, %edi
je 0x1993
movzwl -0x3(%rbp), %esi
rolw $0x8, %si
movzwl %si, %r13d
leal -0xd8(%rdi), %esi
cmpl $0x5, %esi
ja 0x19d6
movslq (%r14,%rsi,4), %rsi
addq %r14, %rsi
jmpq *%rsi
xorl %r13d, %r13d
jmp 0x1c86
cmpl $0xc4, %edi
je 0x1b80
cmpl $0xc0, %edi
jne 0x1c86
movzbl (%rbp), %ecx
movzbl 0x1(%rbp), %edx
movzbl 0x2(%rbp), %esi
movzbl 0x3(%rbp), %edi
movzbl 0x4(%rbp), %r8d
testl %r8d, %r8d
je 0x1a5c
leaq 0x5(%rbp), %r9
movzbl (%r9), %r10d
movzbl 0x1(%r9), %r11d
movzbl 0x2(%r9), %r14d
imulq $0xa8, %r10, %r10
movl %r11d, %r15d
andl $0xf, %r15d
movl %r15d, -0xcefc(%rbx,%r10)
leaq 0x360(%rsp), %r15
shrl $0x4, %r11d
movl %r11d, -0xcf00(%rbx,%r10)
shll $0x9, %r14d
addq %r15, %r14
movq %r14, -0xcef8(%rbx,%r10)
addq $0x3, %r9
decl %r8d
jne 0x1a0c
shll $0x8, %esi
orl %edi, %esi
shll $0x8, %ecx
orl %edx, %ecx
movl %esi, 0xa8(%rsp)
movl %ecx, 0xac(%rsp)
jmp 0x1c7f
cmpl $0x3, %r13d
jb 0x1c86
leal -0x2(%r13), %esi
leaq -0x1(%rbp), %rdx
movzbl (%rdx), %edi
cmpb $0x10, %dil
jae 0x220f
andl $0xf, %edi
cmpb $0x3, %dil
ja 0x2214
shll $0x9, %edi
addq %r15, %rdi
xorl %r8d, %r8d
movq %rcx, %r9
xorl %r10d, %r10d
movzbl (%r9,%r10), %r11d
xorps %xmm0, %xmm0
cvtsi2sd %r11d, %xmm0
movsd %xmm0, (%rdi,%r10,8)
incq %r10
cmpq $0x8, %r10
jne 0x1ab4
incl %r8d
addq $0x40, %rdi
addq $0x8, %r9
cmpl $0x8, %r8d
jne 0x1ab1
addq $0x41, %rdx
leal -0x41(%rsi), %edi
addq $0x41, %rcx
cmpl $0x41, %esi
movl %edi, %esi
jg 0x1a8b
jmp 0x1c86
movl %r13d, 0xb8(%rsp)
jmp 0x1c86
cmpb $0x3, -0x1(%rbp)
jne 0x2228
movl $0x3, %ecx
movzbl -0x2(%rdx), %esi
movl %esi, %edi
andl $0xf, %edi
cmpl $0x4, %edi
jae 0x2205
cmpb $0x40, %sil
jae 0x220a
movzbl -0x3(%rdx), %r8d
shrl $0x4, %esi
imulq $0x3118, %rdi, %rdi     # imm = 0x3118
addq %rbx, %rdi
imulq $0xa8, %r8, %r8
movq %rdi, -0xcef0(%rbx,%r8)
imulq $0x3118, %rsi, %rsi     # imm = 0x3118
addq %r12, %rsi
movq %rsi, -0xcee8(%rbx,%r8)
addq $0x2, %rdx
decl %ecx
jne 0x1b14
movq %rdx, 0xb0(%rsp)
movl $0x1, 0x4(%rsp)
jmp 0x1c86
movzwl -0x3(%rbp), %eax
rolw $0x8, %ax
cmpw $0x3, %ax
jb 0x1c6a
movzwl %ax, %r15d
addl $-0x2, %r15d
leaq -0x1(%rbp), %r12
movzbl (%r12), %eax
movb $0x0, 0x80(%rsp)
xorl %r14d, %r14d
movl $0x1, %ecx
movzbl (%r12,%rcx), %edx
movb %dl, 0x80(%rsp,%rcx)
addl %edx, %r14d
incq %rcx
cmpq $0x11, %rcx
jne 0x1bb3
cmpl $0x100, %r14d           # imm = 0x100
ja 0x2219
movl %eax, %edx
andl $0xf, %edx
cmpb $0x4, %dl
jae 0x221e
addq %rcx, %r12
cmpb $0x10, %al
jae 0x1c22
imulq $0x3118, %rdx, %rax     # imm = 0x3118
leaq 0xb60(%rsp), %rcx
leaq (%rcx,%rax), %rsi
testl %r14d, %r14d
je 0x1c4d
addq %rcx, %rax
addq $0x11, %rax
movl %r14d, %ecx
movb (%r12), %dl
incq %r12
movb %dl, (%rax)
incq %rax
decq %rcx
jne 0x1c0f
jmp 0x1c4d
imulq $0x3118, %rdx, %rax     # imm = 0x3118
leaq (%rbx,%rax), %rsi
testl %r14d, %r14d
je 0x1c4d
addq %rbx, %rax
addq $0x11, %rax
movl %r14d, %ecx
movb (%r12), %dl
incq %r12
movb %dl, (%rax)
incq %rax
decq %rcx
jne 0x1c3c
leaq 0x80(%rsp), %rdi
callq 0x2237
subl %r14d, %r15d
addl $-0x11, %r15d
testl %r15d, %r15d
jg 0x1b9e
movl $0x1, %eax
leaq 0xb60(%rsp), %r12
leaq 0x360(%rsp), %r15
leaq 0x33da(%rip), %r14      # 0x5060
movl %r13d, %ecx
leaq (%rcx,%rbp), %rsi
addq $-0x3, %rsi
cmpl $0x0, 0x4(%rsp)
je 0x197e
testl %eax, %eax
je 0x2232
cmpb $0x0, 0x8(%rsp)
je 0x1cc4
movl 0xa8(%rsp), %eax
imull 0xac(%rsp), %eax
leal (%rax,%rax,2), %eax
movq %rax, 0x5454(%rip)      # 0x7118
xorl %ebx, %ebx
movl %ebx, 0x5454(%rip)      # 0x7120
movl %ebx, 0x5452(%rip)      # 0x7124
movl 0x168(%rsp), %eax
movq %rax, 0x8(%rsp)
movl 0x16c(%rsp), %eax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0xa0(%rsp)
jne 0x1d4e
movl 0xa8(%rsp), %ecx
movl 0xac(%rsp), %eax
leal (%rax,%rax,2), %eax
leal (%rcx,%rcx,2), %ecx
movq 0x8(%rsp), %rdx
leal (,%rdx,8), %esi
leal (%rax,%rdx,8), %edi
cltd
idivl %esi
subl %edx, %edi
movq 0x10(%rsp), %rax
leal (,%rax,8), %esi
leal (%rcx,%rax,8), %r8d
movl %ecx, %eax
cltd
idivl %esi
subl %edx, %r8d
imull %edi, %r8d
movslq %r8d, %rdi
movl $0x1, %esi
callq 0x10c0
movq %rax, 0xa0(%rsp)
movl %ebx, 0x164(%rsp)
movl %ebx, 0x20c(%rsp)
movl %ebx, 0x2b4(%rsp)
movl %ebx, 0x35c(%rsp)
cmpl %ebx, 0xac(%rsp)
jle 0x2158
movq 0x8(%rsp), %rcx
leal (,%rcx,8), %edi
movq 0x10(%rsp), %rdx
leal (,%rdx,8), %eax
movl %ecx, %esi
shll $0x6, %esi
movl %esi, 0x28(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd 0x3289(%rip), %xmm1     # 0x5030
movapd %xmm1, %xmm2
divsd %xmm0, %xmm2
movsd %xmm2, 0x68(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x70(%rsp)
cmpl $0x2, %edi
movl $0x1, %r15d
movl $0x1, %r12d
cmovgel %edi, %r12d
movl %edi, %r13d
cmpl $0x2, %eax
cmovgel %eax, %r15d
movl %edi, 0x2c(%rsp)
movslq %edi, %rcx
movq %rcx, 0x78(%rsp)
cltq
movq %rax, 0x48(%rsp)
leaq 0xa0(%rsp), %rdx
movq $0x0, 0x18(%rsp)
movq %r15, 0x60(%rsp)
movq %r12, 0x58(%rsp)
movq %r13, 0x50(%rsp)
movl 0xa8(%rsp), %eax
testl %eax, %eax
jle 0x2138
movq 0x18(%rsp), %rcx
leal (%rcx,%rcx,2), %ecx
movl %ecx, 0x24(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x30(%rsp)
leaq (%rcx,%rcx,2), %rcx
addq 0xa0(%rsp), %rcx
imull 0x24(%rsp), %eax
addq %rcx, %rax
movq %rax, 0x195a0(%rsp)
cmpl $0x0, 0x10(%rsp)
jle 0x20c4
xorl %eax, %eax
xorl %r13d, %r13d
movl %eax, 0x4(%rsp)
movl %eax, %r12d
movq 0x8(%rsp), %rax
movq %rax, %rbx
testl %eax, %eax
leaq 0x168(%rsp), %rbp
movl 0x2c(%rsp), %r15d
leaq 0x19420(%rsp), %r14
jle 0x1ec1
leaq 0xa0(%rsp), %rdi
movl $0x1, %esi
callq 0x22f5
movslq %r12d, %r12
leaq (%r14,%r12), %rsi
movq %rbp, %rdi
movl %r15d, %edx
callq 0x286c
leaq 0xa0(%rsp), %rdx
addl $0x8, %r12d
decq %rbx
jne 0x1e8c
incl %r13d
movl 0x4(%rsp), %eax
addl 0x28(%rsp), %eax
cmpl 0x10(%rsp), %r13d
jne 0x1e64
movq %rdx, %rbx
movq %rdx, %rdi
movl $0x2, %esi
callq 0x22f5
leaq 0x210(%rsp), %rdi
leaq 0x19560(%rsp), %rsi
movl $0x8, %edx
callq 0x286c
movq %rbx, %rdi
movl $0x3, %esi
callq 0x22f5
leaq 0x2b8(%rsp), %rdi
leaq 0x19520(%rsp), %rsi
movl $0x8, %edx
callq 0x286c
cmpl $0x0, 0x10(%rsp)
leaq 0x19420(%rsp), %rdx
movsd 0x70(%rsp), %xmm4
movsd 0x68(%rsp), %xmm5
movq 0x60(%rsp), %r15
movq 0x58(%rsp), %r12
movq 0x50(%rsp), %r13
movsd 0x30e4(%rip), %xmm6     # 0x5038
movsd 0x30e4(%rip), %xmm7     # 0x5040
movsd 0x30e3(%rip), %xmm8     # 0x5048
movsd 0x30e2(%rip), %xmm9     # 0x5050
jle 0x2115
movslq 0xac(%rsp), %rax
movslq 0xa8(%rsp), %rcx
subq 0x18(%rsp), %rax
subq 0x30(%rsp), %rcx
xorl %esi, %esi
cmpl $0x0, 0x8(%rsp)
jle 0x20b3
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
mulsd %xmm4, %xmm0
cvttsd2si %xmm0, %edi
shll $0x3, %edi
xorl %r8d, %r8d
cmpq %rcx, %r8
jge 0x20a7
cmpq %rax, %rsi
jge 0x20a7
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
movl $0x0, %ebp
cmovlel %ebp, %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 %ebp, %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 %ebp, %ebx
movslq %r9d, %r9
movb %r10b, (%r14,%r9)
movb %r11b, 0x1(%r14,%r9)
movb %bl, 0x2(%r14,%r9)
incq %r8
cmpq %r8, %r12
jne 0x1fb0
incq %rsi
addq %r13, %rdx
cmpq %r15, %rsi
jne 0x1f90
jmp 0x2115
movq %rdx, %rbx
movq %rdx, %rdi
movl $0x2, %esi
callq 0x22f5
leaq 0x210(%rsp), %rdi
leaq 0x19560(%rsp), %rsi
movl $0x8, %edx
callq 0x286c
movq %rbx, %rdi
movl $0x3, %esi
callq 0x22f5
leaq 0x2b8(%rsp), %rdi
leaq 0x19520(%rsp), %rsi
movl $0x8, %edx
callq 0x286c
movq 0x30(%rsp), %rcx
addq 0x78(%rsp), %rcx
movslq 0xa8(%rsp), %rax
cmpq %rax, %rcx
leaq 0xa0(%rsp), %rdx
jl 0x1e33
movq 0x18(%rsp), %rsi
addq 0x48(%rsp), %rsi
movslq 0xac(%rsp), %rax
movq %rsi, 0x18(%rsp)
cmpq %rax, %rsi
jl 0x1e16
movl 0xa8(%rsp), %eax
movq 0x40(%rsp), %r12
movl %eax, 0x8(%r12)
movl 0xac(%rsp), %ebx
movl %ebx, 0xc(%r12)
movl $0x8, %esi
movq %rbx, %rdi
callq 0x10c0
movq %rax, (%r12)
testq %rbx, %rbx
je 0x21da
xorl %r14d, %r14d
xorl %r15d, %r15d
movl 0x8(%r12), %ebx
movl $0x3, %esi
movq %rbx, %rdi
callq 0x10c0
movq (%r12), %rcx
movq %rax, (%rcx,%r15,8)
movq (%r12), %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
movl 0xc(%r12), %eax
addl $0x3, %r14d
cmpq %rax, %r15
jb 0x2191
movq 0xa0(%rsp), %rdi
callq 0x1040
movq 0x38(%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 0x126e
callq 0x1241
callq 0x129b
callq 0x12c8
callq 0x11e7
callq 0x11ba
callq 0x118d
callq 0x1214
callq 0x1160
callq 0x12f5