// File: /workspace/github_c_makefile_star2_O2/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 0x1845(%rip), %xmm0     # 0x34d0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x864f(%rip)      # 0xa2e8
movzbl 0x45c0(%rip), %eax      # 0x6260
imulq $0x18, %rax, %rax
leaq 0x4435(%rip), %r14      # 0x60e0
movl 0x10(%rax,%r14), %ebx
callq 0x1377
testl %eax, %eax
je 0x1f08
movzbl 0x459c(%rip), %eax      # 0x6260
imulq $0x18, %rax, %rcx
movq 0x10(%rcx,%r14), %r15
movl 0x8(%rsp), %edi
cmpl $0xff, %edi
je 0x1d3a
cmpl $0xfe, %edi
jne 0x1d86
xorl %edi, %edi
callq 0x14fe
cmpl $-0x1, %eax
je 0x1df4
cmpl $0x40, %eax
jb 0x1dd0
leaq 0x4563(%rip), %rbx      # 0x6268
movq 0x85dc(%rip), %rdi      # 0xa2e8
shlq $0xa, %rdi
addq %rbx, %rdi
leaq 0x155f(%rip), %rsi      # 0x3279
movl %eax, %edx
xorl %eax, %eax
callq 0x1140
movl %r15d, %eax
movq 0x85bb(%rip), %rcx      # 0xa2e8
movq %rax, 0x4000(%rbx,%rcx,8)
jmp 0x1f01
addq %rcx, %r14
cmpq 0x8(%r14), %r15
jae 0x1dea
leaq 0x451a(%rip), %rax      # 0x6268
movq 0x8593(%rip), %rcx      # 0xa2e8
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 0x1f01
movl %edi, %ecx
andl $-0x2, %ecx
cmpl $0xfc, %ecx
jne 0x1db7
callq 0x147e
testl %eax, %eax
je 0x1f08
movq %rsp, %rdi
callq 0x1377
testl %eax, %eax
je 0x1f08
movzbl 0x44a9(%rip), %eax      # 0x6260
imulq $0x18, %rax, %rax
movl 0x10(%rax,%r14), %r15d
movq %rsp, %rdi
callq 0x1990
testl %eax, %eax
je 0x1ebc
movzbl 0x4489(%rip), %eax      # 0x6260
imulq $0x18, %rax, %rax
movl 0x10(%rax,%r14), %r15d
callq 0x143b
cmpl $-0x1, %eax
je 0x1e30
movb $0x1, 0xc(%rsp)
jmp 0x1f08
leaq 0x446d(%rip), %rax      # 0x6268
movq 0x84e6(%rip), %rcx      # 0xa2e8
movq %rcx, %rdx
shlq $0xa, %rdx
movups 0x1459(%rip), %xmm0     # 0x3269
movups %xmm0, 0xe(%rdx,%rax)
movups 0x143f(%rip), %xmm0     # 0x325b
movups %xmm0, (%rdx,%rax)
movl %r15d, %edx
movq %rdx, 0x4000(%rax,%rcx,8)
jmp 0x1f01
leaq 0x4431(%rip), %r14      # 0x6268
movq 0x84aa(%rip), %rax      # 0xa2e8
movq %rax, %rcx
shlq $0xa, %rcx
movups 0x1479(%rip), %xmm0     # 0x32c5
movups %xmm0, 0x9(%rcx,%r14)
movups 0x1463(%rip), %xmm0     # 0x32bc
movups %xmm0, (%rcx,%r14)
movq %r15, 0x4000(%r14,%rax,8)
movq 0x847b(%rip), %rdi      # 0xa2e8
incq %rdi
movq %rdi, 0x8471(%rip)      # 0xa2e8
shlq $0xa, %rdi
addq %r14, %rdi
movslq 0x8(%rsp), %rax
shlq $0x4, %rax
leaq 0x8482(%rip), %rdx      # 0xa310
addq %rax, %rdx
leaq 0x1412(%rip), %rsi      # 0x32aa
xorl %eax, %eax
callq 0x1140
movq 0x8442(%rip), %rax      # 0xa2e8
movq %rbx, 0x4000(%r14,%rax,8)
incq 0x8433(%rip)            # 0xa2e8
movb $0x0, 0xc(%rsp)
jmp 0x1f08
leaq 0x43a5(%rip), %rbx      # 0x6268
movq 0x841e(%rip), %rdi      # 0xa2e8
shlq $0xa, %rdi
addq %rbx, %rdi
movslq 0x8(%rsp), %rax
shlq $0x4, %rax
leaq 0x842f(%rip), %rdx      # 0xa310
addq %rax, %rdx
leaq 0x13bf(%rip), %rsi      # 0x32aa
xorl %eax, %eax
callq 0x1140
movq 0x83ef(%rip), %rax      # 0xa2e8
movq %r15, 0x4000(%rbx,%rax,8)
incq 0x83e0(%rip)            # 0xa2e8
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq