// File: /workspace/github_c_makefile_star2_O2/erikdubbelboer[P]discnt/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) {
        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)) {
        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)
    {
        addReply(c,shared.noautherr);
        return C_OK;
    }

    /* Handle the maxmemory directive. */
    if (server.maxmemory) {
        if (getMemoryWarningLevel() && c->cmd->flags & CMD_DENYOOM) {
            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) &&
        (c->cmd->flags & CMD_WRITE ||
         c->cmd->proc == pingCommand))
    {
        addReply(c, shared.bgsaveerr);
        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 != isubscribeCommand &&
        c->cmd->proc != unsubscribeCommand) {
        addReplyError(c,"only SUBSCRIBE / ISUBSCRIBE / UNSUBSCRIBE / QUIT allowed in this context");
        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;
    }

    call(c,CMD_CALL_FULL);
    return C_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %rax
movq (%rax), %rax
movq 0x8(%rax), %r14
leaq 0x35527(%rip), %rsi     # 0x4d01d
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
je 0x17b39
movq %r14, %rdi
callq 0x1785c
movq %rax, 0x40(%rbx)
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x17b57
movl 0x10(%rax), %ecx
movl 0x28(%rbx), %edx
testl %ecx, %ecx
jle 0x17b27
cmpl %edx, %ecx
movl %ecx, %edx
jne 0x17b2d
negl %ecx
cmpl %ecx, %edx
jge 0x17b7a
movq (%rax), %rdx
leaq 0x35500(%rip), %rsi     # 0x4d037
jmp 0x17b69
movq 0x52c60(%rip), %rsi     # 0x6a7a0
movq %rbx, %rdi
callq 0x1c8e7
orb $0x40, 0x88(%rbx)
pushq $-0x1
popq %rbp
jmp 0x17c8a
movq 0x30(%rbx), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdx
leaq 0x354b9(%rip), %rsi     # 0x4d022
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1caf6
jmp 0x17c8a
cmpq $0x0, 0x5254e(%rip)     # 0x6a0d0
je 0x17b91
cmpl $0x0, 0x8c(%rbx)
je 0x17c12
cmpq $0x0, 0x52aff(%rip)     # 0x6a698
je 0x17bb2
callq 0x17c91
testl %eax, %eax
je 0x17bb2
movq 0x38(%rbx), %rax
testb $0x4, 0x20(%rax)
jne 0x17c79
cmpl $0x0, 0x52bcf(%rip)     # 0x6a788
je 0x17be4
cmpl $0x0, 0x52b86(%rip)     # 0x6a748
jle 0x17be4
cmpl $-0x1, 0x52bb9(%rip)    # 0x6a784
jne 0x17be4
movq 0x38(%rbx), %rax
testb $0x1, 0x20(%rax)
jne 0x17c09
leaq -0x249b(%rip), %rcx     # 0x15743
cmpq %rcx, 0x8(%rax)
je 0x17c09
testb $0x4, 0x8a(%rbx)
jne 0x17c39
cmpl $0x0, 0x527b4(%rip)     # 0x6a3a8
je 0x17c2c
movq 0x38(%rbx), %rax
testb $0x2, 0x21(%rax)
jne 0x17c2c
movq 0x52c31(%rip), %rsi     # 0x6a838
jmp 0x17c80
movq 0x52c38(%rip), %rsi     # 0x6a848
jmp 0x17c80
leaq -0x2535(%rip), %rcx     # 0x156e4
cmpq %rcx, 0x8(%rax)
je 0x17b91
movq 0x52c3e(%rip), %rsi     # 0x6a868
jmp 0x17c80
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x179ff
jmp 0x17c88
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rax
cmpq 0x51378(%rip), %rax     # 0x68fc0
je 0x17bed
cmpq 0x51337(%rip), %rax     # 0x68f88
je 0x17bed
leaq -0x2517(%rip), %rcx     # 0x15743
cmpq %rcx, %rax
je 0x17bed
cmpq 0x51332(%rip), %rax     # 0x68f98
je 0x17bed
leaq 0x353f3(%rip), %rsi     # 0x4d062
movq %rbx, %rdi
callq 0x1cacf
jmp 0x17c88
movq 0x52c00(%rip), %rsi     # 0x6a880
movq %rbx, %rdi
callq 0x1c8e7
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq