// File: /workspace/github_cpp_makefile_star2_O1/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, 0xdcb0(%rip)      # 0x1c6b1
jne 0xea0c
movw $0x101, 0xdca5(%rip)    # imm = 0x101
xorl %edi, %edi
callq 0x33c0
movq %rax, %rbx
leaq 0x40(%r15), %rdi
leaq 0x18(%rsp), %rsi
callq 0xec0a
movq %rax, %r14
movl 0x28(%rax), %eax
incl %eax
movl %eax, 0x28(%r14)
testb %bpl, %bpl
jne 0xea65
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 0xebcd
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 0xd9f5(%rip), %rdi      # 0x1c488
leaq 0xdc16(%rip), %r8       # 0x1c6b0
leaq 0x28(%rsp), %rsi
movl $0x3e8, %ecx            # imm = 0x3E8
callq 0xf83e
lock
incq 0x70(%r15)
movq %r14, %r15
addq $0x8, %r15
movq 0x8(%r14), %rax
cmpq %rax, 0x10(%r14)
je 0xeac3
movq %rax, 0x10(%r14)
movq $0x0, (%r14)
movq 0x50(%rsp), %rsi
movq %r15, %rdi
callq 0xf890
movq 0x40(%rsp), %r12
cmpq %rbx, %r12
je 0xeba3
leaq 0x14(%rsp), %r13
leaq 0x20(%r12), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x97e8
testb %al, %al
je 0xeb2c
movl $0x4, (%rsp)
movl 0x14(%rsp), %eax
movl %eax, 0x4(%rsp)
movq 0x10(%r14), %rsi
cmpq 0x18(%r14), %rsi
je 0xeb70
movl 0x10(%rsp), %eax
movl %eax, 0x10(%rsi)
movups (%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x14, 0x10(%r14)
jmp 0xeb7b
movq %rbp, %rdi
leaq 0x58(%rsp), %rsi
callq 0x9808
testb %al, %al
je 0xeb8f
movl $0x6, (%rsp)
movups 0x58(%rsp), %xmm0
leaq 0x4(%rsp), %rax
movups %xmm0, (%rax)
movq 0x10(%r14), %rsi
cmpq 0x18(%r14), %rsi
je 0xeb80
movl 0x10(%rsp), %eax
movl %eax, 0x10(%rsi)
movups (%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x14, 0x10(%r14)
jmp 0xeb8b
movq %r15, %rdi
movq %rsp, %rdx
callq 0xf960
incl (%r14)
jmp 0xeb8f
movq %r15, %rdi
movq %rsp, %rdx
callq 0xf960
incl 0x4(%r14)
movq %r12, %rdi
callq 0x3450
movq %rax, %r12
cmpq %rbx, %rax
jne 0xeaea
movl $0x0, 0x28(%r14)
movq 0x20(%rsp), %rax
movq %rax, 0x20(%r14)
leaq 0x28(%rsp), %rdi
callq 0xfaa6
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 0xebbe
movq %rbx, %rax
subq 0x20(%r14), %rax
cmpq $0x6, %rax
jge 0xea65
jmp 0xebbe
jmp 0xebf4
jmp 0xebf4
jmp 0xebf4
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xfaa6
movq %rbx, %rdi
callq 0x3650
nop