// File: /workspace/github_c_makefile_star2_O3/janet-lang[P]janet/src/core/net.c
// Function: janet_get_addrinfo
static struct addrinfo *janet_get_addrinfo(Janet *argv, int32_t offset, int socktype, int passive, int *is_unix, socklen_t *sizeout) {
    /* Unix socket support - not yet supported on windows. */
#ifndef JANET_WINDOWS
    if (janet_keyeq(argv[offset], "unix")) {
        const char *path = janet_getcstring(argv, offset + 1);
        struct sockaddr_un *saddr = janet_calloc(1, sizeof(struct sockaddr_un));
        if (saddr == NULL) {
            JANET_OUT_OF_MEMORY;
        }
        saddr->sun_family = AF_UNIX;
        size_t path_size = sizeof(saddr->sun_path);
        snprintf(saddr->sun_path, path_size, "%s", path);
        *sizeout = sizeof(struct sockaddr_un);
#ifdef JANET_LINUX
        if (path[0] == '@') {
            saddr->sun_path[0] = '\0';
            *sizeout = offsetof(struct sockaddr_un, sun_path) + janet_string_length(path);
        }
#endif
        *is_unix = 1;
        return (struct addrinfo *) saddr;
    }
#endif
    /* Get host and port */
    char *host = (char *)janet_getcstring(argv, offset);
    char *port = NULL;
    if (janet_checkint(argv[offset + 1])) {
        port = (char *)janet_to_string(argv[offset + 1]);
    } else {
        port = (char *)janet_optcstring(argv, offset + 2, offset + 1, NULL);
    }
    /* getaddrinfo */
    struct addrinfo *ai = NULL;
    struct addrinfo hints;
    memset(&hints, 0, sizeof(hints));
    hints.ai_family = AF_UNSPEC;
    hints.ai_socktype = socktype;
    hints.ai_flags = passive ? AI_PASSIVE : 0;
    int status = getaddrinfo(host, port, &hints, &ai);
    if (status) {
        janet_panicf("could not get address info: %s", gai_strerror(status));
    }
    *is_unix = 0;
#ifdef JANET_WINDOWS
    *sizeout = 0;
#else
    *sizeout = sizeof(struct sockaddr_un);
#endif
    return ai;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r14
movq %rcx, %rbx
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %r13
movq (%rdi), %rdi
leaq 0x2e633(%rip), %rsi     # 0x627b0
callq 0x19331
testl %eax, %eax
je 0x341ff
movq %r13, %rdi
movl $0x1, %esi
callq 0x19817
movq %rax, %r12
movl $0x1, %edi
movl $0x6e, %esi
callq 0x125a0
testq %rax, %rax
je 0x34298
movq %rax, %r15
movw $0x1, (%rax)
movq %rax, %r13
addq $0x2, %r13
leaq 0x33e4e(%rip), %rdx     # 0x68012
movl $0x6c, %esi
movq %r13, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x12390
movl $0x6e, (%r14)
cmpb $0x40, (%r12)
jne 0x341f4
movb $0x0, (%r13)
movl -0x8(%r12), %eax
addl $0x2, %eax
movl %eax, (%r14)
movl $0x1, (%rbx)
jmp 0x34286
movq %r13, %rdi
xorl %esi, %esi
callq 0x19817
movq %rax, -0x30(%rbp)
movq 0x8(%r13), %rdi
callq 0x49912
testl %eax, %eax
je 0x34225
movq 0x8(%r13), %rdi
callq 0x3ed51
jmp 0x34239
movq %r13, %rdi
movl $0x2, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x197f0
leaq -0x38(%rbp), %rcx
movq $0x0, (%rcx)
xorps %xmm0, %xmm0
leaq -0x70(%rbp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x20(%rdx)
movaps %xmm0, 0x10(%rdx)
movl %r12d, 0x8(%rdx)
xorl %esi, %esi
testl %r15d, %r15d
setne %sil
movl %esi, (%rdx)
movq -0x30(%rbp), %rdi
movq %rax, %rsi
callq 0x12b10
testl %eax, %eax
jne 0x3429d
movl $0x0, (%rbx)
movl $0x6e, (%r14)
movq -0x38(%rbp), %r15
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x13c50
movl %eax, %edi
callq 0x123c0
leaq 0x2e50a(%rip), %rdi     # 0x627b5
movq %rax, %rsi
xorl %eax, %eax
callq 0x190bb