// File: /workspace/github_cpp_makefile_star2_O2/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 $0x288, %rsp            # imm = 0x288
movq %rdi, %r15
leaq -0x2a0(%rbp), %rdi
pushq $0x10
popq %rdx
callq 0x3240
leaq 0x30(%r15), %r14
cmpb $0x0, 0x38(%r15)
jne 0x8816
movq %r14, %rdi
movq %r15, %rsi
callq 0x6674
leaq -0x290(%rbp), %rbx
movq %rbx, -0x80(%rbp)
leaq 0x44(%r15), %rdi
movss 0x44(%r15), %xmm0
leaq 0x3c(%r15), %rsi
subss 0x3c(%r15), %xmm0
mulss 0x27cf(%rip), %xmm0     # 0xb00c
movss %xmm0, -0x28(%rbp)
movss %xmm0, -0x24(%rbp)
movq 0x3c(%r15), %rax
movq %rax, -0x78(%rbp)
callq 0x97ce
movss %xmm0, -0x30(%rbp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movss %xmm0, -0x2c(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x97ce
movaps %xmm0, -0x40(%rbp)
movss 0x2aa1(%rip), %xmm0     # 0xb31c
leaq -0x28(%rbp), %rdi
callq 0x9978
leaq -0x60(%rbp), %rsi
movlps %xmm0, (%rsi)
leaq -0x30(%rbp), %rdi
callq 0x982e
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jbe 0x8af8
movaps %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm1     # xmm1 = xmm1[1,1],xmm0[1,1]
movaps %xmm1, -0x70(%rbp)
ucomiss %xmm2, %xmm1
jbe 0x8af8
movaps %xmm0, -0x90(%rbp)
movss 0x68(%r15), %xmm0
movss %xmm0, -0x20(%rbp)
leaq 0x313d(%rip), %rsi      # 0xba0a
movq %rbx, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x314f(%rip), %rsi      # 0xba33
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
movss -0x20(%rbp), %xmm0
callq 0x3140
leaq 0x3140(%rip), %rsi      # 0xba40
movq %rax, %rdi
callq 0x31a0
movaps -0x70(%rbp), %xmm0
divss -0x90(%rbp), %xmm0
mulss -0x20(%rbp), %xmm0
movq %rax, %rdi
callq 0x3140
leaq 0x3125(%rip), %rsi      # 0xba4d
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x3113(%rip), %rsi      # 0xba52
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
movaps -0x40(%rbp), %xmm0
callq 0x3140
leaq 0x2b5c(%rip), %rsi      # 0xb4b6
movq %rax, %rdi
callq 0x31a0
movaps -0x40(%rbp), %xmm0
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movq %rax, %rdi
movaps %xmm0, -0x40(%rbp)
callq 0x3140
leaq 0x2b39(%rip), %rsi      # 0xb4b6
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
movaps -0x90(%rbp), %xmm0
callq 0x3140
leaq 0x2b1b(%rip), %rsi      # 0xb4b6
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
movaps -0x70(%rbp), %xmm0
callq 0x3140
leaq 0x2efa(%rip), %rsi      # 0xb8b0
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x2a80(%rip), %rsi      # 0xb44d
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x307d(%rip), %rsi      # 0xba61
movq %rbx, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x2ebf(%rip), %rsi      # 0xb8ba
leaq -0x60(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x30a0
leaq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x59b8
leaq -0x60(%rbp), %rdi
callq 0x30c0
leaq 0x26d6(%rip), %rsi      # 0xb0fa
leaq -0x60(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x30a0
leaq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x5a3a
leaq -0x60(%rbp), %rdi
callq 0x30c0
leaq 0x301b(%rip), %rsi      # 0xba68
movq %rbx, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x300c(%rip), %rsi      # 0xba70
movq %rbx, %rdi
callq 0x31a0
movaps -0x40(%rbp), %xmm0
addss %xmm0, %xmm0
addss -0x70(%rbp), %xmm0
movq %rax, %rdi
callq 0x3140
leaq 0x3005(%rip), %rsi      # 0xba8d
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq -0x80(%rbp), %rsi
movq %r14, %rdi
callq 0x6746
leaq 0x3015(%rip), %rsi      # 0xbac0
movq %rbx, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x3003(%rip), %rsi      # 0xbac5
movq %rbx, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq -0x2a0(%rbp), %rdi
callq 0x3040
leaq -0x2a0(%rbp), %rdi
callq 0x3060
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2ec4(%rip), %rdi      # 0xb9c3
leaq 0x2a1e(%rip), %rsi      # 0xb524
leaq 0x2ed3(%rip), %rcx      # 0xb9e0
movl $0x3ac, %edx            # imm = 0x3AC
callq 0x3110
jmp 0x8b33
jmp 0x8b1d
jmp 0x8b33
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x30c0
jmp 0x8b36
jmp 0x8b33
jmp 0x8b33
jmp 0x8b33
jmp 0x8b33
movq %rax, %rbx
leaq -0x2a0(%rbp), %rdi
callq 0x3060
movq %rbx, %rdi
callq 0x3250