// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/rdb.c
// Function: rdbGenericLoadStringObject
void *rdbGenericLoadStringObject(rio *rdb, int flags) {
    int encode = flags & RDB_LOAD_ENC;
    int plain = flags & RDB_LOAD_PLAIN;
    int isencoded;
    uint32_t len;

    len = rdbLoadLen(rdb,&isencoded);
    if (isencoded) {
        switch(len) {
        case RDB_ENC_INT8:
        case RDB_ENC_INT16:
        case RDB_ENC_INT32:
            return rdbLoadIntegerObject(rdb,len,flags);
        case RDB_ENC_LZF:
            return rdbLoadLzfStringObject(rdb,flags);
        default:
            rdbExitReportCorruptRDB("Unknown RDB string encoding type %d",len);
        }
    }

    if (len == RDB_LENERR) return NULL;
    if (!plain) {
        robj *o = encode ? createStringObject(NULL,len) :
                           createRawStringObject(NULL,len);
        if (len && rioRead(rdb,o->ptr,len) == 0) {
            decrRefCount(o);
            return NULL;
        }
        return o;
    } else {
        void *buf = zmalloc(len);
        if (len && rioRead(rdb,buf,len) == 0) {
            zfree(buf);
            return NULL;
        }
        return buf;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x14(%rsp), %r15
movq %r15, %rsi
callq 0x4b10c
movl %eax, %ebp
cmpl $0x0, (%r15)
je 0x4bb56
cmpl $0x3, %ebp
jae 0x4bb81
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x4b342
jmp 0x4bcab
cmpl $-0x1, %ebp
je 0x4bca2
testb $0x2, %r14b
jne 0x4bb97
movl %ebp, %r12d
xorl %edi, %edi
movq %r12, %rsi
testb $0x1, %r14b
jne 0x4bc26
callq 0x43aef
jmp 0x4bc2b
jne 0x4bcba
movq %rbx, %rdi
movl %r14d, %esi
callq 0x4b701
jmp 0x4bcab
movl %ebp, %r14d
movq %r14, %rdi
callq 0x3b29d
testl %ebp, %ebp
je 0x4bcab
movq %rax, 0x8(%rsp)
movq %rax, %r15
testq %r14, %r14
je 0x4bca6
movq %r14, %rbp
movq 0x38(%rbx), %rax
cmpq %r14, %rax
movq %r14, %r12
cmovbq %rax, %r12
testq %rax, %rax
cmoveq %r14, %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *(%rbx)
movq %rax, %r13
testq %rax, %rax
je 0x4bc09
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x4bbfa
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *%rax
addq %r12, %r15
movq %rbp, %r14
subq %r12, %r14
addq %r12, 0x30(%rbx)
jmp 0x4bc0c
movq %rbp, %r14
testq %r13, %r13
jne 0x4bbb2
testq %rbp, %rbp
je 0x4bca6
movq 0x8(%rsp), %rdi
callq 0x3b3df
jmp 0x4bca2
callq 0x43ba8
testl %ebp, %ebp
je 0x4bcab
movq %rax, 0x8(%rsp)
movq 0x8(%rax), %r15
testq %r12, %r12
je 0x4bca6
movq %r12, %r14
movq 0x38(%rbx), %rax
cmpq %r12, %rax
movq %r12, %r13
cmovbq %rax, %r13
testq %rax, %rax
cmoveq %r12, %r13
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq *(%rbx)
movq %rax, %rbp
testq %rax, %rax
je 0x4bc8b
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x4bc7c
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq *%rax
addq %r13, %r15
movq %r14, %r12
subq %r13, %r12
addq %r13, 0x30(%rbx)
jmp 0x4bc8e
movq %r14, %r12
testq %rbp, %rbp
jne 0x4bc38
testq %r14, %r14
je 0x4bca6
movq 0x8(%rsp), %rdi
callq 0x440f3
xorl %eax, %eax
jmp 0x4bcab
movq 0x8(%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x79ce9(%rip), %rsi     # 0xc59aa
movl $0x1b1, %edi            # imm = 0x1B1
movl %ebp, %edx
xorl %eax, %eax
callq 0x4ac2c