// File: /workspace/github_cpp_makefile_star2_O1/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 $0x168, %rsp            # imm = 0x168
cmpl $0x1, %edi
jle 0x3e30
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x100(%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 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7a4d(%rip), %rsi      # 0xb078
leaq 0x7a48(%rip), %rdx      # 0xb07a
leaq 0x8(%rsp), %rdi
callq 0x8f40
leaq 0xf8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x9f8a
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3662
callq 0x31d0
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x7a05(%rip), %rsi      # 0xb07b
leaq 0x7a06(%rip), %rdx      # 0xb083
callq 0x8f40
leaq 0xf8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x9f8a
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x36a8
callq 0x31d0
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x79c8(%rip), %rsi      # 0xb084
leaq 0x79ca(%rip), %rdx      # 0xb08d
callq 0x8f40
leaq 0xf8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x9f8a
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x36ee
callq 0x31d0
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x798c(%rip), %rsi      # 0xb08e
leaq 0x7987(%rip), %rdx      # 0xb090
callq 0x8f40
leaq 0xf8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x9f8a
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3734
callq 0x31d0
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
leaq 0x7949(%rip), %rsi      # 0xb091
leaq 0x7944(%rip), %rdx      # 0xb093
callq 0x8f40
leaq 0xf8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x9f8a
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x377a
callq 0x31d0
xorl %eax, %eax
movq %rax, 0xa0(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
leaq 0x80(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0xc8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x7a74(%rip), %rdi      # 0xb22e
callq 0x3270
testq %rax, %rax
leaq 0x7a05(%rip), %r14      # 0xb1ce
cmovneq %rax, %r14
leaq 0x8(%rsp), %r15
leaq 0x18(%rsp), %rax
movq %rax, (%r15)
movq %r14, %rdi
callq 0x3100
leaq (%rax,%r14), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x8f40
cmpq $0x0, 0x10(%rsp)
jne 0x3813
leaq 0x7a33(%rip), %rdi      # 0xb233
leaq 0x7a3e(%rip), %rdx      # 0xb245
movl $0x33, %esi
xorl %eax, %eax
callq 0xa50c
leaq 0xe8(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0xd8(%rsp), %rdi
callq 0x63ea
leaq 0x7a1c(%rip), %rsi      # 0xb25c
leaq 0xd8(%rsp), %rdi
callq 0x3390
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3861
callq 0x31d0
movl $0x1, %r12d
movq $0x0, 0xb0(%rsp)
leaq 0x8(%rsp), %r14
movslq %r12d, %r13
movq (%rbx,%r13,8), %rdi
leaq 0x77f2(%rip), %rsi      # 0xb078
callq 0x32d0
testl %eax, %eax
je 0x3a3d
movq (%rbx,%r13,8), %rdi
leaq 0x77e6(%rip), %rsi      # 0xb084
callq 0x32d0
testl %eax, %eax
je 0x3b54
movq (%rbx,%r13,8), %rdi
leaq 0x77db(%rip), %rsi      # 0xb091
callq 0x32d0
testl %eax, %eax
je 0x3b69
movq (%rbx,%r13,8), %rdi
leaq 0x77ad(%rip), %rsi      # 0xb07b
callq 0x32d0
testl %eax, %eax
je 0x3b78
movq (%rbx,%r13,8), %rdi
leaq 0x77a8(%rip), %rsi      # 0xb08e
callq 0x32d0
testl %eax, %eax
jne 0x3e01
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r14, %rdi
leaq 0x77dc(%rip), %rsi      # 0xb0e3
leaq 0x77db(%rip), %rdx      # 0xb0e9
callq 0x8f40
incl %r12d
movl %r12d, %r13d
cmpl %ebp, %r13d
jne 0x3923
xorl %r12d, %r12d
jmp 0x392d
movslq %r13d, %rax
movq (%rbx,%rax,8), %r12
incl %r13d
testq %r12, %r12
je 0x3df5
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x50(%rsp), %r15
movq %r15, %rdi
leaq 0x77ab(%rip), %rsi      # 0xb0fa
leaq 0x77a5(%rip), %rdx      # 0xb0fb
callq 0x8f40
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x413d
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r14, %rdi
callq 0x30a0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x3991
callq 0x31d0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x39a5
callq 0x31d0
movb $0x1, %r12b
cmpl %ebp, %r13d
je 0x39e8
movslq %r13d, %rax
movq (%rbx,%rax,8), %rsi
leaq 0x128(%rsp), %r15
movq %r15, %rdi
leaq 0x2e(%rsp), %rdx
callq 0x30e0
leaq 0xf8(%rsp), %rdi
movq %r15, %rsi
callq 0xa38c
leaq 0x100(%rsp), %rcx
cmpq %rcx, %rax
setne %r12b
cmpl %ebp, %r13d
je 0x3a07
movq 0x128(%rsp), %rdi
leaq 0x138(%rsp), %rax
cmpq %rax, %rdi
je 0x3a07
callq 0x31d0
testb %r12b, %r12b
je 0x3919
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x4100
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3c0d
callq 0x31d0
jmp 0x3c0d
incl %r12d
movl %r12d, %r13d
cmpl %ebp, %r13d
jne 0x3a4d
xorl %r12d, %r12d
jmp 0x3a57
movslq %r13d, %rax
movq (%rbx,%rax,8), %r12
incl %r13d
testq %r12, %r12
je 0x3de9
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x762d(%rip), %rsi      # 0xb0a3
leaq 0x762b(%rip), %rdx      # 0xb0a8
callq 0x8f40
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x63ea
movq %r14, %rdi
movq %r12, %rsi
callq 0x3390
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
callq 0x4100
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3ad0
callq 0x31d0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x3ae4
callq 0x31d0
movb $0x1, %r12b
cmpl %ebp, %r13d
je 0x3b27
movslq %r13d, %rax
movq (%rbx,%rax,8), %rsi
leaq 0x148(%rsp), %r12
movq %r12, %rdi
leaq 0x2f(%rsp), %rdx
callq 0x30e0
leaq 0xf8(%rsp), %rdi
movq %r12, %rsi
callq 0xa38c
leaq 0x100(%rsp), %rcx
cmpq %rcx, %rax
setne %r12b
cmpl %ebp, %r13d
je 0x3b46
movq 0x148(%rsp), %rdi
leaq 0x158(%rsp), %rax
cmpq %rax, %rdi
je 0x3b46
callq 0x31d0
testb %r12b, %r12b
je 0x3a43
jmp 0x3c0d
incl %r12d
movb $0x1, %al
movq %rax, 0xb0(%rsp)
movl %r12d, %r13d
jmp 0x3c0d
leal 0x1(%r12), %r13d
cmpl %ebp, %r13d
jne 0x3b93
xorl %r15d, %r15d
jmp 0x3ba1
cmpq $0x0, 0x78(%rsp)
jne 0x3e18
leal 0x1(%r12), %r13d
cmpl %ebp, %r13d
jne 0x3bd4
xorl %r15d, %r15d
jmp 0x3be2
movslq %r13d, %rax
movq (%rbx,%rax,8), %r15
addl $0x2, %r12d
movl %r12d, %r13d
testq %r15, %r15
je 0x3e0c
movq 0xc0(%rsp), %r12
movq %r15, %rdi
callq 0x3100
leaq 0xb8(%rsp), %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x3300
jmp 0x3c0d
movslq %r13d, %rax
movq (%rbx,%rax,8), %r15
addl $0x2, %r12d
movl %r12d, %r13d
testq %r15, %r15
je 0x3e24
movq 0x78(%rsp), %r12
movq %r15, %rdi
callq 0x3100
leaq 0x70(%rsp), %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x3300
movl %r13d, %r12d
cmpl %ebp, %r13d
jne 0x3878
cmpq $0x0, 0x78(%rsp)
movq 0x90(%rsp), %rax
movq 0x98(%rsp), %rcx
je 0x3d37
cmpq %rcx, %rax
jne 0x3e37
cmpq $0x0, 0xc0(%rsp)
je 0x3e43
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
addq %rsi, %rdx
callq 0x63ea
leaq 0x74e9(%rip), %rsi      # 0xb15c
leaq 0x8(%rsp), %rdi
callq 0x3390
leaq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
movq %rax, (%rdi)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
addq %rsi, %rdx
callq 0x63ea
leaq 0x74c5(%rip), %rsi      # 0xb168
leaq 0x30(%rsp), %rdi
callq 0x3390
leaq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
movq %rax, (%rdi)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
addq %rsi, %rdx
callq 0x63ea
leaq 0x74a3(%rip), %rsi      # 0xb176
leaq 0x50(%rsp), %rdi
callq 0x3390
movq 0x8(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq 0xb8(%rsp), %rcx
callq 0x41be
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x3d0d
callq 0x31d0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x3d21
callq 0x31d0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3d6c
callq 0x31d0
jmp 0x3d6c
cmpq %rcx, %rax
je 0x3e4f
cmpq $0x0, 0x78(%rsp)
jne 0x3e37
movq 0xd8(%rsp), %rdi
movzbl 0xb0(%rsp), %edx
andl $0x1, %edx
leaq 0x90(%rsp), %rsi
callq 0x4314
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x3d86
callq 0x31d0
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x3da0
callq 0x31d0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x3db7
callq 0x31d0
leaq 0x90(%rsp), %rdi
callq 0x4416
leaq 0xf8(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x9f42
xorl %eax, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x72a4(%rip), %rdi      # 0xb094
callq 0x4038
leaq 0x72ee(%rip), %rdi      # 0xb0ea
callq 0x4038
movl %r12d, %edi
movq %rbx, %rsi
callq 0x33d0
leaq 0x7296(%rip), %rdi      # 0xb0a9
callq 0x4038
leaq 0x729b(%rip), %rdi      # 0xb0ba
callq 0x4038
leaq 0x72a7(%rip), %rdi      # 0xb0d2
callq 0x4038
xorl %edi, %edi
callq 0x4038
leaq 0x72d6(%rip), %rdi      # 0xb114
callq 0x4038
leaq 0x72f2(%rip), %rdi      # 0xb13c
callq 0x4038
leaq 0x732b(%rip), %rdi      # 0xb181
callq 0x4038
jmp 0x3f8a
jmp 0x3e62
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x3e80
callq 0x31d0
jmp 0x3e80
jmp 0x3e7d
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
jmp 0x3f5b
jmp 0x3f35
jmp 0x3f35
jmp 0x3f8a
jmp 0x3ef7
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x3f02
callq 0x31d0
jmp 0x3f02
movq %rax, %rbx
jmp 0x3fd9
jmp 0x3ed7
jmp 0x3ef7
jmp 0x3ed7
jmp 0x3ef7
jmp 0x3ed7
jmp 0x3ef7
jmp 0x3ed7
jmp 0x3ef7
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4017
callq 0x31d0
jmp 0x4017
movq %rax, %rbx
jmp 0x4017
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
jmp 0x3fcf
jmp 0x3f8a
jmp 0x3f8a
jmp 0x3f35
jmp 0x3f8a
jmp 0x3f35
movq %rax, %rbx
movq 0x128(%rsp), %rdi
leaq 0x138(%rsp), %rax
jmp 0x3f5b
movq %rax, %rbx
jmp 0x3f51
movq %rax, %rbx
jmp 0x3f65
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x3f51
callq 0x31d0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x3f65
callq 0x31d0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
jmp 0x3fb5
jmp 0x3f8a
movq %rax, %rbx
movq 0x148(%rsp), %rdi
leaq 0x158(%rsp), %rax
jmp 0x3fb5
jmp 0x3f8f
movq %rax, %rbx
jmp 0x3fbf
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3fab
callq 0x31d0
jmp 0x3fab
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x3fbf
callq 0x31d0
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x3fd9
callq 0x31d0
leaq 0xc8(%rsp), %rax
movq 0xb8(%rsp), %rdi
cmpq %rax, %rdi
je 0x3ff3
callq 0x31d0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x400a
callq 0x31d0
leaq 0x90(%rsp), %rdi
callq 0x4416
leaq 0xf8(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x9f42
movq %rbx, %rdi
callq 0x3350
movq %rax, %rdi
callq 0x40f4