// File: /workspace/github_cpp_makefile_star2_O3/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 $0x258, %rsp            # imm = 0x258
movq %rdi, %r15
leaq -0x268(%rbp), %rdi
movl $0x10, %edx
callq 0x3290
leaq 0x30(%r15), %r14
cmpb $0x0, 0x38(%r15)
jne 0xa496
movq %r14, %rdi
movq %r15, %rsi
callq 0x7590
leaq -0x258(%rbp), %rbx
movq %rbx, -0x58(%rbp)
movss 0x44(%r15), %xmm1
movss 0x3c(%r15), %xmm0
movss %xmm0, -0x30(%rbp)
subss %xmm0, %xmm1
movss 0x2b4e(%rip), %xmm2     # 0xd00c
mulss %xmm1, %xmm2
movss %xmm2, -0x24(%rbp)
addss %xmm2, %xmm2
addss %xmm2, %xmm1
xorps %xmm0, %xmm0
movss %xmm1, -0x28(%rbp)
ucomiss %xmm0, %xmm1
jbe 0xa918
movss 0x40(%r15), %xmm3
movss 0x48(%r15), %xmm1
movss %xmm3, -0x1c(%rbp)
subss %xmm3, %xmm1
addss %xmm1, %xmm2
ucomiss %xmm0, %xmm2
jbe 0xa918
movss %xmm2, -0x20(%rbp)
movss 0x68(%r15), %xmm0
movss %xmm0, -0x2c(%rbp)
leaq 0x347d(%rip), %rsi      # 0xd996
movl $0x28, %edx
movq %rbx, %rdi
callq 0x31e0
movq -0x258(%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 0x3464(%rip), %rsi      # 0xd9bf
movl $0xc, %edx
movq %rax, %rdi
callq 0x31e0
xorps %xmm0, %xmm0
cvtss2sd -0x2c(%rbp), %xmm0
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x344a(%rip), %rsi      # 0xd9cc
movl $0xc, %edx
movq %rax, %rdi
callq 0x31e0
movss -0x20(%rbp), %xmm0
divss -0x28(%rbp), %xmm0
mulss -0x2c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x3425(%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 0x33ec(%rip), %rsi      # 0xd9de
movl $0xe, %edx
movq %rax, %rdi
callq 0x31e0
movss -0x30(%rbp), %xmm0
subss -0x24(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x2e23(%rip), %rsi      # 0xd442
movl $0x1, %edx
movq %rax, %rdi
callq 0x31e0
movss -0x1c(%rbp), %xmm0
subss -0x24(%rbp), %xmm0
movss %xmm0, -0x1c(%rbp)
cvtss2sd %xmm0, %xmm0
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x2df1(%rip), %rsi      # 0xd442
movl $0x1, %edx
movq %rax, %rdi
callq 0x31e0
xorps %xmm0, %xmm0
cvtss2sd -0x28(%rbp), %xmm0
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x2dca(%rip), %rsi      # 0xd442
movl $0x1, %edx
movq %rax, %rdi
callq 0x31e0
xorps %xmm0, %xmm0
cvtss2sd -0x20(%rbp), %xmm0
movq %r15, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x319d(%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 0x2cfc(%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 0x32d5(%rip), %rsi      # 0xd9ed
movl $0x6, %edx
movq %rbx, %rdi
callq 0x31e0
movq -0x258(%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 -0x40(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x30e7(%rip), %rsi      # 0xd846
leaq 0x30f2(%rip), %rdx      # 0xd858
leaq -0x50(%rbp), %rdi
callq 0xc1a6
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x6204
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0xa789
callq 0x31a0
leaq -0x50(%rbp), %rdi
movq %r15, (%rdi)
leaq 0x2963(%rip), %rsi      # 0xd0fa
leaq 0x296d(%rip), %rdx      # 0xd10b
callq 0xc1a6
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x632d
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0xa7bd
callq 0x31a0
leaq 0x3230(%rip), %rsi      # 0xd9f4
movl $0x7, %edx
movq %rbx, %rdi
callq 0x31e0
movq -0x258(%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 0x31f9(%rip), %rsi      # 0xd9fc
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x31e0
movss -0x1c(%rbp), %xmm0
addss %xmm0, %xmm0
addss -0x20(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x3250
movq %rax, %r15
leaq 0x31e5(%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 -0x58(%rbp), %rsi
movq %r14, %rdi
callq 0x766a
leaq 0x31d1(%rip), %rsi      # 0xda4c
movl $0x4, %edx
movq %rbx, %rdi
callq 0x31e0
movq -0x258(%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 0x3197(%rip), %rsi      # 0xda51
movl $0x6, %edx
movq %rbx, %rdi
callq 0x31e0
movq -0x258(%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 -0x268(%rbp), %rdi
callq 0x3050
leaq -0x268(%rbp), %rdi
callq 0x3070
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3030(%rip), %rdi      # 0xd94f
leaq 0x2b8a(%rip), %rsi      # 0xd4b0
leaq 0x303f(%rip), %rcx      # 0xd96c
movl $0x3ac, %edx            # imm = 0x3AC
callq 0x3120
jmp 0xa952
jmp 0xa93d
jmp 0xa952
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0xa955
callq 0x31a0
jmp 0xa955
jmp 0xa952
movq %rax, %rbx
leaq -0x268(%rbp), %rdi
callq 0x3070
movq %rbx, %rdi
callq 0x32b0
nop