// File: /workspace/github_c_makefile_star2_O1/ugobas[P]tnm/kinetic_tnm.c
// Function: Test_Eckart
int Test_Eckart(float *Cart_dev, atom *atoms, int N_atoms,
		 struct Reference Ref, int mode, struct axe *axe)
{
  // r_sum = sum_i m_i Delta_r_i
  // r_rot = sum_i r_i X Delta_r_i
  double r_sum[3], r_rot_sum[3], norm=0;
  double r_rot[3], r1=0, r2=0, x[3];
  int iref, j, jj=0;
  for(j=0; j<3; j++){r_sum[j]=0; r_rot_sum[j]=0;}
  for(iref=0; iref< Ref.N_ref; iref++){
    atom *atom1=atoms+Ref.atom_num[iref];
    double m = Ref.mass_atom[iref];
    for(j=0; j<3; j++){x[j]=Cart_dev[jj]; r_sum[j]+=m*x[j]; jj++;}
    Vector_product_d(r_rot, atom1->r, x);
    for(j=0; j<3; j++)r_rot_sum[j]+=m*r_rot[j];
    norm+=m;
  }
  for(j=0; j<3; j++){
    r1+= r_sum[j]*r_sum[j];
    r2+= r_rot_sum[j]*r_rot_sum[j];
  }
  r1=sqrt(r1)/norm; r2=sqrt(r2)/norm;
  if((r1>0.001)||(r2>0.001)){
    printf("%3d %c <d>= %.8f <r_X_d>= %.8f\n", mode, axe->type, r1, r2);
    return(1);
  }
  return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r8, 0x18(%rsp)
movl %ecx, 0x14(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
xorl %eax, %eax
movq %rax, 0x60(%rsp)
movapd %xmm0, 0x30(%rsp)
movq %rax, 0x40(%rsp)
movslq 0xe0(%rsp), %rbx
xorpd %xmm3, %xmm3
xorpd %xmm2, %xmm2
testq %rbx, %rbx
jle 0x23631
leaq 0xe0(%rsp), %rax
movq 0x10(%rax), %r14
movq 0x28(%rax), %r13
xorl %ebp, %ebp
xorl %r15d, %r15d
movsd %xmm2, 0x8(%rsp)
xorps %xmm1, %xmm1
cvtss2sd (%r14,%rbp,4), %xmm1
movslq (%r13,%rbp,4), %rax
movslq %r15d, %r15
movq 0x20(%rsp), %rcx
leaq (%rcx,%r15,4), %rcx
xorl %r12d, %r12d
xorps %xmm0, %xmm0
cvtss2sd (%rcx,%r12,4), %xmm0
movsd %xmm0, 0x70(%rsp,%r12,8)
mulsd %xmm1, %xmm0
addsd 0x50(%rsp,%r12,8), %xmm0
movsd %xmm0, 0x50(%rsp,%r12,8)
incq %r12
cmpq $0x3, %r12
jne 0x235a0
imulq $0x70, %rax, %rsi
addq 0x28(%rsp), %rsi
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rdx
movsd %xmm1, (%rsp)
callq 0x1086b
movsd (%rsp), %xmm1
addq %r12, %r15
xorl %eax, %eax
movsd 0x90(%rsp,%rax,8), %xmm0
mulsd %xmm1, %xmm0
addsd 0x30(%rsp,%rax,8), %xmm0
movsd %xmm0, 0x30(%rsp,%rax,8)
incq %rax
cmpq $0x3, %rax
jne 0x235f5
movsd 0x8(%rsp), %xmm2
addsd %xmm1, %xmm2
incq %rbp
cmpq %rbx, %rbp
xorpd %xmm3, %xmm3
jne 0x2357d
xorl %eax, %eax
xorpd %xmm0, %xmm0
movsd 0x50(%rsp,%rax,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
movsd 0x30(%rsp,%rax,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm3
incq %rax
cmpq $0x3, %rax
jne 0x23637
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movsd %xmm2, 0x8(%rsp)
jb 0x23672
sqrtsd %xmm0, %xmm0
jmp 0x2368b
movsd %xmm3, (%rsp)
callq 0x2290
xorpd %xmm1, %xmm1
movsd (%rsp), %xmm3
movsd 0x8(%rsp), %xmm2
divsd %xmm2, %xmm0
ucomisd %xmm1, %xmm3
jb 0x2369e
xorps %xmm1, %xmm1
sqrtsd %xmm3, %xmm1
jmp 0x236bb
movsd %xmm0, (%rsp)
movapd %xmm3, %xmm0
callq 0x2290
movsd 0x8(%rsp), %xmm2
movapd %xmm0, %xmm1
movsd (%rsp), %xmm0
divsd %xmm2, %xmm1
ucomisd 0x33cd9(%rip), %xmm0    # 0x573a0
ja 0x236d5
xorl %eax, %eax
ucomisd 0x33ccd(%rip), %xmm1    # 0x573a0
jbe 0x236f4
movq 0x18(%rsp), %rax
movsbl (%rax), %edx
leaq 0x3520e(%rip), %rdi     # 0x588f2
movl 0x14(%rsp), %esi
movb $0x2, %al
callq 0x20f0
movl $0x1, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq