// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/ray.cc
// Function: calcPlanesToCell(ATOM_NETWORK*, std::vector<Plane, std::allocator<Plane>>&)
void calcPlanesToCell(ATOM_NETWORK *cell,vector<Plane> &p)
{
  XYZ norm1 = cell->v_a.cross(cell->v_b).unit();
  XYZ norm2 = cell->v_c.cross(cell->v_a).unit();
  XYZ norm3 = cell->v_b.cross(cell->v_c).unit();
  
  Plane face;
  //Each face with abc point 0,0,0
  face.point = cell->abc_to_xyz(Point(0,0,0));
  
  face.normal = Point(norm1.x,norm1.y,norm1.z);
  p.push_back(face);
  
  face.normal = Point(norm2.x,norm2.y,norm2.z);
  p.push_back(face);
  
  face.normal = Point(norm3.x,norm3.y,norm3.z);
  p.push_back(face);
  
  //Each face with point abc point 1,1,1 (Notice that normals are reversed this is so that a vector can easily be determined if
  //it hit within the unit cell
  face.point = cell->abc_to_xyz(Point(1,1,1));
  
  face.normal = Point(-norm1.x,-norm1.y,-norm1.z);
  p.push_back(face);
  
  face.normal = Point(-norm2.x,-norm2.y,-norm2.z);
  p.push_back(face);
  
  face.normal = Point(-norm3.x,-norm3.y,-norm3.z);
  p.push_back(face);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rsi, %rbx
movq %rdi, %r13
leaq 0x38(%rdi), %r15
leaq 0x50(%rdi), %r14
leaq 0x50(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x64146
leaq 0x38(%rsp), %rdi
movq %r12, %rsi
callq 0x640fc
leaq 0x68(%r13), %r12
leaq 0x50(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x64146
leaq 0xd0(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x640fc
leaq 0x50(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x64146
leaq 0xb8(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x640fc
leaq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0x3ccb0
leaq 0xa0(%rsp), %rbp
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %rbp, %rdi
callq 0x63c46
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
movups (%rbp), %xmm0
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3e536
movq 0x10(%rbp), %rax
movq %rax, 0x10(%r14)
movups (%rbp), %xmm0
movaps %xmm0, (%r14)
leaq 0x38(%rsp), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
leaq 0x20(%rsp), %rbp
movq %rbp, %rdi
callq 0x63c46
movq 0x10(%rbp), %rax
movq %rax, 0x28(%r14)
movups (%rbp), %xmm0
movups %xmm0, 0x18(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3ccd8
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
movsd 0x10(%r15), %xmm2
leaq 0x20(%rsp), %rbp
movq %rbp, %rdi
callq 0x63c46
movq 0x10(%rbp), %rax
movq %rax, 0x28(%r14)
movups (%rbp), %xmm0
movups %xmm0, 0x18(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3ccd8
movsd (%r12), %xmm0
movsd 0x8(%r12), %xmm1
movsd 0x10(%r12), %xmm2
leaq 0x20(%rsp), %rbp
movq %rbp, %rdi
callq 0x63c46
movq 0x10(%rbp), %rax
movq %rax, 0x28(%r14)
movups (%rbp), %xmm0
movups %xmm0, 0x18(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3ccd8
leaq 0x88(%rsp), %rbp
movsd 0xc2c10(%rip), %xmm0    # 0xfc058
movq %rbp, %rdi
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x63c46
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
movups (%rbp), %xmm0
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3e536
movq 0x10(%rbp), %rax
movq %rax, 0x10(%r14)
movups (%rbp), %xmm0
movaps %xmm0, (%r14)
leaq 0x38(%rsp), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movaps 0xc712f(%rip), %xmm3    # 0x1005d0
xorps %xmm3, %xmm0
xorps %xmm3, %xmm1
xorps %xmm3, %xmm2
leaq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0x63c46
movq 0x10(%r13), %rax
movq %rax, 0x28(%r14)
movups (%r13), %xmm0
movups %xmm0, 0x18(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3ccd8
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
movsd 0x10(%r15), %xmm2
movaps 0xc70e4(%rip), %xmm3    # 0x1005d0
xorps %xmm3, %xmm0
xorps %xmm3, %xmm1
xorps %xmm3, %xmm2
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x63c46
movq 0x10(%r15), %rax
movq %rax, 0x28(%r14)
movups (%r15), %xmm0
movups %xmm0, 0x18(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3ccd8
movsd (%r12), %xmm0
movsd 0x8(%r12), %xmm1
movsd 0x10(%r12), %xmm2
movaps 0xc7097(%rip), %xmm3    # 0x1005d0
xorps %xmm3, %xmm0
xorps %xmm3, %xmm1
xorps %xmm3, %xmm2
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x63c46
movq 0x10(%r15), %rax
movq %rax, 0x28(%r14)
movups (%r15), %xmm0
movups %xmm0, 0x18(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3ccd8
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq