// File: /workspace/github_c_makefile_star2_O0/asford[P]tmalign/./TMalign.h
// Function: score_matrix_rmsd_sec(double**, double**, int, int, int*)
void score_matrix_rmsd_sec(  double **x, 
							 double **y, 
							 int x_len,
							 int y_len,
							 int *y2x
							 )
{
	double t[3], u[3][3];
	double rmsd, dij;
	double d01=d0+1.5;
	if(d01 < D0_MIN) d01=D0_MIN;
	double d02=d01*d01;

	double xx[3];
	int i, k=0;
	for(int j=0; j<y_len; j++)
	{
		i=y2x[j];
		if(i>=0)
		{
			r1[k][0]=x[i][0];  
			r1[k][1]=x[i][1]; 
			r1[k][2]=x[i][2];   
            
			r2[k][0]=y[j][0];  
			r2[k][1]=y[j][1]; 
			r2[k][2]=y[j][2];
			
			k++;
		}
	}
	Kabsch(r1, r2, k, 1, &rmsd, t, u);

	
	for(int ii=0; ii<x_len; ii++)
	{		
		transform(t, u, &x[ii][0], xx);
		for(int jj=0; jj<y_len; jj++)
		{
			dij=dist(xx, &y[jj][0]); 
			if(secx[ii]==secy[jj])
			{
				score[ii+1][jj+1] = 1.0/(1+dij/d02) + 0.5;
			}
			else
			{
				score[ii+1][jj+1] = 1.0/(1+dij/d02);
			}		
		}
	}		
}

// Assembly:
subq $0xe8, %rsp
movq %rdi, 0xe0(%rsp)
movq %rsi, 0xd8(%rsp)
movl %edx, 0xd4(%rsp)
movl %ecx, 0xd0(%rsp)
movq %r8, 0xc8(%rsp)
movsd 0x18035b(%rip), %xmm0   # 0x58c090
addsd 0x1fe843(%rip), %xmm0   # 0x60a580
movsd %xmm0, 0x48(%rsp)
movsd 0x48(%rsp), %xmm1
movsd 0x1fe817(%rip), %xmm0   # 0x60a568
ucomisd %xmm1, %xmm0
jbe 0x40bd65
movsd 0x1fe809(%rip), %xmm0   # 0x60a568
movsd %xmm0, 0x48(%rsp)
movsd 0x48(%rsp), %xmm0
mulsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0xd0(%rsp), %eax
jge 0x40bed2
movq 0xc8(%rsp), %rax
movslq 0x14(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x1c(%rsp)
cmpl $0x0, 0x1c(%rsp)
jl 0x40bec0
movq 0xe0(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax), %xmm0
movq 0x1fe845(%rip), %rax    # 0x60a618
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax)
movq 0xe0(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd 0x8(%rax), %xmm0
movq 0x1fe81b(%rip), %rax    # 0x60a618
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, 0x8(%rax)
movq 0xe0(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd 0x10(%rax), %xmm0
movq 0x1fe7f0(%rip), %rax    # 0x60a618
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, 0x10(%rax)
movq 0xd8(%rsp), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax), %xmm0
movq 0x1fe7ce(%rip), %rax    # 0x60a620
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax)
movq 0xd8(%rsp), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd 0x8(%rax), %xmm0
movq 0x1fe7a4(%rip), %rax    # 0x60a620
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, 0x8(%rax)
movq 0xd8(%rsp), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd 0x10(%rax), %xmm0
movq 0x1fe779(%rip), %rax    # 0x60a620
movslq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, 0x10(%rax)
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x40bec2
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x40bd87
movq 0x1fe73f(%rip), %rdi    # 0x60a618
movq 0x1fe740(%rip), %rsi    # 0x60a620
movl 0x18(%rsp), %edx
leaq 0xb0(%rsp), %r9
leaq 0x60(%rsp), %rax
movl $0x1, %ecx
leaq 0x58(%rsp), %r8
movq %rax, (%rsp)
callq 0x4070f0
movl $0x0, 0x10(%rsp)
movl 0x10(%rsp), %eax
cmpl 0xd4(%rsp), %eax
jge 0x40c061
leaq 0xb0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movq 0xe0(%rsp), %rax
movslq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x20(%rsp), %rcx
callq 0x4060e0
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0xd0(%rsp), %eax
jge 0x40c04f
leaq 0x20(%rsp), %rdi
movq 0xd8(%rsp), %rax
movslq 0xc(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x406000
movsd %xmm0, 0x50(%rsp)
movq 0x1fe682(%rip), %rax    # 0x60a608
movslq 0x10(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0x1fe67b(%rip), %rcx    # 0x60a610
movslq 0xc(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x40bff5
movsd 0x50(%rsp), %xmm0
divsd 0x40(%rsp), %xmm0
movsd 0x180055(%rip), %xmm1   # 0x58c008
addsd %xmm0, %xmm1
movsd 0x180049(%rip), %xmm0   # 0x58c008
divsd %xmm1, %xmm0
movsd 0x18006d(%rip), %xmm1   # 0x58c038
addsd %xmm1, %xmm0
movq 0x1fe5c2(%rip), %rax    # 0x60a598
movl 0x10(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl 0xc(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x40c03d
movsd 0x50(%rsp), %xmm0
divsd 0x40(%rsp), %xmm0
movsd 0x17ffff(%rip), %xmm1   # 0x58c008
addsd %xmm0, %xmm1
movsd 0x17fff3(%rip), %xmm0   # 0x58c008
divsd %xmm1, %xmm0
movq 0x1fe578(%rip), %rax    # 0x60a598
movl 0x10(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movl 0xc(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x40c03f
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x40bf4d
jmp 0x40c051
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x40bf0c
addq $0xe8, %rsp
retq
nopl (%rax)