// File: /workspace/github_c_makefile_star2_O1/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 0xf930c
movl $0x116, %eax            # imm = 0x116
btq %rcx, %rax
movq %rsi, (%rsp)
jae 0xf9296
movq 0x10(%rsi), %rdx
leaq 0xf(%rdx), %rax
addq $0x1e, %rdx
testq %rax, %rax
cmovnsq %rax, %rdx
cmpq $0x0, 0x18(%rsi)
jle 0xf9280
sarq $0x4, %rdx
leaq (%rdx,%rdx), %rax
movq %rax, 0x50(%rsp)
imulq %rcx, %rax
movq %rax, 0x30(%rsp)
movq 0x8(%rsi), %rdi
movl $0x1, %eax
shlq %cl, %rax
testq %rdi, %rdi
cmovlel %eax, %edi
movq %rdi, 0x40(%rsp)
leal -0x1(%rdi), %eax
movl %eax, 0x1c(%rsp)
imulq %rcx, %rdx
addq %rdx, %rdx
movq $0x0, 0x20(%rsp)
movq $0x0, 0x10(%rsp)
movq %rdx, 0x38(%rsp)
cmpq $0x0, 0x10(%rsi)
jle 0xf925f
movq 0x30(%rsp), %rcx
movq 0x10(%rsp), %rax
imulq %rax, %rcx
movq %rcx, 0x48(%rsp)
shll $0x4, %eax
leal (%rax,%rax,2), %eax
movl %eax, 0x18(%rsp)
xorl %r14d, %r14d
movq (%rsi), %rcx
testq %rcx, %rcx
movq %r14, 0x8(%rsp)
jle 0xf91e4
movq %r14, %rax
shrq $0x4, %rax
movq 0x20(%rsp), %r15
leaq (%r15,%rax,2), %r13
movq %r14, %rdx
shrq %rdx
andq $-0x10, %rdx
addq %r15, %rdx
andl $0x1, %eax
leaq (%rdx,%rax,8), %rbp
movq %r14, %r12
andq $-0x10, %r12
addq %r15, %r12
andl $0xf, %r14d
movq %r14, 0x28(%rsp)
xorl %ebx, %ebx
xorl %r14d, %r14d
cmpl $0x0, 0x28(%rsi)
je 0xf9174
movq 0x20(%rsi), %rdi
movl $0x1, %esi
movq %r15, %rdx
movq 0x8(%rsp), %rcx
callq 0xf2d3a
movl $0x1, %edx
movl %r14d, %ecx
shll %cl, %edx
xorl %ecx, %ecx
testb %al, %al
je 0xf9150
movl %edx, %ecx
orl %ecx, %ebx
incq %r14
movq (%rsp), %rsi
movq (%rsi), %rcx
addq $0x2, %r13
addq $0x2, %rbp
addq $0x2, %r12
addq 0x50(%rsp), %r15
cmpq %rcx, %r14
jl 0xf9122
jmp 0xf91e6
xorl %eax, %eax
decq %rcx
cmpq $0x7, %rcx
ja 0xf913e
leaq 0x50902(%rip), %rdx     # 0x149a88
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq (%rsp), %rax
movq 0x20(%rax), %rdi
movl $0x1, %esi
movq 0x48(%rsp), %rdx
jmp 0xf9134
movq (%rsp), %rax
movq 0x20(%rax), %rdi
movl $0x1, %esi
movq %rbp, %rdx
jmp 0xf91da
movq (%rsp), %rax
movq 0x20(%rax), %rdi
movl $0x1, %esi
movq %r13, %rdx
jmp 0xf9134
movq (%rsp), %rax
movq 0x20(%rax), %rdi
movl $0x1, %esi
movq %r12, %rdx
movq 0x28(%rsp), %rcx
jmp 0xf9139
xorl %ebx, %ebx
cmpl $0x0, 0x2c(%rsi)
je 0xf9228
movl %ebx, %eax
addq %rax, %rax
testb $0x1, %bl
leaq -0x5(%rax,%rax,4), %rcx
leaq 0x1(%rax,%rax,4), %rax
cmovneq %rcx, %rax
leaq 0xa0(%rax), %rcx
leal 0x10(%rbx), %edx
leal 0x20(%rbx), %edi
movq 0x8(%rsp), %r14
cmpq %r14, %rax
cmovgl %ebx, %edx
cmpq %r14, %rcx
cmovlel %edi, %edx
addl 0x18(%rsp), %edx
movl %edx, %ebx
jmp 0xf922d
movq 0x8(%rsp), %r14
cmpl 0x40(%rsp), %ebx
cmovael 0x1c(%rsp), %ebx
movq 0x30(%rsi), %rax
movq 0x38(%rsi), %rdi
movl (%rax,%rbx,4), %ecx
movq %r14, %rsi
movq 0x10(%rsp), %rdx
callq 0xf2afd
movq (%rsp), %rsi
incq %r14
cmpq 0x10(%rsi), %r14
jl 0xf90d5
movq 0x10(%rsp), %rcx
incq %rcx
movq 0x38(%rsp), %rdx
addq %rdx, 0x20(%rsp)
movq %rcx, 0x10(%rsp)
cmpq 0x18(%rsi), %rcx
jl 0xf90aa
movl $0x1, %ebp
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x10, %rcx
jne 0xf930c
movl $0x1, %ebp
cmpq $0x0, 0x18(%rsi)
jle 0xf9285
movq 0x10(%rsi), %rbx
addq %rbx, %rbx
xorl %r13d, %r13d
xorl %r14d, %r14d
cmpq $0x0, 0x10(%rsi)
jle 0xf92fb
movq %r13, %r15
xorl %r12d, %r12d
movq 0x20(%rsi), %rdi
movq %r15, %rsi
callq 0xef169
movl %eax, %edi
callq 0xece9d
movq (%rsp), %rcx
movq 0x38(%rcx), %rdi
movq %r12, %rsi
movq %r14, %rdx
movl %eax, %ecx
callq 0xf2afd
movq (%rsp), %rsi
incq %r12
addq $0x2, %r15
cmpq 0x10(%rsi), %r12
jl 0xf92c2
incq %r14
addq %rbx, %r13
cmpq 0x18(%rsi), %r14
jl 0xf92b5
jmp 0xf9285
leaq 0x466cd(%rip), %rsi     # 0x13f9e0
xorl %ebp, %ebp
movl %ecx, %edx
xorl %eax, %eax
callq 0xe9df7
jmp 0xf9285