// File: /workspace/github_c_makefile_star2_O1/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 0x4df73(%rip), %rsi     # 0x9b13b
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x4d2d1
leaq 0x4df65(%rip), %rsi     # 0x9b144
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x4d2eb
leaq 0x4df52(%rip), %rsi     # 0x9b148
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x4d82e
leaq 0x4df49(%rip), %rsi     # 0x9b156
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x4d30f
leaq 0x4df77(%rip), %rsi     # 0x9b19b
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
je 0x4d4b0
leaq 0x547df(%rip), %rsi     # 0xa1a1a
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4d34e
cmpl $0x3, 0x30(%rbx)
jne 0x4d34e
movq 0x8(%rbx), %rax
movq (%rax), %rdi
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
callq 0x224dc
testq %rax, %rax
je 0x4d767
movq 0x8(%rax), %r14
movl (%r14), %edi
shrl $0x4, %edi
andl $0xf, %edi
callq 0x3110c
movq %rax, %r15
movl 0x4(%r14), %ebp
movq %r14, %rdi
callq 0x3716f
movq %rax, %r12
movl (%r14), %r13d
shrl $0x8, %r13d
movq %r14, %rdi
callq 0x31127
movq %rax, %r10
leaq 0x4df1d(%rip), %rsi     # 0x9b1cc
movq %rbx, %rdi
movq %r14, %rdx
movl %ebp, %ecx
movq %r15, %r8
movq %r12, %r9
xorl %eax, %eax
pushq %r10
pushq %r13
callq 0x2db4e
addq $0xa8, %rsp
jmp 0x4d2e0
movb $0x78, -0x1
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $-0x1, %rdi
callq 0x29709
movq %rax, %rdi
callq 0x2984b
leaq 0x7d4fa(%rip), %rax     # 0xca800
movq 0x8(%rax), %rsi
jmp 0x4d4dd
leaq 0x7cc92(%rip), %r14     # 0xc9fa8
movq 0x588(%r14), %rdi
callq 0x3725a
testl %eax, %eax
jne 0x4d4d2
xorl %edi, %edi
callq 0x3185b
movq 0x588(%r14), %rdi
callq 0x3811a
testl %eax, %eax
je 0x4d74f
leaq 0x4de11(%rip), %rsi     # 0x9b15d
jmp 0x4d39a
leaq 0x4dece(%rip), %rsi     # 0x9b223
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4d3b3
cmpl $0x3, 0x30(%rbx)
jne 0x4d3b3
movq 0x8(%rbx), %rax
movq (%rax), %rdi
movq 0x10(%r15), %rax
movq 0x8(%rax), %rsi
callq 0x224dc
testq %rax, %rax
je 0x4d767
movq 0x8(%rax), %rsi
movl (%rsi), %ecx
testb $0xf, %cl
je 0x4d777
leaq 0x4de90(%rip), %rsi     # 0x9b22a
movq %rbx, %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2d9d7
leaq 0x4ded6(%rip), %rsi     # 0x9b290
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4d4f6
cmpl $0x3, 0x30(%rbx)
jne 0x4d4f6
movq 0x10(%r15), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x310df
testl %eax, %eax
jne 0x4d2d9
movq 0x8(%rbx), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0x21ffe
cmpq $0x0, 0x8(%rsp)
jle 0x4d5d9
leaq 0x4de86(%rip), %r14     # 0x9b299
leaq 0x10(%rsp), %r15
leaq 0x4de82(%rip), %r12     # 0x9b2a1
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 0x303b7
movq %rax, %rbp
movq 0x8(%rbx), %rdi
movq %rax, %rsi
callq 0x3136a
testq %rax, %rax
jne 0x4d495
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 0x303b7
movq 0x8(%rbx), %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x314ef
movq %rbp, %rdi
callq 0x30834
incq %r13
cmpq 0x8(%rsp), %r13
jl 0x4d422
jmp 0x4d5d9
xorl %edi, %edi
callq 0x3185b
leaq 0x7caea(%rip), %r14     # 0xc9fa8
movq 0x4d8(%r14), %rdi
callq 0x4a063
testl %eax, %eax
je 0x4d716
leaq 0x7d327(%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 0x2d6f0
leaq 0x4ddae(%rip), %rsi     # 0x9b2ab
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4d562
cmpl $0x2, 0x30(%rbx)
jne 0x4d562
callq 0x281b2
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x4cac4
leaq 0x49691(%rip), %r15     # 0x96bb9
xorl %r12d, %r12d
movzbl 0x10(%rsp,%r12), %edx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x28760
movq %rax, %r14
incq %r12
cmpq $0x14, %r12
jne 0x4d52b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2db27
movq %r14, %rdi
callq 0x28204
jmp 0x4d2d9
leaq 0x4dd49(%rip), %rsi     # 0x9b2b2
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4d5f1
cmpl $0x3, 0x30(%rbx)
jne 0x4d5f1
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x1fc40
mulsd 0x4db8e(%rip), %xmm0    # 0x9b120
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 0x7d220(%rip), %rax     # 0xca800
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x2d6f0
jmp 0x4d2d9
leaq 0x4dcc0(%rip), %rsi     # 0x9b2b8
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4d629
cmpl $0x3, 0x30(%rbx)
jne 0x4d629
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
callq 0x1f710
leaq 0x7c98a(%rip), %rcx     # 0xc9fa8
movl %eax, 0x470(%rcx)
jmp 0x4d2ff
leaq 0x4dc9a(%rip), %rsi     # 0x9b2ca
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4d685
cmpl $0x3, 0x30(%rbx)
jl 0x4d685
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
callq 0x25a1e
testq %rax, %rax
je 0x4d7bc
movl 0x10(%rax), %ecx
testl %ecx, %ecx
jle 0x4d669
movl 0x30(%rbx), %edx
addl $-0x2, %edx
cmpl %edx, %ecx
jne 0x4d679
movl 0x30(%rbx), %edx
addl $-0x2, %edx
negl %ecx
cmpl %ecx, %edx
jge 0x4d7d0
leaq 0x4dc6c(%rip), %rsi     # 0x9b2ec
jmp 0x4d7c3
leaq 0x4b766(%rip), %rsi     # 0x98df2
movq %r14, %rdi
callq 0x1f2e0
testl %eax, %eax
jne 0x4d72a
cmpl $0x3, 0x30(%rbx)
jne 0x4d72a
leaq 0x54899(%rip), %rdi     # 0xa1f46
movl $0x1, %esi
callq 0x28148
movq 0x38(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rsi
movq %rax, %rdi
callq 0x2843c
leaq 0x4dc4c(%rip), %rsi     # 0x9b31e
leaq 0x4dc48(%rip), %rdx     # 0x9b321
movl $0x2, %ecx
movq %rax, %rdi
callq 0x29653
leaq 0x4bfda(%rip), %rsi     # 0x996c7
movl $0x2, %edx
movq %rax, %rdi
callq 0x28380
movq %rbx, %rdi
movq %rax, %rsi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2d894
movq $0x0, 0x560(%r14)
leaq 0x4da7b(%rip), %rsi     # 0x9b1a3
jmp 0x4d756
leaq 0x4dbf3(%rip), %rsi     # 0x9b324
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 0x2d9fe
leaq 0x4da29(%rip), %rsi     # 0x9b17f
movl $0x3, %edi
xorl %eax, %eax
callq 0x23064
jmp 0x4d2ff
leaq 0x7d092(%rip), %rax     # 0xca800
movq 0x78(%rax), %rsi
jmp 0x4d4dd
shrl $0x4, %ecx
testb $0x7, %cl
jne 0x4d393
movq (%rax), %rax
movslq -0x8(%rax), %rdx
movslq -0x4(%rax), %rcx
movq 0x8(%rsi), %rax
movslq -0x8(%rax), %r8
movslq -0x4(%rax), %r9
leaq 0x4daa4(%rip), %rsi     # 0x9b245
movq %rbx, %rdi
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2db4e
leaq 0x4db0f(%rip), %rsi     # 0x9b2d2
movq %rbx, %rdi
callq 0x2d9d7
jmp 0x4d2d9
movq 0x38(%rbx), %rsi
addq $0x10, %rsi
leaq 0x10(%rsp), %r15
movq %rax, %rdi
movq %r15, %rcx
callq 0x32d32
movq %rax, %r14
movslq (%r15), %rsi
movq %rbx, %rdi
callq 0x2ded8
cmpl $0x0, (%r15)
jle 0x4d821
xorl %r15d, %r15d
movq 0x38(%rbx), %rax
movslq (%r14,%r15,4), %rcx
movq 0x10(%rax,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x2df74
incq %r15
movslq 0x10(%rsp), %rax
cmpq %rax, %r15
jl 0x4d7ff
movq %r14, %rdi
callq 0x32d41
jmp 0x4d2d9
cmpl $0x3, 0x30(%rbx)
jl 0x4d845
movq 0x10(%r15), %rdi
callq 0x30971
movq 0x38(%rbx), %rcx
movq %rax, 0x10(%rcx)
movq 0x38(%rbx), %rax
movq (%rax), %rsi
leaq 0x4d8fc(%rip), %rdx     # 0x9b14f
leaq 0x4d8ce(%rip), %rcx     # 0x9b128
movq %rbx, %rdi
movl $0x102, %r8d            # imm = 0x102
callq 0x4d872
movl $0x1, %edi
callq 0x1f3b0