// File: /workspace/github_c_makefile_star2_O3/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 0x1fcb6
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x70a4
movq 0xd8(%rbx), %rsi
leaq 0x236ad(%rip), %rdi     # 0x4340b
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 0x23692(%rip), %rsi     # 0x43418
movl %ebp, %ecx
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rsi
leaq 0x23690(%rip), %rdi     # 0x4342d
callq 0x34a0
movq 0xd8(%rbx), %rsi
leaq 0x23696(%rip), %rdi     # 0x43446
callq 0x34a0
movq 0xd8(%rbx), %rsi
leaq 0x236c8(%rip), %rdi     # 0x4348b
callq 0x34a0
movq 0xd8(%rbx), %rsi
leaq 0x236d7(%rip), %rdi     # 0x434ad
callq 0x34a0
movq 0xd8(%rbx), %rdi
leaq 0x236f6(%rip), %r14     # 0x434df
leaq 0x23737(%rip), %r12     # 0x43527
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 0x2371a(%rip), %rcx     # 0x4352d
movq %r14, %rsi
movl $0x1, %edx
movl $0x1, %r8d
movq %rcx, %r9
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rdi
leaq 0x236f9(%rip), %r15     # 0x43532
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 0x236d6(%rip), %r13     # 0x43538
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 0x23670(%rip), %rcx     # 0x4353f
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 0x22300(%rip), %rcx     # 0x42217
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 0x235e8(%rip), %rcx     # 0x4352d
movl $0x9, %r8d
movq %rcx, %r9
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rsi
leaq 0x235e1(%rip), %rdi     # 0x43544
callq 0x34a0
movq 0xd8(%rbx), %rsi
leaq 0x235d7(%rip), %rdi     # 0x4354d
callq 0x34a0
movq 0x18(%rbx), %rax
movq 0xd8(%rbx), %rdi
movq 0x8(%rax), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x235c2(%rip), %rsi     # 0x4355b
movl %ebp, %ecx
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rsi
leaq 0x235e6(%rip), %rdi     # 0x43596
callq 0x34a0
movl 0xc8(%rbx), %eax
testl %eax, %eax
jle 0x2013b
leaq 0x235e1(%rip), %r15     # 0x435ab
leaq 0x23606(%rip), %rbp     # 0x435d7
xorl %r13d, %r13d
cmpl $0x0, 0x4(%rbx)
jle 0x2010b
xorl %r14d, %r14d
testq %r14, %r14
je 0x20001
movq 0xd0(%rbx), %rax
movq (%rax,%r13,8), %rax
movl 0x4(%rax,%r14,8), %ecx
cmpl -0x4(%rax,%r14,8), %ecx
je 0x20083
movq 0xd8(%rbx), %rcx
movl $0x5, %esi
movl $0x1, %edx
leaq 0x23594(%rip), %rdi     # 0x435ad
callq 0x3700
movq 0xd0(%rbx), %rax
movq (%rax,%r13,8), %rax
movl 0x4(%rax,%r14,8), %eax
xorl %ecx, %ecx
btl %ecx, %eax
jb 0x2003e
incl %ecx
cmpl $0x20, %ecx
jne 0x20030
jmp 0x20069
movq 0xd8(%rbx), %rdi
btl $0xa, %eax
leaq 0x24330(%rip), %rdx     # 0x44380
leaq 0x24177(%rip), %rax     # 0x441ce
cmovaeq %rax, %rdx
leaq 0x23551(%rip), %rsi     # 0x435b3
xorl %eax, %eax
callq 0x3750
movq 0xd8(%rbx), %rsi
movq %r15, %rdi
callq 0x34a0
movq 0xd0(%rbx), %rax
movq (%rax,%r13,8), %rax
movl (%rax,%r14,8), %edi
movq 0xd8(%rbx), %rsi
cmpl $0x26, %edi
je 0x200af
cmpl $0x3e, %edi
je 0x200a6
cmpl $0x3c, %edi
jne 0x200bd
leaq 0x23523(%rip), %rdi     # 0x435c7
jmp 0x200b6
leaq 0x2351f(%rip), %rdi     # 0x435cc
jmp 0x200b6
leaq 0x2351b(%rip), %rdi     # 0x435d1
callq 0x34a0
jmp 0x200c2
callq 0x3320
leaq 0x1(%r14), %r12
movl 0x4(%rbx), %eax
cmpq %rax, %r12
je 0x200e5
movq 0xd0(%rbx), %rcx
movq (%rcx,%r13,8), %rcx
movl 0x4(%rcx,%r14,8), %edx
cmpl 0x4(%rcx,%r12,8), %edx
je 0x200f7
movq 0xd8(%rbx), %rsi
movq %rbp, %rdi
callq 0x34a0
movl 0x4(%rbx), %eax
cltq
movq %r12, %r14
cmpq %rax, %r12
jl 0x1ffe1
movl 0xc8(%rbx), %eax
incq %r13
movslq %eax, %rcx
cmpq %rcx, %r13
jge 0x20132
movq 0xd8(%rbx), %rsi
leaq 0x234bb(%rip), %rdi     # 0x435df
callq 0x34a0
movl 0xc8(%rbx), %eax
movslq %eax, %rcx
cmpq %rcx, %r13
jl 0x1ffd4
movq 0xd8(%rbx), %rsi
leaq 0x2349c(%rip), %rdi     # 0x435e5
callq 0x34a0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq