// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
cmpl $0x0, 0xebf5e(%rip)     # 0x113a08
jne 0x27ab7
movq $0x0, 0xebed1(%rip) # 0x113988
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %ecx
movb $0x1, %al
cmpl 0xebf3f(%rip), %ecx     # 0x113a08
movb %al, -0x1d(%rbp)
jl 0x27ad8
cmpl $0x0, -0x1c(%rbp)
sete %al
movb %al, -0x1d(%rbp)
movb -0x1d(%rbp), %al
testb $0x1, %al
jne 0x27ae4
jmp 0x27d2a
movslq -0x1c(%rbp), %rcx
leaq 0xebe09(%rip), %rax     # 0x1138f8
cmpq $0x0, 0x90(%rax,%rcx,8)
jne 0x27bd7
movl -0x8(%rbp), %esi
movl 0xebe7d(%rip), %ecx     # 0x113984
leaq 0xebdea(%rip), %rdi     # 0x1138f8
addq $0x1e8, %rdi            # imm = 0x1E8
xorl %eax, %eax
movl %eax, %edx
callq 0x227f0
movl %eax, %edx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0x27b61
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x21890
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl -0x8(%rbp), %esi
movl 0xebe1a(%rip), %ecx     # 0x113984
leaq 0xebd87(%rip), %rdi     # 0x1138f8
addq $0x1e8, %rdi            # imm = 0x1E8
xorl %eax, %eax
movl %eax, %edx
callq 0x22620
movl %eax, %edx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0x27bc4
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x21890
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x27bd2
jmp 0x27d2a
jmp 0x27c7c
movslq -0x1c(%rbp), %rcx
leaq 0xebd16(%rip), %rax     # 0x1138f8
movq 0x90(%rax,%rcx,8), %rdi
movl $0x3a, %esi
callq 0x1f790
cmpq $0x0, %rax
je 0x27c3b
movl -0x8(%rbp), %esi
movslq -0x1c(%rbp), %rcx
leaq 0xebcf0(%rip), %rax     # 0x1138f8
movq 0x90(%rax,%rcx,8), %rdx
movl 0xebd6e(%rip), %ecx     # 0x113984
leaq 0xebcdb(%rip), %rdi     # 0x1138f8
addq $0x1e8, %rdi            # imm = 0x1E8
callq 0x227f0
movl %eax, %edx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x27c7a
movl -0x8(%rbp), %esi
movslq -0x1c(%rbp), %rcx
leaq 0xebcaf(%rip), %rax     # 0x1138f8
movq 0x90(%rax,%rcx,8), %rdx
movl 0xebd2d(%rip), %ecx     # 0x113984
leaq 0xebc9a(%rip), %rdi     # 0x1138f8
addq $0x1e8, %rdi            # imm = 0x1E8
callq 0x22620
movl %eax, %edx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x27c7c
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
cmpl $-0x1, (%rax,%rcx,4)
jne 0x27cfa
movslq -0x1c(%rbp), %rcx
leaq 0xebc60(%rip), %rax     # 0x1138f8
cmpq $0x0, 0x90(%rax,%rcx,8)
je 0x27cbc
movslq -0x1c(%rbp), %rcx
leaq 0xebc4a(%rip), %rax     # 0x1138f8
movq 0x90(%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
jmp 0x27cc9
leaq 0xb6be9(%rip), %rax     # 0xde8ac
movq %rax, -0x28(%rbp)
jmp 0x27cc9
movq -0x28(%rbp), %rdx
movl -0x8(%rbp), %ecx
movl $0x3, %edi
leaq 0xb736a(%rip), %rsi     # 0xdf046
leaq 0xebc15(%rip), %r8      # 0x1138f8
addq $0x1e8, %r8             # imm = 0x1E8
movb $0x0, %al
callq 0x24fb0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x27d31
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x21890
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x27abe
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)