// File: /workspace/github_c_makefile_star2_O2/nilyang[P]redis-tdd-annotation/src/redis.c
// Function: populateCommandTable
void populateCommandTable(void) {
    int j;

    // 命令的数量
    int numcommands = sizeof(redisCommandTable)/sizeof(struct redisCommand);

    for (j = 0; j < numcommands; j++) {
        
        // 指定命令
        struct redisCommand *c = redisCommandTable+j;

        // 取出字符串 FLAG
        char *f = c->sflags;

        int retval1, retval2;

        // 根据字符串 FLAG 生成实际 FLAG
        while(*f != '\0') {
            switch(*f) {
            case 'w': c->flags |= REDIS_CMD_WRITE; break;
            case 'r': c->flags |= REDIS_CMD_READONLY; break;
            case 'm': c->flags |= REDIS_CMD_DENYOOM; break;
            case 'a': c->flags |= REDIS_CMD_ADMIN; break;
            case 'p': c->flags |= REDIS_CMD_PUBSUB; break;
            case 's': c->flags |= REDIS_CMD_NOSCRIPT; break;
            case 'R': c->flags |= REDIS_CMD_RANDOM; break;
            case 'S': c->flags |= REDIS_CMD_SORT_FOR_SCRIPT; break;
            case 'l': c->flags |= REDIS_CMD_LOADING; break;
            case 't': c->flags |= REDIS_CMD_STALE; break;
            case 'M': c->flags |= REDIS_CMD_SKIP_MONITOR; break;
            case 'k': c->flags |= REDIS_CMD_ASKING; break;
            default: redisPanic("Unsupported command flag"); break;
            }
            f++;
        }

        // 将命令关联到命令表
        retval1 = dictAdd(server.commands, sdsnew(c->name), c);

        /* Populate an additional dictionary that will be unaffected
         * by rename-command statements in redis.conf. 
         *
         * 将命令也关联到原始命令表
         *
         * 原始命令表不会受 redis.conf 中命令改名的影响
         */
        retval2 = dictAdd(server.orig_commands, sdsnew(c->name), c);

        redisAssert(retval1 == DICT_OK && retval2 == DICT_OK);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorl %esi, %esi
pushq $0x1
popq %r13
pushq $0x10
popq %rdi
leaq 0x66152(%rip), %rbp     # 0x8a210
pushq $0x4
popq %r8
pushq $0x20
popq %r14
pushq $0x2
popq %r12
pushq $0x40
popq %r15
cmpq $0xa0, %rsi
je 0x241eb
imulq $0x50, %rsi, %rax
leaq 0x9f58a(%rip), %rcx     # 0xc3670
leaq (%rcx,%rax), %rbx
movq 0x18(%rax,%rcx), %rax
movzbl (%rax), %ecx
leal -0x6b(%rcx), %edx
cmpl $0xc, %edx
ja 0x2410e
movslq (%rbp,%rdx,4), %rdx
addq %rbp, %rdx
movl %r13d, %ecx
jmpq *%rdx
movl $0x1000, %ecx           # imm = 0x1000
jmp 0x2415b
cmpl $0x4d, %ecx
je 0x2414f
cmpl $0x52, %ecx
je 0x24156
cmpl $0x53, %ecx
je 0x24148
cmpl $0x61, %ecx
jne 0x24163
movl %edi, %ecx
jmp 0x2415b
movl %r8d, %ecx
jmp 0x2415b
movl $0x200, %ecx            # imm = 0x200
jmp 0x2415b
movl %r14d, %ecx
jmp 0x2415b
movl %r12d, %ecx
jmp 0x2415b
movl %r15d, %ecx
jmp 0x2415b
movl $0x400, %ecx            # imm = 0x400
jmp 0x2415b
movl $0x100, %ecx            # imm = 0x100
jmp 0x2415b
movl $0x800, %ecx            # imm = 0x800
jmp 0x2415b
movl $0x80, %ecx
orl %ecx, 0x20(%rbx)
incq %rax
jmp 0x240ef
testl %ecx, %ecx
jne 0x241fa
movq 0xa2e4e(%rip), %rax     # 0xc6fc0
movq %rax, (%rsp)
movq (%rbx), %rdi
movq %rsi, 0x10(%rsp)
callq 0x271cd
movq (%rsp), %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x21956
movl %eax, (%rsp)
movq 0xa2e2c(%rip), %rax     # 0xc6fc8
movq %rax, 0x8(%rsp)
movq (%rbx), %rdi
callq 0x271cd
movq 0x8(%rsp), %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x21956
pushq $0x4
popq %r8
pushq $0x10
popq %rdi
movq 0x10(%rsp), %rsi
incq %rsi
orl (%rsp), %eax
je 0x240ce
leaq 0x66fc1(%rip), %rdi     # 0x8b199
leaq 0x724ad(%rip), %rsi     # 0x9668c
movl $0x8d9, %edx            # imm = 0x8D9
callq 0x4906b
jmp 0x24212
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x66f7d(%rip), %rdi     # 0x8b17e
leaq 0x72484(%rip), %rsi     # 0x9668c
movl $0x8c8, %edx            # imm = 0x8C8
callq 0x490e8
pushq $0x1
popq %rdi
callq 0x1f3b0