// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/networking.c
// Function: acceptCommonHandler
static void acceptCommonHandler(int fd, int flags, char *ip) {
    client *c;
    if ((c = createClient(fd)) == NULL) {
        serverLog(LL_WARNING,
            "Error registering fd event for the new client: %s (fd=%d)",
            strerror(errno),fd);
        close(fd); /* May be already closed, just ignore errors */
        return;
    }
    /* If maxclient directive is set and this is one client more... close the
     * connection. Note that we create the client instead to check before
     * for this condition, since now the socket is already set in non-blocking
     * mode and we can send an error for free using the Kernel I/O */
    if (listLength(server.clients) > server.maxclients) {
        char *err = "-ERR max number of clients reached\r\n";

        /* That's a best effort error message, don't check write errors */
        if (write(c->fd,err,strlen(err)) == -1) {
            /* Nothing to do, Just to avoid the warning... */
        }
        server.stat_rejected_conn++;
        freeClient(c);
        return;
    }

    /* If the server is running in protected mode (the default) and there
     * is no password set, nor a specific interface is bound, we don't accept
     * requests from non loopback interfaces. Instead we try to explain the
     * user what to do to fix it if needed. */
    if (server.protected_mode &&
        server.bindaddr_count == 0 &&
        server.requirepass == NULL &&
        !(flags & CLIENT_UNIX_SOCKET) &&
        ip != NULL)
    {
        if (strcmp(ip,"127.0.0.1") && strcmp(ip,"::1")) {
            char *err =
                "-DENIED Redis is running in protected mode because protected "
                "mode is enabled, no bind address was specified, no "
                "authentication password is requested to clients. In this mode "
                "connections are only accepted from the loopback interface. "
                "If you want to connect from external computers to Redis you "
                "may adopt one of the following solutions: "
                "1) Just disable protected mode sending the command "
                "'CONFIG SET protected-mode no' from the loopback interface "
                "by connecting to Redis from the same host the server is "
                "running, however MAKE SURE Redis is not publicly accessible "
                "from internet if you do so. Use CONFIG REWRITE to make this "
                "change permanent. "
                "2) Alternatively you can just disable the protected mode by "
                "editing the Redis configuration file, and setting the protected "
                "mode option to 'no', and then restarting the server. "
                "3) If you started the server manually just for testing, restart "
                "it with the '--protected-mode no' option. "
                "4) Setup a bind address or an authentication password. "
                "NOTE: You only need to do one of the above things in order for "
                "the server to start accepting connections from the outside.\r\n";
            if (write(c->fd,err,strlen(err)) == -1) {
                /* Nothing to do, Just to avoid the warning... */
            }
            server.stat_rejected_conn++;
            freeClient(c);
            return;
        }
    }

    server.stat_numconnections++;
    c->flags |= flags;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movl -0x4(%rbp), %edi
callq 0x41d90
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x43bd6
callq 0x26880
movl (%rax), %edi
callq 0x26690
movq %rax, %rdx
movl -0x4(%rbp), %ecx
movl $0x3, %edi
leaq 0xf7450(%rip), %rsi     # 0x13b012
movb $0x0, %al
callq 0x2fc60
movl -0x4(%rbp), %edi
callq 0x26180
jmp 0x43d82
leaq 0x1345fb(%rip), %rax    # 0x1781d8
movq 0x1c8(%rax), %rax
movq 0x28(%rax), %rax
leaq 0x1345e9(%rip), %rcx    # 0x1781d8
movl 0x904(%rcx), %ecx
cmpq %rcx, %rax
jbe 0x43c65
leaq 0xf744b(%rip), %rax     # 0x13b04c
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
callq 0x264f0
movl -0x34(%rbp), %edi
movq -0x30(%rbp), %rsi
movq %rax, %rdx
callq 0x26bc0
cmpq $-0x1, %rax
jne 0x43c37
jmp 0x43c37
leaq 0x13459a(%rip), %rax    # 0x1781d8
movq 0x3d8(%rax), %rcx
addq $0x1, %rcx
leaq 0x134588(%rip), %rax    # 0x1781d8
movq %rcx, 0x3d8(%rax)
movq -0x18(%rbp), %rdi
callq 0x43ea0
jmp 0x43d82
leaq 0x13456c(%rip), %rax    # 0x1781d8
cmpl $0x0, 0x318(%rax)
je 0x43d4f
leaq 0x134558(%rip), %rax    # 0x1781d8
cmpl $0x0, 0x128(%rax)
jne 0x43d4f
leaq 0x134544(%rip), %rax    # 0x1781d8
cmpq $0x0, 0x58(%rax)
jne 0x43d4f
movl -0x8(%rbp), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x43d4f
cmpq $0x0, -0x10(%rbp)
je 0x43d4f
movq -0x10(%rbp), %rdi
leaq 0xf73ab(%rip), %rsi     # 0x13b071
callq 0x268f0
cmpl $0x0, %eax
je 0x43d4d
movq -0x10(%rbp), %rdi
leaq 0xf73a0(%rip), %rsi     # 0x13b07b
callq 0x268f0
cmpl $0x0, %eax
je 0x43d4d
leaq 0xf7393(%rip), %rax     # 0x13b07f
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
callq 0x264f0
movl -0x44(%rbp), %edi
movq -0x40(%rbp), %rsi
movq %rax, %rdx
callq 0x26bc0
cmpq $-0x1, %rax
jne 0x43d22
jmp 0x43d22
leaq 0x1344af(%rip), %rax    # 0x1781d8
movq 0x3d8(%rax), %rcx
addq $0x1, %rcx
leaq 0x13449d(%rip), %rax    # 0x1781d8
movq %rcx, 0x3d8(%rax)
movq -0x18(%rbp), %rdi
callq 0x43ea0
jmp 0x43d82
jmp 0x43d4f
leaq 0x134482(%rip), %rax    # 0x1781d8
movq 0x398(%rax), %rcx
addq $0x1, %rcx
leaq 0x134470(%rip), %rax    # 0x1781d8
movq %rcx, 0x398(%rax)
movl -0x8(%rbp), %ecx
movq -0x18(%rbp), %rax
orl 0x98(%rax), %ecx
movl %ecx, 0x98(%rax)
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)