// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/src/t_string.c
// Function: incrDecrCommand
void incrDecrCommand(client *c, long long incr) {
    long long value, oldvalue;
    robj *o, *new;

    o = lookupKeyWrite(c->db,c->argv[1]);
    if (o != NULL && checkType(c,o,OBJ_STRING)) return;
    if (getLongLongFromObjectOrReply(c,o,&value,NULL) != C_OK) return;

    oldvalue = value;
    if ((incr < 0 && oldvalue < 0 && incr < (LLONG_MIN-oldvalue)) ||
        (incr > 0 && oldvalue > 0 && incr > (LLONG_MAX-oldvalue))) {
        addReplyError(c,"increment or decrement would overflow");
        return;
    }
    value += incr;

    if (o && o->refcount == 1 && o->encoding == OBJ_ENCODING_INT &&
        (value < 0 || value >= OBJ_SHARED_INTEGERS) &&
        value >= LONG_MIN && value <= LONG_MAX)
    {
        new = o;
        o->ptr = (void*)((long)value);
    } else {
        new = createStringObjectFromLongLong(value);
        if (o) {
            dbOverwrite(c->db,c->argv[1],new);
        } else {
            dbAdd(c->db,c->argv[1],new);
        }
    }
    signalModifiedKey(c->db,c->argv[1]);
    notifyKeyspaceEvent(NOTIFY_STRING,"incrby",c->argv[1],c->db->id);
    server.dirty++;
    addReply(c,shared.colon);
    addReply(c,new);
    addReply(c,shared.crlf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x41ad6
movq %rax, %r14
testq %rax, %rax
je 0x4bdcc
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x40d47
testl %eax, %eax
jne 0x4bf14
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x416bb
testl %eax, %eax
jne 0x4bf14
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
movq 0x8(%rsp), %rdi
subq %rdi, %rax
testq %r15, %r15
jns 0x4be0b
testq %rdi, %rdi
jns 0x4be0b
leaq 0x1(%rax), %rcx
cmpq %r15, %rcx
jg 0x4be25
testq %r15, %r15
setg %cl
testq %rdi, %rdi
setg %dl
andb %cl, %dl
cmpq %r15, %rax
setl %al
andb %dl, %al
cmpb $0x1, %al
jne 0x4be39
leaq 0x77444(%rip), %rsi     # 0xc3270
movq %rbx, %rdi
callq 0x3cc06
jmp 0x4bf14
addq %r15, %rdi
movq %rdi, 0x8(%rsp)
testq %r14, %r14
je 0x4be90
cmpl $0x1, 0x4(%r14)
jne 0x4be72
movl $0xf0, %eax
andl (%r14), %eax
cmpl $0x10, %eax
sete %al
cmpq $0x2710, %rdi           # imm = 0x2710
setae %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x4be72
movq %rdi, 0x8(%r14)
jmp 0x4beac
callq 0x40753
movq %rax, %r14
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdx
callq 0x41c77
jmp 0x4beac
callq 0x40753
movq %rax, %r14
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdx
callq 0x41b77
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x41d90
movq 0x10(%rbx), %rax
movq 0x40(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x708b3(%rip), %rsi     # 0xbc786
movl $0x8, %edi
callq 0x7c665
leaq 0xb59c4(%rip), %rax     # 0x1018a8
incq 0x720(%rax)
leaq 0xb641e(%rip), %r15     # 0x102310
movq 0x48(%r15), %rsi
movq %rbx, %rdi
callq 0x3c854
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3c854
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x3c854
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq