// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0x32b4d
movq 0xd3d78(%rip), %rax     # 0x106888
movq 0x48(%rax), %rsi
addq 0x28(%rax), %rsi
movq %rbx, %rdi
callq 0x4063b
movq 0xd3d61(%rip), %rdi     # 0x106888
callq 0x320bb
movq %rax, %r14
movq %rax, %rdi
callq 0x32116
testq %rax, %rax
je 0x32bb0
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x36fb3
movq %r14, %rdi
jmp 0x32b32
movq 0x40(%rbx), %r12
movq 0x8(%r12), %rax
movq 0x8(%rax), %r15
leaq 0xa11e3(%rip), %rsi     # 0xd3d44
movq %r15, %rdi
callq 0x26300
testl %eax, %eax
je 0x32bc3
leaq 0x9d0b9(%rip), %rsi     # 0xcfc2d
movq %r15, %rdi
callq 0x26300
cmpl $0x2, %r14d
jne 0x32c16
testl %eax, %eax
jne 0x32c16
movq 0xd3cf3(%rip), %rax     # 0x106888
movq 0x48(%rax), %rsi
addq 0x28(%rax), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x40606
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x321d3
addq $-0x2, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4063b
cmpl $0x3, 0x38(%rbx)
jl 0x32d00
movl $0x2, %r14d
movq 0xd3c9f(%rip), %rdi     # 0x106888
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x8(%rax), %rsi
callq 0x32019
movq %rbx, %rdi
movq %rax, %rsi
callq 0x36fb3
incq %r14
movslq 0x38(%rbx), %rax
cmpq %rax, %r14
jl 0x32be2
jmp 0x32d00
leaq 0x8dc9b(%rip), %rsi     # 0xc08b8
movq %r15, %rdi
callq 0x26300
cmpl $0x3, %r14d
jl 0x32c7a
testl %eax, %eax
jne 0x32c7a
movq 0x10(%r12), %rax
movq 0x8(%rax), %rsi
movq 0xd3c49(%rip), %rdi     # 0x106888
callq 0x32019
testq %rax, %rax
je 0x32c94
movl 0x10(%rax), %ecx
testl %ecx, %ecx
jle 0x32c5a
movl 0x38(%rbx), %edx
addl $-0x2, %edx
cmpl %edx, %ecx
jne 0x32c66
movl 0x38(%rbx), %edx
addl $-0x2, %edx
negl %ecx
cmpl %ecx, %edx
jge 0x32ca7
leaq 0x8dc6d(%rip), %rsi     # 0xc08da
movq %rbx, %rdi
callq 0x3ffcb
jmp 0x32d00
leaq 0x8dc8b(%rip), %rsi     # 0xc090c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3ffcb
leaq 0x8dc25(%rip), %rsi     # 0xc08c0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3fff2
jmp 0x32d00
movq 0x40(%rbx), %rsi
addq $0x10, %rsi
leaq 0x4(%rsp), %r15
movq %rax, %rdi
movq %r15, %rcx
callq 0x46bc4
movq %rax, %r14
movslq (%r15), %rsi
movq %rbx, %rdi
callq 0x4063b
cmpl $0x0, (%r15)
jle 0x32cf8
xorl %r15d, %r15d
movq 0x40(%rbx), %rax
movslq (%r14,%r15,4), %rcx
movq 0x10(%rax,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x40537
incq %r15
movslq 0x4(%rsp), %rax
cmpq %rax, %r15
jl 0x32cd6
movq %r14, %rdi
callq 0x46bd3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq