// File: /workspace/github_c_makefile_star2_O3/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 0x4376(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
leaq 0x41eb(%rip), %r13      # 0x60d0
movl 0x10(%r13,%rax,8), %r12d
movq %rsp, %rdi
callq 0x1cb0
testl %eax, %eax
je 0x1f61
movq (%rsp), %rax
movq %rax, (%r14)
movl 0x8(%r14), %eax
leal -0x1(%rax), %ecx
xorl %ebx, %ebx
cmpl $0x4, %ecx
jae 0x1f24
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x1955
cmpl $-0x1, %eax
je 0x1fa7
movl %eax, %ebx
movl 0x8(%r14), %eax
cmpl $0xd, %eax
ja 0x2060
movl %eax, %eax
leaq 0x10ce(%rip), %rcx      # 0x3004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x1cb0
testl %eax, %eax
je 0x1ff0
movb $0x1, 0xc(%r14)
movl $0x1, %r15d
jmp 0x21b5
leaq 0x42f0(%rip), %rax      # 0x6258
movq 0x8369(%rip), %rcx      # 0xa2d8
movq %rcx, %rdx
shlq $0xa, %rdx
movups 0x11e8(%rip), %xmm0     # 0x3165
movups %xmm0, (%rdx,%rax)
movabsq $0x79656b20797274, %rsi # imm = 0x79656B20797274
movq %rsi, 0x10(%rdx,%rax)
movq %r12, 0x4000(%rax,%rcx,8)
incq 0x8339(%rip)            # 0xa2d8
xorl %r15d, %r15d
jmp 0x21b5
leaq 0x42aa(%rip), %rbx      # 0x6258
movq 0x8323(%rip), %rdi      # 0xa2d8
shlq $0xa, %rdi
addq %rbx, %rdi
movslq 0x8(%r14), %rax
shlq $0x4, %rax
leaq 0x8335(%rip), %rdx      # 0xa300
addq %rax, %rdx
leaq 0x11a8(%rip), %rsi      # 0x317d
xorl %eax, %eax
callq 0x1130
movq 0x82f5(%rip), %rax      # 0xa2d8
movq %r12, 0x4000(%rbx,%rax,8)
jmp 0x21ae
leaq 0x4261(%rip), %rax      # 0x6258
movq 0x82da(%rip), %rcx      # 0xa2d8
movq %rcx, %rdx
shlq $0xa, %rdx
movups 0x1193(%rip), %xmm0     # 0x319f
movups %xmm0, 0xa(%rdx,%rax)
movups 0x117d(%rip), %xmm0     # 0x3195
movups %xmm0, (%rdx,%rax)
movq %r12, 0x4000(%rax,%rcx,8)
jmp 0x21ae
testl %ebx, %ebx
je 0x1f51
xorl %r12d, %r12d
movzbl 0x4215(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
movl 0x10(%r13,%rax,8), %ebp
xorl %edi, %edi
callq 0x1cb0
testl %eax, %eax
je 0x2138
incl %r12d
cmpl %r12d, %ebx
jne 0x2034
jmp 0x1f51
leaq 0x41f1(%rip), %rax      # 0x6258
movq 0x826a(%rip), %rcx      # 0xa2d8
movq %rcx, %rdx
shlq $0xa, %rdx
movups 0x11ca(%rip), %xmm0     # 0x3246
movups %xmm0, (%rdx,%rax)
movabsq $0x6465746e656d65, %rsi # imm = 0x6465746E656D65
movq %rsi, 0xd(%rdx,%rax)
jmp 0x1f90
testl %ebx, %ebx
je 0x1f51
xorl %r12d, %r12d
movzbl 0x41aa(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
movl 0x10(%r13,%rax,8), %ebp
xorl %edi, %edi
callq 0x1cb0
testl %eax, %eax
je 0x2156
movzbl 0x418b(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
movl 0x10(%r13,%rax,8), %ebp
xorl %edi, %edi
callq 0x1cb0
testl %eax, %eax
je 0x2174
incl %r12d
cmpl %r12d, %ebx
jne 0x209f
jmp 0x1f51
testl %ebx, %ebx
je 0x1f51
xorl %r12d, %r12d
movzbl 0x4154(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
movl 0x10(%r13,%rax,8), %ebp
xorl %edi, %edi
callq 0x1cb0
testl %eax, %eax
je 0x2156
movzbl 0x4139(%rip), %eax      # 0x6250
leaq (%rax,%rax,2), %rax
movl 0x10(%r13,%rax,8), %ebp
xorl %edi, %edi
callq 0x1e3f
testl %eax, %eax
je 0x2174
incl %r12d
cmpl %r12d, %ebx
jne 0x20f5
jmp 0x1f51
leaq 0x4119(%rip), %r14      # 0x6258
movq 0x8192(%rip), %rdi      # 0xa2d8
shlq $0xa, %rdi
addq %r14, %rdi
leaq 0x105b(%rip), %rsi      # 0x31af
jmp 0x2190
leaq 0x40fb(%rip), %r14      # 0x6258
movq 0x8174(%rip), %rdi      # 0xa2d8
shlq $0xa, %rdi
addq %r14, %rdi
leaq 0x106c(%rip), %rsi      # 0x31de
jmp 0x2190
leaq 0x40dd(%rip), %r14      # 0x6258
movq 0x8156(%rip), %rdi      # 0xa2d8
shlq $0xa, %rdi
addq %r14, %rdi
leaq 0x1081(%rip), %rsi      # 0x3211
xorl %r15d, %r15d
movl %r12d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x1130
movq 0x8132(%rip), %rax      # 0xa2d8
movq %rbp, 0x4000(%r14,%rax,8)
incq 0x8123(%rip)            # 0xa2d8
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq