// File: /workspace/github_cpp_makefile_star2_O1/CoinBlack[P]blackcoin-seeder/bitcoin.cpp
// Function: CNode::Run()
bool Run() {
    bool res = true;
    if (!ConnectSocket(you, sock)) return false;
    PushVersion();
    Send();
    int64 now;
    while (now = time(NULL), ban == 0 && (doneAfter == 0 || doneAfter > now) && sock != INVALID_SOCKET) {
      char pchBuf[0x10000];
      fd_set read_set, except_set;
      FD_ZERO(&read_set);
      FD_ZERO(&except_set);
      FD_SET(sock,&read_set);
      FD_SET(sock,&except_set);
      struct timeval wa;
      if (doneAfter) {
        wa.tv_sec = doneAfter - now;
        wa.tv_usec = 0;
      } else {
        wa.tv_sec = GetTimeout();
        wa.tv_usec = 0;
      }
      int ret = select(sock+1, &read_set, NULL, &except_set, &wa);
      if (ret != 1) {
        if (!doneAfter) res = false;
        break;
      }
      int nBytes = recv(sock, pchBuf, sizeof(pchBuf), 0);
      int nPos = vRecv.size();
      if (nBytes > 0) {
        vRecv.resize(nPos + nBytes);
        memcpy(&vRecv[nPos], pchBuf, nBytes);
      } else if (nBytes == 0) {
        // printf("%s: BAD (connection closed prematurely)\n", ToString(you).c_str());
        res = false;
        break;
      } else {
        // printf("%s: BAD (connection error)\n", ToString(you).c_str());
        res = false;
        break;
      }
      ProcessMessages();
      Send();
    }
    if (sock == INVALID_SOCKET) res = false;
    close(sock);
    sock = INVALID_SOCKET;
    return (ban == 0) && res;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10138, %rsp          # imm = 0x10138
movq %rdi, %rbx
addq $0xa8, %rdi
leaq 0x17f78(%rip), %rax     # 0x1d3e0
movl (%rax), %edx
movq %rdi, 0x28(%rsp)
movq %rbx, %rsi
callq 0x8106
testb %al, %al
je 0x56af
movq %rbx, %rdi
callq 0x5798
movq %rbx, %rdi
callq 0x597e
leaq 0x30(%rbx), %rax
movq %rax, 0x20(%rsp)
movb $0x1, %r12b
leaq 0x30(%rsp), %r15
leaq 0x10(%rsp), %r14
leaq 0x130(%rsp), %rbp
xorl %edi, %edi
callq 0x33b0
cmpl $0x0, 0x98(%rbx)
jne 0x5689
movq 0xa0(%rbx), %rsi
testq %rsi, %rsi
setne %cl
movq %rsi, %rdx
subq %rax, %rdx
setle %al
testb %al, %cl
jne 0x5689
movl (%rbx), %ecx
cmpl $-0x1, %ecx
je 0x5689
xorps %xmm0, %xmm0
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xf0(%rsp)
movaps %xmm0, 0x100(%rsp)
movaps %xmm0, 0x110(%rsp)
movaps %xmm0, 0x120(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0xa0(%rsp)
movl $0x1, %eax
shlq %cl, %rax
shrl $0x6, %ecx
orq %rax, 0xb0(%rsp,%rcx,8)
orq %rax, 0x30(%rsp,%rcx,8)
testq %rsi, %rsi
jne 0x5595
movq 0x28(%rsp), %rdi
callq 0x9a66
testb %al, %al
movl $0x1e, %edx
movl $0x78, %eax
cmovneq %rax, %rdx
movq %rdx, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movl (%rbx), %edi
incl %edi
leaq 0xb0(%rsp), %rsi
xorl %edx, %edx
movq %r15, %rcx
movq %r14, %r8
callq 0x33d0
cmpl $0x1, %eax
jne 0x5660
movl %r12d, 0xc(%rsp)
movq %r15, %r14
movl (%rbx), %edi
xorl %r13d, %r13d
movl $0x10000, %edx          # imm = 0x10000
movq %rbp, %r12
movq %rbp, %rsi
xorl %ecx, %ecx
callq 0x3140
movq %rax, %r15
testl %r15d, %r15d
jle 0x5675
movq 0x38(%rbx), %r13
movl 0x48(%rbx), %eax
movq 0x30(%rbx), %rcx
addq %rax, %rcx
subq %rcx, %r13
leal (%r15,%r13), %ecx
movslq %ecx, %rsi
movb $0x0, 0xb(%rsp)
addq %rax, %rsi
movq 0x20(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x647a
movslq %r13d, %rax
movl 0x48(%rbx), %edi
addq 0x30(%rbx), %rdi
addq %rax, %rdi
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movq %r12, %rsi
movq %r15, %rdx
callq 0x3340
movq %rbx, %rdi
callq 0x59dc
movq %rbx, %rdi
callq 0x597e
movb $0x1, %r13b
movq %r14, %r15
leaq 0x10(%rsp), %r14
movl 0xc(%rsp), %r12d
jmp 0x5680
xorl %r13d, %r13d
cmpq $0x0, 0xa0(%rbx)
movzbl %r12b, %r12d
cmovel %r13d, %r12d
jmp 0x5680
movq %r14, %r15
leaq 0x10(%rsp), %r14
xorl %r12d, %r12d
testb %r13b, %r13b
jne 0x54ad
movl (%rbx), %edi
cmpl $-0x1, %edi
setne %bpl
callq 0x3740
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
cmpl $0x0, 0x98(%rbx)
sete %al
andb %bpl, %al
andb %r12b, %al
jmp 0x56b1
xorl %eax, %eax
addq $0x10138, %rsp          # imm = 0x10138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop