// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/src/fmtutil.c
// Function: fmtutil_atari_decode_image
int fmtutil_atari_decode_image(deark *c, struct atari_img_decode_data *adata)
{
	switch(adata->bpp) {
	case 16:
		return decode_atari_image_16(c, adata);
	case 8: case 4: case 2: case 1:
		return decode_atari_image_paletted(c, adata);
	}

	de_err(c, "Unsupported bits/pixel (%d)", (int)adata->bpp);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq (%rsi), %rcx
cmpq $0x10, %rcx
ja 0xed4d2
movq %rsi, %rbx
movl $0x116, %eax            # imm = 0x116
btq %rcx, %rax
jae 0xed461
movq 0x8(%rbx), %r8
movq 0x10(%rbx), %rsi
leaq 0xf(%rsi), %rax
pushq $0x10
popq %rdi
cqto
idivq %rdi
leaq (%rax,%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rdx, %rdi
pushq $0x1
popq %rdx
shlq %cl, %rdx
imulq %rcx, %rdi
movq %rdi, 0x30(%rsp)
testq %r8, %r8
cmovlel %edx, %r8d
movq %r8, 0x40(%rsp)
leal -0x1(%r8), %edx
movl %edx, 0x1c(%rsp)
imulq %rcx, %rax
addq %rax, %rax
movq %rax, 0x38(%rsp)
movq $0x0, 0x10(%rsp)
xorl %r14d, %r14d
cmpq 0x18(%rbx), %r14
jge 0xed4be
movq 0x30(%rsp), %rax
imulq %r14, %rax
movq %rax, 0x48(%rsp)
imull $0x30, %r14d, %eax
movl %eax, 0x18(%rsp)
xorl %r13d, %r13d
movq %r14, 0x20(%rsp)
cmpq %rsi, %r13
jge 0xed44a
movq %r13, %rax
shrq $0x4, %rax
movq 0x10(%rsp), %r15
leaq (%r15,%rax,2), %r14
movq %r13, %rcx
shrq %rcx
andq $-0x10, %rcx
addq %r15, %rcx
andl $0x1, %eax
leaq (%rcx,%rax,8), %r12
movq %r13, %rbp
andq $-0x10, %rbp
addq %r15, %rbp
movq %r13, (%rsp)
andl $0xf, %r13d
movq %r13, 0x28(%rsp)
xorl %r13d, %r13d
movq $0x0, 0x8(%rsp)
movq (%rbx), %rax
cmpq %rax, %r13
jge 0xed3c7
cmpl $0x0, 0x28(%rbx)
je 0xed377
movq 0x20(%rbx), %rdi
pushq $0x1
popq %rsi
movq %r15, %rdx
movq (%rsp), %rcx
callq 0xe74bf
testb %al, %al
je 0xed361
movq 0x8(%rsp), %rax
btsl %r13d, %eax
movq %rax, 0x8(%rsp)
incq %r13
addq $0x2, %r14
addq $0x2, %r12
addq $0x2, %rbp
addq 0x50(%rsp), %r15
jmp 0xed32a
decq %rax
cmpq $0x7, %rax
ja 0xed361
leaq 0x4f7d1(%rip), %rcx     # 0x13cb58
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x20(%rbx), %rdi
pushq $0x1
popq %rsi
movq 0x48(%rsp), %rdx
jmp 0xed346
movq 0x20(%rbx), %rdi
pushq $0x1
popq %rsi
movq %r12, %rdx
jmp 0xed3c0
movq 0x20(%rbx), %rdi
pushq $0x1
popq %rsi
movq %r14, %rdx
jmp 0xed346
movq 0x20(%rbx), %rdi
pushq $0x1
popq %rsi
movq %rbp, %rdx
movq 0x28(%rsp), %rcx
jmp 0xed34a
cmpl $0x0, 0x2c(%rbx)
je 0xed411
movq 0x8(%rsp), %rdi
movl %edi, %eax
imulq $0xa, %rax, %rax
leaq -0x5(%rax), %rcx
incq %rax
testb $0x1, %dil
cmovneq %rcx, %rax
leaq 0xa0(%rax), %rcx
leal 0x10(%rdi), %edx
leal 0x20(%rdi), %esi
movq (%rsp), %r13
cmpq %r13, %rax
cmovgl %edi, %edx
cmpq %r13, %rcx
cmovlel %esi, %edx
addl 0x18(%rsp), %edx
movl %edx, %ecx
movq 0x20(%rsp), %r14
jmp 0xed41f
movq 0x20(%rsp), %r14
movq (%rsp), %r13
movq 0x8(%rsp), %rcx
cmpl 0x40(%rsp), %ecx
cmovael 0x1c(%rsp), %ecx
movq 0x30(%rbx), %rax
movq 0x38(%rbx), %rdi
movl (%rax,%rcx,4), %ecx
movq %r13, %rsi
movq %r14, %rdx
callq 0xe7287
incq %r13
movq 0x10(%rbx), %rsi
jmp 0xed2da
incq %r14
movq 0x10(%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0xed2b2
cmpq $0x10, %rcx
jne 0xed4d2
movq 0x10(%rbx), %rax
leaq (%rax,%rax), %r13
xorl %ebp, %ebp
xorl %r14d, %r14d
cmpq 0x18(%rbx), %r14
jge 0xed4be
movq %rbp, %r15
xorl %r12d, %r12d
cmpq %rax, %r12
jge 0xed4b6
movq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0xe3f46
movl %eax, %edi
callq 0xe1da6
movq 0x38(%rbx), %rdi
movq %r12, %rsi
movq %r14, %rdx
movl %eax, %ecx
callq 0xe7287
incq %r12
movq 0x10(%rbx), %rax
addq $0x2, %r15
jmp 0xed480
incq %r14
addq %r13, %rbp
jmp 0xed474
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x455df(%rip), %rsi     # 0x132ab8
xorl %ebx, %ebx
movl %ecx, %edx
xorl %eax, %eax
callq 0xdf2a5
jmp 0xed4c1