// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/redis-check-dump.c
// Function: loadPair
int loadPair(entry *e) {
    uint32_t offset = CURR_OFFSET;
    uint32_t i;

    /* read key first */
    char *key;
    if (processStringObject(&key)) {
        e->key = key;
    } else {
        SHIFT_ERROR(offset, "Error reading entry key");
        return 0;
    }

    uint32_t length = 0;
    if (e->type == REDIS_LIST ||
        e->type == REDIS_SET  ||
        e->type == REDIS_ZSET ||
        e->type == REDIS_HASH) {
        if ((length = loadLength(NULL)) == REDIS_RDB_LENERR) {
            SHIFT_ERROR(offset, "Error reading %s length", types[e->type]);
            return 0;
        }
    }

    switch(e->type) {
    case REDIS_STRING:
    case REDIS_HASH_ZIPMAP:
    case REDIS_LIST_ZIPLIST:
    case REDIS_SET_INTSET:
    case REDIS_ZSET_ZIPLIST:
    case REDIS_HASH_ZIPLIST:
        if (!processStringObject(NULL)) {
            SHIFT_ERROR(offset, "Error reading entry value");
            return 0;
        }
    break;
    case REDIS_LIST:
    case REDIS_SET:
        for (i = 0; i < length; i++) {
            offset = CURR_OFFSET;
            if (!processStringObject(NULL)) {
                SHIFT_ERROR(offset, "Error reading element at index %d (length: %d)", i, length);
                return 0;
            }
        }
    break;
    case REDIS_ZSET:
        for (i = 0; i < length; i++) {
            offset = CURR_OFFSET;
            if (!processStringObject(NULL)) {
                SHIFT_ERROR(offset, "Error reading element key at index %d (length: %d)", i, length);
                return 0;
            }
            offset = CURR_OFFSET;
            if (!processDoubleValue(NULL)) {
                SHIFT_ERROR(offset, "Error reading element value at index %d (length: %d)", i, length);
                return 0;
            }
        }
    break;
    case REDIS_HASH:
        for (i = 0; i < length; i++) {
            offset = CURR_OFFSET;
            if (!processStringObject(NULL)) {
                SHIFT_ERROR(offset, "Error reading element key at index %d (length: %d)", i, length);
                return 0;
            }
            offset = CURR_OFFSET;
            if (!processStringObject(NULL)) {
                SHIFT_ERROR(offset, "Error reading element value at index %d (length: %d)", i, length);
                return 0;
            }
        }
    break;
    default:
        SHIFT_ERROR(offset, "Type not implemented");
        return 0;
    }
    /* because we're done, we assume success */
    e->success = 1;
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movzbl 0x430b(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
leaq 0x4180(%rip), %r13      # 0x60d0
movl 0x10(%r13,%rax,8), %r12d
movq %rsp, %rdi
callq 0x1d30
testl %eax, %eax
je 0x1fca
movq (%rsp), %rax
movq %rax, (%r14)
movl 0x8(%r14), %eax
decl %eax
xorl %ebx, %ebx
cmpl $0x4, %eax
jae 0x1f8a
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x1949
movl %eax, %ebx
cmpl $-0x1, %eax
je 0x2010
movl 0x8(%r14), %eax
cmpq $0xd, %rax
ja 0x20c9
leaq 0x1065(%rip), %rcx      # 0x3004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x1d30
testl %eax, %eax
je 0x2059
movb $0x1, 0xc(%r14)
movl $0x1, %r15d
jmp 0x221e
leaq 0x4287(%rip), %rax      # 0x6258
movq 0x8300(%rip), %rcx      # 0xa2d8
movq %rcx, %rdx
shlq $0xa, %rdx
movups 0x1147(%rip), %xmm0     # 0x312d
movups %xmm0, (%rdx,%rax)
movabsq $0x79656b20797274, %rsi # imm = 0x79656B20797274
movq %rsi, 0x10(%rdx,%rax)
movq %r12, 0x4000(%rax,%rcx,8)
incq 0x82d0(%rip)            # 0xa2d8
xorl %r15d, %r15d
jmp 0x221e
leaq 0x4241(%rip), %rbx      # 0x6258
movq 0x82ba(%rip), %rdi      # 0xa2d8
shlq $0xa, %rdi
addq %rbx, %rdi
movslq 0x8(%r14), %rax
shlq $0x4, %rax
leaq 0x82cc(%rip), %rdx      # 0xa300
addq %rax, %rdx
leaq 0x1107(%rip), %rsi      # 0x3145
xorl %eax, %eax
callq 0x1130
movq 0x828c(%rip), %rax      # 0xa2d8
movq %r12, 0x4000(%rbx,%rax,8)
jmp 0x2217
leaq 0x41f8(%rip), %rax      # 0x6258
movq 0x8271(%rip), %rcx      # 0xa2d8
movq %rcx, %rdx
shlq $0xa, %rdx
movups 0x10f2(%rip), %xmm0     # 0x3167
movups %xmm0, 0xa(%rdx,%rax)
movups 0x10dc(%rip), %xmm0     # 0x315d
movups %xmm0, (%rdx,%rax)
movq %r12, 0x4000(%rax,%rcx,8)
jmp 0x2217
testl %ebx, %ebx
je 0x1fba
xorl %r12d, %r12d
movzbl 0x41ac(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
movl 0x10(%r13,%rax,8), %ebp
xorl %edi, %edi
callq 0x1d30
testl %eax, %eax
je 0x21a1
incl %r12d
cmpl %r12d, %ebx
jne 0x209d
jmp 0x1fba
leaq 0x4188(%rip), %rax      # 0x6258
movq 0x8201(%rip), %rcx      # 0xa2d8
movq %rcx, %rdx
shlq $0xa, %rdx
movups 0x1129(%rip), %xmm0     # 0x320e
movups %xmm0, (%rdx,%rax)
movabsq $0x6465746e656d65, %rsi # imm = 0x6465746E656D65
movq %rsi, 0xd(%rdx,%rax)
jmp 0x1ff9
testl %ebx, %ebx
je 0x1fba
xorl %r12d, %r12d
movzbl 0x4141(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
movl 0x10(%r13,%rax,8), %ebp
xorl %edi, %edi
callq 0x1d30
testl %eax, %eax
je 0x21bf
movzbl 0x4122(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
movl 0x10(%r13,%rax,8), %ebp
xorl %edi, %edi
callq 0x1d30
testl %eax, %eax
je 0x21dd
incl %r12d
cmpl %r12d, %ebx
jne 0x2108
jmp 0x1fba
testl %ebx, %ebx
je 0x1fba
xorl %r12d, %r12d
movzbl 0x40eb(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
movl 0x10(%r13,%rax,8), %ebp
xorl %edi, %edi
callq 0x1d30
testl %eax, %eax
je 0x21bf
movzbl 0x40d0(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
movl 0x10(%r13,%rax,8), %ebp
xorl %edi, %edi
callq 0x1eaa
testl %eax, %eax
je 0x21dd
incl %r12d
cmpl %r12d, %ebx
jne 0x215e
jmp 0x1fba
leaq 0x40b0(%rip), %r14      # 0x6258
movq 0x8129(%rip), %rdi      # 0xa2d8
shlq $0xa, %rdi
addq %r14, %rdi
leaq 0xfba(%rip), %rsi       # 0x3177
jmp 0x21f9
leaq 0x4092(%rip), %r14      # 0x6258
movq 0x810b(%rip), %rdi      # 0xa2d8
shlq $0xa, %rdi
addq %r14, %rdi
leaq 0xfcb(%rip), %rsi       # 0x31a6
jmp 0x21f9
leaq 0x4074(%rip), %r14      # 0x6258
movq 0x80ed(%rip), %rdi      # 0xa2d8
shlq $0xa, %rdi
addq %r14, %rdi
leaq 0xfe0(%rip), %rsi       # 0x31d9
xorl %r15d, %r15d
movl %r12d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x1130
movq 0x80c9(%rip), %rax      # 0xa2d8
movq %rbp, 0x4000(%r14,%rax,8)
incq 0x80ba(%rip)            # 0xa2d8
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq