// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/bitops.c
// Function: bitcountCommand
void bitcountCommand(client *c) {
    robj *o;
    long start, end, strlen;
    unsigned char *p;
    char llbuf[LONG_STR_SIZE];

    /* Lookup, check for type, and return 0 for non existing keys. */
    if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
        checkType(c,o,OBJ_STRING)) return;
    p = getObjectReadOnlyString(o,&strlen,llbuf);

    /* Parse start/end range if any. */
    if (c->argc == 4) {
        if (getLongFromObjectOrReply(c,c->argv[2],&start,NULL) != C_OK)
            return;
        if (getLongFromObjectOrReply(c,c->argv[3],&end,NULL) != C_OK)
            return;
        /* Convert negative indexes */
        if (start < 0 && end < 0 && start > end) {
            addReply(c,shared.czero);
            return;
        }
        if (start < 0) start = strlen+start;
        if (end < 0) end = strlen+end;
        if (start < 0) start = 0;
        if (end < 0) end = 0;
        if (end >= strlen) end = strlen-1;
    } else if (c->argc == 2) {
        /* The whole string. */
        start = 0;
        end = strlen-1;
    } else {
        /* Syntax error. */
        addReply(c,shared.syntaxerr);
        return;
    }

    /* Precondition: end >= 0 && end < strlen, so the only condition where
     * zero can be returned is: start > end. */
    if (start > end) {
        addReply(c,shared.czero);
    } else {
        long bytes = end-start+1;

        addReplyLongLong(c,redisPopcount(p+start,bytes));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
leaq 0xe6d1d(%rip), %rax     # 0x178c40
movq 0x20(%rax), %rdx
callq 0x4a730
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x91f4a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x490a0
cmpl $0x0, %eax
je 0x91f4f
jmp 0x920dd
movq -0x10(%rbp), %rdi
leaq -0x50(%rbp), %rdx
leaq -0x28(%rbp), %rsi
callq 0x91090
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x4, 0x38(%rax)
jne 0x9204d
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
leaq -0x18(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x49f20
cmpl $0x0, %eax
je 0x91f99
jmp 0x920dd
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rax), %rsi
leaq -0x20(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x49f20
cmpl $0x0, %eax
je 0x91fc0
jmp 0x920dd
cmpq $0x0, -0x18(%rbp)
jge 0x91ff1
cmpq $0x0, -0x20(%rbp)
jge 0x91ff1
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jle 0x91ff1
movq -0x8(%rbp), %rdi
leaq 0xe6c5d(%rip), %rax     # 0x178c40
movq 0x20(%rax), %rsi
callq 0x42cc0
jmp 0x920dd
cmpq $0x0, -0x18(%rbp)
jge 0x92004
movq -0x28(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x20(%rbp)
jge 0x92017
movq -0x28(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
jge 0x92026
movq $0x0, -0x18(%rbp)
cmpq $0x0, -0x20(%rbp)
jge 0x92035
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jl 0x9204b
movq -0x28(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x92088
movq -0x8(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0x9206d
movq $0x0, -0x18(%rbp)
movq -0x28(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x92086
movq -0x8(%rbp), %rdi
leaq 0xe6bc8(%rip), %rax     # 0x178c40
movq 0x80(%rax), %rsi
callq 0x42cc0
jmp 0x920dd
jmp 0x92088
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jle 0x920a8
movq -0x8(%rbp), %rdi
leaq 0xe6ba3(%rip), %rax     # 0x178c40
movq 0x20(%rax), %rsi
callq 0x42cc0
jmp 0x920dd
movq -0x20(%rbp), %rax
subq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rdi
addq -0x18(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x901a0
movq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x43780
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)