// File: /workspace/github_cpp_makefile_star2_O1/carlos-urena[P]svg-gen/svgobjects.cpp
// Function: Figure::drawSVG(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Figure::drawSVG( const std::string & nombre_arch )
{
   using namespace std ;
   std::fstream fout( nombre_arch, ios_base::out) ;

   if ( ! objetos.projected )
      objetos.project( cam ) ;

   SVGContext ctx ;
   ctx.os = &fout ;

   constexpr real fmrg = 0.01 ; // width del margen en X y en Y, expresado en porcentaje del width en X
   //cout << "objetos.min == " << objetos.max << ", objetos.max == " << objetos.min << endl ;

   const real ax       = objetos.max[0]-objetos.min[0] ;
   const vec2 vmargen  = vec2( fmrg*ax, fmrg*ax );
   const vec2 ptos_min = objetos.min,
              ptos_w   = objetos.max-objetos.min,
              box_min  = ptos_min-vmargen,
              box_w    = ptos_w+real(2.0)*vmargen ;

   assert( 0 < box_w[0] && 0 < box_w[1] );
   real ratio = box_w[1]/box_w[0] ;

   const real wx = width_cm,      // width en centimetros
              wy = wx*ratio ;

   // cabecera svg
   fout << "<svg xmlns='http://www.w3.org/2000/svg' " << endl
        << "     width='" << wx << "cm' height='" << wy << "cm' " << endl
        << "     viewBox='" << box_min[0] << " " << box_min[1] << " " << box_w[0] << " " << box_w[1] << "'" << endl
        << ">" << endl ;


   //write_radial_gradient_def( fout, "hemisphereGradFill" );

   fout << "<defs>" << endl ;
   write_radial_gradient_def( fout, "hemisphereGradFill" );
   write_radial_gradient_def_blue( fout, "spherecapGradFill" );
   fout << "</defs>" << endl ;

   fout << "<g transform='translate(0.0 " << real(2.0)*box_min[1]+box_w[1] << ") scale(1.0 -1.0)'> <!-- transf global (inv y) -->"<< endl ;



   // objetos svg
   objetos.drawSVG( ctx );

   // pie svg
   fout << "</g>" << endl ;
   fout << "</svg>" << endl ;

   fout.close();

   //cout << "end svg " << nombre_arch << endl ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, %r15
leaq -0x2b0(%rbp), %rdi
movl $0x10, %edx
callq 0x3290
leaq 0x30(%r15), %r14
cmpb $0x0, 0x38(%r15)
jne 0xa5dc
movq %r14, %rdi
movq %r15, %rsi
callq 0x75a4
leaq -0x2a0(%rbp), %rbx
movq %rbx, -0x88(%rbp)
movss 0x44(%r15), %xmm0
subss 0x3c(%r15), %xmm0
mulss 0x2a0e(%rip), %xmm0     # 0xd00c
movss %xmm0, -0x48(%rbp)
movss %xmm0, -0x44(%rbp)
movq 0x3c(%r15), %rax
movq %rax, -0x80(%rbp)
xorl %eax, %eax
movss 0x44(%r15,%rax,4), %xmm0
subss 0x3c(%r15,%rax,4), %xmm0
movss %xmm0, -0x40(%rbp,%rax,4)
incq %rax
cmpq $0x1, %rax
je 0xa612
movsd -0x40(%rbp), %xmm0
movss %xmm0, -0x50(%rbp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movss %xmm0, -0x4c(%rbp)
xorl %eax, %eax
movss -0x80(%rbp,%rax,4), %xmm0
subss -0x48(%rbp,%rax,4), %xmm0
movss %xmm0, -0x40(%rbp,%rax,4)
incq %rax
cmpq $0x1, %rax
je 0xa644
movsd -0x40(%rbp), %xmm0
movaps %xmm0, -0x60(%rbp)
xorl %eax, %eax
movss -0x48(%rbp,%rax,4), %xmm0
addss %xmm0, %xmm0
movss %xmm0, -0x40(%rbp,%rax,4)
incq %rax
cmpq $0x1, %rax
je 0xa66a
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
xorl %eax, %eax
movss -0x50(%rbp,%rax,4), %xmm0
addss -0x78(%rbp,%rax,4), %xmm0
movss %xmm0, -0x40(%rbp,%rax,4)
incq %rax
cmpq $0x1, %rax
je 0xa68f
movsd -0x40(%rbp), %xmm2
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm2
jbe 0xaae5
movaps %xmm2, %xmm1
shufps $0x55, %xmm2, %xmm1     # xmm1 = xmm1[1,1],xmm2[1,1]
movaps %xmm1, -0x70(%rbp)
ucomiss %xmm0, %xmm1
jbe 0xaae5
movaps %xmm2, -0xa0(%rbp)
movss 0x68(%r15), %xmm0
movss %xmm0, -0x1c(%rbp)
leaq 0x32ae(%rip), %rsi      # 0xd996
movl $0x28, %edx
movq %rbx, %rdi
callq 0x31e0
movq -0x2a0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
movq %rax, %r15
leaq 0x3295(%rip), %rsi      # 0xd9bf
movl $0xc, %edx
movq %rax, %rdi
callq 0x31e0
xorps %xmm0, %xmm0
cvtss2sd -0x1c(%rbp), %xmm0
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x327b(%rip), %rsi      # 0xd9cc
movl $0xc, %edx
movq %rax, %rdi
callq 0x31e0
movaps -0x70(%rbp), %xmm0
divss -0xa0(%rbp), %xmm0
mulss -0x1c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x3254(%rip), %rsi      # 0xd9d9
movl $0x4, %edx
movq %rax, %rdi
callq 0x31e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
movq %rax, %r15
leaq 0x321b(%rip), %rsi      # 0xd9de
movl $0xe, %edx
movq %rax, %rdi
callq 0x31e0
xorps %xmm0, %xmm0
cvtss2sd -0x60(%rbp), %xmm0
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x2c58(%rip), %rsi      # 0xd442
movl $0x1, %edx
movq %rax, %rdi
callq 0x31e0
movaps -0x60(%rbp), %xmm0
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movaps %xmm0, -0x60(%rbp)
cvtss2sd %xmm0, %xmm0
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x2c29(%rip), %rsi      # 0xd442
movl $0x1, %edx
movq %rax, %rdi
callq 0x31e0
xorps %xmm0, %xmm0
cvtss2sd -0xa0(%rbp), %xmm0
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x2bff(%rip), %rsi      # 0xd442
movl $0x1, %edx
movq %rax, %rdi
callq 0x31e0
xorps %xmm0, %xmm0
cvtss2sd -0x70(%rbp), %xmm0
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x2fd2(%rip), %rsi      # 0xd83c
movl $0x1, %edx
movq %rax, %rdi
callq 0x31e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
movq %rax, %r15
leaq 0x2b31(%rip), %rsi      # 0xd3d9
movl $0x1, %edx
movq %rax, %rdi
callq 0x31e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
leaq 0x310a(%rip), %rsi      # 0xd9ed
movl $0x6, %edx
movq %rbx, %rdi
callq 0x31e0
movq -0x2a0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x2f1c(%rip), %rsi      # 0xd846
leaq 0x2f27(%rip), %rdx      # 0xd858
leaq -0x40(%rbp), %rdi
callq 0xc45a
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x61e8
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xa954
callq 0x31a0
leaq -0x40(%rbp), %rdi
movq %r15, (%rdi)
leaq 0x2798(%rip), %rsi      # 0xd0fa
leaq 0x27a2(%rip), %rdx      # 0xd10b
callq 0xc45a
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x6311
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xa988
callq 0x31a0
leaq 0x3065(%rip), %rsi      # 0xd9f4
movl $0x7, %edx
movq %rbx, %rdi
callq 0x31e0
movq -0x2a0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
leaq 0x302e(%rip), %rsi      # 0xd9fc
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x31e0
movaps -0x60(%rbp), %xmm0
addss %xmm0, %xmm0
addss -0x70(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x301b(%rip), %rsi      # 0xda19
movl $0x32, %edx
movq %rax, %rdi
callq 0x31e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
leaq -0x88(%rbp), %rsi
movq %r14, %rdi
callq 0x767e
leaq 0x3004(%rip), %rsi      # 0xda4c
movl $0x4, %edx
movq %rbx, %rdi
callq 0x31e0
movq -0x2a0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
leaq 0x2fca(%rip), %rsi      # 0xda51
movl $0x6, %edx
movq %rbx, %rdi
callq 0x31e0
movq -0x2a0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3130
leaq -0x2b0(%rbp), %rdi
callq 0x3050
leaq -0x2b0(%rbp), %rdi
callq 0x3070
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2e63(%rip), %rdi      # 0xd94f
leaq 0x29bd(%rip), %rsi      # 0xd4b0
leaq 0x2e72(%rip), %rcx      # 0xd96c
movl $0x3ac, %edx            # imm = 0x3AC
callq 0x3120
jmp 0xab1f
jmp 0xab0a
jmp 0xab1f
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xab22
callq 0x31a0
jmp 0xab22
jmp 0xab1f
movq %rax, %rbx
leaq -0x2b0(%rbp), %rdi
callq 0x3070
movq %rbx, %rdi
callq 0x32b0