// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/rdb.c
// Function: rdbLoadLen
uint32_t rdbLoadLen(rio *rdb, int *isencoded) {
    unsigned char buf[2];
    uint32_t len;
    int type;

    if (isencoded) *isencoded = 0;
    if (rioRead(rdb,buf,1) == 0) return RDB_LENERR;
    type = (buf[0]&0xC0)>>6;
    if (type == RDB_ENCVAL) {
        /* Read a 6 bit encoding type. */
        if (isencoded) *isencoded = 1;
        return buf[0]&0x3F;
    } else if (type == RDB_6BITLEN) {
        /* Read a 6 bit len. */
        return buf[0]&0x3F;
    } else if (type == RDB_14BITLEN) {
        /* Read a 14 bit len. */
        if (rioRead(rdb,buf+1,1) == 0) return RDB_LENERR;
        return ((buf[0]&0x3F)<<8)|buf[1];
    } else if (type == RDB_32BITLEN) {
        /* Read a 32 bit len. */
        if (rioRead(rdb,&len,4) == 0) return RDB_LENERR;
        return ntohl(len);
    } else {
        rdbExitReportCorruptRDB(
            "Unknown length encoding %d in rdbLoadLen()",type);
        return -1; /* Never reached. */
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
testq %rsi, %rsi
je 0x4b129
movl $0x0, (%r14)
movl $0x1, %eax
leaq 0x2(%rsp), %r15
testq %rax, %rax
je 0x4b19c
movq %rax, %rbp
movq 0x38(%rbx), %rax
cmpq %rbp, %rax
movq %rbp, %r12
cmovbq %rax, %r12
testq %rax, %rax
cmoveq %rbp, %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *(%rbx)
movq %rax, %r13
testq %rax, %rax
je 0x4b186
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x4b177
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *%rax
addq %r12, %r15
movq %rbp, %rax
subq %r12, %rax
addq %r12, 0x30(%rbx)
jmp 0x4b189
movq %rbp, %rax
testq %r13, %r13
jne 0x4b133
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rbp, %rbp
jne 0x4b2cc
movzbl 0x2(%rsp), %eax
movl %eax, %ecx
shrl $0x6, %ecx
cmpl $0x3, %ecx
jne 0x4b1bf
testq %r14, %r14
je 0x4b1b7
movl $0x1, (%r14)
andl $0x3f, %eax
jmp 0x4b2cc
cmpb $0x40, %al
jb 0x4b2cc
cmpl $0x1, %ecx
jne 0x4b257
movl $0x1, %eax
leaq 0x3(%rsp), %r14
testq %rax, %rax
je 0x4b243
movq %rax, %r13
movq 0x38(%rbx), %rax
cmpq %r13, %rax
movq %r13, %r15
cmovbq %rax, %r15
testq %rax, %rax
cmoveq %r13, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq *(%rbx)
movq %rax, %r12
testq %rax, %rax
je 0x4b22d
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x4b21e
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq *%rax
addq %r15, %r14
movq %r13, %rax
subq %r15, %rax
addq %r15, 0x30(%rbx)
jmp 0x4b230
movq %r13, %rax
testq %r12, %r12
jne 0x4b1da
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r13, %r13
jne 0x4b2cc
movzbl 0x2(%rsp), %ecx
andl $0x3f, %ecx
shll $0x8, %ecx
movzbl 0x3(%rsp), %eax
orl %ecx, %eax
jmp 0x4b2cc
movl $0x4, %eax
leaq 0x4(%rsp), %r14
testq %rax, %rax
je 0x4b2c6
movq %rax, %r13
movq 0x38(%rbx), %rax
cmpq %r13, %rax
movq %r13, %r15
cmovbq %rax, %r15
testq %rax, %rax
cmoveq %r13, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq *(%rbx)
movq %rax, %r12
testq %rax, %rax
je 0x4b2b4
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x4b2a5
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq *%rax
addq %r15, %r14
movq %r13, %rax
subq %r15, %rax
addq %r15, 0x30(%rbx)
jmp 0x4b2b7
movq %r13, %rax
testq %r12, %r12
jne 0x4b261
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r13, %r13
jne 0x4b2cc
movl 0x4(%rsp), %eax
bswapl %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq