// File: /workspace/github_c_makefile_star2_O0/erikdubbelboer[P]discnt/src/counter.c
// Function: genericIncrCommand
void genericIncrCommand(client *c, const sds name, long double increment) {
    counter *cntr;

    cntr = counterLookup(name);
    if (cntr == NULL) {
        cntr = counterCreate(name);
    }

    if (cntr->myshard == NULL) {
        counterAddShard(cntr, myself, myself->name);
    }

    long double newshardvalue = cntr->myshard->value + increment;
    if (newshardvalue > COUNTER_MAX) {
        addReplyErrorFormat(c, "Counter value out of allowed range");
        return;
    } else if (newshardvalue < COUNTER_MIN) {
        addReplyErrorFormat(c, "Counter value out of allowed range");
        return;
    }

    countersUpdateValue(cntr);

    long double newvalue = cntr->value + increment;
    if (newvalue > COUNTER_MAX) {
        addReplyErrorFormat(c, "Counter value out of allowed range");
        return;
    } else if (newvalue < COUNTER_MIN) {
        addReplyErrorFormat(c, "Counter value out of allowed range");
        return;
    }

    cntr->myshard->value = newshardvalue;
    cntr->value = newvalue;
    server.dirty++;
    addReplyCounter(c,cntr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
fldt 0x10(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
fstpt -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x396f0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x39e77
movq -0x10(%rbp), %rdi
callq 0x39740
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x39e9f
movq -0x28(%rbp), %rdi
leaq 0x99773(%rip), %rax     # 0xd3600
movq (%rax), %rsi
leaq 0x99769(%rip), %rax     # 0xd3600
movq (%rax), %rdx
callq 0x39810
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
fldt 0x30(%rax)
fldt -0x20(%rbp)
faddp %st, %st(1)
fstpt -0x40(%rbp)
fldt -0x40(%rbp)
fldl 0x6f3e5(%rip)           # 0xa92a0
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x39edc
jmp 0x39ec5
movq -0x8(%rbp), %rdi
leaq 0x6f471(%rip), %rsi     # 0xa9341
movb $0x0, %al
callq 0x24360
jmp 0x39fb1
fldt -0x40(%rbp)
fldl 0x6f3c3(%rip)           # 0xa92a8
fucompi %st(1), %st
fstp %st(0)
jbe 0x39f04
jmp 0x39eed
movq -0x8(%rbp), %rdi
leaq 0x6f449(%rip), %rsi     # 0xa9341
movb $0x0, %al
callq 0x24360
jmp 0x39fb1
jmp 0x39f06
movq -0x28(%rbp), %rdi
callq 0x398f0
movq -0x28(%rbp), %rax
fldt 0x20(%rax)
fldt -0x20(%rbp)
faddp %st, %st(1)
fstpt -0x50(%rbp)
fldt -0x50(%rbp)
fldl 0x6f379(%rip)           # 0xa92a0
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x39f45
jmp 0x39f31
movq -0x8(%rbp), %rdi
leaq 0x6f405(%rip), %rsi     # 0xa9341
movb $0x0, %al
callq 0x24360
jmp 0x39fb1
fldt -0x50(%rbp)
fldl 0x6f35a(%rip)           # 0xa92a8
fucompi %st(1), %st
fstp %st(0)
jbe 0x39f6a
jmp 0x39f56
movq -0x8(%rbp), %rdi
leaq 0x6f3e0(%rip), %rsi     # 0xa9341
movb $0x0, %al
callq 0x24360
jmp 0x39fb1
jmp 0x39f6c
fldt -0x40(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
fstpt 0x30(%rax)
fldt -0x50(%rbp)
movq -0x28(%rbp), %rax
fstpt 0x20(%rax)
leaq 0x8515d(%rip), %rax     # 0xbf0e8
movq 0x6a0(%rax), %rcx
addq $0x1, %rcx
leaq 0x8514b(%rip), %rax     # 0xbf0e8
movq %rcx, 0x6a0(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x398c0
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)