// File: /workspace/github_c_makefile_star2_O1/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 0x36e0b(%rip), %rsi     # 0x530ad
movq %r14, %rdi
callq 0x12090
testl %eax, %eax
je 0x1c2e9
movq 0x52dfb(%rip), %rdi     # 0x6f0b0
movq %r14, %rsi
callq 0x191a0
movq %rax, 0x40(%rbx)
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x1c309
movl 0x10(%rax), %ecx
testl %ecx, %ecx
jle 0x1c2d6
cmpl 0x28(%rbx), %ecx
jne 0x1c2dd
negl %ecx
cmpl %ecx, 0x28(%rbx)
jge 0x1c32c
movq (%rax), %rdx
leaq 0x36de0(%rip), %rsi     # 0x530c7
jmp 0x1c31b
movq 0x534b0(%rip), %rsi     # 0x6f7a0
movq %rbx, %rdi
callq 0x21f58
orb $0x40, 0x88(%rbx)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x1c46b
movq 0x30(%rbx), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdx
leaq 0x36d97(%rip), %rsi     # 0x530b2
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0x22331
jmp 0x1c46b
cmpq $0x0, 0x52d9c(%rip)     # 0x6f0d0
je 0x1c343
cmpl $0x0, 0x8c(%rbx)
je 0x1c440
cmpq $0x0, 0x5334d(%rip)     # 0x6f698
je 0x1c391
callq 0x2006e
movq %rax, %rcx
movq 0x5333c(%rip), %rax     # 0x6f698
shrq $0x2, %rax
movabsq $0x28f5c28f5c28f5c3, %rdx # imm = 0x28F5C28F5C28F5C3
mulq %rdx
shrq $0x2, %rdx
imulq $0x5f, %rdx, %rax
cmpq %rax, %rcx
ja 0x1c383
imulq $0x4b, %rdx, %rax
cmpq %rax, %rcx
jbe 0x1c391
movq 0x38(%rbx), %rax
testb $0x4, 0x20(%rax)
jne 0x1c45a
cmpl $0x0, 0x533f0(%rip)     # 0x6f788
je 0x1c3c3
cmpl $0x0, 0x533a7(%rip)     # 0x6f748
jle 0x1c3c3
cmpl $-0x1, 0x533da(%rip)    # 0x6f784
jne 0x1c3c3
movq 0x38(%rbx), %rax
testb $0x1, 0x20(%rax)
jne 0x1c3e8
leaq -0x2897(%rip), %rcx     # 0x19b26
cmpq %rcx, 0x8(%rax)
je 0x1c3e8
testb $0x4, 0x8a(%rbx)
jne 0x1c400
cmpl $0x0, 0x52fd5(%rip)     # 0x6f3a8
je 0x1c3f1
movq 0x38(%rbx), %rax
testb $0x2, 0x21(%rax)
jne 0x1c3f1
movq 0x53452(%rip), %rsi     # 0x6f838
jmp 0x1c461
movq 0x53459(%rip), %rsi     # 0x6f848
jmp 0x1c461
movq %rbx, %rdi
movl $0x3, %esi
callq 0x1c182
jmp 0x1c469
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rax
cmpq 0x51bb1(%rip), %rax     # 0x6dfc0
je 0x1c3cc
cmpq 0x51b70(%rip), %rax     # 0x6df88
je 0x1c3cc
leaq -0x28fb(%rip), %rcx     # 0x19b26
cmpq %rcx, %rax
je 0x1c3cc
cmpq 0x51b6b(%rip), %rax     # 0x6df98
je 0x1c3cc
leaq 0x36cbc(%rip), %rsi     # 0x530f2
movq %rbx, %rdi
callq 0x2230a
jmp 0x1c469
leaq -0x2983(%rip), %rcx     # 0x19ac4
cmpq %rcx, 0x8(%rax)
je 0x1c343
movq 0x53410(%rip), %rsi     # 0x6f868
jmp 0x1c461
movq 0x5341f(%rip), %rsi     # 0x6f880
movq %rbx, %rdi
callq 0x21f58
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq