// File: /workspace/github_cpp_makefile_star2_O1/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), %r14d
movl 0x3c(%rdi), %ebp
movq 0x293b0(%rip), %r13     # 0x2efd8
xorl %r12d, %r12d
leaq 0x10(%rsp), %r15
movq (%r13), %rdi
callq 0x3670
cmpl $0x61, %eax
jle 0x5c6d
cmpl $0x101, %eax            # imm = 0x101
jg 0x5ca7
addl $-0x62, %eax
cmpl $0x1d, %eax
ja 0x62a0
leaq 0x1e3c0(%rip), %rcx     # 0x24018
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, 0x60(%rbx)
jmp 0x62b5
cmpl $0x3e, %eax
jg 0x5cd4
cmpl $0x1a, %eax
jle 0x5d45
cmpl $0x1b, %eax
je 0x5d9e
cmpl $0x20, %eax
je 0x5f9e
cmpl $0x2e, %eax
jne 0x62a0
xorl %eax, %eax
cmpl $0x0, 0x64(%rbx)
sete %al
movl %eax, 0x64(%rbx)
jmp 0x62b5
cmpl $0x188, %eax            # imm = 0x188
jg 0x5d04
addl $0xfffffefe, %eax       # imm = 0xFFFFFEFE
cmpl $0x5, %eax
ja 0x62a0
leaq 0x1e3cd(%rip), %rcx     # 0x24090
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
incl 0x58(%rbx)
jmp 0x62b5
cmpl $0x47, %eax
jle 0x5d62
cmpl $0x48, %eax
je 0x5db0
cmpl $0x4c, %eax
je 0x5da8
cmpl $0x4e, %eax
jne 0x62a0
movl $0x0, 0x5c(%rbx)
jmp 0x62b5
cmpl $0x189, %eax            # imm = 0x189
je 0x5db0
cmpl $0x192, %eax            # imm = 0x192
je 0x5da8
cmpl $0x19a, %eax            # imm = 0x19A
jne 0x62a0
movq (%r13), %rax
testq %rax, %rax
je 0x62a7
movswl 0x4(%rax), %ecx
incl %ecx
movl %ecx, (%rbx)
movswl 0x6(%rax), %eax
incl %eax
jmp 0x62b2
cmpl $0x8, %eax
je 0x5fa6
cmpl $0xc, %eax
jne 0x62a0
addl $0x3e8, %ebp            # imm = 0x3E8
jmp 0x62b5
cmpl $0x3f, %eax
je 0x5fb1
cmpl $0x43, %eax
jne 0x62a0
movl $0x1, 0x5c(%rbx)
jmp 0x62b5
decl %ebp
jmp 0x62b5
subl 0x4(%rbx), %ebp
jmp 0x62b5
decl 0x58(%rbx)
jmp 0x62b5
incl %ebp
jmp 0x62b5
movl $0x5, %eax
jmp 0x62d7
addl $0x14, %ebp
jmp 0x62b5
addl $-0x14, %ebp
jmp 0x62b5
xorl %eax, %eax
cmpl $0x0, 0x6c(%rbx)
sete %al
movl %eax, 0x6c(%rbx)
jmp 0x62b5
xorl %eax, %eax
cmpl $0x0, 0x74(%rbx)
sete %al
movl %eax, 0x74(%rbx)
jmp 0x62b5
movl $0x4, 0x60(%rbx)
jmp 0x62b5
movl $0x3, 0x60(%rbx)
jmp 0x62b5
xorl %eax, %eax
cmpl $0x0, 0x70(%rbx)
sete %al
movl %eax, 0x70(%rbx)
jmp 0x62b5
movq 0x8(%rbx), %rdi
subq $0x8, %rsp
movl $0x7c, %esi
movl $0x7c, %edx
movl $0x2d, %ecx
movl $0x2d, %r8d
movl $0x2b, %r9d
movl $0x2b, %eax
pushq %rax
pushq %rax
pushq %rax
callq 0x33d0
addq $0x20, %rsp
movq 0x8(%rbx), %rdi
xorl %r13d, %r13d
movl $0x1, %esi
movl $0x2, %edx
leaq 0x1e5d2(%rip), %rcx     # 0x24421
xorl %eax, %eax
callq 0x3120
movq 0x8(%rbx), %rdi
callq 0x3670
movl %eax, %r12d
movq 0x8(%rbx), %rdi
callq 0x3340
cmpl $0x7e, %r12d
jg 0x5e85
cmpl $0x8, %r12d
je 0x5e9d
cmpl $0xa, %r12d
je 0x5ea2
cmpl $0xd, %r12d
je 0x5ea2
jmp 0x5edb
cmpl $0x7f, %r12d
je 0x5e9d
cmpl $0x157, %r12d           # imm = 0x157
je 0x5ea2
cmpl $0x107, %r12d           # imm = 0x107
jne 0x5edb
decl %r13d
jmp 0x5f13
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 0x11668
movl 0x4(%rsp), %ecx
testl %ecx, %ecx
js 0x5f13
movl 0x8(%rsp), %ebp
xorl %eax, %eax
movl %ecx, %r14d
jmp 0x5f6f
callq 0x3310
movq (%rax), %rax
movslq %r12d, %rcx
cmpw $0x0, (%rax,%rcx,2)
js 0x5efd
xorl %eax, %eax
cmpl $0x17, %r12d
je 0x5f10
cmpl $0x1b, %r12d
je 0x5f6f
jmp 0x5f13
cmpl $0x27, %r13d
jg 0x5f13
movslq %r13d, %rax
incl %r13d
movb %r12b, 0x10(%rsp,%rax)
jmp 0x5f13
xorl %r13d, %r13d
movslq %r13d, %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 0x5f45
movq 0x8(%rbx), %rdi
movl $0x20, %esi
callq 0x3300
incl %r12d
cmpl $0x30, %r12d
jne 0x5f21
movq 0x8(%rbx), %rdi
movl $0x1, %esi
movl $0x8, %edx
leaq 0x1e4c5(%rip), %rcx     # 0x24428
movq %r15, %r8
xorl %eax, %eax
callq 0x3120
movb $0x1, %al
testb %al, %al
jne 0x5e56
movq 0x2905a(%rip), %r13     # 0x2efd8
xorl %r12d, %r12d
jmp 0x62b5
movl $0x2, 0x60(%rbx)
jmp 0x62b5
movl $0x0, 0x60(%rbx)
jmp 0x62b5
addl 0x4(%rbx), %ebp
jmp 0x62b5
addl $0xfffffc18, %ebp       # imm = 0xFFFFFC18
jmp 0x62b5
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
movl $0x2b, %eax
pushq %rax
pushq %rax
pushq %rax
callq 0x33d0
addq $0x20, %rsp
movq %r12, %rdi
movl $0x1, %esi
movl $0x2, %edx
leaq 0x1e134(%rip), %rcx     # 0x24130
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x3, %esi
movl $0x2, %edx
leaq 0x1e135(%rip), %rcx     # 0x2414c
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x4, %esi
movl $0x2, %edx
leaq 0x1e131(%rip), %rcx     # 0x24163
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x5, %esi
movl $0x2, %edx
leaq 0x1e137(%rip), %rcx     # 0x24184
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x6, %esi
movl $0x2, %edx
leaq 0x1e13d(%rip), %rcx     # 0x241a5
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x7, %esi
movl $0x2, %edx
leaq 0x1e143(%rip), %rcx     # 0x241c6
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x8, %esi
movl $0x2, %edx
leaq 0x1e142(%rip), %rcx     # 0x241e0
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x9, %esi
movl $0x2, %edx
leaq 0x1e142(%rip), %rcx     # 0x241fb
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0xa, %esi
movl $0x2, %edx
leaq 0x1e144(%rip), %rcx     # 0x24218
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0xb, %esi
movl $0x2, %edx
leaq 0x1e14b(%rip), %rcx     # 0x2423a
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0xc, %esi
movl $0x2, %edx
leaq 0x1e153(%rip), %rcx     # 0x2425d
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0xd, %esi
movl $0x2, %edx
leaq 0x1e15a(%rip), %rcx     # 0x2427f
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0xe, %esi
movl $0x2, %edx
leaq 0x1e15f(%rip), %rcx     # 0x2429f
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0xf, %esi
movl $0x2, %edx
leaq 0x1e166(%rip), %rcx     # 0x242c1
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x10, %esi
movl $0x2, %edx
leaq 0x1e169(%rip), %rcx     # 0x242df
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x11, %esi
movl $0x2, %edx
leaq 0x1e16b(%rip), %rcx     # 0x242fc
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x12, %esi
movl $0x2, %edx
leaq 0x1e172(%rip), %rcx     # 0x2431e
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x13, %esi
movl $0x2, %edx
leaq 0x1e179(%rip), %rcx     # 0x24340
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x14, %esi
movl $0x2, %edx
leaq 0x1e17f(%rip), %rcx     # 0x24361
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x15, %esi
movl $0x2, %edx
leaq 0x1e17f(%rip), %rcx     # 0x2437c
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x16, %esi
movl $0x2, %edx
leaq 0x1e17f(%rip), %rcx     # 0x24397
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x17, %esi
movl $0x2, %edx
leaq 0x1e181(%rip), %rcx     # 0x243b4
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x19, %esi
movl $0x2, %edx
leaq 0x1e176(%rip), %rcx     # 0x243c4
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x1a, %esi
movl $0x2, %edx
leaq 0x1e17f(%rip), %rcx     # 0x243e8
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
movl $0x1b, %esi
movl $0x2, %edx
leaq 0x1e181(%rip), %rcx     # 0x24405
xorl %eax, %eax
callq 0x3120
movq %r12, %rdi
callq 0x3340
movq %r12, %rdi
xorl %r12d, %r12d
callq 0x3670
jmp 0x62b5
movl $0x2, %eax
jmp 0x62d7
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0x4(%rbx)
testl %ebp, %ebp
cmovlel %r12d, %ebp
cmpl $0x0, 0x58(%rbx)
jns 0x62c8
movl $0x0, 0x58(%rbx)
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x5a71
xorl %eax, %eax
testb $0x5, %al
je 0x5c30
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq