// File: /workspace/github_c_makefile_star2_O1/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 0xa187d(%rip), %r12     # 0xc6670
leaq 0x6f406(%rip), %r13     # 0x94200
leaq (%r15,%r15,4), %rax
shlq $0x4, %rax
leaq (%r12,%rax), %rbx
movq 0x18(%rax,%r12), %rax
movzbl (%rax), %ecx
cmpl $0x52, %ecx
jle 0x24e2c
leal -0x6b(%rcx), %edx
cmpl $0xc, %edx
ja 0x24e44
movslq (%r13,%rdx,4), %rcx
addq %r13, %rcx
jmpq *%rcx
movl $0x1000, %ecx           # imm = 0x1000
jmp 0x24e8f
cmpl $0x4d, %ecx
je 0x24e3d
cmpl $0x52, %ecx
jne 0x24e9a
movl $0x80, %ecx
jmp 0x24e8f
movl $0x800, %ecx            # imm = 0x800
jmp 0x24e8f
cmpl $0x53, %ecx
je 0x24e8a
cmpl $0x61, %ecx
jne 0x24efd
movl $0x10, %ecx
jmp 0x24e8f
movl $0x1, %ecx
jmp 0x24e8f
movl $0x200, %ecx            # imm = 0x200
jmp 0x24e8f
movl $0x20, %ecx
jmp 0x24e8f
movl $0x40, %ecx
jmp 0x24e8f
movl $0x2, %ecx
jmp 0x24e8f
movl $0x4, %ecx
jmp 0x24e8f
movl $0x400, %ecx            # imm = 0x400
jmp 0x24e8f
movl $0x100, %ecx            # imm = 0x100
orl %ecx, 0x20(%rbx)
incq %rax
jmp 0x24e0b
testl %ecx, %ecx
jne 0x24efd
movq 0xa511b(%rip), %r14     # 0xc9fc0
movq (%rbx), %rdi
callq 0x281da
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x222b6
movl %eax, %ebp
movq 0xa5104(%rip), %r14     # 0xc9fc8
movq (%rbx), %rdi
callq 0x281da
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x222b6
orl %ebp, %eax
jne 0x24f1f
incq %r15
cmpq $0xa0, %r15
jne 0x24dfa
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7026a(%rip), %rdi     # 0x9516e
leaq 0x7b785(%rip), %rsi     # 0xa0690
movl $0x8c8, %edx            # imm = 0x8C8
callq 0x4d0e5
movl $0x1, %edi
callq 0x1f3b0
leaq 0x70263(%rip), %rdi     # 0x95189
leaq 0x7b763(%rip), %rsi     # 0xa0690
movl $0x8d9, %edx            # imm = 0x8D9
callq 0x4d037
jmp 0x24f15