// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/object.c
// Function: getDoubleFromObject
int getDoubleFromObject(robj *o, double *target) {
    double value;
    char *eptr;

    if (o == NULL) {
        value = 0;

    } else {
        redisAssertWithInfo(NULL,o,o->type == REDIS_STRING);

        // 尝试从字符串中转换 double 值
        if (sdsEncodedObject(o)) {
            errno = 0;
            value = strtod(o->ptr, &eptr);
            if (isspace(((char*)o->ptr)[0]) ||
                eptr[0] != '\0' ||
                (errno == ERANGE &&
                    (value == HUGE_VAL || value == -HUGE_VAL || value == 0)) ||
                errno == EINVAL ||
                isnan(value))
                return REDIS_ERR;

        // INT 编码
        } else if (o->encoding == REDIS_ENCODING_INT) {
            value = (long)o->ptr;

        } else {
            redisPanic("Unknown string encoding");
        }
    }

    // 返回值
    *target = value;
    return REDIS_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x3b394
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
jmp 0x3b502
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x0, %eax
jne 0x3b3a4
jmp 0x3b3cf
movq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
leaq 0xa5a9d(%rip), %rdx     # 0xe0e50
leaq 0xa608d(%rip), %rcx     # 0xe1447
movl $0x301, %r8d            # imm = 0x301
callq 0x648b0
movl $0x1, %edi
callq 0x1f3b0
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x0, %eax
je 0x3b3f5
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x8, %eax
jne 0x3b4b7
callq 0x1f820
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1fc60
movsd %xmm0, -0x20(%rbp)
callq 0x1f530
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x3b4ac
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x3b4ac
callq 0x1f820
cmpl $0x22, (%rax)
jne 0x3b490
movsd -0x20(%rbp), %xmm0
movsd 0xa59d3(%rip), %xmm1    # 0xe0e30
ucomisd %xmm1, %xmm0
jne 0x3b467
jp 0x3b467
jmp 0x3b4ac
movsd -0x20(%rbp), %xmm0
movsd 0xa5fc4(%rip), %xmm1    # 0xe1438
ucomisd %xmm1, %xmm0
jne 0x3b47e
jp 0x3b47e
jmp 0x3b4ac
movsd -0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x3b490
jp 0x3b490
jmp 0x3b4ac
callq 0x1f820
cmpl $0x16, (%rax)
je 0x3b4ac
movsd -0x20(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x3b4ac
jmp 0x3b4b5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3b516
jmp 0x3b500
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x1, %eax
jne 0x3b4dc
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x20(%rbp)
jmp 0x3b4fe
leaq 0xa6079(%rip), %rdi     # 0xe155c
leaq 0xa5f5d(%rip), %rsi     # 0xe1447
movl $0x314, %edx            # imm = 0x314
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x3b500
jmp 0x3b502
movsd -0x20(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop