// File: BenLangmead[P]bowtie/./ebwt.h
// Function: Ebwt::szsToDisk(EList<RefRecord, 128> const&, std::ostream&, int)
void szsToDisk(const EList<RefRecord>& szs, ostream& os, int reverse) {
		TIndexOffU seq = 0;
		TIndexOffU off = 0;
		TIndexOffU totlen = 0;
		for(unsigned int i = 0; i < szs.size(); i++) {
			if(szs[i].len == 0) continue;
			if(szs[i].first) off = 0;
			off += szs[i].off;
#ifdef ACCOUNT_FOR_ALL_GAP_REFS
			if(szs[i].first && szs[i].len > 0) seq++;
#else
			if(szs[i].first) seq++;
#endif
			TIndexOffU seqm1 = seq-1;
			assert_lt(seqm1, _nPat);
			TIndexOffU fwoff = off;
			if(reverse == REF_READ_REVERSE) {
				// Invert pattern idxs
				seqm1 = _nPat - seqm1 - 1;
				// Invert pattern idxs
				assert_leq(off + szs[i].len, _plen[seqm1]);
				fwoff = _plen[seqm1] - (off + szs[i].len);
			}
			writeU<TIndexOffU>(os, totlen, this->toBe()); // offset from beginning of joined string
			writeU<TIndexOffU>(os, seqm1,  this->toBe()); // sequence id
			writeU<TIndexOffU>(os, fwoff,  this->toBe()); // offset into sequence
			totlen += szs[i].len;
			off += szs[i].len;
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1b600
movq %rax, %rcx
movq -0x48(%rbp), %rax
cmpq %rcx, %rax
jae 0x1fd36
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x221d0
cmpl $0x0, 0x4(%rax)
jne 0x1fbd7
jmp 0x1fd28
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x221d0
testb $0x1, 0x8(%rax)
je 0x1fbf2
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x221d0
movl (%rax), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x221d0
testb $0x1, 0x8(%rax)
je 0x1fc25
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x34(%rbp)
cmpl $0x1, -0x1c(%rbp)
jne 0x1fc7f
movq -0x40(%rbp), %rax
movl 0x74(%rax), %ecx
subl -0x30(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, -0x30(%rbp)
movq 0x80(%rax), %rax
movl -0x30(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x221d0
movl -0x50(%rbp), %ecx
movq %rax, %rdx
movl -0x4c(%rbp), %eax
addl 0x4(%rdx), %ecx
subl %ecx, %eax
movl %eax, -0x34(%rbp)
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x80(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x74(%rbp)
callq 0x16c80
movq -0x80(%rbp), %rdi
movl -0x74(%rbp), %esi
movzbl %al, %edx
andl $0x1, %edx
callq 0xbd10
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x64(%rbp)
callq 0x16c80
movq -0x70(%rbp), %rdi
movl -0x64(%rbp), %esi
movzbl %al, %edx
andl $0x1, %edx
callq 0xbd10
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x54(%rbp)
callq 0x16c80
movq -0x60(%rbp), %rdi
movl -0x54(%rbp), %esi
movzbl %al, %edx
andl $0x1, %edx
callq 0xbd10
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x221d0
movl 0x4(%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x221d0
movl 0x4(%rax), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1fb9e
addq $0x80, %rsp
popq %rbp
retq
nop