// File: /workspace/github_cpp_makefile_star2_O1/ekg[P]sgd2/src/main.cpp
// Function: draw_svg(unsigned long, std::vector<double, std::allocator<double>> const&, unsigned long, std::vector<unsigned long, std::allocator<unsigned long>> const&, std::vector<unsigned long, std::allocator<unsigned long>> const&)
void draw_svg(uint64_t n, const std::vector<double>& X, uint64_t len_I, const std::vector<uint64_t>& I, const std::vector<uint64_t>& J) {
    double scale = 5.0;
    double border = 10.0;
    double min_x = 0;
    double min_y = 0;
    double max_x = 0;
    double max_y = 0;
    // determine boundaries
    for (uint64_t i = 0; i < n; ++i) {
        double x = X[i*2]*scale;
        double y = X[i*2+1]*scale;
        if (x < min_x) min_x = x;
        if (x > max_x) max_x = x;
        if (y < min_y) min_y = y;
        if (y > max_y) max_y = y;
    }
    double width = max_x - min_x;
    double height = max_y - min_y;
    
    std::cout << "<svg width=\"" << width + border << "\" height=\"" << height + border << "\" "
              << "viewBox=\"" << min_x - border/2<< " " << min_y - border/2 << " " << width + border << " " << height + border << "\" xmlns=\"http://www.w3.org/2000/svg\">"
              << "<style type=\"text/css\">"
              << "line{stroke:black;stroke-width:1.0;stroke-opacity:1.0;stroke-linecap:round;}"
        //<< "circle{{r:" << 1.0 << ";fill:black;fill-opacity:" << 1.0 << "}}"
              << "</style>"
              << std::endl;

    for (uint64_t i = 0; i < len_I; ++i) {
        uint64_t a = I[i];
        uint64_t b = J[i];
        std::cout << "<line x1=\"" << X[a*2]*scale << "\" x2=\"" << X[b*2]*scale
                  << "\" y1=\"" << X[a*2+1]*scale << "\" y2=\"" << X[b*2+1]*scale << "\"/>"
                  << std::endl;
    }

    /* // to draw nodes
    for (uint64_t i = 0; i < n; ++i) {
        std::cout << "<circle cx=\"" << X[i*2]*scale << "\" cy=\"" << X[i*2+1]*scale << "\" r=\"1.0\"/>" << std::endl;
    }
    */
    std::cout << "</svg>" << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %r13
testq %rdi, %rdi
movq %rsi, -0x68(%rbp)
je 0x7112
movq (%rsi), %rax
addq $0x8, %rax
xorpd %xmm1, %xmm1
movsd 0x3f79(%rip), %xmm0     # 0xb038
xorpd %xmm2, %xmm2
xorpd %xmm4, %xmm4
xorpd %xmm3, %xmm3
movsd -0x8(%rax), %xmm6
mulsd %xmm0, %xmm6
movsd (%rax), %xmm5
mulsd %xmm0, %xmm5
movapd %xmm6, %xmm8
minsd %xmm1, %xmm8
maxsd %xmm4, %xmm6
movapd %xmm5, %xmm7
minsd %xmm2, %xmm7
maxsd %xmm3, %xmm5
addq $0x10, %rax
movapd %xmm8, %xmm1
movapd %xmm7, %xmm2
movapd %xmm6, %xmm4
movapd %xmm5, %xmm3
decq %rdi
jne 0x70cb
jmp 0x7123
xorpd %xmm5, %xmm5
xorpd %xmm6, %xmm6
xorpd %xmm7, %xmm7
xorpd %xmm8, %xmm8
movsd %xmm8, -0x40(%rbp)
movsd %xmm7, -0x48(%rbp)
subsd %xmm8, %xmm6
movsd %xmm6, -0x38(%rbp)
subsd %xmm7, %xmm5
movsd %xmm5, -0x30(%rbp)
movq 0x7e88(%rip), %rbx      # 0xefd0
leaq 0x4011(%rip), %rsi      # 0xb160
movl $0xc, %edx
movq %rbx, %rdi
callq 0x2190
movsd -0x38(%rbp), %xmm0
addsd 0x3ed7(%rip), %xmm0     # 0xb040
movsd %xmm0, -0x38(%rbp)
movq %rbx, %rdi
callq 0x21f0
movq %rax, %rbx
leaq 0x3fed(%rip), %rsi      # 0xb16d
movl $0xa, %edx
movq %rax, %rdi
callq 0x2190
movsd -0x30(%rbp), %xmm0
addsd 0x3ea6(%rip), %xmm0     # 0xb040
movsd %xmm0, -0x30(%rbp)
movq %rbx, %rdi
callq 0x21f0
movq %rax, %rbx
leaq 0x3fc7(%rip), %rsi      # 0xb178
movl $0x2, %edx
movq %rax, %rdi
callq 0x2190
leaq 0x3fb6(%rip), %rsi      # 0xb17b
movl $0x9, %edx
movq %rbx, %rdi
callq 0x2190
movsd -0x40(%rbp), %xmm0
addsd 0x3e69(%rip), %xmm0     # 0xb048
movq %rbx, %rdi
callq 0x21f0
movq %rax, %r14
leaq 0x3f88(%rip), %rbx      # 0xb179
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2190
movsd -0x48(%rbp), %xmm0
addsd 0x3e3a(%rip), %xmm0     # 0xb048
movq %r14, %rdi
callq 0x21f0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2190
movq %r14, %rdi
movsd -0x38(%rbp), %xmm0
callq 0x21f0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2190
movq %r14, %rdi
movsd -0x30(%rbp), %xmm0
callq 0x21f0
movq %rax, %rbx
leaq 0x3f25(%rip), %rsi      # 0xb185
movl $0x25, %edx
movq %rax, %rdi
callq 0x2190
leaq 0x3f37(%rip), %rsi      # 0xb1ab
movl $0x17, %edx
movq %rbx, %rdi
callq 0x2190
leaq 0x3f3b(%rip), %rsi      # 0xb1c3
movl $0x4c, %edx
movq %rbx, %rdi
callq 0x2190
leaq 0x3f74(%rip), %rsi      # 0xb210
movl $0x8, %edx
movq %rbx, %rdi
callq 0x2190
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
testq %r13, %r13
je 0x7426
xorl %ebx, %ebx
movq %r12, -0x60(%rbp)
movq %r15, -0x58(%rbp)
movq %r13, -0x50(%rbp)
movq (%r12), %rax
movq (%rax,%rbx,8), %r13
movq (%r15), %rax
movq (%rax,%rbx,8), %r14
movl $0xa, %edx
movq 0x7cce(%rip), %r15      # 0xefd0
movq %r15, %rdi
leaq 0x3f0d(%rip), %rsi      # 0xb219
callq 0x2190
movq -0x68(%rbp), %r12
movq (%r12), %rax
shlq $0x4, %r13
movsd (%rax,%r13), %xmm0
movsd 0x3d0d(%rip), %xmm1     # 0xb038
mulsd %xmm1, %xmm0
movq %r15, %rdi
callq 0x21f0
movq %rax, %r15
movl $0x6, %edx
movq %rax, %rdi
leaq 0x3edb(%rip), %rsi      # 0xb224
callq 0x2190
movq (%r12), %rax
shlq $0x4, %r14
movsd (%rax,%r14), %xmm0
mulsd 0x3cd4(%rip), %xmm0     # 0xb038
movq %r15, %rdi
callq 0x21f0
movq %rax, %r15
movl $0x6, %edx
movq %rax, %rdi
leaq 0x3ead(%rip), %rsi      # 0xb22b
callq 0x2190
movq (%r12), %rax
movsd 0x8(%rax,%r13), %xmm0
movq -0x50(%rbp), %r13
mulsd 0x3c9e(%rip), %xmm0     # 0xb038
movq %r15, %rdi
callq 0x21f0
movq %rax, %r15
movl $0x6, %edx
movq %rax, %rdi
leaq 0x3e7e(%rip), %rsi      # 0xb232
callq 0x2190
movq (%r12), %rax
movsd 0x8(%rax,%r14), %xmm0
mulsd 0x3c6c(%rip), %xmm0     # 0xb038
movq %r15, %rdi
callq 0x21f0
movq %rax, %r15
movl $0x3, %edx
movq %rax, %rdi
leaq 0x3e53(%rip), %rsi      # 0xb239
callq 0x2190
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r15, %rdi
movq -0x58(%rbp), %r15
movq -0x60(%rbp), %r12
callq 0x2030
movq %rax, %rdi
callq 0x20c0
incq %rbx
cmpq %rbx, %r13
jne 0x72e7
leaq 0x3e10(%rip), %rsi      # 0xb23d
movl $0x6, %edx
movq 0x7b97(%rip), %rbx      # 0xefd0
movq %rbx, %rdi
callq 0x2190
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20c0