// File: /workspace/github_c_makefile_star2_O1/asford[P]tmalign/./Kabsch.h
// Function: Kabsch(double**, double**, int, int, double*, double*, double (*) [3])
bool Kabsch(double **x, 
            double **y, 
            int n, 
            int mode,
            double *rms,
            double t[3],
            double u[3][3]
            )
{	
    int i, j, m, m1, l, k;
    double e0, rms1, d, h, g;
    double cth, sth, sqrth, p, det, sigma;  
    double xc[3], yc[3];
    double a[3][3], b[3][3], r[3][3], e[3], rr[6], ss[6];
    double sqrt3=1.73205080756888, tol=0.01;
    int ip[]={0, 1, 3, 1, 2, 4, 3, 4, 5};
    int ip2312[]={1, 2, 0, 1};
    
    int a_failed=0, b_failed=0;
	double epsilon=0.00000001;
    
    //initializtation
	*rms=0;
    rms1=0;
    e0=0;
    for(i=0; i<3; i++)
    {
        xc[i]=0.0;
        yc[i]=0.0;
        t[i]=0.0;
        for(j=0; j<3; j++)
        {
            u[i][j]=0.0;
            r[i][j]=0.0;
            a[i][j]=0.0;
            if(i==j)
            {
                u[i][j]=1.0;
                a[i][j]=1.0;
            }
        }
    }
    
    if(n<1)
    {
		return false;
    } 
    
    //compute centers for vector sets x, y
    for(i=0; i<n; i++)
    {
        xc[0] += x[i][0];
        xc[1] += x[i][1];
        xc[2] += x[i][2];
        
        yc[0] += y[i][0];
        yc[1] += y[i][1];
        yc[2] += y[i][2];
    }
    for(i=0; i<3; i++)
    {
        xc[i] = xc[i]/n;
        yc[i] = yc[i]/n;        
    }
    
    //compute e0 and matrix r
    for(m=0; m<n; m++)
    {
        for (i=0; i<3; i++)
        {
            e0 += (x[m][i]-xc[i])*(x[m][i]-xc[i])+\
                  (y[m][i]-yc[i])*(y[m][i]-yc[i]);
            d = y[m][i] - yc[i];
            for(j=0; j<3; j++)
            {
                r[i][j] += d*(x[m][j] - xc[j]);
            }
        }        
    }
    //compute determinat of matrix r
    det = r[0][0] * ( r[1][1]*r[2][2] - r[1][2]*r[2][1] )\
        - r[0][1] * ( r[1][0]*r[2][2] - r[1][2]*r[2][0] )\
        + r[0][2] * ( r[1][0]*r[2][1] - r[1][1]*r[2][0] ); 
    sigma=det;
    
    //compute tras(r)*r
    m = 0;
    for(j=0; j<3; j++)
    {
        for (i=0; i<=j; i++)
        {            
            rr[m]=r[0][i]*r[0][j]+r[1][i]*r[1][j]+r[2][i]*r[2][j];
            m++;
        }
    }
    
    double spur=(rr[0]+rr[2]+rr[5]) / 3.0;
    double cof = (((((rr[2]*rr[5] - rr[4]*rr[4]) + rr[0]*rr[5])\
          - rr[3]*rr[3]) + rr[0]*rr[2]) - rr[1]*rr[1]) / 3.0;
    det = det*det; 
    
    for (i=0; i<3; i++)
    {
        e[i]=spur;
    }
    
    if(spur>0) 
    {
        d = spur*spur;
        h = d - cof;
        g = (spur*cof - det)/2.0 - spur*h;
        
        if(h>0)
        {
            sqrth = sqrt(h);
            d = h*h*h - g*g;
            if(d<0.0) d=0.0;
            d = atan2( sqrt(d), -g ) / 3.0;			
            cth = sqrth * cos(d);
            sth = sqrth*sqrt3*sin(d);
            e[0]= (spur + cth) + cth;
            e[1]= (spur - cth) + sth;            
            e[2]= (spur - cth) - sth;
			
            if(mode!=0)
            {//compute a                
                for(l=0; l<3; l=l+2)
                {
                    d = e[l];  
                    ss[0] = (d-rr[2]) * (d-rr[5])  - rr[4]*rr[4];
                    ss[1] = (d-rr[5]) * rr[1]      + rr[3]*rr[4];
                    ss[2] = (d-rr[0]) * (d-rr[5])  - rr[3]*rr[3];
                    ss[3] = (d-rr[2]) * rr[3]      + rr[1]*rr[4];
                    ss[4] = (d-rr[0]) * rr[4]      + rr[1]*rr[3];                
                    ss[5] = (d-rr[0]) * (d-rr[2])  - rr[1]*rr[1]; 

					if(fabs(ss[0])<=epsilon) ss[0]=0.0;
					if(fabs(ss[1])<=epsilon) ss[1]=0.0;
					if(fabs(ss[2])<=epsilon) ss[2]=0.0;
					if(fabs(ss[3])<=epsilon) ss[3]=0.0;
					if(fabs(ss[4])<=epsilon) ss[4]=0.0;
					if(fabs(ss[5])<=epsilon) ss[5]=0.0;
                    
                    if( fabs(ss[0]) >= fabs(ss[2]) )
                    {
                        j=0;                    
                        if( fabs(ss[0]) < fabs(ss[5])) 
                        {
                            j = 2;
                        }
                    }
                    else if ( fabs(ss[2]) >= fabs(ss[5]) )
                    {
                        j = 1;
                    }
                    else
                    {
                        j = 2;
                    }  
                    
                    d = 0.0;
                    j = 3 * j;
                    for(i=0; i<3; i++)
                    {
                        k=ip[i+j];
                        a[i][l] = ss[k];
                        d = d + ss[k]*ss[k];						
                    } 
                   

					//if( d > 0.0 ) d = 1.0 / sqrt(d);
                    if( d > epsilon ) d = 1.0 / sqrt(d);
					else d=0.0;
                    for(i=0; i<3; i++)
                    {
                        a[i][l] = a[i][l] * d;
                    }               
                }//for l
                
                d = a[0][0]*a[0][2] + a[1][0]*a[1][2] + a[2][0]*a[2][2];
                if ((e[0] - e[1]) > (e[1] - e[2]))
                {
                    m1=2;
                    m=0;
                }
                else
                {
                    m1=0;
                    m=2;                
                }
                p=0;
                for(i=0; i<3; i++)
                {
                    a[i][m1] = a[i][m1] - d*a[i][m];
                    p = p + a[i][m1]*a[i][m1];
                }
                if( p <= tol )
                {
                    p = 1.0;
                    for(i=0; i<3; i++)
                    {
                        if (p < fabs(a[i][m])) 
                        {
                            continue;
                        }
                        p = fabs( a[i][m] );
                        j = i;                    
                    }
                    k = ip2312[j];
                    l = ip2312[j+1];
                    p = sqrt( a[k][m]*a[k][m] + a[l][m]*a[l][m] ); 
                    if( p > tol )  
                    {
                        a[j][m1] = 0.0;
                        a[k][m1] = -a[l][m]/p;
                        a[l][m1] =  a[k][m]/p;                                                       
                    }   
                    else
                    {//goto 40
                        a_failed=1;
                    }     
                }//if p<=tol
                else
                {
                    p = 1.0 / sqrt(p);
                    for(i=0; i<3; i++)
                    {
                        a[i][m1] = a[i][m1]*p;
                    }                                  
                }//else p<=tol  
                if(a_failed!=1)
                {
                    a[0][1] = a[1][2]*a[2][0] - a[1][0]*a[2][2];
                    a[1][1] = a[2][2]*a[0][0] - a[2][0]*a[0][2];
                    a[2][1] = a[0][2]*a[1][0] - a[0][0]*a[1][2];       
                }                                   
            }//if(mode!=0)       
        }//h>0
        
        //compute b anyway
        if(mode!=0 && a_failed!=1)//a is computed correctly
        {
            //compute b
            for(l=0; l<2; l++)
            {
                d=0.0;
                for(i=0; i<3; i++)
                {
                    b[i][l] = r[i][0]*a[0][l] + r[i][1]*a[1][l] + r[i][2]*a[2][l];
                    d = d + b[i][l]*b[i][l];
                }
                //if( d > 0 ) d = 1.0 / sqrt(d);
				if( d > epsilon ) d = 1.0 / sqrt(d);
				else d=0.0;
                for(i=0; i<3; i++)
                {
                    b[i][l] = b[i][l]*d;
                }                
            }            
            d =b[0][0]*b[0][1] + b[1][0]*b[1][1] + b[2][0]*b[2][1];
            p=0.0;
            
            for(i=0; i<3; i++)
            {
                b[i][1] = b[i][1] - d*b[i][0];
                p += b[i][1]*b[i][1];
            }
            
            if( p <= tol )
            {
                p = 1.0;
                for(i=0; i<3; i++)
                {
                    if(p<fabs(b[i][0]))
                    {
                        continue;
                    }
                    p = fabs( b[i][0] );
                    j=i;
                }
                k = ip2312[j];
                l = ip2312[j+1];
                p = sqrt( b[k][0]*b[k][0] + b[l][0]*b[l][0] ); 
                if( p > tol )  
                {
                    b[j][1] = 0.0;
                    b[k][1] = -b[l][0]/p;
                    b[l][1] =  b[k][0]/p;        
                }
                else
                {
                    //goto 40
                    b_failed=1;
                }                
            }//if( p <= tol )
            else
            {
                p = 1.0 / sqrt(p);
                for(i=0; i<3; i++)
                {
                    b[i][1]=b[i][1]*p;
                }
            }            
            if(b_failed!=1)
            {
                b[0][2] = b[1][0]*b[2][1] - b[1][1]*b[2][0];
                b[1][2] = b[2][0]*b[0][1] - b[2][1]*b[0][0];
                b[2][2] = b[0][0]*b[1][1] - b[0][1]*b[1][0]; 
                //compute u
                for(i=0; i<3; i++)
                {
                    for(j=0; j<3; j++)
                    {
                        u[i][j] = b[i][0]*a[j][0] + b[i][1]*a[j][1]\
                                + b[i][2]*a[j][2];
                    }
                }
            }
            
            //compute t
            for(i=0; i<3; i++)
            {
                t[i] = ((yc[i] - u[i][0]*xc[0]) - u[i][1]*xc[1])\
                        - u[i][2]*xc[2];
            }            
        }//if(mode!=0 && a_failed!=1)
    }//spur>0
    else //just compute t and errors
    {
        //compute t
        for(i=0; i<3; i++)
        {
            t[i] = ((yc[i] - u[i][0]*xc[0]) - u[i][1]*xc[1]) - u[i][2]*xc[2];
        }
    }//else spur>0 
    
    //compute rms
    for(i=0; i<3; i++)
    {
        if( e[i] < 0 ) e[i] = 0;
        e[i] = sqrt( e[i] );           
    }            
    d = e[2];
    if( sigma < 0.0 )
    {
        d = - d;
    }
    d = (d + e[1]) + e[0];
    rms1 = (e0 - d) - d; 
    if( rms1 < 0.0 ) rms1 = 0.0;  
    
    *rms=rms1;

	return true;
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movq %r9, %r15
movl %ecx, %r13d
movl %edx, %ebx
movq 0x2e0(%rsp), %rbp
xorl %eax, %eax
movq %rax, (%r8)
movq %rax, 0x160(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x150(%rsp)
movapd %xmm0, 0x140(%rsp)
movapd %xmm0, 0x130(%rsp)
movapd %xmm0, 0x120(%rsp)
leaq 0x70(%rsp), %rcx
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movq %rbp, %r11
xorl %r9d, %r9d
movq %rax, 0x10(%rsp,%r9,8)
movq %rax, 0x50(%rsp,%r9,8)
movq %rax, (%r15,%r9,8)
xorl %r10d, %r10d
movq %rax, (%r11,%r10,8)
movq %rax, (%rcx,%r10,8)
cmpq %r10, %r9
jne 0x4061f9
movq %rdx, (%r11,%r10,8)
movq %rdx, (%rcx,%r10,8)
incq %r10
cmpq $0x3, %r10
jne 0x4061e4
incq %r9
addq $0x18, %r11
addq $0x18, %rcx
cmpq $0x3, %r9
jne 0x4061d3
testl %ebx, %ebx
jle 0x40709c
movapd 0x10(%rsp), %xmm0
movsd 0x20(%rsp), %xmm2
movapd 0x50(%rsp), %xmm1
movsd 0x60(%rsp), %xmm3
movl %ebx, %eax
xorl %ecx, %ecx
movq (%rdi,%rcx,8), %rdx
movupd (%rdx), %xmm4
addsd 0x10(%rdx), %xmm2
addpd %xmm4, %xmm0
movq (%rsi,%rcx,8), %rdx
movupd (%rdx), %xmm4
addpd %xmm4, %xmm1
addsd 0x10(%rdx), %xmm3
incq %rcx
cmpq %rcx, %rax
jne 0x406237
movsd %xmm2, 0x20(%rsp)
movsd %xmm3, 0x60(%rsp)
movapd %xmm0, 0x10(%rsp)
movapd %xmm1, 0x50(%rsp)
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
movsd 0x17dd7f(%rip), %xmm10  # 0x584008
movapd %xmm10, %xmm0
divsd %xmm1, %xmm0
xorl %ecx, %ecx
movsd 0x10(%rsp,%rcx,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp,%rcx,8)
movsd 0x50(%rsp,%rcx,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x50(%rsp,%rcx,8)
incq %rcx
cmpq $0x3, %rcx
jne 0x406294
xorpd %xmm8, %xmm8
xorl %ecx, %ecx
leaq 0x120(%rsp), %rdx
movq (%rdi,%rcx,8), %r12
movq (%rsi,%rcx,8), %r9
movq %rdx, %r10
xorl %r11d, %r11d
movapd %xmm8, %xmm0
movsd (%r12,%r11,8), %xmm8
subsd 0x10(%rsp,%r11,8), %xmm8
mulsd %xmm8, %xmm8
addsd %xmm0, %xmm8
movsd (%r9,%r11,8), %xmm0
subsd 0x50(%rsp,%r11,8), %xmm0
xorl %r14d, %r14d
movsd (%r12,%r14,8), %xmm1
subsd 0x10(%rsp,%r14,8), %xmm1
mulsd %xmm0, %xmm1
addsd (%r10,%r14,8), %xmm1
movsd %xmm1, (%r10,%r14,8)
incq %r14
cmpq $0x3, %r14
jne 0x406306
mulsd %xmm0, %xmm0
addsd %xmm0, %xmm8
incq %r11
addq $0x18, %r10
cmpq $0x3, %r11
jne 0x4062da
incq %rcx
cmpq %rax, %rcx
jne 0x4062cc
movsd 0x120(%rsp), %xmm1
movsd 0x138(%rsp), %xmm0
movsd 0x140(%rsp), %xmm3
movsd 0x160(%rsp), %xmm2
movapd %xmm2, %xmm9
mulsd %xmm3, %xmm9
movsd 0x148(%rsp), %xmm4
movsd 0x158(%rsp), %xmm5
mulsd %xmm0, %xmm2
mulsd %xmm5, %xmm0
mulsd %xmm4, %xmm5
movsd 0x150(%rsp), %xmm6
mulsd %xmm6, %xmm4
subsd %xmm4, %xmm2
mulsd 0x128(%rsp), %xmm2
mulsd %xmm3, %xmm6
subsd %xmm6, %xmm0
mulsd 0x130(%rsp), %xmm0
subsd %xmm5, %xmm9
movl $0x1, %eax
xorl %ecx, %ecx
xorl %edx, %edx
movsd 0x120(%rsp,%rcx,8), %xmm3
movsd 0x138(%rsp,%rcx,8), %xmm4
movsd 0x150(%rsp,%rcx,8), %xmm5
movslq %edx, %rdx
xorl %esi, %esi
movsd 0x120(%rsp,%rsi,8), %xmm6
mulsd %xmm3, %xmm6
movsd 0x138(%rsp,%rsi,8), %xmm7
mulsd %xmm4, %xmm7
addsd %xmm6, %xmm7
movsd 0x150(%rsp,%rsi,8), %xmm6
mulsd %xmm5, %xmm6
addsd %xmm7, %xmm6
movsd %xmm6, 0x260(%rsp,%rdx,8)
incq %rdx
incq %rsi
cmpq %rsi, %rax
jne 0x4063ef
incq %rcx
incq %rax
cmpq $0x3, %rcx
jne 0x4063cf
mulsd %xmm1, %xmm9
subsd %xmm2, %xmm9
addsd %xmm0, %xmm9
movsd 0x260(%rsp), %xmm15
movsd 0x268(%rsp), %xmm12
movsd 0x270(%rsp), %xmm13
movapd %xmm13, %xmm0
addsd %xmm15, %xmm0
movsd 0x288(%rsp), %xmm14
movapd %xmm0, %xmm11
addsd %xmm14, %xmm11
movsd 0x17db7f(%rip), %xmm2   # 0x584010
mulsd %xmm2, %xmm11
movupd 0x278(%rsp), %xmm1
movapd %xmm1, %xmm3
unpckhpd %xmm1, %xmm3            # xmm3 = xmm3[1],xmm1[1]
movapd %xmm3, 0x220(%rsp)
mulsd %xmm3, %xmm3
movapd %xmm1, 0x1c0(%rsp)
movapd %xmm1, %xmm4
mulsd %xmm1, %xmm4
mulsd %xmm14, %xmm0
movapd %xmm13, %xmm1
mulsd %xmm15, %xmm1
addsd %xmm0, %xmm1
movapd %xmm12, %xmm5
mulsd %xmm12, %xmm5
movapd %xmm4, 0x240(%rsp)
movapd %xmm4, %xmm0
movapd %xmm5, 0x230(%rsp)
addsd %xmm5, %xmm0
movapd %xmm3, 0x250(%rsp)
addsd %xmm3, %xmm0
subsd %xmm0, %xmm1
mulsd %xmm2, %xmm1
movdqa 0x17dbe7(%rip), %xmm0   # 0x584100
xorl %eax, %eax
movdqa 0x17dbed(%rip), %xmm2   # 0x584110
movdqa 0x17dbf5(%rip), %xmm3   # 0x584120
movdqa 0x17dbfd(%rip), %xmm4   # 0x584130
movdqa %xmm0, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm3, %xmm6
pcmpgtd %xmm5, %xmm6
pshufd $0xf5, %xmm3, %xmm7     # xmm7 = xmm3[1,1,3,3]
pshufd $0xf5, %xmm5, %xmm5     # xmm5 = xmm5[1,1,3,3]
pcmpeqd %xmm7, %xmm5
pand %xmm6, %xmm5
movd %xmm5, %ecx
testb $0x1, %cl
je 0x406565
movsd %xmm11, 0x30(%rsp,%rax,8)
pextrw $0x4, %xmm5, %ecx
testb $0x1, %cl
je 0x406576
movsd %xmm11, 0x38(%rsp,%rax,8)
addq $0x2, %rax
paddq %xmm4, %xmm0
cmpq $0x4, %rax
jne 0x406533
pxor %xmm2, %xmm2
ucomisd %xmm2, %xmm11
jbe 0x406ab7
movapd %xmm11, %xmm0
mulsd %xmm11, %xmm0
subsd %xmm1, %xmm0
movl $0x3, %r14d
movb $0x1, %cl
ucomisd %xmm2, %xmm0
jbe 0x406c96
movapd %xmm15, 0x1d0(%rsp)
movsd %xmm14, 0x1a8(%rsp)
movapd %xmm13, 0x1e0(%rsp)
movapd %xmm12, 0x1f0(%rsp)
movl %ebx, 0xc(%rsp)
movsd %xmm8, 0xc0(%rsp)
movq %r8, 0xc8(%rsp)
movapd %xmm9, 0x1b0(%rsp)
movapd %xmm9, %xmm2
mulsd %xmm9, %xmm2
mulsd %xmm11, %xmm1
subsd %xmm2, %xmm1
mulsd 0x17da02(%rip), %xmm1   # 0x584018
movapd %xmm0, %xmm2
mulsd %xmm11, %xmm2
subsd %xmm2, %xmm1
xorps %xmm2, %xmm2
sqrtsd %xmm0, %xmm2
movapd %xmm2, 0x200(%rsp)
movapd %xmm0, %xmm2
mulsd %xmm0, %xmm2
mulsd %xmm0, %xmm2
movapd %xmm1, %xmm0
mulsd %xmm1, %xmm0
subsd %xmm0, %xmm2
xorpd %xmm0, %xmm0
maxsd %xmm2, %xmm0
sqrtsd %xmm0, %xmm0
xorpd 0x17dae1(%rip), %xmm1   # 0x584140
movapd %xmm11, 0x210(%rsp)
callq 0x4ab850
mulsd 0x17d99a(%rip), %xmm0   # 0x584010
leaq 0x2a0(%rsp), %r12
leaq 0x298(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4aadc0
movapd 0x210(%rsp), %xmm12
movapd 0x17daad(%rip), %xmm0   # 0x584150
movlpd (%rbx), %xmm0           # xmm0 = mem[0],xmm0[1]
movapd 0x200(%rsp), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm0, %xmm1
movapd 0x17daa0(%rip), %xmm2   # 0x584160
movhpd (%r12), %xmm2           # xmm2 = xmm2[0],mem[0]
mulpd %xmm1, %xmm2
movapd %xmm12, %xmm0
subsd %xmm1, %xmm0
unpcklpd %xmm0, %xmm12           # xmm12 = xmm12[0],xmm0[0]
addpd %xmm2, %xmm12
movapd %xmm12, 0x30(%rsp)
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
subsd %xmm2, %xmm0
movsd %xmm0, 0x40(%rsp)
testl %r13d, %r13d
je 0x406b17
movapd 0x1c0(%rsp), %xmm4
movapd %xmm4, %xmm3
mulsd 0x220(%rsp), %xmm3
movapd 0x1f0(%rsp), %xmm13
movapd %xmm13, %xmm0
unpcklpd %xmm13, %xmm0           # xmm0 = xmm0[0],xmm13[0]
shufpd $0x1, %xmm4, %xmm4      # xmm4 = xmm4[1,0]
mulpd %xmm0, %xmm4
movapd 0x1e0(%rsp), %xmm14
unpcklpd 0x1d0(%rsp), %xmm14     # xmm14 = xmm14[0],mem[0]
leaq 0x70(%rsp), %rax
xorl %ecx, %ecx
movapd 0x17da1f(%rip), %xmm0   # 0x584170
movsd 0x17d8c7(%rip), %xmm5   # 0x584020
movapd 0x17da0f(%rip), %xmm6   # 0x584170
leaq 0x17e8c8(%rip), %rdx    # 0x585030
movsd 0x17d898(%rip), %xmm1   # 0x584008
movq 0xc8(%rsp), %r8
movl 0xc(%rsp), %ebx
movsd 0x1a8(%rsp), %xmm15
movsd 0x30(%rsp,%rcx,8), %xmm9
movapd %xmm9, %xmm7
subsd %xmm15, %xmm7
movapd %xmm7, %xmm11
mulsd %xmm13, %xmm11
addsd %xmm3, %xmm11
movsd %xmm11, 0x178(%rsp)
unpcklpd %xmm9, %xmm9            # xmm9 = xmm9[0,0]
subpd %xmm14, %xmm9
movapd %xmm9, %xmm8
mulsd %xmm7, %xmm8
subsd 0x250(%rsp), %xmm8
movapd %xmm8, %xmm10
andpd %xmm0, %xmm10
ucomisd %xmm5, %xmm10
movsd %xmm8, 0x170(%rsp)
movapd %xmm9, %xmm10
unpckhpd %xmm9, %xmm10           # xmm10 = xmm10[1],xmm9[1]
mulsd %xmm10, %xmm7
subsd 0x240(%rsp), %xmm7
movsd %xmm7, 0x180(%rsp)
mulsd %xmm9, %xmm10
mulpd 0x1c0(%rsp), %xmm9
addpd %xmm4, %xmm9
movupd %xmm9, 0x188(%rsp)
subsd 0x230(%rsp), %xmm10
movsd %xmm10, 0x198(%rsp)
ja 0x40684d
movq $0x0, 0x170(%rsp)
xorpd %xmm8, %xmm8
andpd %xmm0, %xmm11
ucomisd %xmm5, %xmm11
ja 0x406865
movq $0x0, 0x178(%rsp)
movapd %xmm7, %xmm11
andpd %xmm0, %xmm11
ucomisd %xmm5, %xmm11
ja 0x406886
movq $0x0, 0x180(%rsp)
xorpd %xmm7, %xmm7
movapd %xmm9, %xmm11
andpd %xmm0, %xmm11
ucomisd %xmm5, %xmm11
ja 0x4068a3
movq $0x0, 0x188(%rsp)
unpckhpd %xmm9, %xmm9            # xmm9 = xmm9[1,1]
andpd %xmm0, %xmm9
ucomisd %xmm5, %xmm9
ja 0x4068c0
movq $0x0, 0x190(%rsp)
movapd %xmm10, %xmm9
andpd %xmm0, %xmm9
ucomisd %xmm5, %xmm9
ja 0x4068e2
movq $0x0, 0x198(%rsp)
xorpd %xmm10, %xmm10
andpd %xmm6, %xmm8
andpd %xmm6, %xmm7
ucomisd %xmm7, %xmm8
andpd %xmm6, %xmm10
jae 0x40690c
xorl %esi, %esi
ucomisd %xmm10, %xmm7
setb %sil
leal (%rsi,%rsi,2), %r14d
addl $0x3, %r14d
jmp 0x40691c
xorl %r14d, %r14d
ucomisd %xmm10, %xmm8
jae 0x40691c
movl $0x6, %r14d
leal (,%r14,4), %esi
xorpd %xmm7, %xmm7
movq %rax, %rdi
xorl %r10d, %r10d
leaq (%rsi,%r10,4), %r9
movslq (%rdx,%r9), %r9
movsd 0x170(%rsp,%r9,8), %xmm8
movsd %xmm8, (%rdi)
mulsd %xmm8, %xmm8
addsd %xmm8, %xmm7
incq %r10
addq $0x18, %rdi
cmpq $0x3, %r10
jne 0x40692e
xorps %xmm8, %xmm8
sqrtsd %xmm7, %xmm8
movapd %xmm1, %xmm9
divsd %xmm8, %xmm9
movapd %xmm5, %xmm8
cmpltsd %xmm7, %xmm8
andpd %xmm9, %xmm8
xorl %esi, %esi
movsd (%rax,%rsi), %xmm7
mulsd %xmm8, %xmm7
movsd %xmm7, (%rax,%rsi)
addq $0x18, %rsi
cmpq $0x48, %rsi
jne 0x406981
leaq 0x2(%rcx), %rsi
addq $0x10, %rax
testq %rcx, %rcx
movq %rsi, %rcx
je 0x406786
movsd 0x80(%rsp), %xmm3
mulsd 0x70(%rsp), %xmm3
movsd 0x98(%rsp), %xmm4
mulsd 0x88(%rsp), %xmm4
addsd %xmm3, %xmm4
movsd 0xb0(%rsp), %xmm3
mulsd 0xa0(%rsp), %xmm3
addsd %xmm4, %xmm3
movapd %xmm12, %xmm4
unpckhpd %xmm12, %xmm4           # xmm4 = xmm4[1],xmm12[1]
subsd %xmm4, %xmm12
addsd %xmm2, %xmm2
xorl %esi, %esi
xorl %edx, %edx
ucomisd %xmm2, %xmm12
setbe %sil
seta %dl
leal (%rdx,%rdx), %eax
leal (%rsi,%rsi), %ecx
shll $0x4, %edx
addq %rsp, %rdx
addq $0x70, %rdx
shll $0x4, %esi
addq %rsp, %rsi
addq $0x70, %rsi
xorpd %xmm2, %xmm2
xorl %edi, %edi
movsd (%rdx,%rdi), %xmm4
movsd (%rsi,%rdi), %xmm5
mulsd %xmm3, %xmm5
subsd %xmm5, %xmm4
movsd %xmm4, (%rdx,%rdi)
mulsd %xmm4, %xmm4
addsd %xmm4, %xmm2
addq $0x18, %rdi
cmpq $0x48, %rdi
jne 0x406a2c
ucomisd 0x17d5cb(%rip), %xmm2   # 0x584028
movsd 0xc0(%rsp), %xmm8
movapd 0x1b0(%rsp), %xmm9
movsd 0x17d58e(%rip), %xmm10  # 0x584008
jbe 0x406b45
sqrtsd %xmm2, %xmm1
movsd 0x17d57c(%rip), %xmm0   # 0x584008
divsd %xmm1, %xmm0
leaq (%rsp,%rax,8), %rax
addq $0x70, %rax
xorl %ecx, %ecx
movsd (%rax,%rcx), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rcx)
addq $0x18, %rcx
cmpq $0x48, %rcx
jne 0x406a9a
jmp 0x406c11
movsd 0x20(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
xorpd 0x17d675(%rip), %xmm1   # 0x584140
movhpd 0x18(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0]
addq $0x10, %rbp
xorl %eax, %eax
movupd -0x10(%rbp), %xmm2
mulpd %xmm1, %xmm2
movsd (%rbp), %xmm3
mulsd %xmm0, %xmm3
movapd %xmm2, %xmm4
unpckhpd %xmm2, %xmm4            # xmm4 = xmm4[1],xmm2[1]
addsd %xmm3, %xmm4
subsd %xmm4, %xmm2
addsd 0x50(%rsp,%rax,8), %xmm2
movsd %xmm2, (%r15,%rax,8)
incq %rax
addq $0x18, %rbp
cmpq $0x3, %rax
jne 0x406ad7
jmp 0x407020
movq 0xc8(%rsp), %r8
movsd 0xc0(%rsp), %xmm8
movapd 0x1b0(%rsp), %xmm9
movsd 0x17d4cc(%rip), %xmm10  # 0x584008
movl 0xc(%rsp), %ebx
jmp 0x406c94
leaq (%rsp,%rcx,8), %rdx
addq $0x70, %rdx
xorl %esi, %esi
movsd (%rdx), %xmm2
andpd %xmm0, %xmm2
ucomisd %xmm2, %xmm1
cmovael %esi, %r14d
minsd %xmm2, %xmm1
incq %rsi
addq $0x18, %rdx
cmpq $0x3, %rsi
jne 0x406b4f
movslq %r14d, %rdi
leaq 0x17d626(%rip), %rdx    # 0x5841a0
movslq (%rdx,%rdi,4), %rsi
movslq 0x4(%rdx,%rdi,4), %r9
leaq (%rsi,%rsi,2), %rdx
leaq (%rsp,%rdx,8), %rdx
addq $0x70, %rdx
shll $0x3, %ecx
movsd (%rcx,%rdx), %xmm0
mulsd %xmm0, %xmm0
leaq (%r9,%r9,2), %rsi
leaq (%rsp,%rsi,8), %rsi
addq $0x70, %rsi
movsd (%rcx,%rsi), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
movb $0x1, %r9b
ucomisd 0x17d462(%rip), %xmm0   # 0x584028
jbe 0x406c14
leaq (%rdx,%rcx), %r9
addq %rsi, %rcx
leaq (%rdi,%rdi,2), %rdi
leaq (%rsp,%rdi,8), %rdi
addq $0x70, %rdi
shll $0x3, %eax
movq $0x0, (%rax,%rdi)
movsd (%rcx), %xmm1
xorpd 0x17d54e(%rip), %xmm1   # 0x584140
movsd 0x17d40e(%rip), %xmm2   # 0x584008
divsd %xmm0, %xmm2
mulsd %xmm2, %xmm1
movsd %xmm1, (%rax,%rdx)
mulsd (%r9), %xmm2
movsd %xmm2, (%rax,%rsi)
xorl %r9d, %r9d
testb %r9b, %r9b
je 0x406c1d
xorl %ecx, %ecx
jmp 0x406c96
movsd 0x98(%rsp), %xmm0
movsd 0xa0(%rsp), %xmm1
movapd %xmm1, %xmm2
mulsd %xmm0, %xmm2
movsd 0x88(%rsp), %xmm3
movsd 0xb0(%rsp), %xmm4
movapd %xmm4, %xmm5
mulsd %xmm3, %xmm5
subsd %xmm5, %xmm2
movsd %xmm2, 0x78(%rsp)
movsd 0x70(%rsp), %xmm2
movsd 0x80(%rsp), %xmm5
mulsd %xmm2, %xmm4
mulsd %xmm5, %xmm1
subsd %xmm1, %xmm4
movsd %xmm4, 0x90(%rsp)
mulsd %xmm3, %xmm5
mulsd %xmm0, %xmm2
subsd %xmm2, %xmm5
movsd %xmm5, 0xa8(%rsp)
movb $0x1, %cl
testl %r13d, %r13d
sete %al
xorb $0x1, %cl
orb %al, %cl
jne 0x407020
leaq 0xd0(%rsp), %rax
xorl %ecx, %ecx
movsd 0x17d367(%rip), %xmm0   # 0x584020
movsd 0x70(%rsp,%rcx,8), %xmm2
movsd 0x88(%rsp,%rcx,8), %xmm3
movhpd 0xa0(%rsp,%rcx,8), %xmm3 # xmm3 = xmm3[0],mem[0]
xorpd %xmm1, %xmm1
xorl %edx, %edx
movsd 0x120(%rsp,%rdx), %xmm4
mulsd %xmm2, %xmm4
movupd 0x128(%rsp,%rdx), %xmm5
mulpd %xmm3, %xmm5
addsd %xmm5, %xmm4
unpckhpd %xmm5, %xmm5            # xmm5 = xmm5[1,1]
addsd %xmm4, %xmm5
movsd %xmm5, (%rax,%rdx)
mulsd %xmm5, %xmm5
addsd %xmm5, %xmm1
addq $0x18, %rdx
cmpq $0x48, %rdx
jne 0x406cd7
xorps %xmm2, %xmm2
sqrtsd %xmm1, %xmm2
movapd %xmm10, %xmm3
divsd %xmm2, %xmm3
movapd %xmm0, %xmm2
cmpltsd %xmm1, %xmm2
andpd %xmm3, %xmm2
xorl %edx, %edx
movsd (%rax,%rdx), %xmm1
mulsd %xmm2, %xmm1
movsd %xmm1, (%rax,%rdx)
addq $0x18, %rdx
cmpq $0x48, %rdx
jne 0x406d33
leaq 0x1(%rcx), %rdx
addq $0x8, %rax
testq %rcx, %rcx
movq %rdx, %rcx
je 0x406cb9
movsd 0xd0(%rsp), %xmm1
movsd 0xe8(%rsp), %xmm0
movsd 0xd8(%rsp), %xmm2
mulsd %xmm1, %xmm2
movsd 0xf0(%rsp), %xmm3
mulsd %xmm0, %xmm3
addsd %xmm2, %xmm3
movsd 0x100(%rsp), %xmm2
movsd 0x108(%rsp), %xmm4
mulsd %xmm2, %xmm4
addsd %xmm3, %xmm4
xorpd %xmm3, %xmm3
movl $0x8, %eax
movsd 0xd0(%rsp,%rax), %xmm5
movsd 0xc8(%rsp,%rax), %xmm6
mulsd %xmm4, %xmm6
subsd %xmm6, %xmm5
movsd %xmm5, 0xd0(%rsp,%rax)
mulsd %xmm5, %xmm5
addsd %xmm5, %xmm3
addq $0x18, %rax
cmpq $0x50, %rax
jne 0x406db2
ucomisd 0x17d239(%rip), %xmm3   # 0x584028
jbe 0x406e2e
xorps %xmm4, %xmm4
sqrtsd %xmm3, %xmm4
movsd 0x17d208(%rip), %xmm3   # 0x584008
divsd %xmm4, %xmm3
movl $0x8, %eax
movsd 0xd0(%rsp,%rax), %xmm4
mulsd %xmm3, %xmm4
movsd %xmm4, 0xd0(%rsp,%rax)
addq $0x18, %rax
cmpq $0x50, %rax
jne 0x406e09
jmp 0x406f02
leaq 0xd0(%rsp), %rax
xorl %ecx, %ecx
movapd 0x17d330(%rip), %xmm3   # 0x584170
movsd (%rax), %xmm4
andpd %xmm3, %xmm4
ucomisd %xmm4, %xmm10
cmovael %ecx, %r14d
minsd %xmm4, %xmm10
incq %rcx
addq $0x18, %rax
cmpq $0x3, %rcx
jne 0x406e40
movslq %r14d, %rax
leaq 0x17d333(%rip), %rcx    # 0x5841a0
movslq (%rcx,%rax,4), %rdx
movslq 0x4(%rcx,%rax,4), %rsi
leaq (%rdx,%rdx,2), %rcx
movsd 0xd0(%rsp,%rcx,8), %xmm3
movapd %xmm3, %xmm5
mulsd %xmm3, %xmm5
leaq (%rsi,%rsi,2), %rdx
movsd 0xd0(%rsp,%rdx,8), %xmm4
movapd %xmm4, %xmm6
mulsd %xmm4, %xmm6
addsd %xmm5, %xmm6
xorps %xmm5, %xmm5
sqrtsd %xmm6, %xmm5
ucomisd 0x17d175(%rip), %xmm5   # 0x584028
jbe 0x406fc5
leaq (%rsp,%rcx,8), %rcx
addq $0xd0, %rcx
leaq 0xd0(%rsp,%rdx,8), %rdx
leaq (%rax,%rax,2), %rax
movq $0x0, 0xd8(%rsp,%rax,8)
xorpd 0x17d25c(%rip), %xmm4   # 0x584140
movsd 0x17d11c(%rip), %xmm6   # 0x584008
divsd %xmm5, %xmm6
mulsd %xmm6, %xmm4
movsd %xmm4, 0x8(%rcx)
mulsd %xmm6, %xmm3
movsd %xmm3, 0x8(%rdx)
movsd 0x108(%rsp), %xmm3
movapd %xmm3, %xmm4
mulsd %xmm0, %xmm4
movsd 0xd8(%rsp), %xmm5
movsd 0xf0(%rsp), %xmm6
movapd %xmm6, %xmm7
mulsd %xmm2, %xmm7
subsd %xmm7, %xmm4
movsd %xmm4, 0xe0(%rsp)
mulsd %xmm5, %xmm2
mulsd %xmm1, %xmm3
subsd %xmm3, %xmm2
movsd %xmm2, 0xf8(%rsp)
mulsd %xmm1, %xmm6
mulsd %xmm0, %xmm5
subsd %xmm5, %xmm6
movsd %xmm6, 0x110(%rsp)
leaq 0x78(%rsp), %rax
xorl %ecx, %ecx
movq %rbp, %rdx
leaq (%rcx,%rcx,2), %rsi
movsd 0xd0(%rsp,%rsi,8), %xmm0
movupd 0xd8(%rsp,%rsi,8), %xmm1
movq %rax, %rsi
xorl %edi, %edi
movsd -0x8(%rsi), %xmm2
mulsd %xmm0, %xmm2
movupd (%rsi), %xmm3
mulpd %xmm1, %xmm3
addsd %xmm3, %xmm2
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
addsd %xmm2, %xmm3
movsd %xmm3, (%rdx,%rdi,8)
incq %rdi
addq $0x18, %rsi
cmpq $0x3, %rdi
jne 0x406f89
incq %rcx
addq $0x18, %rdx
cmpq $0x3, %rcx
jne 0x406f6e
movsd 0x20(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
xorpd 0x17d167(%rip), %xmm1   # 0x584140
movhpd 0x18(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0]
addq $0x10, %rbp
xorl %eax, %eax
movupd -0x10(%rbp), %xmm2
mulpd %xmm1, %xmm2
movsd (%rbp), %xmm3
mulsd %xmm0, %xmm3
movapd %xmm2, %xmm4
unpckhpd %xmm2, %xmm4            # xmm4 = xmm4[1],xmm2[1]
addsd %xmm3, %xmm4
subsd %xmm4, %xmm2
addsd 0x50(%rsp,%rax,8), %xmm2
movsd %xmm2, (%r15,%rax,8)
incq %rax
addq $0x18, %rbp
cmpq $0x3, %rax
jne 0x406fe5
xorl %eax, %eax
xorpd %xmm0, %xmm0
ucomisd 0x30(%rsp,%rax,8), %xmm0
jbe 0x407037
movq $0x0, 0x30(%rsp,%rax,8)
xorps %xmm1, %xmm1
sqrtsd 0x30(%rsp,%rax,8), %xmm1
movsd %xmm1, 0x30(%rsp,%rax,8)
incq %rax
cmpq $0x3, %rax
jne 0x407026
movsd 0x40(%rsp), %xmm0
movapd 0x17d0e3(%rip), %xmm1   # 0x584140
xorpd %xmm0, %xmm1
xorpd %xmm2, %xmm2
cmpltsd %xmm2, %xmm9
andpd %xmm9, %xmm1
andnpd %xmm0, %xmm9
orpd %xmm1, %xmm9
addsd 0x38(%rsp), %xmm9
addsd 0x30(%rsp), %xmm9
addsd %xmm9, %xmm9
subsd %xmm9, %xmm8
maxsd %xmm2, %xmm8
movsd %xmm8, (%r8)
testl %ebx, %ebx
setg %al
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq