// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bam_tview_html.c
// Function: html_drawaln
static int html_drawaln(struct AbstractTview* tv, int tid, int pos)
    {
    int y,x;
    html_tview_t* ptr=FROM_TV(tv);
    html_clear(tv);
    base_draw_aln(tv,  tid, pos);
    fputs("<html><head>",ptr->out);
    fprintf(ptr->out,"<title>%s:%d</title>",
    	tv->header->target_name[tid],
    	pos+1
    	);
    //style
   
    fputs("<style type='text/css'>\n",ptr->out);
    fputs(".tviewbody { margin:5px; background-color:white;text-align:center;}\n",ptr->out);
    fputs(".tviewtitle {text-align:center;}\n",ptr->out);
    fputs(".tviewpre { margin:5px; background-color:white;}\n",ptr->out);
    #define CSS(id,col) fprintf(ptr->out,".tviewc%d {color:%s;}\n.tviewcu%d {color:%s;text-decoration:underline;}\n",id,col,id,col);
        CSS(0, "black");
    	CSS(1, "blue");
	CSS(2, "green");
	CSS(3, "yellow");
	CSS(4, "black");
	CSS(5, "green");
	CSS(6, "cyan");
	CSS(7, "yellow");
	CSS(8, "red");
	CSS(9, "blue");
    #undef CSS
    fputs("</style>",ptr->out);
    
    fputs("</head><body>",ptr->out);
    
      fprintf(ptr->out,"<div class='tviewbody'><div class='tviewtitle'>%s:%d</div>",
    	tv->header->target_name[tid],
    	pos+1
    	);
    
    fputs("<pre class='tviewpre'>",ptr->out);
    for(y=0;y< ptr->row_count;++y)
    	{
    	
    	for(x=0;x< tv->mcol;++x)
	    	{
	    	
		
		if(x== 0 || ptr->screen[y][x].attributes != ptr->screen[y][x-1].attributes)
	    		{
	    		int css=0;
			fprintf(ptr->out,"<span");
	    		while(css<32)
	    			{
	    			//if(y>1) fprintf(stderr,"css=%d pow2=%d vs %d\n",css,(1 << (css)),ptr->screen[y][x].attributes);
	    			if(( (ptr->screen[y][x].attributes) & (1 << (css)))!=0)
	    				{
	    				
	    				fprintf(ptr->out," class='tviewc%s%d'",
	    					(( (ptr->screen[y][x].attributes) & (1 << (UNDERLINE_FLAG)) )!=0?"u":""),
	    					css);
	    				break;
	    				}
	    			++css;
	    			}


	    		fputs(">",ptr->out);
	    		}
		
		int ch=ptr->screen[y][x].ch;
		switch(ch)
			{
			case '<': fputs("&lt;",ptr->out);break;
			case '>': fputs("&gt;",ptr->out);break;
			case '&': fputs("&amp;",ptr->out);break;
			default: fputc(ch,ptr->out); break;
			}
	    	
	    	
	    	if(x+1 == tv->mcol  || ptr->screen[y][x].attributes!=ptr->screen[y][x+1].attributes)
	    		{
	    		fputs("</span>",ptr->out);
	    		}
	    	}
    	if(y+1 < ptr->row_count) fputs("<br/>",ptr->out);
    	}
    fputs("</pre></div></body></html>",ptr->out);
    return 0;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
callq 0x1f769
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x6c83
movq 0xd8(%rbx), %rsi
leaq 0x22bac(%rip), %rdi     # 0x423bb
callq 0x34a0
movq 0x18(%rbx), %rax
movq 0xd8(%rbx), %rdi
movq 0x8(%rax), %rax
movslq %r14d, %rcx
movq %rcx, (%rsp)
movq (%rax,%rcx,8), %rdx
incl %ebp
leaq 0x22b91(%rip), %rsi     # 0x423c8
movl %ebp, %ecx
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rsi
leaq 0x22b8f(%rip), %rdi     # 0x423dd
callq 0x34a0
movq 0xd8(%rbx), %rsi
leaq 0x22b95(%rip), %rdi     # 0x423f6
callq 0x34a0
movq 0xd8(%rbx), %rsi
leaq 0x22bc7(%rip), %rdi     # 0x4243b
callq 0x34a0
movq 0xd8(%rbx), %rsi
leaq 0x22bd6(%rip), %rdi     # 0x4245d
callq 0x34a0
movq 0xd8(%rbx), %rdi
leaq 0x22bf5(%rip), %r14     # 0x4248f
leaq 0x22c36(%rip), %r12     # 0x424d7
movq %r14, %rsi
xorl %edx, %edx
movq %r12, %rcx
xorl %r8d, %r8d
movq %r12, %r9
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rdi
leaq 0x22c19(%rip), %rcx     # 0x424dd
movq %r14, %rsi
movl $0x1, %edx
movl $0x1, %r8d
movq %rcx, %r9
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rdi
leaq 0x22bf8(%rip), %r15     # 0x424e2
movq %r14, %rsi
movl $0x2, %edx
movq %r15, %rcx
movl $0x2, %r8d
movq %r15, %r9
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rdi
leaq 0x22bd5(%rip), %r13     # 0x424e8
movq %r14, %rsi
movl $0x3, %edx
movq %r13, %rcx
movl $0x3, %r8d
movq %r13, %r9
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rdi
movq %r14, %rsi
movl $0x4, %edx
movq %r12, %rcx
movl $0x4, %r8d
movq %r12, %r9
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rdi
movq %r14, %rsi
movl $0x5, %edx
movq %r15, %rcx
movl $0x5, %r8d
movq %r15, %r9
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rdi
leaq 0x22b6f(%rip), %rcx     # 0x424ef
movq %r14, %rsi
movl $0x6, %edx
movl $0x6, %r8d
movq %rcx, %r9
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rdi
movq %r14, %rsi
movl $0x7, %edx
movq %r13, %rcx
movl $0x7, %r8d
movq %r13, %r9
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rdi
leaq 0x217ff(%rip), %rcx     # 0x411c7
movq %r14, %rsi
movl $0x8, %edx
movl $0x8, %r8d
movq %rcx, %r9
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rdi
movq %r14, %rsi
movl $0x9, %edx
leaq 0x22ae7(%rip), %rcx     # 0x424dd
movl $0x9, %r8d
movq %rcx, %r9
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rsi
leaq 0x22ae0(%rip), %rdi     # 0x424f4
callq 0x34a0
movq 0xd8(%rbx), %rsi
leaq 0x22ad6(%rip), %rdi     # 0x424fd
callq 0x34a0
movq 0x18(%rbx), %rax
movq 0xd8(%rbx), %rdi
movq 0x8(%rax), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x22ac1(%rip), %rsi     # 0x4250b
movl %ebp, %ecx
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rsi
leaq 0x22ae5(%rip), %rdi     # 0x42546
callq 0x34a0
cmpl $0x0, 0xc8(%rbx)
jle 0x1fbe2
leaq 0x22ae1(%rip), %r15     # 0x4255b
leaq 0x22b06(%rip), %rbp     # 0x42587
xorl %r13d, %r13d
cmpl $0x0, 0x4(%rbx)
jle 0x1fbb0
xorl %r14d, %r14d
testq %r14, %r14
je 0x1faad
movq 0xd0(%rbx), %rax
movq (%rax,%r13,8), %rax
movl 0x4(%rax,%r14,8), %ecx
cmpl -0x4(%rax,%r14,8), %ecx
je 0x1fb24
movq 0xd8(%rbx), %rcx
movl $0x5, %esi
movl $0x1, %edx
leaq 0x22a98(%rip), %rdi     # 0x4255d
callq 0x3700
movq 0xd0(%rbx), %rax
movq (%rax,%r13,8), %rax
movl 0x4(%rax,%r14,8), %eax
xorl %ecx, %ecx
btl %ecx, %eax
jb 0x1faea
incl %ecx
cmpl $0x20, %ecx
jne 0x1fadc
jmp 0x1fb15
movq 0xd8(%rbx), %rdi
btl $0xa, %eax
leaq 0x237a2(%rip), %rdx     # 0x4329e
leaq 0x235e9(%rip), %rax     # 0x430ec
cmovaeq %rax, %rdx
leaq 0x22a55(%rip), %rsi     # 0x42563
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rsi
movq %r15, %rdi
callq 0x34a0
movq 0xd0(%rbx), %rax
movq 0xd8(%rbx), %rsi
movq (%rax,%r13,8), %rax
movl (%rax,%r14,8), %edi
cmpl $0x26, %edi
je 0x1fb5b
cmpl $0x3e, %edi
je 0x1fb52
cmpl $0x3c, %edi
jne 0x1fb69
leaq 0x22a27(%rip), %rdi     # 0x42577
jmp 0x1fb62
leaq 0x22a23(%rip), %rdi     # 0x4257c
jmp 0x1fb62
leaq 0x22a1f(%rip), %rdi     # 0x42581
callq 0x34a0
jmp 0x1fb6e
callq 0x3320
leaq 0x1(%r14), %r12
movl 0x4(%rbx), %eax
cmpq %rax, %r12
je 0x1fb91
movq 0xd0(%rbx), %rax
movq (%rax,%r13,8), %rax
movl 0x4(%rax,%r14,8), %ecx
cmpl 0x4(%rax,%r12,8), %ecx
je 0x1fba0
movq 0xd8(%rbx), %rsi
movq %rbp, %rdi
callq 0x34a0
movslq 0x4(%rbx), %rax
movq %r12, %r14
cmpq %rax, %r12
jl 0x1fa91
incq %r13
movslq 0xc8(%rbx), %rax
cmpq %rax, %r13
jge 0x1fbd2
movq 0xd8(%rbx), %rsi
leaq 0x229c2(%rip), %rdi     # 0x4258f
callq 0x34a0
movslq 0xc8(%rbx), %rax
cmpq %rax, %r13
jl 0x1fa84
movq 0xd8(%rbx), %rsi
leaq 0x229a5(%rip), %rdi     # 0x42595
callq 0x34a0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq