// File: /workspace/github_cpp_makefile_star2_O3/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
movl %ecx, 0x20(%rsp)
movl %edx, 0x24(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
xorl %eax, %eax
movq %rax, 0x18(%rsi)
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
movq %rcx, (%rsp)
movq %rax, 0x8(%rsp)
movq $0x80, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq 0x18(%rdi), %rsi
testq %rsi, %rsi
jle 0x29c25
movq %rsp, %r12
leaq 0x28(%rsp), %r13
leaq -0x1(%rsi), %rbp
movl 0x18(%rbx), %eax
decl %eax
cltq
movb $0x1, %r15b
cmpq %rax, %rbp
je 0x29aa9
movq %rbx, %rdi
callq 0x1800c
movb 0x10(%rax), %r15b
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1800c
cmpq $0x0, 0x8(%rax)
je 0x29aeb
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1800c
movq 0x8(%rax), %rax
movq $0x0, 0x28(%rsp)
movq %rax, 0x30(%rsp)
movb %r15b, 0x38(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x1ee04
xorl %r15d, %r15d
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1800c
cmpq $0x0, (%rax)
je 0x29b28
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1800c
movq (%rax), %rax
movq %rax, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
movb %r15b, 0x38(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x1ee04
movq %rbp, %rax
incq %rax
movq %rbp, %rsi
cmpq $0x1, %rax
ja 0x29a8a
cmpq $0x0, 0x18(%rsp)
jle 0x29c25
xorl %ebp, %ebp
movq %rsp, %r13
movq %r14, 0x40(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1ef76
cmpq $0x0, (%rax)
je 0x29b78
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1ef76
cmpq $0x0, 0x8(%rax)
jne 0x2a26b
movq 0x18(%rsp), %rax
decq %rax
cmpq %rax, %rbp
jge 0x29bab
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1ef76
cmpq $0x0, (%rax)
je 0x29bab
leaq 0x1(%rbp), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x1ef76
cmpb $0x0, 0x10(%rax)
je 0x29bcd
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1ef76
movq %r14, %rdi
movq %rax, %rsi
callq 0x1ee04
incq %rbp
cmpq 0x18(%rsp), %rbp
jl 0x29b51
jmp 0x29c25
movq %r13, %r12
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1ef76
movq (%rax), %r13
movq %r12, %rdi
movq %r15, %rsi
callq 0x1ef76
movq 0x8(%rax), %r14
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1ef76
movb 0x10(%rax), %al
movq %r13, 0x28(%rsp)
movq %r14, 0x30(%rsp)
movb %al, 0x38(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x1ee04
movq %r15, %rbp
movq 0x40(%rsp), %r14
movq %r12, %r13
jmp 0x29bc1
movq %rsp, %rdi
callq 0x1f656
cmpb $0x0, 0x20(%rsp)
je 0x29cc5
movq 0xd379(%rip), %r15      # 0x36fb8
leaq 0x6680(%rip), %rsi      # 0x302c6
movl $0x8, %edx
movq %r15, %rdi
callq 0x43b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4300
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41e0
movq %rbx, %rdi
callq 0x2a438
leaq 0x6646(%rip), %rsi      # 0x302cf
movl $0x6, %edx
movq %r15, %rdi
callq 0x43b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4300
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41e0
movq %r14, %rdi
callq 0x2a438
cmpb $0x0, 0x24(%rsp)
jne 0x29d92
movq %rsp, %rsi
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, (%rsi)
xorl %eax, %eax
movq %rax, 0x8(%rsi)
movq $0x80, 0x10(%rsi)
movq %rax, 0x18(%rsi)
movq %r14, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x29a32
movq 0x18(%rsp), %rax
cmpq 0x18(%rbx), %rax
jne 0x2a28a
testq %rax, %rax
je 0x29d8a
xorl %r14d, %r14d
movq %rsp, %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1800c
movq 0x8(%rax), %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0x1ef76
cmpq 0x8(%rax), %r12
jne 0x2a0d1
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1800c
movq (%rax), %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0x1ef76
cmpq (%rax), %r12
jne 0x29f3b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1800c
movb 0x10(%rax), %bpl
movq %r15, %rdi
movq %r14, %rsi
callq 0x1ef76
cmpb 0x10(%rax), %bpl
jne 0x29da1
incq %r14
cmpq 0x18(%rbx), %r14
jb 0x29d1b
movq %rsp, %rdi
callq 0x1f656
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xd210(%rip), %rdi      # 0x36fb8
leaq 0x2417(%rip), %rsi      # 0x2c1c6
movl $0x15, %edx
callq 0x43b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1800c
movzbl 0x10(%rax), %esi
movq 0xd1e9(%rip), %rdi      # 0x36fb8
callq 0x4590
movq %rax, %r15
leaq 0x23fe(%rip), %rsi      # 0x2c1dc
movl $0x4, %edx
movq %rax, %rdi
callq 0x43b0
movq (%r15), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r15,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1800c
movzbl 0x10(%rax), %esi
movq %r15, %rdi
callq 0x4590
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0x23a9(%rip), %rsi      # 0x2c1e1
movl $0x7, %edx
movq %rbx, %rdi
callq 0x43b0
movq %rsp, %rdi
movq %r14, %rsi
callq 0x1ef76
movzbl 0x10(%rax), %esi
movq %rbx, %rdi
callq 0x4590
movq %rax, %rbx
leaq 0x2376(%rip), %rsi      # 0x2c1dc
movl $0x4, %edx
movq %rax, %rdi
callq 0x43b0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq %rsp, %rdi
movq %r14, %rsi
callq 0x1ef76
movzbl 0x10(%rax), %esi
movq %rbx, %rdi
callq 0x4590
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0x44e7(%rip), %rsi      # 0x2e3a5
movl $0x1, %edx
movq %rbx, %rdi
callq 0x43b0
movq %rbx, %rdi
callq 0x4150
movq 0xd0de(%rip), %rdi      # 0x36fb8
leaq 0x61fd(%rip), %rsi      # 0x300de
movl $0xc, %edx
callq 0x43b0
movq 0xd0c6(%rip), %rdi      # 0x36fb8
leaq 0x38af(%rip), %rsi      # 0x2d7a8
movl $0x1, %edx
callq 0x43b0
movq 0xd0ae(%rip), %rdi      # 0x36fb8
movl $0xc2, %esi
callq 0x4610
movq %rax, %rdi
callq 0x4150
leaq 0x3765(%rip), %rdi      # 0x2d688
leaq 0x61b4(%rip), %rsi      # 0x300de
leaq 0x6344(%rip), %rcx      # 0x30275
movl $0xc2, %edx
callq 0x41c0
movq 0xd076(%rip), %rdi      # 0x36fb8
leaq 0x227d(%rip), %rsi      # 0x2c1c6
movl $0x15, %edx
callq 0x43b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1800c
movq (%rax), %rsi
movq 0xd050(%rip), %rdi      # 0x36fb8
callq 0x41d0
movq %rax, %r15
leaq 0x2265(%rip), %rsi      # 0x2c1dc
movl $0x4, %edx
movq %rax, %rdi
callq 0x43b0
movq (%r15), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r15,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1800c
movq (%rax), %rsi
movq %r15, %rdi
callq 0x41d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0x2211(%rip), %rsi      # 0x2c1e1
movl $0x7, %edx
movq %rbx, %rdi
callq 0x43b0
movq %rsp, %rdi
movq %r14, %rsi
callq 0x1ef76
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x41d0
movq %rax, %rbx
leaq 0x21df(%rip), %rsi      # 0x2c1dc
movl $0x4, %edx
movq %rax, %rdi
callq 0x43b0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq %rsp, %rdi
movq %r14, %rsi
callq 0x1ef76
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x41d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0x4351(%rip), %rsi      # 0x2e3a5
movl $0x1, %edx
movq %rbx, %rdi
callq 0x43b0
movq %rbx, %rdi
callq 0x4150
movq 0xcf48(%rip), %rdi      # 0x36fb8
leaq 0x6067(%rip), %rsi      # 0x300de
movl $0xc, %edx
callq 0x43b0
movq 0xcf30(%rip), %rdi      # 0x36fb8
leaq 0x3719(%rip), %rsi      # 0x2d7a8
movl $0x1, %edx
callq 0x43b0
movq 0xcf18(%rip), %rdi      # 0x36fb8
movl $0xc1, %esi
callq 0x4610
movq %rax, %rdi
callq 0x4150
leaq 0x35cf(%rip), %rdi      # 0x2d688
leaq 0x601e(%rip), %rsi      # 0x300de
leaq 0x61ae(%rip), %rcx      # 0x30275
movl $0xc1, %edx
callq 0x41c0
movq 0xcee0(%rip), %rdi      # 0x36fb8
leaq 0x20e7(%rip), %rsi      # 0x2c1c6
movl $0x15, %edx
callq 0x43b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1800c
movq 0x8(%rax), %rsi
movq 0xceb9(%rip), %rdi      # 0x36fb8
callq 0x41d0
movq %rax, %r15
leaq 0x20ce(%rip), %rsi      # 0x2c1dc
movl $0x4, %edx
movq %rax, %rdi
callq 0x43b0
movq (%r15), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r15,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1800c
movq 0x8(%rax), %rsi
movq %r15, %rdi
callq 0x41d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0x2079(%rip), %rsi      # 0x2c1e1
movl $0x7, %edx
movq %rbx, %rdi
callq 0x43b0
movq %rsp, %rdi
movq %r14, %rsi
callq 0x1ef76
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x41d0
movq %rax, %rbx
leaq 0x2046(%rip), %rsi      # 0x2c1dc
movl $0x4, %edx
movq %rax, %rdi
callq 0x43b0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq %rsp, %rdi
movq %r14, %rsi
callq 0x1ef76
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x41d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0x41b7(%rip), %rsi      # 0x2e3a5
movl $0x1, %edx
movq %rbx, %rdi
callq 0x43b0
movq %rbx, %rdi
callq 0x4150
movq 0xcdae(%rip), %rdi      # 0x36fb8
leaq 0x5ecd(%rip), %rsi      # 0x300de
movl $0xc, %edx
callq 0x43b0
movq 0xcd96(%rip), %rdi      # 0x36fb8
leaq 0x357f(%rip), %rsi      # 0x2d7a8
movl $0x1, %edx
callq 0x43b0
movq 0xcd7e(%rip), %rdi      # 0x36fb8
movl $0xc0, %esi
callq 0x4610
movq %rax, %rdi
callq 0x4150
leaq 0x3435(%rip), %rdi      # 0x2d688
leaq 0x5e84(%rip), %rsi      # 0x300de
leaq 0x6014(%rip), %rcx      # 0x30275
movl $0xc0, %edx
callq 0x41c0
leaq 0x5fe0(%rip), %rdi      # 0x30252
leaq 0x5e65(%rip), %rsi      # 0x300de
leaq 0x5ff5(%rip), %rcx      # 0x30275
movl $0xab, %edx
callq 0x41c0
movq 0xcd27(%rip), %rdi      # 0x36fb8
leaq 0x1f2e(%rip), %rsi      # 0x2c1c6
movl $0x15, %edx
callq 0x43b0
movq 0x18(%rsp), %rsi
movq 0xcd0a(%rip), %rdi      # 0x36fb8
callq 0x41d0
movq %rax, %r14
leaq 0x1f1f(%rip), %rsi      # 0x2c1dc
movl $0x4, %edx
movq %rax, %rdi
callq 0x43b0
movq (%r14), %rax
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r14,%rax)
movq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x41d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%r14,%rax)
leaq 0x1ed2(%rip), %rsi      # 0x2c1e1
movl $0x7, %edx
movq %r14, %rdi
callq 0x43b0
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0x41d0
movq %rax, %r14
leaq 0x1eaa(%rip), %rsi      # 0x2c1dc
movl $0x4, %edx
movq %rax, %rdi
callq 0x43b0
movq (%r14), %rax
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r14,%rax)
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0x41d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
leaq 0x4024(%rip), %rsi      # 0x2e3a5
movl $0x1, %edx
movq %rbx, %rdi
callq 0x43b0
movq %rbx, %rdi
callq 0x4150
movq 0xcc1b(%rip), %rdi      # 0x36fb8
leaq 0x5d3a(%rip), %rsi      # 0x300de
movl $0xc, %edx
callq 0x43b0
movq 0xcc03(%rip), %rdi      # 0x36fb8
leaq 0x33ec(%rip), %rsi      # 0x2d7a8
movl $0x1, %edx
callq 0x43b0
movq 0xcbeb(%rip), %rdi      # 0x36fb8
movl $0xbe, %esi
callq 0x4610
movq %rax, %rdi
callq 0x4150
leaq 0x32a2(%rip), %rdi      # 0x2d688
leaq 0x5cf1(%rip), %rsi      # 0x300de
leaq 0x5e81(%rip), %rcx      # 0x30275
movl $0xbe, %edx
callq 0x41c0
jmp 0x2a430
jmp 0x2a41b
jmp 0x2a430
jmp 0x2a40e
jmp 0x2a40e
jmp 0x2a40e
jmp 0x2a41b
jmp 0x2a40e
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1f656
jmp 0x2a426
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1f656
movq %rbx, %rdi
callq 0x4620
jmp 0x2a430
movq %rax, %rdi
callq 0x100de