// File: /workspace/github_c_makefile_star2_O2/jani-nykanen[P]mushrooms/./tools/src/png2spr.c
// Function: main
i32 main(i32 argc, str* argv) {

    i32 frameWidth;
    i32 frameHeight;

    if(argc < 5) {

        fprintf(stderr, "Must pass at least 4 arguments.\nHelp: png2spr input output framewidth frameheight (-mask)\n");
        return 1;
    }

    frameWidth = (i32) strtol(argv[3], NULL, 10);
    frameHeight = (i32) strtol(argv[4], NULL, 10);

    return convert_bitmap(argv[1], argv[2], includes_str("-mask", argv, argc, 1), 
        frameWidth, frameHeight);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
cmpl $0x4, %edi
jle 0x34f3
movq %rsi, %rbx
movl %edi, %r15d
movq 0x18(%rsi), %rdi
pushq $0xa
popq %r14
xorl %esi, %esi
movl %r14d, %edx
callq 0x1100
movq %rax, -0x50(%rbp)
movq 0x20(%rbx), %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0x1100
movq %rax, -0x48(%rbp)
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %rax
movq %rax, -0x58(%rbp)
movl %r15d, %r12d
pushq $0x1
popq %rcx
leaq 0xa6f1(%rip), %r15      # 0xd86a
movq %rcx, %r13
cmpq %rcx, %r12
je 0x3195
movq (%rbx,%r13,8), %rsi
movq %r15, %rdi
callq 0x10c0
leaq 0x1(%r13), %rcx
testl %eax, %eax
jne 0x3179
leaq -0x60(%rbp), %rsi
leaq -0x5c(%rbp), %rdx
leaq -0xbc(%rbp), %rcx
pushq $0x4
popq %r8
movq %r14, %rdi
callq 0x129f
testq %rax, %rax
je 0x3524
movq %rax, %r15
movq -0x50(%rbp), %rsi
testl %esi, %esi
movl -0x60(%rbp), %eax
cmovlel %eax, %esi
movq -0x48(%rbp), %rcx
testl %ecx, %ecx
movl -0x5c(%rbp), %edi
cmovlel %edi, %ecx
movq %rax, -0x38(%rbp)
cltd
movq %rsi, -0x50(%rbp)
idivl %esi
movl %eax, -0x40(%rbp)
testl %edx, %edx
jne 0x34de
movl %edi, %eax
cltd
idivl %ecx
movl %eax, -0x3c(%rbp)
testl %edx, %edx
jne 0x34de
movq %rcx, -0x48(%rbp)
movq %r13, -0x78(%rbp)
imull -0x38(%rbp), %edi
movl %edi, -0x30(%rbp)
movslq %edi, %rbx
movq %rbx, %rdi
callq 0x1120
testq %rax, %rax
je 0x34c9
movq %rax, %r13
movq %r12, -0x70(%rbp)
movq %rbx, %rdi
callq 0x1120
testq %rax, %rax
je 0x34c9
movq %rax, %r12
movl -0x30(%rbp), %eax
xorl %ecx, %ecx
leaq 0xa59c(%rip), %rdx      # 0xd7e0
xorl %esi, %esi
cmpq %rax, %rsi
je 0x32ab
leal (,%rsi,4), %edi
movq %rdx, %r9
xorl %r8d, %r8d
cmpq $0x4, %r8
je 0x3283
xorl %r10d, %r10d
leal (%rcx,%r10), %r11d
movb (%r15,%r11), %r11b
cmpb (%r9,%r10), %r11b
jne 0x327a
incq %r10
cmpq $0x3, %r10
jne 0x3261
jmp 0x3286
incq %r8
addq $0x3, %r9
jmp 0x3258
xorl %r8d, %r8d
movb %r8b, (%r13,%rsi)
movl %edi, %edi
xorl %r8d, %r8d
cmpb $0x7f, 0x3(%r15,%rdi)
setae %r8b
leal (%r8,%r8,2), %edi
movb %dil, (%r12,%rsi)
incq %rsi
addq $0x4, %rcx
jmp 0x3246
movq %r15, -0x68(%rbp)
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x10b0
testq %rax, %rax
je 0x34c9
movq %rax, %r15
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x10b0
testq %rax, %rax
je 0x34c9
movq %rax, %rbx
movq $0x0, -0x80(%rbp)
movq -0x50(%rbp), %rcx
testl %ecx, %ecx
movl $0x0, %esi
cmovgl %ecx, %esi
movq -0x48(%rbp), %rax
testl %eax, %eax
movl $0x0, %edx
cmovgl %eax, %edx
movl %ecx, %ecx
movq %rcx, -0x98(%rbp)
movl -0x40(%rbp), %ecx
testl %ecx, %ecx
movl $0x0, %edi
cmovgl %ecx, %edi
movq %rdi, -0xa8(%rbp)
movl -0x3c(%rbp), %ecx
testl %ecx, %ecx
movl $0x0, %edi
cmovgl %ecx, %edi
movq %rdi, -0x90(%rbp)
movl %eax, %eax
imulq -0x38(%rbp), %rax
movq %rax, -0x88(%rbp)
xorl %ecx, %ecx
xorl %r11d, %r11d
movq -0x58(%rbp), %rdi
cmpq -0x90(%rbp), %rcx
je 0x33ed
movq -0x80(%rbp), %r9
xorl %eax, %eax
movq %rcx, -0xa0(%rbp)
cmpq -0xa8(%rbp), %rax
je 0x33da
movq %rax, -0xb0(%rbp)
movq %r9, -0xb8(%rbp)
xorl %r10d, %r10d
cmpq %rdx, %r10
je 0x33b5
movq %rsi, %rcx
movq %r9, %rax
subq $0x1, %rcx
jb 0x33ac
movl %eax, %edi
movb (%r13,%rdi), %r8b
movl %r11d, %r14d
movb %r8b, (%r15,%r14)
movb (%r12,%rdi), %dil
movb %dil, (%rbx,%r14)
incl %r11d
incq %rax
jmp 0x3388
incq %r10
addq -0x38(%rbp), %r9
jmp 0x337d
movq -0xb0(%rbp), %rax
incq %rax
movq -0xb8(%rbp), %r9
addq -0x98(%rbp), %r9
movq -0x58(%rbp), %rdi
movq -0xa0(%rbp), %rcx
jmp 0x3363
incq %rcx
movq -0x88(%rbp), %rax
addq %rax, -0x80(%rbp)
jmp 0x3349
leaq 0xaff6(%rip), %rsi      # 0xe3ea
callq 0x1160
testq %rax, %rax
je 0x3541
movq %rax, %r14
xorl %ecx, %ecx
movq -0x70(%rbp), %rax
cmpq %rax, -0x78(%rbp)
setb %cl
movl %ecx, -0x38(%rbp)
leaq -0x2a(%rbp), %rdi
movq -0x50(%rbp), %rax
movw %ax, (%rdi)
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x1170
movq -0x48(%rbp), %rax
leaq -0x2a(%rbp), %rdi
movw %ax, (%rdi)
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x1170
movl -0x3c(%rbp), %eax
imull -0x40(%rbp), %eax
leaq -0x2a(%rbp), %rdi
movw %ax, (%rdi)
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x1170
movl -0x38(%rbp), %edi
movq %r14, %rsi
callq 0x10a0
movq %r14, %rdi
movq %r15, %rsi
movl -0x30(%rbp), %edx
callq 0xc7b5
movq -0x70(%rbp), %rax
cmpq %rax, -0x78(%rbp)
jae 0x3494
movq %r14, %rdi
movq %rbx, %rsi
movl -0x30(%rbp), %edx
callq 0xc7b5
movq %r14, %rdi
callq 0x1070
movq -0x68(%rbp), %rdi
callq 0x1030
movq %r13, %rdi
callq 0x1030
movq %r12, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x3512
movq 0xdb28(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0xaef6(%rip), %rdi      # 0xe3d0
pushq $0x19
jmp 0x3506
movq 0xdb13(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0xaebb(%rip), %rdi      # 0xe3aa
pushq $0x25
jmp 0x3506
movq 0xdafe(%rip), %rax      # 0x10ff8
movq (%rax), %rcx
leaq 0xa30b(%rip), %rdi      # 0xd80f
pushq $0x5a
popq %rsi
pushq $0x1
popq %rdx
callq 0x1170
pushq $0x1
popq %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xdacd(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0xae55(%rip), %rsi      # 0xe38a
movq %r14, %rdx
xorl %eax, %eax
callq 0x10d0
jmp 0x350f
movq 0xdab0(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0xae9b(%rip), %rsi      # 0xe3ed
movq -0x58(%rbp), %rdx
xorl %eax, %eax
callq 0x10d0
movq -0x68(%rbp), %rdi
callq 0x1030
jmp 0x350f