// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/nma.c
// Function: Print_modes_old
void Print_modes_old(float *eigen_value, float **eigen_vector, float *eigen_B,
		     float *Cart_collectivity, float *Tors_collectivity,
		     int N, int N_MODES, atom *atoms, int N_atoms, int nca,
		     struct residue *seq, struct axe *axes, int N_axes,
		     char *file_name, char *deg_of_freedom,
		     float **Cart_mode, int *atom_ref, int N_ref)
{
  // Notice that eigenvectors are defined between 0 and N-1 !!

  FILE *file_out; int ia, i, n_max=N_MODES, tnm=0;
  char outfile[200];

  if(PRINT_LAMBDA){
    double sum=0; float kappa;
    sprintf(outfile, "%s_lambda.dat", file_name);
    file_out=fopen(outfile, "w");
    printf("Writing %s\n", outfile);
    kappa=Collectivity_norm1(eigen_B, N);
    fprintf(file_out, "# Reciprocal collectivity of fluctuations=  %.1f\n",
	    kappa);
    fprintf(file_out, "# mode Contr_to_fluct Cumulative lambda Coll.(cart)");
    if(Tors_collectivity)fprintf(file_out, " Coll.(tors)");
    fprintf(file_out, "\n");

    for(i=0; i<N; i++){
      if(eigen_value[i] < E_MIN)fprintf(file_out, "#");
      sum+=eigen_B[i];
      fprintf(file_out, "%3d\t%.4f\t%.3f\t%7.4g\t%.3f",
	      i, eigen_B[i], sum, eigen_value[i], Cart_collectivity[i]);
      if(Tors_collectivity)fprintf(file_out, "\t%.3f", Tors_collectivity[i]);
      fprintf(file_out, "\n");
    }
    fclose(file_out);
  }


  if(n_max==0)return;
  if(n_max > N)n_max=N;

  sprintf(outfile, "%s.dat", file_name);
  file_out=fopen(outfile, "w");
  printf("Writing normal modes to file %s\n", outfile);
  fprintf(file_out, "# %d degrees of freedom: %s\n", N, deg_of_freedom);
  fprintf(file_out, "# Contribution to fluctuation:");
  for(ia=0; ia<n_max; ia++)fprintf(file_out, "\t%.3g", eigen_B[ia]);
  fprintf(file_out, "\n");
  fprintf(file_out, "# e_values:                    ");
  for(ia=0; ia<n_max; ia++)fprintf(file_out, "\t%.3g", eigen_value[ia]);
  fprintf(file_out, "\n");

  if(strncmp(deg_of_freedom, "TNM", 3)==0)tnm=1;
  for(i=0; i<N; i++){
    fprintf(file_out, "%4d", i);
    for(ia=0; ia<n_max; ia++)fprintf(file_out, "\t%.6g", eigen_vector[ia][i]);
    if(tnm){
      fprintf(file_out, "\t%c%s", axes[i].type,
	      seq[(axes[i].bond)->atom->res].pdbres);
    }
    fprintf(file_out, "\n");
  }

  /* // Check global rotation eigenvector (only ANM)
  if(N==nca*3){
    float *ev, *r, sum; int ica;
    for(n=1; n<=n_max; n++){
      // scalar product sum_i vi*ri
      sum=0; ica=0; ev=eigen_vector[N-n];
      for(i=0; i<N_atoms; i++){
	if(strncmp(atoms[i].name, "CA", 2)!=0)continue; r=atoms[i].r;
	sum += ev[ica]*r[0]+ev[ica+1]*r[1]+ev[ica+2]*r[2];
	ica+=3;
      }
      fprintf(file_out, "# ev %d, lambda= %.4f sum(ri*vi)= %6.3f\n",
	      n, eigen_value[N-n], sum);
    }
    }*/

  fclose(file_out);

  if(tnm){
    for(ia=0; ia<n_max; ia++){
      if(eigen_value[ia] < E_MIN)continue;
      Print_PDB_3(Cart_mode[ia], eigen_value[ia], eigen_B[ia], atoms,
		  N_ref, atom_ref, seq, file_name, ia);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movl 0x68(%rbp), %eax
movq 0x60(%rbp), %rax
movq 0x58(%rbp), %rax
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movl 0x40(%rbp), %eax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movl 0x10(%rbp), %eax
movl %eax, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
leaq 0x529ea(%rip), %rax     # 0x8c0bc
cmpl $0x0, (%rax)
je 0x398a0
xorps %xmm0, %xmm0
movsd %xmm0, -0x118(%rbp)
leaq -0x110(%rbp), %rdi
movq 0x48(%rbp), %rdx
leaq 0x44d74(%rip), %rsi     # 0x7e46c
movb $0x0, %al
callq 0x1200
leaq -0x110(%rbp), %rdi
leaq 0x42c65(%rip), %rsi     # 0x7c372
callq 0x11b0
movq %rax, -0x38(%rbp)
leaq -0x110(%rbp), %rsi
leaq 0x3ddca(%rip), %rdi     # 0x774ee
movb $0x0, %al
callq 0x10d0
movq -0x18(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x15c80
movss %xmm0, -0x11c(%rbp)
movq -0x38(%rbp), %rdi
movss -0x11c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x44d24(%rip), %rsi     # 0x7e47a
movb $0x1, %al
callq 0x1150
movq -0x38(%rbp), %rdi
leaq 0x44d44(%rip), %rsi     # 0x7e4ac
movb $0x0, %al
callq 0x1150
cmpq $0x0, -0x28(%rbp)
je 0x39788
movq -0x38(%rbp), %rdi
leaq 0x44d5f(%rip), %rsi     # 0x7e4e0
movb $0x0, %al
callq 0x1150
movq -0x38(%rbp), %rdi
leaq 0x448e5(%rip), %rsi     # 0x7e078
movb $0x0, %al
callq 0x1150
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x39897
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movss (%rax,%rcx,4), %xmm1
leaq 0x528f3(%rip), %rax     # 0x8c0b4
movss (%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x397dc
movq -0x38(%rbp), %rdi
leaq 0x47f42(%rip), %rsi     # 0x81717
movb $0x0, %al
callq 0x1150
movq -0x18(%rbp), %rax
movslq -0x40(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0x118(%rbp), %xmm0
movsd %xmm0, -0x118(%rbp)
movq -0x38(%rbp), %rdi
movl -0x40(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0x40(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movsd -0x118(%rbp), %xmm1
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movss (%rax,%rcx,4), %xmm2
cvtss2sd %xmm2, %xmm2
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movss (%rax,%rcx,4), %xmm3
cvtss2sd %xmm3, %xmm3
leaq 0x44ca7(%rip), %rsi     # 0x7e4ed
movb $0x4, %al
callq 0x1150
cmpq $0x0, -0x28(%rbp)
je 0x39877
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rax
movslq -0x40(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x49349(%rip), %rsi     # 0x82bb9
movb $0x1, %al
callq 0x1150
movq -0x38(%rbp), %rdi
leaq 0x447f6(%rip), %rsi     # 0x7e078
movb $0x0, %al
callq 0x1150
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x397a1
movq -0x38(%rbp), %rdi
callq 0x10a0
cmpl $0x0, -0x44(%rbp)
jne 0x398ab
jmp 0x39b6e
movl -0x44(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jle 0x398b9
movl -0x2c(%rbp), %eax
movl %eax, -0x44(%rbp)
leaq -0x110(%rbp), %rdi
movq 0x48(%rbp), %rdx
leaq 0x488d5(%rip), %rsi     # 0x821a0
movb $0x0, %al
callq 0x1200
leaq -0x110(%rbp), %rdi
leaq 0x42a92(%rip), %rsi     # 0x7c372
callq 0x11b0
movq %rax, -0x38(%rbp)
leaq -0x110(%rbp), %rsi
leaq 0x44c0f(%rip), %rdi     # 0x7e506
movb $0x0, %al
callq 0x10d0
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %edx
movq 0x50(%rbp), %rcx
leaq 0x44c17(%rip), %rsi     # 0x7e527
movb $0x0, %al
callq 0x1150
movq -0x38(%rbp), %rdi
leaq 0x44c22(%rip), %rsi     # 0x7e544
movb $0x0, %al
callq 0x1150
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x39966
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x43049(%rip), %rsi     # 0x7c99d
movb $0x1, %al
callq 0x1150
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x39930
movq -0x38(%rbp), %rdi
leaq 0x44707(%rip), %rsi     # 0x7e078
movb $0x0, %al
callq 0x1150
movq -0x38(%rbp), %rdi
leaq 0x44be0(%rip), %rsi     # 0x7e563
movb $0x0, %al
callq 0x1150
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x399c7
movq -0x38(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x42fe8(%rip), %rsi     # 0x7c99d
movb $0x1, %al
callq 0x1150
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x39991
movq -0x38(%rbp), %rdi
leaq 0x446a6(%rip), %rsi     # 0x7e078
movb $0x0, %al
callq 0x1150
movq 0x50(%rbp), %rdi
leaq 0x3ca00(%rip), %rsi     # 0x763e4
movl $0x3, %edx
callq 0x1050
cmpl $0x0, %eax
jne 0x399fa
movl $0x1, -0x48(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x39ae0
movq -0x38(%rbp), %rdi
movl -0x40(%rbp), %edx
leaq 0x44b68(%rip), %rsi     # 0x7e583
movb $0x0, %al
callq 0x1150
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x39a67
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x40(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x44b32(%rip), %rsi     # 0x7e587
movb $0x1, %al
callq 0x1150
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x39a29
cmpl $0x0, -0x48(%rbp)
je 0x39ac0
movq -0x38(%rbp), %rdi
movq 0x38(%rbp), %rax
movslq -0x40(%rbp), %rcx
imulq $0x158, %rcx, %rcx      # imm = 0x158
addq %rcx, %rax
movsbl (%rax), %edx
movq 0x30(%rbp), %rcx
movq 0x38(%rbp), %rax
movslq -0x40(%rbp), %rsi
imulq $0x158, %rsi, %rsi      # imm = 0x158
addq %rsi, %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movslq 0x64(%rax), %rax
shlq $0x5, %rax
addq %rax, %rcx
addq $0xd, %rcx
leaq 0x44ad4(%rip), %rsi     # 0x7e58d
movb $0x0, %al
callq 0x1150
movq -0x38(%rbp), %rdi
leaq 0x445ad(%rip), %rsi     # 0x7e078
movb $0x0, %al
callq 0x1150
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x39a01
movq -0x38(%rbp), %rdi
callq 0x10a0
cmpl $0x0, -0x48(%rbp)
je 0x39b6e
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x39b6c
movq -0x8(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm1
leaq 0x525a2(%rip), %rax     # 0x8c0b4
movss (%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x39b1d
jmp 0x39b61
movq 0x58(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x8(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm1
movq 0x18(%rbp), %rsi
movl 0x68(%rbp), %edx
movq 0x60(%rbp), %rcx
movq 0x30(%rbp), %r8
movq 0x48(%rbp), %r9
movl -0x3c(%rbp), %eax
movl %eax, (%rsp)
callq 0x3a530
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x39af6
jmp 0x39b6e
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw (%rax,%rax)