// File: /workspace/github_c_makefile_star2_O1/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 $0x88, %rsp
cmpl $0x4, %edi
jle 0x3531
movq %rsi, %r14
movl %edi, %r15d
movq 0x18(%rsi), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x1110
movq %rax, -0x38(%rbp)
movq 0x20(%r14), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x1110
movq %rax, %r13
movq 0x8(%r14), %rbx
movq 0x10(%r14), %rax
movq %rax, -0x78(%rbp)
leaq 0xc6f5(%rip), %rdi      # 0xf88a
movq %rbx, %rsi
callq 0x10d0
testl %eax, %eax
je 0x31dd
movq %r13, -0x48(%rbp)
movl %r15d, %r12d
movl $0x2, %ecx
leaq 0xc6d6(%rip), %r15      # 0xf88a
movq %rcx, %r13
cmpq %rcx, %r12
je 0x31d0
movq (%r14,%r13,8), %rsi
movq %r15, %rdi
callq 0x10d0
leaq 0x1(%r13), %rcx
testl %eax, %eax
jne 0x31b4
cmpq %r12, %r13
setb %r15b
movq -0x48(%rbp), %r13
jmp 0x31e0
movb $0x1, %r15b
leaq -0x70(%rbp), %rsi
leaq -0x6c(%rbp), %rdx
leaq -0xac(%rbp), %rcx
movq %rbx, %rdi
movl $0x4, %r8d
callq 0x135f
testq %rax, %rax
je 0x3538
movq %rax, %r14
movq -0x38(%rbp), %rcx
testl %ecx, %ecx
movl -0x70(%rbp), %eax
cmovlel %eax, %ecx
testl %r13d, %r13d
movl -0x6c(%rbp), %ebx
cmovlel %ebx, %r13d
movq %rax, -0x68(%rbp)
cltd
movq %rcx, -0x38(%rbp)
idivl %ecx
movl %eax, -0x40(%rbp)
testl %edx, %edx
jne 0x352a
movl %ebx, %eax
cltd
idivl %r13d
testl %edx, %edx
jne 0x352a
movl %eax, -0x4c(%rbp)
movb %r15b, -0x29(%rbp)
imull -0x68(%rbp), %ebx
movslq %ebx, %r15
movq %r15, %rdi
callq 0x1130
testq %rax, %rax
je 0x3555
movq %rax, %r12
movq %r13, -0x48(%rbp)
movq %r15, %rdi
callq 0x1130
testq %rax, %rax
je 0x355c
movq %rax, %r13
movl %ebx, -0x3c(%rbp)
testl %ebx, %ebx
movq %r14, -0x58(%rbp)
je 0x332d
movl -0x3c(%rbp), %eax
movq %rax, -0x60(%rbp)
xorl %ecx, %ecx
xorl %edi, %edi
movl %ecx, %r9d
incq %r9
leal (,%rdi,4), %r8d
movb (%r14,%r8), %r11b
leaq 0xc551(%rip), %rbx      # 0xf801
xorl %r10d, %r10d
leaq (%r10,%r10,2), %r14
leaq 0xc542(%rip), %rax      # 0xf800
cmpb (%rax,%r14), %r11b
jne 0x32ec
xorl %r14d, %r14d
cmpq $0x2, %r14
je 0x32fc
movq %r15, %rsi
leal (%r9,%r14), %r15d
leaq 0x1(%r14), %rdx
movq -0x58(%rbp), %rax
movb (%rax,%r15), %r15b
cmpb (%rbx,%r14), %r15b
movq %rsi, %r15
movq %rdx, %r14
je 0x32c7
incq %r10
addq $0x3, %rbx
cmpq $0x4, %r10
jne 0x32b3
xorl %r10d, %r10d
movb %r10b, (%r12,%rdi)
movl %r8d, %edx
xorl %r8d, %r8d
movq -0x58(%rbp), %r14
cmpb $0x7f, 0x3(%r14,%rdx)
setae %r8b
leal (%r8,%r8,2), %edx
movb %dl, (%r13,%rdi)
incq %rdi
addl $0x4, %ecx
cmpq -0x60(%rbp), %rdi
jne 0x3297
movl $0x1, %esi
movq %r15, %rdi
callq 0x10c0
movq %rax, %rbx
movb $0x1, %r14b
testq %rax, %rax
je 0x343f
movl $0x1, %esi
movq %r15, %rdi
callq 0x10c0
movq %rax, %r15
testq %rax, %rax
je 0x3442
xorl %r14d, %r14d
movl -0x4c(%rbp), %eax
testl %eax, %eax
jle 0x3442
movl -0x38(%rbp), %r9d
movl -0x48(%rbp), %ecx
movl %eax, %eax
movq %rax, -0x88(%rbp)
movl -0x40(%rbp), %eax
movq %rax, -0xa0(%rbp)
movq %rcx, %rax
imulq -0x68(%rbp), %rax
movq %rax, -0x80(%rbp)
xorl %r8d, %r8d
xorl %edx, %edx
movq %rdx, -0x90(%rbp)
cmpl $0x0, -0x40(%rbp)
movq %r8, -0x98(%rbp)
jle 0x3418
xorl %eax, %eax
movq %rax, -0xa8(%rbp)
cmpl $0x0, -0x48(%rbp)
movq %r8, -0x60(%rbp)
jle 0x33fe
xorl %edi, %edi
cmpl $0x0, -0x38(%rbp)
jle 0x33f2
movq %r8, %r10
movq %r9, %rax
movl %r10d, %esi
movb (%r12,%rsi), %dl
movl %r14d, %r11d
movb %dl, (%rbx,%r11)
movb (%r13,%rsi), %dl
movb %dl, (%r15,%r11)
incl %r14d
incq %r10
decq %rax
jne 0x33d0
incq %rdi
addq -0x68(%rbp), %r8
cmpq %rcx, %rdi
jne 0x33c4
movq -0xa8(%rbp), %rax
incq %rax
movq -0x60(%rbp), %r8
addq %r9, %r8
cmpq -0xa0(%rbp), %rax
jne 0x33b1
movq -0x90(%rbp), %rdx
incq %rdx
movq -0x98(%rbp), %r8
addq -0x80(%rbp), %r8
cmpq -0x88(%rbp), %rdx
jne 0x339b
xorl %r14d, %r14d
jmp 0x3442
xorl %r15d, %r15d
testb %r14b, %r14b
movq -0x78(%rbp), %rax
jne 0x3563
leaq 0xcfb8(%rip), %rsi      # 0x1040e
movq %rax, %rdi
callq 0x1160
testq %rax, %rax
je 0x356a
movq %rax, %r14
leaq -0x2c(%rbp), %rdi
movq -0x38(%rbp), %rax
movw %ax, (%rdi)
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x1170
movq -0x48(%rbp), %rax
leaq -0x2c(%rbp), %rdi
movw %ax, (%rdi)
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x1170
movl -0x4c(%rbp), %eax
imull -0x40(%rbp), %eax
leaq -0x2c(%rbp), %rdi
movw %ax, (%rdi)
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x1170
movzbl -0x29(%rbp), %edi
movl %edi, -0x38(%rbp)
movq %r14, %rsi
callq 0x10b0
movq %r14, %rdi
movq %rbx, %rsi
movl -0x3c(%rbp), %edx
callq 0xee13
cmpb $0x0, -0x38(%rbp)
je 0x34f5
movq %r14, %rdi
movq %r15, %rsi
movl -0x3c(%rbp), %edx
callq 0xee13
movq %r14, %rdi
callq 0x1080
movq -0x58(%rbp), %rdi
callq 0x1030
movq %r12, %rdi
callq 0x1030
movq %r13, %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x3594
callq 0x1190
jmp 0x358f
callq 0x1218
jmp 0x358f
movq 0x10ab9(%rip), %rax     # 0x13ff8
movq (%rax), %rdi
leaq 0xce65(%rip), %rsi      # 0x103ae
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10e0
jmp 0x358f
callq 0x11f6
jmp 0x358f
callq 0x11d4
jmp 0x358f
callq 0x11b2
jmp 0x358f
movq 0x10a87(%rip), %rax     # 0x13ff8
movq (%rax), %rdi
leaq 0xce96(%rip), %rsi      # 0x10411
movq -0x78(%rbp), %rdx
xorl %eax, %eax
callq 0x10e0
movq -0x58(%rbp), %rdi
callq 0x1030
movl $0x1, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq