// File: 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
movq %rsp, %rbp
subq $0x10170, %rsp          # imm = 0x10170
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rsi
movq %rsi, -0x10168(%rbp)
movb $0x1, -0x11(%rbp)
movq %rsi, %rdi
addq $0xa8, %rdi
leaq 0x463e9(%rip), %rax     # 0x4d4e8
movl (%rax), %edx
callq 0x109e0
testb $0x1, %al
jne 0x7113
movb $0x0, -0x1(%rbp)
jmp 0x7444
movq -0x10168(%rbp), %rdi
callq 0x7a50
movq -0x10168(%rbp), %rdi
callq 0x7ca0
xorl %eax, %eax
movl %eax, %edi
callq 0x4490
movq -0x10168(%rbp), %rcx
movq %rax, -0x20(%rbp)
xorl %eax, %eax
cmpl $0x0, 0x98(%rcx)
movb %al, -0x10169(%rbp)
jne 0x7190
movq -0x10168(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
je 0x717d
movq -0x10168(%rbp), %rax
movq 0xa0(%rax), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x10169(%rbp)
jle 0x7190
movq -0x10168(%rbp), %rax
cmpl $-0x1, (%rax)
setne %al
movb %al, -0x10169(%rbp)
movb -0x10169(%rbp), %al
testb $0x1, %al
jne 0x719f
jmp 0x73f4
jmp 0x71a1
leaq -0x100a0(%rbp), %rax
movq %rax, -0x10130(%rbp)
movl $0x0, -0x10124(%rbp)
movl -0x10124(%rbp), %eax
cmpq $0x10, %rax
jae 0x71eb
movq -0x10130(%rbp), %rax
movl -0x10124(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x10124(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10124(%rbp)
jmp 0x71b9
jmp 0x71ed
jmp 0x71ef
leaq -0x10120(%rbp), %rax
movq %rax, -0x10140(%rbp)
movl $0x0, -0x10134(%rbp)
movl -0x10134(%rbp), %eax
cmpq $0x10, %rax
jae 0x7239
movq -0x10140(%rbp), %rax
movl -0x10134(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x10134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10134(%rbp)
jmp 0x7207
jmp 0x723b
movq -0x10168(%rbp), %rax
movl (%rax), %ecx
andl $0x3f, %ecx
movl %ecx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movl (%rax), %ecx
shrl $0x6, %ecx
movl %ecx, %ecx
orq -0x100a0(%rbp,%rcx,8), %rdx
movq %rdx, -0x100a0(%rbp,%rcx,8)
movl (%rax), %ecx
andl $0x3f, %ecx
movl %ecx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movl (%rax), %ecx
shrl $0x6, %ecx
movl %ecx, %ecx
orq -0x10120(%rbp,%rcx,8), %rdx
movq %rdx, -0x10120(%rbp,%rcx,8)
cmpq $0x0, 0xa0(%rax)
je 0x72be
movq -0x10168(%rbp), %rax
movq 0xa0(%rax), %rax
subq -0x20(%rbp), %rax
movq %rax, -0x10150(%rbp)
movq $0x0, -0x10148(%rbp)
jmp 0x72de
movq -0x10168(%rbp), %rdi
callq 0x7d90
cltq
movq %rax, -0x10150(%rbp)
movq $0x0, -0x10148(%rbp)
movq -0x10168(%rbp), %rax
movl (%rax), %edi
addl $0x1, %edi
leaq -0x100a0(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq -0x10120(%rbp), %rcx
leaq -0x10150(%rbp), %r8
callq 0x44c0
movl %eax, -0x10154(%rbp)
cmpl $0x1, -0x10154(%rbp)
je 0x7331
movq -0x10168(%rbp), %rax
cmpq $0x0, 0xa0(%rax)
jne 0x732c
movb $0x0, -0x11(%rbp)
jmp 0x73f4
movq -0x10168(%rbp), %rax
movl (%rax), %edi
leaq -0x10020(%rbp), %rsi
movl $0x10000, %edx          # imm = 0x10000
xorl %ecx, %ecx
callq 0x4180
movq -0x10168(%rbp), %rdi
movl %eax, -0x10158(%rbp)
addq $0x30, %rdi
callq 0x7dd0
movl %eax, -0x1015c(%rbp)
cmpl $0x0, -0x10158(%rbp)
jle 0x73c2
movq -0x10168(%rbp), %rdi
addq $0x30, %rdi
movl -0x1015c(%rbp), %eax
addl -0x10158(%rbp), %eax
movslq %eax, %rsi
xorl %edx, %edx
callq 0x7e00
movq -0x10168(%rbp), %rdi
addq $0x30, %rdi
movslq -0x1015c(%rbp), %rsi
callq 0x7e40
movq %rax, %rdi
leaq -0x10020(%rbp), %rsi
movslq -0x10158(%rbp), %rdx
callq 0x4410
jmp 0x73d7
cmpl $0x0, -0x10158(%rbp)
jne 0x73d1
movb $0x0, -0x11(%rbp)
jmp 0x73f4
movb $0x0, -0x11(%rbp)
jmp 0x73f4
movq -0x10168(%rbp), %rdi
callq 0x7e70
movq -0x10168(%rbp), %rdi
callq 0x7ca0
jmp 0x712b
movq -0x10168(%rbp), %rax
cmpl $-0x1, (%rax)
jne 0x7404
movb $0x0, -0x11(%rbp)
movq -0x10168(%rbp), %rax
movl (%rax), %edi
callq 0x4930
movq -0x10168(%rbp), %rcx
movl $0xffffffff, (%rcx)     # imm = 0xFFFFFFFF
xorl %eax, %eax
cmpl $0x0, 0x98(%rcx)
movb %al, -0x1016a(%rbp)
jne 0x7439
movb -0x11(%rbp), %al
movb %al, -0x1016a(%rbp)
movb -0x1016a(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x10170, %rsp          # imm = 0x10170
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)