// File: Lartu[P]polaris/src/polaris.cpp
// Function: check_args[abi:cxx11](int, char**)
string check_args(int argc, char** argv)
{
    string filename = "";
    if (argc > 1)
    {
        for (unsigned int i = 1; i < argc; ++i)
        {
            string argument = argv[i];
            if (argument == "-v") display_version(true);
            else if (argument == "-h") display_help();
            else if (argument == "-p") show_pushpops = true;
            else
            {
                filename = argument;
                if (i < argc - 1)
                {
                    warning("some switches after the filename have been ignored.");
                    //TODO these commands should be pushed to the stack.
                }
            }
        }
    }
    if (filename == "")
        error("\nUsage: polaris <file>\nRun polaris -h for more information");
    return filename;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0xb8(%rbp)
movq %rdi, %rax
movq %rax, -0xc0(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
leaq -0x1a(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x34a0
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rdx
leaq 0xc817(%rip), %rsi      # 0x103c7
callq 0x33a0
jmp 0x3bb7
leaq -0x1a(%rbp), %rdi
callq 0x3330
cmpl $0x1, -0xc(%rbp)
jle 0x3dda
movl $0x1, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x3dd8
movq -0x18(%rbp), %rax
movl -0x30(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0xd0(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x34a0
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x33a0
jmp 0x3c18
leaq -0x51(%rbp), %rdi
callq 0x3330
leaq 0xc428(%rip), %rsi      # 0x10050
leaq -0x50(%rbp), %rdi
callq 0xa7b0
movb %al, -0xd1(%rbp)
jmp 0x3c39
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x3c45
jmp 0x3c9b
movl $0x1, %edi
callq 0x4980
jmp 0x3c51
jmp 0x3d9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x1a(%rbp), %rdi
callq 0x3330
jmp 0x3ecb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x51(%rbp), %rdi
callq 0x3330
jmp 0x3ebb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x3dc8
leaq 0xc3b1(%rip), %rsi      # 0x10053
leaq -0x50(%rbp), %rdi
callq 0xa7b0
movb %al, -0xd2(%rbp)
jmp 0x3cb3
movb -0xd2(%rbp), %al
testb $0x1, %al
jne 0x3cbf
jmp 0x3ccb
callq 0x4a20
jmp 0x3cc6
jmp 0x3d9a
leaq 0xc384(%rip), %rsi      # 0x10056
leaq -0x50(%rbp), %rdi
callq 0xa7b0
movb %al, -0xd3(%rbp)
jmp 0x3ce3
movb -0xd3(%rbp), %al
testb $0x1, %al
jne 0x3cef
jmp 0x3cfb
movb $0x1, 0x125b3(%rip)     # 0x162a9
jmp 0x3d98
movq -0xb8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3040
jmp 0x3d0d
movl -0x30(%rbp), %eax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jae 0x3d96
leaq -0x79(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x34a0
movq -0xe0(%rbp), %rdx
leaq 0xc321(%rip), %rsi      # 0x10059
leaq -0x78(%rbp), %rdi
callq 0x33a0
jmp 0x3d43
leaq -0x78(%rbp), %rdi
callq 0x4ad0
jmp 0x3d4e
leaq -0x78(%rbp), %rdi
callq 0x31c0
jmp 0x3d59
leaq -0x79(%rbp), %rdi
callq 0x3330
jmp 0x3d96
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x3d8b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x31c0
jmp 0x3d89
jmp 0x3d8b
leaq -0x79(%rbp), %rdi
callq 0x3330
jmp 0x3dc8
jmp 0x3d98
jmp 0x3d9a
jmp 0x3d9c
leaq -0x50(%rbp), %rdi
callq 0x31c0
jmp 0x3da7
jmp 0x3da9
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x3bd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x3ebb
leaq -0x50(%rbp), %rdi
callq 0x31c0
jmp 0x3dd3
jmp 0x3ebb
jmp 0x3dda
movq -0xb8(%rbp), %rdi
leaq 0xc5df(%rip), %rsi      # 0x103c7
callq 0xa7b0
movb %al, -0xe1(%rbp)
jmp 0x3df5
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0x3e04
jmp 0x3e95
leaq -0xa1(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x34a0
movq -0xf0(%rbp), %rdx
leaq 0xc268(%rip), %rsi      # 0x1008d
leaq -0xa0(%rbp), %rdi
callq 0x33a0
jmp 0x3e33
leaq -0xa0(%rbp), %rdi
callq 0x4b20
jmp 0x3e41
leaq -0xa0(%rbp), %rdi
callq 0x31c0
jmp 0x3e4f
leaq -0xa1(%rbp), %rdi
callq 0x3330
jmp 0x3e95
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x3e87
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x31c0
jmp 0x3e85
jmp 0x3e87
leaq -0xa1(%rbp), %rdi
callq 0x3330
jmp 0x3ebb
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x3eab
movq -0xb8(%rbp), %rdi
callq 0x31c0
movq -0xc0(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
movq -0xb8(%rbp), %rdi
callq 0x31c0
jmp 0x3ec9
jmp 0x3ecb
movq -0x28(%rbp), %rdi
callq 0x3490
movq %rax, %rdi
callq 0xa540
nopl (%rax)