// File: /workspace/github_cpp_makefile_star2_O3/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), %r15
movl $0x10, (%r15)
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x3260
movq %rax, 0x10(%rsp)
movl 0x8(%rbx), %edi
leaq 0x50(%rsp), %rsi
leaq 0x40(%rsp), %r8
movl $0x800, %edx            # imm = 0x800
xorl %ecx, %ecx
movq %r15, %r9
callq 0x3210
cmpl $0xd, %eax
jl 0x58b3
xorl %r14d, %r14d
leaq 0x50(%rsp), %r15
leaq 0x40(%rsp), %r12
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x4968
incl %r14d
movl 0x8(%rbx), %edi
movl $0x800, %edx            # imm = 0x800
movq %r15, %rsi
xorl %ecx, %ecx
movq %r12, %r8
movq %r13, %r9
callq 0x3210
cmpl $0xc, %eax
jg 0x5886
movl 0xc(%rbx), %edi
leaq 0x50(%rsp), %rsi
leaq 0x40(%rsp), %r8
leaq 0x4(%rsp), %r9
movl $0x800, %edx            # imm = 0x800
xorl %ecx, %ecx
callq 0x3210
cmpl $0xd, %eax
jl 0x5912
leaq 0x50(%rsp), %r15
leaq 0x40(%rsp), %r12
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
movq %r15, %rsi
movl %eax, %edx
callq 0x4968
incl %r14d
movl 0xc(%rbx), %edi
movl $0x800, %edx            # imm = 0x800
movq %r15, %rsi
xorl %ecx, %ecx
movq %r12, %r8
movq %r13, %r9
callq 0x3210
cmpl $0xc, %eax
jg 0x58e5
movq 0x48(%rbx), %r12
testq %r12, %r12
je 0x59fa
leaq 0x38(%rbx), %rax
movq %rax, 0x8(%rsp)
leaq 0x70(%rbx), %rbp
leaq 0x18(%rsp), %r15
movq 0x10(%r12), %rsi
movq 0x10(%rsp), %rax
cmpq %rax, (%rsi)
jge 0x59ed
movq %rbx, %rdi
movl $0x2, %edx
callq 0x4f5c
movq 0x10(%r12), %r13
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x3c72
movzwl 0xc(%r13), %eax
movw %ax, 0x38(%rsp)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x7c74
movq %rbp, %rdi
movq %rax, %rsi
callq 0x7d48
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x59af
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x10(%r12), %r13
testq %r13, %r13
je 0x59c1
movq %r13, %rdi
callq 0x6fcc
movl $0x78, %esi
movq %r13, %rdi
callq 0x32b0
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x8536
movq %rax, %r12
movq 0x50(%rbx), %rax
cmpq 0x98(%rbx), %rax
je 0x59f1
jmp 0x5a0f
movq (%r12), %r12
testq %r12, %r12
jne 0x5931
movl %r14d, %eax
addq $0x858, %rsp            # imm = 0x858
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x56a2(%rip), %rdi      # 0xb0b8
leaq 0x56bb(%rip), %rsi      # 0xb0d8
leaq 0x5724(%rip), %rcx      # 0xb148
movl $0x1ba, %edx            # imm = 0x1BA
callq 0x31b0
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x5a4d
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x3400