// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x580e(%rip), %rdi      # 0xb535
movb $0x0, %al
callq 0x20e0
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x5f04
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x5ef1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x28(%rbp), %rcx
callq 0x6110
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x5d8d
cmpq $0x0, -0x28(%rbp)
jne 0x5d97
xorps %xmm0, %xmm0
movss %xmm0, -0x34(%rbp)
jmp 0x5dac
cvtsi2ssq -0x30(%rbp), %xmm0
cvtsi2ssq -0x28(%rbp), %xmm1
divss %xmm1, %xmm0
movss %xmm0, -0x34(%rbp)
movss -0x34(%rbp), %xmm0
movss 0x55ff(%rip), %xmm1     # 0xb3b8
callq 0x6490
cmpl $0x0, %eax
je 0x5e2f
movss -0x34(%rbp), %xmm0
xorps %xmm1, %xmm1
callq 0x61f0
cmpl $0x0, %eax
je 0x5e2d
movss -0x34(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x5222(%rip), %xmm0     # 0xb008
subsd %xmm1, %xmm0
movss -0x34(%rbp), %xmm1
mulss -0x34(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0x5610(%rip), %xmm2     # 0xb410
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
callq 0x2120
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x34(%rbp)
jmp 0x5ea4
movss -0x34(%rbp), %xmm0
movss 0x5584(%rip), %xmm1     # 0xb3c0
callq 0x61f0
cmpl $0x0, %eax
je 0x5e55
movss 0x556e(%rip), %xmm0     # 0xb3bc
movss %xmm0, -0x34(%rbp)
jmp 0x5ea2
movss -0x34(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x559a(%rip), %xmm1     # 0xb400
mulsd %xmm1, %xmm0
movsd 0x5596(%rip), %xmm1     # 0xb408
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movslq %eax, %rcx
leaq 0x929c(%rip), %rax      # 0xf120
cvtsi2ssl (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x5563(%rip), %xmm1     # 0xb3f8
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x34(%rbp)
jmp 0x5ea4
movss -0x34(%rbp), %xmm0
movss %xmm0, -0x44(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x60d0
movss -0x44(%rbp), %xmm0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movss %xmm0, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x5d54
jmp 0x5ef3
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x5d36
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)