// File: /workspace/github_cpp_makefile_star2_O1/tenup-coin[P]seeder/db.cpp
// Function: CAddrDb::GetIPs_(std::set<CNetAddr, std::less<CNetAddr>, std::allocator<CNetAddr>>&, unsigned long, int, bool const*)
void CAddrDb::GetIPs_(set<CNetAddr>& ips, uint64_t requestedFlags, int max, const bool* nets) {
  if (goodId.size() == 0) {
    int id = -1;
    if (ourId.size() == 0) {
      if (unkId.size() == 0) return;
      id = *unkId.begin();
    } else {
      id = *ourId.begin();
    }
    if (id >= 0 && (idToInfo[id].services & requestedFlags) == requestedFlags) {
      ips.insert(idToInfo[id].ip);
    }
    return;
  }
  std::vector<int> goodIdFiltered;
  for (std::set<int>::const_iterator it = goodId.begin(); it != goodId.end(); it++) {
    if ((idToInfo[*it].services & requestedFlags) == requestedFlags)
      goodIdFiltered.push_back(*it);
  }

  if (!goodIdFiltered.size())
    return;

  if (max > goodIdFiltered.size() / 2)
    max = goodIdFiltered.size() / 2;
  if (max < 1)
    max = 1;

  set<int> ids;
  while (ids.size() < max) {
    ids.insert(goodIdFiltered[rand() % goodIdFiltered.size()]);
  }
  for (set<int>::const_iterator it = ids.begin(); it != ids.end(); it++) {
    CService &ip = idToInfo[*it].ip;
    if (nets[ip.GetNetwork()])
      ips.insert(ip);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
cmpq $0x0, 0x148(%rdi)
je 0xb9c9
movl %ecx, 0x24(%rsp)
movq %r8, 0x28(%rsp)
movq %rbx, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x138(%r14), %r13
leaq 0x128(%r14), %r15
cmpq %r15, %r13
je 0xb8d3
leaq 0x40(%r14), %rbp
leaq 0x20(%r13), %rbx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xbc36
movq 0x18(%rax), %rax
notq %rax
testq %rax, %r12
jne 0xb8c3
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0xb8b8
movl (%rbx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0xb8c3
movq %rsp, %rdi
movq %rbx, %rdx
callq 0xd3a4
movq %r13, %rdi
callq 0x3450
movq %rax, %r13
cmpq %r15, %rax
jne 0xb882
movq 0x8(%rsp), %rax
subq (%rsp), %rax
je 0xb9b2
sarq $0x2, %rax
movslq 0x24(%rsp), %rcx
shrq %rax
cmpq %rcx, %rax
cmovbl %eax, %ecx
cmpl $0x2, %ecx
movl $0x1, %ebx
cmovgel %ecx, %ebx
leaq 0x40(%rsp), %r13
movl $0x0, (%r13)
xorl %eax, %eax
movq %rax, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rax, 0x20(%r13)
leaq 0x38(%rsp), %r12
movq 0x30(%rsp), %r15
movq 0x28(%rsp), %rbp
cmpq %rbx, 0x60(%rsp)
jae 0xb95e
callq 0x30c0
cltq
movq (%rsp), %rcx
movq 0x8(%rsp), %rsi
subq %rcx, %rsi
sarq $0x2, %rsi
xorl %edx, %edx
divq %rsi
leaq (%rcx,%rdx,4), %rsi
movq %r12, %rdi
callq 0xc802
jmp 0xb92d
movq 0x50(%rsp), %r12
cmpq %r13, %r12
je 0xb9a8
addq $0x40, %r14
leaq 0x20(%r12), %rsi
movq %r14, %rdi
callq 0xbc36
movq %rax, %rbx
movq %rax, %rdi
callq 0x7f2a
movl %eax, %eax
cmpb $0x1, (%rbp,%rax)
jne 0xb998
movq %r15, %rdi
movq %rbx, %rsi
callq 0xd272
movq %r12, %rdi
callq 0x3450
movq %rax, %r12
cmpq %r13, %rax
jne 0xb96c
leaq 0x38(%rsp), %rdi
callq 0xc024
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xba75
callq 0x33d0
jmp 0xba75
movl $0xffffffff, 0x38(%rsp) # imm = 0xFFFFFFFF
movq 0xe8(%r14), %rax
movq %rax, %rcx
subq 0xc8(%r14), %rcx
shrq $0x3, %rcx
cmpq $0x1, %rax
adcq $-0x1, %rcx
movq 0xd0(%r14), %rdx
subq 0xd8(%r14), %rdx
shlq $0x7, %rcx
sarq $0x2, %rdx
addq %rcx, %rdx
movq 0xb0(%r14), %rax
movq 0xc0(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
addq %rdx, %rcx
jne 0xba36
cmpq $0x0, 0x118(%r14)
je 0xba75
movq 0x108(%r14), %rax
addq $0x20, %rax
movl (%rax), %eax
movl %eax, 0x38(%rsp)
testl %eax, %eax
js 0xba75
addq $0x40, %r14
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
callq 0xbc36
movq 0x18(%rax), %rax
notq %rax
testq %rax, %r12
jne 0xba75
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
callq 0xbc36
movq %rbx, %rdi
movq %rax, %rsi
callq 0xd272
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xba8b
movq %rax, %rbx
jmp 0xba98
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0xc024
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xbaa6
callq 0x33d0
movq %rbx, %rdi
callq 0x3650