// File: /workspace/github_cpp_makefile_star2_O3/loadzero[P]geoloc/geoloc/geoloc.cpp
// Function: main
int main(int argc, char** argv)
{
    if (argc < 2)
    {
        usage(0);
    }

    Args args(argc, argv);

    std::set<std::string> flags;

    flags.insert("-f");
    flags.insert("--import");
    flags.insert("--headers");
    flags.insert("-q");
    flags.insert("-o");

    std::vector<std::string> input_list;
    std::string import;
    std::string output;

    std::string data_file_name = default_file();
    bool show_headers = false;

    while (!args.empty())
    {
        if (strcmp(args.peek(), "-f") == 0)
        {
            args.pop();

            while (true)
            {
                const char* fn = args.pop();

                if (!fn)
                {
                    usage("empty file arg");
                }

                input_list.push_back(std::string("file:") + fn);

                if (args.empty() || flags.count(args.peek()))
                    break;
            }
        }
        else if (strcmp(args.peek(), "--headers") == 0)
        {
            show_headers = true;
            args.pop();
        }
        else if (strcmp(args.peek(), "-o") == 0)
        {
            args.pop();

            const char* arg = args.pop();

            if (!arg)
            {
                usage("empty output arg");
            }

            output = arg;
        }
        else if (strcmp(args.peek(), "--import") == 0)
        {
            args.pop();

            if (!import.empty())
            {
                usage("too many import options");
            }

            const char* arg = args.pop();

            if (!arg)
            {
                usage("empty import arg");
            }

            import = arg;
        }
        else if (strcmp(args.peek(), "-q") == 0)
        {
            args.pop();

            std::string query = "query:";

            while (true)
            {
                const char* arg = args.pop();

                if (!arg)
                {
                    usage("empty query arg");
                }

                query += arg + std::string(",");

                if (args.empty() || flags.count(args.peek()))
                    break;
            }

            input_list.push_back(query);
        }
        else
        {
            fprintf(stderr, "unrecognized option %s\n", args.peek());
            usage(0);
        }
    }

    if (!import.empty())
    {
        if (!input_list.empty())
        {
            usage("import and query are mutually exclusive");
        }

        if (output.empty())
        {
            usage("no output specified with import");
        }

        std::string city_blocks = import + "/blocks.csv";
        std::string city_locs = import + "/location.csv";
        std::string geo_asns = import + "/asnum.csv";

        etl(city_blocks.c_str(), city_locs.c_str(), geo_asns.c_str(), 
            output.c_str());
    }
    else
    {
        if (input_list.empty())
        {
            usage("query has no input");
        }

        if (!import.empty())
        {
            usage("import and query are mutually exclusive");
        }

        query(data_file_name.c_str(), input_list, show_headers);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
cmpl $0x1, %edi
jle 0x3edb
movq %rsi, %r13
movl %edi, %ebx
leaq 0x120(%rsp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7a4d(%rip), %rsi      # 0xb078
leaq 0x7a48(%rip), %rdx      # 0xb07a
movq %rsp, %rdi
callq 0x8fc8
leaq 0x118(%rsp), %rdi
movq %rsp, %rsi
callq 0xa01a
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x365d
callq 0x31d0
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x7a0c(%rip), %rsi      # 0xb07b
leaq 0x7a0d(%rip), %rdx      # 0xb083
callq 0x8fc8
leaq 0x118(%rsp), %rdi
movq %rsp, %rsi
callq 0xa01a
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x369e
callq 0x31d0
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x79d4(%rip), %rsi      # 0xb084
leaq 0x79d6(%rip), %rdx      # 0xb08d
callq 0x8fc8
leaq 0x118(%rsp), %rdi
movq %rsp, %rsi
callq 0xa01a
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x36df
callq 0x31d0
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x799d(%rip), %rsi      # 0xb08e
leaq 0x7998(%rip), %rdx      # 0xb090
callq 0x8fc8
leaq 0x118(%rsp), %rdi
movq %rsp, %rsi
callq 0xa01a
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3720
callq 0x31d0
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
leaq 0x795f(%rip), %rsi      # 0xb091
leaq 0x795a(%rip), %rdx      # 0xb093
callq 0x8fc8
leaq 0x118(%rsp), %rdi
movq %rsp, %rsi
callq 0xa01a
movq %rbx, 0x50(%rsp)
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3766
callq 0x31d0
xorl %eax, %eax
movq %rax, 0xd0(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
leaq 0xb0(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x108(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x7a88(%rip), %rdi      # 0xb22e
callq 0x3270
testq %rax, %rax
leaq 0x7a19(%rip), %rbx      # 0xb1ce
cmovneq %rax, %rbx
movq %rsp, %r15
leaq 0x10(%rsp), %rax
movq %rax, (%r15)
movq %rbx, %rdi
callq 0x3100
leaq (%rax,%rbx), %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8fc8
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
movq 0x50(%rsp), %r15
jne 0x3809
leaq 0x7a42(%rip), %rdi      # 0xb233
leaq 0x7a4d(%rip), %rdx      # 0xb245
movl $0x33, %esi
xorl %eax, %eax
callq 0xa594
movq 0x8(%rsp), %rdx
leaq 0x90(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%rsp), %rsi
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x646c
leaq 0x7a2c(%rip), %rsi      # 0xb25c
leaq 0x80(%rsp), %rdi
callq 0x3390
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3850
callq 0x31d0
movl %r15d, %eax
movq %rax, 0xe8(%rsp)
leaq 0x8(%r13), %rax
movq %rax, 0xe0(%rsp)
leal -0x2(%r15), %eax
movl %eax, 0x4c(%rsp)
movl $0x1, %r12d
movq $0x0, 0xf0(%rsp)
leaq 0x28(%rsp), %rbp
movq %r13, 0xd8(%rsp)
movslq %r12d, %rax
movq (%r13,%rax,8), %rbx
movb (%rbx), %r14b
cmpb $0x2d, %r14b
jne 0x38f3
cmpb $0x66, 0x1(%rbx)
jne 0x38af
cmpb $0x0, 0x2(%rbx)
je 0x3aff
movq %rbx, %rdi
leaq 0x77cb(%rip), %rsi      # 0xb084
callq 0x32d0
testl %eax, %eax
je 0x396f
cmpb $0x6f, 0x1(%rbx)
jne 0x398a
cmpb $0x0, 0x2(%rbx)
je 0x3c7c
movq %rbx, %rdi
leaq 0x7797(%rip), %rsi      # 0xb07b
callq 0x32d0
testl %eax, %eax
jne 0x39a7
jmp 0x391d
movq %rbx, %rdi
leaq 0x7787(%rip), %rsi      # 0xb084
callq 0x32d0
testl %eax, %eax
je 0x396f
movq %rbx, %rdi
leaq 0x776b(%rip), %rsi      # 0xb07b
callq 0x32d0
testl %eax, %eax
jne 0x3ebb
cmpq $0x0, 0xa8(%rsp)
jne 0x3ec3
leal 0x1(%r12), %eax
cmpl %r15d, %eax
je 0x3eaf
cltq
movq (%r13,%rax,8), %rbx
testq %rbx, %rbx
je 0x3eaf
movq %rbx, %rdi
callq 0x3100
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
movq %rax, %r8
callq 0x3300
addl $0x2, %r12d
jmp 0x397c
incl %r12d
movb $0x1, %al
movq %rax, 0xf0(%rsp)
cmpl %r15d, %r12d
jne 0x388e
jmp 0x3cc7
movq %rbx, %rdi
leaq 0x76e7(%rip), %rsi      # 0xb07b
callq 0x32d0
testl %eax, %eax
je 0x391d
cmpb $0x2d, %r14b
jne 0x3ebb
cmpb $0x71, 0x1(%rbx)
jne 0x3ebb
cmpb $0x0, 0x2(%rbx)
jne 0x3ebb
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %rsp, %rdi
leaq 0x7715(%rip), %rsi      # 0xb0e3
leaq 0x7714(%rip), %rdx      # 0xb0e9
callq 0x8fc8
leal 0x1(%r12), %eax
movl %eax, 0x24(%rsp)
cltq
movq 0xe8(%rsp), %r15
subq %rax, %r15
movq %r15, 0x78(%rsp)
movq 0xe0(%rsp), %rcx
leaq (%rcx,%rax,8), %r13
movl 0x4c(%rsp), %eax
movl %eax, %r14d
subl %r12d, %r14d
xorl %r12d, %r12d
cmpq %r12, 0x78(%rsp)
je 0x3e97
movq -0x8(%r13,%r12,8), %rbx
testq %rbx, %rbx
je 0x3e97
leaq 0x68(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0x58(%rsp), %r15
movq %r15, %rdi
leaq 0x76ba(%rip), %rsi      # 0xb0fa
leaq 0x76b4(%rip), %rdx      # 0xb0fb
callq 0x8fc8
movq %rbp, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x41cd
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rsp, %rdi
callq 0x30a0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x3a80
callq 0x31d0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x3a94
callq 0x31d0
cmpl %r12d, %r14d
je 0x3c40
movq (%r13,%r12,8), %rsi
movq %rbp, %rbx
movq %rbp, %rdi
movq %r15, %rdx
callq 0x30e0
leaq 0x118(%rsp), %rdi
movq %rbx, %rsi
callq 0xa418
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x3ad7
callq 0x31d0
incq %r12
leaq 0x120(%rsp), %rax
cmpq %rax, %rbx
je 0x3a0e
movl 0x24(%rsp), %eax
addl %r12d, %eax
movl %eax, %r12d
movq 0x50(%rsp), %r15
jmp 0x3c48
leal 0x1(%r12), %eax
movl %eax, 0x24(%rsp)
cltq
movq 0xe8(%rsp), %r14
subq %rax, %r14
movq %r14, 0x78(%rsp)
movq 0xe0(%rsp), %rcx
leaq (%rcx,%rax,8), %r15
movl 0x4c(%rsp), %eax
movl %eax, %r13d
subl %r12d, %r13d
xorl %r12d, %r12d
cmpq %r12, 0x78(%rsp)
je 0x3ea3
movq -0x8(%r15,%r12,8), %rbx
testq %rbx, %rbx
je 0x3ea3
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbp, %rdi
leaq 0x7543(%rip), %rsi      # 0xb0a3
leaq 0x7541(%rip), %rdx      # 0xb0a8
callq 0x8fc8
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
movq %rsp, %r14
movq %r14, %rdi
callq 0x646c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3390
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
callq 0x4190
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3bbb
callq 0x31d0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x3bcf
callq 0x31d0
cmpl %r12d, %r13d
je 0x3cc7
movq (%r15,%r12,8), %rsi
movq %rsp, %rbx
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x30e0
leaq 0x118(%rsp), %rdi
movq %rbx, %rsi
callq 0xa418
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3c10
callq 0x31d0
incq %r12
leaq 0x120(%rsp), %rax
cmpq %rax, %rbx
je 0x3b33
movl 0x24(%rsp), %eax
addl %r12d, %eax
movl %eax, %r12d
movq 0xd8(%rsp), %r13
movq 0x50(%rsp), %r15
jmp 0x397c
movq 0x50(%rsp), %r15
movl %r15d, %r12d
leaq 0xc0(%rsp), %rdi
movq %rsp, %rsi
callq 0x4190
movq 0xd8(%rsp), %r13
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x397c
callq 0x31d0
jmp 0x397c
leal 0x1(%r12), %eax
cmpl %r15d, %eax
je 0x3ecf
cltq
movq (%r13,%rax,8), %rbx
testq %rbx, %rbx
je 0x3ecf
movq 0x100(%rsp), %r14
movq %rbx, %rdi
callq 0x3100
leaq 0xf8(%rsp), %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x3300
jmp 0x3969
movq 0xa8(%rsp), %rdx
movq 0xc0(%rsp), %rax
movq 0xc8(%rsp), %rcx
testq %rdx, %rdx
je 0x3dee
cmpq %rcx, %rax
jne 0x3ee2
cmpq $0x0, 0x100(%rsp)
je 0x3eee
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq 0xa0(%rsp), %rsi
addq %rsi, %rdx
callq 0x646c
leaq 0x743a(%rip), %rsi      # 0xb15c
movq %rsp, %rdi
callq 0x3390
leaq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
movq %rax, (%rdi)
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
addq %rsi, %rdx
callq 0x646c
leaq 0x7412(%rip), %rsi      # 0xb168
leaq 0x28(%rsp), %rdi
callq 0x3390
leaq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
movq %rax, (%rdi)
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
addq %rsi, %rdx
callq 0x646c
leaq 0x73ea(%rip), %rsi      # 0xb176
leaq 0x58(%rsp), %rdi
callq 0x3390
movq (%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq 0xf8(%rsp), %rcx
callq 0x424e
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x3dc5
callq 0x31d0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x3dd9
callq 0x31d0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3e17
callq 0x31d0
jmp 0x3e17
cmpq %rcx, %rax
je 0x3efa
movq 0x80(%rsp), %rdi
movzbl 0xf0(%rsp), %edx
andl $0x1, %edx
leaq 0xc0(%rsp), %rsi
callq 0x43a8
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x3e31
callq 0x31d0
movq 0xf8(%rsp), %rdi
leaq 0x108(%rsp), %rax
cmpq %rax, %rdi
je 0x3e4b
callq 0x31d0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x3e65
callq 0x31d0
leaq 0xc0(%rsp), %rdi
callq 0x44aa
leaq 0x118(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x9fd2
xorl %eax, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x724c(%rip), %rdi      # 0xb0ea
callq 0x40c9
leaq 0x71ea(%rip), %rdi      # 0xb094
callq 0x40c9
leaq 0x721c(%rip), %rdi      # 0xb0d2
callq 0x40c9
movq %rbx, %rdi
callq 0x33d0
leaq 0x71f0(%rip), %rdi      # 0xb0ba
callq 0x40c9
leaq 0x71d3(%rip), %rdi      # 0xb0a9
callq 0x40c9
xorl %edi, %edi
callq 0x40c9
leaq 0x722b(%rip), %rdi      # 0xb114
callq 0x40c9
leaq 0x7247(%rip), %rdi      # 0xb13c
callq 0x40c9
leaq 0x7280(%rip), %rdi      # 0xb181
callq 0x40c9
jmp 0x3fc5
jmp 0x3fc5
jmp 0x3f12
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x3ff7
callq 0x31d0
jmp 0x3ff7
jmp 0x3ff4
jmp 0x3ff4
jmp 0x4005
jmp 0x4005
jmp 0x3fc5
jmp 0x3fa0
movq %rax, %rbx
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x3fab
callq 0x31d0
jmp 0x3fab
movq %rax, %rbx
jmp 0x4067
jmp 0x3f81
jmp 0x3fa0
jmp 0x3f81
jmp 0x3fa0
jmp 0x3f81
jmp 0x3fa0
jmp 0x3f81
jmp 0x3fa0
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x40a8
callq 0x31d0
jmp 0x40a8
movq %rax, %rbx
jmp 0x40a8
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
jmp 0x405d
jmp 0x4005
jmp 0x3fc5
jmp 0x3fc5
jmp 0x3fc5
jmp 0x4005
jmp 0x3fd2
movq %rax, %rbx
jmp 0x404d
movq %rax, %rbx
jmp 0x3fe8
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3fe8
callq 0x31d0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
jmp 0x4043
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
jmp 0x4030
jmp 0x4005
movq %rax, %rbx
jmp 0x403a
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x4026
callq 0x31d0
jmp 0x4026
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x403a
callq 0x31d0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x404d
callq 0x31d0
leaq 0x90(%rsp), %rax
movq 0x80(%rsp), %rdi
cmpq %rax, %rdi
je 0x4067
callq 0x31d0
leaq 0x108(%rsp), %rax
movq 0xf8(%rsp), %rdi
cmpq %rax, %rdi
je 0x4081
callq 0x31d0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x409b
callq 0x31d0
leaq 0xc0(%rsp), %rdi
callq 0x44aa
leaq 0x118(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x9fd2
movq %rbx, %rdi
callq 0x3350
movq %rax, %rdi
callq 0x4185