// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/t_string.c
// Function: getrangeCommand
void getrangeCommand(client *c) {
    robj *o;
    long long start, end;
    char *str, llbuf[32];
    size_t strlen;

    if (getLongLongFromObjectOrReply(c,c->argv[2],&start,NULL) != C_OK)
        return;
    if (getLongLongFromObjectOrReply(c,c->argv[3],&end,NULL) != C_OK)
        return;
    if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.emptybulk)) == NULL ||
        checkType(c,o,OBJ_STRING)) return;

    if (o->encoding == OBJ_ENCODING_INT) {
        str = llbuf;
        strlen = ll2string(llbuf,sizeof(llbuf),(long)o->ptr);
    } else {
        str = o->ptr;
        strlen = sdslen(str);
    }

    /* Convert negative indexes */
    if (start < 0 && end < 0 && start > end) {
        addReply(c,shared.emptybulk);
        return;
    }
    if (start < 0) start = strlen+start;
    if (end < 0) end = strlen+end;
    if (start < 0) start = 0;
    if (end < 0) end = 0;
    if ((unsigned long long)end >= strlen) end = strlen-1;

    /* Precondition: end >= 0 && end < strlen, so the only condition where
     * nothing can be returned is: start > end. */
    if (start > end || strlen == 0) {
        addReply(c,shared.emptybulk);
    } else {
        addReplyBulkCBuffer(c,(char*)str+start,end-start+1);
    }
}

// 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 0x10(%rax), %rsi
leaq -0x18(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x49ea0
cmpl $0x0, %eax
je 0x58323
jmp 0x584ac
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 0x49ea0
cmpl $0x0, %eax
je 0x5834a
jmp 0x584ac
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
leaq 0x1208df(%rip), %rax    # 0x178c40
movq 0x18(%rax), %rdx
callq 0x4a730
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x58388
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x490a0
cmpl $0x0, %eax
je 0x5838d
jmp 0x584ac
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x1, %eax
jne 0x583c4
leaq -0x50(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq -0x50(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x20, %esi
callq 0x477e0
cltq
movq %rax, -0x58(%rbp)
jmp 0x583dd
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x58210
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x18(%rbp)
jge 0x5840e
cmpq $0x0, -0x20(%rbp)
jge 0x5840e
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jle 0x5840e
movq -0x8(%rbp), %rdi
leaq 0x120840(%rip), %rax    # 0x178c40
movq 0x18(%rax), %rsi
callq 0x42cc0
jmp 0x584ac
cmpq $0x0, -0x18(%rbp)
jge 0x58421
movq -0x58(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x20(%rbp)
jge 0x58434
movq -0x58(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
jge 0x58443
movq $0x0, -0x18(%rbp)
cmpq $0x0, -0x20(%rbp)
jge 0x58452
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x58(%rbp), %rax
jb 0x58468
movq -0x58(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jg 0x58479
cmpq $0x0, -0x58(%rbp)
jne 0x5848f
movq -0x8(%rbp), %rdi
leaq 0x1207bc(%rip), %rax    # 0x178c40
movq 0x18(%rax), %rsi
callq 0x42cc0
jmp 0x584ac
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
subq -0x18(%rbp), %rdx
addq $0x1, %rdx
callq 0x43920
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)