// File: /workspace/github_cpp_makefile_star2_O1/carlos-urena[P]svg-gen/svgobjects.cpp
// Function: HorPlanePolygon::HorPlanePolygon(Polygon const&, bool)
HorPlanePolygon::HorPlanePolygon( const Polygon & orig, bool clip_neg )
{
  style.draw_lines   = true ;
  style.draw_filled  = true ;
  style.close_lines  = true ;
  style.lines_width  = 0.004 ;
  style.fill_opacity = 0.2 ;
  style.lines_color  = vec3( 1.0, 0.0, 0.0 );
  style.fill_color   = vec3( 1.0, 0.0, 0.0 );

  assert( orig.points3D.size() > 0 );
  for( auto orig_pnt : orig.points3D )
  {
      // project onto sphere (normalize)
      const vec3 sph_pnt = orig_pnt.normalized() ,    // sphere point
                 pln_pnt = { sph_pnt[0], 0.0, sph_pnt[2] };   // plane point

      if ( !clip_neg || 0.0 <= sph_pnt[1] ) // if it is in upper hemisphere, just project
         points3D.push_back( pln_pnt );
      else // if in lower hemisphere, project to the circunference
         points3D.push_back( pln_pnt.normalized() );
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
movb $0x0, 0x8(%rdi)
leaq 0x6993(%rip), %rax      # 0x11760
movq %rax, (%rdi)
addq $0x20, %rdi
callq 0x6c48
xorps %xmm0, %xmm0
movups %xmm0, 0x88(%rbx)
movups %xmm0, 0x78(%rbx)
movups %xmm0, 0x68(%rbx)
leaq 0x6cde(%rip), %rax      # 0x11ad0
movq %rax, (%rbx)
movw $0x101, 0x38(%rbx)      # imm = 0x101
movb $0x1, 0x3a(%rbx)
movabsq $0x3e4ccccd3b83126f, %rax # imm = 0x3E4CCCCD3B83126F
movq %rax, 0x3c(%rbx)
movapd 0x245b(%rip), %xmm0     # 0xd270
movupd %xmm0, 0x20(%rbx)
movq $0x0, 0x30(%rbx)
movq 0x68(%r15), %r12
movq 0x70(%r15), %r13
cmpq %r12, %r13
je 0xafa0
leaq 0x68(%rbx), %r15
movl 0x8(%r12), %eax
movl %eax, -0x50(%rbp)
movq (%r12), %rax
movq %rax, -0x58(%rbp)
xorpd %xmm0, %xmm0
xorl %eax, %eax
xorps %xmm1, %xmm1
cvtss2sd -0x58(%rbp,%rax,4), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rax
cmpq $0x3, %rax
jne 0xae4d
cvtsd2ss %xmm0, %xmm0
ucomiss 0x243a(%rip), %xmm0     # 0xd2ac
jb 0xae7a
sqrtss %xmm0, %xmm0
jmp 0xae7f
callq 0x32d0
xorl %eax, %eax
movss -0x58(%rbp,%rax,4), %xmm1
divss %xmm0, %xmm1
movss %xmm1, -0x40(%rbp,%rax,4)
incq %rax
cmpq $0x3, %rax
jne 0xae81
movsd -0x40(%rbp), %xmm0
movss -0x38(%rbp), %xmm1
movss %xmm0, -0x34(%rbp)
movl $0x0, -0x30(%rbp)
movss %xmm1, -0x2c(%rbp)
testb %r14b, %r14b
je 0xaef9
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
ucomiss 0x23e7(%rip), %xmm0     # 0xd2ac
jae 0xaef9
xorps %xmm0, %xmm0
xorl %eax, %eax
xorps %xmm1, %xmm1
cvtss2sd -0x34(%rbp,%rax,4), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rax
cmpq $0x3, %rax
jne 0xaecc
cvtsd2ss %xmm0, %xmm0
ucomiss 0x23bb(%rip), %xmm0     # 0xd2ac
jb 0xaf0f
sqrtss %xmm0, %xmm0
jmp 0xaf14
movq 0x70(%rbx), %rsi
cmpq 0x78(%rbx), %rsi
je 0xaf6a
movl -0x2c(%rbp), %eax
movl %eax, 0x8(%rsi)
movq -0x34(%rbp), %rax
jmp 0xaf60
callq 0x32d0
xorl %eax, %eax
movss -0x34(%rbp,%rax,4), %xmm1
divss %xmm0, %xmm1
movss %xmm1, -0x40(%rbp,%rax,4)
incq %rax
cmpq $0x3, %rax
jne 0xaf16
movsd -0x40(%rbp), %xmm0
movss -0x38(%rbp), %xmm1
movss %xmm0, -0x4c(%rbp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movss %xmm0, -0x48(%rbp)
movss %xmm1, -0x44(%rbp)
movq 0x70(%rbx), %rsi
cmpq 0x78(%rbx), %rsi
je 0xaf78
movl -0x44(%rbp), %eax
movl %eax, 0x8(%rsi)
movq -0x4c(%rbp), %rax
movq %rax, (%rsi)
addq $0xc, 0x70(%rbx)
jmp 0xaf84
movq %r15, %rdi
leaq -0x34(%rbp), %rdx
callq 0xc67c
jmp 0xaf84
movq %r15, %rdi
leaq -0x4c(%rbp), %rdx
callq 0xc4f4
addq $0xc, %r12
cmpq %r13, %r12
jne 0xae37
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2ab1(%rip), %rdi      # 0xda58
leaq 0x2502(%rip), %rsi      # 0xd4b0
leaq 0x2af0(%rip), %rcx      # 0xdaa5
movl $0x3fc, %edx            # imm = 0x3FC
callq 0x3120
jmp 0xafc1
movq %rax, %r14
movq %rbx, %rdi
callq 0xbe68
movq %r14, %rdi
callq 0x32b0