// File: /workspace/github_cpp_makefile_star2_O2/BenLangmead[P]bowtie/ref_read.cpp
// Function: reverseRefRecords(EList<RefRecord, 128> const&, EList<RefRecord, 128>&, bool, bool)
void reverseRefRecords(const EList<RefRecord>& src,
					   EList<RefRecord>& dst,
					   bool recursive,
					   bool verbose)
{
	dst.clear();
	{
		EList<RefRecord> cur;
		for(int64_t i = (int64_t)src.size()-1; i >= 0; i--) {
			bool first = (i == (int)src.size()-1 || src[i+1].first);
			if(src[i].len) {
				cur.push_back(RefRecord(0, src[i].len, first));
				first = false;
			}
			if(src[i].off) cur.push_back(RefRecord(src[i].off, 0, first));
		}
		for(int64_t i = 0; i < (int64_t)cur.size(); i++) {
			assert(cur[i].off == 0 || cur[i].len == 0);
			if(i < (int64_t)cur.size()-1 && cur[i].off != 0 && !cur[i+1].first) {
				dst.push_back(RefRecord(cur[i].off, cur[i+1].len, cur[i].first));
				i++;
			} else {
				dst.push_back(cur[i]);
			}
		}
	}
	if(verbose) {
		cout << "Source: " << endl;
		printRecords(cout, src);
		cout << "Dest: " << endl;
		printRecords(cout, dst);
	}
#ifndef NDEBUG
	if(!recursive) {
		EList<RefRecord> tmp;
		reverseRefRecords(dst, tmp, true);
		assert_eq(tmp.size(), src.size());
		for(size_t i = 0; i < src.size(); i++) {
			assert_eq(src[i].len, tmp[i].len);
			assert_eq(src[i].off, tmp[i].off);
			assert_eq(src[i].first, tmp[i].first);
		}
	}
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
andq $0x0, 0x18(%rsi)
movl %ecx, 0x2c(%rsp)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
leaq 0x8(%rsp), %r12
movq %rax, (%r12)
andq $0x0, 0x8(%r12)
movq $0x80, 0x10(%r12)
andq $0x0, 0x18(%r12)
movl %edx, %ebx
movq %rdi, (%rsp)
movq 0x18(%rdi), %rsi
leaq 0x30(%rsp), %r13
testq %rsi, %rsi
jle 0x25c59
leaq -0x1(%rsi), %rbp
movq (%rsp), %rdi
movl 0x18(%rdi), %eax
decl %eax
cltq
movb $0x1, %r15b
cmpq %rax, %rbp
je 0x25bd8
callq 0x147d8
movb 0x10(%rax), %r15b
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x147d8
cmpq $0x0, 0x8(%rax)
je 0x25c15
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x147d8
movq 0x8(%rax), %rax
andq $0x0, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movb %r15b, 0x40(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x1b1a2
xorl %r15d, %r15d
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x147d8
cmpq $0x0, (%rax)
je 0x25c51
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x147d8
movq (%rax), %rax
movq %rax, 0x30(%rsp)
andq $0x0, 0x38(%rsp)
movb %r15b, 0x40(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x1b1a2
movq %rbp, %rsi
jmp 0x25bab
movl %ebx, 0x28(%rsp)
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
movq (%rsp), %rbx
cmpq 0x20(%rsp), %rbp
jge 0x25d3d
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1b2cc
cmpq $0x0, (%rax)
je 0x25c9a
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1b2cc
cmpq $0x0, 0x8(%rax)
jne 0x25e73
movq 0x20(%rsp), %rax
decq %rax
cmpq %rax, %rbp
jge 0x25ccd
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1b2cc
cmpq $0x0, (%rax)
je 0x25ccd
leaq 0x1(%rbp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x1b2cc
cmpb $0x0, 0x10(%rax)
je 0x25ce8
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1b2cc
movq %r14, %rdi
movq %rax, %rsi
callq 0x1b1a2
incq %rbp
jmp 0x25c68
movq %r14, %rbx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1b2cc
movq (%rax), %r13
movq %r12, %rdi
movq %r15, %rsi
callq 0x1b2cc
movq 0x8(%rax), %r14
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1b2cc
movb 0x10(%rax), %al
movq %r13, 0x30(%rsp)
movq %r14, 0x38(%rsp)
movb %al, 0x40(%rsp)
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
callq 0x1b1a2
movq %r15, %rbp
movq %rbx, %r14
movq (%rsp), %rbx
jmp 0x25ce3
leaq 0x8(%rsp), %rdi
callq 0x1b83c
cmpb $0x0, 0x2c(%rsp)
je 0x25d93
movq 0xe263(%rip), %r15      # 0x33fb8
leaq 0x65da(%rip), %rsi      # 0x2c336
movq %r15, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x26437
leaq 0x65c4(%rip), %rsi      # 0x2c33f
movq %r15, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
movq %r14, %rdi
callq 0x26437
cmpb $0x0, 0x28(%rsp)
jne 0x25e64
leaq 0x8(%rsp), %rsi
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, (%rsi)
andq $0x0, 0x8(%rsi)
movq $0x80, 0x10(%rsi)
andq $0x0, 0x18(%rsi)
pushq $0x1
popq %rdx
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x25b5a
movq 0x20(%rsp), %rax
cmpq 0x18(%rbx), %rax
jne 0x262e1
xorl %r14d, %r14d
leaq 0x8(%rsp), %r15
cmpq %rax, %r14
jae 0x25e5a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x147d8
movq 0x8(%rax), %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0x1b2cc
cmpq 0x8(%rax), %r12
jne 0x26170
movq %rbx, %rdi
movq %r14, %rsi
callq 0x147d8
movq (%rax), %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0x1b2cc
cmpq (%rax), %r12
jne 0x26003
movq %rbx, %rdi
movq %r14, %rsi
callq 0x147d8
movb 0x10(%rax), %bpl
movq %r15, %rdi
movq %r14, %rsi
callq 0x1b2cc
cmpb 0x10(%rax), %bpl
jne 0x25e92
incq %r14
movq 0x18(%rbx), %rax
jmp 0x25de6
leaq 0x8(%rsp), %rdi
callq 0x1b83c
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6448(%rip), %rdi      # 0x2c2c2
leaq 0x62cd(%rip), %rsi      # 0x2c14e
leaq 0x645d(%rip), %rcx      # 0x2c2e5
movl $0xab, %edx
callq 0x4190
movq 0xe11f(%rip), %rdi      # 0x33fb8
leaq 0x22b9(%rip), %rsi      # 0x28159
callq 0x42d0
movq %rax, %r15
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x147d8
movzbl 0x10(%rax), %esi
movq %r15, %rdi
callq 0x4550
leaq 0x22a8(%rip), %rsi      # 0x2816f
movq %rax, %rdi
callq 0x42d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r15,%rax)
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x147d8
movzbl 0x10(%rax), %esi
movq %r15, %rdi
callq 0x4550
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x2257(%rip), %rsi      # 0x28174
movq %rax, %rdi
callq 0x42d0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1b2cc
movzbl 0x10(%rax), %esi
movq %rbx, %rdi
callq 0x4550
leaq 0x2227(%rip), %rsi      # 0x2816f
movq %rax, %rdi
callq 0x42d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1b2cc
movzbl 0x10(%rax), %esi
movq %rbx, %rdi
callq 0x4550
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x447b(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
movq 0xe004(%rip), %rdi      # 0x33fb8
leaq 0x6193(%rip), %rsi      # 0x2c14e
callq 0x42d0
leaq 0x3774(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0xc2, %esi
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x3630(%rip), %rdi      # 0x2961b
leaq 0x615c(%rip), %rsi      # 0x2c14e
leaq 0x62ec(%rip), %rcx      # 0x2c2e5
movl $0xc2, %edx
callq 0x4190
movq 0xdfae(%rip), %rdi      # 0x33fb8
leaq 0x2148(%rip), %rsi      # 0x28159
callq 0x42d0
movq %rax, %r15
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x147d8
movq (%rax), %rsi
movq %r15, %rdi
callq 0x41a0
leaq 0x2138(%rip), %rsi      # 0x2816f
movq %rax, %rdi
callq 0x42d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r15,%rax)
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x147d8
movq (%rax), %rsi
movq %r15, %rdi
callq 0x41a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x20e8(%rip), %rsi      # 0x28174
movq %rax, %rdi
callq 0x42d0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1b2cc
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x41a0
leaq 0x20b9(%rip), %rsi      # 0x2816f
movq %rax, %rdi
callq 0x42d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1b2cc
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x41a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x430e(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
movq 0xde97(%rip), %rdi      # 0x33fb8
leaq 0x6026(%rip), %rsi      # 0x2c14e
callq 0x42d0
leaq 0x3607(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0xc1, %esi
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x34c3(%rip), %rdi      # 0x2961b
leaq 0x5fef(%rip), %rsi      # 0x2c14e
leaq 0x617f(%rip), %rcx      # 0x2c2e5
movl $0xc1, %edx
callq 0x4190
movq 0xde41(%rip), %rdi      # 0x33fb8
leaq 0x1fdb(%rip), %rsi      # 0x28159
callq 0x42d0
movq %rax, %r15
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x147d8
movq 0x8(%rax), %rsi
movq %r15, %rdi
callq 0x41a0
leaq 0x1fca(%rip), %rsi      # 0x2816f
movq %rax, %rdi
callq 0x42d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r15,%rax)
movq (%rsp), %rdi
movq %r14, %rsi
callq 0x147d8
movq 0x8(%rax), %rsi
movq %r15, %rdi
callq 0x41a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x1f79(%rip), %rsi      # 0x28174
movq %rax, %rdi
callq 0x42d0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1b2cc
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x41a0
leaq 0x1f49(%rip), %rsi      # 0x2816f
movq %rax, %rdi
callq 0x42d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1b2cc
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x41a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x419d(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
movq 0xdd26(%rip), %rdi      # 0x33fb8
leaq 0x5eb5(%rip), %rsi      # 0x2c14e
callq 0x42d0
leaq 0x3496(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0xc0, %esi
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x3352(%rip), %rdi      # 0x2961b
leaq 0x5e7e(%rip), %rsi      # 0x2c14e
leaq 0x600e(%rip), %rcx      # 0x2c2e5
movl $0xc0, %edx
callq 0x4190
movq 0xdcd0(%rip), %rdi      # 0x33fb8
leaq 0x1e6a(%rip), %rsi      # 0x28159
callq 0x42d0
movq 0x20(%rsp), %rsi
movq %rax, %rdi
callq 0x41a0
leaq 0x1e67(%rip), %rsi      # 0x2816f
movq %rax, %rdi
callq 0x42d0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq 0x20(%rsp), %rsi
movq %rax, %rdi
callq 0x41a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x1e26(%rip), %rsi      # 0x28174
movq %rax, %rdi
callq 0x42d0
movq 0x18(%rbx), %rsi
movq %rax, %rdi
callq 0x41a0
leaq 0x1e06(%rip), %rsi      # 0x2816f
movq %rax, %rdi
callq 0x42d0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq 0x18(%rbx), %rsi
movq %rax, %rdi
callq 0x41a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
leaq 0x406a(%rip), %rsi      # 0x2a418
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4130
movq 0xdbf3(%rip), %rdi      # 0x33fb8
leaq 0x5d82(%rip), %rsi      # 0x2c14e
callq 0x42d0
leaq 0x3363(%rip), %rsi      # 0x2973b
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
movl $0xbe, %esi
callq 0x45d0
movq %rax, %rdi
callq 0x4130
leaq 0x321f(%rip), %rdi      # 0x2961b
leaq 0x5d4b(%rip), %rsi      # 0x2c14e
leaq 0x5edb(%rip), %rcx      # 0x2c2e5
movl $0xbe, %edx
callq 0x4190
jmp 0x26422
jmp 0x26422
jmp 0x26422
jmp 0x26422
jmp 0x26422
jmp 0x26422
jmp 0x26422
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1b83c
movq %rbx, %rdi
callq 0x45e0