// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/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) {
            /* 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)++;
            }
            fds[*count] = anetTcpServer(server.neterr,port,NULL,
                server.tcp_backlog);
            if (fds[*count] != ANET_ERR) {
                anetNonBlock(NULL,fds[*count]);
                (*count)++;
            }
            /* Exit the loop if we were able to bind * on IPv4 or IPv6,
             * otherwise fds[*count] will be ANET_ERR and we'll print an
             * error and return to the caller with an error. */
            if (*count) 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, 0x53844(%rip)     # 0x6f1c8
jne 0x1b991
movq $0x0, 0x537b7(%rip) # 0x6f148
xorl %ebp, %ebp
leaq 0x53906(%rip), %r12     # 0x6f2a0
leaq 0x536e7(%rip), %rax     # 0x6f088
movq 0xc0(%rax,%rbp,8), %r13
testq %r13, %r13
je 0x1b9d5
movq %r13, %rdi
movl $0x3a, %esi
callq 0x122b0
movl 0x5377f(%rip), %ecx     # 0x6f140
movq %r12, %rdi
movl %ebx, %esi
movq %r13, %rdx
testq %rax, %rax
je 0x1ba3b
callq 0x18246
jmp 0x1ba40
movl 0x53765(%rip), %ecx     # 0x6f140
movq %r12, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x18246
movslq (%r14), %rcx
movl %eax, (%r15,%rcx,4)
movslq (%r14), %rax
movl (%r15,%rax,4), %esi
cmpl $-0x1, %esi
je 0x1ba04
xorl %edi, %edi
callq 0x178ed
incl (%r14)
movl 0x53736(%rip), %ecx     # 0x6f140
movq %r12, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x180c7
movslq (%r14), %rcx
movl %eax, (%r15,%rcx,4)
movslq (%r14), %rax
movl (%r15,%rax,4), %esi
cmpl $-0x1, %esi
je 0x1ba33
xorl %edi, %edi
callq 0x178ed
incl (%r14)
cmpl $0x0, (%r14)
je 0x1ba47
jmp 0x1bab6
callq 0x180c7
movslq (%r14), %rcx
movl %eax, (%r15,%rcx,4)
movslq (%r14), %rax
movl (%r15,%rax,4), %esi
cmpl $-0x1, %esi
je 0x1ba75
xorl %r13d, %r13d
xorl %edi, %edi
callq 0x178ed
incl (%r14)
incq %rbp
movslq 0x5375e(%rip), %rax     # 0x6f1c8
cmpq %rax, %rbp
jl 0x1b99a
jmp 0x1bab9
leaq 0x5360c(%rip), %rax     # 0x6f088
movq 0xc0(%rax,%rbp,8), %rax
testq %rax, %rax
leaq 0x3744f(%rip), %rdx     # 0x52edd
cmovneq %rax, %rdx
leaq 0x37415(%rip), %rsi     # 0x52eae
leaq 0x53800(%rip), %r8      # 0x6f2a0
movl $0x3, %edi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x19fb1
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x1bab9
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq