// File: tenup-coin[P]seeder/main.cpp
// Function: ThreadCrawler
void* ThreadCrawler(void* data) {
  int *nThreads=(int*)data;
  do {
    std::vector<CServiceResult> ips;
    int wait = 5;
    db.GetMany(ips, 16, wait);
    int64 now = time(NULL);
    if (ips.empty()) {
      wait *= 1000;
      wait += rand() % (500 * *nThreads);
      Sleep(wait);
      continue;
    }
    vector<CAddress> addr;
    for (int i=0; i<ips.size(); i++) {
      CServiceResult &res = ips[i];
      res.nBanTime = 0;
      res.nClientV = 0;
      res.nHeight = 0;
      res.strClientV = "";
      bool getaddr = res.ourLastSuccess + 3600 < now;
      res.fGood = TestNode(res.service,res.nBanTime,res.nClientV,res.strClientV,res.nHeight,getaddr ? &addr : NULL);
    }
    db.ResultMany(ips);
    db.Add(addr);
  } while(1);
  return nullptr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x244a0
movq -0x88(%rbp), %rsi
movl $0x5, -0x2c(%rbp)
leaq 0x27cac(%rip), %rdi     # 0x4a5a8
movl $0x10, %edx
leaq -0x2c(%rbp), %rcx
callq 0x244c0
jmp 0x2290c
xorl %eax, %eax
movl %eax, %edi
callq 0x44a0
movq %rax, -0x48(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x24620
testb $0x1, %al
jne 0x22928
jmp 0x22977
movl -0x2c(%rbp), %eax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movl %eax, -0x2c(%rbp)
callq 0x4110
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
imull $0x1f4, %ecx, %ecx      # imm = 0x1F4
cltd
idivl %ecx
movl -0x2c(%rbp), %eax
addl %edx, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %edi
callq 0x22b60
jmp 0x2295a
movl $0x3, -0x4c(%rbp)
jmp 0x22b17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x22b44
leaq -0x68(%rbp), %rdi
callq 0xdde0
movl $0x0, -0x6c(%rbp)
movslq -0x6c(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x24660
movq %rax, %rcx
movq -0x90(%rbp), %rax
cmpq %rcx, %rax
jae 0x22ae1
movslq -0x6c(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x24690
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x78(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x78(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x78(%rbp), %rdi
addq $0x20, %rdi
leaq 0x10d36(%rip), %rsi     # 0x33725
callq 0x4670
jmp 0x229f6
movq -0x78(%rbp), %rax
movq 0x40(%rax), %rax
addq $0xe10, %rax            # imm = 0xE10
cmpq -0x48(%rbp), %rax
setl %al
andb $0x1, %al
movb %al, -0x79(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x78(%rbp), %rax
addq $0x14, %rax
movq %rax, -0xb0(%rbp)
movq -0x78(%rbp), %rax
addq $0x1c, %rax
movq %rax, -0xa8(%rbp)
movq -0x78(%rbp), %rax
addq $0x20, %rax
movq %rax, -0xa0(%rbp)
movq -0x78(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x98(%rbp)
testb $0x1, -0x79(%rbp)
je 0x22a6a
leaq -0x68(%rbp), %rax
movq %rax, -0xc0(%rbp)
jmp 0x22a75
xorl %eax, %eax
movq %rax, -0xc0(%rbp)
jmp 0x22a75
movq -0x98(%rbp), %r8
movq -0xa0(%rbp), %rcx
movq -0xa8(%rbp), %rdx
movq -0xb0(%rbp), %rsi
movq -0xb8(%rbp), %rdi
movq -0xc0(%rbp), %r9
callq 0x6920
movb %al, -0xc1(%rbp)
jmp 0x22aac
movb -0xc1(%rbp), %cl
movq -0x78(%rbp), %rax
andb $0x1, %cl
movb %cl, 0x12(%rax)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x22987
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0xdfe0
jmp 0x22b44
leaq 0x27ac0(%rip), %rdi     # 0x4a5a8
leaq -0x28(%rbp), %rsi
callq 0x246b0
jmp 0x22af3
leaq 0x27aae(%rip), %rdi     # 0x4a5a8
leaq -0x68(%rbp), %rsi
xorl %edx, %edx
callq 0x24830
jmp 0x22b07
leaq -0x68(%rbp), %rdi
callq 0xdfe0
movl $0x0, -0x4c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x248f0
movl -0x4c(%rbp), %eax
testl %eax, %eax
je 0x22b2b
jmp 0x22b29
jmp 0x22b2d
jmp 0x22b2d
movb $0x1, %al
testb $0x1, %al
jne 0x228d7
jmp 0x22b39
xorl %eax, %eax
addq $0xd0, %rsp
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x248f0
movq -0x38(%rbp), %rdi
callq 0x47f0
nopw %cs:(%rax,%rax)