// File: /workspace/github_cpp_makefile_star2_O3/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 0x2c83(%rip), %rdi      # 0xb618
leaq 0x2eee(%rip), %rdx      # 0xb88a
movl $0x18a, %esi            # imm = 0x18A
xorl %eax, %eax
callq 0xa47c
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 0x89e4
leaq 0x2c4a(%rip), %rdi      # 0xb618
leaq 0x2ecf(%rip), %rdx      # 0xb8a4
movl $0x192, %esi            # imm = 0x192
movq %r12, %rcx
xorl %eax, %eax
callq 0xa594
leaq 0x30(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8fc8
incq %r15
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rsp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x8fc8
leaq 0x2e9f(%rip), %rsi      # 0xb8be
leaq 0x20(%rsp), %rdi
callq 0x3080
testl %eax, %eax
je 0x8a66
leaq 0x2e8f(%rip), %rsi      # 0xb8c3
leaq 0x20(%rsp), %rdi
callq 0x3080
testl %eax, %eax
je 0x8a8f
movq 0x20(%rsp), %rcx
leaq 0x2bca(%rip), %rdi      # 0xb618
leaq 0x2e74(%rip), %rdx      # 0xb8c9
movl $0x1ab, %esi            # imm = 0x1AB
xorl %eax, %eax
callq 0xa594
jmp 0x8b40
leaq 0x58(%rsp), %rdi
movq %rsp, %rsi
callq 0x4a3a
leaq 0x58(%rsp), %rdi
movq %rbx, %rsi
callq 0x9359
leaq 0x58(%rsp), %rdi
callq 0x4cd0
jmp 0x8b40
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 0x4e0f
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 0x9ce0
xorl %eax, %eax
leaq 0xa0(%rsp), %rdi
movq %rax, 0x8(%rdi)
leaq 0x7266(%rip), %rcx      # 0xfd68
movq %rcx, (%rdi)
movq %r14, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movq %rbx, %rsi
callq 0x94d5
leaq 0x80(%rsp), %rdi
callq 0x44aa
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x8b31
callq 0x31d0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x8b40
callq 0x31d0
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x8b4e
callq 0x31d0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x8b5d
callq 0x31d0
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x8b84
jmp 0x8b72
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x44aa
jmp 0x8b87
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x8b96
callq 0x31d0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x8bc8
callq 0x31d0
jmp 0x8bc8
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x4cd0
jmp 0x8bc8
movq %rax, %rdi
callq 0x4185
jmp 0x8bc5
movq %rax, %rbx
jmp 0x8bd6
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x8bd6
callq 0x31d0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x8be5
callq 0x31d0
movq %rbx, %rdi
callq 0x3350
nop