// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/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) {
            int unsupported = 0;
            /* 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)++;
            } else if (errno == EAFNOSUPPORT) {
                unsupported++;
                serverLog(LL_WARNING,"Not listening to IPv6: unsupproted");
            }

            if (*count == 1 || unsupported) {
                /* Bind the IPv4 address as well. */
                fds[*count] = anetTcpServer(server.neterr,port,NULL,
                    server.tcp_backlog);
                if (fds[*count] != ANET_ERR) {
                    anetNonBlock(NULL,fds[*count]);
                    (*count)++;
                } else if (errno == EAFNOSUPPORT) {
                    unsupported++;
                    serverLog(LL_WARNING,"Not listening to IPv4: unsupproted");
                }
            }
            /* Exit the loop if we were able to bind * on IPv4 and IPv6,
             * otherwise fds[*count] will be ANET_ERR and we'll print an
             * error and return to the caller with an error. */
            if (*count + unsupported == 2) 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
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
cmpl $0x0, 0x1455d6(%rip)    # 0x178300
jne 0x32d37
movq $0x0, 0x145549(%rip) # 0x178280
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %ecx
movb $0x1, %al
cmpl 0x1455b7(%rip), %ecx    # 0x178300
movb %al, -0x21(%rbp)
jl 0x32d58
cmpl $0x0, -0x1c(%rbp)
sete %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x32d64
jmp 0x3301f
movslq -0x1c(%rbp), %rcx
leaq 0x145469(%rip), %rax    # 0x1781d8
cmpq $0x0, 0xa8(%rax,%rcx,8)
jne 0x32ecc
movl $0x0, -0x20(%rbp)
movl -0x8(%rbp), %esi
movl 0x1454ee(%rip), %ecx    # 0x17827c
leaq 0x145443(%rip), %rdi    # 0x1781d8
addq $0x208, %rdi            # imm = 0x208
xorl %eax, %eax
movl %eax, %edx
callq 0x2c800
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 0x32dea
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x2b860
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x32e12
callq 0x26880
cmpl $0x61, (%rax)
jne 0x32e10
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl $0x3, %edi
leaq 0x10558c(%rip), %rsi    # 0x138395
movb $0x0, %al
callq 0x2fc60
jmp 0x32e12
movq -0x18(%rbp), %rax
cmpl $0x1, (%rax)
je 0x32e25
cmpl $0x0, -0x20(%rbp)
je 0x32eb4
movl -0x8(%rbp), %esi
movl 0x14544e(%rip), %ecx    # 0x17827c
leaq 0x1453a3(%rip), %rdi    # 0x1781d8
addq $0x208, %rdi            # imm = 0x208
xorl %eax, %eax
movl %eax, %edx
callq 0x2c610
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 0x32e8a
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x2b860
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x32eb2
callq 0x26880
cmpl $0x61, (%rax)
jne 0x32eb0
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl $0x3, %edi
leaq 0x10550f(%rip), %rsi    # 0x1383b8
movb $0x0, %al
callq 0x2fc60
jmp 0x32eb2
jmp 0x32eb4
movq -0x18(%rbp), %rax
movl (%rax), %eax
addl -0x20(%rbp), %eax
cmpl $0x2, %eax
jne 0x32ec7
jmp 0x3301f
jmp 0x32f71
movslq -0x1c(%rbp), %rcx
leaq 0x145301(%rip), %rax    # 0x1781d8
movq 0xa8(%rax,%rcx,8), %rdi
movl $0x3a, %esi
callq 0x267f0
cmpq $0x0, %rax
je 0x32f30
movl -0x8(%rbp), %esi
movslq -0x1c(%rbp), %rcx
leaq 0x1452db(%rip), %rax    # 0x1781d8
movq 0xa8(%rax,%rcx,8), %rdx
movl 0x145371(%rip), %ecx    # 0x17827c
leaq 0x1452c6(%rip), %rdi    # 0x1781d8
addq $0x208, %rdi            # imm = 0x208
callq 0x2c800
movl %eax, %edx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x32f6f
movl -0x8(%rbp), %esi
movslq -0x1c(%rbp), %rcx
leaq 0x14529a(%rip), %rax    # 0x1781d8
movq 0xa8(%rax,%rcx,8), %rdx
movl 0x145330(%rip), %ecx    # 0x17827c
leaq 0x145285(%rip), %rdi    # 0x1781d8
addq $0x208, %rdi            # imm = 0x208
callq 0x2c610
movl %eax, %edx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x32f71
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
cmpl $-0x1, (%rax,%rcx,4)
jne 0x32fef
movslq -0x1c(%rbp), %rcx
leaq 0x14524b(%rip), %rax    # 0x1781d8
cmpq $0x0, 0xa8(%rax,%rcx,8)
je 0x32fb1
movslq -0x1c(%rbp), %rcx
leaq 0x145235(%rip), %rax    # 0x1781d8
movq 0xa8(%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
jmp 0x32fbe
leaq 0x104bb3(%rip), %rax    # 0x137b6b
movq %rax, -0x30(%rbp)
jmp 0x32fbe
movq -0x30(%rbp), %rdx
movl -0x8(%rbp), %ecx
movl $0x3, %edi
leaq 0x10540a(%rip), %rsi    # 0x1383db
leaq 0x145200(%rip), %r8     # 0x1781d8
addq $0x208, %r8             # imm = 0x208
movb $0x0, %al
callq 0x2fc60
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x33026
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x2b860
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 0x32d3e
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop