// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/rdb.c
// Function: rdbLoadIntegerObject
void *rdbLoadIntegerObject(rio *rdb, int enctype, int flags) {
    int plain = flags & RDB_LOAD_PLAIN;
    int encode = flags & RDB_LOAD_ENC;
    unsigned char enc[4];
    long long val;

    if (enctype == RDB_ENC_INT8) {
        if (rioRead(rdb,enc,1) == 0) return NULL;
        val = (signed char)enc[0];
    } else if (enctype == RDB_ENC_INT16) {
        uint16_t v;
        if (rioRead(rdb,enc,2) == 0) return NULL;
        v = enc[0]|(enc[1]<<8);
        val = (int16_t)v;
    } else if (enctype == RDB_ENC_INT32) {
        uint32_t v;
        if (rioRead(rdb,enc,4) == 0) return NULL;
        v = enc[0]|(enc[1]<<8)|(enc[2]<<16)|(enc[3]<<24);
        val = (int32_t)v;
    } else {
        val = 0; /* anti-warning */
        rdbExitReportCorruptRDB("Unknown RDB integer encoding type %d",enctype);
    }
    if (plain) {
        char buf[LONG_STR_SIZE], *p;
        int len = ll2string(buf,sizeof(buf),val);
        p = zmalloc(len);
        memcpy(p,buf,len);
        return p;
    } else if (encode) {
        return createStringObjectFromLongLong(val);
    } else {
        return createObject(OBJ_STRING,sdsfromlonglong(val));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebx
movq %rdi, %r14
cmpl $0x2, %esi
je 0x4b470
movl %esi, %edx
cmpl $0x1, %esi
je 0x4b3eb
testl %edx, %edx
jne 0x4b551
movl $0x1, %eax
leaq 0xc(%rsp), %r15
testq %rax, %rax
je 0x4b3e0
movq %rax, %rbp
movq 0x38(%r14), %rax
cmpq %rbp, %rax
movq %rbp, %r12
cmovbq %rax, %r12
testq %rax, %rax
cmoveq %rbp, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *(%r14)
movq %rax, %r13
testq %rax, %rax
je 0x4b3cf
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x4b3c0
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *%rax
addq %r12, %r15
movq %rbp, %rax
subq %r12, %rax
addq %r12, 0x30(%r14)
jmp 0x4b3d2
movq %rbp, %rax
testq %r13, %r13
jne 0x4b37b
testq %rbp, %rbp
jne 0x4b4e5
movsbq 0xc(%rsp), %rdx
jmp 0x4b4e9
movl $0x2, %eax
leaq 0xc(%rsp), %r15
movq %rax, %rbp
testq %rax, %rax
je 0x4b45a
movq 0x38(%r14), %rax
cmpq %rbp, %rax
movq %rbp, %r12
cmovbq %rax, %r12
testq %rax, %rax
cmoveq %rbp, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *(%r14)
movq %rax, %r13
testq %rax, %rax
je 0x4b449
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x4b43a
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *%rax
addq %r12, %r15
movq %rbp, %rax
subq %r12, %rax
addq %r12, 0x30(%r14)
jmp 0x4b44c
movq %rbp, %rax
testq %r13, %r13
jne 0x4b3f5
testq %rbp, %rbp
jne 0x4b4e0
movzbl 0xc(%rsp), %eax
movzbl 0xd(%rsp), %ecx
shll $0x8, %ecx
movswq %cx, %rdx
orq %rax, %rdx
jmp 0x4b4e0
movl $0x4, %eax
leaq 0xc(%rsp), %r15
movq %rax, %rbp
testq %rax, %rax
je 0x4b4db
movq 0x38(%r14), %rax
cmpq %rbp, %rax
movq %rbp, %r12
cmovbq %rax, %r12
testq %rax, %rax
cmoveq %rbp, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *(%r14)
movq %rax, %r13
testq %rax, %rax
je 0x4b4ce
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x4b4bf
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *%rax
addq %r12, %r15
movq %rbp, %rax
subq %r12, %rax
addq %r12, 0x30(%r14)
jmp 0x4b4d1
movq %rbp, %rax
testq %r13, %r13
jne 0x4b47a
testq %rbp, %rbp
jne 0x4b4e0
movslq 0xc(%rsp), %rdx
testq %rbp, %rbp
je 0x4b4e9
xorl %ebx, %ebx
jmp 0x4b53f
testb $0x2, %bl
jne 0x4b507
movq %rdx, %rdi
testb $0x1, %bl
jne 0x4b537
callq 0x39da4
xorl %edi, %edi
movq %rax, %rsi
callq 0x43ab4
jmp 0x4b53c
leaq 0x10(%rsp), %r14
movl $0x15, %esi
movq %r14, %rdi
callq 0x433e5
movslq %eax, %r15
movq %r15, %rdi
callq 0x3b29d
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x26c60
jmp 0x4b53f
callq 0x43bb7
movq %rax, %rbx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7a3e7(%rip), %rsi     # 0xc593f
movl $0xdf, %edi
xorl %eax, %eax
callq 0x4ac2c