// File: /workspace/github_c_makefile_star2_O2/ugobas[P]tnm/mutation.c
// Function: Normalize_parameters
void Normalize_parameters()
{
  // a.a. 20 = gap
  double E1=0, E2=0, D1=0, D2=0, na1=0, na2=0;
  int a, b, n=21;
  for(a=0; a<=20; a++){
    na1+=atom_numb[a];
    na2+=atom_numb[a]*atom_numb[a];
  }
  na1/=n; na2=sqrt(na2/n-na1*na1);
  for(a=0; a<=20; a++){
    natm_norm[a]=(atom_numb[a]-na1)/na2;
  }
  // E(gap)=0; D(gap)=min D_Res
  n=230;
  double D_min=1000;
  for(a=0; a<20; a++){
    for(b=0; b<=a; b++){
      E1+=Econt[a][b];
      E2+=Econt[a][b]*Econt[a][b];
      D1+=D_Res[a][b];
      D2+=D_Res[a][b]*D_Res[a][b];
      if(D_Res[a][b]<D_min)D_min=D_Res[a][b];
    }
  }
  E1/=n; E2=sqrt(E2/n-E1*E1);
  D1+=D_min*20; D2+=D_min*D_min*20;
  D1/=n; D2=sqrt(D2/n-D1*D1);
  float E_gap=-E1/E2;
  float D_gap=(D_min-D1)/D2;
  for(a=0; a<20; a++){
    for(b=0; b<20; b++){
      Econt_norm[a][b]=(Econt[a][b]-E1)/E2;
      D_Res_norm[a][b]=(D_Res[a][b]-D1)/D2;
    }
    Econt_norm[a][20]=E_gap;
    Econt_norm[20][a]=E_gap;
    D_Res_norm[a][20]=D_gap;
    D_Res_norm[20][a]=D_gap;
  }
  printf("Parameters of mutation model type, ave, s.d.:\n");
  printf("SIZE natom: %.3g %.3g\n\n", na1, na2);
  printf("DIST D_Res: %.3g %.3g\n", D1, D2);
  printf("STAB Econt: %.3g %.3g\n", E1, E2);
}

// Assembly:
pushq %rbx
subq $0x50, %rsp
xorpd %xmm2, %xmm2
xorl %eax, %eax
leaq 0x29b07(%rip), %rbx     # 0x63ef0
xorpd %xmm0, %xmm0
cmpq $0x54, %rax
je 0x3a40f
movl (%rax,%rbx), %ecx
cvtsi2sd %ecx, %xmm1
addsd %xmm1, %xmm2
imull %ecx, %ecx
cvtsi2sd %ecx, %xmm1
addsd %xmm1, %xmm0
addq $0x4, %rax
jmp 0x3a3ed
movsd 0x1baf1(%rip), %xmm1    # 0x55f08
divsd %xmm1, %xmm2
divsd %xmm1, %xmm0
movapd %xmm2, %xmm1
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movsd %xmm2, 0x18(%rsp)
jb 0x3a441
sqrtsd %xmm0, %xmm3
jmp 0x3a450
callq 0x2290
movsd 0x18(%rsp), %xmm2
movapd %xmm0, %xmm3
xorl %eax, %eax
leaq 0x3a797(%rip), %rcx     # 0x74bf0
cmpq $0x54, %rax
je 0x3a47b
cvtsi2sdl (%rax,%rbx), %xmm0
subsd %xmm2, %xmm0
divsd %xmm3, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rax,%rcx)
addq $0x4, %rax
jmp 0x3a459
leaq 0x29cfe(%rip), %rbx     # 0x64180
movq (%rbx), %rax
movsd 0x1ba83(%rip), %xmm5    # 0x55f10
xorpd %xmm6, %xmm6
pushq $0x1
popq %rcx
leaq 0x2a335(%rip), %rdx     # 0x647d0
xorl %esi, %esi
xorpd %xmm7, %xmm7
xorpd %xmm0, %xmm0
xorpd %xmm4, %xmm4
cmpq $0x14, %rsi
je 0x3a508
movq (%rax,%rsi,8), %rdi
xorl %r8d, %r8d
cmpq %r8, %rcx
je 0x3a4fc
movss (%rdi,%r8,4), %xmm1
cvtss2sd %xmm1, %xmm2
addsd %xmm2, %xmm4
mulss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
addsd %xmm1, %xmm0
movss (%rdx,%r8,4), %xmm1
cvtss2sd %xmm1, %xmm2
addsd %xmm2, %xmm6
mulss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
addsd %xmm1, %xmm7
minsd %xmm5, %xmm2
incq %r8
movapd %xmm2, %xmm5
jmp 0x3a4b6
incq %rsi
incq %rcx
addq $0x50, %rdx
jmp 0x3a4a9
movsd 0x1ba08(%rip), %xmm2    # 0x55f18
divsd %xmm2, %xmm4
divsd %xmm2, %xmm0
movapd 0x10ba0(%rip), %xmm1    # 0x4b0c0
xorpd %xmm4, %xmm1
movapd %xmm1, 0x40(%rsp)
movapd %xmm4, %xmm1
mulsd %xmm4, %xmm1
subsd %xmm1, %xmm0
xorpd %xmm9, %xmm9
ucomisd %xmm9, %xmm0
movsd %xmm3, 0x38(%rsp)
movapd %xmm4, 0x20(%rsp)
movsd %xmm5, (%rsp)
jb 0x3a559
sqrtsd %xmm0, %xmm4
jmp 0x3a58c
movsd %xmm6, 0x10(%rsp)
movsd %xmm7, 0x8(%rsp)
callq 0x2290
xorpd %xmm9, %xmm9
movsd 0x1b9a1(%rip), %xmm2    # 0x55f18
movsd 0x8(%rsp), %xmm7
movsd 0x10(%rsp), %xmm6
movsd (%rsp), %xmm5
movapd %xmm0, %xmm4
movsd 0x16d2c(%rip), %xmm1    # 0x512c0
movapd %xmm5, %xmm8
mulsd %xmm1, %xmm8
addsd %xmm6, %xmm8
movapd %xmm5, %xmm0
mulsd %xmm5, %xmm0
mulsd %xmm1, %xmm0
addsd %xmm7, %xmm0
divsd %xmm2, %xmm8
divsd %xmm2, %xmm0
movapd %xmm8, %xmm1
mulsd %xmm8, %xmm1
subsd %xmm1, %xmm0
ucomisd %xmm9, %xmm0
movsd %xmm4, 0x10(%rsp)
movsd %xmm8, 0x8(%rsp)
jb 0x3a5e4
sqrtsd %xmm0, %xmm0
jmp 0x3a5fb
callq 0x2290
movsd 0x8(%rsp), %xmm8
movsd 0x10(%rsp), %xmm4
movsd (%rsp), %xmm5
movapd 0x20(%rsp), %xmm3
movapd 0x40(%rsp), %xmm1
divsd %xmm4, %xmm1
cvtsd2ss %xmm1, %xmm6
subsd %xmm8, %xmm5
divsd %xmm0, %xmm5
cvtsd2ss %xmm5, %xmm1
movq (%rbx), %rax
leaq 0x2a1aa(%rip), %rcx     # 0x647d0
xorl %edx, %edx
leaq 0x3a621(%rip), %rsi     # 0x74c50
leaq 0x3ad0a(%rip), %rdi     # 0x75340
xorl %r8d, %r8d
cmpq $0x14, %r8
je 0x3a6bd
movq (%rax,%r8,8), %r9
xorl %r10d, %r10d
cmpq $0x50, %r10
je 0x3a687
cvtss2sd (%r9,%r10), %xmm2
subsd %xmm3, %xmm2
divsd %xmm4, %xmm2
cvtsd2ss %xmm2, %xmm2
leaq (%rdx,%r10), %r11
movss %xmm2, (%rsi,%r11)
cvtss2sd (%rcx,%r10), %xmm2
subsd %xmm8, %xmm2
divsd %xmm0, %xmm2
cvtsd2ss %xmm2, %xmm2
movss %xmm2, (%rdi,%r11)
addq $0x4, %r10
jmp 0x3a646
imulq $0x54, %r8, %r9
movss %xmm6, 0x50(%r9,%rsi)
movss %xmm6, 0x690(%rsi,%r8,4)
movss %xmm1, 0x50(%r9,%rdi)
movss %xmm1, 0x690(%rdi,%r8,4)
incq %r8
addq $0x54, %rdx
addq $0x50, %rcx
jmp 0x3a639
leaq 0x1c46c(%rip), %rdi     # 0x56b30
movsd %xmm0, (%rsp)
callq 0x2090
leaq 0x1c1b9(%rip), %rdi     # 0x5688e
movsd 0x18(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
movb $0x2, %al
callq 0x20f0
leaq 0x1c1b7(%rip), %rdi     # 0x568a6
movsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm1
movb $0x2, %al
callq 0x20f0
leaq 0x1c1b5(%rip), %rdi     # 0x568bd
movaps 0x20(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movb $0x2, %al
addq $0x50, %rsp
popq %rbx
jmp 0x20f0