// File: /workspace/github_c_makefile_star2_O3/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
pushq %rax
xorl %r15d, %r15d
leaq 0xa169d(%rip), %r12     # 0xc6670
leaq 0x6f276(%rip), %r13     # 0x94250
leaq (%r15,%r15,4), %rax
shlq $0x4, %rax
leaq (%r12,%rax), %rbx
movq 0x18(%rax,%r12), %rax
movzbl (%rax), %ecx
cmpl $0x52, %ecx
jle 0x2500c
leal -0x6b(%rcx), %edx
cmpl $0xc, %edx
ja 0x25024
movslq (%r13,%rdx,4), %rcx
addq %r13, %rcx
jmpq *%rcx
movl $0x1000, %ecx           # imm = 0x1000
jmp 0x2506f
cmpl $0x4d, %ecx
je 0x2501d
cmpl $0x52, %ecx
jne 0x2507a
movl $0x80, %ecx
jmp 0x2506f
movl $0x800, %ecx            # imm = 0x800
jmp 0x2506f
cmpl $0x53, %ecx
je 0x2506a
cmpl $0x61, %ecx
jne 0x250dd
movl $0x10, %ecx
jmp 0x2506f
movl $0x1, %ecx
jmp 0x2506f
movl $0x200, %ecx            # imm = 0x200
jmp 0x2506f
movl $0x20, %ecx
jmp 0x2506f
movl $0x40, %ecx
jmp 0x2506f
movl $0x2, %ecx
jmp 0x2506f
movl $0x4, %ecx
jmp 0x2506f
movl $0x400, %ecx            # imm = 0x400
jmp 0x2506f
movl $0x100, %ecx            # imm = 0x100
orl %ecx, 0x20(%rbx)
incq %rax
jmp 0x24feb
testl %ecx, %ecx
jne 0x250dd
movq 0xa4f3b(%rip), %r14     # 0xc9fc0
movq (%rbx), %rdi
callq 0x28486
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x2249c
movl %eax, %ebp
movq 0xa4f24(%rip), %r14     # 0xc9fc8
movq (%rbx), %rdi
callq 0x28486
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x2249c
orl %ebp, %eax
jne 0x250ff
incq %r15
cmpq $0xa0, %r15
jne 0x24fda
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x700da(%rip), %rdi     # 0x951be
leaq 0x7b625(%rip), %rsi     # 0xa0710
movl $0x8c8, %edx            # imm = 0x8C8
callq 0x4cae0
movl $0x1, %edi
callq 0x1f3b0
leaq 0x700d3(%rip), %rdi     # 0x951d9
leaq 0x7b603(%rip), %rsi     # 0xa0710
movl $0x8d9, %edx            # imm = 0x8D9
callq 0x4ca32
jmp 0x250f5