// File: /workspace/github_c_makefile_star2_O3/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 0x36cc
movq %rsi, %r14
movl %edi, %r15d
movq 0x18(%rsi), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x1100
movq %rax, -0x38(%rbp)
movq 0x20(%r14), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x1100
movq %rax, %r13
movq 0x8(%r14), %rbx
movq 0x10(%r14), %r12
leaq 0xc540(%rip), %rdi      # 0xf88a
movq %rbx, %rsi
callq 0x10c0
testl %eax, %eax
movq %r12, -0x80(%rbp)
je 0x3396
movq %r13, -0x50(%rbp)
movl %r15d, %r12d
movl $0x2, %ecx
leaq 0xc51d(%rip), %r15      # 0xf88a
movq %rcx, %r13
cmpq %rcx, %r12
je 0x3389
movq (%r14,%r13,8), %rsi
movq %r15, %rdi
callq 0x10c0
leaq 0x1(%r13), %rcx
testl %eax, %eax
jne 0x336d
cmpq %r12, %r13
setb %r15b
movq -0x50(%rbp), %r13
jmp 0x3399
movb $0x1, %r15b
leaq -0x70(%rbp), %rsi
leaq -0x6c(%rbp), %rdx
leaq -0xac(%rbp), %rcx
movq %rbx, %rdi
movl $0x4, %r8d
callq 0x134f
testq %rax, %rax
je 0x36d3
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, -0x44(%rbp)
testl %edx, %edx
jne 0x36be
movl %ebx, %eax
cltd
idivl %r13d
movl %eax, -0x40(%rbp)
testl %edx, %edx
jne 0x36be
movb %r15b, -0x29(%rbp)
imull -0x68(%rbp), %ebx
movslq %ebx, %r15
movq %r15, %rdi
callq 0x1120
testq %rax, %rax
je 0x36f0
movq %rax, %r12
movq %r13, -0x50(%rbp)
movq %r15, -0x58(%rbp)
movq %r15, %rdi
callq 0x1120
testq %rax, %rax
je 0x36f7
movq %rax, %r13
movl %ebx, -0x3c(%rbp)
testl %ebx, %ebx
je 0x34d1
movl -0x3c(%rbp), %eax
movq %rax, -0x60(%rbp)
xorl %ecx, %ecx
leaq 0xc3ab(%rip), %rsi      # 0xf800
xorl %edi, %edi
movl %ecx, %r9d
incq %r9
leal (,%rdi,4), %r8d
movb (%r14,%r8), %r11b
leaq 0xc391(%rip), %rbx      # 0xf801
xorl %r10d, %r10d
leaq (%r10,%r10,2), %r15
cmpb (%rsi,%r15), %r11b
jne 0x349b
xorl %r15d, %r15d
cmpq $0x2, %r15
je 0x34ab
leal (%r9,%r15), %edx
leaq 0x1(%r15), %rax
movb (%r14,%rdx), %dl
cmpb (%rbx,%r15), %dl
movq %rax, %r15
je 0x3480
incq %r10
addq $0x3, %rbx
cmpq $0x4, %r10
jne 0x3473
xorl %r10d, %r10d
movb %r10b, (%r12,%rdi)
movl %r8d, %eax
xorl %edx, %edx
cmpb $0x7f, 0x3(%r14,%rax)
setae %dl
leal (%rdx,%rdx,2), %eax
movb %al, (%r13,%rdi)
incq %rdi
addl $0x4, %ecx
cmpq -0x60(%rbp), %rdi
jne 0x3457
movl $0x1, %esi
movq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x10b0
testq %rax, %rax
je 0x36c5
movq %rax, %rbx
movl $0x1, %esi
movq %r15, %rdi
callq 0x10b0
testq %rax, %rax
je 0x36c5
movq %rax, %r15
movq %r14, -0x78(%rbp)
cmpl $0x0, -0x40(%rbp)
jle 0x35e2
movl -0x38(%rbp), %esi
movl -0x50(%rbp), %ecx
movl -0x40(%rbp), %eax
movq %rax, -0x90(%rbp)
movl -0x44(%rbp), %eax
movq %rax, -0xa8(%rbp)
movq %rcx, %rax
imulq -0x68(%rbp), %rax
movq %rax, -0x88(%rbp)
xorl %r8d, %r8d
xorl %edx, %edx
xorl %r10d, %r10d
movq %rdx, -0x98(%rbp)
cmpl $0x0, -0x44(%rbp)
movq %r8, -0xa0(%rbp)
jle 0x35bd
xorl %eax, %eax
movq %rax, -0x58(%rbp)
cmpl $0x0, -0x50(%rbp)
movq %r8, -0x60(%rbp)
jle 0x35a6
xorl %edi, %edi
cmpl $0x0, -0x38(%rbp)
jle 0x359a
movq %r8, %r11
movq %rsi, %rax
movl %r11d, %r14d
movb (%r12,%r14), %r9b
movl %r10d, %edx
movb %r9b, (%rbx,%rdx)
movb (%r13,%r14), %r9b
movb %r9b, (%r15,%rdx)
incl %r10d
incq %r11
decq %rax
jne 0x3578
incq %rdi
addq -0x68(%rbp), %r8
cmpq %rcx, %rdi
jne 0x356c
movq -0x58(%rbp), %rax
incq %rax
movq -0x60(%rbp), %r8
addq %rsi, %r8
cmpq -0xa8(%rbp), %rax
jne 0x355c
movq -0x98(%rbp), %rdx
incq %rdx
movq -0xa0(%rbp), %r8
addq -0x88(%rbp), %r8
cmpq -0x90(%rbp), %rdx
jne 0x3546
leaq 0xce21(%rip), %rsi      # 0x1040a
movq -0x80(%rbp), %rdi
callq 0x1150
testq %rax, %rax
je 0x36fe
movq %rax, %r14
leaq -0x2c(%rbp), %rdi
movq -0x38(%rbp), %rax
movw %ax, (%rdi)
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x1160
movq -0x50(%rbp), %rax
leaq -0x2c(%rbp), %rdi
movw %ax, (%rdi)
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x1160
movl -0x40(%rbp), %eax
imull -0x44(%rbp), %eax
leaq -0x2c(%rbp), %rdi
movw %ax, (%rdi)
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x1160
movzbl -0x29(%rbp), %edi
movl %edi, -0x38(%rbp)
movq %r14, %rsi
callq 0x10a0
movq %r14, %rdi
movq %rbx, %rsi
movl -0x3c(%rbp), %edx
callq 0xe3e1
cmpb $0x0, -0x38(%rbp)
je 0x3689
movq %r14, %rdi
movq %r15, %rsi
movl -0x3c(%rbp), %edx
callq 0xe3e1
movq %r14, %rdi
callq 0x1070
movq -0x78(%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 0x3728
callq 0x1180
jmp 0x3723
callq 0x11a2
jmp 0x3723
callq 0x1208
jmp 0x3723
movq 0xf91e(%rip), %rax      # 0x12ff8
movq (%rax), %rdi
leaq 0xccc6(%rip), %rsi      # 0x103aa
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10d0
jmp 0x3723
callq 0x11e6
jmp 0x3723
callq 0x11c4
jmp 0x3723
movq 0xf8f3(%rip), %rax      # 0x12ff8
movq (%rax), %rdi
leaq 0xccfe(%rip), %rsi      # 0x1040d
movq -0x80(%rbp), %rdx
xorl %eax, %eax
callq 0x10d0
movq -0x78(%rbp), %rdi
callq 0x1030
movl $0x1, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq