// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/redis.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) {
            redisLog(REDIS_WARNING,
                "Creating Server TCP listening socket %s:%d: %s",
                server.bindaddr[j] ? server.bindaddr[j] : "*",
                port, server.neterr);
            return REDIS_ERR;
        }
        anetNonBlock(NULL,fds[*count]);
        (*count)++;
    }
    return REDIS_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, 0xa4dc4(%rip)     # 0xca0b8
jne 0x25301
movq $0x0, 0xa4d37(%rip) # 0xca038
xorl %ebp, %ebp
leaq 0xa4e86(%rip), %r12     # 0xca190
leaq 0xa4c97(%rip), %rax     # 0xc9fa8
movq 0x90(%rax,%rbp,8), %r13
testq %r13, %r13
je 0x25345
movq %r13, %rdi
movl $0x3a, %esi
callq 0x1f790
movl 0xa4d03(%rip), %ecx     # 0xca034
movq %r12, %rdi
movl %ebx, %esi
movq %r13, %rdx
testq %rax, %rax
je 0x253ae
callq 0x21cd5
jmp 0x253b3
movl 0xa4ce9(%rip), %ecx     # 0xca034
movq %r12, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x21cd5
movslq (%r14), %rcx
movl %eax, (%r15,%rcx,4)
movslq (%r14), %rax
movl (%r15,%rax,4), %esi
cmpl $-0x1, %esi
je 0x25374
xorl %edi, %edi
callq 0x21374
incl (%r14)
movl 0xa4cba(%rip), %ecx     # 0xca034
movq %r12, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x21b51
movslq (%r14), %rcx
movl %eax, (%r15,%rcx,4)
movslq (%r14), %rax
movl (%r15,%rax,4), %esi
cmpl $-0x1, %esi
je 0x253a8
xorl %edi, %edi
callq 0x21374
movl (%r14), %eax
incl %eax
movl %eax, (%r14)
testl %eax, %eax
je 0x253ba
jmp 0x25429
callq 0x21b51
movslq (%r14), %rcx
movl %eax, (%r15,%rcx,4)
movslq (%r14), %rax
movl (%r15,%rax,4), %esi
cmpl $-0x1, %esi
je 0x253e8
xorl %r13d, %r13d
xorl %edi, %edi
callq 0x21374
incl (%r14)
incq %rbp
movslq 0xa4cdb(%rip), %rax     # 0xca0b8
cmpq %rax, %rbp
jl 0x2530a
jmp 0x2542c
leaq 0xa4bb9(%rip), %rax     # 0xc9fa8
movq 0x90(%rax,%rbp,8), %rax
testq %rax, %rax
leaq 0x6f483(%rip), %rdx     # 0x94884
cmovneq %rax, %rdx
leaq 0x6fc12(%rip), %rsi     # 0x9501e
leaq 0xa4d7d(%rip), %r8      # 0xca190
movl $0x3, %edi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x23223
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x2542c
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq