// File: /workspace/github_c_makefile_star2_O0/DavidSM64[P]n64graphics_ci/n64graphics_ci.c
// Function: parse_arguments
static int parse_arguments(int argc, char *argv[], graphics_config *config)
{
    for (int i = 1; i < argc; i++) {
        if (argv[i][0] == '-') {
            switch (argv[i][1]) {
            case 'e':
                if (++i >= argc) return 0;
                config->bin_filename = argv[i];
                config->mode = MODE_EXPORT;
                break;
            case 'f':
                if (++i >= argc) return 0;
                if (!parse_format(config, argv[i])) {
                    return 0;
                }
                break;
            case 'i':
                if (++i >= argc) return 0;
                config->bin_filename = argv[i];
                config->mode = MODE_IMPORT;
                break;
            case 'g':
                if (++i >= argc) return 0;
                config->img_filename = argv[i];
                break;
            case 'h':
                if (++i >= argc) return 0;
                config->height = strtoul(argv[i], NULL, 0);
                break;
            case 'o':
                if (++i >= argc) return 0;
                config->offset = strtoul(argv[i], NULL, 0);
                config->truncate = 0;
                break;
            case 'w':
                if (++i >= argc) return 0;
                config->width = strtoul(argv[i], NULL, 0);
                break;
            case 'v':
                g_verbosity = 1;
                break;
            case 'V':
                print_version();
                exit(0);
                break;
            default:
                return 0;
                break;
            }
        }
        else {
            return 0;
        }
    }
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0xa975
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0xa95c
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
addl $-0x56, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x21, %eax
ja 0xa951
movq -0x28(%rbp), %rax
leaq 0x169ad(%rip), %rcx     # 0x21128
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl -0x8(%rbp), %eax
jl 0xa79e
movl $0x0, -0x4(%rbp)
jmp 0xa97c
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x10(%rax)
jmp 0xa95a
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl -0x8(%rbp), %eax
jl 0xa7dc
movl $0x0, -0x4(%rbp)
jmp 0xa97c
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x20660
cmpl $0x0, %eax
jne 0xa802
movl $0x0, -0x4(%rbp)
jmp 0xa97c
jmp 0xa95a
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl -0x8(%rbp), %eax
jl 0xa821
movl $0x0, -0x4(%rbp)
jmp 0xa97c
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movl $0x1, 0x10(%rax)
jmp 0xa95a
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl -0x8(%rbp), %eax
jl 0xa85f
movl $0x0, -0x4(%rbp)
jmp 0xa97c
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0xa95a
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl -0x8(%rbp), %eax
jl 0xa891
movl $0x0, -0x4(%rbp)
jmp 0xa97c
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x1240
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
jmp 0xa95a
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl -0x8(%rbp), %eax
jl 0xa8d0
movl $0x0, -0x4(%rbp)
jmp 0xa97c
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x1240
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x28(%rax)
jmp 0xa95a
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl -0x8(%rbp), %eax
jl 0xa914
movl $0x0, -0x4(%rbp)
jmp 0xa97c
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x1240
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
jmp 0xa95a
leaq 0x1de0b(%rip), %rax     # 0x28748
movl $0x1, (%rax)
jmp 0xa95a
callq 0x20710
xorl %edi, %edi
callq 0x1260
movl $0x0, -0x4(%rbp)
jmp 0xa97c
jmp 0xa965
movl $0x0, -0x4(%rbp)
jmp 0xa97c
jmp 0xa967
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa72a
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)