// File: BenLangmead[P]bowtie/ebwt_search_util.cpp
// Function: printHit(EList<SString<char>, 128> const&, Hit const&, SDnaStringExpandable<25, 2> const&, unsigned long, unsigned int, unsigned int, unsigned int, unsigned int, bool)
void printHit(const EList<BTRefString >& os,
              const Hit& h,
              const BTDnaString& qry,
              size_t qlen,
              uint32_t unrevOff,
              uint32_t oneRevOff,
              uint32_t twoRevOff,
              uint32_t threeRevOff,
              bool ebwtFw)
{
	// Print pattern sequence
	cout << "  Pat:  " << qry << endl;
	// Print text sequence
	cout << "  Tseg: ";
	if(ebwtFw) {
		for(size_t i = 0; i < qlen; i++) {
			cout << os[h.h.first][h.h.second + i];
		}
	} else {
		for(int i = (int)qlen-1; i >= 0; i--) {
			cout << os[h.h.first][h.h.second + i];
		}
	}
	cout << endl;
	cout << "  Bt:   ";
	for(int i = (int)qlen-1; i >= 0; i--) {
		if     (i < (int)unrevOff)    cout << "0";
		else if(i < (int)oneRevOff)   cout << "1";
		else if(i < (int)twoRevOff)   cout << "2";
		else if(i < (int)threeRevOff) cout << "3";
		else cout << "X";
	}
	cout << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb 0x20(%rbp), %al
movl 0x18(%rbp), %r10d
movl 0x10(%rbp), %r10d
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
andb $0x1, %al
movb %al, -0x29(%rbp)
movq 0x23eb1(%rip), %rdi     # 0xa7fb8
leaq 0x8d61(%rip), %rsi      # 0x8ce6f
callq 0xa5d0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x2c0d0
movq %rax, %rdi
movq 0x23e3f(%rip), %rsi     # 0xa7f68
callq 0xa640
movq 0x23e83(%rip), %rdi     # 0xa7fb8
leaq 0x8d3c(%rip), %rsi      # 0x8ce78
callq 0xa5d0
testb $0x1, -0x29(%rbp)
je 0x8419e
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x8419c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x25100
movq %rax, %rdi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, %esi
addq -0x38(%rbp), %rsi
callq 0x25150
movq 0x23e32(%rip), %rdi     # 0xa7fb8
movsbl (%rax), %esi
callq 0xa720
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x8414f
jmp 0x841f1
movq -0x20(%rbp), %rax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jl 0x841ef
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x25100
movq %rax, %rdi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
addl -0x3c(%rbp), %eax
movl %eax, %eax
movl %eax, %esi
callq 0x25150
movq 0x23ddc(%rip), %rdi     # 0xa7fb8
movsbl (%rax), %esi
callq 0xa720
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x841a8
jmp 0x841f1
movq 0x23dc0(%rip), %rdi     # 0xa7fb8
movq 0x23d69(%rip), %rsi     # 0xa7f68
callq 0xa640
movq 0x23dad(%rip), %rdi     # 0xa7fb8
leaq 0xa604(%rip), %rsi      # 0x8e816
callq 0xa5d0
movq -0x20(%rbp), %rax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
jl 0x842c8
movl -0x40(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x84248
movq 0x23d7e(%rip), %rdi     # 0xa7fb8
leaq 0xa641(%rip), %rsi      # 0x8e882
callq 0xa5d0
jmp 0x842b8
movl -0x40(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x84265
movq 0x23d61(%rip), %rdi     # 0xa7fb8
leaq 0x6917(%rip), %rsi      # 0x8ab75
callq 0xa5d0
jmp 0x842b6
movl -0x40(%rbp), %eax
cmpl 0x10(%rbp), %eax
jge 0x84282
movq 0x23d44(%rip), %rdi     # 0xa7fb8
leaq 0x8dd9(%rip), %rsi      # 0x8d054
callq 0xa5d0
jmp 0x842b4
movl -0x40(%rbp), %eax
cmpl 0x18(%rbp), %eax
jge 0x8429f
movq 0x23d27(%rip), %rdi     # 0xa7fb8
leaq 0x65cc(%rip), %rsi      # 0x8a864
callq 0xa5d0
jmp 0x842b2
movq 0x23d12(%rip), %rdi     # 0xa7fb8
leaq 0xa572(%rip), %rsi      # 0x8e81f
callq 0xa5d0
jmp 0x842b4
jmp 0x842b6
jmp 0x842b8
jmp 0x842ba
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x84221
movq 0x23ce9(%rip), %rdi     # 0xa7fb8
movq 0x23c92(%rip), %rsi     # 0xa7f68
callq 0xa640
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
nopw %cs:(%rax,%rax)
nop