// File: /workspace/github_c_makefile_star2_O2/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, %r15
movq %rsi, %r12
movl %edi, %ebx
movl 0xa2cef(%rip), %eax     # 0xc70b8
testl %eax, %eax
jne 0x243d5
andq $0x0, 0xa2c63(%rip)     # 0xc7038
leaq 0xa2db4(%rip), %r13     # 0xc7190
xorl %ebp, %ebp
testq %rbp, %rbp
je 0x243ee
cltq
cmpq %rax, %rbp
jge 0x244c0
leaq 0xa2bb3(%rip), %rax     # 0xc6fa8
movq 0x90(%rax,%rbp,8), %r14
testq %r14, %r14
je 0x24427
movq %r14, %rdi
pushq $0x3a
popq %rsi
callq 0x1f790
movl 0xa2c21(%rip), %ecx     # 0xc7034
movq %r13, %rdi
movl %ebx, %esi
movq %r14, %rdx
testq %rax, %rax
je 0x24490
callq 0x2127f
jmp 0x24495
movl 0xa2c07(%rip), %ecx     # 0xc7034
movq %r13, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x2127f
movslq (%r15), %rcx
movl %eax, (%r12,%rcx,4)
movslq (%r15), %rax
movl (%r12,%rax,4), %esi
cmpl $-0x1, %esi
je 0x24456
xorl %edi, %edi
callq 0x209a0
incl (%r15)
movl 0xa2bd8(%rip), %ecx     # 0xc7034
movq %r13, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x21111
movslq (%r15), %rcx
movl %eax, (%r12,%rcx,4)
movslq (%r15), %rax
movl (%r12,%rax,4), %esi
cmpl $-0x1, %esi
je 0x2448a
xorl %edi, %edi
callq 0x209a0
movl (%r15), %eax
incl %eax
movl %eax, (%r15)
testl %eax, %eax
je 0x2449c
jmp 0x244c0
callq 0x21111
movslq (%r15), %rcx
movl %eax, (%r12,%rcx,4)
movslq (%r15), %rax
movl (%r12,%rax,4), %esi
cmpl $-0x1, %esi
je 0x244c4
xorl %edi, %edi
callq 0x209a0
incl (%r15)
incq %rbp
movl 0xa2bfd(%rip), %eax     # 0xc70b8
jmp 0x243de
xorl %eax, %eax
jmp 0x244fe
leaq 0xa2add(%rip), %rax     # 0xc6fa8
movq 0x90(%rax,%rbp,8), %rax
testq %rax, %rax
leaq 0x66367(%rip), %rdx     # 0x8a844
cmovneq %rax, %rdx
leaq 0x66af6(%rip), %rsi     # 0x8afde
leaq 0xa2ca1(%rip), %r8      # 0xc7190
pushq $0x3
popq %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x22613
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq