// File: /workspace/github_c_makefile_star2_O0/kyz[P]amostools/dumpamos.c
// Function: amos_bank
void amos_bank(char *fname, uint8_t *src, size_t len) {
    /* get the "real", validated bank length */
    if (!(len = bank_length(src, len))) return;

    if (amos_leek(src) == ID_AmSp) {
        decode_sprites(fname, src, len, "sprite");
    }
    else if (amos_leek(src) == ID_AmIc) {
        decode_sprites(fname, src, len, "icon");
    }
    else if (amos_leek(src) == ID_AmBk) {
        if (!memcmp(&src[12], "Pac.Pic.", 8)) {
            decode_pacpic(fname, src, len);
        }
        else if (!memcmp(&src[12], "Samples ", 8)) {
            decode_samples(fname, src, len);
        }
        else if (!memcmp(&src[12], "Tracker ", 8)) {
            decode_tracker(fname, src, len);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1600
movl %eax, %eax
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x2c32
jmp 0x2db9
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
shll $0x18, %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
orl %ecx, %eax
cmpl $0x416d5370, %eax       # imm = 0x416D5370
jne 0x2c84
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq 0x14c9(%rip), %rcx      # 0x4143
callq 0x1aa0
jmp 0x2db9
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
shll $0x18, %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
orl %ecx, %eax
cmpl $0x416d4963, %eax       # imm = 0x416D4963
jne 0x2cd6
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq 0x147e(%rip), %rcx      # 0x414a
callq 0x1aa0
jmp 0x2db7
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
shll $0x18, %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
orl %ecx, %eax
cmpl $0x416d426b, %eax       # imm = 0x416D426B
jne 0x2db5
movq -0x10(%rbp), %rax
addq $0xc, %rax
movq (%rax), %rax
movabsq $0x2e6369502e636150, %rcx # imm = 0x2E6369502E636150
subq %rcx, %rax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x2d45
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x1ef0
jmp 0x2db3
movq -0x10(%rbp), %rax
addq $0xc, %rax
movq (%rax), %rax
movabsq $0x2073656c706d6153, %rcx # imm = 0x2073656C706D6153
subq %rcx, %rax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x2d7b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x27d0
jmp 0x2db1
movq -0x10(%rbp), %rax
addq $0xc, %rax
movq (%rax), %rax
movabsq $0x2072656b63617254, %rcx # imm = 0x2072656B63617254
subq %rcx, %rax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x2daf
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x2b60
jmp 0x2db1
jmp 0x2db3
jmp 0x2db5
jmp 0x2db7
jmp 0x2db9
addq $0x20, %rsp
popq %rbp
retq
nop