// File: /workspace/github_c_makefile_star2_O1/asford[P]tmalign/./TMalign.h
// Function: output_superpose(char*, char*, int, int, double*, double (*) [3], double, double, int*, int*, int, double, double, double, double)
void output_superpose(char *xname,
					  char *yname,
					  int x_len,
					  int y_len,
					  double t[3],
					  double u[3][3],
					  double rmsd,
					  double d0_out,
					  int m1[], 
					  int m2[],
					  int n_ali8,
					  double seq_id,
					  double TM_0,
					  double Lnorm_0,
					  double d0_0
					 )
{
	int i, j, j1;
	double dis2;

	int max=2000;


	//aligned region
	FILE *fp=fopen(out_reg, "w");
	fprintf(fp, "load inline\n");
	fprintf(fp, "select atomno<%d\n", max);
	fprintf(fp, "wireframe .45\n");
	fprintf(fp, "select none\n");
	fprintf(fp, "select atomno>%d\n", max);
	fprintf(fp, "wireframe .20\n");
	fprintf(fp, "color white\n");


	do_rotation(xa, xt, x_len, t, u);
	for(i=0; i<n_ali8; i++)
	{
		j=m1[i];
		j1=m2[i];
		dis2=sqrt(dist(&xt[j][0], &ya[j1][0])) ;
		if(dis2<=d0_out)
		{
			fprintf(fp, "select atomno=%d\n", j+1);
			fprintf(fp, "color red\n");

			fprintf(fp, "select atomno=%d\n", max+j1+1);
			fprintf(fp, "color red\n");
		}
	}

	fprintf(fp, "select all\n");
	fprintf(fp, "exit\n");
	fprintf(fp, "REMARK TM-align Version %s\n", version);
	fprintf(fp, "REMARK Structure A:%s   Size=%d\n", yname, y_len);
	fprintf(fp, "REMARK Structure B:%s   Size=%d\n", xname, x_len);
	fprintf(fp, "REMARK TM-score is normalized by %.2f, d0=%.2f\n",  Lnorm_0, d0_0);
	fprintf(fp, "REMARK Aligned length=%d, RMSD=%.2f, TM-score=%.5f, ID=%.3f\n", n_ali8, rmsd, TM_0, seq_id);


	char AA[3];
	//superposed structure B
	for(i=0; i<n_ali8; i++)
	{
		j=m1[i];
		AAmap3(seqx[j], AA);
		fprintf(fp, "ATOM  %5d  CA  %3s %5d    %8.3f%8.3f%8.3f\n", j+1, AA, xresno[j], xt[j][0], xt[j][1], xt[j][2]);
	}
	fprintf(fp, "TER\n");

	for(i=1; i<n_ali8; i++)
	{
		j=m1[i-1]+1;
		j1=m1[i]+1;
		fprintf(fp, "CONECT%5d%5d\n", j, j1);
	}
	//structure A
	for(i=0; i<n_ali8; i++)
	{
		j=m2[i];
		AAmap3(seqy[j], AA);
		fprintf(fp, "ATOM  %5d  CA  %3s %5d    %8.3f%8.3f%8.3f\n", j+max+1, AA, yresno[j], ya[j][0], ya[j][1], ya[j][2]);
	}
	fprintf(fp, "TER\n");
	for(i=1; i<n_ali8; i++)
	{
		j=max+m2[i-1]+1;
		j1=max+m2[i]+1;
		fprintf(fp, "CONECT%5d%5d\n", j, j1);
	}

	fclose(fp);








	//all regions
	char str[3000];
	sprintf(str, "%s_all", out_reg);
	fp=fopen(str, "w");
	fprintf(fp, "load inline\n");
	fprintf(fp, "select atomno<%d\n", max);
	fprintf(fp, "wireframe .45\n");
	fprintf(fp, "select none\n");
	fprintf(fp, "select atomno>%d\n", max);
	fprintf(fp, "wireframe .20\n");
	fprintf(fp, "color white\n");

	for(i=0; i<n_ali8; i++)
	{
		j=m1[i];
		j1=m2[i];
		dis2=sqrt(dist(&xt[j][0], &ya[j1][0])) ;
		if(dis2<=d0_out)
		{
			fprintf(fp, "select atomno=%d\n", j+1);
			fprintf(fp, "color red\n");

			fprintf(fp, "select atomno=%d\n", max+j1+1);
			fprintf(fp, "color red\n");
		}
	}


	fprintf(fp, "select all\n");
	fprintf(fp, "exit\n");
	fprintf(fp, "REMARK TM-align Version %s\n", version);
	fprintf(fp, "REMARK Structure A:%s   Size=%d\n", yname, y_len);
	fprintf(fp, "REMARK Structure B:%s   Size=%d\n", xname, x_len);
	fprintf(fp, "REMARK TM-score is normalized by %.2f, d0=%.2f\n",  Lnorm_0, d0_0);
	fprintf(fp, "REMARK Aligned length=%d, RMSD=%.2f, TM-score=%.5f, ID=%.3f\n", n_ali8, rmsd, TM_0, seq_id);



	//superposed structure B
	for(i=0; i<x_len; i++)
	{
		j=i;
		AAmap3(seqx[j], AA);
		fprintf(fp, "ATOM  %5d  CA  %3s %5d    %8.3f%8.3f%8.3f\n", j+1, AA, xresno[j], xt[j][0], xt[j][1], xt[j][2]);
	}
	fprintf(fp, "TER\n");

	for(i=1; i<x_len; i++)
	{
		fprintf(fp, "CONECT%5d%5d\n", i, i+1);
	}
	//structure A
	for(i=0; i<y_len; i++)
	{
		j=i;
		AAmap3(seqy[j], AA);
		fprintf(fp, "ATOM  %5d  CA  %3s %5d    %8.3f%8.3f%8.3f\n", j+max+1, AA, yresno[j], ya[j][0], ya[j][1], ya[j][2]);
	}
	fprintf(fp, "TER\n");
	for(i=1; i<y_len; i++)
	{
		fprintf(fp, "CONECT%5d%5d\n", max+i, max+i+1);
	}

	fclose(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc18, %rsp            # imm = 0xC18
movsd %xmm5, 0x30(%rsp)
movsd %xmm4, 0x28(%rsp)
movsd %xmm3, 0x40(%rsp)
movsd %xmm2, 0x48(%rsp)
movsd %xmm1, 0x58(%rsp)
movsd %xmm0, 0x38(%rsp)
movq %r9, %r15
movq %r8, %r12
movq %rcx, 0x10(%rsp)
movl %edx, %ebx
movq %rsi, 0x18(%rsp)
movq %rdi, 0x20(%rsp)
leaq 0x1f8d5a(%rip), %rdi    # 0x6026a0
leaq 0x17f43c(%rip), %rsi    # 0x588d89
callq 0x4e8470
movq %rax, %r13
leaq 0x17a924(%rip), %rdi    # 0x584280
movl $0xc, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x4e87a0
leaq 0x17a918(%rip), %rsi    # 0x58428d
movq %r13, %rdi
movl $0x7d0, %edx            # imm = 0x7D0
xorl %eax, %eax
callq 0x4d9750
leaq 0x17a914(%rip), %rdi    # 0x58429f
movl $0xe, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
leaq 0x17a90a(%rip), %rdi    # 0x5842ae
movl $0xc, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
leaq 0x17a8fe(%rip), %rsi    # 0x5842bb
movq %r13, %rdi
movl $0x7d0, %edx            # imm = 0x7D0
xorl %eax, %eax
callq 0x4d9750
leaq 0x17a8fa(%rip), %rdi    # 0x5842cd
movl $0xe, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
leaq 0x17a8f0(%rip), %rdi    # 0x5842dc
movl $0xc, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
movl %ebx, %eax
movq %rax, 0x50(%rsp)
movl %ebx, 0xc(%rsp)
testl %ebx, %ebx
jle 0x409a3a
movq 0x1f8bac(%rip), %rbx    # 0x6025c0
movq 0x1f8bd5(%rip), %r14    # 0x6025f0
xorl %ebp, %ebp
movq (%rbx,%rbp,8), %rdx
movq (%r14,%rbp,8), %rcx
movq %r12, %rdi
movq %r15, %rsi
callq 0x4058ff
incq %rbp
cmpq %rbp, 0x50(%rsp)
jne 0x409a1d
movq 0xc58(%rsp), %rsi
movq 0xc50(%rsp), %rdi
movl 0xc60(%rsp), %eax
movl %eax, %ebp
testl %eax, %eax
jle 0x409b2e
leaq 0x17a887(%rip), %r15    # 0x5842e9
leaq 0x17a892(%rip), %r12    # 0x5842fb
xorl %ebx, %ebx
movslq (%rdi,%rbx,4), %rdx
movslq (%rsi,%rbx,4), %r14
movq 0x1f8b76(%rip), %rax    # 0x6025f0
movq (%rax,%rdx,8), %rax
movq 0x1f8b43(%rip), %rcx    # 0x6025c8
movq (%rcx,%r14,8), %rcx
movsd (%rax), %xmm0
subsd (%rcx), %xmm0
mulsd %xmm0, %xmm0
movupd 0x8(%rax), %xmm1
movupd 0x8(%rcx), %xmm2
subpd %xmm2, %xmm1
mulpd %xmm1, %xmm1
addsd %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
ucomisd 0x58(%rsp), %xmm0
ja 0x409b22
incl %edx
movq %r13, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x4d9750
movl $0xa, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r13, %rcx
callq 0x4e87a0
addl $0x7d1, %r14d           # imm = 0x7D1
movq %r13, %rdi
movq %r15, %rsi
movl %r14d, %edx
xorl %eax, %eax
callq 0x4d9750
movl $0xa, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r13, %rcx
callq 0x4e87a0
movq 0xc50(%rsp), %rdi
movq 0xc58(%rsp), %rsi
incq %rbx
cmpq %rbx, %rbp
jne 0x409a6b
movq %rdi, %r15
leaq 0x17a7ce(%rip), %rdi    # 0x584306
movl $0xb, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
leaq 0x17a7c1(%rip), %rdi    # 0x584312
movl $0x5, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
leaq 0x17a7ae(%rip), %rsi    # 0x584318
leaq 0x1f89df(%rip), %rdx    # 0x602550
movq %r13, %rdi
xorl %eax, %eax
callq 0x4d9750
leaq 0x17a7b2(%rip), %rsi    # 0x584334
movq %r13, %rdi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0x4d9750
leaq 0x17a7b8(%rip), %rsi    # 0x584355
movq %r13, %rdi
movq 0x20(%rsp), %rdx
movl 0xc(%rsp), %ecx
xorl %eax, %eax
callq 0x4d9750
leaq 0x17a7bf(%rip), %rsi    # 0x584376
movq %r13, %rdi
movsd 0x28(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movb $0x2, %al
callq 0x4d9750
leaq 0x17a7d2(%rip), %rsi    # 0x5843a6
movq %r13, %rdi
movl 0xc60(%rsp), %ebx
movl %ebx, %edx
movsd 0x38(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
movb $0x3, %al
callq 0x4d9750
testl %ebx, %ebx
jle 0x409c61
xorl %ebx, %ebx
leaq 0x9(%rsp), %r14
movslq (%r15,%rbx,4), %r12
movq 0x1f89e9(%rip), %rax    # 0x6025f8
movsbl (%rax,%r12), %edi
movq %r14, %rsi
callq 0x40497a
leal 0x1(%r12), %edx
movq 0x1f89a8(%rip), %rax    # 0x6025d0
movl (%rax,%r12,4), %r8d
movq 0x1f89bd(%rip), %rax    # 0x6025f0
movq (%rax,%r12,8), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movq %r13, %rdi
leaq 0x17a794(%rip), %rsi    # 0x5843e3
movq %r14, %rcx
movb $0x3, %al
callq 0x4d9750
incq %rbx
cmpq %rbx, %rbp
jne 0x409c04
leaq 0x17a7a6(%rip), %rdi    # 0x58440e
movl $0x1, %ebx
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
cmpl $0x2, 0xc60(%rsp)
jl 0x409cb2
leaq 0x17a783(%rip), %r14    # 0x584413
movl -0x4(%r15,%rbx,4), %edx
movl (%r15,%rbx,4), %ecx
incl %edx
incl %ecx
movq %r13, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x4d9750
incq %rbx
cmpq %rbx, %rbp
jne 0x409c90
cmpl $0x0, 0xc60(%rsp)
movq 0xc58(%rsp), %r12
jle 0x409d31
xorl %ebx, %ebx
leaq 0x9(%rsp), %r14
movq %r12, %r15
movslq (%r12,%rbx,4), %r12
movq 0x1f8927(%rip), %rax    # 0x602600
movsbl (%rax,%r12), %edi
movq %r14, %rsi
callq 0x40497a
leal 0x7d1(%r12), %edx
movq 0x1f88e3(%rip), %rax    # 0x6025d8
movl (%rax,%r12,4), %r8d
movq 0x1f88c8(%rip), %rax    # 0x6025c8
movq (%rax,%r12,8), %rax
movq %r15, %r12
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movq %r13, %rdi
leaq 0x17a6c4(%rip), %rsi    # 0x5843e3
movq %r14, %rcx
movb $0x3, %al
callq 0x4d9750
incq %rbx
cmpq %rbx, %rbp
jne 0x409ccb
leaq 0x17a6d6(%rip), %rdi    # 0x58440e
movl $0x1, %ebx
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
cmpl $0x2, 0xc60(%rsp)
jl 0x409d8a
movl $0x7d1, %r15d           # imm = 0x7D1
leaq 0x17a6ad(%rip), %r14    # 0x584413
movl -0x4(%r12,%rbx,4), %edx
addl %r15d, %edx
movl (%r12,%rbx,4), %ecx
addl %r15d, %ecx
movq %r13, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x4d9750
incq %rbx
cmpq %rbx, %rbp
jne 0x409d66
movq %r13, %rdi
callq 0x4e7d40
leaq 0x17a688(%rip), %rsi    # 0x584421
leaq 0x1f8900(%rip), %rdx    # 0x6026a0
leaq 0x60(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x4d98e0
leaq 0x17efd3(%rip), %rsi    # 0x588d89
movq %r14, %rdi
callq 0x4e8470
movq %rax, %r13
leaq 0x17a4b8(%rip), %rdi    # 0x584280
movl $0xc, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x4e87a0
leaq 0x17a4ac(%rip), %rsi    # 0x58428d
movq %r13, %rdi
movl $0x7d0, %edx            # imm = 0x7D0
xorl %eax, %eax
callq 0x4d9750
leaq 0x17a4a8(%rip), %rdi    # 0x58429f
movl $0xe, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
leaq 0x17a49e(%rip), %rdi    # 0x5842ae
movl $0xc, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
leaq 0x17a492(%rip), %rsi    # 0x5842bb
movq %r13, %rdi
movl $0x7d0, %edx            # imm = 0x7D0
xorl %eax, %eax
callq 0x4d9750
leaq 0x17a48e(%rip), %rdi    # 0x5842cd
movl $0xe, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
leaq 0x17a484(%rip), %rdi    # 0x5842dc
movl $0xc, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
cmpl $0x0, 0xc60(%rsp)
movq 0xc50(%rsp), %rdi
jle 0x409f56
movq %r12, %rsi
leaq 0x17a45f(%rip), %r15    # 0x5842e9
leaq 0x17a46a(%rip), %r12    # 0x5842fb
xorl %ebx, %ebx
movslq (%rdi,%rbx,4), %rdx
movslq (%rsi,%rbx,4), %r14
movq 0x1f874e(%rip), %rax    # 0x6025f0
movq (%rax,%rdx,8), %rax
movq 0x1f871b(%rip), %rcx    # 0x6025c8
movq (%rcx,%r14,8), %rcx
movsd (%rax), %xmm0
subsd (%rcx), %xmm0
mulsd %xmm0, %xmm0
movupd 0x8(%rax), %xmm1
movupd 0x8(%rcx), %xmm2
subpd %xmm2, %xmm1
mulpd %xmm1, %xmm1
addsd %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
ucomisd 0x58(%rsp), %xmm0
ja 0x409f4a
incl %edx
movq %r13, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x4d9750
movl $0xa, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r13, %rcx
callq 0x4e87a0
addl $0x7d1, %r14d           # imm = 0x7D1
movq %r13, %rdi
movq %r15, %rsi
movl %r14d, %edx
xorl %eax, %eax
callq 0x4d9750
movl $0xa, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r13, %rcx
callq 0x4e87a0
movq 0xc50(%rsp), %rdi
movq 0xc58(%rsp), %rsi
incq %rbx
cmpq %rbx, %rbp
jne 0x409e93
leaq 0x17a3a9(%rip), %rdi    # 0x584306
movl $0xb, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
leaq 0x17a39c(%rip), %rdi    # 0x584312
movl $0x5, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
leaq 0x17a389(%rip), %rsi    # 0x584318
leaq 0x1f85ba(%rip), %rdx    # 0x602550
movq %r13, %rdi
xorl %eax, %eax
callq 0x4d9750
leaq 0x17a38d(%rip), %rsi    # 0x584334
movq %r13, %rdi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0x4d9750
leaq 0x17a393(%rip), %rsi    # 0x584355
movq %r13, %rdi
movq 0x20(%rsp), %rdx
movl 0xc(%rsp), %ebx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x4d9750
leaq 0x17a398(%rip), %rsi    # 0x584376
movq %r13, %rdi
movsd 0x28(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movb $0x2, %al
callq 0x4d9750
leaq 0x17a3ab(%rip), %rsi    # 0x5843a6
movq %r13, %rdi
movl 0xc60(%rsp), %edx
movsd 0x38(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
movb $0x3, %al
callq 0x4d9750
testl %ebx, %ebx
movq 0x50(%rsp), %rbp
jle 0x40a08b
xorl %ebx, %ebx
leaq 0x9(%rsp), %r14
leaq 0x17a3ae(%rip), %r15    # 0x5843e3
movq 0x1f85bc(%rip), %rax    # 0x6025f8
movsbl (%rax,%rbx), %edi
movq %r14, %rsi
callq 0x40497a
leaq 0x1(%rbx), %r12
movq 0x1f857d(%rip), %rax    # 0x6025d0
movl (%rax,%rbx,4), %r8d
movq 0x1f8592(%rip), %rax    # 0x6025f0
movq (%rax,%rbx,8), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movq %r13, %rdi
movq %r15, %rsi
movl %r12d, %edx
movq %r14, %rcx
movb $0x3, %al
callq 0x4d9750
movq %r12, %rbx
cmpq %r12, %rbp
jne 0x40a035
leaq 0x17a37c(%rip), %rdi    # 0x58440e
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
movl 0xc(%rsp), %ebx
cmpl $0x2, %ebx
jl 0x40a0d5
movl $0x1, %edx
leaq 0x17a35a(%rip), %r14    # 0x584413
leal 0x1(%rdx), %r15d
movq %r13, %rdi
movq %r14, %rsi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x4d9750
movl %r15d, %edx
cmpl %r15d, %ebx
jne 0x40a0b9
movq 0x10(%rsp), %rbp
testl %ebp, %ebp
jle 0x40a147
movl %ebp, %ebx
xorl %r12d, %r12d
leaq 0x9(%rsp), %r14
leaq 0x17a2f4(%rip), %r15    # 0x5843e3
movq 0x1f850a(%rip), %rax    # 0x602600
movsbl (%rax,%r12), %edi
movq %r14, %rsi
callq 0x40497a
movq 0x1f84ce(%rip), %rax    # 0x6025d8
movl (%rax,%r12,4), %r8d
movq 0x1f84b3(%rip), %rax    # 0x6025c8
movq (%rax,%r12,8), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
leal 0x7d1(%r12), %edx
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rcx
movb $0x3, %al
callq 0x4d9750
incq %r12
cmpq %r12, %rbx
jne 0x40a0ef
leaq 0x17a2c0(%rip), %rdi    # 0x58440e
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4e87a0
cmpl $0x2, %ebp
jl 0x40a19d
negl %ebp
movl $0x7d2, %r15d           # imm = 0x7D2
leaq 0x17a29f(%rip), %r14    # 0x584413
leal -0x1(%r15), %edx
movq %r13, %rdi
movq %r14, %rsi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x4d9750
leal (%r15,%rbp), %eax
incl %eax
movl %r15d, %ecx
incl %ecx
movl %ecx, %r15d
cmpl $0x7d1, %eax            # imm = 0x7D1
jne 0x40a174
movq %r13, %rdi
callq 0x4e7d40
addq $0xc18, %rsp            # imm = 0xC18
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq