// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xe0, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x88(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x90(%rbp)
movl $0x0, -0xbc(%rbp)
movl $0x0, -0xb8(%rbp)
cmpl $0x3, -0xb8(%rbp)
jge 0x310b4
movslq -0xb8(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp,%rax,8)
movslq -0xb8(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp,%rax,8)
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x3107a
movl $0x0, -0xb4(%rbp)
movq -0xd8(%rbp), %rcx
movl -0xb4(%rbp), %eax
cmpl (%rcx), %eax
jge 0x31232
movq -0xd8(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x28(%rax), %rdx
movslq -0xb4(%rbp), %rsi
movslq (%rdx,%rsi,4), %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rcx
movq %rcx, -0xc8(%rbp)
movq 0x10(%rax), %rax
movslq -0xb4(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0xd0(%rbp)
movl $0x0, -0xb8(%rbp)
cmpl $0x3, -0xb8(%rbp)
jge 0x311a1
movq -0x10(%rbp), %rax
movslq -0xbc(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movslq -0xb8(%rbp), %rax
movsd %xmm0, -0xb0(%rbp,%rax,8)
movsd -0xd0(%rbp), %xmm0
movslq -0xb8(%rbp), %rax
movsd -0xb0(%rbp,%rax,8), %xmm2
movslq -0xb8(%rbp), %rax
movsd -0x40(%rbp,%rax,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp,%rax,8)
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x31121
leaq -0x80(%rbp), %rdi
movq -0xc8(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x14aa0
movl $0x0, -0xb8(%rbp)
cmpl $0x3, -0xb8(%rbp)
jge 0x3120c
movsd -0xd0(%rbp), %xmm0
movslq -0xb8(%rbp), %rax
movsd -0x80(%rbp,%rax,8), %xmm2
movslq -0xb8(%rbp), %rax
movsd -0x60(%rbp,%rax,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp,%rax,8)
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x311c2
movsd -0xd0(%rbp), %xmm0
addsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x310be
movl $0x0, -0xb8(%rbp)
cmpl $0x3, -0xb8(%rbp)
jge 0x312ba
movslq -0xb8(%rbp), %rax
movsd -0x40(%rbp,%rax,8), %xmm0
movslq -0xb8(%rbp), %rax
movsd -0x40(%rbp,%rax,8), %xmm2
movsd -0x88(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movslq -0xb8(%rbp), %rax
movsd -0x60(%rbp,%rax,8), %xmm0
movslq -0xb8(%rbp), %rax
movsd -0x60(%rbp,%rax,8), %xmm2
movsd -0x90(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x3123c
movsd -0x88(%rbp), %xmm0
callq 0x1220
divsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x90(%rbp), %xmm0
callq 0x1220
divsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x88(%rbp), %xmm0
movsd 0x4b162(%rip), %xmm1    # 0x7c460
ucomisd %xmm1, %xmm0
ja 0x3131a
movsd -0x90(%rbp), %xmm0
movsd 0x4b14c(%rip), %xmm1    # 0x7c460
ucomisd %xmm1, %xmm0
jbe 0x3134b
movl -0x20(%rbp), %esi
movq -0x28(%rbp), %rax
movsbl (%rax), %edx
movsd -0x88(%rbp), %xmm0
movsd -0x90(%rbp), %xmm1
leaq 0x4c853(%rip), %rdi     # 0x7db8e
movb $0x2, %al
callq 0x10d0
movl $0x1, -0x4(%rbp)
jmp 0x31352
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nop