// File: /workspace/github_c_makefile_star2_O1/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 0x323f2
cvtss2sd %xmm0, %xmm2
xorps %xmm0, %xmm0
xorl %eax, %eax
movaps 0x24f9c(%rip), %xmm3    # 0x57330
movsd 0x1eca4(%rip), %xmm4    # 0x51040
xorps %xmm5, %xmm5
cvtss2sd (%r8,%rax,4), %xmm5
movaps %xmm5, %xmm6
andps %xmm3, %xmm6
ucomisd %xmm6, %xmm2
jbe 0x323bb
movl $0x0, (%rbp,%rax,4)
jmp 0x323e8
movapd %xmm2, %xmm7
divsd %xmm6, %xmm7
movapd %xmm4, %xmm6
subsd %xmm7, %xmm6
mulsd %xmm5, %xmm6
xorps %xmm5, %xmm5
cvtsd2ss %xmm6, %xmm5
movss %xmm5, (%rbp,%rax,4)
mulss %xmm5, %xmm5
cvtss2sd %xmm5, %xmm5
addsd %xmm5, %xmm0
incq %rax
cmpq %rax, %rbx
jne 0x3239c
jmp 0x323f5
xorps %xmm0, %xmm0
testl %ebx, %ebx
jle 0x32429
divsd %xmm0, %xmm1
xorl %eax, %eax
xorps %xmm0, %xmm0
movss (%rbp,%rax,4), %xmm2
ucomiss %xmm0, %xmm2
jne 0x3240f
jnp 0x32421
cvtss2sd %xmm2, %xmm2
divsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm2
movss %xmm2, (%rbp,%rax,4)
incq %rax
cmpq %rax, %rbx
jne 0x32402
testl %r12d, %r12d
jle 0x32440
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 0x3249c
xorl %eax, %eax
xorps %xmm0, %xmm0
movss (%rbp,%rax,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0x32464
jnp 0x32494
testl %r12d, %r12d
jle 0x32494
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 0x32473
incq %rax
cmpq %rbx, %rax
jne 0x32457
movq %r14, %rdi
movl %esi, %ebx
callq 0x1512b
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x154bb
movq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x32b1e
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 0x33198
movq 0x10(%r12), %rdx
movq 0x98(%rsp), %rdi
movq %r14, %rsi
movl %ebx, %ecx
callq 0x4e010
cvtsd2ss %xmm0, %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop