// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/simulation.c
// Function: RMSD_LIN
float RMSD_LIN(float *RMSD_target, float *RMSD_full,
	       struct Jacobian *J, float *Delta_phi,
	       struct Reference Ref,
	       float *coord_ref_1, float *coord_ref_2,
	       float *coord_full)
{
  // Compute new conformation
  int N_Cart=3*Ref.N_ref;
  float RMSD=0, coord_lin[N_Cart];
  for(int i=0; i<N_Cart; i++){
    double X=coord_ref_1[i];
    for(int a=0; a<J->N_axes; a++)
      X+=J->Jacobian_ar[a][i]*Delta_phi[a];
    coord_lin[i]=X;
  }
  if(coord_ref_2){
    *RMSD_target=
      rmsd_mclachlan_f(coord_ref_2, coord_lin, Ref.mass_atom, Ref.N_ref);
  }
  if(coord_ref_1){
    RMSD=rmsd_mclachlan_f(coord_ref_1, coord_lin, Ref.mass_atom, Ref.N_ref);
  }
  if(coord_full){
    float coord_ref[N_Cart];
    Write_ref_coord(coord_ref, Ref.N_ref, coord_full, Ref.atom_num);
    *RMSD_full=
      rmsd_mclachlan_f(coord_ref, coord_lin, Ref.mass_atom, Ref.N_ref);
  }
  //printf("RMSD_lin= %.2f (ini) %.2f (end) %.2f (torsional)\n",
  //	 RMSD, *RMSD_target, *RMSD_full);
  return(RMSD);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq 0x40(%rbp), %rax
leaq 0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl (%rax), %ecx
movl %ecx, %eax
leal (%rax,%rax,2), %eax
movl %eax, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x34(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x40(%rbp)
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x78(%rbp)
movq %rcx, %rsp
movq %rax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x50a35
movq -0x28(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x50a11
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x4c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x20(%rbp), %rax
movslq -0x5c(%rbp), %rcx
mulss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
addsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x509c7
movq -0x78(%rbp), %rax
movsd -0x58(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movslq -0x4c(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x5099e
cmpq $0x0, -0x30(%rbp)
je 0x50a5f
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rax
movq -0x30(%rbp), %rdi
movq 0x10(%rax), %rdx
movl (%rax), %ecx
callq 0x70af0
cvtsd2ss %xmm0, %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x50a86
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rax
movq -0x28(%rbp), %rdi
movq 0x10(%rax), %rdx
movl (%rax), %ecx
callq 0x70af0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x38(%rbp)
cmpq $0x0, 0x40(%rbp)
je 0x50af7
movq -0x80(%rbp), %rax
movl -0x34(%rbp), %ecx
movq %rsp, %rdx
movq %rdx, -0x68(%rbp)
leaq 0xf(,%rcx,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rdi
subq %rdx, %rdi
movq %rdi, -0x88(%rbp)
movq %rdi, %rsp
movq %rcx, -0x70(%rbp)
movl (%rax), %esi
movq 0x40(%rbp), %rdx
movq 0x28(%rax), %rcx
callq 0x4a1d0
movq -0x80(%rbp), %rax
movq -0x88(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq 0x10(%rax), %rdx
movl (%rax), %ecx
callq 0x70af0
cvtsd2ss %xmm0, %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, (%rax)
movq -0x68(%rbp), %rax
movq %rax, %rsp
movss -0x38(%rbp), %xmm0
movq -0x40(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax,%rax)