// File: /workspace/github_c_makefile_star2_O0/asford[P]tmalign/./TMalign.h
// Function: score_fun8(double**, double**, int, double, int*, double*, int)
int score_fun8( double **xa, 
                double **ya, 
                int n_ali,
                double d,
                int i_ali[], 
                double *score1,
                int score_sum_method
              )
{
    double score_sum=0, di;
    double d_tmp=d*d;
	double d02=d0*d0;
	double score_d8_cut = score_d8*score_d8;
    
    int i, n_cut, inc=0;

    while(1)
    {
		n_cut=0;
        score_sum=0;
        for(i=0; i<n_ali; i++)
        {
            di = dist(xa[i], ya[i]);
            if(di<d_tmp)
            {
                i_ali[n_cut]=i;
                n_cut++;
            }
            if(score_sum_method==8)
            {				
                if(di<=score_d8_cut)
                {					
                    score_sum += 1/(1+di/d02);
                }                
            }
            else
            {
				score_sum += 1/(1+di/d02);
            }
        }
        //there are not enough feasible pairs, reliefe the threshold 		
        if(n_cut<3 && n_ali>3)
        {
			inc++;
			double dinc=(d+inc*0.5);
			d_tmp = dinc * dinc;
        }
        else
        {
            break;
        }

    }  

    *score1=score_sum/Lnorm;

    return n_cut;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movl %edx, 0x64(%rsp)
movsd %xmm0, 0x58(%rsp)
movq %rcx, 0x50(%rsp)
movq %r8, 0x48(%rsp)
movl %r9d, 0x44(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x58(%rsp), %xmm0
mulsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x200f46(%rip), %xmm0   # 0x60a580
mulsd 0x200f3e(%rip), %xmm0   # 0x60a580
movsd %xmm0, 0x20(%rsp)
movsd 0x200f28(%rip), %xmm0   # 0x60a578
mulsd 0x200f20(%rip), %xmm0   # 0x60a578
movsd %xmm0, 0x18(%rsp)
movl $0x0, 0xc(%rsp)
movl $0x0, 0x10(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x64(%rsp), %eax
jge 0x40976f
movq 0x70(%rsp), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x68(%rsp), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x406000
movsd %xmm0, 0x30(%rsp)
movsd 0x30(%rsp), %xmm1
movsd 0x28(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x4096e2
movl 0x14(%rsp), %edx
movq 0x50(%rsp), %rax
movslq 0x10(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
cmpl $0x8, 0x44(%rsp)
jne 0x40972d
movsd 0x30(%rsp), %xmm1
movsd 0x18(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x40972b
movsd 0x30(%rsp), %xmm0
divsd 0x20(%rsp), %xmm0
movsd 0x1828f9(%rip), %xmm1   # 0x58c008
addsd %xmm0, %xmm1
movsd 0x1828ed(%rip), %xmm0   # 0x58c008
divsd %xmm1, %xmm0
addsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
jmp 0x40975d
movsd 0x30(%rsp), %xmm0
divsd 0x20(%rsp), %xmm0
movsd 0x1828c7(%rip), %xmm1   # 0x58c008
addsd %xmm0, %xmm1
movsd 0x1828bb(%rip), %xmm0   # 0x58c008
divsd %xmm1, %xmm0
addsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
jmp 0x40975f
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x40967f
cmpl $0x3, 0x10(%rsp)
jge 0x4097bb
cmpl $0x3, 0x64(%rsp)
jle 0x4097bb
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
movsd 0x58(%rsp), %xmm0
cvtsi2sdl 0xc(%rsp), %xmm1
movsd 0x18289c(%rip), %xmm2   # 0x58c038
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movsd (%rsp), %xmm0
mulsd (%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
jmp 0x4097bd
jmp 0x4097c2
jmp 0x409666
movsd 0x38(%rsp), %xmm0
divsd 0x200da0(%rip), %xmm0   # 0x60a570
movq 0x48(%rsp), %rax
movsd %xmm0, (%rax)
movl 0x10(%rsp), %eax
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)