// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_tview.c
// Function: tv_init
tview_t *tv_init(const char *fn, const char *fn_fa)
{
	tview_t *tv = (tview_t*)calloc(1, sizeof(tview_t));
	tv->is_dot = 1;
	tv->idx = bam_index_load(fn);
	if (tv->idx == 0) exit(1);
	tv->fp = bam_open(fn, "r");
	bgzf_set_cache_size(tv->fp, 8 * 1024 *1024);
	assert(tv->fp);
	tv->header = bam_header_read(tv->fp);
	tv->lplbuf = bam_lplbuf_init(tv_pl_func, tv);
	if (fn_fa) tv->fai = fai_load(fn_fa);
	tv->bmc = bam_maqcns_init();
	tv->ins = 1;
	bam_maqcns_prepare(tv->bmc);

	initscr();
	keypad(stdscr, TRUE);
	clear();
	noecho();
	cbreak();
	tv->mrow = 24; tv->mcol = 80;
	getmaxyx(stdscr, tv->mrow, tv->mcol);
	tv->wgoto = newwin(3, TV_MAX_GOTO + 10, 10, 5);
	tv->whelp = newwin(29, 40, 5, 5);
	tv->color_for = TV_COLOR_MAPQ;
	start_color();
	init_pair(1, COLOR_BLUE, COLOR_BLACK);
	init_pair(2, COLOR_GREEN, COLOR_BLACK);
	init_pair(3, COLOR_YELLOW, COLOR_BLACK);
	init_pair(4, COLOR_WHITE, COLOR_BLACK);
	init_pair(5, COLOR_GREEN, COLOR_BLACK);
	init_pair(6, COLOR_CYAN, COLOR_BLACK);
	init_pair(7, COLOR_YELLOW, COLOR_BLACK);
	init_pair(8, COLOR_RED, COLOR_BLACK);
	init_pair(9, COLOR_BLUE, COLOR_BLACK);
	return tv;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x80, %esi
callq 0x3530
movq %rax, %rbx
movl $0x1, 0x64(%rax)
movq %r15, %rdi
callq 0x163cd
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x5994
leaq 0x227e6(%rip), %rsi     # 0x27fc7
movq %r15, %rdi
callq 0xfa04
movq %rax, 0x30(%rbx)
movq %rax, %rdi
movl $0x800000, %esi         # imm = 0x800000
callq 0x10641
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x599e
callq 0x11d21
movq %rax, 0x28(%rbx)
leaq -0x86b(%rip), %rdi      # 0x4fac
movq %rbx, %rsi
callq 0x182cd
movq %rax, 0x20(%rbx)
testq %r14, %r14
je 0x5834
movq %r14, %rdi
callq 0x1af55
movq %rax, 0x40(%rbx)
xorl %eax, %eax
callq 0x6a04
movq %rax, 0x48(%rbx)
movl $0x1, 0x6c(%rbx)
movq %rax, %rdi
callq 0x6a51
callq 0x35a0
movq 0x2977e(%rip), %r14     # 0x2efd8
movq (%r14), %rdi
movl $0x1, %esi
callq 0x3190
movq (%r14), %rdi
callq 0x3070
callq 0x3080
callq 0x3570
movabsq $0x5000000018, %rax     # imm = 0x5000000018
movq %rax, (%rbx)
movq (%r14), %rax
testq %rax, %rax
je 0x589e
movswl 0x4(%rax), %ecx
incl %ecx
movl %ecx, (%rbx)
movswl 0x6(%rax), %eax
incl %eax
jmp 0x58a9
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0x4(%rbx)
movl $0x3, %edi
movl $0x32, %esi
movl $0xa, %edx
movl $0x5, %ecx
callq 0x34c0
movq %rax, 0x8(%rbx)
movl $0x1d, %edi
movl $0x28, %esi
movl $0x5, %edx
movl $0x5, %ecx
callq 0x34c0
movq %rax, 0x10(%rbx)
movl $0x0, 0x60(%rbx)
callq 0x35b0
movl $0x1, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x3220
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x3220
movl $0x3, %edi
movl $0x3, %esi
xorl %edx, %edx
callq 0x3220
movl $0x4, %edi
movl $0x7, %esi
xorl %edx, %edx
callq 0x3220
movl $0x5, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x3220
movl $0x6, %edi
movl $0x6, %esi
xorl %edx, %edx
callq 0x3220
movl $0x7, %edi
movl $0x3, %esi
xorl %edx, %edx
callq 0x3220
movl $0x8, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x3220
movl $0x9, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x3220
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
movl $0x1, %edi
callq 0x3130
leaq 0x1e718(%rip), %rdi     # 0x240bd
leaq 0x1e718(%rip), %rsi     # 0x240c4
leaq 0x1e71d(%rip), %rcx     # 0x240d0
movl $0xbe, %edx
callq 0x3140