// File: /workspace/github_c_makefile_star2_O3/josch[P]stride/geometry.c
// Function: Project4_123
void Project4_123(float *Coord1, float *Coord2, float *Coord3, float *Coord4, 
		 float *Coord_Proj4_123)
{

/*
                          Atom4
   Atom3                  .
   \                     .
    \                   .    
     \                 .  .Proj4_123
      \               .. 
      Atom2-------Atom1

*/


  float Vector21[3], Vector23[3], Vector14[3], VectorNormal_123[3];
  float Length_21 = 0.0, Length_23 = 0.0, Length_14 = 0.0, NormalLength;
  float COS_Norm_14, Proj_14_Norm;
  int i;

  for( i=0; i<3; i++ ) {
    Vector21[i] = Coord1[i] - Coord2[i];
    Vector23[i] = Coord3[i] - Coord2[i];
    Vector14[i] = Coord4[i] - Coord1[i];
    Length_21 += Vector21[i]*Vector21[i];
    Length_23 += Vector23[i]*Vector23[i];
    Length_14 += Vector14[i]*Vector14[i];
  }
  
  Length_21 = sqrt(Length_21);
  Length_23 = sqrt(Length_23);
  Length_14 = sqrt(Length_14);

  NormalLength = VectorProduct(Vector21,Vector23,VectorNormal_123);

  for( i=0; i<3; i++ ) 
    VectorNormal_123[i] /= NormalLength;

  COS_Norm_14 = 0.0;

  for( i=0; i<3; i++ ) 
    COS_Norm_14 += VectorNormal_123[i]*Vector14[i];

  COS_Norm_14 /= (Length_14*NormalLength);

  if( COS_Norm_14 < 0.0 ) {
    COS_Norm_14 = fabs(COS_Norm_14);
    for( i=0; i<3; i++ ) 
      VectorNormal_123[i] = -VectorNormal_123[i];
  }

  Proj_14_Norm = Length_14*COS_Norm_14;

  for( i=0; i<3; i++ ) {
    VectorNormal_123[i] *= Proj_14_Norm;
    Coord_Proj4_123[i] = (Vector14[i] - VectorNormal_123[i]) + Coord1[i];
  }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %r8, %rbx
movq %rdi, %r14
xorps %xmm6, %xmm6
xorps %xmm0, %xmm0
xorl %eax, %eax
movss (%r14,%rax), %xmm1
movss (%rsi,%rax), %xmm2
movaps %xmm1, %xmm3
subss %xmm2, %xmm3
movss %xmm3, 0x3c(%rsp,%rax)
movss (%rcx,%rax), %xmm4
movss (%rdx,%rax), %xmm5
unpcklps %xmm4, %xmm5            # xmm5 = xmm5[0],xmm4[0],xmm5[1],xmm4[1]
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
subps %xmm2, %xmm5
movss %xmm5, 0x30(%rsp,%rax)
movaps %xmm5, %xmm1
shufps $0x55, %xmm5, %xmm1     # xmm1 = xmm1[1,1],xmm5[1,1]
movss %xmm1, 0x24(%rsp,%rax)
mulss %xmm3, %xmm3
addss %xmm3, %xmm0
mulps %xmm5, %xmm5
addps %xmm5, %xmm6
addq $0x4, %rax
cmpq $0xc, %rax
jne 0x489d
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
movaps %xmm6, 0x10(%rsp)
jae 0x490d
callq 0x2170
xorps %xmm1, %xmm1
movaps 0x10(%rsp), %xmm6
ucomiss %xmm1, %xmm6
jae 0x491f
movaps %xmm6, %xmm0
callq 0x2170
movaps 0x10(%rsp), %xmm6
shufps $0x55, %xmm6, %xmm6     # xmm6 = xmm6[1,1,1,1]
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm6
jb 0x4934
xorps %xmm3, %xmm3
sqrtss %xmm6, %xmm3
jmp 0x4942
movaps %xmm6, %xmm0
callq 0x2170
xorps %xmm2, %xmm2
movaps %xmm0, %xmm3
xorl %eax, %eax
xorl %ecx, %ecx
leaq 0x1(%rcx), %rdx
cmpq $0x2, %rcx
movl %edx, %esi
cmovel %eax, %esi
xorl %edi, %edi
cmpl $0x2, %esi
setb %dil
leal (%rdi,%rdi,2), %edi
leal -0x2(%rsi,%rdi), %edi
movss 0x3c(%rsp,%rsi,4), %xmm0
movss 0x30(%rsp,%rsi,4), %xmm1
mulss 0x3c(%rsp,%rdi,4), %xmm1
mulss 0x30(%rsp,%rdi,4), %xmm0
subss %xmm1, %xmm0
movss %xmm0, 0x4(%rsp,%rcx,4)
mulss %xmm0, %xmm0
addss %xmm0, %xmm2
movq %rdx, %rcx
cmpq $0x3, %rdx
jne 0x4946
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm2
jb 0x49a7
xorps %xmm0, %xmm0
sqrtss %xmm2, %xmm0
jmp 0x49bb
movaps %xmm2, %xmm0
movss %xmm3, 0x10(%rsp)
callq 0x2170
movss 0x10(%rsp), %xmm3
xorl %eax, %eax
movss 0x4(%rsp,%rax,4), %xmm1
divss %xmm0, %xmm1
movss %xmm1, 0x4(%rsp,%rax,4)
incq %rax
cmpq $0x3, %rax
jne 0x49bd
xorps %xmm1, %xmm1
xorl %eax, %eax
movss 0x4(%rsp,%rax,4), %xmm2
mulss 0x24(%rsp,%rax,4), %xmm2
addss %xmm2, %xmm1
incq %rax
cmpq $0x3, %rax
jne 0x49db
mulss %xmm3, %xmm0
divss %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x4a2c
xorl %eax, %eax
movaps 0x14ec3(%rip), %xmm0    # 0x198d0
movss 0x4(%rsp,%rax,4), %xmm2
xorps %xmm0, %xmm2
movss %xmm2, 0x4(%rsp,%rax,4)
incq %rax
cmpq $0x3, %rax
jne 0x4a0d
andps 0x14eb4(%rip), %xmm1    # 0x198e0
mulss %xmm1, %xmm3
xorl %eax, %eax
movss 0x4(%rsp,%rax,4), %xmm0
mulss %xmm3, %xmm0
movss %xmm0, 0x4(%rsp,%rax,4)
movss 0x24(%rsp,%rax,4), %xmm1
subss %xmm0, %xmm1
addss (%r14,%rax,4), %xmm1
movss %xmm1, (%rbx,%rax,4)
incq %rax
cmpq $0x3, %rax
jne 0x4a32
addq $0x48, %rsp
popq %rbx
popq %r14
retq