// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_tview_curses.c
// Function: curses_loop
static int curses_loop(tview_t* tv)
	{
	int tid, pos;
	curses_tview_t *CTV=(curses_tview_t *)tv;
	tid = tv->curr_tid; pos = tv->left_pos;
	while (1) {
		int c = getch();
		switch (c) {
			case '?': tv_win_help(CTV); break;
			case '\033':
			case 'q': goto end_loop;
			case '/': 
			case 'g': tv_win_goto(CTV, &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->my_drawaln(tv, tid, pos);
	}
end_loop:
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdi, %rbx
movl 0x28(%rdi), %eax
movl %eax, 0x8(%rsp)
movl 0x2c(%rdi), %r12d
movq 0x30db0(%rip), %r13     # 0x4ffd8
xorl %ebp, %ebp
leaq 0x20(%rsp), %r15
leaq 0x23e36(%rip), %r14     # 0x4306c
movq (%r13), %rdi
callq 0x37b0
cmpl $0x61, %eax
jle 0x1f268
cmpl $0x101, %eax            # imm = 0x101
jg 0x1f299
addl $-0x62, %eax
cmpl $0x1d, %eax
ja 0x1f236
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
movl $0x1, 0x50(%rbx)
jmp 0x1f91c
cmpl $0x2e, %eax
jle 0x1f2c8
cmpl $0x47, %eax
jg 0x1f2fd
cmpl $0x2f, %eax
je 0x1f3b2
cmpl $0x3f, %eax
je 0x1f600
cmpl $0x43, %eax
jne 0x1f236
movl $0x1, 0x4c(%rbx)
jmp 0x1f91c
cmpl $0x188, %eax            # imm = 0x188
jg 0x1f324
addl $0xfffffefe, %eax       # imm = 0xFFFFFEFE
cmpl $0x5, %eax
ja 0x1f236
leaq 0x23e2f(%rip), %rcx     # 0x430e4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x48(%rbx), %eax
incl %eax
jmp 0x1f3aa
cmpl $0x1a, %eax
jle 0x1f36e
cmpl $0x1b, %eax
je 0x1f946
cmpl $0x20, %eax
je 0x1f5f7
cmpl $0x2e, %eax
jne 0x1f236
xorl %eax, %eax
cmpl $0x0, 0x54(%rbx)
sete %al
movl %eax, 0x54(%rbx)
jmp 0x1f91c
cmpl $0x48, %eax
je 0x1f576
cmpl $0x4c, %eax
je 0x1f57f
cmpl $0x4e, %eax
jne 0x1f236
movl $0x0, 0x4c(%rbx)
jmp 0x1f91c
cmpl $0x189, %eax            # imm = 0x189
je 0x1f576
cmpl $0x192, %eax            # imm = 0x192
je 0x1f57f
cmpl $0x19a, %eax            # imm = 0x19A
jne 0x1f236
movq (%r13), %rax
testq %rax, %rax
je 0x1f914
movd 0x4(%rax), %xmm0
pshuflw $0x60, %xmm0, %xmm0     # xmm0 = xmm0[0,0,2,1,4,5,6,7]
psrad $0x10, %xmm0
psubd 0x1fcd7(%rip), %xmm0    # 0x3f040
jmp 0x1f918
cmpl $0x8, %eax
je 0x1f5eb
cmpl $0xc, %eax
jne 0x1f236
addl $0x3e8, %r12d           # imm = 0x3E8
jmp 0x1f91c
subl 0x4(%rbx), %r12d
jmp 0x1f91c
decl %r12d
jmp 0x1f91c
incl %r12d
jmp 0x1f91c
movl 0x48(%rbx), %eax
decl %eax
movl %eax, 0x48(%rbx)
jmp 0x1f91f
movq 0xc8(%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 0x3470
addq $0x20, %rsp
movq 0xc8(%rbx), %rdi
xorl %r13d, %r13d
movl $0x1, %esi
movl $0x2, %edx
leaq 0x23ff8(%rip), %rcx     # 0x433fc
xorl %eax, %eax
callq 0x3190
movq 0xc8(%rbx), %rdi
callq 0x37b0
movl %eax, %r14d
movq 0xc8(%rbx), %rdi
callq 0x33f0
cmpl $0x7e, %r14d
jg 0x1f443
cmpl $0x8, %r14d
je 0x1f45f
cmpl $0xa, %r14d
je 0x1f46c
cmpl $0xd, %r14d
je 0x1f46c
jmp 0x1f52f
cmpl $0x7f, %r14d
je 0x1f45f
cmpl $0x157, %r14d           # imm = 0x157
je 0x1f46c
cmpl $0x107, %r14d           # imm = 0x107
jne 0x1f52f
xorl %eax, %eax
testl %r13d, %r13d
setg %al
subl %eax, %r13d
jmp 0x1f4c1
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
cmpb $0x3d, 0x20(%rsp)
jne 0x1f49a
leaq 0x21(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movl $0xa, %edx
callq 0x34b0
decl %eax
testl %eax, %eax
jle 0x1f4c1
jmp 0x1f8ff
movq 0x18(%rbx), %rdi
movq %r15, %rsi
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x14(%rsp), %r8
callq 0x22e08
movl 0xc(%rsp), %ecx
testl %ecx, %ecx
jns 0x1f8f7
movl %r13d, %ebp
movslq %ebp, %rax
movb $0x0, 0x20(%rsp,%rax)
movl $0x8, %r14d
movq 0xc8(%rbx), %rdi
movl $0x1, %esi
movl %r14d, %edx
callq 0x3550
cmpl $-0x1, %eax
je 0x1f4fc
movq 0xc8(%rbx), %rdi
movl $0x20, %esi
callq 0x33b0
incl %r14d
cmpl $0x30, %r14d
jne 0x1f4d2
movq 0xc8(%rbx), %rdi
movl $0x1, %esi
movl $0x8, %edx
leaq 0x262f0(%rip), %rcx     # 0x4580d
movq %r15, %r8
xorl %eax, %eax
callq 0x3190
movl %ebp, %r13d
jmp 0x1f40b
callq 0x33c0
movq (%rax), %rax
movslq %r14d, %rcx
cmpw $0x0, (%rax,%rcx,2)
js 0x1f55c
xorl %ebp, %ebp
cmpl $0x17, %r14d
je 0x1f4c4
cmpl $0x1b, %r14d
jne 0x1f4c1
jmp 0x1f902
cmpl $0x27, %r13d
jg 0x1f4c1
movslq %r13d, %rax
incl %r13d
movb %r14b, 0x20(%rsp,%rax)
jmp 0x1f4c1
addl $-0x14, %r12d
jmp 0x1f91c
addl $0x14, %r12d
jmp 0x1f91c
xorl %eax, %eax
cmpl $0x0, 0x64(%rbx)
sete %al
movl %eax, 0x64(%rbx)
jmp 0x1f91c
xorl %eax, %eax
cmpl $0x0, 0x60(%rbx)
sete %al
movl %eax, 0x60(%rbx)
jmp 0x1f91c
movl $0x0, 0x50(%rbx)
jmp 0x1f91c
movl $0x3, 0x50(%rbx)
jmp 0x1f91c
xorl %eax, %eax
cmpl $0x0, 0x5c(%rbx)
sete %al
movl %eax, 0x5c(%rbx)
jmp 0x1f91c
movl $0x4, 0x50(%rbx)
jmp 0x1f91c
movl $0x2, 0x50(%rbx)
jmp 0x1f91c
addl $0xfffffc18, %r12d      # imm = 0xFFFFFC18
jmp 0x1f91c
addl 0x4(%rbx), %r12d
jmp 0x1f91c
movq %r14, %rbp
movq 0xd0(%rbx), %r14
subq $0x8, %rsp
movq %r14, %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 0x3470
addq $0x20, %rsp
movq %r14, %rdi
movl $0x1, %esi
movl $0x2, %edx
leaq 0x23aba(%rip), %rcx     # 0x4310b
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x3, %esi
movl $0x2, %edx
leaq 0x23abb(%rip), %rcx     # 0x43127
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x4, %esi
movl $0x2, %edx
leaq 0x23ab7(%rip), %rcx     # 0x4313e
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x5, %esi
movl $0x2, %edx
leaq 0x23abd(%rip), %rcx     # 0x4315f
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x6, %esi
movl $0x2, %edx
leaq 0x23ac3(%rip), %rcx     # 0x43180
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x7, %esi
movl $0x2, %edx
leaq 0x23ac9(%rip), %rcx     # 0x431a1
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x8, %esi
movl $0x2, %edx
leaq 0x23ac8(%rip), %rcx     # 0x431bb
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x9, %esi
movl $0x2, %edx
leaq 0x23ac8(%rip), %rcx     # 0x431d6
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0xa, %esi
movl $0x2, %edx
leaq 0x23aca(%rip), %rcx     # 0x431f3
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0xb, %esi
movl $0x2, %edx
leaq 0x23ad1(%rip), %rcx     # 0x43215
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0xc, %esi
movl $0x2, %edx
leaq 0x23ad9(%rip), %rcx     # 0x43238
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0xd, %esi
movl $0x2, %edx
leaq 0x23ae0(%rip), %rcx     # 0x4325a
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0xe, %esi
movl $0x2, %edx
leaq 0x23ae5(%rip), %rcx     # 0x4327a
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0xf, %esi
movl $0x2, %edx
leaq 0x23aec(%rip), %rcx     # 0x4329c
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x10, %esi
movl $0x2, %edx
leaq 0x23aef(%rip), %rcx     # 0x432ba
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x11, %esi
movl $0x2, %edx
leaq 0x23af1(%rip), %rcx     # 0x432d7
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x12, %esi
movl $0x2, %edx
leaq 0x23af8(%rip), %rcx     # 0x432f9
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x13, %esi
movl $0x2, %edx
leaq 0x23aff(%rip), %rcx     # 0x4331b
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x14, %esi
movl $0x2, %edx
leaq 0x23b05(%rip), %rcx     # 0x4333c
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x15, %esi
movl $0x2, %edx
leaq 0x23b05(%rip), %rcx     # 0x43357
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x16, %esi
movl $0x2, %edx
leaq 0x23b05(%rip), %rcx     # 0x43372
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x17, %esi
movl $0x2, %edx
leaq 0x23b07(%rip), %rcx     # 0x4338f
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x19, %esi
movl $0x2, %edx
leaq 0x23afc(%rip), %rcx     # 0x4339f
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x1a, %esi
movl $0x2, %edx
leaq 0x23b05(%rip), %rcx     # 0x433c3
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
movl $0x1b, %esi
movl $0x2, %edx
leaq 0x23b07(%rip), %rcx     # 0x433e0
xorl %eax, %eax
callq 0x3190
movq %r14, %rdi
callq 0x33f0
movq %r14, %rdi
movq %rbp, %r14
xorl %ebp, %ebp
callq 0x37b0
jmp 0x1f91c
movl 0x10(%rsp), %eax
movl %ecx, 0x8(%rsp)
movl %eax, %r12d
movq 0x306cf(%rip), %r13     # 0x4ffd8
xorl %ebp, %ebp
leaq 0x2375a(%rip), %r14     # 0x4306c
jmp 0x1f91c
pcmpeqd %xmm0, %xmm0
movq %xmm0, (%rbx)
movl 0x48(%rbx), %eax
testl %r12d, %r12d
cmovlel %ebp, %r12d
testl %eax, %eax
jns 0x1f931
movl $0x0, 0x48(%rbx)
movq %rbx, %rdi
movl 0x8(%rsp), %esi
movl %r12d, %edx
callq *0xb0(%rbx)
jmp 0x1f236
xorl %eax, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq