// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/redis-cli.c
// Function: hintsCallback
static char *hintsCallback(const char *buf, int *color, int *bold) {
    if (!pref.hints) return NULL;

    int i, argc, buflen = strlen(buf);
    sds *argv = sdssplitargs(buf,&argc);
    int endspace = buflen && isspace(buf[buflen-1]);

    /* Check if the argument list is empty and return ASAP. */
    if (argc == 0) {
        sdsfreesplitres(argv,argc);
        return NULL;
    }

    for (i = 0; i < helpEntriesLen; i++) {
        if (!(helpEntries[i].type & CLI_HELP_COMMAND)) continue;

        if (strcasecmp(argv[0],helpEntries[i].full) == 0)
        {
            *color = 90;
            *bold = 0;
            sds hint = sdsnew(helpEntries[i].org->params);

            /* Remove arguments from the returned hint to show only the
             * ones the user did not yet typed. */
            int toremove = argc-1;
            while(toremove > 0 && sdslen(hint)) {
                if (hint[0] == '[') break;
                if (hint[0] == ' ') toremove--;
                sdsrange(hint,1,-1);
            }

            /* Add an initial space if needed. */
            if (!endspace) {
                sds newhint = sdsnewlen(" ",1);
                newhint = sdscatsds(newhint,hint);
                sdsfree(hint);
                hint = newhint;
            }

            sdsfreesplitres(argv,argc);
            return hint;
        }
    }
    sdsfreesplitres(argv,argc);
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpb $0x1, 0x40831(%rip)     # 0x563f8
jne 0x15c74
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
callq 0x101c0
movq %rax, %r13
leaq 0x4(%rsp), %rsi
movq %r12, %rdi
callq 0x1a100
movq %rax, %rbx
testl %r13d, %r13d
je 0x15c15
callq 0x10710
movq (%rax), %rax
decl %r13d
movslq %r13d, %rcx
movsbq (%r12,%rcx), %rcx
movb 0x1(%rax,%rcx,2), %r12b
andb $0x20, %r12b
shrb $0x5, %r12b
jmp 0x15c18
xorl %r12d, %r12d
movl 0x4(%rsp), %ebp
testl %ebp, %ebp
je 0x15c7c
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movl 0x40933(%rip), %r15d    # 0x56564
movq 0x40930(%rip), %r13     # 0x56568
xorl %r14d, %r14d
testl %r15d, %r15d
cmovlel %r14d, %r15d
shlq $0x5, %r15
cmpq %r14, %r15
je 0x15c6a
testb $0x1, (%r13,%r14)
je 0x15c64
movq (%rbx), %rdi
movq 0x10(%r13,%r14), %rsi
callq 0x10080
testl %eax, %eax
je 0x15c89
addq $0x20, %r14
jmp 0x15c46
movq %rbx, %rdi
movl %ebp, %esi
callq 0x19f36
xorl %r14d, %r14d
jmp 0x15d29
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x15d24
movq 0x8(%rsp), %rax
movl $0x5a, (%rax)
movq 0x10(%rsp), %rax
andl $0x0, (%rax)
movq 0x18(%r13,%r14), %rax
movq 0x8(%rax), %rdi
callq 0x18ed2
movq %rax, %r14
movl 0x4(%rsp), %r13d
decl %r13d
pushq $0x1
popq %rbp
pushq $-0x1
popq %r15
testl %r13d, %r13d
jle 0x15cf0
movq %r14, %rdi
callq 0x159d8
testq %rax, %rax
je 0x15cf0
movzbl (%r14), %eax
cmpl $0x20, %eax
je 0x15cde
cmpl $0x5b, %eax
jne 0x15ce1
jmp 0x15cf0
decl %r13d
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x19c06
jmp 0x15cbc
testb %r12b, %r12b
jne 0x15d1d
leaq 0x2b03a(%rip), %rdi     # 0x40d36
pushq $0x1
popq %rsi
callq 0x18d90
movq %rax, %rdi
movq %r14, %rsi
callq 0x19556
movq %rax, %r15
movq %r14, %rdi
callq 0x18f40
movq %r15, %r14
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0x19f36
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq