// File: /workspace/github_c_makefile_star2_O0/erikdubbelboer[P]discnt/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) {
            /* 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) {
            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, 0xa449e(%rip)     # 0xbf228
jne 0x1ad97
movq $0x0, 0xa4411(%rip) # 0xbf1a8
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %ecx
movb $0x1, %al
cmpl 0xa447f(%rip), %ecx     # 0xbf228
movb %al, -0x1d(%rbp)
jl 0x1adb8
cmpl $0x0, -0x1c(%rbp)
sete %al
movb %al, -0x1d(%rbp)
movb -0x1d(%rbp), %al
testb $0x1, %al
jne 0x1adc4
jmp 0x1b00a
movslq -0x1c(%rbp), %rcx
leaq 0xa4319(%rip), %rax     # 0xbf0e8
cmpq $0x0, 0xc0(%rax,%rcx,8)
jne 0x1aeb7
movl -0x8(%rbp), %esi
movl 0xa43b9(%rip), %ecx     # 0xbf1a0
leaq 0xa42fa(%rip), %rdi     # 0xbf0e8
addq $0x218, %rdi            # imm = 0x218
xorl %eax, %eax
movl %eax, %edx
callq 0x15650
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 0x1ae41
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x14750
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl -0x8(%rbp), %esi
movl 0xa4356(%rip), %ecx     # 0xbf1a0
leaq 0xa4297(%rip), %rdi     # 0xbf0e8
addq $0x218, %rdi            # imm = 0x218
xorl %eax, %eax
movl %eax, %edx
callq 0x15480
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 0x1aea4
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x14750
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1aeb2
jmp 0x1b00a
jmp 0x1af5c
movslq -0x1c(%rbp), %rcx
leaq 0xa4226(%rip), %rax     # 0xbf0e8
movq 0xc0(%rax,%rcx,8), %rdi
movl $0x3a, %esi
callq 0x122a0
cmpq $0x0, %rax
je 0x1af1b
movl -0x8(%rbp), %esi
movslq -0x1c(%rbp), %rcx
leaq 0xa4200(%rip), %rax     # 0xbf0e8
movq 0xc0(%rax,%rcx,8), %rdx
movl 0xa42aa(%rip), %ecx     # 0xbf1a0
leaq 0xa41eb(%rip), %rdi     # 0xbf0e8
addq $0x218, %rdi            # imm = 0x218
callq 0x15650
movl %eax, %edx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1af5a
movl -0x8(%rbp), %esi
movslq -0x1c(%rbp), %rcx
leaq 0xa41bf(%rip), %rax     # 0xbf0e8
movq 0xc0(%rax,%rcx,8), %rdx
movl 0xa4269(%rip), %ecx     # 0xbf1a0
leaq 0xa41aa(%rip), %rdi     # 0xbf0e8
addq $0x218, %rdi            # imm = 0x218
callq 0x15480
movl %eax, %edx
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1af5c
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
cmpl $-0x1, (%rax,%rcx,4)
jne 0x1afda
movslq -0x1c(%rbp), %rcx
leaq 0xa4170(%rip), %rax     # 0xbf0e8
cmpq $0x0, 0xc0(%rax,%rcx,8)
je 0x1af9c
movslq -0x1c(%rbp), %rcx
leaq 0xa415a(%rip), %rax     # 0xbf0e8
movq 0xc0(%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
jmp 0x1afa9
leaq 0x88f5a(%rip), %rax     # 0xa3efd
movq %rax, -0x28(%rbp)
jmp 0x1afa9
movq -0x28(%rbp), %rdx
movl -0x8(%rbp), %ecx
movl $0x3, %edi
leaq 0x88f12(%rip), %rsi     # 0xa3ece
leaq 0xa4125(%rip), %r8      # 0xbf0e8
addq $0x218, %r8             # imm = 0x218
movb $0x0, %al
callq 0x18b10
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1b011
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movl (%rax,%rcx,4), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x14750
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 0x1ad9e
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)