// File: /workspace/github_cpp_makefile_star2_O2/tenup-coin[P]seeder/main.cpp
// Function: ThreadDumper
void* ThreadDumper(void*) {
  int count = 0;
  do {
    Sleep(100000 << count); // First 100s, than 200s, 400s, 800s, 1600s, and then 3200s forever
    if (count < 5)
        count++;
    {
      vector<CAddrReport> v = db.GetAll();
      sort(v.begin(), v.end(), StatCompare);
      FILE *f = fopen("dnsseed.dat.new","w+");
      if (f) {
        {
          CAutoFile cf(f);
          cf << db;
        }
        rename("dnsseed.dat.new", "dnsseed.dat");
      }
      FILE *d = fopen("dnsseed.dump", "w");
      fprintf(d, "# address                                        good  lastSuccess    %%(2h)   %%(8h)   %%(1d)   %%(7d)  %%(30d)  blocks      svcs  version\n");
      double stat[5]={0,0,0,0,0};
      for (vector<CAddrReport>::const_iterator it = v.begin(); it < v.end(); it++) {
        CAddrReport rep = *it;
        fprintf(d, "%-47s  %4d  %11" PRId64 "  %6.2f%% %6.2f%% %6.2f%% %6.2f%% %6.2f%%  %6i  %08" PRIx64 "  %5i \"%s\"\n", rep.ip.ToString().c_str(), (int)rep.fGood, rep.lastSuccess, 100.0*rep.uptime[0], 100.0*rep.uptime[1], 100.0*rep.uptime[2], 100.0*rep.uptime[3], 100.0*rep.uptime[4], rep.blocks, rep.services, rep.clientVersion, rep.clientSubVersion.c_str());
        stat[0] += rep.uptime[0];
        stat[1] += rep.uptime[1];
        stat[2] += rep.uptime[2];
        stat[3] += rep.uptime[3];
        stat[4] += rep.uptime[4];
      }
      fclose(d);
      FILE *ff = fopen("dnsstats.log", "a");
      fprintf(ff, "%llu %g %g %g %g %g\n", (unsigned long long)(time(NULL)), stat[0], stat[1], stat[2], stat[3], stat[4]);
      fclose(ff);
    }
  } while(1);
  return nullptr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
leaq 0xa0(%rsp), %rbx
leaq 0x18(%rsp), %r15
leaq 0x58(%rsp), %rbp
leaq 0xd8(%rsp), %r12
leaq 0x6299(%rip), %r14      # 0x12b91
movl $0x0, 0xc(%rsp)
movl $0x186a0, %edi          # imm = 0x186A0
movl 0xc(%rsp), %r13d
movl %r13d, %ecx
shll %cl, %edi
callq 0xc667
cmpl $0x5, %r13d
adcl $0x0, %r13d
movl %r13d, 0xc(%rsp)
movq %r15, %rdi
leaq 0x10b8d(%rip), %rsi     # 0x1d4b8
callq 0xda4a
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
leaq -0xa9(%rip), %rdx       # 0xc898
callq 0xf73d
leaq 0x618b(%rip), %rdi      # 0x12ad8
leaq 0x6194(%rip), %rsi      # 0x12ae8
callq 0x3470
testq %rax, %rax
je 0xc9a4
movq %rax, 0x58(%rsp)
movl $0x11500, 0x68(%rsp)    # imm = 0x11500
movabsq $0x200050000, %rax      # imm = 0x200050000
movq %rax, 0x60(%rsp)
movq %rbp, %rdi
leaq 0x10b34(%rip), %rsi     # 0x1d4b8
callq 0xdb3c
movq %rbp, %rdi
callq 0xdbc0
leaq 0x6140(%rip), %rdi      # 0x12ad8
leaq 0x614c(%rip), %rsi      # 0x12aeb
callq 0x3270
leaq 0x614c(%rip), %rdi      # 0x12af7
leaq 0x6134(%rip), %rsi      # 0x12ae6
callq 0x3470
movq %rax, %r15
movq %rax, %rdi
leaq 0x6140(%rip), %rsi      # 0x12b04
xorl %eax, %eax
callq 0x35b0
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x18(%rsp), %r13
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
cmpq 0x20(%rsp), %r13
jae 0xcaf9
movq %rbp, %rdi
movq %r13, %rsi
callq 0xdbd0
movq %r12, %rdi
movq %rbp, %rsi
callq 0x9022
movq 0xd8(%rsp), %rdx
movzbl 0xc8(%rsp), %ecx
movq 0xc0(%rsp), %r8
movsd 0x78(%rsp), %xmm0
movsd 0x604b(%rip), %xmm5     # 0x12a80
mulsd %xmm5, %xmm0
movsd 0x80(%rsp), %xmm1
mulsd %xmm5, %xmm1
movsd 0x88(%rsp), %xmm2
mulsd %xmm5, %xmm2
movsd 0x90(%rsp), %xmm3
mulsd %xmm5, %xmm3
movsd 0x98(%rsp), %xmm4
mulsd %xmm5, %xmm4
movl 0x6c(%rsp), %r10d
movl 0x70(%rsp), %r9d
subq $0x8, %rsp
movq %r15, %rdi
movq %r14, %rsi
movb $0x5, %al
pushq 0xa8(%rsp)
pushq %r10
pushq 0xe8(%rsp)
callq 0x35b0
addq $0x20, %rsp
movq %r12, %rdi
callq 0x31d0
movupd 0x78(%rsp), %xmm0
movupd 0x88(%rsp), %xmm1
movapd 0x30(%rsp), %xmm2
addpd %xmm1, %xmm2
movapd %xmm2, 0x30(%rsp)
movapd 0x40(%rsp), %xmm1
addpd %xmm0, %xmm1
movapd %xmm1, 0x40(%rsp)
movsd 0x10(%rsp), %xmm0
addsd 0x98(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
callq 0x31d0
subq $-0x80, %r13
jmp 0xc9ee
movq %r15, %rdi
callq 0x3400
leaq 0x60db(%rip), %rdi      # 0x12be3
leaq 0x568e(%rip), %rsi      # 0x1219d
callq 0x3470
movq %rax, %r15
xorl %edi, %edi
callq 0x33d0
movapd 0x40(%rsp), %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
movapd 0x30(%rsp), %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
movq %r15, %rdi
leaq 0x60ac(%rip), %rsi      # 0x12bf0
movq %rax, %rdx
movsd 0x10(%rsp), %xmm4
movb $0x5, %al
callq 0x35b0
movq %r15, %rdi
callq 0x3400
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0xdc06
jmp 0xc900
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0xdbc0
jmp 0xcb8f
jmp 0xcb8c
movq %rax, %r14
movq %rbx, %rdi
callq 0x31d0
jmp 0xcb8f
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0xdc06
movq %r14, %rdi
callq 0x3690