// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movl $0xa0, -0x8(%rbp)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x27870
movslq -0x4(%rbp), %rcx
leaq 0xe8003(%rip), %rax     # 0x10f680
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x277dc
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
addl $-0x4d, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x2a, %eax
ja 0x277a9
movq -0x28(%rbp), %rax
leaq 0xb6b38(%rip), %rcx     # 0xde200
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x1, %ecx
movl %ecx, 0x20(%rax)
jmp 0x277cb
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x20(%rax)
jmp 0x277cb
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x20(%rax)
jmp 0x277cb
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x10, %ecx
movl %ecx, 0x20(%rax)
jmp 0x277cb
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x20, %ecx
movl %ecx, 0x20(%rax)
jmp 0x277cb
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x40, %ecx
movl %ecx, 0x20(%rax)
jmp 0x277cb
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x80, %ecx
movl %ecx, 0x20(%rax)
jmp 0x277cb
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x20(%rax)
jmp 0x277cb
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x200, %ecx            # imm = 0x200
movl %ecx, 0x20(%rax)
jmp 0x277cb
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x400, %ecx            # imm = 0x400
movl %ecx, 0x20(%rax)
jmp 0x277cb
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movl %ecx, 0x20(%rax)
jmp 0x277cb
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x1000, %ecx           # imm = 0x1000
movl %ecx, 0x20(%rax)
jmp 0x277cb
leaq 0xb7a36(%rip), %rdi     # 0xdf1e6
leaq 0xc309d(%rip), %rsi     # 0xea854
movl $0x8c8, %edx            # imm = 0x8C8
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x27694
movq 0xec12d(%rip), %rax     # 0x113910
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2c0e0
movq -0x38(%rbp), %rdi
movq %rax, %rsi
movq -0x10(%rbp), %rdx
callq 0x236d0
movl %eax, -0x1c(%rbp)
movq 0xec10b(%rip), %rax     # 0x113918
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2c0e0
movq -0x30(%rbp), %rdi
movq %rax, %rsi
movq -0x10(%rbp), %rdx
callq 0x236d0
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x2783e
cmpl $0x0, -0x20(%rbp)
jne 0x2783e
jmp 0x27860
leaq 0xb79bc(%rip), %rdi     # 0xdf201
leaq 0xc3008(%rip), %rsi     # 0xea854
movl $0x8d9, %edx            # imm = 0x8D9
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
jmp 0x27862
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x27666
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)