// File: /workspace/github_c_makefile_star2_O3/ugobas[P]tnm/confchange.c
// Function: RMSD_Lasso_confchange
float RMSD_Lasso_confchange(float lambda, float *cnew, double *d_phi,
			    float *coord_all, float *coord_new,
			    float *c, double c2_sum,
			    struct Normal_Mode *NM, struct bond *bonds,
			    atom *atoms, int natoms,
			    struct Reference Ref, float *coord_2)
{
  int naxes=NM->N_axes, k, i; double norm=0;
  for(k=0; k<NM->N; k++){
    if(fabs(c[k])<lambda){cnew[k]=0; continue;}
    else{cnew[k]=c[k]*(1-lambda/fabs(c[k]));}
    norm+=cnew[k]*cnew[k];
  }
  norm=c2_sum/norm; for(k=0; k<NM->N; k++)if(cnew[k])cnew[k]/=norm;
  // angular distance
  for(i=0; i<naxes; i++)d_phi[i]=0;
  for(k=0; k<NM->N; k++){
    if(cnew[k]==0)continue;
    float *mode=NM->Tors[k];
    for(i=0; i<naxes; i++)d_phi[i]+=cnew[k]*mode[i];
  }
  Set_bonds_measure(bonds, natoms, atoms);
  Build_up(bonds, natoms, d_phi, naxes);
  Put_coord(coord_all, bonds, natoms);
  Write_ref_coord(coord_new, Ref.N_ref, coord_all, Ref.atom_num);
  float rmsd2=rmsd_mclachlan_f(coord_2, coord_new, Ref.mass_atom, Ref.N_ref);
  return(rmsd2);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r13
movq %rcx, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, %r15
movq %rdi, %rbp
movl 0x8(%r9), %r12d
movslq (%r9), %rbx
testq %rbx, %rbx
jle 0x31fc6
cvtss2sd %xmm0, %xmm2
xorps %xmm0, %xmm0
xorl %eax, %eax
movaps 0x253b6(%rip), %xmm3    # 0x572f0
movsd 0x1f206(%rip), %xmm4    # 0x51148
xorps %xmm6, %xmm6
cvtss2sd (%r8,%rax,4), %xmm6
movaps %xmm6, %xmm7
andps %xmm3, %xmm7
xorps %xmm5, %xmm5
ucomisd %xmm7, %xmm2
ja 0x31f84
movapd %xmm2, %xmm5
divsd %xmm7, %xmm5
movapd %xmm4, %xmm7
subsd %xmm5, %xmm7
mulsd %xmm6, %xmm7
xorps %xmm5, %xmm5
cvtsd2ss %xmm7, %xmm5
movaps %xmm5, %xmm6
mulss %xmm5, %xmm6
cvtss2sd %xmm6, %xmm6
addsd %xmm6, %xmm0
movss %xmm5, (%rbp,%rax,4)
incq %rax
cmpq %rax, %rbx
jne 0x31f42
testl %ebx, %ebx
jle 0x31fc6
divsd %xmm0, %xmm1
xorl %eax, %eax
xorps %xmm0, %xmm0
movss (%rbp,%rax,4), %xmm2
ucomiss %xmm0, %xmm2
jne 0x31fac
jnp 0x31fbe
cvtss2sd %xmm2, %xmm2
divsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm2
movss %xmm2, (%rbp,%rax,4)
incq %rax
cmpq %rax, %rbx
jne 0x31f9f
testl %r12d, %r12d
jle 0x31fdd
leaq (,%r12,8), %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x2110
movl 0x60(%rsp), %esi
movq 0x58(%rsp), %rdx
movq 0x50(%rsp), %r14
testl %ebx, %ebx
jle 0x32039
xorl %eax, %eax
xorps %xmm0, %xmm0
movss (%rbp,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0x32001
jnp 0x32031
testl %r12d, %r12d
jle 0x32031
movq 0x40(%r13), %rcx
movq (%rcx,%rax,8), %rcx
xorl %edi, %edi
movss (%rcx,%rdi,4), %xmm2
mulss %xmm1, %xmm2
cvtss2sd %xmm2, %xmm2
addsd (%r15,%rdi,8), %xmm2
movsd %xmm2, (%r15,%rdi,8)
incq %rdi
cmpq %rdi, %r12
jne 0x32010
incq %rax
cmpq %rbx, %rax
jne 0x31ff4
movq %r14, %rdi
movl %esi, %ebx
callq 0x14cf3
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x15083
movq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x326eb
leaq 0x68(%rsp), %r12
movl (%r12), %ebx
movq 0x28(%r12), %rcx
movq 0x10(%rsp), %r14
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x32d7a
movq 0x10(%r12), %rdx
movq 0x98(%rsp), %rdi
movq %r14, %rsi
movl %ebx, %ecx
callq 0x4dfa0
cvtsd2ss %xmm0, %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop