// File: /workspace/github_cpp_makefile_star2_O1/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)
movq $0x0, 0x10(%rdi)
movq %rsi, %rdi
callq 0x9538
movl %eax, %ebp
movq %r14, %rdi
callq 0x9596
xorl %ecx, %ecx
testb %al, %al
je 0x9926
movl %ebp, %eax
xorb $0x1, %al
movzbl %al, %r12d
shll $0x4, %r12d
movl $0x9bff6400, %eax       # imm = 0x9BFF6400
movl 0x8(%r14), %ecx
leaq 0x63ff9c00(%rax), %rdx
xorq %rcx, %rdx
movl $0xc, %r13d
movb $0x1, %cl
orq (%r14), %rdx
je 0x992c
movl 0x8(%r14), %edx
xorq $0xffff, %rdx           # imm = 0xFFFF
orq (%r14), %rdx
je 0x992c
xorq (%r14), %rax
movl 0x8(%r14), %edx
orq %rax, %rdx
je 0x992c
movb (%r14), %sil
movb 0x1(%r14), %dl
movl %esi, %eax
xorb $0x20, %al
movl %edx, %edi
xorb $0x2, %dil
movl $0x2, %r13d
orb %al, %dil
je 0x992c
movb 0x2(%r14), %cl
cmpb $0x20, %sil
jne 0x99e1
cmpb $0x1, %dl
jne 0x99e1
testb %cl, %cl
jne 0x99e1
cmpb $0x0, 0x3(%r14)
jne 0x99e1
leaq 0x7(%rsp), %rsi
movb $0x1, (%rsi)
movq %rbx, %rdi
callq 0xa548
movb 0xc(%r14), %al
notb %al
leaq 0x6(%rsp), %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0xa548
movb 0xd(%r14), %al
notb %al
leaq 0x5(%rsp), %rsi
movb %al, (%rsi)
movq %rbx, %rdi
callq 0xa548
jmp 0x99cf
xorl %r13d, %r13d
xorl %r12d, %r12d
movb %cl, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x9942
movb %cl, (%rsi)
incq 0x8(%rbx)
jmp 0x994f
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0xa968
cmpl $0x8, %r12d
jb 0x9995
movl %r13d, %r13d
leaq 0x3(%rsp), %r15
movb (%r14,%r13), %al
movb %al, 0x3(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x9977
movb %al, (%rsi)
incq 0x8(%rbx)
jmp 0x9982
movq %rbx, %rdi
movq %r15, %rdx
callq 0xa968
incq %r13
leal -0x8(%r12), %ecx
cmpl $0xf, %r12d
movl %ecx, %r12d
jg 0x995d
jmp 0x9998
movl %r12d, %ecx
testl %ecx, %ecx
jle 0x99cf
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
movl %r13d, %ecx
notb %al
orb (%r14,%rcx), %al
movb %al, 0x2(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x99c2
movb %al, (%rsi)
incq 0x8(%rbx)
jmp 0x99cf
leaq 0x2(%rsp), %rdx
movq %rbx, %rdi
callq 0xa968
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x7ed887fd, %esi       # imm = 0x7ED887FD
xorl (%r14), %esi
movzwl 0x4(%r14), %edi
xorl $0x43eb, %edi           # imm = 0x43EB
movl $0x4, %r12d
movl $0x6, %r13d
orl %esi, %edi
je 0x9a4b
movl $0x4ddb60fd, %esi       # imm = 0x4DDB60FD
xorl (%r14), %esi
movzwl 0x4(%r14), %edi
xorl $0xb5dd, %edi           # imm = 0xB5DD
orl %esi, %edi
je 0x9a52
xorb $0x11, %dl
orb %dl, %al
xorb $0x4, %cl
orb %al, %cl
movb 0x3(%r14), %al
xorb $0x70, %al
xorl %edx, %edx
orb %cl, %al
sete %dl
leal 0x20(,%rdx,4), %r12d
negb %bpl
orb $0x2, %bpl
movl %ebp, %ecx
xorl %r13d, %r13d
jmp 0x992c
movb $0x3, %cl
jmp 0x992c
movb $0x4, %cl
jmp 0x992c
jmp 0x9a63
jmp 0x9a63
jmp 0x9a63
jmp 0x9a63
jmp 0x9a63
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x9a73
callq 0x33d0
movq %r14, %rdi
callq 0x3650
nop