// File: /workspace/github_cpp_makefile_star2_O2/tenup-coin[P]seeder/bitcoin.cpp
// Function: CNode::ProcessMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, CDataStream&)
bool ProcessMessage(string strCommand, CDataStream& vRecv) {
    //printf("%s: RECV %s\n", ToString(you).c_str(), strCommand.c_str());
    if (strCommand == "version") {
      int64 nTime;
      CAddress addrMe;
      CAddress addrFrom;
      uint64 nNonce = 1;
      vRecv >> nVersion >> you.nServices >> nTime >> addrMe;
      if (nVersion == 10300) nVersion = 300;
      if (nVersion >= 106 && !vRecv.empty())
        vRecv >> addrFrom >> nNonce;
      if (nVersion >= 106 && !vRecv.empty())
        vRecv >> strSubVer;
      if (nVersion >= 209 && !vRecv.empty())
        vRecv >> nStartingHeight;
      
      if (nVersion >= 209) {
        BeginMessage("verack");
        EndMessage();
      }
      vSend.SetVersion(min(nVersion, PROTOCOL_VERSION));
      if (nVersion < 209) {
        this->vRecv.SetVersion(min(nVersion, PROTOCOL_VERSION));
        GotVersion();
      }
      return false;
    }
    
    if (strCommand == "verack") {
      this->vRecv.SetVersion(min(nVersion, PROTOCOL_VERSION));
      GotVersion();
      return false;
    }
    
    if (strCommand == "addr" && vAddr) {
      vector<CAddress> vAddrNew;
      vRecv >> vAddrNew;
       //printf("%s: got %i addresses\n", ToString(you).c_str(), (int)vAddrNew.size());
      int64 now = time(NULL);
      vector<CAddress>::iterator it = vAddrNew.begin();
      if (vAddrNew.size() > 1) {
        if (doneAfter == 0 || doneAfter > now + 1) doneAfter = now + 1;
      }
      while (it != vAddrNew.end()) {
        CAddress &addr = *it;
        //printf("%s: got address %s\n", ToString(you).c_str(), addr.ToString().c_str(), (int)(vAddr->size()));
        it++;
        if (addr.nTime <= 100000000 || addr.nTime > now + 600)
          addr.nTime = now - 5 * 86400;
        if (addr.nTime > now - 604800)
          vAddr->push_back(addr);
        //printf("%s: added address %s (#%i)\n", ToString(you).c_str(), addr.ToString().c_str(), (int)(vAddr->size()));
        if (vAddr->size() > 1000) {doneAfter = 1; return true; }
      }
      return false;
    }
    
    return false;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xc590(%rip), %rsi      # 0x1200c
movq %r15, %rdi
callq 0x62b4
testb %al, %al
je 0x5af6
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x9a3a
leaq 0x40(%rsp), %rdi
callq 0x9a3a
movq $0x1, 0x8(%rsp)
leaq 0x60(%rbx), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x62c2
leaq 0xc0(%rbx), %rsi
movq %rax, %rdi
callq 0x62d4
leaq 0x38(%rsp), %rsi
movq %rax, %rdi
callq 0x62e6
movq %rax, %rdi
movq %r12, %rsi
callq 0x62f8
movl 0x60(%rbx), %eax
cmpl $0x283c, %eax           # imm = 0x283C
jne 0x5b22
movl $0x12c, (%r15)          # imm = 0x12C
movl $0x12c, %eax            # imm = 0x12C
jmp 0x5b2b
leaq 0xc6ec(%rip), %rsi      # 0x121e9
movq %r15, %rdi
callq 0x62b4
testb %al, %al
je 0x5bf8
movl 0x60(%rbx), %eax
movl $0x11500, %ecx          # imm = 0x11500
cmpl %ecx, %eax
cmovll %eax, %ecx
movl %ecx, 0x54(%rbx)
jmp 0x5bdd
cmpl $0x6a, %eax
jl 0x5bc6
movq 0x8(%r14), %rcx
subq (%r14), %rcx
movl 0x18(%r14), %edx
cmpq %rdx, %rcx
je 0x5b5d
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
callq 0x62f8
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x62d4
movl (%r15), %eax
cmpl $0x6a, %eax
jl 0x5bc6
movq 0x8(%r14), %rcx
subq (%r14), %rcx
movl 0x18(%r14), %edx
cmpq %rdx, %rcx
je 0x5b7c
leaq 0x68(%rbx), %rsi
movq %r14, %rdi
callq 0x6312
movl 0x60(%rbx), %eax
cmpl $0xd1, %eax
jl 0x5bc6
movq 0x8(%r14), %rax
subq (%r14), %rax
movl 0x18(%r14), %ecx
cmpq %rcx, %rax
je 0x5bac
leaq 0x88(%rbx), %rsi
movq %r14, %rdi
callq 0x62c2
movl 0x60(%rbx), %eax
cmpl $0xd1, %eax
jl 0x5bc6
leaq 0xc636(%rip), %rsi      # 0x121e9
movq %rbx, %rdi
callq 0x4fa8
movq %rbx, %rdi
callq 0x5082
movl 0x60(%rbx), %eax
movl $0x11500, %ecx          # imm = 0x11500
cmpl %ecx, %eax
cmovll %eax, %ecx
movl %ecx, 0x2c(%rbx)
cmpl $0xd0, %eax
jg 0x5be5
movl %eax, 0x54(%rbx)
movq %rbx, %rdi
callq 0x6326
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc617(%rip), %rsi      # 0x12216
movq %r15, %rdi
callq 0x62b4
testb %al, %al
je 0x5be5
cmpq $0x0, 0x90(%rbx)
je 0x5be5
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
movq %r14, %rdi
callq 0x6380
xorl %edi, %edi
callq 0x33d0
movq %rax, %r14
movq 0x10(%rsp), %r15
movq 0x18(%rsp), %rax
subq %r15, %rax
pushq $0x28
popq %rcx
cqto
idivq %rcx
cmpq $0x2, %rax
jb 0x5c77
movq 0xa0(%rbx), %rcx
testq %rcx, %rcx
sete %dl
leaq 0x1(%r14), %rax
cmpq %rax, %rcx
setg %cl
orb %dl, %cl
cmpb $0x1, %cl
jne 0x5c77
movq %rax, 0xa0(%rbx)
leaq 0x258(%r14), %r13
leal -0x69780(%r14), %r12d
addq $-0x93a80, %r14         # imm = 0xFFF6C580
cmpq 0x18(%rsp), %r15
setne %bpl
je 0x5cfa
movl 0x20(%r15), %eax
cmpl $0x5f5e101, %eax        # imm = 0x5F5E101
setb %cl
movl %eax, %eax
cmpq %rax, %r13
setl %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x5cb9
movl %r12d, 0x20(%r15)
movq %r12, %rax
movq 0x90(%rbx), %rdi
cmpq %rax, %r14
jge 0x5cd4
movq %r15, %rsi
callq 0x6394
movq 0x90(%rbx), %rdi
addq $0x28, %r15
movq 0x8(%rdi), %rax
subq (%rdi), %rax
cqto
pushq $0x28
popq %rcx
idivq %rcx
cmpq $0x3e9, %rax            # imm = 0x3E9
jb 0x5c8c
movq $0x1, 0xa0(%rbx)
leaq 0x10(%rsp), %rdi
callq 0x695a
jmp 0x5be7
jmp 0x5d0b
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x695a
movq %rbx, %rdi
callq 0x3690