// File: 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
subq $0x150, %rsp            # imm = 0x150
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0xb040
movq -0xe8(%rbp), %rax
leaq 0xc360(%rip), %rcx      # 0x1dab8
movq %rcx, (%rax)
movb $0x1, 0x38(%rax)
movb $0x1, 0x3a(%rax)
movb $0x1, 0x39(%rax)
movl $0x3b83126f, 0x3c(%rax) # imm = 0x3B83126F
movl $0x3e4ccccd, 0x40(%rax) # imm = 0x3E4CCCCD
movl $0x3f800000, -0x24(%rbp) # imm = 0x3F800000
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x24(%rbp), %rsi
leaq -0x28(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
callq 0x8c30
jmp 0x117a1
movq -0xe8(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x20(%rax)
movl $0x3f800000, -0x4c(%rbp) # imm = 0x3F800000
movl $0x0, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x4c(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0x54(%rbp), %rcx
callq 0x8c30
jmp 0x117e2
movq -0xe8(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, 0x2c(%rax)
movl -0x40(%rbp), %ecx
movl %ecx, 0x34(%rax)
movq -0x10(%rbp), %rdi
addq $0x68, %rdi
callq 0x13790
cmpq $0x0, %rax
jbe 0x1180c
jmp 0x11848
leaq 0x6205(%rip), %rdi      # 0x17a18
leaq 0x5c56(%rip), %rsi      # 0x17470
movl $0x3fc, %edx            # imm = 0x3FC
leaq 0x623f(%rip), %rcx      # 0x17a65
callq 0x3100
movq -0xe8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0xb2d0
jmp 0x11a6a
movq -0x10(%rbp), %rax
addq $0x68, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x13e30
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0x13e60
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x13e90
testb $0x1, %al
jne 0x11884
jmp 0x11a61
leaq -0x68(%rbp), %rdi
callq 0x13ed0
movl 0x8(%rax), %ecx
movl %ecx, -0x78(%rbp)
movq (%rax), %rax
movq %rax, -0x80(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x8ea0
movss %xmm1, -0x104(%rbp)
movaps %xmm0, -0x100(%rbp)
jmp 0x118b4
movss -0x104(%rbp), %xmm0
movaps -0x100(%rbp), %xmm1
movlpd %xmm1, -0xa8(%rbp)
movss %xmm0, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
movl %eax, -0x90(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x8c(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x8e00
jmp 0x11902
leaq -0x8c(%rbp), %rdi
callq 0x8f10
movq %rax, -0x110(%rbp)
jmp 0x11917
movq -0x110(%rbp), %rax
movq %rax, -0x120(%rbp)
movl $0x0, -0xb8(%rbp)
leaq -0x8c(%rbp), %rdi
callq 0x8f10
movq %rax, -0x118(%rbp)
jmp 0x11944
movq -0x120(%rbp), %rsi
movq -0x118(%rbp), %rcx
addq $0x8, %rcx
leaq -0xb4(%rbp), %rdi
leaq -0xb8(%rbp), %rdx
callq 0x8c30
jmp 0x1196b
testb $0x1, -0x11(%rbp)
je 0x1199f
leaq -0x8c(%rbp), %rdi
callq 0x8f10
movq %rax, -0x128(%rbp)
jmp 0x11986
movq -0x128(%rbp), %rax
movss 0x4(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x119bd
movq -0xe8(%rbp), %rdi
addq $0x68, %rdi
leaq -0xb4(%rbp), %rsi
callq 0x13cc0
jmp 0x119b8
jmp 0x11a51
movq -0xe8(%rbp), %rax
addq $0x68, %rax
movq %rax, -0x150(%rbp)
leaq -0xb4(%rbp), %rdi
callq 0x8ea0
movss %xmm1, -0x144(%rbp)
movaps %xmm0, -0x140(%rbp)
jmp 0x119ec
movss -0x144(%rbp), %xmm0
movaps -0x140(%rbp), %xmm1
movlpd %xmm1, -0xe0(%rbp)
movss %xmm0, -0xd8(%rbp)
movl -0xd8(%rbp), %eax
movl %eax, -0xc8(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0xc4(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x8e00
jmp 0x11a3a
movq -0x150(%rbp), %rdi
leaq -0xc4(%rbp), %rsi
callq 0x13b60
jmp 0x11a4f
jmp 0x11a51
jmp 0x11a53
leaq -0x68(%rbp), %rdi
callq 0x13ef0
jmp 0x1186e
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3280
nopw %cs:(%rax,%rax)