// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/networking.c
// Function: createClient
client *createClient(int fd) {
    client *c = zmalloc(sizeof(client));

    /* passing -1 as fd it is possible to create a non connected client.
     * This is useful since all the commands needs to be executed
     * in the context of a client. When commands are executed in other
     * contexts (for instance a Lua script) we need a non connected client. */
    if (fd != -1) {
        anetNonBlock(NULL,fd);
        anetEnableTcpNoDelay(NULL,fd);
        if (server.tcpkeepalive)
            anetKeepAlive(NULL,fd,server.tcpkeepalive);
        if (aeCreateFileEvent(server.el,fd,AE_READABLE,
            readQueryFromClient, c) == AE_ERR)
        {
            close(fd);
            zfree(c);
            return NULL;
        }
    }

    selectDb(c,0);
    c->id = server.next_client_id++;
    c->fd = fd;
    c->name = NULL;
    c->bufpos = 0;
    c->querybuf = sdsempty();
    c->querybuf_peak = 0;
    c->reqtype = 0;
    c->argc = 0;
    c->argv = NULL;
    c->cmd = c->lastcmd = NULL;
    c->multibulklen = 0;
    c->bulklen = -1;
    c->sentlen = 0;
    c->flags = 0;
    c->ctime = c->lastinteraction = server.unixtime;
    c->authenticated = 0;
    c->replstate = REPL_STATE_NONE;
    c->repl_put_online_on_ack = 0;
    c->reploff = 0;
    c->repl_ack_off = 0;
    c->repl_ack_time = 0;
    c->slave_listening_port = 0;
    c->slave_ip[0] = '\0';
    c->slave_capa = SLAVE_CAPA_NONE;
    c->reply = listCreate();
    c->reply_bytes = 0;
    c->obuf_soft_limit_reached_time = 0;
    listSetFreeMethod(c->reply,decrRefCountVoid);
    listSetDupMethod(c->reply,dupClientReplyValue);
    c->btype = BLOCKED_NONE;
    c->bpop.timeout = 0;
    c->bpop.keys = dictCreate(&setDictType,NULL);
    c->bpop.target = NULL;
    c->bpop.numreplicas = 0;
    c->bpop.reploffset = 0;
    c->woff = 0;
    c->watched_keys = listCreate();
    c->pubsub_channels = dictCreate(&setDictType,NULL);
    c->pubsub_patterns = listCreate();
    c->peerid = NULL;
    listSetFreeMethod(c->pubsub_patterns,decrRefCountVoid);
    listSetMatchMethod(c->pubsub_patterns,listMatchObjects);
    if (fd != -1) listAddNodeTail(server.clients,c);
    initClientMultiState(c);
    return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0xc(%rbp)
movl $0x41c8, %edi           # imm = 0x41C8
callq 0x3acd0
movq %rax, -0x18(%rbp)
cmpl $-0x1, -0xc(%rbp)
je 0x41e3c
movl -0xc(%rbp), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x2b860
movl -0xc(%rbp), %esi
xorl %eax, %eax
movl %eax, %edi
callq 0x2ba60
leaq 0x136406(%rip), %rax    # 0x1781d8
cmpl $0x0, 0x600(%rax)
je 0x41df4
movl -0xc(%rbp), %esi
leaq 0x1363f3(%rip), %rax    # 0x1781d8
movl 0x600(%rax), %edx
xorl %eax, %eax
movl %eax, %edi
callq 0x2b8c0
leaq 0x1363dd(%rip), %rax    # 0x1781d8
movq 0x40(%rax), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %r8
movl $0x1, %edx
leaq 0x32e(%rip), %rcx       # 0x42140
callq 0x2a8f0
cmpl $-0x1, %eax
jne 0x41e3a
movl -0xc(%rbp), %edi
callq 0x26180
movq -0x18(%rbp), %rdi
callq 0x3afa0
movq $0x0, -0x8(%rbp)
jmp 0x42132
jmp 0x41e3c
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x4aef0
leaq 0x13638a(%rip), %rax    # 0x1781d8
movq 0x310(%rax), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
leaq 0x136375(%rip), %rax    # 0x1781d8
movq %rdx, 0x310(%rax)
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x1c0(%rax)
callq 0x384f0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x58(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x38(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x5c(%rax)
movq -0x18(%rbp), %rax
movq $-0x1, 0x60(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x78(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x98(%rax)
leaq 0x1362b5(%rip), %rax    # 0x1781d8
movq 0x978(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x18(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x9c(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0xa0(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0xa4(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0xc8(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0xd0(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0xd8(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x114(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x118(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x148(%rax)
callq 0x26e20
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x70(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x90(%rax)
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rax
leaq 0x7068(%rip), %rcx      # 0x49060
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rax
leaq -0x2cb(%rip), %rcx      # 0x41d40
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x168(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x170(%rax)
leaq 0x134d7d(%rip), %rdi    # 0x176db0
xorl %eax, %eax
movl %eax, %esi
callq 0x2d330
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x178(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x180(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x188(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x190(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x198(%rax)
callq 0x26e20
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x1a0(%rax)
leaq 0x134d11(%rip), %rdi    # 0x176db0
xorl %eax, %eax
movl %eax, %esi
callq 0x2d330
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x1a8(%rax)
callq 0x26e20
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x1b0(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x1b8(%rax)
movq -0x18(%rbp), %rax
movq 0x1b0(%rax), %rax
leaq 0x6f76(%rip), %rcx      # 0x49060
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rax
movq 0x1b0(%rax), %rax
leaq -0x3a0(%rip), %rcx      # 0x41d60
movq %rcx, 0x20(%rax)
cmpl $-0x1, -0xc(%rbp)
je 0x42121
leaq 0x1360c7(%rip), %rax    # 0x1781d8
movq 0x1c8(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x27000
movq -0x18(%rbp), %rdi
callq 0x75750
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)