// File: /workspace/github_cpp_makefile_star2_O3/davidgfnet[P]tadns/tadns.cc
// Function: tokenizedom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int)
std::pair<std::string, bool> tokenizedom (std::string dom, unsigned level) {
    std::vector<std::string> chunks;
    while (dom.size()) {
        auto p = dom.find(".");
        if (p != std::string::npos) {
            chunks.push_back(dom.substr(0, p));
            dom = dom.substr(p+1);
        }
        else {
            chunks.push_back(dom);
            break;
        }
    }

    bool lastquery = level > chunks.size();
    std::string ret;
    while (level-- && chunks.size()) {
        ret = chunks.back() + "." + ret;
        chunks.pop_back();
    }
    if (ret.size())
        ret.pop_back();

    return std::make_pair(ret, lastquery);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %edx, %ebp
movq %rdi, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
cmpq $0x0, 0x8(%rsi)
je 0x5b40
movq %rsi, %r14
leaq 0x20(%rsp), %r15
leaq 0x10(%rsp), %r12
leaq 0x30(%rsp), %r13
movl $0x1, %ecx
movq %r14, %rdi
leaq 0x56be(%rip), %rsi      # 0xb168
xorl %edx, %edx
callq 0x33f0
cmpq $-0x1, %rax
je 0x5b33
movq %rax, %rbx
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x32d0
movq %r13, %rdi
movq %r12, %rsi
callq 0x85f8
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x5aec
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
incq %rbx
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq $-0x1, %rcx
callq 0x32d0
movq %r14, %rdi
movq %r12, %rsi
callq 0x3340
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x5b26
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
cmpq $0x0, 0x8(%r14)
jne 0x5a9b
jmp 0x5b40
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x7186
movl %ebp, %eax
movq 0x38(%rsp), %rcx
subq 0x30(%rsp), %rcx
sarq $0x5, %rcx
cmpq %rax, %rcx
setb %r15b
leaq 0x20(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
testl %ebp, %ebp
je 0x5caf
movb %r15b, 0xf(%rsp)
leaq 0x68(%rsp), %rbx
leaq 0x88(%rsp), %r15
leaq 0x58(%rsp), %r14
leaq 0x10(%rsp), %r12
leaq 0x78(%rsp), %r13
movq 0x38(%rsp), %rax
cmpq 0x30(%rsp), %rax
je 0x5c8f
movq %rbx, 0x58(%rsp)
movq -0x20(%rax), %rsi
movq -0x18(%rax), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x3c72
movq %r14, %rdi
leaq 0x55a2(%rip), %rsi      # 0xb168
callq 0x3450
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r14, %rdi
callq 0x3100
movq %r15, 0x78(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5c03
movq %rdx, 0x78(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x88(%rsp)
jmp 0x5c0a
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x80(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r12, %rdi
movq %r13, %rsi
callq 0x3340
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x5c4a
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x58(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5c61
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x38(%rsp), %rax
leaq -0x20(%rax), %rcx
movq %rcx, 0x38(%rsp)
movq -0x20(%rax), %rdi
addq $-0x10, %rax
cmpq %rax, %rdi
je 0x5c87
movq (%rax), %rsi
incq %rsi
callq 0x32b0
decl %ebp
jne 0x5b94
cmpq $0x0, 0x18(%rsp)
movq 0x50(%rsp), %r14
je 0x5cb8
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x3330
movq 0x8(%rbx), %rdx
jmp 0x5cba
xorl %edx, %edx
movq 0x50(%rsp), %r14
jmp 0x5cc4
xorl %edx, %edx
leaq 0x20(%rsp), %rbx
movb 0xf(%rsp), %r15b
leaq 0x10(%r14), %rax
movq %rax, (%r14)
movq 0x10(%rsp), %rsi
addq %rsi, %rdx
movq %r14, %rdi
callq 0x3c72
movb %r15b, 0x20(%r14)
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5cf6
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0x30(%rsp), %rdi
callq 0x71c4
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5d4d
jmp 0x5d19
movq %rax, %r14
jmp 0x5d3a
jmp 0x5d20
movq %rax, %r14
movq 0x58(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5d3a
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
jne 0x5d5f
jmp 0x5d6c
jmp 0x5d4d
movq %rax, %r14
jmp 0x5d6c
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x5d6c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0x30(%rsp), %rdi
callq 0x71c4
movq %r14, %rdi
callq 0x3400