// File: /workspace/github_cpp_makefile_star2_O2/tenup-coin[P]seeder/netbase.cpp
// Function: CNetAddr::GetGroup() const
std::vector<unsigned char> CNetAddr::GetGroup() const
{
    std::vector<unsigned char> vchRet;
    int nClass = NET_IPV6;
    int nStartByte = 0;
    int nBits = 16;

    // all local addresses belong to the same group
    if (IsLocal())
    {
        nClass = 255;
        nBits = 0;
    }

    // all unroutable addresses belong to the same group
    if (!IsRoutable())
    {
        nClass = NET_UNROUTABLE;
        nBits = 0;
    }
    // for IPv4 addresses, '1' + the 16 higher-order bits of the IP
    // includes mapped IPv4, SIIT translated IPv4, and the well-known prefix
    else if (IsIPv4() || IsRFC6145() || IsRFC6052())
    {
        nClass = NET_IPV4;
        nStartByte = 12;
    }
    // for 6to4 tunnelled addresses, use the encapsulated IPv4 address
    else if (IsRFC3964())
    {
        nClass = NET_IPV4;
        nStartByte = 2;
    }
    // for Teredo-tunnelled IPv6 addresses, use the encapsulated IPv4 address
    else if (IsRFC4380())
    {
        vchRet.push_back(NET_IPV4);
        vchRet.push_back(GetByte(3) ^ 0xFF);
        vchRet.push_back(GetByte(2) ^ 0xFF);
        return vchRet;
    }
    else if (IsTor())
    {
        nClass = NET_TOR;
        nStartByte = 6;
        nBits = 4;
    }
    else if (IsI2P())
    {
        nClass = NET_I2P;
        nStartByte = 6;
        nBits = 4;
    }
    // for he.net, use /36 groups
    else if (GetByte(15) == 0x20 && GetByte(14) == 0x11 && GetByte(13) == 0x04 && GetByte(12) == 0x70)
        nBits = 36;
    // for the rest of the IPv6 network, use /32 groups
    else
        nBits = 32;

    vchRet.push_back(nClass);
    while (nBits >= 8)
    {
        vchRet.push_back(GetByte(15 - nStartByte));
        nStartByte++;
        nBits -= 8;
    }
    if (nBits > 0)
        vchRet.push_back(GetByte(15 - nStartByte) | ((1 << nBits) - 1));

    return vchRet;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq %rsi, %rdi
callq 0x8522
movl %eax, %ebp
movq %r14, %rdi
callq 0x857a
xorl %r15d, %r15d
testb %al, %al
je 0x87f6
movl %ebp, %eax
xorb $0x1, %al
movzbl %al, %r12d
shll $0x4, %r12d
movq %r14, %rdi
callq 0x8392
pushq $0xc
popq %r13
movb $0x1, %r15b
testb %al, %al
jne 0x87fc
movq %r14, %rdi
callq 0x84ec
testb %al, %al
jne 0x87fc
movq %r14, %rdi
callq 0x84a2
testb %al, %al
jne 0x87fc
movb (%r14), %r13b
movb 0x1(%r14), %cl
xorb $0x20, %r13b
movl %ecx, %eax
xorb $0x2, %al
orb %r13b, %al
jne 0x8868
pushq $0x2
popq %r13
jmp 0x87fc
xorl %r13d, %r13d
xorl %r12d, %r12d
leaq 0x4(%rsp), %rsi
movb %r15b, (%rsi)
movq %rbx, %rdi
callq 0x9706
movl %r13d, %ebp
movl %r12d, %r13d
shrl $0x3, %r13d
addq %rbp, %r13
leaq 0x2(%rsp), %r15
cmpq %rbp, %r13
je 0x883b
movb (%r14,%rbp), %al
movb %al, 0x2(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9706
incq %rbp
jmp 0x881e
testb $0x4, %r12b
je 0x8856
movb (%r14,%r13), %al
orb $0xf, %al
leaq 0x3(%rsp), %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0x9706
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb %cl, 0x1(%rsp)
movq %r14, %rdi
callq 0x84ba
testb %al, %al
je 0x88b4
leaq 0x7(%rsp), %rsi
movb $0x1, (%rsi)
movq %rbx, %rdi
callq 0x9706
movb 0xc(%r14), %al
notb %al
leaq 0x6(%rsp), %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0x9706
movb 0xd(%r14), %al
notb %al
leaq 0x5(%rsp), %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0x9706
jmp 0x8856
movb %r13b, (%rsp)
movq %r14, %rdi
callq 0x83d4
pushq $0x4
popq %r12
pushq $0x6
popq %r13
movb $0x3, %r15b
testb %al, %al
jne 0x87fc
movq %r14, %rdi
callq 0x83ec
movb $0x4, %r15b
testb %al, %al
jne 0x87fc
movb 0x1(%rsp), %al
xorb $0x11, %al
movb (%rsp), %dl
orb %al, %dl
movb 0x2(%r14), %al
movb 0x3(%r14), %cl
xorb $0x4, %al
orb %dl, %al
xorb $0x70, %cl
xorl %edx, %edx
orb %al, %cl
sete %dl
leal 0x20(,%rdx,4), %r12d
negb %bpl
orb $0x2, %bpl
movl %ebp, %r15d
xorl %r13d, %r13d
jmp 0x87fc
jmp 0x892b
jmp 0x892b
jmp 0x892b
jmp 0x892b
jmp 0x892b
movq %rax, %r14
movq %rbx, %rdi
callq 0x96f8
movq %r14, %rdi
callq 0x3690