// File: /workspace/github_c_makefile_star2_O2/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
pushq %rax
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r12
movl 0x50(%rsp), %ebp
movq 0x48(%rsp), %rdx
movq 0x40(%rsp), %r13
movl (%r9), %eax
movl 0x8(%r9), %r14d
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cvtss2sd %xmm0, %xmm2
xorps %xmm0, %xmm0
movaps 0x22550(%rip), %xmm3    # 0x51240
movsd 0x1c350(%rip), %xmm4    # 0x4b048
cmpq %rcx, %rax
je 0x2ed43
cvtss2sd (%r8,%rcx,4), %xmm6
movaps %xmm6, %xmm7
andps %xmm3, %xmm7
xorps %xmm5, %xmm5
ucomisd %xmm7, %xmm2
ja 0x2ed39
movapd %xmm2, %xmm5
divsd %xmm7, %xmm5
movapd %xmm4, %xmm7
subsd %xmm5, %xmm7
mulsd %xmm6, %xmm7
cvtsd2ss %xmm7, %xmm5
movaps %xmm5, %xmm6
mulss %xmm5, %xmm6
cvtss2sd %xmm6, %xmm6
addsd %xmm6, %xmm0
movss %xmm5, (%rdi,%rcx,4)
incq %rcx
jmp 0x2ecf8
divsd %xmm0, %xmm1
xorl %ecx, %ecx
xorps %xmm0, %xmm0
cmpq %rcx, %rax
je 0x2ed73
movss (%rdi,%rcx,4), %xmm2
ucomiss %xmm0, %xmm2
jne 0x2ed5d
jnp 0x2ed6e
cvtss2sd %xmm2, %xmm2
divsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm2
movss %xmm2, (%rdi,%rcx,4)
incq %rcx
jmp 0x2ed4c
xorl %esi, %esi
testl %r14d, %r14d
movl $0x0, %ecx
cmovgl %r14d, %ecx
cmpq %rsi, %rcx
je 0x2ed90
andq $0x0, (%r12,%rsi,8)
incq %rsi
jmp 0x2ed81
xorl %esi, %esi
xorps %xmm0, %xmm0
cmpq %rax, %rsi
je 0x2edda
movss (%rdi,%rsi,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0x2edab
jp 0x2edab
incq %rsi
jmp 0x2ed95
movq 0x40(%r9), %r8
movq (%r8,%rsi,8), %r8
xorl %r10d, %r10d
cmpq %r10, %rcx
je 0x2eda6
movss (%r8,%r10,4), %xmm2
mulss %xmm1, %xmm2
cvtss2sd %xmm2, %xmm2
addsd (%r12,%r10,8), %xmm2
movsd %xmm2, (%r12,%r10,8)
incq %r10
jmp 0x2edb6
movq %r13, %rdi
movl %ebp, %esi
callq 0x139f6
movq %r13, %rdi
movl %ebp, %esi
movq %r12, %rdx
movl %r14d, %ecx
callq 0x13d70
movq %r15, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x2f358
leaq 0x58(%rsp), %r14
movl (%r14), %ebp
movq 0x28(%r14), %rcx
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rdx
callq 0x2f9b8
movq 0x10(%r14), %rdx
movq 0x88(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %ecx
callq 0x47a64
cvtsd2ss %xmm0, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop