// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rcx
leaq 0x2b2a(%rip), %rdi      # 0xa5ea
leaq 0x2d95(%rip), %rdx      # 0xa85c
movl $0x18a, %esi            # imm = 0x18A
xorl %eax, %eax
callq 0x93b8
movq (%r14), %r12
movq 0x8(%r14), %r14
addq %r12, %r14
pushq $0x3a
popq %rsi
movq %r12, %rdi
callq 0x30b0
movq %rax, %r15
testq %rax, %rax
jne 0x7b0d
leaq 0x2af3(%rip), %rdi      # 0xa5ea
leaq 0x2d78(%rip), %rdx      # 0xa876
movl $0x192, %esi            # imm = 0x192
movq %r12, %rcx
xorl %eax, %eax
callq 0x94d0
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x80f4
incq %r15
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rsp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x80f4
leaq 0x2d49(%rip), %rsi      # 0xa890
leaq 0x20(%rsp), %rdi
callq 0x4978
testb %al, %al
je 0x7b7e
leaq 0x58(%rsp), %rdi
movq %rsp, %rsi
callq 0x468a
leaq 0x58(%rsp), %rdi
movq %rbx, %rsi
callq 0x8450
leaq 0x58(%rsp), %rdi
callq 0x4946
jmp 0x7c5b
leaq 0x2d10(%rip), %rsi      # 0xa895
leaq 0x20(%rsp), %rdi
callq 0x4978
testb %al, %al
je 0x7c3c
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rcx
andq $0x0, 0x10(%rcx)
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movaps %xmm0, (%rcx)
movb $0x0, (%rax)
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x4a76
leaq 0x80(%rsp), %r14
andq $0x0, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r14, %rdi
callq 0x8c26
leaq 0x98(%rsp), %rdi
andq $0x0, 0x8(%rdi)
leaq 0x8163(%rip), %rax      # 0xfd68
movq %rax, (%rdi)
movq %r14, 0x10(%rdi)
andq $0x0, 0x18(%rdi)
movq %rbx, %rsi
callq 0x855b
leaq 0x80(%rsp), %rdi
callq 0x4142
leaq 0x58(%rsp), %rdi
callq 0x3260
leaq 0x40(%rsp), %rdi
callq 0x5326
jmp 0x7c5b
movq 0x20(%rsp), %rcx
leaq 0x29a2(%rip), %rdi      # 0xa5ea
leaq 0x2c4c(%rip), %rdx      # 0xa89b
movl $0x1ab, %esi            # imm = 0x1AB
xorl %eax, %eax
callq 0x94d0
movq %rsp, %rdi
callq 0x3260
leaq 0x20(%rsp), %rdi
callq 0x3260
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x7cca
movq %rax, %rbx
jmp 0x7ca6
jmp 0x7c99
jmp 0x7c87
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x4142
jmp 0x7c9c
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x3260
leaq 0x40(%rsp), %rdi
callq 0x5326
jmp 0x7ccd
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x4946
jmp 0x7ccd
jmp 0x7cc5
jmp 0x7cca
movq %rax, %rbx
jmp 0x7cd5
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3260
leaq 0x20(%rsp), %rdi
callq 0x3260
movq %rbx, %rdi
callq 0x3370
movq %rax, %rdi
callq 0x3e8f
nop