// File: /workspace/github_cpp_makefile_star2_O1/tenup-coin[P]seeder/netbase.cpp
// Function: CNetAddr::GetReachabilityFrom(CNetAddr const*) const
int CNetAddr::GetReachabilityFrom(const CNetAddr *paddrPartner) const
{
    enum Reachability {
        REACH_UNREACHABLE,
        REACH_DEFAULT,
        REACH_TEREDO,
        REACH_IPV6_WEAK,
        REACH_IPV4,
        REACH_IPV6_STRONG,
        REACH_PRIVATE
    };

    if (!IsRoutable())
        return REACH_UNREACHABLE;

    int ourNet = GetExtNetwork(this);
    int theirNet = GetExtNetwork(paddrPartner);
    bool fTunnel = IsRFC3964() || IsRFC6052() || IsRFC6145();

    switch(theirNet) {
    case NET_IPV4:
        switch(ourNet) {
        default:       return REACH_DEFAULT;
        case NET_IPV4: return REACH_IPV4;
        }
    case NET_IPV6:
        switch(ourNet) {
        default:         return REACH_DEFAULT;
        case NET_TEREDO: return REACH_TEREDO;
        case NET_IPV4:   return REACH_IPV4;
        case NET_IPV6:   return fTunnel ? REACH_IPV6_WEAK : REACH_IPV6_STRONG; // only prefer giving our IPv6 address if it's not tunnelled
        }
    case NET_TOR:
        switch(ourNet) {
        default:         return REACH_DEFAULT;
        case NET_IPV4:   return REACH_IPV4; // Tor users can connect to IPv4 as well
        case NET_TOR:    return REACH_PRIVATE;
        }
    case NET_I2P:
        switch(ourNet) {
        default:         return REACH_DEFAULT;
        case NET_I2P:    return REACH_PRIVATE;
        }
    case NET_TEREDO:
        switch(ourNet) {
        default:          return REACH_DEFAULT;
        case NET_TEREDO:  return REACH_TEREDO;
        case NET_IPV6:    return REACH_IPV6_WEAK;
        case NET_IPV4:    return REACH_IPV4;
        }
    case NET_UNKNOWN:
    case NET_UNROUTABLE:
    default:
        switch(ourNet) {
        default:          return REACH_DEFAULT;
        case NET_TEREDO:  return REACH_TEREDO;
        case NET_IPV6:    return REACH_IPV6_WEAK;
        case NET_IPV4:    return REACH_IPV4;
        case NET_I2P:     return REACH_PRIVATE; // assume connections from unroutable addresses are
        case NET_TOR:     return REACH_PRIVATE; // either from Tor/I2P, or don't care about our address
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
callq 0x9596
movl %eax, %ecx
xorl %eax, %eax
testb %cl, %cl
je 0x9c4b
movq %r14, %rdi
callq 0x9c58
movl %eax, %ebx
movq %r15, %rdi
callq 0x9c58
movl %eax, %ecx
cmpb $0x20, (%r14)
movl $0x3, %eax
jne 0x9b88
cmpb $0x2, 0x1(%r14)
je 0x9bb2
movl $0x9bff6400, %edx       # imm = 0x9BFF6400
xorq (%r14), %rdx
movl 0x8(%r14), %esi
orq %rdx, %rsi
je 0x9bb2
movl 0x8(%r14), %eax
xorq $0xffff, %rax           # imm = 0xFFFF
xorl %edx, %edx
orq (%r14), %rax
setne %dl
leal 0x3(,%rdx,2), %eax
decl %ecx
cmpl $0x5, %ecx
ja 0x9bd8
leaq 0x96f0(%rip), %rdx      # 0x132b0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
xorl %eax, %eax
cmpl $0x1, %ebx
sete %al
leal (%rax,%rax,2), %eax
incl %eax
jmp 0x9c4b
decl %ebx
movl $0x1, %eax
cmpl $0x6, %ebx
jae 0x9c4b
movl %ebx, %eax
leaq 0x974b(%rip), %rcx      # 0x13338
jmp 0x9c48
xorl %eax, %eax
cmpl $0x3, %ebx
sete %al
leal (%rax,%rax,4), %ecx
incl %ecx
cmpl $0x1, %ebx
movl $0x4, %eax
cmovnel %ecx, %eax
jmp 0x9c4b
cmpl $0x1, %ebx
je 0x9c51
cmpl $0x2, %ebx
je 0x9c4b
movl $0x1, %eax
cmpl $0x6, %ebx
jne 0x9c4b
movl $0x2, %eax
jmp 0x9c4b
xorl %eax, %eax
cmpl $0x4, %ebx
sete %al
leal (%rax,%rax,4), %eax
incl %eax
jmp 0x9c4b
decl %ebx
movl $0x1, %eax
cmpl $0x6, %ebx
jae 0x9c4b
movl %ebx, %eax
leaq 0x96d8(%rip), %rcx      # 0x13320
movl (%rcx,%rax,4), %eax
popq %rbx
popq %r14
popq %r15
retq
movl $0x4, %eax
jmp 0x9c4b