// File: /workspace/github_cpp_makefile_star2_O1/Infinidat[P]slimfastq/recs.cpp
// Function: RecLoad::load_pre5(unsigned char*, unsigned char const*)
size_t RecLoad::load_pre5(UCHAR* buf, const UCHAR* prev) {

    UINT64 map = get_num(0);

    UCHAR* b = buf;
    for (int i = 0; i < smap[0].len; i++) {
        // if (IS_SET(last_map, i)) {
         if (IS_SET(map, i)) {

             UCHAR type = get_type(i+1);
             switch (type) {

             case ST_DGT:
             case ST_DLT: {
                      // compatibility - let it open old fi
                 long long pval;
                 bool expect_num = is_number(prev + smap[0].off[i], smap[0].wln[i], pval);
                 assert(expect_num);
                 long long gap = get_num(i+1);
                 long long val = type == ST_DGT ? pval + gap : pval - gap ;
                 // if (UINT64(val) > 0xffffffff00000000) {
                 //     fprintf(stderr, "big val: 0x%llx gap=0x%llx %s pval=0x%llx\n",
                 //             val, gap, (type == ST_DGT ? "GAP" : "PAG"), pval);
                 //     // debug point
                 // }

                 b += sprintf((char*)b, "%lld", val);
             } break;

             case ST_STR: {
                 b = get_str(i+1, b);
             } break;

             default:
                 croak("REC: bad type value %d", type);
             }
         }
         else {
            // b = (UCHAR*)mempcpy(b, prev + smap[0].off[i], smap[0].wln[i]);
            // mempcpy is not compatible with Mac OS, must do it the hard way ..
            UINT32 count = smap[0].wln[i] ;
            memcpy(b, prev + smap[0].off[i], count );
            b += count;
        }
        *b ++ = smap[0].str[i];
    }
    return b-buf-1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, (%rsp)
movq %rsi, %rbp
movq %rdi, %r15
addq $0x60e, %rdi            # imm = 0x60E
leaq 0xc7ce0(%r15), %rsi
movq %rsi, 0x10(%rsp)
callq 0x7fea
movq %rax, 0x20(%rsp)
cmpb $0x0, 0xc7f79(%r15)
movq %rbp, 0x8(%rsp)
je 0x7f04
xorl %r14d, %r14d
movq 0x8(%rsp), %rbp
movq 0x20(%rsp), %rax
btq %r14, %rax
jae 0x7e52
leal 0x1(%r14), %eax
movzbl %al, %r13d
imulq $0x3070, %r13, %rax     # imm = 0x3070
movq %rax, 0x18(%rsp)
leaq (%r15,%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0x34b4
movl %eax, %ebx
cmpb $0x2, %bl
jae 0x7e76
movslq 0xc7d30(%r15,%r14,4), %rax
movq (%rsp), %rcx
cmpb $0x30, (%rcx,%rax)
je 0x7e9d
movl 0xc7e34(%r15,%r14,4), %ecx
testl %ecx, %ecx
setle %dl
jle 0x7e95
addq (%rsp), %rax
movzbl (%rax), %edx
leal -0x30(%rdx), %esi
cmpl $0x9, %esi
ja 0x7e9a
movl $0x1, %edi
xorl %r12d, %r12d
movq %rdi, %rsi
leaq (%r12,%r12,4), %rdi
movzbl %dl, %edx
leaq (%rdx,%rdi,2), %r12
addq $-0x30, %r12
cmpq %rsi, %rcx
je 0x7e4a
movzbl (%rax,%rsi), %edx
movl %edx, %r8d
addl $-0x30, %r8d
leaq 0x1(%rsi), %rdi
cmpl $0x9, %r8d
jbe 0x7e1e
cmpq %rcx, %rsi
setae %dl
jmp 0x7e9f
movl 0xc7e34(%r15,%r14,4), %ebx
movslq 0xc7d30(%r15,%r14,4), %rsi
addq (%rsp), %rsi
movq %rbp, %rdi
movq %rbx, %rdx
callq 0x2170
addq %rbx, %rbp
jmp 0x7ee2
movzbl %bl, %eax
cmpl $0x2, %eax
jne 0x7f3d
movq %r15, %rdi
movl %r13d, %esi
movq %rbp, %rdx
callq 0x72a6
movq %rax, %rbp
jmp 0x7ee2
xorl %r12d, %r12d
jmp 0x7e9f
xorl %r12d, %r12d
xorl %edx, %edx
testb %dl, %dl
je 0x7f1e
movq 0x18(%rsp), %rax
leaq (%r15,%rax), %rdi
addq $0x60e, %rdi            # imm = 0x60E
movq 0x10(%rsp), %rsi
callq 0x7fea
movq %rax, %rdx
negq %rdx
testb %bl, %bl
cmoveq %rax, %rdx
addq %r12, %rdx
movq %rbp, %rdi
leaq 0x2c03(%rip), %rsi      # 0xaad9
xorl %eax, %eax
callq 0x20a0
cltq
addq %rax, %rbp
movb 0xc7f38(%r15,%r14), %al
movb %al, (%rbp)
incq %rbp
incq %r14
movzbl 0xc7f79(%r15), %eax
cmpq %rax, %r14
jb 0x7d9e
movq 0x8(%rsp), %rax
notq %rax
addq %rbp, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3116(%rip), %rdi      # 0xb03b
leaq 0x3078(%rip), %rsi      # 0xafa4
leaq 0x3113(%rip), %rcx      # 0xb046
movl $0x1e0, %edx            # imm = 0x1E0
callq 0x2130
movl %ebx, %edi
callq 0x2a0d