// File: /workspace/github_c_makefile_star2_O2/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 0x47faa(%rip), %rsi     # 0x9113b
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x4929a
leaq 0x47f9c(%rip), %rsi     # 0x91144
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x492b4
leaq 0x47f89(%rip), %rsi     # 0x91148
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x497ca
leaq 0x47f80(%rip), %rsi     # 0x91156
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x492d4
leaq 0x47fae(%rip), %rsi     # 0x9119b
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x49469
leaq 0x4e836(%rip), %rsi     # 0x97a3a
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x49313
cmpl $0x3, 0x30(%rbx)
jne 0x49313
movq 0x8(%rbx), %rax
movq (%rax), %rdi
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
callq 0x21b64
testq %rax, %rax
je 0x496ef
movq 0x8(%rax), %r14
movl (%r14), %edi
shrl $0x4, %edi
andl $0xf, %edi
callq 0x2f69d
movq %rax, %r15
movl 0x4(%r14), %ebp
movq %r14, %rdi
callq 0x34c38
movq %rax, %r12
movl (%r14), %r13d
shrl $0x8, %r13d
movq %r14, %rdi
callq 0x2f6bb
movq %rax, %r10
leaq 0x47f54(%rip), %rsi     # 0x911cc
movq %rbx, %rdi
movq %r14, %rdx
movl %ebp, %ecx
movq %r15, %r8
movq %r12, %r9
xorl %eax, %eax
pushq %r10
pushq %r13
callq 0x2c44a
addq $0xa8, %rsp
jmp 0x492a9
movb $0x78, -0x1
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $-0x1
popq %rdi
callq 0x2828d
movq %rax, %rdi
callq 0x283cd
leaq 0x7e535(%rip), %rax     # 0xc7800
movq 0x8(%rax), %rsi
jmp 0x49496
leaq 0x7dccd(%rip), %r14     # 0xc6fa8
movq 0x588(%r14), %rdi
callq 0x34d06
testl %eax, %eax
jne 0x4948b
xorl %edi, %edi
callq 0x2fd47
movq 0x588(%r14), %rdi
callq 0x35a8b
testl %eax, %eax
je 0x496d9
leaq 0x47e4c(%rip), %rsi     # 0x9115d
jmp 0x4935f
leaq 0x47f09(%rip), %rsi     # 0x91223
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x49378
cmpl $0x3, 0x30(%rbx)
jne 0x49378
movq 0x8(%rbx), %rax
movq (%rax), %rdi
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
callq 0x21b64
testq %rax, %rax
je 0x496ef
movq 0x8(%rax), %rsi
movl (%rsi), %ecx
testb $0xf, %cl
je 0x49717
leaq 0x47ecb(%rip), %rsi     # 0x9122a
movq %rbx, %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2c2da
leaq 0x47f11(%rip), %rsi     # 0x91290
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x494af
cmpl $0x3, 0x30(%rbx)
jne 0x494af
movq 0x10(%r15), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x2f672
testl %eax, %eax
jne 0x492a2
movq 0x8(%rbx), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0x21751
leaq 0x47ecd(%rip), %r14     # 0x91299
leaq 0x10(%rsp), %r15
leaq 0x47ec9(%rip), %r12     # 0x912a1
xorl %r13d, %r13d
cmpq 0x8(%rsp), %r13
jge 0x49562
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 0x2ea81
movq %rax, %rbp
movq 0x8(%rbx), %rdi
movq %rax, %rsi
callq 0x2f89e
testq %rax, %rax
jne 0x49459
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 0x2ea81
movq 0x8(%rbx), %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x2fa09
movq %rbp, %rdi
callq 0x2ee1f
incq %r13
jmp 0x493db
xorl %edi, %edi
callq 0x2fd47
leaq 0x7db31(%rip), %r14     # 0xc6fa8
movq 0x4d8(%r14), %rdi
callq 0x465b7
testl %eax, %eax
je 0x496a3
leaq 0x7e36e(%rip), %rax     # 0xc7800
movq 0x10(%rax), %rsi
movq %rbx, %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2c10d
leaq 0x47df5(%rip), %rsi     # 0x912ab
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x49509
cmpl $0x2, 0x30(%rbx)
jne 0x49509
callq 0x271bf
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x48b38
leaq 0x436ff(%rip), %r15     # 0x8cbe0
xorl %r12d, %r12d
cmpq $0x14, %r12
je 0x496ff
movzbl 0x10(%rsp,%r12), %edx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2763d
movq %rax, %r14
incq %r12
jmp 0x494e4
leaq 0x47da2(%rip), %rsi     # 0x912b2
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4957a
cmpl $0x3, 0x30(%rbx)
jne 0x4957a
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x1fc40
mulsd 0x47be7(%rip), %xmm0    # 0x91120
cvttsd2si %xmm0, %rax
movl $0xf4240, %ecx          # imm = 0xF4240
cqto
idivq %rcx
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
imulq $0x3e8, %rdx, %rax      # imm = 0x3E8
movq %rax, 0x8(%rdi)
xorl %esi, %esi
callq 0x1f8e0
leaq 0x7e297(%rip), %rax     # 0xc7800
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x2c10d
jmp 0x492a2
leaq 0x47d37(%rip), %rsi     # 0x912b8
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x495b2
cmpl $0x3, 0x30(%rbx)
jne 0x495b2
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
callq 0x1f710
leaq 0x7da01(%rip), %rcx     # 0xc6fa8
movl %eax, 0x470(%rcx)
jmp 0x492c4
leaq 0x47d11(%rip), %rsi     # 0x912ca
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x49618
cmpl $0x3, 0x30(%rbx)
jl 0x49618
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
callq 0x24bcc
testq %rax, %rax
je 0x4975c
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 0x49770
leaq 0x47cd9(%rip), %rsi     # 0x912ec
jmp 0x49763
leaq 0x457e0(%rip), %rsi     # 0x8edff
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x496b4
cmpl $0x3, 0x30(%rbx)
jne 0x496b4
leaq 0x4e942(%rip), %rdi     # 0x97f7e
pushq $0x1
popq %rsi
callq 0x27158
movq 0x38(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rsi
movq %rax, %rdi
callq 0x273e6
leaq 0x47cbf(%rip), %rsi     # 0x9131e
leaq 0x47cbb(%rip), %rdx     # 0x91321
pushq $0x2
popq %r14
movq %rax, %rdi
movq %r14, %rcx
callq 0x281ff
leaq 0x46057(%rip), %rsi     # 0x8f6d3
movq %rax, %rdi
movq %r14, %rdx
callq 0x2736d
movq %rbx, %rdi
movq %rax, %rsi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2c20f
andq $0x0, 0x560(%r14)
leaq 0x47af1(%rip), %rsi     # 0x911a3
jmp 0x496e0
leaq 0x47c69(%rip), %rsi     # 0x91324
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 0x2c301
leaq 0x47a9f(%rip), %rsi     # 0x9117f
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x22613
jmp 0x492c4
leaq 0x7e10a(%rip), %rax     # 0xc7800
movq 0x78(%rax), %rsi
jmp 0x49496
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2c423
movq %r14, %rdi
callq 0x271f7
jmp 0x492a2
shrl $0x4, %ecx
testb $0x7, %cl
jne 0x49358
movq (%rax), %rax
movslq -0x8(%rax), %rdx
movslq -0x4(%rax), %rcx
movq 0x8(%rsi), %rax
movslq -0x8(%rax), %r8
movslq -0x4(%rax), %r9
leaq 0x47b04(%rip), %rsi     # 0x91245
movq %rbx, %rdi
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2c44a
leaq 0x47b6f(%rip), %rsi     # 0x912d2
movq %rbx, %rdi
callq 0x2c2da
jmp 0x492a2
movq 0x38(%rbx), %rsi
addq $0x10, %rsi
leaq 0x10(%rsp), %r15
movq %rax, %rdi
movq %r15, %rcx
callq 0x310c6
movq %rax, %r14
movslq (%r15), %rsi
movq %rbx, %rdi
callq 0x2c7c7
xorl %r15d, %r15d
movslq 0x10(%rsp), %rax
cmpq %rax, %r15
jge 0x497bd
movq 0x38(%rbx), %rax
movslq (%r14,%r15,4), %rcx
movq 0x10(%rax,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x2c84a
incq %r15
jmp 0x49799
movq %r14, %rdi
callq 0x310d5
jmp 0x492a2
cmpl $0x3, 0x30(%rbx)
jl 0x497e5
movq 0x10(%r15), %rdi
callq 0x2ef4c
movq 0x38(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0x38(%rbx), %r15
movq (%r15), %rsi
leaq 0x47960(%rip), %rdx     # 0x9114f
leaq 0x47932(%rip), %rcx     # 0x91128
movq %rbx, %rdi
movl $0x102, %r8d            # imm = 0x102
callq 0x4980c
pushq $0x1
popq %rdi
callq 0x1f3b0