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

    // 取出 incr 参数
    if (getLongDoubleFromObjectOrReply(c,c->argv[3],&incr,NULL) != REDIS_OK) return;

    // 取出或新创建哈希对象
    if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return;

    // 取出值对象
    if ((current = hashTypeGetObject(o,c->argv[2])) != NULL) {
        // 从值对象中取出浮点值
        if (getLongDoubleFromObjectOrReply(c,current,&value,
            "hash value is not a valid float") != REDIS_OK) {
            decrRefCount(current);
            return;
        }
        decrRefCount(current);
    } else {
        // 值对象不存在，默认值为 0
        value = 0;
    }

    // 计算结果
    value += incr;
    // 为计算结果创建值对象
    new = createStringObjectFromLongDouble(value);
    // 编码值对象
    hashTypeTryObjectEncoding(o,&c->argv[2],NULL);
    // 关联键和新的值对象，如果已经有对象存在，那么用新对象替换它
    hashTypeSet(o,c->argv[2],new);

    // 返回新的值对象作为回复
    addReplyBulk(c,new);

    // 发送键修改信号
    signalModifiedKey(c->db,c->argv[1]);

    // 发送事件通知
    notifyKeyspaceEvent(REDIS_NOTIFY_HASH,"hincrbyfloat",c->argv[1],c->db->id);

    // 将数据库设置脏
    server.dirty++;

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq 0x18(%rax), %rsi
leaq 0x20(%rsp), %rdx
xorl %ecx, %ecx
callq 0x30f45
testl %eax, %eax
je 0x43191
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%rbx), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x42b94
testq %rax, %rax
je 0x43184
movq %rax, %r15
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rsi
movq %r15, %rdi
callq 0x42479
testq %rax, %rax
je 0x431e8
movq %rax, %r14
leaq 0x564c4(%rip), %rcx     # 0x9968c
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x30f45
movl %eax, %ebp
movq %r14, %rdi
callq 0x30834
testl %ebp, %ebp
jne 0x43184
jmp 0x431ee
fldz
fstpt 0x10(%rsp)
fldt 0x20(%rsp)
fldt 0x10(%rsp)
faddp %st, %st(1)
fld %st(0)
fstpt 0x10(%rsp)
fstpt (%rsp)
callq 0x3041f
movq %rax, %r14
movl $0xf0, %eax
andl (%r15), %eax
cmpl $0x20, %eax
jne 0x43229
movq 0x38(%rbx), %r12
movq 0x10(%r12), %rdi
callq 0x30971
movq %rax, 0x10(%r12)
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x425b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2df74
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 0x51211(%rip), %rsi     # 0x9447f
movl $0x40, %edi
callq 0x608b5
leaq 0x86d29(%rip), %rax     # 0xc9fa8
incq 0x560(%rax)
leaq 0x5641f(%rip), %rdi     # 0x996ac
movl $0x4, %esi
callq 0x303b7
movq %rax, %r15
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0x2f6dd
movq %r15, %rdi
callq 0x30834
movq %rbx, %rdi
movl $0x3, %esi
movq %r14, %rdx
callq 0x2f6dd
movq %r14, %rdi
callq 0x30834
jmp 0x43184