// File: /workspace/github_cpp_makefile_star2_O3/tenup-coin[P]seeder/main.cpp
// Function: CDnsThread::cacheHit(unsigned long, bool)
void cacheHit(uint64_t requestedFlags, bool force = false) {
    static bool nets[NET_MAX] = {};
    if (!nets[NET_IPV4]) {
        nets[NET_IPV4] = true;
        nets[NET_IPV6] = true;
    }
    time_t now = time(NULL);
    FlagSpecificData& thisflag = perflag[requestedFlags];
    thisflag.cacheHits++;
    if (force || thisflag.cacheHits * 400 > (thisflag.cache.size()*thisflag.cache.size()) || (thisflag.cacheHits*thisflag.cacheHits * 20 > thisflag.cache.size() && (now - thisflag.cacheTime > 5))) {
      set<CNetAddr> ips;
      db.GetIPs(ips, requestedFlags, 1000, nets);
      dbQueries++;
      thisflag.cache.clear();
      thisflag.nIPv4 = 0;
      thisflag.nIPv6 = 0;
      thisflag.cache.reserve(ips.size());
      for (set<CNetAddr>::iterator it = ips.begin(); it != ips.end(); it++) {
        struct in_addr addr;
        struct in6_addr addr6;
        if ((*it).GetInAddr(&addr)) {
          addr_t a;
          a.v = 4;
          memcpy(&a.data.v4, &addr, 4);
          thisflag.cache.push_back(a);
          thisflag.nIPv4++;
        } else if ((*it).GetIn6Addr(&addr6)) {
          addr_t a;
          a.v = 6;
          memcpy(&a.data.v6, &addr6, 16);
          thisflag.cache.push_back(a);
          thisflag.nIPv6++;
        }
      }
      thisflag.cacheHits = 0;
      thisflag.cacheTime = now;
    }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %ebp
movq %rdi, %r15
movq %rsi, 0x18(%rsp)
cmpb $0x0, 0xdea4(%rip)      # 0x1c6b1
jne 0xe818
movw $0x101, 0xde99(%rip)    # imm = 0x101
xorl %edi, %edi
callq 0x33c0
movq %rax, %rbx
leaq 0x40(%r15), %rdi
leaq 0x18(%rsp), %rsi
callq 0xea16
movq %rax, %r14
movl 0x28(%rax), %eax
incl %eax
movl %eax, 0x28(%r14)
testb %bpl, %bpl
jne 0xe871
imull $0x190, %eax, %edx      # imm = 0x190
movq 0x10(%r14), %rsi
subq 0x8(%r14), %rsi
sarq $0x2, %rsi
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rsi, %rcx
movq %rcx, %rsi
imulq %rcx, %rsi
cmpq %rdx, %rsi
jae 0xe9d9
movq %rbx, 0x20(%rsp)
leaq 0x30(%rsp), %rbx
movl $0x0, (%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq %rbx, 0x10(%rbx)
movq %rbx, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movq 0x18(%rsp), %rdx
leaq 0xdbe9(%rip), %rdi      # 0x1c488
leaq 0xde0a(%rip), %r8       # 0x1c6b0
leaq 0x28(%rsp), %rsi
movl $0x3e8, %ecx            # imm = 0x3E8
callq 0xf60c
lock
incq 0x70(%r15)
movq %r14, %r15
addq $0x8, %r15
movq 0x8(%r14), %rax
cmpq %rax, 0x10(%r14)
je 0xe8cf
movq %rax, 0x10(%r14)
movq $0x0, (%r14)
movq 0x50(%rsp), %rsi
movq %r15, %rdi
callq 0xf65e
movq 0x40(%rsp), %r12
cmpq %rbx, %r12
je 0xe9af
leaq 0x14(%rsp), %r13
leaq 0x20(%r12), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x969e
testb %al, %al
je 0xe938
movl $0x4, (%rsp)
movl 0x14(%rsp), %eax
movl %eax, 0x4(%rsp)
movq 0x10(%r14), %rsi
cmpq 0x18(%r14), %rsi
je 0xe97c
movl 0x10(%rsp), %eax
movl %eax, 0x10(%rsi)
movups (%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x14, 0x10(%r14)
jmp 0xe987
movq %rbp, %rdi
leaq 0x58(%rsp), %rsi
callq 0x96be
testb %al, %al
je 0xe99b
movl $0x6, (%rsp)
movups 0x58(%rsp), %xmm0
leaq 0x4(%rsp), %rax
movups %xmm0, (%rax)
movq 0x10(%r14), %rsi
cmpq 0x18(%r14), %rsi
je 0xe98c
movl 0x10(%rsp), %eax
movl %eax, 0x10(%rsi)
movups (%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x14, 0x10(%r14)
jmp 0xe997
movq %r15, %rdi
movq %rsp, %rdx
callq 0xf732
incl (%r14)
jmp 0xe99b
movq %r15, %rdi
movq %rsp, %rdx
callq 0xf732
incl 0x4(%r14)
movq %r12, %rdi
callq 0x3450
movq %rax, %r12
cmpq %rbx, %rax
jne 0xe8f6
movl $0x0, 0x28(%r14)
movq 0x20(%rsp), %rax
movq %rax, 0x20(%r14)
leaq 0x28(%rsp), %rdi
callq 0xf878
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
imull %eax, %eax
shll $0x2, %eax
leal (%rax,%rax,4), %eax
cmpq %rax, %rcx
jae 0xe9ca
movq %rbx, %rax
subq 0x20(%r14), %rax
cmpq $0x6, %rax
jge 0xe871
jmp 0xe9ca
jmp 0xea00
jmp 0xea00
jmp 0xea00
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xf878
movq %rbx, %rdi
callq 0x3650
nop