// File: /workspace/github_cpp_makefile_star2_O3/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 0x6b6d(%rip), %rax      # 0x11760
movq %rax, (%rdi)
addq $0x20, %rdi
callq 0x6c64
xorps %xmm0, %xmm0
movups %xmm0, 0x88(%rbx)
movups %xmm0, 0x78(%rbx)
movups %xmm0, 0x68(%rbx)
leaq 0x6eb8(%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 0x2635(%rip), %xmm0     # 0xd270
movupd %xmm0, 0x20(%rbx)
movq $0x0, 0x30(%rbx)
movq 0x68(%r15), %r12
movq 0x70(%r15), %r13
cmpq %r12, %r13
je 0xadc6
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 0xac73
cvtsd2ss %xmm0, %xmm0
ucomiss 0x2614(%rip), %xmm0     # 0xd2ac
jb 0xaca0
sqrtss %xmm0, %xmm0
jmp 0xaca5
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 0xaca7
movsd -0x40(%rbp), %xmm0
movss -0x38(%rbp), %xmm1
movss %xmm0, -0x34(%rbp)
movl $0x0, -0x30(%rbp)
movss %xmm1, -0x2c(%rbp)
testb %r14b, %r14b
je 0xad1f
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
ucomiss 0x25c1(%rip), %xmm0     # 0xd2ac
jae 0xad1f
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 0xacf2
cvtsd2ss %xmm0, %xmm0
ucomiss 0x2595(%rip), %xmm0     # 0xd2ac
jb 0xad35
sqrtss %xmm0, %xmm0
jmp 0xad3a
movq 0x70(%rbx), %rsi
cmpq 0x78(%rbx), %rsi
je 0xad90
movl -0x2c(%rbp), %eax
movl %eax, 0x8(%rsi)
movq -0x34(%rbp), %rax
jmp 0xad86
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 0xad3c
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 0xad9e
movl -0x44(%rbp), %eax
movl %eax, 0x8(%rsi)
movq -0x4c(%rbp), %rax
movq %rax, (%rsi)
addq $0xc, 0x70(%rbx)
jmp 0xadaa
movq %r15, %rdi
leaq -0x34(%rbp), %rdx
callq 0xc3cc
jmp 0xadaa
movq %r15, %rdi
leaq -0x4c(%rbp), %rdx
callq 0xc244
addq $0xc, %r12
cmpq %r13, %r12
jne 0xac5d
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2c8b(%rip), %rdi      # 0xda58
leaq 0x26dc(%rip), %rsi      # 0xd4b0
leaq 0x2cca(%rip), %rcx      # 0xdaa5
movl $0x3fc, %edx            # imm = 0x3FC
callq 0x3120
jmp 0xade7
movq %rax, %r14
movq %rbx, %rdi
callq 0xbbb4
movq %r14, %rdi
callq 0x32b0