// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/t_string.c
// Function: incrbyfloatCommand
void incrbyfloatCommand(redisClient *c) {
    long double incr, value;
    robj *o, *new, *aux;

    // 取出值对象
    o = lookupKeyWrite(c->db,c->argv[1]);

    // 检查对象是否存在，以及类型是否正确
    if (o != NULL && checkType(c,o,REDIS_STRING)) return;

    // 将对象的整数值保存到 value 参数中
    // 并取出 incr 参数的值
    if (getLongDoubleFromObjectOrReply(c,o,&value,NULL) != REDIS_OK ||
        getLongDoubleFromObjectOrReply(c,c->argv[2],&incr,NULL) != REDIS_OK)
        return;

    // 进行加法计算，并检查是否溢出
    value += incr;
    if (isnan(value) || isinf(value)) {
        addReplyError(c,"increment would produce NaN or Infinity");
        return;
    }

    // 用一个包含新值的新对象替换现有的值对象
    new = createStringObjectFromLongDouble(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(REDIS_NOTIFY_STRING,"incrbyfloat",c->argv[1],c->db->id);

    // 将服务器设为脏
    server.dirty++;

    // 回复
    addReplyBulk(c,new);

    /* Always replicate INCRBYFLOAT as a SET command with the final value
     * in order to make sure that differences in float precision or formatting
     * will not create differences in replicas or after an AOF restart. */
    // 在传播 INCRBYFLOAT 命令时，总是用 SET 命令来替换 INCRBYFLOAT 命令
    // 从而防止因为不同的浮点精度和格式化造成 AOF 重启时的数据不一致
    aux = createStringObject("SET",3);
    rewriteClientCommandArgument(c,0,aux);
    decrRefCount(aux);
    rewriteClientCommandArgument(c,2,new);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x31454
movq %rax, %r14
testq %rax, %rax
je 0x39316
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x308e7
testl %eax, %eax
jne 0x39457
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x30f45
testl %eax, %eax
jne 0x39457
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rsi
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x30f45
testl %eax, %eax
jne 0x39457
fldt 0x30(%rsp)
fldt 0x20(%rsp)
faddp %st, %st(1)
fld %st(0)
fstpt 0x10(%rsp)
movzwl 0x18(%rsp), %eax
movq 0x10(%rsp), %rcx
fld %st(0)
fstpt 0x20(%rsp)
shrq $0x3f, %rcx
andl $0x7fff, %eax           # imm = 0x7FFF
leal -0x1(%rax), %edx
movzwl %dx, %edx
cmpl $0x7ffe, %edx           # imm = 0x7FFE
setb %dl
andb %cl, %dl
testq %rax, %rax
sete %al
orb %dl, %al
jne 0x393a9
fstp %st(0)
leaq 0x5fb75(%rip), %rsi     # 0x98f11
movq %rbx, %rdi
callq 0x2d9d7
jmp 0x39457
fstpt (%rsp)
callq 0x3041f
movq %rax, %r15
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r15, %rdx
testq %r14, %r14
je 0x393cf
callq 0x315a0
jmp 0x393d4
callq 0x314ef
movq 0x8(%rbx), %rdi
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
callq 0x316b7
movq 0x8(%rbx), %rax
movq 0x38(%rbx), %rcx
movq 0x8(%rcx), %rdx
movl 0x30(%rax), %ecx
leaq 0x5b085(%rip), %rsi     # 0x94480
movl $0x8, %edi
callq 0x608b5
leaq 0x90b9c(%rip), %rax     # 0xc9fa8
incq 0x560(%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2df74
leaq 0x667c7(%rip), %rdi     # 0x9fbec
movl $0x3, %esi
callq 0x303b7
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x2f6dd
movq %r14, %rdi
callq 0x30834
movq %rbx, %rdi
movl $0x2, %esi
movq %r15, %rdx
callq 0x2f6dd
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq