LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/chahk0129[P]hash_bench/./bench/benchmark.hpp
// Function: benchmark_t<unsigned long>::utilization(int, Pair<unsigned long>*, int)
inline void benchmark_t<Key_t>::utilization(int index_type, Pair<Key_t>* init_kv, int init_num){
    gen_input(init_kv, init_num);
    std::random_shuffle(init_kv, init_kv+init_num);
    std::vector<int> num_records;
    int base = 0;
    int num_iter = 100;
    for(int i=0; i<num_iter; i++){
	base += 1000;
	num_records.push_back(base);
    }

    std::vector<double> utils;
    for(auto& it: num_records){
	Hash<Key_t>* hashtable = getInstance<Key_t>(index_type);
	for(int i=0; i<it; i++){
	    hashtable->Insert(init_kv[i].key, init_kv[i].value);
	}
	double util = hashtable->Utilization();
	utils.push_back(util);
	delete hashtable;
    }

    for(int i=0; i<num_iter; i++)
	std::cout << utils[i] << std::endl;
	//std::cout << "num( " << num_records[i] << " ), util( " << utils[i] << " %)" << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebx
movq %rdx, %r15
movl %esi, (%rsp)
movq %rdx, %rdi
movl %ecx, %esi
callq 0x7542
movslq %ebx, %rsi
shlq $0x4, %rsi
addq %r15, %rsi
movq %r15, %rdi
callq 0x756e
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rbx
movaps %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq 0x4(%rsp), %r14
andl $0x0, (%r14)
pushq $0x64
popq %rbp
subl $0x1, %ebp
jb 0x6fc0
addl $0x3e8, 0x4(%rsp)       # imm = 0x3E8
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb19e
jmp 0x6fa6
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq 0x30(%rsp), %r14
movq 0x38(%rsp), %r12
cmpq %r12, %r14
je 0x7040
movl (%rsp), %edi
callq 0x7490
movq %rax, %r13
movq %r15, %rbx
xorl %ebp, %ebp
movslq (%r14), %rax
cmpq %rax, %rbp
jge 0x7010
movq 0x8(%rbx), %rdx
movq (%r13), %rax
movq %r13, %rdi
movq %rbx, %rsi
callq *(%rax)
incq %rbp
addq $0x10, %rbx
jmp 0x6fef
movq (%r13), %rax
movq %r13, %rdi
callq *0x20(%rax)
movsd %xmm0, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xb1bc
movq %r13, %rdi
pushq $0x8
popq %rsi
callq 0x21a0
addq $0x4, %r14
jmp 0x6fda
xorl %r14d, %r14d
movq 0xcf76(%rip), %rbx      # 0x13fc0
cmpq $0x64, %r14
je 0x7070
movq 0x10(%rsp), %rax
movsd (%rax,%r14,8), %xmm0
movq %rbx, %rdi
callq 0x2260
movq %rax, %rdi
callq 0x20a0
incq %r14
jmp 0x704a
leaq 0x10(%rsp), %rdi
callq 0xb492
leaq 0x30(%rsp), %rdi
callq 0xb4b0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x709e
movq %rax, %rbx
jmp 0x70ab
jmp 0x709e
jmp 0x709e
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xb492
leaq 0x30(%rsp), %rdi
callq 0xb4b0
movq %rbx, %rdi
callq 0x22c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns-server.cc
// Function: resolved_cb(dns_cb_data*)
void resolved_cb(struct dns_cb_data *cbdata) {
    // Return whatever we found
    struct dns_response *dresp = (struct dns_response*)cbdata->context;

    unsigned numans = 0;
    for (const auto &e: cbdata->replies)
        if (e.resptype == RESPONSE_ANSWER)
            numans++;

    switch (cbdata->error) {
    case DNS_OK:
        dresp->pkt.answers = cbdata->replies;
        dresp->pkt.header.flags = 0x8180;
        dresp->pkt.header.nanswers = numans;
        break;
    case DNS_DOES_NOT_EXIST:
        dresp->pkt.header.flags = 0x8180;
        break;
    case DNS_TIMEOUT:
    case DNS_ERROR:
    case DNS_NET_ERROR:
        dresp->pkt.header.flags = 0x8182;
        break;
    };

    // Blocking send, automatic rate limiting?
    uint8_t tmp[2048];
    unsigned towrite = serialize_udp_packet(&dresp->pkt, tmp);
    sendto(listenfd, tmp, towrite, 0, (struct sockaddr*)&dresp->addrstorage, dresp->addrlen);

    delete dresp;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x800, %rsp            # imm = 0x800
movq (%rdi), %rbx
movq 0x30(%rdi), %rax
leaq 0x30(%rdi), %rsi
movq 0x38(%rdi), %rcx
xorl %ebp, %ebp
cmpq %rcx, %rax
je 0x360b
cmpl $0x1, 0x4(%rax)
adcw $0x0, %bp
addq $0x50, %rax
jmp 0x35f8
movl 0x8(%rdi), %ecx
pushq $0x2
popq %rax
leal -0x2(%rcx), %edx
cmpl $0x3, %edx
jae 0x361f
movw $0x8182, %bp            # imm = 0x8182
jmp 0x3640
testl %ecx, %ecx
je 0x362e
movw $0x8180, %bp            # imm = 0x8180
cmpl $0x1, %ecx
je 0x3640
jmp 0x3644
leaq 0x28(%rbx), %rdi
callq 0x393c
movw $0x8180, 0x2(%rbx)      # imm = 0x8180
pushq $0x6
popq %rax
movw %bp, (%rbx,%rax)
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x908c
movl 0xcc10(%rip), %edi      # 0x10268
movl %eax, %edx
leaq 0x40(%rbx), %r8
movl 0xc0(%rbx), %r9d
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x3060
movq %rbx, %rdi
callq 0x3a46
movl $0xc8, %esi
movq %rbx, %rdi
callq 0x32b0
addq $0x800, %rsp            # imm = 0x800
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: parseAddr(char const*, sockaddr_storage*)
bool parseAddr(const char *ipaddr, struct sockaddr_storage *addrout) {
    unsigned ok = 0;
    union {
        struct sockaddr_storage addrst;
        struct sockaddr_in6 ipv6addr;
        struct sockaddr_in ipv4addr;
    } addrunion;
    if (strchr(ipaddr, '.') == NULL) {
        addrunion.ipv6addr.sin6_family = AF_INET6;
        addrunion.ipv6addr.sin6_port = htons(53);
        addrunion.ipv6addr.sin6_flowinfo = 0;
        addrunion.ipv6addr.sin6_scope_id = 0;
        ok |= inet_pton(AF_INET6, ipaddr, &addrunion.ipv6addr.sin6_addr);
    } else {
        addrunion.ipv4addr.sin_family = AF_INET;
        addrunion.ipv4addr.sin_port = htons(53);
        ok |= inet_pton(AF_INET, ipaddr, &addrunion.ipv4addr.sin_addr);
    }
    *addrout = addrunion.addrst;
    return (ok == 1);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x2e
popq %rsi
callq 0x3100
testq %rax, %rax
je 0x40ad
leaq 0xc(%rsp), %rdx
movl $0x35000002, -0x4(%rdx) # imm = 0x35000002
pushq $0x2
jmp 0x40c0
leaq 0x10(%rsp), %rdx
movq $0x3500000a, -0x8(%rdx) # imm = 0x3500000A
andl $0x0, 0x10(%rdx)
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x3430
pushq $0x10
popq %rcx
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
rep  movsq (%rsi), %es:(%rdi)
cmpl $0x1, %eax
sete %al
addq $0x88, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: createResolver(char const**, unsigned int)
DNSResolverIface * createResolver(const char **dns_servers, unsigned atimeout) {
#ifdef _WIN32
    { WSADATA data; WSAStartup(MAKEWORD(2,2), &data); }
#endif /* _WIN32 */

    std::list<struct sockaddr_storage> serverbundle;

    if (!dns_servers) {
        #ifdef TADNS_DONT_USE_OS_DNS_SERVERS
            return (NULL);
        #else
        serverbundle = getdnsip();
        if (!serverbundle.size())
            return (NULL);
        #endif
    }
    else {
        while (*dns_servers != NULL) {
            struct sockaddr_storage addr;
            if (parseAddr(*dns_servers++, &addr))
                serverbundle.push_back(addr);
        }
    }

    DNSResolver *dns = new DNSResolver(serverbundle, atimeout);

    return (dns);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4d8, %rsp            # imm = 0x4D8
movl %esi, %ebp
leaq 0x8(%rsp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
andq $0x0, 0x10(%rax)
testq %rdi, %rdi
je 0x414a
movq %rdi, %rbx
leaq 0xd0(%rsp), %r14
leaq 0x8(%rsp), %r15
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x4211
movq %r14, %rsi
callq 0x4080
testb %al, %al
je 0x4144
movq %r15, %rdi
movq %r14, %rsi
callq 0x5d7a
addq $0x8, %rbx
jmp 0x4121
leaq 0x38(%rsp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x6118(%rip), %rdi      # 0xa27a
leaq 0x6122(%rip), %rsi      # 0xa28b
callq 0x32f0
testq %rax, %rax
je 0x41ed
movq %rax, %r14
movl %ebp, 0x4(%rsp)
leaq 0xd0(%rsp), %r15
leaq 0x6104(%rip), %r12      # 0xa28d
leaq 0x2d0(%rsp), %r13
leaq 0x50(%rsp), %rbp
leaq 0x38(%rsp), %rbx
movq %r15, %rdi
movl $0x200, %esi            # imm = 0x200
movq %r14, %rdx
callq 0x33c0
testq %rax, %rax
je 0x41e1
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x3270
cmpl $0x1, %eax
jne 0x419b
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4080
testb %al, %al
je 0x419b
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5d7a
jmp 0x419b
movq %r14, %rdi
callq 0x3290
movl 0x4(%rsp), %ebp
leaq 0x8(%rsp), %rbx
leaq 0x38(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6e1e
movq %r14, %rdi
callq 0x644c
cmpq $0x0, 0x10(%rbx)
je 0x4265
movl $0xd8, %edi
callq 0x32a0
movq %rax, %r14
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5d86
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
movl %ebp, %edx
callq 0x5dc0
leaq 0x20(%rsp), %rdi
callq 0x644c
leaq 0x8(%rsp), %rdi
callq 0x644c
movq %r14, %rax
addq $0x4d8, %rsp            # imm = 0x4D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
jmp 0x4246
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x644c
jmp 0x427c
movq %rax, %rbx
movl $0xd8, %esi
movq %r14, %rdi
callq 0x32b0
jmp 0x429f
jmp 0x429c
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x644c
jmp 0x429f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x644c
movq %rbx, %rdi
callq 0x33f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::find_cached_query(dns_record_type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
cache_entry* DNSResolver::find_cached_query(enum dns_record_type qtype, std::string name) {
    time_t now = time(NULL);
    auto entry = std::make_pair(name, qtype);
    if (cached.find(entry) != cached.end()) {
        auto r = &(cached.at(entry));
        r->hits++;
        if (r->expire > now)
            return r;
    }
    return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %r14
xorl %edi, %edi
callq 0x3260
movq %rax, %rbx
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x3360
movl %ebp, 0x20(%r12)
movq %rsp, %rdi
movq %r12, %rsi
callq 0x5f4e
leaq 0xa0(%r14), %r15
movq %rsp, %rsi
movq %r15, %rdi
callq 0x6ec0
movq %rax, %r12
addq $0xa8, %r14
movq %rsp, %rdi
callq 0x3140
cmpq %r14, %r12
je 0x437a
movq %rsp, %rdi
leaq 0x28(%rsp), %rsi
callq 0x5f4e
movq %rsp, %rsi
movq %r15, %rdi
callq 0x5f6e
movq %rax, %r14
movq %rsp, %rdi
callq 0x3140
incl 0x20(%r14)
cmpq %rbx, 0x18(%r14)
jg 0x437d
xorl %r14d, %r14d
leaq 0x28(%rsp), %rdi
callq 0x3140
movq %r14, %rax
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x439b
jmp 0x43a8
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3140
jmp 0x43ab
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x33f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::cancel(void const*)
void DNSResolver::cancel(const void *context) {
    for (auto it: active) {
        if (it.second->ctx == context) {
            ongoing.erase(std::make_pair(it.second->name, it.second->qtype));
            delete it.second;
            active.erase(it.first);
            assert(active.size() == ongoing.size());
            return;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
leaq 0x48(%rdi), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x444a
movups 0x8(%rax), %xmm0
movaps %xmm0, (%rsp)
movq 0x8(%rsp), %r15
cmpq %rsi, 0x30(%r15)
jne 0x43d6
leaq 0x70(%rbx), %r12
leaq 0x10(%r15), %rsi
leaq 0xc(%r15), %rdx
leaq 0x18(%rsp), %r13
movq %r13, %rdi
callq 0x67e0
movq %r12, %rdi
movq %r13, %rsi
callq 0x6fa4
leaq 0x18(%rsp), %rdi
callq 0x3140
movq %r15, %rdi
callq 0x5fb4
pushq $0x78
popq %rsi
movq %r15, %rdi
callq 0x32b0
movq %rsp, %rsi
movq %r14, %rdi
callq 0x71a6
movq 0x50(%rbx), %rax
cmpq 0x98(%rbx), %rax
jne 0x4458
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x5c29(%rip), %rdi      # 0xa088
leaq 0x5c42(%rip), %rsi      # 0xa0a8
leaq 0x5c44(%rip), %rcx      # 0xa0b1
movl $0x124, %edx            # imm = 0x124
callq 0x31c0
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x33f0
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::call_user_rec(Query*, dns_error)
void DNSResolver::call_user_rec(Query *q, enum dns_error err) {
    // If this query has dependencies don't report it
    for (auto de: q->deps)
        call_user_rec(de, err);

    call_user(this, q->name, q->qtype, NULL, q->callback, q->ctx, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movq 0x58(%rsi), %r12
leaq 0x48(%rsi), %r13
cmpq %r13, %r12
je 0x491e
movq 0x20(%r12), %rsi
movq %r15, %rdi
movl %ebx, %edx
callq 0x48e0
movq %r12, %rdi
callq 0x32e0
movq %rax, %r12
jmp 0x48fd
leaq 0x10(%r14), %rsi
movq %rsp, %r15
movq %r15, %rdi
callq 0x3360
movzwl 0xc(%r14), %esi
movq 0x30(%r14), %r8
movq 0x38(%r14), %rcx
movq %r15, %rdi
xorl %edx, %edx
movl %ebx, %r9d
callq 0x4970
movq %rsp, %rdi
callq 0x3140
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x33f0
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: call_user(DNSResolver*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned short, cache_entry const*, void (*)(dns_cb_data*), void*, dns_error)
static void
call_user(DNSResolver *dns, std::string name, uint16_t qtype, 
          const struct cache_entry *entry, dns_callback_t cb, void *ctx, enum dns_error error)
{
    struct dns_cb_data cbd;
    cbd.context = ctx;
    cbd.query_type = (enum dns_record_type) qtype;
    cbd.error = error;
    cbd.name = name;

    if (entry)
        cbd.replies = entry->replies;

    if (cb)
        cb(&cbd);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %rax
leaq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
xorps %xmm0, %xmm0
andq $0x0, 0x20(%rcx)
movups %xmm0, 0x10(%rcx)
movq %r8, -0x20(%rcx)
movl %esi, -0x14(%rcx)
movl %r9d, -0x18(%rcx)
movq %rax, %rsi
callq 0x3180
testq %r14, %r14
je 0x49c7
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x393c
testq %rbx, %rbx
je 0x49d1
movq %rsp, %rdi
callq *%rbx
movq %rsp, %rdi
callq 0x630a
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x630a
movq %rbx, %rdi
callq 0x33f0
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::poll()
int DNSResolver::poll() {
    struct sockaddr_in sa;
    socklen_t len = sizeof(sa);
    int n, num_packets = 0;
    unsigned char pkt[DNS_PACKET_LEN];
    time_t now;

    now = time(NULL);

    /* Check our sockets for new stuff */
    while ((n = recvfrom(sock4, pkt, sizeof(pkt), 0,
        (struct sockaddr *) &sa, &len)) > 0 &&
        n > (int) sizeof(struct header)) {
        this->parse_udp(pkt, n);
        num_packets++;
    }
    while ((n = recvfrom(sock6, pkt, sizeof(pkt), 0,
        (struct sockaddr *) &sa, &len)) > 0 &&
        n > (int) sizeof(struct header)) {
        this->parse_udp(pkt, n);
        num_packets++;
    }

    /* Cleanup expired active queries */
    auto ita = active.begin();
    while (ita != active.end()) {
        if (ita->second->atimeout < now) {
            call_user_rec(ita->second, DNS_TIMEOUT);

            ongoing.erase(std::make_pair(ita->second->name, ita->second->qtype));
            delete ita->second;
            ita = active.erase(ita);
            assert(active.size() == ongoing.size());
        }
        else ita++;
    }

    return (num_packets);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x858, %rsp            # imm = 0x858
movq %rdi, %rbx
leaq 0x4(%rsp), %r12
movl $0x10, (%r12)
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x3260
movq %rax, %r15
leaq 0x50(%rsp), %r13
leaq 0x18(%rsp), %rbp
movl 0x8(%rbx), %edi
movl $0x800, %edx            # imm = 0x800
movq %r13, %rsi
xorl %ecx, %ecx
movq %rbp, %r8
movq %r12, %r9
callq 0x3210
cmpl $0xc, %eax
jle 0x4efd
movq %rbx, %rdi
movq %r13, %rsi
movl %eax, %edx
callq 0x44c0
incl %r14d
jmp 0x4ece
leaq 0x50(%rsp), %r12
leaq 0x18(%rsp), %r13
leaq 0x4(%rsp), %rbp
movl 0xc(%rbx), %edi
movl $0x800, %edx            # imm = 0x800
movq %r12, %rsi
xorl %ecx, %ecx
movq %r13, %r8
movq %rbp, %r9
callq 0x3210
cmpl $0xd, %eax
jl 0x4f3b
movq %rbx, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x44c0
incl %r14d
jmp 0x4f0c
leaq 0x38(%rbx), %rax
movq %rax, 0x8(%rsp)
movq 0x48(%rbx), %r12
leaq 0x70(%rbx), %rax
movq %rax, 0x10(%rsp)
leaq 0x28(%rsp), %rbp
testq %r12, %r12
je 0x4fe7
movq 0x10(%r12), %rsi
cmpq %r15, (%rsi)
jge 0x4fde
movq %rbx, %rdi
pushq $0x2
popq %rdx
callq 0x48e0
movq 0x10(%r12), %rdx
leaq 0x10(%rdx), %rsi
addq $0xc, %rdx
movq %rbp, %rdi
callq 0x67e0
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x6fa4
movq %rbp, %rdi
callq 0x3140
movq 0x10(%r12), %r13
testq %r13, %r13
je 0x4fb0
movq %r13, %rdi
callq 0x5fb4
movq %r13, %rdi
pushq $0x78
popq %rsi
callq 0x32b0
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x7998
movq %rax, %r12
movq 0x50(%rbx), %rax
cmpq 0x98(%rbx), %rax
je 0x4f56
jmp 0x4ffc
movq (%r12), %r12
jmp 0x4f56
movl %r14d, %eax
addq $0x858, %rsp            # imm = 0x858
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5085(%rip), %rdi      # 0xa088
leaq 0x509e(%rip), %rsi      # 0xa0a8
leaq 0x5107(%rip), %rcx      # 0xa118
movl $0x1ba, %edx            # imm = 0x1BA
callq 0x31c0
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x33f0
// File: /workspace/github_cpp_makefile_star2_O2/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, 0xc(%rsp)
movq %rsi, %r14
movq %rdi, 0x50(%rsp)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r15
andq $0x0, 0x10(%r15)
movaps %xmm0, (%r15)
leaq 0x50d3(%rip), %r12      # 0xa138
leaq 0x28(%rsp), %r13
pushq $-0x1
popq %rbp
cmpq $0x0, 0x8(%r14)
je 0x50e3
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3480
cmpq $-0x1, %rax
je 0x50d6
movq %rax, %rbx
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x32c0
movq %r15, %rdi
movq %r13, %rsi
callq 0x7ad6
movq %r13, %rdi
callq 0x3140
incq %rbx
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %rbp, %rcx
callq 0x32c0
movq %r14, %rdi
movq %r13, %rsi
callq 0x3320
movq %r13, %rdi
callq 0x3140
jmp 0x506d
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x60ea
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq 0x10(%rsp), %rcx
movq %rcx, 0x48(%rsp)
movq 0x18(%rsp), %rbx
movb $0x0, (%rax)
leaq 0x502e(%rip), %r14      # 0xa138
leaq 0x58(%rsp), %r15
leaq 0x78(%rsp), %r12
leaq 0x28(%rsp), %r13
movl 0xc(%rsp), %ebp
subl $0x1, %ebp
jb 0x517b
movq 0x18(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x517b
addq $-0x20, %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x6135
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x6116
movq %r13, %rdi
movq %r12, %rsi
callq 0x3320
movq %r12, %rdi
callq 0x3140
movq %r15, %rdi
callq 0x3140
movq 0x18(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0x18(%rsp)
callq 0x3140
jmp 0x511d
cmpq $0x0, 0x30(%rsp)
je 0x518d
leaq 0x28(%rsp), %rdi
callq 0x3310
leaq 0x28(%rsp), %rsi
movq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0x3360
subq 0x48(%rsp), %rbx
sarq $0x5, %rbx
movl 0xc(%rsp), %eax
cmpq %rax, %rbx
setb 0x20(%r14)
leaq 0x28(%rsp), %rdi
callq 0x3140
leaq 0x10(%rsp), %rdi
callq 0x616e
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5203
jmp 0x51f2
jmp 0x51f2
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x3140
jmp 0x51f5
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3140
jmp 0x5206
jmp 0x5203
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x616e
movq %rbx, %rdi
callq 0x33f0
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::createQuery(unsigned int, void*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, dns_record_type, void (*)(dns_cb_data*))
Query * DNSResolver::createQuery(unsigned niter, void *ctx, std::string name,
                    enum dns_record_type qtype, dns_callback_t callback) {

    std::transform(name.begin(), name.end(), name.begin(), ::tolower);

    time_t now = time(NULL);
    Query * query = new Query();
    query->ctx = ctx;
    query->qtype = (uint16_t) qtype;
    query->callback = callback;
    query->atimeout = now + this->atimeout;
    query->niter = niter + 1;
    query->name = name;

    return query;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x10(%rsp)
movl %r8d, 0x4(%rsp)
movq %rcx, %rbx
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, 0x8(%rsp)
movq (%rcx), %r14
movq 0x8(%rcx), %r15
xorl %r12d, %r12d
cmpq %r12, %r15
je 0x58fd
movsbl (%r14,%r12), %edi
callq 0x3390
movb %al, (%r14,%r12)
incq %r12
jmp 0x58e5
xorl %edi, %edi
callq 0x3260
movq %rax, %r14
pushq $0x78
popq %rdi
callq 0x32a0
movq %rax, %r15
movq %rax, %rdi
callq 0x62d2
movq %r13, 0x30(%r15)
movl 0x4(%rsp), %eax
movw %ax, 0xc(%r15)
movq 0x10(%rsp), %rax
movq %rax, 0x38(%r15)
movq 0x8(%rsp), %rax
movl 0xd0(%rax), %eax
addq %r14, %rax
movq %rax, (%r15)
incl %ebp
movl %ebp, 0x8(%r15)
leaq 0x10(%r15), %rdi
movq %rbx, %rsi
callq 0x3180
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::resolve(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, dns_record_type, void (*)(dns_cb_data*), void*, unsigned int)
void DNSResolver::resolve(std::string name, enum dns_record_type qtype,
                          dns_callback_t callback, void *ctx, unsigned options) {
    std::transform(name.begin(), name.end(), name.begin(), ::tolower);

    if (options & DNS_OPT_RECURSIVE_SOLVE) {
		struct cache_entry *dentry = find_cached_query(qtype, name);
		if (dentry) {
		    call_user(this, name, qtype, dentry, callback, ctx, DNS_OK);
		} else {
	        Query * oq = createQuery(0, ctx, name, qtype, callback);
    	    this->queue(0, name, oq, qtype, NULL);
		}
    } else {
        this->resolveInt(0, ctx, name, qtype, callback);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %r9d, %ebp
movq %r8, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
movl %edx, 0x4(%rsp)
movq %rsi, %r13
movq %rdi, %r15
movq (%rsi), %r14
movq 0x8(%rsi), %r12
xorl %ebx, %ebx
cmpq %rbx, %r12
je 0x59af
movsbl (%r14,%rbx), %edi
callq 0x3390
movb %al, (%r14,%rbx)
incq %rbx
jmp 0x5997
testb $0x1, %bpl
jne 0x59e6
leaq 0x18(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3360
movq %r15, %rdi
xorl %esi, %esi
movq 0x8(%rsp), %rdx
movq %rbp, %rcx
movl 0x4(%rsp), %r8d
movq 0x10(%rsp), %r9
callq 0x49f4
jmp 0x5aa9
leaq 0x98(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3360
movq %r15, %rdi
movl 0x4(%rsp), %ebx
movl %ebx, %esi
movq %rbp, %rdx
callq 0x42e6
movq %rax, %r14
leaq 0x98(%rsp), %rdi
callq 0x3140
testq %r14, %r14
je 0x5a4c
leaq 0x78(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3360
movzwl %bx, %esi
movq %rbp, %rdi
movq %r14, %rdx
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %r8
xorl %r9d, %r9d
callq 0x4970
jmp 0x5aa9
leaq 0x58(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3360
movq %r15, %rdi
xorl %esi, %esi
movq 0x8(%rsp), %rdx
movq %rbp, %rcx
movl %ebx, %r8d
movq 0x10(%rsp), %r9
callq 0x58b6
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x3140
leaq 0x38(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3360
movq %r15, %rdi
xorl %esi, %esi
movq %rbp, %rdx
movq %r14, %rcx
movl %ebx, %r8d
xorl %r9d, %r9d
callq 0x569a
movq %rbp, %rdi
callq 0x3140
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rbp
jmp 0x5ae6
jmp 0x5ad9
movq %rax, %rbx
leaq 0x78(%rsp), %rbp
jmp 0x5ae6
movq %rax, %rbx
jmp 0x5ae6
movq %rax, %rbx
leaq 0x18(%rsp), %rbp
movq %rbp, %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x33f0
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::getNewTid()
uint16_t DNSResolver::getNewTid() {
    while(1) {
        uint16_t n = ++tidseq;
        if (active.count(n) == 0)
            return n;
        std::cout << "Dup!" << std::endl;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
leaq 0xe(%rsp), %r15
movq 0xa4ba(%rip), %r12      # 0xffd0
leaq 0x4695(%rip), %r13      # 0xa1b2
movl 0x10(%rbx), %eax
incl %eax
movw %ax, 0x10(%rbx)
movw %ax, 0xe(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x6e0a
testq %rax, %rax
je 0x5b50
movq %r12, %rdi
movq %r13, %rsi
callq 0x3280
movq %rax, %rdi
callq 0x3160
jmp 0x5b1d
movzwl 0xe(%rsp), %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::DNSResolver(std::__cxx11::list<sockaddr_storage, std::allocator<sockaddr_storage>>, unsigned int)
DNSResolver(std::list<struct sockaddr_storage> serverbundle, unsigned atimeout)
      : pkts_dns_servers(0), pkts_auth_servers(0), dns_servers(serverbundle), atimeout(atimeout) {
        this->sock4 = socket(PF_INET,  SOCK_DGRAM, 17);
        this->sock6 = socket(PF_INET6, SOCK_DGRAM, 17);
        /* Make it non blocking */
        nonblock(sock4);
        nonblock(sock6);
        /* Increase socket's receive buffer */
        int rcvbufsiz = 128 * 1024;
        (void) setsockopt(sock4, SOL_SOCKET, SO_RCVBUF,
            (char *) &rcvbufsiz, sizeof(rcvbufsiz));
        (void) setsockopt(sock6, SOL_SOCKET, SO_RCVBUF,
            (char *) &rcvbufsiz, sizeof(rcvbufsiz));
        tidseq = 0;
        active.rehash(MAX_CACHE_ENTRIES*2);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rdi, %r14
leaq 0x9f76(%rip), %rax      # 0xfd50
movq %rax, (%rdi)
andq $0x0, 0x14(%rdi)
addq $0x20, %rdi
movq %rdi, 0x8(%rsp)
callq 0x5d86
leaq 0x68(%r14), %rax
movq %rax, 0x38(%r14)
movq $0x1, 0x40(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%r14)
movl $0x3f800000, 0x58(%r14) # imm = 0x3F800000
movups %xmm0, 0x60(%r14)
leaq 0x78(%r14), %rax
andl $0x0, 0x78(%r14)
andq $0x0, 0x80(%r14)
movq %rax, 0x88(%r14)
movq %rax, 0x90(%r14)
andq $0x0, 0x98(%r14)
andl $0x0, 0xa8(%r14)
andq $0x0, 0xb0(%r14)
leaq 0x38(%r14), %r15
leaq 0xa8(%r14), %rax
movq %rax, 0xb8(%r14)
movq %rax, 0xc0(%r14)
andq $0x0, 0xc8(%r14)
movl %ebp, 0xd0(%r14)
pushq $0x2
popq %rbp
pushq $0x11
popq %r12
movl %ebp, %edi
movl %ebp, %esi
movl %r12d, %edx
callq 0x30c0
movl %eax, 0x8(%r14)
pushq $0xa
popq %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x30c0
movl %eax, 0xc(%r14)
movl 0x8(%r14), %edi
callq 0x91b8
movl 0xc(%r14), %edi
callq 0x91b8
leaq 0x14(%rsp), %r12
movl $0x20000, (%r12)        # imm = 0x20000
movl 0x8(%r14), %edi
pushq $0x1
popq %rbp
pushq $0x8
popq %r13
pushq $0x4
popq %rbx
movl %ebp, %esi
movl %r13d, %edx
movq %r12, %rcx
movl %ebx, %r8d
callq 0x3400
movl 0xc(%r14), %edi
movl %ebp, %esi
movl %r13d, %edx
movq %r12, %rcx
movl %ebx, %r8d
callq 0x3400
andw $0x0, 0x10(%r14)
movl $0x20000, %esi          # imm = 0x20000
movq %r15, %rdi
callq 0x6476
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5f11
movq %rax, %r12
leaq 0xa0(%r14), %rdi
addq $0x70, %r14
callq 0x6680
movq %r14, %rdi
callq 0x66fa
movq %r15, %rdi
callq 0x675e
movq 0x8(%rsp), %rdi
callq 0x644c
movq %r12, %rdi
callq 0x33f0
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: Query::~Query()
~Query() {
        // Remove the entry from the parent deps list
        assert(!deps_on || deps_on->deps.count(this));
        if (deps_on)
            deps_on->deps.erase(this);

        for (auto e: deps)
            delete e;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x70(%rdi), %rdi
testq %rdi, %rdi
je 0x5ffd
addq $0x40, %rdi
leaq 0x8(%rsp), %rsi
movq %rbx, (%rsi)
callq 0x6800
testq %rax, %rax
je 0x605a
movq 0x70(%rbx), %rdi
testq %rdi, %rdi
je 0x5ffd
addq $0x40, %rdi
leaq 0x8(%rsp), %rsi
movq %rbx, (%rsi)
callq 0x6870
movq 0x58(%rbx), %r15
leaq 0x48(%rbx), %r13
pushq $0x78
popq %r14
cmpq %r13, %r15
je 0x6037
movq 0x20(%r15), %r12
testq %r12, %r12
je 0x601f
movq %r12, %rdi
callq 0x5fb4
movq %r12, %rdi
movq %r14, %rsi
callq 0x32b0
movq %r15, %rdi
callq 0x32e0
movq %rax, %r15
jmp 0x6009
leaq 0x40(%rbx), %rdi
callq 0x6a5c
addq $0x10, %rbx
movq %rbx, %rdi
callq 0x3140
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x423f(%rip), %rdi      # 0xa2a0
leaq 0x4040(%rip), %rsi      # 0xa0a8
leaq 0x4257(%rip), %rcx      # 0xa2c6
pushq $0x3d
popq %rdx
callq 0x31c0
movq %rax, %rdi
callq 0x3aa3
nop
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns.cc
// Function: DNSResolver::~DNSResolver()
~DNSResolver() {
        if (sock4 != -1)
            (void) closesocket(sock4);
        if (sock6 != -1)
            (void) closesocket(sock6);

        for (auto it: active)
            delete it.second;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x99b4(%rip), %rax      # 0xfd50
movq %rax, (%rdi)
movl 0x8(%rdi), %edi
cmpl $-0x1, %edi
je 0x63ac
callq 0x3470
movl 0xc(%rbx), %edi
cmpl $-0x1, %edi
je 0x63b9
callq 0x3470
leaq 0x48(%rbx), %r12
pushq $0x78
popq %r14
movq (%r12), %r12
testq %r12, %r12
je 0x63e9
movq 0x10(%r12), %r15
testq %r15, %r15
je 0x63dc
movq %r15, %rdi
callq 0x5fb4
movq %r15, %rdi
movq %r14, %rsi
callq 0x32b0
jmp 0x63c1
leaq 0x38(%rbx), %r14
leaq 0xa0(%rbx), %rdi
callq 0x6680
leaq 0x70(%rbx), %rdi
callq 0x66fa
movq %r14, %rdi
callq 0x675e
addq $0x20, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x644c
movq %rax, %rdi
callq 0x3aa3
nop
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns_common.cc
// Function: fetch(unsigned char const*, unsigned char const*, int, char*, int)
unsigned fetch(const uint8_t *pkt, const uint8_t *s, int pktsiz, char *dst, int dstlen) {
    const uint8_t *e = pkt + pktsiz;
    unsigned skip = 0;
    bool labelj = false;
    int j, i = 0, n = 0;

    while (*s != 0 && s < e) {
        if (n > 0)
            dst[i++] = '.';

        if (i >= dstlen)
            break;

        if (((n = *s++) & 0xc0) == 0xc0) {
            s = pkt + (((n&3) << 8) | *s);    /* New offset */
            n = 0;
            if (!labelj)
                skip += 2;
            labelj = true;
        } else {
            if (!labelj)
                skip += std::min(n, dstlen - i) + 1;
            for (j = 0; j < n && i < dstlen; j++)
                dst[i++] = *s++;
        }
    }

    dst[i] = '\0';
    return skip + (labelj ? 0 : 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq %edx, %r10
addq %rdi, %r10
movslq %r8d, %r11
xorl %eax, %eax
xorl %edx, %edx
xorl %r9d, %r9d
xorl %ebx, %ebx
cmpb $0x0, (%rsi)
je 0x8a1e
cmpq %r10, %rsi
jae 0x8a1e
testl %ebx, %ebx
je 0x89a8
movslq %r9d, %rbx
incl %r9d
movb $0x2e, (%rcx,%rbx)
movl %r8d, %r14d
subl %r9d, %r14d
jle 0x8a1e
movzbl (%rsi), %ebx
incq %rsi
movl %ebx, %ebp
notl %ebp
testb $-0x40, %bpl
je 0x89fe
testb $0x1, %dl
jne 0x89d1
cmpl %ebx, %r14d
cmovgel %ebx, %r14d
addl %r14d, %eax
incl %eax
movslq %r9d, %r15
leaq (%rcx,%r15), %r12
xorl %r14d, %r14d
cmpl %ebx, %r14d
jae 0x89f6
leaq (%r15,%r14), %r13
cmpq %r11, %r13
jge 0x89f6
movb (%rsi,%r14), %bpl
movb %bpl, (%r12,%r14)
incq %r14
jmp 0x89db
addl %r14d, %r9d
addq %r14, %rsi
jmp 0x8988
andl $0x3, %ebx
shll $0x8, %ebx
movzbl (%rsi), %esi
orl %ebx, %esi
addq %rdi, %rsi
leal 0x2(%rax), %ebx
testb $0x1, %dl
cmovnel %eax, %ebx
movb $0x1, %dl
movl %ebx, %eax
jmp 0x8986
movslq %r9d, %rsi
movb $0x0, (%rcx,%rsi)
xorb $0x1, %dl
movzbl %dl, %ecx
addl %ecx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns_common.cc
// Function: serializeName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned char*)
unsigned serializeName(std::string dom, uint8_t *out) {
    uint8_t * oout = out;
    unsigned off = 0;
    while (off < dom.size()) {
        auto s = dom.find('.', off);
        unsigned l = (s != std::string::npos) ? s - off : dom.size() - off;
        unsigned a = (s != std::string::npos) ? l + 1 : l;

        *out++ = l;
        memcpy(out, &dom[off], l);
        out += l;
        off += a;
    }
    *out++ = 0;

    return out - oout;  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
xorl %ebx, %ebx
movq %rsi, (%rsp)
movl %ebx, %r12d
cmpq %r12, 0x8(%r15)
jbe 0x8f78
movq %r15, %rdi
pushq $0x2e
popq %rsi
movq %r12, %rdx
callq 0x3340
movq %rax, %rbp
cmpq $-0x1, %rax
jne 0x8f4a
movq 0x8(%r15), %rbp
xorl %ebx, %ebx
cmpq $-0x1, %rax
setne %bl
movl %ebp, %r13d
subl %r12d, %r13d
leaq 0x1(%r14), %rdi
movb %r13b, (%r14)
addq (%r15), %r12
movq %r12, %rsi
movq %r13, %rdx
callq 0x3230
addq %r13, %r14
incq %r14
addl %ebp, %ebx
jmp 0x8f26
movb $0x0, (%r14)
subl (%rsp), %r14d
incl %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns_common.cc
// Function: serialize_answer(dns_record const*, unsigned char*)
unsigned serialize_answer(const struct dns_record *rec, uint8_t *out) {
    uint8_t * oout = out;

    bool namec = (rec->rtype == DNS_MX_RECORD || 
                  rec->rtype == DNS_NS_RECORD ||
                  rec->rtype == DNS_CNAME_RECORD);

    // Getting the size is a bit convoluted depending on type and the domain itself
    unsigned dlen = namec ? (rec->addr.size() ? rec->addr.size() + 2 : 1) : rec->addr.size();

    // Name goes first
    out += serializeName(rec->name, out);

    ((uint16_t*)out)[0] = htons(rec->rtype);
    ((uint16_t*)out)[1] = htons(0x0001);  // Assuming Internet yo!
    ((uint32_t*)out)[1] = htonl(rec->ttl);
    ((uint16_t*)out)[4] = htons(dlen);
    out += 10;

    if (namec) {
        out += serializeName(rec->addr, out);
    } else {
        memcpy(out, rec->addr.data(), rec->addr.size());
        out += rec->addr.size();
    }

    return out - oout;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %eax
cmpl $0xf, %eax
ja 0x8fd2
movl $0x8024, %ecx           # imm = 0x8024
btl %eax, %ecx
jae 0x8fd2
movq 0x30(%r14), %rax
leaq 0x2(%rax), %rcx
testq %rax, %rax
pushq $0x1
popq %r12
cmovneq %rcx, %r12
movb $0x1, %bpl
jmp 0x8fd8
movq 0x30(%r14), %r12
xorl %ebp, %ebp
leaq 0x8(%r14), %rsi
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x3360
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8f0f
movl %eax, %r13d
movq %r15, %rdi
callq 0x3140
movzwl (%r14), %eax
rolw $0x8, %ax
leaq (%rbx,%r13), %r15
addq $0xa, %r15
movw %ax, -0xa(%r15)
movw $0x100, -0x8(%r15)      # imm = 0x100
movl 0x48(%r14), %eax
bswapl %eax
movl %eax, -0x6(%r15)
rolw $0x8, %r12w
movw %r12w, -0x2(%r15)
testb %bpl, %bpl
je 0x9060
addq $0x28, %r14
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x3360
movq %r12, %rdi
movq %r15, %rsi
callq 0x8f0f
movl %eax, %r14d
movq %r12, %rdi
callq 0x3140
jmp 0x9074
movq 0x28(%r14), %rsi
movq 0x30(%r14), %rdx
movq %r15, %rdi
callq 0x3230
movq 0x30(%r14), %r14
addl %r14d, %r15d
subl %ebx, %r15d
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns_common.cc
// Function: serialize_udp_packet(dns_packet*, unsigned char*)
unsigned serialize_udp_packet(struct dns_packet *in, uint8_t *out) {
    uint8_t *oout = out;
    const uint8_t *e = out + DNS_PACKET_LEN;
    struct header *h = (struct header*)out;

    h->tid      = htons(in->header.tid);
    h->flags    = htons(in->header.flags);
    h->nqueries = htons(in->header.nqueries);
    h->nanswers = htons(in->header.nanswers);
    h->nauth    = htons(in->header.nauth);
    h->nother   = htons(in->header.nother);

    out = &h->data[0];

    for (const auto &q: in->questions) {
        unsigned s = serializeName(q.name, out);
        out += s;

        if (out + 4 >= e) return 0;

        ((uint16_t*)out)[0] = htons(q.qtype);
        ((uint16_t*)out)[1] = htons(q.qclass);
        out += 4;
    }

    for (unsigned i = 0; i < RESPONSE_LAST; i++) {
        for (const auto &r: in->answers) {
            if (r.resptype == i) {
                out += serialize_answer(&r, out);
            }
        }
    }

    return out - oout;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movzwl (%rdi), %eax
rolw $0x8, %ax
movw %ax, (%rsi)
movzwl 0x2(%rdi), %eax
rolw $0x8, %ax
movw %ax, 0x2(%rsi)
movzwl 0x4(%rdi), %eax
rolw $0x8, %ax
movw %ax, 0x4(%rsi)
movzwl 0x6(%rdi), %eax
rolw $0x8, %ax
movw %ax, 0x6(%rsi)
movzwl 0x8(%rdi), %eax
rolw $0x8, %ax
movw %ax, 0x8(%rsi)
movzwl 0xa(%rdi), %eax
rolw $0x8, %ax
movw %ax, 0xa(%rsi)
movq 0x10(%rdi), %r12
movq %rdi, 0x8(%rsp)
movq 0x18(%rdi), %rax
movq %rax, 0x10(%rsp)
pushq $0xc
popq %r14
leaq 0x18(%rsp), %r13
leaq (%rbx,%r14), %r15
cmpq 0x10(%rsp), %r12
je 0x9164
addq $0x8, %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x3360
movq %r13, %rdi
movq %r15, %rsi
callq 0x8f0f
movl %eax, %ebp
movq %r13, %rdi
callq 0x3140
movl %ebp, %eax
addq %rax, %r14
cmpq $0x7fb, %r14            # imm = 0x7FB
jg 0x91a3
movzwl -0x8(%r12), %eax
rolw $0x8, %ax
movw %ax, (%rbx,%r14)
movzwl -0x6(%r12), %eax
rolw $0x8, %ax
movw %ax, 0x2(%rbx,%r14)
addq $0x4, %r14
addq $0x20, %r12
jmp 0x90fe
xorl %ebp, %ebp
movq 0x8(%rsp), %r13
cmpl $0x3, %ebp
je 0x919e
movq 0x28(%r13), %r12
movq 0x30(%r13), %r14
cmpq %r14, %r12
je 0x919a
cmpl %ebp, 0x4(%r12)
jne 0x9194
movq %r12, %rdi
movq %r15, %rsi
callq 0x8f95
movl %eax, %eax
addq %rax, %r15
addq $0x50, %r12
jmp 0x9178
incl %ebp
jmp 0x916b
subl %ebx, %r15d
jmp 0x91a6
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/davidgfnet[P]tadns/tadns_common.cc
// Function: nonblock(int)
int nonblock(int fd) {
#ifdef _WIN32
    unsigned long on = 1;
    return (ioctlsocket(fd, FIONBIO, &on));
#else
    int flags;
    flags = fcntl(fd, F_GETFL, 0);
    return (fcntl(fd, F_SETFL, flags | O_NONBLOCK));
#endif /* _WIN32 */
}

// Assembly:
pushq %rbx
movl %edi, %ebx
pushq $0x3
popq %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x31a0
orl $0x800, %eax            # imm = 0x800
pushq $0x4
popq %rsi
movl %ebx, %edi
movl %eax, %edx
xorl %eax, %eax
popq %rbx
jmp 0x31a0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/apps/img2img/img2img.cpp
// Function: main
int main(int argc, char **argv)
{
  // Check arguments
  if (argc != 3) {
    RNFail("Usage: img2img inputfile outputfile\n");
    return 1;
  }

  // Read and write image file 
  R2Image image;
  if (!image.Read(argv[1])) return -1;
  if (!image.Write(argv[2])) return -1;
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
cmpl $0x3, %edi
jne 0x351b
movq %rsi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x3558
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x3574
testl %eax, %eax
je 0x352e
movq 0x10(%rbx), %rsi
movq %rsp, %rdi
callq 0x549a
xorl %ebx, %ebx
cmpl $0x1, %eax
sbbl %ebx, %ebx
jmp 0x3531
leaq 0x2eae2(%rip), %rdi     # 0x32004
xorl %eax, %eax
callq 0x679a
pushq $0x1
popq %rbx
jmp 0x3539
pushq $-0x1
popq %rbx
movq %rsp, %rdi
callq 0x3aa4
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3aa4
movq %rbx, %rdi
callq 0x3340
nop
// File: /workspace/github_cpp_makefile_star2_O2/jansucan[P]diff-dd/src/buffered_stream.cpp
// Function: BufferedStream::Reader::Reader(std::istream&, unsigned long, unsigned long)
Reader::Reader(std::istream &istream, size_t buffer_capacity,
               size_t buffer_count)
    : m_buffer_count(buffer_count), m_buffer_capacity(buffer_capacity),
      m_istream(istream), m_buffers(buffer_count),
      m_buffer_index(buffer_count - 1), m_buffer_offset(buffer_capacity),
      m_buffer_size(buffer_capacity)
{
    for (size_t i = 0; i < m_buffer_count; ++i) {
        try {
            m_buffers[i] = std::shared_ptr<char[]>(new char[m_buffer_capacity]);
        } catch (const std::bad_alloc &e) {
            throw Error("cannot allocate buffer for input stream data");
        }
    }

    refill_next_buffer();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movq %rdx, %r15
movq %rdi, %r14
leaq 0x947e(%rip), %rax      # 0xcb08
movq %rax, (%rdi)
movq %rcx, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rsi, 0x18(%rdi)
leaq 0x20(%rdi), %rbx
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rcx, %rsi
callq 0x3dbc
decq %r12
movq %r12, 0x38(%r14)
movq %r15, 0x40(%r14)
movq %r15, 0x48(%r14)
leaq 0x10(%rsp), %r15
xorl %r13d, %r13d
leaq 0x8(%rsp), %r12
xorl %ebp, %ebp
cmpq 0x8(%r14), %rbp
jae 0x3704
movq 0x10(%r14), %rdi
callq 0x3030
movq %r12, %rdi
movq %rax, %rsi
callq 0x417c
movq (%rbx), %rdi
addq %r13, %rdi
movq %r12, %rsi
callq 0x42fe
movq %r15, %rdi
callq 0x3ed0
incq %rbp
addq $0x10, %r13
jmp 0x36cb
movq %r14, %rdi
callq 0x37c0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
jmp 0x37a8
movq %rax, %r15
jmp 0x37b0
movq %rax, %r15
cmpl $0x1, %edx
jne 0x37a8
movq %r15, %rdi
callq 0x30e0
pushq $0x10
popq %rdi
callq 0x3130
movq %rax, %r14
leaq 0x48b7(%rip), %rsi      # 0x8004
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x3e0e
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x3e4a
xorl %ebp, %ebp
leaq 0x93bb(%rip), %rsi      # 0xcb30
movq 0x9834(%rip), %rdx      # 0xcfb0
movq %r14, %rdi
callq 0x3330
movq %rax, %r15
leaq 0x8(%rsp), %rdi
callq 0x3398
testb %bpl, %bpl
jne 0x379b
jmp 0x37a3
movq %rax, %r15
movq %r14, %rdi
callq 0x3180
callq 0x3320
movq %rbx, %rdi
callq 0x3e6a
movq %r15, %rdi
callq 0x3340
movq %rax, %rdi
callq 0x3e5f
// File: /workspace/github_cpp_makefile_star2_O2/jansucan[P]diff-dd/src/buffered_stream.cpp
// Function: BufferedStream::Reader::refill_next_buffer()
void
Reader::refill_next_buffer()
{
    if (m_buffer_size == 0) {
        // Current buffer is the last one. Don't fill the next one.
        return;
    }

    // Current buffer must be completely read before filling the next one
    assert(m_buffer_offset == m_buffer_size);

    m_buffer_index = (m_buffer_index + 1) % m_buffer_count;
    auto buf = m_buffers[m_buffer_index];
    // Buffer for new data must not in use
    assert(buf.use_count() == 2);

    m_buffer_size = read_stream(buf, m_buffer_capacity);
    m_buffer_offset = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x385c
movq %rdi, %rbx
cmpq %rax, 0x40(%rdi)
jne 0x3885
movq 0x38(%rbx), %rax
incq %rax
xorl %edx, %edx
divq 0x8(%rbx)
movq %rdx, 0x38(%rbx)
shlq $0x4, %rdx
addq 0x20(%rbx), %rdx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rdx, %rsi
callq 0x3f8e
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x3866
movl 0x8(%rax), %eax
cmpl $0x2, %eax
jne 0x3866
leaq 0x18(%rsp), %r14
movq %rsp, %r15
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x3f8e
movq 0x10(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3a90
movq %rax, 0x48(%rbx)
leaq 0x8(%rsp), %rdi
callq 0x3ed0
andq $0x0, 0x40(%rbx)
movq %r14, %rdi
callq 0x3ed0
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x48b6(%rip), %rdi      # 0x8123
leaq 0x47d1(%rip), %rsi      # 0x8045
leaq 0x4876(%rip), %rcx      # 0x80f1
movl $0x84, %edx
callq 0x3160
leaq 0x4844(%rip), %rdi      # 0x80d0
leaq 0x47b2(%rip), %rsi      # 0x8045
leaq 0x4857(%rip), %rcx      # 0x80f1
pushq $0x7f
popq %rdx
callq 0x3160
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3ed0
movq %r14, %rdi
callq 0x3ed0
movq %rbx, %rdi
callq 0x3340
nop
// File: /workspace/github_cpp_makefile_star2_O2/jansucan[P]diff-dd/src/buffered_stream.cpp
// Function: BufferedStream::Reader::read(unsigned long, char*)
size_t
Reader::read(size_t data_size, char *dest_buf)
{
    size_t retry_count{0};
    size_t offset{0};
    size_t to_read{data_size};

    while ((to_read > 0) && (retry_count < 2)) {
        const DataPart dp{readMultipart(to_read)};
        if (dp.size == 0) {
            ++retry_count;
            continue;
        }

        retry_count = 0;
        memcpy(dest_buf + offset, dp.data.get(), dp.size);
        offset += dp.size;
        to_read -= dp.size;
    }

    assert(offset <= data_size);
    return offset;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
xorl %ebp, %ebp
xorl %r12d, %r12d
movq %rsi, 0x8(%rsp)
testq %rbx, %rbx
je 0x3930
cmpq $0x1, %rbp
ja 0x3930
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x3966
movq 0x10(%rsp), %r13
testq %r13, %r13
je 0x3921
leaq (%r14,%r12), %rdi
movq 0x18(%rsp), %rsi
movq %r13, %rdx
callq 0x31b0
addq %r13, %r12
subq %r13, %rbx
xorl %ebp, %ebp
jmp 0x3924
incq %rbp
leaq 0x20(%rsp), %rdi
callq 0x3ed0
jmp 0x38e1
cmpq 0x8(%rsp), %r12
ja 0x3949
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x46e1(%rip), %rdi      # 0x8031
leaq 0x46ee(%rip), %rsi      # 0x8045
leaq 0x46fb(%rip), %rcx      # 0x8059
pushq $0x4d
popq %rdx
callq 0x3160
// File: /workspace/github_cpp_makefile_star2_O2/jansucan[P]diff-dd/src/buffered_stream.cpp
// Function: BufferedStream::Reader::readMultipart(unsigned long)
DataPart
Reader::readMultipart(size_t data_size)
{
    const size_t size_left{m_buffer_size - m_buffer_offset};
    if (size_left == 0) {
        refill_next_buffer();
        if (m_buffer_size == 0) {
            return DataPart{.size = 0, .data = std::shared_ptr<char[]>()};
        }
    }
    // There is at least one byte in the buffer
    const DataPart dp{read_current_buffer(data_size)};
    assert(dp.size > 0);
    return dp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x48(%rsi), %rax
cmpq 0x40(%rsi), %rax
jne 0x398d
movq %r15, %rdi
callq 0x37c0
cmpq $0x0, 0x48(%r15)
je 0x39aa
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x39d4
cmpq $0x0, (%rbx)
je 0x39b7
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
jmp 0x39a1
leaq 0x46cf(%rip), %rdi      # 0x808d
leaq 0x4680(%rip), %rsi      # 0x8045
leaq 0x46cd(%rip), %rcx      # 0x8099
pushq $0x5d
popq %rdx
callq 0x3160