// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_tview_curses.c
// Function: curses_tv_init
tview_t* curses_tv_init(const char *fn, const char *fn_fa, const char *samples)
	{
	curses_tview_t *tv = (curses_tview_t*)calloc(1, sizeof(curses_tview_t));
	tview_t* base=(tview_t*)tv;
	if(tv==0)
		{
		fprintf(stderr,"Calloc failed\n");
		return 0;
		}
	
	base_tv_init(base,fn,fn_fa,samples);
	/* initialize callbacks */
#define SET_CALLBACK(fun) base->my_##fun=curses_##fun;
	SET_CALLBACK(destroy);
	SET_CALLBACK(mvprintw);
	SET_CALLBACK(mvaddch);
	SET_CALLBACK(attron);
	SET_CALLBACK(attroff);
	SET_CALLBACK(clear);
	SET_CALLBACK(colorpair);
	SET_CALLBACK(drawaln);
	SET_CALLBACK(loop);
	SET_CALLBACK(underline);
#undef SET_CALLBACK

	initscr();
	keypad(stdscr, TRUE);
	clear();
	noecho();
	cbreak();
	
	getmaxyx(stdscr, base->mrow, base->mcol);
	tv->wgoto = newwin(3, TV_MAX_GOTO + 10, 10, 5);
	tv->whelp = newwin(29, 40, 5, 5);
	
	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 base;
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl $0x1, %edi
movl $0xd8, %esi
callq 0x3610
movq %rax, %rbx
testq %rax, %rax
je 0x1f083
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x5e4c
leaq 0x1ca(%rip), %rax       # 0x1f08a
movq %rax, 0x78(%rbx)
leaq 0x1f1(%rip), %rax       # 0x1f0bc
movq %rax, 0x80(%rbx)
leaq 0x2b9(%rip), %rax       # 0x1f192
movq %rax, 0x88(%rbx)
leaq 0x2de(%rip), %rax       # 0x1f1c5
movq %rax, 0x90(%rbx)
leaq 0x2e1(%rip), %rax       # 0x1f1d6
movq %rax, 0x98(%rbx)
leaq 0x2e4(%rip), %rax       # 0x1f1e7
movq %rax, 0xa0(%rbx)
leaq 0x2e5(%rip), %rax       # 0x1f1f6
movq %rax, 0xa8(%rbx)
leaq 0x2de(%rip), %rax       # 0x1f1fd
movq %rax, 0xb0(%rbx)
leaq 0x2d5(%rip), %rax       # 0x1f202
movq %rax, 0xb8(%rbx)
leaq 0xa1f(%rip), %rax       # 0x1f95a
movq %rax, 0xc0(%rbx)
callq 0x36a0
movq 0x3108a(%rip), %r14     # 0x4ffd8
movq (%r14), %rdi
movl $0x1, %esi
callq 0x3200
movq (%r14), %rdi
callq 0x3090
callq 0x30a0
callq 0x3660
movq (%r14), %rax
testq %rax, %rax
je 0x1ef8e
movd 0x4(%rax), %xmm0
pshuflw $0x60, %xmm0, %xmm0     # xmm0 = xmm0[0,0,2,1,4,5,6,7]
psrad $0x10, %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
jmp 0x1ef92
pcmpeqd %xmm0, %xmm0
movq %xmm0, (%rbx)
movl $0x3, %edi
movl $0x32, %esi
movl $0xa, %edx
movl $0x5, %ecx
callq 0x3580
movq %rax, 0xc8(%rbx)
movl $0x1d, %edi
movl $0x28, %esi
movl $0x5, %edx
movl $0x5, %ecx
callq 0x3580
movq %rax, 0xd0(%rbx)
callq 0x36b0
movl $0x1, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x32a0
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x32a0
movl $0x3, %edi
movl $0x3, %esi
xorl %edx, %edx
callq 0x32a0
movl $0x4, %edi
movl $0x7, %esi
xorl %edx, %edx
callq 0x32a0
movl $0x5, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x32a0
movl $0x6, %edi
movl $0x6, %esi
xorl %edx, %edx
callq 0x32a0
movl $0x7, %edi
movl $0x3, %esi
xorl %edx, %edx
callq 0x32a0
movl $0x8, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x32a0
movl $0x9, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x32a0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x4790
jmp 0x1f074