// File: /workspace/github_cpp_makefile_star2_O3/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 $0x118, %rsp            # imm = 0x118
leaq 0x98(%rsp), %rbx
leaq 0xa8(%rsp), %rbp
leaq 0x50(%rsp), %r14
leaq 0x18(%rsp), %r12
leaq 0x644a(%rip), %r15      # 0x13b91
xorl %r13d, %r13d
movl $0x186a0, %eax          # imm = 0x186A0
movl %r13d, %ecx
shll %cl, %eax
cltq
imulq $0x10624dd3, %rax, %rcx # imm = 0x10624DD3
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x26, %rcx
addl %edx, %ecx
movslq %ecx, %rcx
movq %rcx, 0x50(%rsp)
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
subl %ecx, %eax
imull $0xf4240, %eax, %eax    # imm = 0xF4240
cltq
movq %rax, 0x58(%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x3100
cmpl $0x5, %r13d
adcl $0x0, %r13d
movl %r13d, 0x14(%rsp)
movq %r12, %rdi
leaq 0xece0(%rip), %rsi      # 0x1c488
callq 0xea8a
movq 0x18(%rsp), %r12
movq 0x20(%rsp), %r13
cmpq %r13, %r12
je 0xd7f7
movq %r13, %rax
subq %r12, %rax
sarq $0x7, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r12, %rdi
movq %r13, %rsi
leaq -0xf9(%rip), %rcx       # 0xd6e7
callq 0x1044a
movq %r12, %rdi
movq %r13, %rsi
leaq -0x10b(%rip), %rdx      # 0xd6e7
callq 0x10539
leaq 0x62da(%rip), %rdi      # 0x13ad8
leaq 0x62e3(%rip), %rsi      # 0x13ae8
callq 0x3460
testq %rax, %rax
je 0xd855
movq %rax, 0x50(%rsp)
movl $0x11500, 0x60(%rsp)    # imm = 0x11500
movabsq $0x200050000, %rax      # imm = 0x200050000
movq %rax, 0x58(%rsp)
movq %r14, %rdi
leaq 0xec53(%rip), %rsi      # 0x1c488
callq 0xeb94
movq %r14, %rdi
callq 0xfcba
leaq 0x628f(%rip), %rdi      # 0x13ad8
leaq 0x629b(%rip), %rsi      # 0x13aeb
callq 0x3260
leaq 0x629b(%rip), %rdi      # 0x13af7
leaq 0x6283(%rip), %rsi      # 0x13ae6
callq 0x3460
movq %rax, %r12
movq %rax, %rdi
leaq 0x628f(%rip), %rsi      # 0x13b04
xorl %eax, %eax
callq 0x3570
movq 0x18(%rsp), %r13
cmpq 0x20(%rsp), %r13
jae 0xda1e
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movl $0x9, %ecx
movq %r14, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %rbp, 0x98(%rsp)
movq 0x48(%r13), %rsi
movq 0x50(%r13), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x706e
movq 0x78(%r13), %rax
movq %rax, 0x30(%rbx)
movups 0x68(%r13), %xmm0
movups %xmm0, 0x20(%rbx)
leaq 0xf8(%rsp), %rdi
movq %r14, %rsi
callq 0xa306
movq 0xf8(%rsp), %rdx
movzbl 0xc0(%rsp), %ecx
movq 0xb8(%rsp), %r8
movsd 0x70(%rsp), %xmm0
movsd 0x616b(%rip), %xmm5     # 0x13a80
mulsd %xmm5, %xmm0
movsd 0x78(%rsp), %xmm1
mulsd %xmm5, %xmm1
movsd 0x80(%rsp), %xmm2
mulsd %xmm5, %xmm2
movsd 0x88(%rsp), %xmm3
mulsd %xmm5, %xmm3
movsd 0x90(%rsp), %xmm4
mulsd %xmm5, %xmm4
movl 0x64(%rsp), %r10d
movl 0x68(%rsp), %r9d
subq $0x8, %rsp
movq %r12, %rdi
movq %r15, %rsi
movb $0x5, %al
pushq 0xa0(%rsp)
pushq %r10
pushq 0xe0(%rsp)
callq 0x3570
addq $0x20, %rsp
movq 0xf8(%rsp), %rdi
leaq 0x108(%rsp), %rax
cmpq %rax, %rdi
je 0xd993
callq 0x33d0
movupd 0x70(%rsp), %xmm2
movupd 0x80(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
addsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x98(%rsp), %rdi
cmpq %rbp, %rdi
je 0xd9ed
movapd %xmm1, 0xe0(%rsp)
movapd %xmm2, 0xd0(%rsp)
callq 0x33d0
movapd 0xd0(%rsp), %xmm2
movapd 0xe0(%rsp), %xmm1
movapd 0x40(%rsp), %xmm0
addpd %xmm2, %xmm0
movapd %xmm0, 0x40(%rsp)
movapd 0x30(%rsp), %xmm0
addpd %xmm1, %xmm0
movapd %xmm0, 0x30(%rsp)
subq $-0x80, %r13
cmpq 0x20(%rsp), %r13
jb 0xd8a5
jmp 0xda3c
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movq %r12, %rdi
callq 0x33f0
leaq 0x6198(%rip), %rdi      # 0x13be3
leaq 0x5785(%rip), %rsi      # 0x131d7
callq 0x3460
movq %rax, %r12
xorl %edi, %edi
callq 0x33c0
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 %r12, %rdi
leaq 0x6169(%rip), %rsi      # 0x13bf0
movq %rax, %rdx
movsd 0x8(%rsp), %xmm4
movb $0x5, %al
callq 0x3570
movq %r12, %rdi
callq 0x33f0
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0xec1a
movl 0x14(%rsp), %r13d
jmp 0xd74a
jmp 0xdac7
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0xfcba
jmp 0xdaeb
movq %rax, %rdi
callq 0x5036
jmp 0xdad1
movq %rax, %rbx
jmp 0xdaeb
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %rbp, %rdi
je 0xdaeb
callq 0x33d0
leaq 0x18(%rsp), %rdi
callq 0xec1a
movq %rbx, %rdi
callq 0x3650