// File: BenLangmead[P]bowtie/./ebwt.h
// Function: readEbwtRefnames(_IO_FILE*, EList<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, 128>&)
static inline void
readEbwtRefnames(FILE* fin, EList<string>& refnames) {
	// _in1 must already be open with the get cursor at the
	// beginning and no error flags set.
	assert(fin != NULL);
	assert_eq(ftello(fin), 0);

	// Read endianness hints from both streams
	bool switchEndian = false;
	uint32_t one = readU<uint32_t>(fin, switchEndian); // 1st word of primary stream
	if(one != 1) {
		assert_eq((1u<<24), one);
		switchEndian = true;
	}

	// Reads header entries one by one from primary stream
	TIndexOffU len          = readU<TIndexOffU>(fin, switchEndian);
	int32_t  lineRate     = readI<int32_t>(fin, switchEndian);
	int32_t  linesPerSide = readI<int32_t>(fin, switchEndian);
	int32_t  offRate      = readI<int32_t>(fin, switchEndian);
	int32_t  ftabChars    = readI<int32_t>(fin, switchEndian);
	// BTL: chunkRate is now deprecated
	int32_t flags = readI<int32_t>(fin, switchEndian);
	bool entireReverse = false;
	if(flags < 0) {
		entireReverse = (((-flags) & EBWT_ENTIRE_REV) != 0);
	}

	// Create a new EbwtParams from the entries read from primary stream
	bool isBt2Index = false;
	if (gEbwt_ext == "bt2" || gEbwt_ext == "bt2") {
		isBt2Index = true;
	}
	EbwtParams eh(len, lineRate, linesPerSide, offRate, -1, ftabChars, entireReverse, isBt2Index);

	TIndexOffU nPat = readI<TIndexOffU>(fin, switchEndian); // nPat
	fseeko(fin, nPat*OFF_SIZE, SEEK_CUR);

	// Skip rstarts
	TIndexOffU nFrag = readU<TIndexOffU>(fin, switchEndian);
	fseeko(fin, nFrag*OFF_SIZE*3, SEEK_CUR);

	// Skip ebwt
	fseeko(fin, eh._ebwtTotLen, SEEK_CUR);

	// Skip zOff from primary stream
	readU<TIndexOffU>(fin, switchEndian);

	// Skip fchr
	fseeko(fin, 5 * OFF_SIZE, SEEK_CUR);

	// Skip ftab
	fseeko(fin, eh._ftabLen*OFF_SIZE, SEEK_CUR);

	// Skip eftab
	fseeko(fin, eh._eftabLen*OFF_SIZE, SEEK_CUR);

	// Read reference sequence names from primary index file
	while(true) {
		char c = '\0';
		int read_value = 0;
        read_value = fgetc(fin);
		if(read_value == EOF) break;
        c = read_value;
		if(c == '\0') break;
		else if(c == '\n') {
			refnames.push_back("");
		} else {
			if(refnames.size() == 0) {
				refnames.push_back("");
			}
			refnames.back().push_back(c);
		}
	}
	if(refnames.back().empty()) {
		refnames.pop_back();
	}

	// Be kind
    fseeko(fin, 0, SEEK_SET);
	assert(ferror(fin) == 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1337c
jmp 0x1339b
leaq 0x2e237(%rip), %rdi     # 0x415ba
leaq 0x2bd33(%rip), %rsi     # 0x3f0bd
movl $0xd80, %edx            # imm = 0xD80
leaq 0x2e230(%rip), %rcx     # 0x415c6
callq 0x51e0
movq -0x8(%rbp), %rdi
callq 0x5630
cmpq $0x0, %rax
je 0x134f7
movq 0x36c0b(%rip), %rdi     # 0x49fc0
leaq 0x2bd5d(%rip), %rsi     # 0x3f119
callq 0x5360
movq %rax, -0x180(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5630
movq -0x180(%rbp), %rdi
movq %rax, %rsi
callq 0x57b0
movq %rax, %rdi
leaq 0x2bd45(%rip), %rsi     # 0x3f12f
callq 0x5360
movq %rax, %rdi
leaq 0x53e7(%rip), %rsi      # 0x187e0
callq 0x5120
movq %rax, -0x178(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5630
movq -0x178(%rbp), %rdi
movq %rax, %rsi
callq 0x57b0
movq %rax, %rdi
leaq 0x53e9(%rip), %rsi      # 0x18810
callq 0x5120
movq %rax, %rdi
leaq 0x2bcfe(%rip), %rsi     # 0x3f134
callq 0x5360
movq %rax, %rdi
xorl %esi, %esi
callq 0x5750
movq %rax, %rdi
leaq 0x2bce0(%rip), %rsi     # 0x3f12f
callq 0x5360
movq %rax, %rdi
leaq 0x5382(%rip), %rsi      # 0x187e0
callq 0x5120
movq %rax, %rdi
xorl %esi, %esi
callq 0x5750
movq %rax, %rdi
leaq 0x5399(%rip), %rsi      # 0x18810
callq 0x5120
movq %rax, %rdi
leaq 0x2e132(%rip), %rsi     # 0x415b8
callq 0x5360
movq %rax, %rdi
movq 0x36aeb(%rip), %rsi     # 0x49f80
callq 0x53c0
movq 0x36b1f(%rip), %rdi     # 0x49fc0
leaq 0x2bc15(%rip), %rsi     # 0x3f0bd
callq 0x5360
movq %rax, %rdi
leaq 0x2d2d3(%rip), %rsi     # 0x4078a
callq 0x5360
movq %rax, %rdi
movl $0xd81, %esi            # imm = 0xD81
callq 0x5750
movq %rax, %rdi
movq 0x36aad(%rip), %rsi     # 0x49f80
callq 0x53c0
leaq 0x2d18b(%rip), %rdi     # 0x4066a
leaq 0x2bbd7(%rip), %rsi     # 0x3f0bd
movl $0xd81, %edx            # imm = 0xD81
leaq 0x2e0d4(%rip), %rcx     # 0x415c6
callq 0x51e0
movb $0x0, -0x11(%rbp)
movq -0x8(%rbp), %rdi
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0xe250
movl %eax, -0x18(%rbp)
cmpl $0x1, -0x18(%rbp)
je 0x13652
movl $0x1000000, %eax        # imm = 0x1000000
cmpl -0x18(%rbp), %eax
je 0x1364e
movq 0x36a92(%rip), %rdi     # 0x49fc0
leaq 0x2bbe4(%rip), %rsi     # 0x3f119
callq 0x5360
movq %rax, %rdi
movl $0x1000000, %esi        # imm = 0x1000000
callq 0x5530
movq %rax, %rdi
leaq 0x2bbde(%rip), %rsi     # 0x3f12f
callq 0x5360
movq %rax, %rdi
leaq 0x5280(%rip), %rsi      # 0x187e0
callq 0x5120
movq %rax, %rdi
movl $0x1000000, %esi        # imm = 0x1000000
callq 0x5530
movq %rax, %rdi
leaq 0x5294(%rip), %rsi      # 0x18810
callq 0x5120
movq %rax, %rdi
leaq 0x2bba9(%rip), %rsi     # 0x3f134
callq 0x5360
movq %rax, %rdi
movl -0x18(%rbp), %esi
callq 0x5530
movq %rax, %rdi
leaq 0x2bb8a(%rip), %rsi     # 0x3f12f
callq 0x5360
movq %rax, %rdi
leaq 0x522c(%rip), %rsi      # 0x187e0
callq 0x5120
movq %rax, %rdi
movl -0x18(%rbp), %esi
callq 0x5530
movq %rax, %rdi
leaq 0x5242(%rip), %rsi      # 0x18810
callq 0x5120
movq %rax, %rdi
leaq 0x2dfdb(%rip), %rsi     # 0x415b8
callq 0x5360
movq %rax, %rdi
movq 0x36994(%rip), %rsi     # 0x49f80
callq 0x53c0
movq 0x369c8(%rip), %rdi     # 0x49fc0
leaq 0x2babe(%rip), %rsi     # 0x3f0bd
callq 0x5360
movq %rax, %rdi
leaq 0x2d17c(%rip), %rsi     # 0x4078a
callq 0x5360
movq %rax, %rdi
movl $0xd87, %esi            # imm = 0xD87
callq 0x5750
movq %rax, %rdi
movq 0x36956(%rip), %rsi     # 0x49f80
callq 0x53c0
leaq 0x2d034(%rip), %rdi     # 0x4066a
leaq 0x2ba80(%rip), %rsi     # 0x3f0bd
movl $0xd87, %edx            # imm = 0xD87
leaq 0x2df7d(%rip), %rcx     # 0x415c6
callq 0x51e0
movb $0x1, -0x11(%rbp)
movq -0x8(%rbp), %rdi
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0xe330
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0xe3b0
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0xe3b0
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0xe3b0
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0xe3b0
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0xe3b0
movl %eax, -0x34(%rbp)
movb $0x0, -0x35(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0x136e8
xorl %eax, %eax
subl -0x34(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x35(%rbp)
movb $0x0, -0x36(%rbp)
leaq 0x38aed(%rip), %rdi     # 0x4c1e0
leaq 0x2defb(%rip), %rsi     # 0x415f5
callq 0x2f730
testb $0x1, %al
jne 0x1371c
leaq 0x38ad6(%rip), %rdi     # 0x4c1e0
leaq 0x2dee4(%rip), %rsi     # 0x415f5
callq 0x2f730
testb $0x1, %al
jne 0x1371c
jmp 0x13720
movb $0x1, -0x36(%rbp)
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
movl -0x2c(%rbp), %r8d
movl -0x30(%rbp), %r11d
movb -0x35(%rbp), %r10b
movb -0x36(%rbp), %al
leaq -0xf8(%rbp), %rdi
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
andb $0x1, %r10b
andb $0x1, %al
movl %r11d, (%rsp)
movzbl %r10b, %r10d
movl %r10d, 0x8(%rsp)
movzbl %al, %eax
movl %eax, 0x10(%rsp)
callq 0x1a0c0
movq -0x8(%rbp), %rdi
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0xe430
movq %rax, -0x100(%rbp)
movq -0x8(%rbp), %rdi
movq -0x100(%rbp), %rsi
shlq $0x3, %rsi
movl $0x1, %edx
callq 0x56b0
movq -0x8(%rbp), %rdi
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0xe330
movq %rax, -0x108(%rbp)
movq -0x8(%rbp), %rdi
movq -0x108(%rbp), %rax
shlq $0x3, %rax
imulq $0x3, %rax, %rsi
movl $0x1, %edx
callq 0x56b0
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl $0x1, %edx
callq 0x56b0
movq -0x8(%rbp), %rdi
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0xe330
movq -0x8(%rbp), %rdi
movl $0x28, %esi
movl $0x1, %edx
callq 0x56b0
movq -0x8(%rbp), %rdi
movq -0xa8(%rbp), %rsi
shlq $0x3, %rsi
movl $0x1, %edx
callq 0x56b0
movq -0x8(%rbp), %rdi
movl -0xb4(%rbp), %eax
shll $0x3, %eax
movl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x56b0
movb $0x0, -0x109(%rbp)
movl $0x0, -0x110(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5650
movl %eax, -0x110(%rbp)
cmpl $-0x1, -0x110(%rbp)
jne 0x13863
jmp 0x13a1d
movl -0x110(%rbp), %eax
movb %al, -0x109(%rbp)
movsbl -0x109(%rbp), %eax
cmpl $0x0, %eax
jne 0x13880
jmp 0x13a1d
movsbl -0x109(%rbp), %eax
cmpl $0xa, %eax
jne 0x1393f
movq -0x10(%rbp), %rax
movq %rax, -0x190(%rbp)
leaq -0x131(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x5780
movq -0x188(%rbp), %rdx
leaq 0x2c508(%rip), %rsi     # 0x3fdc4
leaq -0x130(%rbp), %rdi
callq 0x17fb0
jmp 0x138ca
movq -0x190(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x1aa20
jmp 0x138df
leaq -0x130(%rbp), %rdi
callq 0x5888
leaq -0x131(%rbp), %rdi
callq 0x53f0
jmp 0x13a16
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x1392e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x5888
leaq -0x131(%rbp), %rdi
callq 0x53f0
jmp 0x13a84
movq -0x10(%rbp), %rdi
callq 0x1aaa0
cmpq $0x0, %rax
jne 0x139fe
movq -0x10(%rbp), %rax
movq %rax, -0x1a0(%rbp)
leaq -0x169(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x5780
movq -0x198(%rbp), %rdx
leaq 0x2c446(%rip), %rsi     # 0x3fdc4
leaq -0x168(%rbp), %rdi
callq 0x17fb0
jmp 0x1398c
movq -0x1a0(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x1aa20
jmp 0x139a1
leaq -0x168(%rbp), %rdi
callq 0x5888
leaq -0x169(%rbp), %rdi
callq 0x53f0
jmp 0x139fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x139ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x5888
leaq -0x169(%rbp), %rdi
callq 0x53f0
jmp 0x13a84
movq -0x10(%rbp), %rdi
callq 0x1aac0
movq %rax, %rdi
movsbl -0x109(%rbp), %esi
callq 0x52d0
jmp 0x13a18
jmp 0x13835
movq -0x10(%rbp), %rdi
callq 0x1aac0
movq %rax, %rdi
callq 0x56d0
testb $0x1, %al
jne 0x13a34
jmp 0x13a3d
movq -0x10(%rbp), %rdi
callq 0x2f760
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x56b0
movq -0x8(%rbp), %rdi
callq 0x57f0
cmpl $0x0, %eax
jne 0x13a5c
jmp 0x13a7b
leaq 0x2db96(%rip), %rdi     # 0x415f9
leaq 0x2b653(%rip), %rsi     # 0x3f0bd
movl $0xdcc, %edx            # imm = 0xDCC
leaq 0x2db50(%rip), %rcx     # 0x415c6
callq 0x51e0
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
movq -0x140(%rbp), %rdi
callq 0x5760