// File: /workspace/github_c_makefile_star2_O3/ugobas[P]tnm/output_tnm.c
// Function: Print_PDB_mode_old
int Print_PDB_mode_old(char *nameout, int ia, float *Cart_mode,
		       float Amplitude, float Cart_collectivity,
		       float Tors_collectivity, float MW_Tors_collectivity,
		       float eigen_value, float eigen_B,
		       atom *atoms, int natoms, struct residue *seq, int nres,
		       int *atom_num, int N_ref)
{
//Print_PDB_3(Cart_mode[ia], eigen_value[ia], eigen_B[ia], atoms,
//		  N_ref, atom_ref, seq, file_name, ia);
  FILE *file_out;  char outfile[200];
  //~ FILE * CHAIN[2];
  int i, j, k; atom *atom1=atoms;
  char aaname3[10];   float r[3];
  // Amplitude factors
  //~ float DTHETA=0;
  //~ float AMPL_FACTOR=16; // Amplification with respect to thermal fluctuations
  //~ float AMAX=120;      // New amplitude factor
  //~ float step, dtheta;
  //~ int N_STEP=10; // Number of conformations per normal mode
  //~ int i_step;
  //~ double norm;

  for(i=0; i<10; i++)aaname3[i]='\0';

  // Opening file
  sprintf(outfile, "%s_modes.pdb", nameout);
  if(ia<1){
    file_out=fopen(outfile, "w");
    printf("Writing normal modes in PDB format in %s\n", outfile);
    fprintf(file_out, "MODEL 0:  Native structure\n");
  }else{
    file_out=fopen(outfile, "a");
    fprintf(file_out, "MODEL %d\n", ia+1);
    fprintf(file_out, "REMARK  Normal mode %3d  Percent fluctuation= %.2f",
	    ia, eigen_B*100.0);
    fprintf(file_out,
	    "REMARK Collectivity: "
	    "Cartesian %.3f Torsional %.3f MW_Torsional %.3f\n",
	    Cart_collectivity, Tors_collectivity, MW_Tors_collectivity);
  }

  // Compute and print
  int jatom=0;
  for(i=0; i<N_ref; i++){
    int m=3*i;
    atom1=atoms+atom_num[i];
    for(j=0; j<3; j++){
      r[j]=atom1->r[j];
      if(ia>=0)r[j]+=Cart_mode[m+j]*Amplitude;
    }
    k=atom1->res; Name3(aaname3, seq[k].i_aa);
    if(jatom <99999)jatom++;
    fprintf(file_out,
	    "ATOM  %5d%4s  %3s %c%4s   %8.3f%8.3f%8.3f%6.2f%6.2f\n",
	    jatom, atom1->name, aaname3, chain,
	    seq[k].pdbres,  r[0], r[1], r[2], 1.0, atom1->B_factor);
    atom1=atoms+atom1->i_next;
  }
  fprintf(file_out, "ENDMDL\n");
  fclose(file_out);
  return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %r9, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movss %xmm5, 0x18(%rsp)
movss %xmm3, 0x8(%rsp)
movss %xmm2, 0x10(%rsp)
movss %xmm1, 0x1c(%rsp)
movss %xmm0, 0x20(%rsp)
movq %rdx, %r15
movl %esi, %r12d
movq %rdi, %rdx
movl 0x160(%rsp), %ebp
movq $0x0, 0x30(%rsp)
movw $0x0, 0x38(%rsp)
leaq 0x1b615(%rip), %rsi     # 0x5cdb2
leaq 0x50(%rsp), %rdi
xorl %eax, %eax
callq 0x2270
testl %r12d, %r12d
jle 0x41834
leaq 0x183a2(%rip), %rsi     # 0x59b5b
leaq 0x50(%rsp), %rdi
callq 0x2220
movq %rax, %rbx
leal 0x1(%r12), %edx
leaq 0x17a41(%rip), %rsi     # 0x59213
movq %rax, %rdi
xorl %eax, %eax
callq 0x21a0
xorps %xmm0, %xmm0
cvtss2sd 0x18(%rsp), %xmm0
mulsd 0x156f3(%rip), %xmm0    # 0x56ee0
leaq 0x179c1(%rip), %rsi     # 0x591b5
movq %rbx, %rdi
movl %r12d, %edx
movb $0x1, %al
callq 0x21a0
xorps %xmm0, %xmm0
cvtss2sd 0x1c(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x10(%rsp), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x8(%rsp), %xmm2
leaq 0x1b5b8(%rip), %rsi     # 0x5cddb
movq %rbx, 0x8(%rsp)
movq %rbx, %rdi
movb $0x3, %al
callq 0x21a0
jmp 0x4187a
leaq 0x159c5(%rip), %rsi     # 0x57200
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
callq 0x2220
movq %rax, %r14
leaq 0x17939(%rip), %rdi     # 0x5918b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20f0
leaq 0x1b55c(%rip), %rdi     # 0x5cdbf
movl $0x1b, %esi
movl $0x1, %edx
movq %r14, 0x8(%rsp)
movq %r14, %rcx
callq 0x2290
testl %ebp, %ebp
jle 0x41978
movl %ebp, %eax
movq %rax, 0x10(%rsp)
xorl %r13d, %r13d
xorl %r14d, %r14d
movq 0x158(%rsp), %rax
movslq (%rax,%r13,4), %rax
imulq $0x70, %rax, %rbx
addq 0x40(%rsp), %rbx
xorl %eax, %eax
movss 0x20(%rsp), %xmm2
xorps %xmm0, %xmm0
cvtsd2ss (%rbx,%rax,8), %xmm0
movss %xmm0, 0x24(%rsp,%rax,4)
testl %r12d, %r12d
js 0x418d3
movss (%r15,%rax,4), %xmm1
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movss %xmm1, 0x24(%rsp,%rax,4)
incq %rax
cmpq $0x3, %rax
jne 0x418ac
movslq 0x64(%rbx), %rax
shlq $0x5, %rax
movq 0x48(%rsp), %rcx
leaq (%rcx,%rax), %rbp
addq $0xd, %rbp
movswl 0x7(%rbp), %esi
leaq 0x30(%rsp), %rdi
callq 0x26d50
cmpl $0x1869f, %r14d         # imm = 0x1869F
adcl $0x0, %r14d
xorps %xmm0, %xmm0
cvtss2sd 0x24(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x28(%rsp), %xmm1
xorps %xmm2, %xmm2
cvtss2sd 0x2c(%rsp), %xmm2
leaq 0x37abc(%rip), %rax     # 0x793e8
movsbl (%rax), %r9d
xorps %xmm4, %xmm4
cvtss2sd 0x1c(%rbx), %xmm4
addq $0x18, %rbx
movq %rbp, (%rsp)
movq 0x8(%rsp), %rdi
leaq 0x178d1(%rip), %rsi     # 0x5921d
movl %r14d, %edx
movq %rbx, %rcx
leaq 0x30(%rsp), %r8
movsd 0xf7e9(%rip), %xmm3     # 0x51148
movb $0x5, %al
callq 0x21a0
incq %r13
addq $0xc, %r15
cmpq 0x10(%rsp), %r13
jne 0x4188f
leaq 0x178d3(%rip), %rdi     # 0x59252
movl $0x7, %esi
movl $0x1, %edx
movq 0x8(%rsp), %rbx
movq %rbx, %rcx
callq 0x2290
movq %rbx, %rdi
callq 0x20c0
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq