// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/db.c
// Function: sortGetKeys
int *sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys) {
    int i, j, num, *keys, found_store = 0;
    UNUSED(cmd);

    num = 0;
    keys = zmalloc(sizeof(int)*2); /* Alloc 2 places for the worst case. */

    keys[num++] = 1; /* <sort-key> is always present. */

    /* Search for STORE option. By default we consider options to don't
     * have arguments, so if we find an unknown option name we scan the
     * next. However there are options with 1 or 2 arguments, so we
     * provide a list here in order to skip the right number of args. */
    struct {
        char *name;
        int skip;
    } skiplist[] = {
        {"limit", 2},
        {"get", 1},
        {"by", 1},
        {NULL, 0} /* End of elements. */
    };

    for (i = 2; i < argc; i++) {
        for (j = 0; skiplist[j].name != NULL; j++) {
            if (!strcasecmp(argv[i]->ptr,skiplist[j].name)) {
                i += skiplist[j].skip;
                break;
            } else if (!strcasecmp(argv[i]->ptr,"store") && i+1 < argc) {
                /* Note: we don't increment "num" here and continue the loop
                 * to be sure to process the *last* "STORE" option if multiple
                 * ones are provided. This is same behavior as SORT. */
                found_store = 1;
                keys[num] = i+1; /* <store-key> */
                break;
            }
        }
    }
    *numkeys = num + found_store;
    return keys;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x8, %edi
callq 0x3acd0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x2c(%rbp)
movslq %ecx, %rcx
movl $0x1, (%rax,%rcx,4)
leaq -0x80(%rbp), %rdi
leaq 0x1234c6(%rip), %rsi    # 0x170620
movl $0x40, %edx
callq 0x26c60
movl $0x2, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x4d245
movl $0x0, -0x28(%rbp)
movslq -0x28(%rbp), %rcx
leaq -0x80(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x4d235
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
movslq -0x28(%rbp), %rcx
leaq -0x80(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0x26300
cmpl $0x0, %eax
jne 0x4d1dd
movslq -0x28(%rbp), %rcx
leaq -0x80(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x4d235
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xea67a(%rip), %rsi     # 0x13786e
callq 0x26300
cmpl $0x0, %eax
jne 0x4d223
movl -0x24(%rbp), %eax
addl $0x1, %eax
cmpl -0x14(%rbp), %eax
jge 0x4d223
movl $0x1, -0x3c(%rbp)
movl -0x24(%rbp), %edx
addl $0x1, %edx
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x4d235
jmp 0x4d225
jmp 0x4d227
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x4d17e
jmp 0x4d237
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x4d16b
movl -0x2c(%rbp), %ecx
addl -0x3c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x38(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nop