// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/server.c
// Function: processCommand
int processCommand(client *c) {
    /* The QUIT command is handled separately. Normal command procs will
     * go through checking for replication and QUIT will cause trouble
     * when FORCE_REPLICATION is enabled and would be implemented in
     * a regular command proc. */
    if (!strcasecmp(c->argv[0]->ptr,"quit")) {
        addReply(c,shared.ok);
        c->flags |= CLIENT_CLOSE_AFTER_REPLY;
        return C_ERR;
    }

    /* Now lookup the command and check ASAP about trivial error conditions
     * such as wrong arity, bad command name and so forth. */
    c->cmd = c->lastcmd = lookupCommand(c->argv[0]->ptr);
    if (!c->cmd) {
        flagTransaction(c);
        addReplyErrorFormat(c,"unknown command '%s'",
            (char*)c->argv[0]->ptr);
        return C_OK;
    } else if ((c->cmd->arity > 0 && c->cmd->arity != c->argc) ||
               (c->argc < -c->cmd->arity)) {
        flagTransaction(c);
        addReplyErrorFormat(c,"wrong number of arguments for '%s' command",
            c->cmd->name);
        return C_OK;
    }

    /* Check if the user is authenticated */
    if (server.requirepass && !c->authenticated && c->cmd->proc != authCommand)
    {
        flagTransaction(c);
        addReply(c,shared.noautherr);
        return C_OK;
    }

    /* If cluster is enabled perform the cluster redirection here.
     * However we don't perform the redirection if:
     * 1) The sender of this command is our master.
     * 2) The command has no key arguments. */
    if (server.cluster_enabled &&
        !(c->flags & CLIENT_MASTER) &&
        !(c->flags & CLIENT_LUA &&
          server.lua_caller->flags & CLIENT_MASTER) &&
        !(c->cmd->getkeys_proc == NULL && c->cmd->firstkey == 0 &&
          c->cmd->proc != execCommand))
    {
        int hashslot;
        int error_code;
        clusterNode *n = getNodeByQuery(c,c->cmd,c->argv,c->argc,
                                        &hashslot,&error_code);
        if (n == NULL || n != server.cluster->myself) {
            if (c->cmd->proc == execCommand) {
                discardTransaction(c);
            } else {
                flagTransaction(c);
            }
            clusterRedirectClient(c,n,hashslot,error_code);
            return C_OK;
        }
    }

    /* Handle the maxmemory directive.
     *
     * First we try to free some memory if possible (if there are volatile
     * keys in the dataset). If there are not the only thing we can do
     * is returning an error. */
    if (server.maxmemory) {
        int retval = freeMemoryIfNeeded();
        /* freeMemoryIfNeeded may flush slave output buffers. This may result
         * into a slave, that may be the active client, to be freed. */
        if (server.current_client == NULL) return C_ERR;

        /* It was impossible to free enough memory, and the command the client
         * is trying to execute is denied during OOM conditions? Error. */
        if ((c->cmd->flags & CMD_DENYOOM) && retval == C_ERR) {
            flagTransaction(c);
            addReply(c, shared.oomerr);
            return C_OK;
        }
    }

    /* Don't accept write commands if there are problems persisting on disk
     * and if this is a master instance. */
    if (((server.stop_writes_on_bgsave_err &&
          server.saveparamslen > 0 &&
          server.lastbgsave_status == C_ERR) ||
          server.aof_last_write_status == C_ERR) &&
        server.masterhost == NULL &&
        (c->cmd->flags & CMD_WRITE ||
         c->cmd->proc == pingCommand))
    {
        flagTransaction(c);
        if (server.aof_last_write_status == C_OK)
            addReply(c, shared.bgsaveerr);
        else
            addReplySds(c,
                sdscatprintf(sdsempty(),
                "-MISCONF Errors writing to the AOF file: %s\r\n",
                strerror(server.aof_last_write_errno)));
        return C_OK;
    }

    /* Don't accept write commands if there are not enough good slaves and
     * user configured the min-slaves-to-write option. */
    if (server.masterhost == NULL &&
        server.repl_min_slaves_to_write &&
        server.repl_min_slaves_max_lag &&
        c->cmd->flags & CMD_WRITE &&
        server.repl_good_slaves_count < server.repl_min_slaves_to_write)
    {
        flagTransaction(c);
        addReply(c, shared.noreplicaserr);
        return C_OK;
    }

    /* Don't accept write commands if this is a read only slave. But
     * accept write commands if this is our master. */
    if (server.masterhost && server.repl_slave_ro &&
        !(c->flags & CLIENT_MASTER) &&
        c->cmd->flags & CMD_WRITE)
    {
        addReply(c, shared.roslaveerr);
        return C_OK;
    }

    /* Only allow SUBSCRIBE and UNSUBSCRIBE in the context of Pub/Sub */
    if (c->flags & CLIENT_PUBSUB &&
        c->cmd->proc != pingCommand &&
        c->cmd->proc != subscribeCommand &&
        c->cmd->proc != unsubscribeCommand &&
        c->cmd->proc != psubscribeCommand &&
        c->cmd->proc != punsubscribeCommand) {
        addReplyError(c,"only (P)SUBSCRIBE / (P)UNSUBSCRIBE / PING / QUIT allowed in this context");
        return C_OK;
    }

    /* Only allow INFO and SLAVEOF when slave-serve-stale-data is no and
     * we are a slave with a broken link with master. */
    if (server.masterhost && server.repl_state != REPL_STATE_CONNECTED &&
        server.repl_serve_stale_data == 0 &&
        !(c->cmd->flags & CMD_STALE))
    {
        flagTransaction(c);
        addReply(c, shared.masterdownerr);
        return C_OK;
    }

    /* Loading DB? Return an error if the command has not the
     * CMD_LOADING flag. */
    if (server.loading && !(c->cmd->flags & CMD_LOADING)) {
        addReply(c, shared.loadingerr);
        return C_OK;
    }

    /* Lua script too slow? Only allow a limited number of commands. */
    if (server.lua_timedout &&
          c->cmd->proc != authCommand &&
          c->cmd->proc != replconfCommand &&
        !(c->cmd->proc == shutdownCommand &&
          c->argc == 2 &&
          tolower(((char*)c->argv[1]->ptr)[0]) == 'n') &&
        !(c->cmd->proc == scriptCommand &&
          c->argc == 2 &&
          tolower(((char*)c->argv[1]->ptr)[0]) == 'k'))
    {
        flagTransaction(c);
        addReply(c, shared.slowscripterr);
        return C_OK;
    }

    /* Exec the command */
    if (c->flags & CLIENT_MULTI &&
        c->cmd->proc != execCommand && c->cmd->proc != discardCommand &&
        c->cmd->proc != multiCommand && c->cmd->proc != watchCommand)
    {
        queueMultiCommand(c);
        addReply(c,shared.queued);
    } else {
        call(c,CMD_CALL_FULL);
        c->woff = server.master_repl_offset;
        if (listLength(server.ready_keys))
            handleClientsBlockedOnLists();
    }
    return C_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x1043f8(%rip), %rsi    # 0x1385da
callq 0x26300
cmpl $0x0, %eax
jne 0x3421b
movq -0x10(%rbp), %rdi
movq 0x144a51(%rip), %rsi    # 0x178c48
callq 0x42cc0
movq -0x10(%rbp), %rax
movl 0x98(%rax), %ecx
orl $0x40, %ecx
movl %ecx, 0x98(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x34904
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
callq 0x33b00
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x34283
movq -0x10(%rbp), %rdi
callq 0x75ab0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdx
leaq 0x10436f(%rip), %rsi    # 0x1385df
movb $0x0, %al
callq 0x42fd0
movl $0x0, -0x4(%rbp)
jmp 0x34904
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x0, 0x10(%rax)
jle 0x342a5
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x10(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jne 0x342bd
movq -0x10(%rbp), %rax
movl 0x38(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x48(%rcx), %rdx
xorl %ecx, %ecx
subl 0x10(%rdx), %ecx
cmpl %ecx, %eax
jge 0x342ef
movq -0x10(%rbp), %rdi
callq 0x75ab0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
leaq 0x104318(%rip), %rsi    # 0x1385f4
movb $0x0, %al
callq 0x42fd0
movl $0x0, -0x4(%rbp)
jmp 0x34904
jmp 0x342f1
cmpq $0x0, 0x143f37(%rip)    # 0x178230
je 0x34342
movq -0x10(%rbp), %rax
cmpl $0x0, 0x9c(%rax)
jne 0x34342
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq -0x4e87(%rip), %rcx     # 0x2f490
cmpq %rcx, 0x8(%rax)
je 0x34342
movq -0x10(%rbp), %rdi
callq 0x75ab0
movq -0x10(%rbp), %rdi
movq 0x1449df(%rip), %rsi    # 0x178d10
callq 0x42cc0
movl $0x0, -0x4(%rbp)
jmp 0x34904
cmpl $0x0, 0x14482b(%rip)    # 0x178b74
je 0x34455
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x34455
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x34392
movq 0x144830(%rip), %rax    # 0x178bb0
movl 0x98(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x34455
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, 0x28(%rax)
jne 0x343c8
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x0, 0x30(%rax)
jne 0x343c8
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x41852(%rip), %rcx     # 0x75c10
cmpq %rcx, 0x8(%rax)
jne 0x34455
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdx
movq -0x10(%rbp), %rax
movl 0x38(%rax), %ecx
leaq -0x14(%rbp), %r8
leaq -0x18(%rbp), %r9
callq 0x86e10
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x3440b
movq -0x20(%rbp), %rax
movq 0x144782(%rip), %rcx    # 0x178b88
cmpq (%rcx), %rax
je 0x34453
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x417f6(%rip), %rcx     # 0x75c10
cmpq %rcx, 0x8(%rax)
jne 0x3442b
movq -0x10(%rbp), %rdi
callq 0x75930
jmp 0x34434
movq -0x10(%rbp), %rdi
callq 0x75ab0
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0x87380
movl $0x0, -0x4(%rbp)
jmp 0x34904
jmp 0x34455
cmpq $0x0, 0x144683(%rip)    # 0x178ae0
je 0x344bd
callq 0x34910
movl %eax, -0x24(%rbp)
cmpq $0x0, 0x143f59(%rip)    # 0x1783c8
jne 0x3447d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x34904
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x20(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x344bb
cmpl $-0x1, -0x24(%rbp)
jne 0x344bb
movq -0x10(%rbp), %rdi
callq 0x75ab0
movq -0x10(%rbp), %rdi
movq 0x14487e(%rip), %rsi    # 0x178d28
callq 0x42cc0
movl $0x0, -0x4(%rbp)
jmp 0x34904
jmp 0x344bd
cmpl $0x0, 0x144498(%rip)    # 0x17895c
je 0x344d8
cmpl $0x0, 0x14444b(%rip)    # 0x178918
jle 0x344d8
cmpl $-0x1, 0x144482(%rip)   # 0x178958
je 0x344e5
cmpl $-0x1, 0x1443e5(%rip)   # 0x1788c4
jne 0x34588
cmpq $0x0, 0x144513(%rip)    # 0x178a00
jne 0x34588
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x20(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x3451b
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq -0x4ff5(%rip), %rcx     # 0x2f520
cmpq %rcx, 0x8(%rax)
jne 0x34588
movq -0x10(%rbp), %rdi
callq 0x75ab0
cmpl $0x0, 0x144399(%rip)    # 0x1788c4
jne 0x3453f
movq -0x10(%rbp), %rdi
movq 0x1447b8(%rip), %rsi    # 0x178cf0
callq 0x42cc0
jmp 0x3457c
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
callq 0x384f0
movq %rax, -0x38(%rbp)
movl 0x144372(%rip), %edi    # 0x1788c8
callq 0x26690
movq -0x38(%rbp), %rdi
movq %rax, %rdx
leaq 0x1040b6(%rip), %rsi    # 0x13861f
movb $0x0, %al
callq 0x395b0
movq -0x30(%rbp), %rdi
movq %rax, %rsi
callq 0x42e50
movl $0x0, -0x4(%rbp)
jmp 0x34904
cmpq $0x0, 0x144470(%rip)    # 0x178a00
jne 0x345ea
cmpl $0x0, 0x144447(%rip)    # 0x1789e0
je 0x345ea
cmpl $0x0, 0x144442(%rip)    # 0x1789e4
je 0x345ea
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x20(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x345ea
movl 0x14442b(%rip), %eax    # 0x1789e8
cmpl 0x14441d(%rip), %eax    # 0x1789e0
jge 0x345ea
movq -0x10(%rbp), %rdi
callq 0x75ab0
movq -0x10(%rbp), %rdi
movq 0x14473f(%rip), %rsi    # 0x178d18
callq 0x42cc0
movl $0x0, -0x4(%rbp)
jmp 0x34904
cmpq $0x0, 0x14440e(%rip)    # 0x178a00
je 0x3463e
cmpl $0x0, 0x144461(%rip)    # 0x178a5c
je 0x3463e
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x3463e
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x20(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x3463e
movq -0x10(%rbp), %rdi
movq 0x1446d3(%rip), %rsi    # 0x178d00
callq 0x42cc0
movl $0x0, -0x4(%rbp)
jmp 0x34904
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x40000, %eax          # imm = 0x40000
cmpl $0x0, %eax
je 0x346db
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq -0x5145(%rip), %rcx     # 0x2f520
cmpq %rcx, 0x8(%rax)
je 0x346db
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x40bc6(%rip), %rcx     # 0x75240
cmpq %rcx, 0x8(%rax)
je 0x346db
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x40c11(%rip), %rcx     # 0x752a0
cmpq %rcx, 0x8(%rax)
je 0x346db
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x40c8c(%rip), %rcx     # 0x75330
cmpq %rcx, 0x8(%rax)
je 0x346db
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x40cd7(%rip), %rcx     # 0x75390
cmpq %rcx, 0x8(%rax)
je 0x346db
movq -0x10(%rbp), %rdi
leaq 0x103f83(%rip), %rsi    # 0x13864d
callq 0x42f90
movl $0x0, -0x4(%rbp)
jmp 0x34904
cmpq $0x0, 0x14431d(%rip)    # 0x178a00
je 0x34731
cmpl $0xf, 0x144338(%rip)    # 0x178a24
je 0x34731
cmpl $0x0, 0x144363(%rip)    # 0x178a58
jne 0x34731
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x20(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0x34731
movq -0x10(%rbp), %rdi
callq 0x75ab0
movq -0x10(%rbp), %rdi
movq 0x1445d8(%rip), %rsi    # 0x178cf8
callq 0x42cc0
movl $0x0, -0x4(%rbp)
jmp 0x34904
cmpl $0x0, 0x143dbc(%rip)    # 0x1784f4
je 0x3476b
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x20(%rax), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
jne 0x3476b
movq -0x10(%rbp), %rdi
movq 0x144586(%rip), %rsi    # 0x178ce0
callq 0x42cc0
movl $0x0, -0x4(%rbp)
jmp 0x34904
cmpl $0x0, 0x144472(%rip)    # 0x178be4
je 0x34847
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq -0x52f7(%rip), %rcx     # 0x2f490
cmpq %rcx, 0x8(%rax)
je 0x34847
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x1a740(%rip), %rcx     # 0x4eee0
cmpq %rcx, 0x8(%rax)
je 0x34847
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x178d7(%rip), %rcx     # 0x4c090
cmpq %rcx, 0x8(%rax)
jne 0x347e6
movq -0x10(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0x347e6
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %edi
callq 0x26900
cmpl $0x6e, %eax
je 0x34847
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x5701b(%rip), %rcx     # 0x8b810
cmpq %rcx, 0x8(%rax)
jne 0x34822
movq -0x10(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0x34822
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %edi
callq 0x26900
cmpl $0x6b, %eax
je 0x34847
movq -0x10(%rbp), %rdi
callq 0x75ab0
movq -0x10(%rbp), %rdi
movq 0x1444b2(%rip), %rsi    # 0x178ce8
callq 0x42cc0
movl $0x0, -0x4(%rbp)
jmp 0x34904
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x348c8
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x413a8(%rip), %rcx     # 0x75c10
cmpq %rcx, 0x8(%rax)
je 0x348c8
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x412d3(%rip), %rcx     # 0x75b50
cmpq %rcx, 0x8(%rax)
je 0x348c8
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x4125e(%rip), %rcx     # 0x75af0
cmpq %rcx, 0x8(%rax)
je 0x348c8
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
leaq 0x418c9(%rip), %rcx     # 0x76170
cmpq %rcx, 0x8(%rax)
je 0x348c8
movq -0x10(%rbp), %rdi
callq 0x75820
movq -0x10(%rbp), %rdi
movq 0x1443df(%rip), %rsi    # 0x178ca0
callq 0x42cc0
jmp 0x348fd
movq -0x10(%rbp), %rdi
movl $0xf, %esi
callq 0x33d50
movq 0x1440bb(%rip), %rcx    # 0x178998
movq -0x10(%rbp), %rax
movq %rcx, 0x198(%rax)
movq 0x144211(%rip), %rax    # 0x178b00
cmpq $0x0, 0x28(%rax)
je 0x348fb
callq 0x5b070
jmp 0x348fd
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)