// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/debug.c
// Function: debugCommand
void debugCommand(redisClient *c) {
    if (!strcasecmp(c->argv[1]->ptr,"segfault")) {
        *((char*)-1) = 'x';
    } else if (!strcasecmp(c->argv[1]->ptr,"oom")) {
        void *ptr = zmalloc(ULONG_MAX); /* Should trigger an out of memory. */
        zfree(ptr);
        addReply(c,shared.ok);
    } else if (!strcasecmp(c->argv[1]->ptr,"assert")) {
        if (c->argc >= 3) c->argv[2] = tryObjectEncoding(c->argv[2]);
        redisAssertWithInfo(c,c->argv[0],1 == 2);
    } else if (!strcasecmp(c->argv[1]->ptr,"reload")) {
        if (rdbSave(server.rdb_filename) != REDIS_OK) {
            addReply(c,shared.err);
            return;
        }
        emptyDb(NULL);
        if (rdbLoad(server.rdb_filename) != REDIS_OK) {
            addReplyError(c,"Error trying to load the RDB dump");
            return;
        }
        redisLog(REDIS_WARNING,"DB reloaded by DEBUG RELOAD");
        addReply(c,shared.ok);
    } else if (!strcasecmp(c->argv[1]->ptr,"loadaof")) {
        emptyDb(NULL);
        if (loadAppendOnlyFile(server.aof_filename) != REDIS_OK) {
            addReply(c,shared.err);
            return;
        }
        server.dirty = 0; /* Prevent AOF / replication */
        redisLog(REDIS_WARNING,"Append Only File loaded by DEBUG LOADAOF");
        addReply(c,shared.ok);
    } else if (!strcasecmp(c->argv[1]->ptr,"object") && c->argc == 3) {
        dictEntry *de;
        robj *val;
        char *strenc;

        if ((de = dictFind(c->db->dict,c->argv[2]->ptr)) == NULL) {
            addReply(c,shared.nokeyerr);
            return;
        }
        val = dictGetVal(de);
        strenc = strEncoding(val->encoding);

        addReplyStatusFormat(c,
            "Value at:%p refcount:%d "
            "encoding:%s serializedlength:%lld "
            "lru:%d lru_seconds_idle:%llu",
            (void*)val, val->refcount,
            strenc, (long long) rdbSavedObjectLen(val),
            val->lru, estimateObjectIdleTime(val));
    } else if (!strcasecmp(c->argv[1]->ptr,"sdslen") && c->argc == 3) {
        dictEntry *de;
        robj *val;
        sds key;

        if ((de = dictFind(c->db->dict,c->argv[2]->ptr)) == NULL) {
            addReply(c,shared.nokeyerr);
            return;
        }
        val = dictGetVal(de);
        key = dictGetKey(de);

        if (val->type != REDIS_STRING || !sdsEncodedObject(val)) {
            addReplyError(c,"Not an sds encoded string.");
        } else {
            addReplyStatusFormat(c,
                "key_sds_len:%lld, key_sds_avail:%lld, "
                "val_sds_len:%lld, val_sds_avail:%lld",
                (long long) sdslen(key),
                (long long) sdsavail(key),
                (long long) sdslen(val->ptr),
                (long long) sdsavail(val->ptr));
        }
    } else if (!strcasecmp(c->argv[1]->ptr,"populate") && c->argc == 3) {
        long keys, j;
        robj *key, *val;
        char buf[128];

        if (getLongFromObjectOrReply(c, c->argv[2], &keys, NULL) != REDIS_OK)
            return;
        dictExpand(c->db->dict,keys);
        for (j = 0; j < keys; j++) {
            snprintf(buf,sizeof(buf),"key:%lu",j);
            key = createStringObject(buf,strlen(buf));
            if (lookupKeyRead(c->db,key) != NULL) {
                decrRefCount(key);
                continue;
            }
            snprintf(buf,sizeof(buf),"value:%lu",j);
            val = createStringObject(buf,strlen(buf));
            dbAdd(c->db,key,val);
            decrRefCount(key);
        }
        addReply(c,shared.ok);
    } else if (!strcasecmp(c->argv[1]->ptr,"digest") && c->argc == 2) {
        unsigned char digest[20];
        sds d = sdsempty();
        int j;

        computeDatasetDigest(digest);
        for (j = 0; j < 20; j++)
            d = sdscatprintf(d, "%02x",digest[j]);
        addReplyStatus(c,d);
        sdsfree(d);
    } else if (!strcasecmp(c->argv[1]->ptr,"sleep") && c->argc == 3) {
        double dtime = strtod(c->argv[2]->ptr,NULL);
        long long utime = dtime*1000000;
        struct timespec tv;

        tv.tv_sec = utime / 1000000;
        tv.tv_nsec = (utime % 1000000) * 1000;
        nanosleep(&tv, NULL);
        addReply(c,shared.ok);
    } else if (!strcasecmp(c->argv[1]->ptr,"set-active-expire") &&
               c->argc == 3)
    {
        server.active_expire_enabled = atoi(c->argv[2]->ptr);
        addReply(c,shared.ok);
    } else if (!strcasecmp(c->argv[1]->ptr,"cmdkeys") && c->argc >= 3) {
        struct redisCommand *cmd = lookupCommand(c->argv[2]->ptr);
        int *keys, numkeys, j;

        if (!cmd) {
            addReplyError(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 if (!strcasecmp(c->argv[1]->ptr,"error") && c->argc == 3) {
        sds errstr = sdsnewlen("-",1);

        errstr = sdscatsds(errstr,c->argv[2]->ptr);
        errstr = sdsmapchars(errstr,"\n\r","  ",2); /* no newlines in errors. */
        errstr = sdscatlen(errstr,"\r\n",2);
        addReplySds(c,errstr);
    } else {
        addReplyErrorFormat(c, "Unknown DEBUG subcommand or wrong number of arguments for '%s'",
            (char*)c->argv[1]->ptr);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
movq 0x38(%rdi), %r15
movq 0x8(%r15), %rax
movq 0x8(%rax), %r14
leaq 0x4e5b8(%rip), %rsi     # 0x9b17b
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x4cccc
leaq 0x4e5aa(%rip), %rsi     # 0x9b184
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x4cce6
leaq 0x4e597(%rip), %rsi     # 0x9b188
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x4d233
leaq 0x4e58e(%rip), %rsi     # 0x9b196
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x4cd0a
leaq 0x4e5bc(%rip), %rsi     # 0x9b1db
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x4ceab
leaq 0x54e74(%rip), %rsi     # 0xa1aaa
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4cd49
cmpl $0x3, 0x30(%rbx)
jne 0x4cd49
movq 0x8(%rbx), %rax
movq (%rax), %rdi
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
callq 0x226ac
testq %rax, %rax
je 0x4d16c
movq 0x8(%rax), %r14
movl (%r14), %edi
shrl $0x4, %edi
andl $0xf, %edi
callq 0x313df
movq %rax, %r15
movl 0x4(%r14), %ebp
movq %r14, %rdi
callq 0x37375
movq %rax, %r12
movl (%r14), %r13d
shrl $0x8, %r13d
movq %r14, %rdi
callq 0x313fa
movq %rax, %r10
leaq 0x4e562(%rip), %rsi     # 0x9b20c
movq %rbx, %rdi
movq %r14, %rdx
movl %ebp, %ecx
movq %r15, %r8
movq %r12, %r9
xorl %eax, %eax
pushq %r10
pushq %r13
callq 0x2ddde
addq $0xa8, %rsp
jmp 0x4ccdb
movb $0x78, -0x1
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $-0x1, %rdi
callq 0x299b5
movq %rax, %rdi
callq 0x29af7
leaq 0x7daff(%rip), %rax     # 0xca800
movq 0x8(%rax), %rsi
jmp 0x4ced8
leaq 0x7d297(%rip), %r14     # 0xc9fa8
movq 0x588(%r14), %rdi
callq 0x37460
testl %eax, %eax
jne 0x4cecd
xorl %edi, %edi
callq 0x31b46
movq 0x588(%r14), %rdi
callq 0x3829e
testl %eax, %eax
je 0x4d154
leaq 0x4e456(%rip), %rsi     # 0x9b19d
jmp 0x4cd95
leaq 0x4e513(%rip), %rsi     # 0x9b263
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4cdae
cmpl $0x3, 0x30(%rbx)
jne 0x4cdae
movq 0x8(%rbx), %rax
movq (%rax), %rdi
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
callq 0x226ac
testq %rax, %rax
je 0x4d16c
movq 0x8(%rax), %rsi
movl (%rsi), %ecx
testb $0xf, %cl
je 0x4d17c
leaq 0x4e4d5(%rip), %rsi     # 0x9b26a
movq %rbx, %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2dc63
leaq 0x4e51b(%rip), %rsi     # 0x9b2d0
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4cef1
cmpl $0x3, 0x30(%rbx)
jne 0x4cef1
movq 0x10(%r15), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x313b2
testl %eax, %eax
jne 0x4ccd4
movq 0x8(%rbx), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0x221e2
cmpq $0x0, 0x8(%rsp)
jle 0x4cfd4
leaq 0x4e4cb(%rip), %r14     # 0x9b2d9
leaq 0x10(%rsp), %r15
leaq 0x4e4c7(%rip), %r12     # 0x9b2e1
xorl %r13d, %r13d
movl $0x80, %esi
movq %r15, %rdi
movq %r14, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x1f120
movq %r15, %rdi
callq 0x1f4f0
movq %r15, %rdi
movq %rax, %rsi
callq 0x3068f
movq %rax, %rbp
movq 0x8(%rbx), %rdi
movq %rax, %rsi
callq 0x3163a
testq %rax, %rax
jne 0x4ce90
movl $0x80, %esi
movq %r15, %rdi
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x1f120
movq %r15, %rdi
callq 0x1f4f0
movq %r15, %rdi
movq %rax, %rsi
callq 0x3068f
movq 0x8(%rbx), %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x317f0
movq %rbp, %rdi
callq 0x30b0c
incq %r13
cmpq 0x8(%rsp), %r13
jl 0x4ce1d
jmp 0x4cfd4
xorl %edi, %edi
callq 0x31b46
leaq 0x7d0ef(%rip), %r14     # 0xc9fa8
movq 0x4d8(%r14), %rdi
callq 0x49b45
testl %eax, %eax
je 0x4d11b
leaq 0x7d92c(%rip), %rax     # 0xca800
movq 0x10(%rax), %rsi
movq %rbx, %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2d97c
leaq 0x4e3f3(%rip), %rsi     # 0x9b2eb
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4cf5d
cmpl $0x2, 0x30(%rbx)
jne 0x4cf5d
callq 0x2845e
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x4c4a8
leaq 0x49cee(%rip), %r15     # 0x96c11
xorl %r12d, %r12d
movzbl 0x10(%rsp,%r12), %edx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x28a5e
movq %rax, %r14
incq %r12
cmpq $0x14, %r12
jne 0x4cf26
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ddb7
movq %r14, %rdi
callq 0x2850d
jmp 0x4ccd4
leaq 0x4e38e(%rip), %rsi     # 0x9b2f2
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4cfec
cmpl $0x3, 0x30(%rbx)
jne 0x4cfec
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x1fc40
mulsd 0x4e1d3(%rip), %xmm0    # 0x9b160
cvttsd2si %xmm0, %rcx
movabsq $0x431bde82d7b634db, %rdx # imm = 0x431BDE82D7B634DB
movq %rcx, %rax
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x12, %rdx
addq %rax, %rdx
leaq 0x10(%rsp), %rdi
movq %rdx, (%rdi)
imulq $0xf4240, %rdx, %rax    # imm = 0xF4240
subq %rax, %rcx
imulq $0x3e8, %rcx, %rax      # imm = 0x3E8
movq %rax, 0x8(%rdi)
xorl %esi, %esi
callq 0x1f8e0
leaq 0x7d825(%rip), %rax     # 0xca800
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x2d97c
jmp 0x4ccd4
leaq 0x4e305(%rip), %rsi     # 0x9b2f8
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4d024
cmpl $0x3, 0x30(%rbx)
jne 0x4d024
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
callq 0x1f710
leaq 0x7cf8f(%rip), %rcx     # 0xc9fa8
movl %eax, 0x470(%rcx)
jmp 0x4ccfa
leaq 0x4e2df(%rip), %rsi     # 0x9b30a
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4d08a
cmpl $0x3, 0x30(%rbx)
jl 0x4d08a
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
callq 0x25c20
testq %rax, %rax
je 0x4d1c1
movl 0x10(%rax), %ecx
testl %ecx, %ecx
setg %sil
movl 0x30(%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 0x4d1d5
leaq 0x4e2a7(%rip), %rsi     # 0x9b32c
jmp 0x4d1c8
leaq 0x4bdaa(%rip), %rsi     # 0x98e3b
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4d12f
cmpl $0x3, 0x30(%rbx)
jne 0x4d12f
leaq 0x54f24(%rip), %rdi     # 0xa1fd6
movl $0x1, %esi
callq 0x283f4
movq 0x38(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rsi
movq %rax, %rdi
callq 0x2873e
leaq 0x4e287(%rip), %rsi     # 0x9b35e
leaq 0x4e283(%rip), %rdx     # 0x9b361
movl $0x2, %ecx
movq %rax, %rdi
callq 0x29900
leaq 0x4c61d(%rip), %rsi     # 0x9970f
movl $0x2, %edx
movq %rax, %rdi
callq 0x28689
movq %rbx, %rdi
movq %rax, %rsi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2db20
movq $0x0, 0x560(%r14)
leaq 0x4e0b6(%rip), %rsi     # 0x9b1e3
jmp 0x4d15b
leaq 0x4e22e(%rip), %rsi     # 0x9b364
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2dc8a
leaq 0x4e064(%rip), %rsi     # 0x9b1bf
movl $0x3, %edi
xorl %eax, %eax
callq 0x23223
jmp 0x4ccfa
leaq 0x7d68d(%rip), %rax     # 0xca800
movq 0x78(%rax), %rsi
jmp 0x4ced8
shrl $0x4, %ecx
testb $0x7, %cl
jne 0x4cd8e
movq (%rax), %rax
movslq -0x8(%rax), %rdx
movslq -0x4(%rax), %rcx
movq 0x8(%rsi), %rax
movslq -0x8(%rax), %r8
movslq -0x4(%rax), %r9
leaq 0x4e0df(%rip), %rsi     # 0x9b285
movq %rbx, %rdi
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2ddde
leaq 0x4e14a(%rip), %rsi     # 0x9b312
movq %rbx, %rdi
callq 0x2dc63
jmp 0x4ccd4
movq 0x38(%rbx), %rsi
addq $0x10, %rsi
leaq 0x10(%rsp), %r15
movq %rax, %rdi
movq %r15, %rcx
callq 0x330a8
movq %rax, %r14
movslq (%r15), %rsi
movq %rbx, %rdi
callq 0x2e168
cmpl $0x0, (%r15)
jle 0x4d226
xorl %r15d, %r15d
movq 0x38(%rbx), %rax
movslq (%r14,%r15,4), %rcx
movq 0x10(%rax,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x2e204
incq %r15
movslq 0x10(%rsp), %rax
cmpq %rax, %r15
jl 0x4d204
movq %r14, %rdi
callq 0x330b7
jmp 0x4ccd4
cmpl $0x3, 0x30(%rbx)
jl 0x4d24e
movq 0x10(%r15), %rdi
callq 0x30c49
movq 0x38(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0x38(%rbx), %r15
movq (%r15), %rsi
leaq 0x4df37(%rip), %rdx     # 0x9b18f
leaq 0x4df09(%rip), %rcx     # 0x9b168
movq %rbx, %rdi
movl $0x102, %r8d            # imm = 0x102
callq 0x4d277
movl $0x1, %edi
callq 0x1f3b0