// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/server.c
// Function: listenToPort
int listenToPort(int port, int *fds, int *count) {
    int j;

    /* Force binding of 0.0.0.0 if no bind address is specified, always
     * entering the loop if j == 0. */
    if (server.bindaddr_count == 0) server.bindaddr[0] = NULL;
    for (j = 0; j < server.bindaddr_count || j == 0; j++) {
        if (server.bindaddr[j] == NULL) {
            int unsupported = 0;
            /* Bind * for both IPv6 and IPv4, we enter here only if
             * server.bindaddr_count == 0. */
            fds[*count] = anetTcp6Server(server.neterr,port,NULL,
                server.tcp_backlog);
            if (fds[*count] != ANET_ERR) {
                anetNonBlock(NULL,fds[*count]);
                (*count)++;
            } else if (errno == EAFNOSUPPORT) {
                unsupported++;
                serverLog(LL_WARNING,"Not listening to IPv6: unsupproted");
            }

            if (*count == 1 || unsupported) {
                /* Bind the IPv4 address as well. */
                fds[*count] = anetTcpServer(server.neterr,port,NULL,
                    server.tcp_backlog);
                if (fds[*count] != ANET_ERR) {
                    anetNonBlock(NULL,fds[*count]);
                    (*count)++;
                } else if (errno == EAFNOSUPPORT) {
                    unsupported++;
                    serverLog(LL_WARNING,"Not listening to IPv4: unsupproted");
                }
            }
            /* Exit the loop if we were able to bind * on IPv4 and IPv6,
             * otherwise fds[*count] will be ANET_ERR and we'll print an
             * error and return to the caller with an error. */
            if (*count + unsupported == 2) break;
        } else if (strchr(server.bindaddr[j],':')) {
            /* Bind IPv6 address. */
            fds[*count] = anetTcp6Server(server.neterr,port,server.bindaddr[j],
                server.tcp_backlog);
        } else {
            /* Bind IPv4 address. */
            fds[*count] = anetTcpServer(server.neterr,port,server.bindaddr[j],
                server.tcp_backlog);
        }
        if (fds[*count] == ANET_ERR) {
            serverLog(LL_WARNING,
                "Creating Server TCP listening socket %s:%d: %s",
                server.bindaddr[j] ? server.bindaddr[j] : "*",
                port, server.neterr);
            return C_ERR;
        }
        anetNonBlock(NULL,fds[*count]);
        (*count)++;
    }
    return C_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebx
cmpl $0x0, 0xcf61b(%rip)     # 0x1019d0
jne 0x323c2
movq $0x0, 0xcf58e(%rip) # 0x101950
leaq 0xcf4df(%rip), %r12     # 0x1018a8
xorl %r13d, %r13d
movq 0xa8(%r12,%r13,8), %rbp
testq %rbp, %rbp
je 0x32404
movq %rbp, %rdi
movl $0x3a, %esi
callq 0x267f0
movl 0xcf560(%rip), %ecx     # 0x10194c
leaq 0xcf6bd(%rip), %rdi     # 0x101ab0
movl %ebx, %esi
movq %rbp, %rdx
testq %rax, %rax
je 0x3243f
callq 0x2e067
jmp 0x32444
movl 0xcf542(%rip), %ecx     # 0x10194c
leaq 0xcf69f(%rip), %rdi     # 0x101ab0
movl %ebx, %esi
xorl %edx, %edx
callq 0x2e067
movslq (%r14), %rcx
movl %eax, (%r15,%rcx,4)
movslq (%r14), %r12
movl (%r15,%r12,4), %esi
cmpl $-0x1, %esi
je 0x32450
xorl %edi, %edi
callq 0x2d6a1
movl (%r14), %r12d
incl %r12d
movl %r12d, (%r14)
jmp 0x32474
callq 0x2ded1
movslq (%r14), %rcx
movl %eax, (%r15,%rcx,4)
jmp 0x324e9
callq 0x26880
cmpl $0x61, (%rax)
jne 0x32474
movl $0x3, %edi
leaq 0x8afbf(%rip), %rsi     # 0xbd425
xorl %eax, %eax
callq 0x2fdad
movl $0x1, %ebp
jmp 0x3247c
xorl %ebp, %ebp
cmpl $0x1, %r12d
jne 0x324d9
movl 0xcf4ca(%rip), %ecx     # 0x10194c
leaq 0xcf627(%rip), %rdi     # 0x101ab0
movl %ebx, %esi
xorl %edx, %edx
callq 0x2ded1
movslq (%r14), %rcx
movl %eax, (%r15,%rcx,4)
movslq (%r14), %r12
movl (%r15,%r12,4), %esi
cmpl $-0x1, %esi
je 0x324b7
xorl %edi, %edi
callq 0x2d6a1
movl (%r14), %r12d
incl %r12d
movl %r12d, (%r14)
jmp 0x324d9
callq 0x26880
cmpl $0x61, (%rax)
jne 0x324d9
incl %ebp
movl $0x3, %edi
leaq 0x8af79(%rip), %rsi     # 0xbd448
xorl %eax, %eax
callq 0x2fdad
movl (%r14), %r12d
addl %ebp, %r12d
cmpl $0x2, %r12d
leaq 0xcf3c1(%rip), %r12     # 0x1018a8
je 0x3254f
movslq (%r14), %rax
movl (%r15,%rax,4), %esi
cmpl $-0x1, %esi
je 0x32516
xorl %ebp, %ebp
xorl %edi, %edi
callq 0x2d6a1
incl (%r14)
incq %r13
movslq 0xcf4c5(%rip), %rax     # 0x1019d0
cmpq %rax, %r13
jl 0x323cc
jmp 0x32551
movq 0xa8(%r12,%r13,8), %rax
testq %rax, %rax
leaq 0x8a6d3(%rip), %rdx     # 0xbcbfb
cmovneq %rax, %rdx
leaq 0x8af38(%rip), %rsi     # 0xbd46b
leaq 0xcf576(%rip), %r8      # 0x101ab0
movl $0x3, %edi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x2fdad
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x32551
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq