// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/redis-check-dump.c
// Function: loadEntry
entry loadEntry() {
    entry e = { NULL, -1, 0 };
    uint32_t length, offset[4];

    /* reset error container */
    errors.level = 0;

    offset[0] = CURR_OFFSET;
    if (!loadType(&e)) {
        return e;
    }

    offset[1] = CURR_OFFSET;
    if (e.type == REDIS_SELECTDB) {
        if ((length = loadLength(NULL)) == REDIS_RDB_LENERR) {
            SHIFT_ERROR(offset[1], "Error reading database number");
            return e;
        }
        if (length > 63) {
            SHIFT_ERROR(offset[1], "Database number out of range (%d)", length);
            return e;
        }
    } else if (e.type == REDIS_EOF) {
        if (positions[level].offset < positions[level].size) {
            SHIFT_ERROR(offset[0], "Unexpected EOF");
        } else {
            e.success = 1;
        }
        return e;
    } else {
        /* optionally consume expire */
        if (e.type == REDIS_EXPIRETIME || 
            e.type == REDIS_EXPIRETIME_MS) {
            if (!processTime(e.type)) return e;
            if (!loadType(&e)) return e;
        }

        offset[1] = CURR_OFFSET;
        if (!loadPair(&e)) {
            SHIFT_ERROR(offset[1], "Error for type %s", types[e.type]);
            return e;
        }
    }

    /* all entries are followed by a valid type:
     * e.g. a new entry, SELECTDB, EXPIRE, EOF */
    offset[2] = CURR_OFFSET;
    if (peekType() == -1) {
        SHIFT_ERROR(offset[2], "Followed by invalid type");
        SHIFT_ERROR(offset[0], "Error for type %s", types[e.type]);
        e.success = 0;
    } else {
        e.success = 1;
    }

    return e;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movups 0x12f9(%rip), %xmm0     # 0x34d0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x80f0(%rip) # 0xa2d8
movzbl 0x4061(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
leaq 0x3ed6(%rip), %r14      # 0x60d0
movl 0x10(%r14,%rax,8), %ebx
callq 0x17be
testl %eax, %eax
je 0x2476
movzbl 0x403d(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rcx
movq 0x10(%r14,%rcx,8), %r15
movl 0x8(%rsp), %edi
cmpl $0xff, %edi
je 0x2289
cmpl $0xfe, %edi
jne 0x22d6
xorl %edi, %edi
callq 0x1955
cmpl $-0x1, %eax
je 0x23d0
cmpl $0x40, %eax
jb 0x2320
leaq 0x4004(%rip), %rbx      # 0x6258
movq 0x807d(%rip), %rdi      # 0xa2d8
shlq $0xa, %rdi
addq %rbx, %rdi
leaq 0x1010(%rip), %rsi      # 0x3279
movl %eax, %edx
xorl %eax, %eax
callq 0x1130
movl %r15d, %eax
movq 0x805c(%rip), %rcx      # 0xa2d8
movq %rax, 0x4000(%rbx,%rcx,8)
jmp 0x246f
leaq (%r14,%rcx,8), %rax
cmpq 0x8(%rax), %r15
jae 0x2423
leaq 0x3fba(%rip), %rax      # 0x6258
movq 0x8033(%rip), %rcx      # 0xa2d8
movq %rcx, %rdx
shlq $0xa, %rdx
movabsq $0x464f4520646574, %rsi # imm = 0x464F4520646574
movq %rsi, 0x7(%rdx,%rax)
movabsq $0x7463657078656e55, %rsi # imm = 0x7463657078656E55
movq %rsi, (%rdx,%rax)
movq %rbx, 0x4000(%rax,%rcx,8)
jmp 0x246f
movl %edi, %ecx
andl $-0x2, %ecx
cmpl $0xfc, %ecx
jne 0x2307
callq 0x18dc
testl %eax, %eax
je 0x2476
movq %rsp, %rdi
callq 0x17be
testl %eax, %eax
je 0x2476
movzbl 0x3f49(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
movl 0x10(%r14,%rax,8), %r15d
movq %rsp, %rdi
callq 0x1ec5
testl %eax, %eax
je 0x242a
movzbl 0x3f29(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rcx
movq 0x10(%r14,%rcx,8), %rax
leaq 0x1(%rax), %rdx
cmpq 0x8(%r14,%rcx,8), %rdx
jbe 0x2409
leaq 0x3f12(%rip), %r14      # 0x6258
movq 0x7f8b(%rip), %rcx      # 0xa2d8
movq %rcx, %rdx
shlq $0xa, %rdx
movups 0xf6a(%rip), %xmm0      # 0x32c5
movups %xmm0, 0x9(%rdx,%r14)
movups 0xf54(%rip), %xmm0      # 0x32bc
movups %xmm0, (%rdx,%r14)
movl %eax, %eax
movq %rax, 0x4000(%r14,%rcx,8)
movq 0x7f5a(%rip), %rdi      # 0xa2d8
incq %rdi
movq %rdi, 0x7f50(%rip)      # 0xa2d8
shlq $0xa, %rdi
addq %r14, %rdi
movslq 0x8(%rsp), %rax
shlq $0x4, %rax
leaq 0x7f61(%rip), %rdx      # 0xa300
addq %rax, %rdx
leaq 0xf01(%rip), %rsi       # 0x32aa
xorl %eax, %eax
callq 0x1130
movq 0x7f21(%rip), %rax      # 0xa2d8
movq %rbx, 0x4000(%r14,%rax,8)
incq 0x7f12(%rip)            # 0xa2d8
movb $0x0, 0xc(%rsp)
jmp 0x2476
leaq 0x3e81(%rip), %rax      # 0x6258
movq 0x7efa(%rip), %rcx      # 0xa2d8
movq %rcx, %rdx
shlq $0xa, %rdx
movups 0xe7d(%rip), %xmm0      # 0x3269
movups %xmm0, 0xe(%rdx,%rax)
movups 0xe63(%rip), %xmm0      # 0x325b
movups %xmm0, (%rdx,%rax)
movl %r15d, %edx
movq %rdx, 0x4000(%rax,%rcx,8)
jmp 0x246f
leaq (%r14,%rcx,8), %rcx
movq (%rcx), %rcx
movzbl (%rax,%rcx), %ecx
cmpl $0xd, %ecx
ja 0x2489
movl $0x3e1f, %edx           # imm = 0x3E1F
btl %ecx, %edx
jae 0x2489
movb $0x1, 0xc(%rsp)
jmp 0x2476
leaq 0x3e27(%rip), %rbx      # 0x6258
movq 0x7ea0(%rip), %rdi      # 0xa2d8
shlq $0xa, %rdi
addq %rbx, %rdi
movslq 0x8(%rsp), %rax
shlq $0x4, %rax
leaq 0x7eb1(%rip), %rdx      # 0xa300
addq %rax, %rdx
leaq 0xe51(%rip), %rsi       # 0x32aa
xorl %eax, %eax
callq 0x1130
movq 0x7e71(%rip), %rax      # 0xa2d8
movq %r15, 0x4000(%rbx,%rax,8)
incq 0x7e62(%rip)            # 0xa2d8
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
cmpb $-0x4, %cl
jb 0x233f
jmp 0x2423