// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/server.c
// Function: commandCommand
void commandCommand(client *c) {
    dictIterator *di;
    dictEntry *de;

    if (c->argc == 1) {
        addReplyMultiBulkLen(c, dictSize(server.commands));
        di = dictGetIterator(server.commands);
        while ((de = dictNext(di)) != NULL) {
            addReplyCommand(c, dictGetVal(de));
        }
        dictReleaseIterator(di);
    } else if (!strcasecmp(c->argv[1]->ptr, "info")) {
        int i;
        addReplyMultiBulkLen(c, c->argc-2);
        for (i = 2; i < c->argc; i++) {
            addReplyCommand(c, dictFetchValue(server.commands, c->argv[i]->ptr));
        }
    } else if (!strcasecmp(c->argv[1]->ptr, "count") && c->argc == 2) {
        addReplyLongLong(c, dictSize(server.commands));
    } else if (!strcasecmp(c->argv[1]->ptr,"getkeys") && c->argc >= 3) {
        struct redisCommand *cmd = lookupCommand(c->argv[2]->ptr);
        int *keys, numkeys, j;

        if (!cmd) {
            addReplyErrorFormat(c,"Invalid command specified");
            return;
        } else if ((cmd->arity > 0 && cmd->arity != c->argc-2) ||
                   ((c->argc-2) < -cmd->arity))
        {
            addReplyError(c,"Invalid number of arguments specified for command");
            return;
        }

        keys = getKeysFromCommand(cmd,c->argv+2,c->argc-2,&numkeys);
        addReplyMultiBulkLen(c,numkeys);
        for (j = 0; j < numkeys; j++) addReplyBulk(c,c->argv[keys[j]+2]);
        getKeysFreeResult(keys);
    } else {
        addReplyError(c, "Unknown subcommand or wrong number of arguments.");
        return;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x38(%rdi), %r14
cmpq $0x1, %r14
jne 0x2fa4a
movq 0xd1ecb(%rip), %rax     # 0x1018d8
movq 0x48(%rax), %rsi
addq 0x28(%rax), %rsi
movq %rbx, %rdi
callq 0x3d274
movq 0xd1eb4(%rip), %rdi     # 0x1018d8
callq 0x2efbb
movq %rax, %r14
movq %rax, %rdi
callq 0x2f015
testq %rax, %rax
je 0x2faad
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x33f7f
movq %r14, %rdi
jmp 0x2fa2f
movq 0x40(%rbx), %r12
movq 0x8(%r12), %rax
movq 0x8(%rax), %r15
leaq 0xa1416(%rip), %rsi     # 0xd0e74
movq %r15, %rdi
callq 0x262f0
testl %eax, %eax
je 0x2fac0
leaq 0x9d2bc(%rip), %rsi     # 0xccd2d
movq %r15, %rdi
callq 0x262f0
cmpl $0x2, %r14d
jne 0x2fb13
testl %eax, %eax
jne 0x2fb13
movq 0xd1e46(%rip), %rax     # 0x1018d8
movq 0x48(%rax), %rsi
addq 0x28(%rax), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3d23f
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2f0dd
addq $-0x2, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3d274
cmpl $0x3, 0x38(%rbx)
jl 0x2fc07
movl $0x2, %r14d
movq 0xd1df2(%rip), %rdi     # 0x1018d8
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x8(%rax), %rsi
callq 0x2ef19
movq %rbx, %rdi
movq %rax, %rsi
callq 0x33f7f
incq %r14
movslq 0x38(%rbx), %rax
cmpq %rax, %r14
jl 0x2fadf
jmp 0x2fc07
leaq 0x8de10(%rip), %rsi     # 0xbd92a
movq %r15, %rdi
callq 0x262f0
cmpl $0x3, %r14d
jl 0x2fb81
testl %eax, %eax
jne 0x2fb81
movq 0x10(%r12), %rax
movq 0x8(%rax), %rsi
movq 0xd1d9c(%rip), %rdi     # 0x1018d8
callq 0x2ef19
testq %rax, %rax
je 0x2fb9b
movl 0x10(%rax), %ecx
testl %ecx, %ecx
setg %sil
movl 0x38(%rbx), %edx
addl $-0x2, %edx
cmpl %edx, %ecx
setne %dil
andb %sil, %dil
negl %ecx
cmpl %ecx, %edx
setl %cl
orb %dil, %cl
cmpb $0x1, %cl
jne 0x2fbae
leaq 0x8ddd8(%rip), %rsi     # 0xbd94c
movq %rbx, %rdi
callq 0x3cc06
jmp 0x2fc07
leaq 0x8ddf6(%rip), %rsi     # 0xbd97e
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3cc06
leaq 0x8dd90(%rip), %rsi     # 0xbd932
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3cc2d
jmp 0x2fc07
movq 0x40(%rbx), %rsi
addq $0x10, %rsi
leaq 0x4(%rsp), %r15
movq %rax, %rdi
movq %r15, %rcx
callq 0x43778
movq %rax, %r14
movslq (%r15), %rsi
movq %rbx, %rdi
callq 0x3d274
cmpl $0x0, (%r15)
jle 0x2fbff
xorl %r15d, %r15d
movq 0x40(%rbx), %rax
movslq (%r14,%r15,4), %rcx
movq 0x10(%rax,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x3d170
incq %r15
movslq 0x4(%rsp), %rax
cmpq %rax, %r15
jl 0x2fbdd
movq %r14, %rdi
callq 0x43787
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq