// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_tview.c
// Function: tv_loop
void tv_loop(tview_t *tv)
{
	int tid, pos;
	tid = tv->curr_tid; pos = tv->left_pos;
	while (1) {
		int c = getch();
		switch (c) {
			case '?': tv_win_help(tv); break;
			case '\033':
			case 'q': goto end_loop;
			case 'g': tv_win_goto(tv, &tid, &pos); break;
			case 'm': tv->color_for = TV_COLOR_MAPQ; break;
			case 'b': tv->color_for = TV_COLOR_BASEQ; break;
			case 'n': tv->color_for = TV_COLOR_NUCL; break;
			case 'c': tv->color_for = TV_COLOR_COL; break;
			case 'z': tv->color_for = TV_COLOR_COLQ; break;
			case 's': tv->no_skip = !tv->no_skip; break;
			case 'r': tv->show_name = !tv->show_name; break;
			case KEY_LEFT:
			case 'h': --pos; break;
			case KEY_RIGHT:
			case 'l': ++pos; break;
			case KEY_SLEFT:
			case 'H': pos -= 20; break;
			case KEY_SRIGHT:
			case 'L': pos += 20; break;
			case '.': tv->is_dot = !tv->is_dot; break;
			case 'N': tv->base_for = TV_BASE_NUCL; break;
			case 'C': tv->base_for = TV_BASE_COLOR_SPACE; break;
			case 'i': tv->ins = !tv->ins; break;
			case '\010': pos -= 1000; break;
			case '\014': pos += 1000; break;
			case ' ': pos += tv->mcol; break;
			case KEY_UP:
			case 'j': --tv->row_shift; break;
			case KEY_DOWN:
			case 'k': ++tv->row_shift; break;
			case KEY_BACKSPACE:
			case '\177': pos -= tv->mcol; break;
			case KEY_RESIZE: getmaxyx(stdscr, tv->mrow, tv->mcol); break;
			default: continue;
		}
		if (pos < 0) pos = 0;
		if (tv->row_shift < 0) tv->row_shift = 0;
		tv_draw_aln(tv, tid, pos);
	}
end_loop:
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %rbx
movl 0x38(%rdi), %r12d
movl 0x3c(%rdi), %ebp
movq 0x2810e(%rip), %r14     # 0x2dfd8
movl $0x2b, %r13d
leaq 0x10(%rsp), %r15
movq (%r14), %rdi
callq 0x3670
cmpl $0x61, %eax
jle 0x5f0d
cmpl $0x101, %eax            # imm = 0x101
jg 0x5f43
addl $-0x62, %eax
cmpl $0x1d, %eax
ja 0x5ed5
leaq 0x1d120(%rip), %rcx     # 0x23018
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, 0x60(%rbx)
jmp 0x6557
cmpl $0x3e, %eax
jg 0x5f6e
cmpl $0x1a, %eax
jle 0x5fe7
cmpl $0x1b, %eax
je 0x6594
cmpl $0x20, %eax
je 0x6537
cmpl $0x2e, %eax
jne 0x5ed5
xorl %eax, %eax
cmpl $0x0, 0x64(%rbx)
sete %al
movl %eax, 0x64(%rbx)
jmp 0x6557
cmpl $0x188, %eax            # imm = 0x188
jg 0x5f9e
addl $0xfffffefe, %eax       # imm = 0xFFFFFEFE
cmpl $0x5, %eax
ja 0x5ed5
leaq 0x1d135(%rip), %rcx     # 0x23090
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x58(%rbx), %eax
incl %eax
jmp 0x603d
cmpl $0x47, %eax
jle 0x6004
cmpl $0x48, %eax
je 0x604d
cmpl $0x4c, %eax
je 0x6045
cmpl $0x4e, %eax
jne 0x5ed5
movl $0x0, 0x5c(%rbx)
jmp 0x6557
cmpl $0x189, %eax            # imm = 0x189
je 0x604d
cmpl $0x192, %eax            # imm = 0x192
je 0x6045
cmpl $0x19a, %eax            # imm = 0x19A
jne 0x5ed5
movq (%r14), %rax
testq %rax, %rax
je 0x654f
movd 0x4(%rax), %xmm0
pshuflw $0x60, %xmm0, %xmm0     # xmm0 = xmm0[0,0,2,1,4,5,6,7]
psrad $0x10, %xmm0
psubd 0x1d0ce(%rip), %xmm0    # 0x230b0
jmp 0x6553
cmpl $0x8, %eax
je 0x623a
cmpl $0xc, %eax
jne 0x5ed5
addl $0x3e8, %ebp            # imm = 0x3E8
jmp 0x6557
cmpl $0x3f, %eax
je 0x6245
cmpl $0x43, %eax
jne 0x5ed5
movl $0x1, 0x5c(%rbx)
jmp 0x6557
subl 0x4(%rbx), %ebp
jmp 0x6557
decl %ebp
jmp 0x6557
incl %ebp
jmp 0x6557
movl 0x58(%rbx), %eax
decl %eax
movl %eax, 0x58(%rbx)
jmp 0x655a
addl $0x14, %ebp
jmp 0x6557
addl $-0x14, %ebp
jmp 0x6557
xorl %eax, %eax
cmpl $0x0, 0x74(%rbx)
sete %al
movl %eax, 0x74(%rbx)
jmp 0x6557
xorl %eax, %eax
cmpl $0x0, 0x70(%rbx)
sete %al
movl %eax, 0x70(%rbx)
jmp 0x6557
movl $0x0, 0x60(%rbx)
jmp 0x6557
movl $0x3, 0x60(%rbx)
jmp 0x6557
movl %r12d, (%rsp)
movq 0x8(%rbx), %rdi
subq $0x8, %rsp
movl $0x7c, %esi
movl $0x7c, %edx
movl $0x2d, %ecx
movl $0x2d, %r8d
movl $0x2b, %r9d
pushq %r13
pushq %r13
pushq %r13
callq 0x33d0
addq $0x20, %rsp
movq 0x8(%rbx), %rdi
xorl %r13d, %r13d
movl $0x1, %esi
movl $0x2, %edx
leaq 0x1d35c(%rip), %rcx     # 0x23439
xorl %eax, %eax
callq 0x3120
movq 0x8(%rbx), %rdi
callq 0x3670
movl %eax, %r12d
movq 0x8(%rbx), %rdi
callq 0x3340
cmpl $0x7e, %r12d
jg 0x6116
cmpl $0x8, %r12d
je 0x6132
cmpl $0xa, %r12d
je 0x6137
cmpl $0xd, %r12d
je 0x6137
jmp 0x61cd
cmpl $0x7f, %r12d
je 0x6132
cmpl $0x157, %r12d           # imm = 0x157
je 0x6137
cmpl $0x107, %r12d           # imm = 0x107
jne 0x61cd
decl %r13d
jmp 0x6168
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
movq 0x28(%rbx), %rdi
movq %r15, %rsi
leaq 0x4(%rsp), %rdx
leaq 0x8(%rsp), %rcx
leaq 0xc(%rsp), %r8
callq 0x11f47
movl 0x4(%rsp), %r12d
testl %r12d, %r12d
jns 0x653c
movl %r13d, %r14d
movslq %r14d, %rax
movb $0x0, 0x10(%rsp,%rax)
movl $0x8, %r12d
movq 0x8(%rbx), %rdi
movl $0x1, %esi
movl %r12d, %edx
callq 0x3490
cmpl $-0x1, %eax
je 0x619d
movq 0x8(%rbx), %rdi
movl $0x20, %esi
callq 0x3300
incl %r12d
cmpl $0x30, %r12d
jne 0x6179
movq 0x8(%rbx), %rdi
movl $0x1, %esi
movl $0x8, %edx
leaq 0x1d285(%rip), %rcx     # 0x23440
movq %r15, %r8
xorl %eax, %eax
callq 0x3120
movl %r14d, %r13d
jmp 0x60e4
callq 0x3310
movq (%rax), %rax
movslq %r12d, %rcx
cmpw $0x0, (%rax,%rcx,2)
js 0x61f7
xorl %r14d, %r14d
cmpl $0x17, %r12d
je 0x616b
cmpl $0x1b, %r12d
jne 0x6168
jmp 0x6581
cmpl $0x27, %r13d
jg 0x6168
movslq %r13d, %rax
incl %r13d
movb %r12b, 0x10(%rsp,%rax)
jmp 0x6168
xorl %eax, %eax
cmpl $0x0, 0x6c(%rbx)
sete %al
movl %eax, 0x6c(%rbx)
jmp 0x6557
movl $0x4, 0x60(%rbx)
jmp 0x6557
movl $0x2, 0x60(%rbx)
jmp 0x6557
addl $0xfffffc18, %ebp       # imm = 0xFFFFFC18
jmp 0x6557
movl %r12d, (%rsp)
movq 0x10(%rbx), %r12
subq $0x8, %rsp
movq %r12, %rdi
movl $0x7c, %esi
movl $0x7c, %edx
movl $0x2d, %ecx
movl $0x2d, %r8d
movl $0x2b, %r9d
pushq %r13
pushq %r13
pushq %r13
callq 0x33d0
addq $0x20, %rsp
movq %r12, %rdi
movl $0x1, %esi
movl $0x2, %edx
leaq 0x1ceb6(%rip), %rcx     # 0x23148
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x3, %esi
movl $0x2, %edx
leaq 0x1ceb7(%rip), %rcx     # 0x23164
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x4, %esi
movl $0x2, %edx
leaq 0x1ceb3(%rip), %rcx     # 0x2317b
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x5, %esi
movl $0x2, %edx
leaq 0x1ceb9(%rip), %rcx     # 0x2319c
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x6, %esi
movl $0x2, %edx
leaq 0x1cebf(%rip), %rcx     # 0x231bd
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x7, %esi
movl $0x2, %edx
leaq 0x1cec5(%rip), %rcx     # 0x231de
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x8, %esi
movl $0x2, %edx
leaq 0x1cec4(%rip), %rcx     # 0x231f8
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x9, %esi
movl $0x2, %edx
leaq 0x1cec4(%rip), %rcx     # 0x23213
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0xa, %esi
movl $0x2, %edx
leaq 0x1cec6(%rip), %rcx     # 0x23230
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0xb, %esi
movl $0x2, %edx
leaq 0x1cecd(%rip), %rcx     # 0x23252
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0xc, %esi
movl $0x2, %edx
leaq 0x1ced5(%rip), %rcx     # 0x23275
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0xd, %esi
movl $0x2, %edx
leaq 0x1cedc(%rip), %rcx     # 0x23297
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0xe, %esi
movl $0x2, %edx
leaq 0x1cee1(%rip), %rcx     # 0x232b7
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0xf, %esi
movl $0x2, %edx
leaq 0x1cee8(%rip), %rcx     # 0x232d9
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x10, %esi
movl $0x2, %edx
leaq 0x1ceeb(%rip), %rcx     # 0x232f7
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x11, %esi
movl $0x2, %edx
leaq 0x1ceed(%rip), %rcx     # 0x23314
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x12, %esi
movl $0x2, %edx
leaq 0x1cef4(%rip), %rcx     # 0x23336
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x13, %esi
movl $0x2, %edx
leaq 0x1cefb(%rip), %rcx     # 0x23358
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x14, %esi
movl $0x2, %edx
leaq 0x1cf01(%rip), %rcx     # 0x23379
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x15, %esi
movl $0x2, %edx
leaq 0x1cf01(%rip), %rcx     # 0x23394
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x16, %esi
movl $0x2, %edx
leaq 0x1cf01(%rip), %rcx     # 0x233af
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x17, %esi
movl $0x2, %edx
leaq 0x1cf03(%rip), %rcx     # 0x233cc
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x19, %esi
movl $0x2, %edx
leaq 0x1cef8(%rip), %rcx     # 0x233dc
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x1a, %esi
movl $0x2, %edx
leaq 0x1cf01(%rip), %rcx     # 0x23400
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x1b, %esi
movl $0x2, %edx
leaq 0x1cf03(%rip), %rcx     # 0x2341d
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
callq 0x3340
movq %r12, %rdi
movl (%rsp), %r12d
callq 0x3670
jmp 0x6557
addl 0x4(%rbx), %ebp
jmp 0x6557
movl 0x8(%rsp), %ebp
movq 0x27a91(%rip), %r14     # 0x2dfd8
movl $0x2b, %r13d
jmp 0x6557
pcmpeqd %xmm0, %xmm0
movq %xmm0, (%rbx)
movl 0x58(%rbx), %eax
testl %ebp, %ebp
movl $0x0, %ecx
cmovlel %ecx, %ebp
testl %eax, %eax
jns 0x656f
movl $0x0, 0x58(%rbx)
movq %rbx, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x5cff
jmp 0x5ed5
movq 0x27a50(%rip), %r14     # 0x2dfd8
movl $0x2b, %r13d
movl (%rsp), %r12d
jmp 0x6557
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq