// File: /workspace/github_c_makefile_star2_O3/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 0xf8e05
movl $0x116, %eax            # imm = 0x116
btq %rcx, %rax
movq %rsi, 0x10(%rsp)
jae 0xf8d86
movq 0x10(%rsi), %rax
movq 0x18(%rsi), %rdx
leaq 0xf(%rax), %rdi
leaq 0x1e(%rax), %r8
testq %rdi, %rdi
cmovnsq %rdi, %r8
testq %rdx, %rdx
jle 0xf8d72
sarq $0x4, %r8
leaq (%r8,%r8), %rdi
movq %rdi, 0x50(%rsp)
imulq %rcx, %rdi
movq %rdi, 0x30(%rsp)
movq 0x8(%rsi), %r9
movl $0x1, %edi
shlq %cl, %rdi
testq %r9, %r9
cmovlel %edi, %r9d
movq %r9, 0x40(%rsp)
leal -0x1(%r9), %edi
movl %edi, 0x1c(%rsp)
imulq %rcx, %r8
addq %r8, %r8
movq $0x0, 0x20(%rsp)
movq $0x0, 0x8(%rsp)
movq %r8, 0x38(%rsp)
testq %rax, %rax
jle 0xf8d57
movq 0x30(%rsp), %rcx
movq 0x8(%rsp), %rax
imulq %rax, %rcx
movq %rcx, 0x48(%rsp)
shll $0x4, %eax
leal (%rax,%rax,2), %eax
movl %eax, 0x18(%rsp)
xorl %ebx, %ebx
movq (%rsi), %rax
testq %rax, %rax
movq %rbx, (%rsp)
jle 0xf8cc7
movq %rbx, %rcx
shrq $0x4, %rcx
movq 0x20(%rsp), %r15
leaq (%r15,%rcx,2), %r13
movq %rbx, %rdx
shrq %rdx
andq $-0x10, %rdx
addq %r15, %rdx
andl $0x1, %ecx
leaq (%rdx,%rcx,8), %rbp
movq %rbx, %r12
andq $-0x10, %r12
addq %r15, %r12
andl $0xf, %ebx
movq %rbx, 0x28(%rsp)
xorl %r14d, %r14d
xorl %ebx, %ebx
cmpl $0x0, 0x28(%rsi)
je 0xf8c6c
movq 0x20(%rsi), %rdi
movl $0x1, %esi
movq %r15, %rdx
movq (%rsp), %rcx
callq 0xf26f9
testb %al, %al
movq 0x10(%rsp), %rsi
je 0xf8c4e
btsl %ebx, %r14d
incq %rbx
movq (%rsi), %rax
addq $0x2, %r13
addq $0x2, %rbp
addq $0x2, %r12
addq 0x50(%rsp), %r15
cmpq %rax, %rbx
jl 0xf8c26
jmp 0xf8cca
decq %rax
cmpq $0x7, %rax
ja 0xf8c4e
leaq 0x513ac(%rip), %rcx     # 0x14a028
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x20(%rsi), %rdi
movl $0x1, %esi
movq 0x48(%rsp), %rdx
jmp 0xf8c38
movq 0x20(%rsi), %rdi
movl $0x1, %esi
movq %rbp, %rdx
jmp 0xf8cbd
movq 0x20(%rsi), %rdi
movl $0x1, %esi
movq %r13, %rdx
jmp 0xf8c38
movq 0x20(%rsi), %rdi
movl $0x1, %esi
movq %r12, %rdx
movq 0x28(%rsp), %rcx
jmp 0xf8c3c
xorl %r14d, %r14d
cmpl $0x0, 0x2c(%rsi)
je 0xf8d11
movl %r14d, %eax
addq %rax, %rax
testb $0x1, %r14b
leaq -0x5(%rax,%rax,4), %rcx
leaq 0x1(%rax,%rax,4), %rax
cmovneq %rcx, %rax
leaq 0xa0(%rax), %rcx
leal 0x10(%r14), %edx
leal 0x20(%r14), %edi
movq (%rsp), %rbx
cmpq %rbx, %rax
cmovgl %r14d, %edx
cmpq %rbx, %rcx
cmovlel %edi, %edx
addl 0x18(%rsp), %edx
movl %edx, %r14d
jmp 0xf8d15
movq (%rsp), %rbx
cmpl 0x40(%rsp), %r14d
cmovael 0x1c(%rsp), %r14d
movq 0x30(%rsi), %rax
movq 0x38(%rsi), %rdi
movl (%rax,%r14,4), %ecx
movq %rbx, %rsi
movq 0x8(%rsp), %rdx
callq 0xf24ba
movq 0x10(%rsp), %rsi
incq %rbx
movq 0x10(%rsi), %rax
cmpq %rax, %rbx
jl 0xf8bdb
movq 0x18(%rsi), %rdx
movq 0x38(%rsp), %r8
movq 0x8(%rsp), %rdi
incq %rdi
addq %r8, 0x20(%rsp)
movq %rdi, 0x8(%rsp)
cmpq %rdx, %rdi
jl 0xf8bb3
movl $0x1, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x10, %rcx
jne 0xf8e05
movq 0x18(%rsi), %rcx
movl $0x1, %eax
testq %rcx, %rcx
jle 0xf8d77
movq 0x10(%rsi), %rax
leaq (%rax,%rax), %rbx
xorl %r13d, %r13d
xorl %r14d, %r14d
testq %rax, %rax
jle 0xf8df5
movq %r13, %r15
xorl %r12d, %r12d
movq 0x20(%rsi), %rdi
movq %r15, %rsi
callq 0xeeb67
movl %eax, %edi
callq 0xec844
movq 0x10(%rsp), %rcx
movq 0x38(%rcx), %rdi
movq %r12, %rsi
movq %r14, %rdx
movl %eax, %ecx
callq 0xf24ba
movq 0x10(%rsp), %rsi
incq %r12
movq 0x10(%rsi), %rax
addq $0x2, %r15
cmpq %rax, %r12
jl 0xf8db3
movq 0x18(%rsi), %rcx
incq %r14
addq %rbx, %r13
cmpq %rcx, %r14
jl 0xf8da8
jmp 0xf8d72
leaq 0x46fdc(%rip), %rsi     # 0x13fde8
movl %ecx, %edx
xorl %eax, %eax
callq 0xe9295
xorl %eax, %eax
jmp 0xf8d77