// File: /workspace/github_c_makefile_star2_O1/sheneman[P]clearcut/dist.c
// Function: NJ_PROTEIN_kimura_correction
void
NJ_PROTEIN_kimura_correction(DMAT *dmat,
			     NJ_alignment *alignment) {

  long int i, j;
  long int residues;
  long int diff;
  float dist;
  

  printf("NJ_PROTEIN_kimura_correction()\n");

  for(i=0;i<dmat->size;i++) {
    for(j=i+1;j<dmat->size;j++) {
      diff = NJ_pw_differences(alignment, i, j, &residues);
      
      if(!diff || !residues) {
	dist = 0.0;
      } else {
	dist = (float)diff/(float)residues;
      }
      
      if(NJ_FLT_LT(dist, 0.75)) {
	if(NJ_FLT_GT(dist, 0.0) ) {
	  dist = -log(1.0 - dist - (dist * dist/5.0) );
	}
      } else {
	if(NJ_FLT_GT(dist, 0.93) ) {
	  dist = 10.0; 
	} else {
	  dist = (float)NJ_dayhoff[ (int)((dist*1000.0)-750.0) ] / 100.0 ;
	}
      }
      
      dmat->val[NJ_MAP(i, j, dmat->size)] = dist;
    }
  }
  
  return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x3600(%rip), %rdi      # 0x855d
callq 0x20b0
cmpq $0x0, 0x8(%r14)
jle 0x5116
xorl %r12d, %r12d
leaq 0x10(%rsp), %r15
leaq 0x1(%r12), %rax
movq %rax, 0x8(%rsp)
cmpq 0x8(%r14), %rax
jge 0x5107
movq %r12, %rbp
notq %rbp
movq 0x8(%rsp), %r13
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x524c
testq %rax, %rax
setne %cl
movq 0x10(%rsp), %rdx
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
testq %rdx, %rdx
xorps %xmm0, %xmm0
cvtsi2ss %rdx, %xmm0
setne %al
divss %xmm0, %xmm1
movaps %xmm1, %xmm0
andb %cl, %al
jne 0x4fd4
xorps %xmm0, %xmm0
movaps %xmm0, %xmm2
addss 0x33e1(%rip), %xmm2     # 0x83c0
movss 0x33cd(%rip), %xmm3     # 0x83b4
ucomiss %xmm0, %xmm3
jbe 0x5066
andps 0x302d(%rip), %xmm2     # 0x8020
movss 0x300d(%rip), %xmm3     # 0x8008
ucomiss %xmm2, %xmm3
ja 0x5066
andps 0x3019(%rip), %xmm1     # 0x8020
movss 0x2ff9(%rip), %xmm2     # 0x8008
ucomiss %xmm1, %xmm2
setbe %cl
ucomiss 0x33a0(%rip), %xmm0     # 0x83bc
jbe 0x50c9
andb %cl, %al
je 0x50c9
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
movsd 0x33a7(%rip), %xmm2     # 0x83e0
subsd %xmm1, %xmm2
mulss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
divsd 0x33c3(%rip), %xmm0     # 0x8410
addsd %xmm2, %xmm0
callq 0x2140
xorps %xmm1, %xmm1
cvtsd2ss %xmm0, %xmm1
xorps 0x33cc(%rip), %xmm1     # 0x8430
jmp 0x50cc
movaps %xmm0, %xmm1
addss 0x3353(%rip), %xmm1     # 0x83c4
ucomiss 0x3350(%rip), %xmm0     # 0x83c8
jbe 0x5096
andps 0x2f9f(%rip), %xmm1     # 0x8020
movss 0x2f7f(%rip), %xmm2     # 0x8008
ucomiss %xmm1, %xmm2
movss 0x331c(%rip), %xmm1     # 0x83b0
jbe 0x50cc
cvtss2sd %xmm0, %xmm0
mulsd 0x3376(%rip), %xmm0     # 0x8418
addsd 0x3376(%rip), %xmm0     # 0x8420
cvttsd2si %xmm0, %eax
cltq
leaq 0x8089(%rip), %rcx      # 0xd140
xorps %xmm1, %xmm1
cvtsi2ssl (%rcx,%rax,4), %xmm1
divss 0x3305(%rip), %xmm1     # 0x83cc
jmp 0x50cc
movaps %xmm0, %xmm1
movq 0x8(%r14), %rax
leaq (,%rax,2), %rax
addq %rbp, %rax
imulq %r12, %rax
movq %rax, %rcx
shrq $0x3f, %rcx
addq %rax, %rcx
andq $-0x2, %rcx
addq %rcx, %rcx
addq 0x18(%r14), %rcx
movss %xmm1, (%rcx,%r13,4)
incq %r13
cmpq 0x8(%r14), %r13
jl 0x4f94
movq 0x8(%rsp), %r12
cmpq 0x8(%r14), %r12
jl 0x4f75
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq