// File: /workspace/github_cpp_makefile_star2_O1/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 %rsi, %r14
movq %rdi, 0x70(%rsp)
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r15
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
leaq 0x567d(%rip), %r12      # 0xb168
leaq 0x10(%rsp), %r13
cmpq $0x0, 0x8(%r14)
je 0x5ba1
movl $0x1, %ecx
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x33f0
movq %rax, %rbx
cmpq $-0x1, %rax
je 0x5b8c
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x32d0
movq %r15, %rdi
movq %r13, %rsi
callq 0x8648
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x5b4d
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0x1(%rbx), %rdx
movq %r13, %rdi
movq %r14, %rsi
movq $-0x1, %rcx
callq 0x32d0
movq %r14, %rdi
movq %r13, %rsi
callq 0x3340
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x5b97
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x5b97
movq %r15, %rdi
movq %r14, %rsi
callq 0x71a4
cmpq $-0x1, %rbx
jne 0x5af0
movq 0x38(%rsp), %rax
subq 0x30(%rsp), %rax
movl %ebp, %ecx
sarq $0x5, %rax
cmpq %rcx, %rax
setb 0xf(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
testl %ebp, %ebp
je 0x5cf0
leaq 0x60(%rsp), %rbx
leaq 0x88(%rsp), %r15
leaq 0x50(%rsp), %r14
leaq 0x10(%rsp), %r12
leaq 0x78(%rsp), %r13
movq 0x38(%rsp), %rax
cmpq 0x30(%rsp), %rax
je 0x5cf0
movq %rbx, 0x50(%rsp)
movq -0x20(%rax), %rsi
movq -0x18(%rax), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x3c70
movq %r14, %rdi
leaq 0x5541(%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 0x5c64
movq %rdx, 0x78(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x88(%rsp)
jmp 0x5c6b
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 0x5cab
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x50(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5cc2
movq 0x60(%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 0x5ce8
movq (%rax), %rsi
incq %rsi
callq 0x32b0
decl %ebp
jne 0x5bf5
cmpq $0x0, 0x18(%rsp)
movq 0x70(%rsp), %rbx
je 0x5d07
leaq 0x10(%rsp), %rdi
callq 0x3330
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x3c70
movb 0xf(%rsp), %al
movb %al, 0x20(%rbx)
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x5d46
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0x30(%rsp), %rdi
callq 0x71e2
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5d89
jmp 0x5dac
jmp 0x5d89
jmp 0x5d6d
movq %rax, %r14
movq 0x50(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5d8c
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x5d8c
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x5daf
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x5daf
jmp 0x5dac
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x71e2
movq %r14, %rdi
callq 0x3400
nop