// File: /workspace/github_c_makefile_star2_O2/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 0x48bb(%rip), %eax      # 0x6260
imulq $0x18, %rax, %rax
leaq 0x4730(%rip), %r13      # 0x60e0
movl 0x10(%rax,%r13), %r12d
movq %rsp, %rdi
callq 0x17d4
testl %eax, %eax
je 0x1a2a
movq (%rsp), %rax
movq %rax, (%r14)
movl 0x8(%r14), %eax
leal -0x1(%rax), %ecx
xorl %ebx, %ebx
cmpl $0x4, %ecx
jae 0x19ef
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x14fe
cmpl $-0x1, %eax
je 0x1a70
movl %eax, %ebx
movl 0x8(%r14), %eax
cmpl $0xd, %eax
ja 0x1b22
movl %eax, %eax
leaq 0x1603(%rip), %rcx      # 0x3004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x17d4
testl %eax, %eax
je 0x1ab9
movb $0x1, 0xc(%r14)
pushq $0x1
popq %r15
jmp 0x1c69
leaq 0x4837(%rip), %rax      # 0x6268
movq 0x88b0(%rip), %rcx      # 0xa2e8
movq %rcx, %rdx
shlq $0xa, %rdx
movups 0x171f(%rip), %xmm0     # 0x3165
movups %xmm0, (%rdx,%rax)
movabsq $0x79656b20797274, %rsi # imm = 0x79656B20797274
movq %rsi, 0x10(%rdx,%rax)
movq %r12, 0x4000(%rax,%rcx,8)
incq 0x8880(%rip)            # 0xa2e8
xorl %r15d, %r15d
jmp 0x1c69
leaq 0x47f1(%rip), %rbx      # 0x6268
movq 0x886a(%rip), %rdi      # 0xa2e8
shlq $0xa, %rdi
addq %rbx, %rdi
movslq 0x8(%r14), %rax
shlq $0x4, %rax
leaq 0x887c(%rip), %rdx      # 0xa310
addq %rax, %rdx
leaq 0x16df(%rip), %rsi      # 0x317d
xorl %eax, %eax
callq 0x1140
movq 0x883c(%rip), %rax      # 0xa2e8
movq %r12, 0x4000(%rbx,%rax,8)
jmp 0x1c62
leaq 0x47a8(%rip), %rax      # 0x6268
movq 0x8821(%rip), %rcx      # 0xa2e8
movq %rcx, %rdx
shlq $0xa, %rdx
movups 0x16ca(%rip), %xmm0     # 0x319f
movups %xmm0, 0xa(%rdx,%rax)
movups 0x16b4(%rip), %xmm0     # 0x3195
movups %xmm0, (%rdx,%rax)
movq %r12, 0x4000(%rax,%rcx,8)
jmp 0x1c62
xorl %r12d, %r12d
cmpl %r12d, %ebx
je 0x1a1c
movzbl 0x475b(%rip), %eax      # 0x6260
imulq $0x18, %rax, %rax
movl 0x10(%rax,%r13), %ebp
xorl %edi, %edi
callq 0x17d4
testl %eax, %eax
je 0x1bec
incl %r12d
jmp 0x1af5
leaq 0x473f(%rip), %rax      # 0x6268
movq 0x87b8(%rip), %rcx      # 0xa2e8
movq %rcx, %rdx
shlq $0xa, %rdx
movups 0x1708(%rip), %xmm0     # 0x3246
movups %xmm0, (%rdx,%rax)
movabsq $0x6465746e656d65, %rsi # imm = 0x6465746E656D65
movq %rsi, 0xd(%rdx,%rax)
jmp 0x1a59
xorl %r12d, %r12d
cmpl %r12d, %ebx
je 0x1a1c
movzbl 0x46f7(%rip), %eax      # 0x6260
imulq $0x18, %rax, %rax
movl 0x10(%rax,%r13), %ebp
xorl %edi, %edi
callq 0x17d4
testl %eax, %eax
je 0x1c0a
movzbl 0x46d8(%rip), %eax      # 0x6260
imulq $0x18, %rax, %rax
movl 0x10(%rax,%r13), %ebp
xorl %edi, %edi
callq 0x17d4
testl %eax, %eax
je 0x1c28
incl %r12d
jmp 0x1b59
xorl %r12d, %r12d
cmpl %r12d, %ebx
je 0x1a1c
movzbl 0x46a8(%rip), %eax      # 0x6260
imulq $0x18, %rax, %rax
movl 0x10(%rax,%r13), %ebp
xorl %edi, %edi
callq 0x17d4
testl %eax, %eax
je 0x1c0a
movzbl 0x468d(%rip), %eax      # 0x6260
imulq $0x18, %rax, %rax
movl 0x10(%rax,%r13), %ebp
xorl %edi, %edi
callq 0x190c
testl %eax, %eax
je 0x1c28
incl %r12d
jmp 0x1ba8
leaq 0x4675(%rip), %r14      # 0x6268
movq 0x86ee(%rip), %rdi      # 0xa2e8
shlq $0xa, %rdi
addq %r14, %rdi
leaq 0x15a7(%rip), %rsi      # 0x31af
jmp 0x1c44
leaq 0x4657(%rip), %r14      # 0x6268
movq 0x86d0(%rip), %rdi      # 0xa2e8
shlq $0xa, %rdi
addq %r14, %rdi
leaq 0x15b8(%rip), %rsi      # 0x31de
jmp 0x1c44
leaq 0x4639(%rip), %r14      # 0x6268
movq 0x86b2(%rip), %rdi      # 0xa2e8
shlq $0xa, %rdi
addq %r14, %rdi
leaq 0x15cd(%rip), %rsi      # 0x3211
xorl %r15d, %r15d
movl %r12d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x1140
movq 0x868e(%rip), %rax      # 0xa2e8
movq %rbp, 0x4000(%r14,%rax,8)
incq 0x867f(%rip)            # 0xa2e8
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq