// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/gai.c
// Function: main
int main(int argc, char **argv)
{
    if (argc == 1) usage("host... -- display getaddrinfo results");

    struct addrinfo crap, *gaip = NULL, *aip,
           hint = { AI_NUMERICSERV | AI_CANONNAME, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP,
                    /*addrlen*/0, /*addr*/0, /*canonname*/0, /*next*/0 };

    while (*++argv) {
        gaip = &crap;
        int ret = getaddrinfo(*argv, 0, &hint, &gaip);
        if (ret)  {
            fprintf(stderr, "%s error:%d %s\n", *argv, ret, eainame[-ret]);
        } else if (gaip) {

            printf("%s %s\n", *argv, 
                    gaip->ai_canonname && strcmp(gaip->ai_canonname, *argv)
                        ? gaip->ai_canonname : "");

            for (aip = gaip; aip; aip = aip->ai_next) {
                IPSTR    ip = {};
                inet_ntop(aip->ai_family, 
                            aip->ai_family == AF_INET6 
                                ? (void*)&((struct sockaddr_in6*)aip->ai_addr)->sin6_addr
                                : (void*)&((struct sockaddr_in *)aip->ai_addr)->sin_addr, 
                            ip, sizeof(ip));
                printf("\t%s\n", ip);
            }

            freeaddrinfo(gaip);
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
cmpl $0x1, %edi
je 0x354f
movq %rsi, %r14
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rcx
movaps %xmm0, (%rcx)
movaps %xmm0, 0x20(%rcx)
movaps %xmm0, 0x10(%rcx)
movl $0x402, (%rcx)          # imm = 0x402
movabsq $0x600000001, %rax      # imm = 0x600000001
movq %rax, 0x8(%rcx)
movq %rsp, %rbx
leaq 0x10(%rsp), %r13
pushq $0x2e
popq %rbp
leaq 0x1c19(%rip), %r12      # 0x503b
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x353b
addq $0x8, %r14
leaq 0x78(%rsp), %rax
movq %rax, (%rsp)
xorl %esi, %esi
leaq 0x40(%rsp), %rdx
movq %rbx, %rcx
callq 0x31b0
testl %eax, %eax
jne 0x3507
movq (%rsp), %rax
testq %rax, %rax
leaq 0x1bde(%rip), %rcx      # 0x503f
je 0x3422
movq %r14, 0x8(%rsp)
movq (%r14), %r14
movq 0x20(%rax), %r15
movq %rcx, %rdx
testq %r15, %r15
je 0x348e
movq %rcx, %rbx
movq %r15, %rdi
movq %r14, %rsi
callq 0x31f0
testl %eax, %eax
cmoveq %rbx, %r15
movq %r15, %rdx
leaq 0x1bb2(%rip), %rdi      # 0x5047
movq %r14, %rsi
xorl %eax, %eax
callq 0x3040
movq %rsp, %rbx
movq %rbx, %r14
movq (%r14), %r14
testq %r14, %r14
je 0x34f4
xorps %xmm0, %xmm0
movups %xmm0, 0x2e(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl 0x4(%r14), %edi
xorl %eax, %eax
cmpl $0xa, %edi
sete %al
movq 0x18(%r14), %rcx
leaq (%rcx,%rax,4), %rsi
addq $0x4, %rsi
movq %r13, %rdx
movl %ebp, %ecx
callq 0x3130
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x3040
addq $0x28, %r14
jmp 0x34a5
movq (%rsp), %rdi
callq 0x31c0
movq 0x8(%rsp), %r14
jmp 0x3422
movq 0x4ad2(%rip), %rcx      # 0x7fe0
movq (%rcx), %rdi
movq (%r14), %rdx
movl %eax, %ecx
negl %ecx
movslq %ecx, %rcx
leaq 0x519e(%rip), %rsi      # 0x86c0
movq (%rsi,%rcx,8), %r8
leaq 0x1afe(%rip), %rsi      # 0x502b
movl %eax, %ecx
xorl %eax, %eax
callq 0x3200
jmp 0x3422
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4a8a(%rip), %rax      # 0x7fe0
movq (%rax), %rbx
callq 0x3db1
leaq 0x1adb(%rip), %rsi      # 0x5040
leaq 0x1a98(%rip), %rcx      # 0x5004
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3200
pushq $0x2
popq %rdi
callq 0x3240
nopl (%rax)