// File: /workspace/github_cpp_makefile_star2_O1/loadzero[P]geoloc/geoloc/query.hpp
// Function: query(GeoData&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
inline void query(GeoData &data, const std::string &source)
{
    LOG_CONTEXT("query data with source %s", source.c_str());
    
    const char* iter = &source[0];
    const char* end = &source[0] + source.size();
    const char* res = strchr(iter, ':');

    if (!res)
    {
        FATAL_ERROR("could not parse source %s", source.c_str());
    }

    std::string protocol(iter, res);
    std::string path(res+1, end);

    if (protocol == "file")
    {
        FileReader reader(path);
        query(reader, data);
    }
    else if (protocol == "query")
    {
        std::vector<char*> toks;
        std::string scratch;
        csv_split(&path[0], path.size(), scratch, toks);

        std::vector<std::string> ip_list;
        ip_list.assign(toks.begin(), toks.end());

        StringInjector reader(ip_list);
        query(reader, data);
    }
    else
    {
        FATAL_ERROR("unknown source protocol %s", protocol.c_str());
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rcx
leaq 0x2d1d(%rip), %rdi      # 0xb618
leaq 0x2f88(%rip), %rdx      # 0xb88a
movl $0x18a, %esi            # imm = 0x18A
xorl %eax, %eax
callq 0xa3f4
movq (%r14), %r12
movq 0x8(%r14), %r14
addq %r12, %r14
movq %r12, %rdi
movl $0x3a, %esi
callq 0x30d0
movq %rax, %r15
testq %rax, %rax
jne 0x894a
leaq 0x2ce4(%rip), %rdi      # 0xb618
leaq 0x2f69(%rip), %rdx      # 0xb8a4
movl $0x192, %esi            # imm = 0x192
movq %r12, %rcx
xorl %eax, %eax
callq 0xa50c
leaq 0x30(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8f40
incq %r15
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rsp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x8f40
leaq 0x2f39(%rip), %rsi      # 0xb8be
leaq 0x20(%rsp), %rdi
callq 0x3080
testl %eax, %eax
je 0x89cc
leaq 0x2f29(%rip), %rsi      # 0xb8c3
leaq 0x20(%rsp), %rdi
callq 0x3080
testl %eax, %eax
je 0x89f5
movq 0x20(%rsp), %rcx
leaq 0x2c64(%rip), %rdi      # 0xb618
leaq 0x2f0e(%rip), %rdx      # 0xb8c9
movl $0x1ab, %esi            # imm = 0x1AB
xorl %eax, %eax
callq 0xa50c
jmp 0x8aa6
leaq 0x58(%rsp), %rdi
movq %rsp, %rsi
callq 0x49ae
leaq 0x58(%rsp), %rdi
movq %rbx, %rsi
callq 0x92d0
leaq 0x58(%rsp), %rdi
callq 0x4c44
jmp 0x8aa6
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rcx
movaps %xmm0, (%rcx)
xorl %eax, %eax
movq %rax, 0x10(%rcx)
leaq 0x68(%rsp), %r15
movq %r15, -0x10(%r15)
movq %rax, -0x8(%r15)
movb $0x0, (%r15)
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x4d83
leaq 0x80(%rsp), %r14
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r14, %rdi
callq 0x9c56
xorl %eax, %eax
leaq 0xa0(%rsp), %rdi
movq %rax, 0x8(%rdi)
leaq 0x7300(%rip), %rcx      # 0xfd68
movq %rcx, (%rdi)
movq %r14, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movq %rbx, %rsi
callq 0x944c
leaq 0x80(%rsp), %rdi
callq 0x4416
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x8a97
callq 0x31d0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x8aa6
callq 0x31d0
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x8ab4
callq 0x31d0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x8ac3
callq 0x31d0
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x8aea
jmp 0x8ad8
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x4416
jmp 0x8aed
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x8afc
callq 0x31d0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x8b2e
callq 0x31d0
jmp 0x8b2e
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x4c44
jmp 0x8b2e
movq %rax, %rdi
callq 0x40f4
jmp 0x8b2b
movq %rax, %rbx
jmp 0x8b3c
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x8b3c
callq 0x31d0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x8b4b
callq 0x31d0
movq %rbx, %rdi
callq 0x3350
nop