// File: BenLangmead[P]bowtie/./ebwt.h
// Function: SString<char> Ebwt::join<SString<char>>(EList<FileBuf*, 128>&, EList<RefRecord, 128>&, unsigned int, RefReadInParams const&, unsigned int)
TStr Ebwt::join(EList<FileBuf*>& l,
		EList<RefRecord>& szs,
		TIndexOffU sztot,
		const RefReadInParams& refparams,
		uint32_t seed)
{
	RandomSource rand; // reproducible given same seed
	rand.init(seed);
	RefReadInParams rpcp = refparams;
	TStr ret;
	size_t guessLen = sztot;
	ret.resize(guessLen);
	TIndexOffU dstoff = 0;
	ASSERT_ONLY(size_t szsi = 0);
	for(size_t i = 0; i < l.size(); i++) {
		// For each sequence we can pull out of istream l[i]...
		assert(!l[i]->eof());
		bool first = true;
		while(!l[i]->eof()) {
			RefRecord rec = fastaRefReadAppend(*l[i], first, ret, dstoff, rpcp);
#ifndef ACCOUNT_FOR_ALL_GAP_REFS
			if(rec.first && rec.len == 0) rec.first = false;
#endif
			first = false;
			size_t bases = rec.len;
			assert_eq(rec.off, szs[szsi].off);
			assert_eq(rec.len, szs[szsi].len);
			assert_eq(rec.first, szs[szsi].first);
			ASSERT_ONLY(szsi++);
			if(bases == 0) continue;
		}
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0xa0(%rbp)
movq %rdi, %rax
movq %rax, -0xb0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x21c20
movq -0xa8(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x21c40
movq -0xa0(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movb $0x0, -0x49(%rbp)
callq 0x14b80
movq -0xa0(%rbp), %rdi
movl -0x1c(%rbp), %eax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rsi
callq 0x14860
jmp 0x1cb96
movl $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x21c70
movq %rax, %rcx
movq -0xb8(%rbp), %rax
cmpq %rcx, %rax
jae 0x1ccbe
movb $0x1, -0x71(%rbp)
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x21c90
movq (%rax), %rdi
callq 0x21cc0
xorb $-0x1, %al
testb $0x1, %al
jne 0x1cbf0
jmp 0x1ccab
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x21c90
movq -0xa0(%rbp), %rdx
movq (%rax), %rdi
movzbl -0x71(%rbp), %esi
andl $0x1, %esi
xorl %eax, %eax
movl %eax, %r9d
leaq -0x68(%rbp), %rcx
leaq -0x48(%rbp), %r8
callq 0x11cc0
movb %dl, -0xc1(%rbp)
movq %rax, -0xc0(%rbp)
jmp 0x1cc2f
movb -0xc1(%rbp), %al
movq -0xc0(%rbp), %rcx
movq %rcx, -0x90(%rbp)
movb %al, -0x88(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x80(%rbp)
movb -0x88(%rbp), %al
movb %al, -0x78(%rbp)
testb $0x1, -0x78(%rbp)
je 0x1cc89
cmpl $0x0, -0x7c(%rbp)
jne 0x1cc89
movb $0x0, -0x78(%rbp)
jmp 0x1cc89
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
callq 0x14c50
jmp 0x1cce4
movb $0x0, -0x71(%rbp)
movl -0x7c(%rbp), %eax
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
jne 0x1cca6
jmp 0x1cbd0
jmp 0x1cbd0
jmp 0x1ccad
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x1cba5
movb $0x1, -0x49(%rbp)
testb $0x1, -0x49(%rbp)
jne 0x1ccd4
movq -0xa0(%rbp), %rdi
callq 0x14c50
movq -0xb0(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x6850
nopl (%rax)