// File: tenup-coin[P]seeder/db.cpp
// Function: CAddrDb::Get_(CServiceResult&, int&)
bool CAddrDb::Get_(CServiceResult &ip, int &wait) {
  int64 now = time(NULL);
  int cont = 0;
  int tot = unkId.size() + ourId.size();
  if (tot == 0) {
    wait = 5;
    return false;
  }
  do {
    int rnd = rand() % tot;
    int ret;
    if (rnd < unkId.size()) {
      set<int>::iterator it = unkId.end(); it--;
      ret = *it;
      unkId.erase(it);
    } else {
      ret = ourId.front();
      if (time(NULL) - idToInfo[ret].ourLastTry < MIN_RETRY) return false;
      ourId.pop_front();
    }
    if (idToInfo[ret].ignoreTill && idToInfo[ret].ignoreTill < now) {
      ourId.push_back(ret);
      idToInfo[ret].ourLastTry = now;
    } else {
      ip.service = idToInfo[ret].ip;
      ip.ourLastSuccess = idToInfo[ret].ourLastSuccess;
      break;
    }
  } while(1);
  nDirty++;
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x44a0
movq -0x68(%rbp), %rdi
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
addq $0xf0, %rdi
callq 0x1a210
movq -0x68(%rbp), %rdi
movq %rax, -0x60(%rbp)
addq $0xa0, %rdi
callq 0x1a230
movq %rax, %rcx
movq -0x60(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0x1927d
movq -0x20(%rbp), %rax
movl $0x5, (%rax)
movb $0x0, -0x1(%rbp)
jmp 0x1943d
jmp 0x1927f
callq 0x4110
movq -0x68(%rbp), %rdi
cltd
idivl -0x30(%rbp)
movl %edx, -0x34(%rbp)
movslq -0x34(%rbp), %rax
movq %rax, -0x70(%rbp)
addq $0xf0, %rdi
callq 0x1a210
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq %rcx, %rax
jae 0x19302
movq -0x68(%rbp), %rdi
addq $0xf0, %rdi
callq 0x1a260
movq %rax, -0x40(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0x1a290
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x1a2d0
movq -0x68(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x38(%rbp)
addq $0xf0, %rdi
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rsi
callq 0x1a300
movq %rax, -0x58(%rbp)
jmp 0x19361
movq -0x68(%rbp), %rdi
addq $0xa0, %rdi
callq 0x1a340
movl (%rax), %eax
movl %eax, -0x38(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x44a0
movq -0x68(%rbp), %rdi
movq %rax, -0x78(%rbp)
addq $0x40, %rdi
leaq -0x38(%rbp), %rsi
callq 0x1a370
movq %rax, %rcx
movq -0x78(%rbp), %rax
subq 0x28(%rcx), %rax
cmpq $0x3e8, %rax            # imm = 0x3E8
jge 0x19351
movb $0x0, -0x1(%rbp)
jmp 0x1943d
movq -0x68(%rbp), %rdi
addq $0xa0, %rdi
callq 0x1a450
movq -0x68(%rbp), %rdi
addq $0x40, %rdi
leaq -0x38(%rbp), %rsi
callq 0x1a370
cmpq $0x0, 0x38(%rax)
je 0x193cb
movq -0x68(%rbp), %rdi
addq $0x40, %rdi
leaq -0x38(%rbp), %rsi
callq 0x1a370
movq 0x38(%rax), %rax
cmpq -0x28(%rbp), %rax
jge 0x193cb
movq -0x68(%rbp), %rdi
addq $0xa0, %rdi
leaq -0x38(%rbp), %rsi
callq 0x1a4c0
movq -0x68(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, -0x80(%rbp)
addq $0x40, %rdi
leaq -0x38(%rbp), %rsi
callq 0x1a370
movq -0x80(%rbp), %rcx
movq %rcx, 0x28(%rax)
jmp 0x19418
movq -0x68(%rbp), %rdi
addq $0x40, %rdi
leaq -0x38(%rbp), %rsi
callq 0x1a370
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movw 0x10(%rcx), %cx
movw %cx, 0x10(%rax)
addq $0x40, %rdi
leaq -0x38(%rbp), %rsi
callq 0x1a370
movq 0x30(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
jmp 0x19426
jmp 0x1941a
movb $0x1, %al
testb $0x1, %al
jne 0x1927f
jmp 0x19426
movq -0x68(%rbp), %rax
movl 0x150(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x150(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)