// File: /workspace/github_c_makefile_star2_O1/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, 0xa4fc3(%rip)     # 0xca0b8
jne 0x25102
movq $0x0, 0xa4f36(%rip) # 0xca038
xorl %ebp, %ebp
leaq 0xa5085(%rip), %r12     # 0xca190
leaq 0xa4e96(%rip), %rax     # 0xc9fa8
movq 0x90(%rax,%rbp,8), %r13
testq %r13, %r13
je 0x25146
movq %r13, %rdi
movl $0x3a, %esi
callq 0x1f790
movl 0xa4f02(%rip), %ecx     # 0xca034
movq %r12, %rdi
movl %ebx, %esi
movq %r13, %rdx
testq %rax, %rax
je 0x251ac
callq 0x21abf
jmp 0x251b1
movl 0xa4ee8(%rip), %ecx     # 0xca034
movq %r12, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x21abf
movslq (%r14), %rcx
movl %eax, (%r15,%rcx,4)
movslq (%r14), %rax
movl (%r15,%rax,4), %esi
cmpl $-0x1, %esi
je 0x25175
xorl %edi, %edi
callq 0x21120
incl (%r14)
movl 0xa4eb9(%rip), %ecx     # 0xca034
movq %r12, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x21940
movslq (%r14), %rcx
movl %eax, (%r15,%rcx,4)
movslq (%r14), %rax
movl (%r15,%rax,4), %esi
cmpl $-0x1, %esi
je 0x251a4
xorl %edi, %edi
callq 0x21120
incl (%r14)
cmpl $0x0, (%r14)
je 0x251b8
jmp 0x25227
callq 0x21940
movslq (%r14), %rcx
movl %eax, (%r15,%rcx,4)
movslq (%r14), %rax
movl (%r15,%rax,4), %esi
cmpl $-0x1, %esi
je 0x251e6
xorl %r13d, %r13d
xorl %edi, %edi
callq 0x21120
incl (%r14)
incq %rbp
movslq 0xa4edd(%rip), %rax     # 0xca0b8
cmpq %rax, %rbp
jl 0x2510b
jmp 0x2522a
leaq 0xa4dbb(%rip), %rax     # 0xc9fa8
movq 0x90(%rax,%rbp,8), %rax
testq %rax, %rax
leaq 0x6f635(%rip), %rdx     # 0x94834
cmovneq %rax, %rdx
leaq 0x6fdc4(%rip), %rsi     # 0x94fce
leaq 0xa4f7f(%rip), %r8      # 0xca190
movl $0x3, %edi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x23064
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x2522a
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq