// File: /workspace/github_cpp_makefile_star2_O2/wichtounet[P]articles/src/graphs.cpp
// Function: graphs::output(graphs::Output)
void graphs::output(Output output){
    if(output == Output::GOOGLE){
        std::ofstream file("graph.html");

        file << "<html>" << std::endl;
        file << "<head>" << std::endl;
        file << "<script type=\"text/javascript\" src=\"https://www.google.com/jsapi\"></script>" << std::endl;
        file << "<script type=\"text/javascript\">google.load('visualization', '1.0', {'packages':['corechart']});</script>" << std::endl;
        file << "</head>" << std::endl;
        file << "<body>" << std::endl;

        file << "<script type=\"text/javascript\">" << std::endl;

        //One function to rule them all
        for(auto& graph : all_graphs){
            file << "function draw_" << graph->name << "(){" << std::endl;

            file << "var data = google.visualization.arrayToDataTable([" << std::endl;

            //['x', 'Cats', 'Blanket 1', 'Blanket 2'],
            auto results = compute_values(graph);

            file << "['x'";

            auto first = results.begin()->second;
            for(auto& pair : first){
                file << ", '" << pair.first << "'";
            }

            file << "]," << std::endl;

            std::vector<std::string> groups;
            for(auto& group : results){
                groups.push_back(group.first);
            }
            std::sort(groups.begin(), groups.end(), numeric_cmp);

            std::size_t max = 0;
            for(auto& group_title : groups){
                file << "['" << group_title << "'";

                for(auto& serie : results[group_title]){
                    file << ", " << serie.second;
                    max = std::max(max, serie.second);
                }

                file << "]," << std::endl;
            }

            file << "]);" << std::endl;

            file << "var graph = new google.visualization.LineChart(document.getElementById('graph_" << graph->name <<"'));" << std::endl
                 << "var options = {curveType: \"function\","
                 << "title: \"" << graph->title << "\","
                 << "animation: {duration:1200, easing:\"in\"},"
                 << "width: 700, height: 400,"
                 << "hAxis: {title:\"Number of elements\", slantedText:true},"
                 << "vAxis: {viewWindow: {min:0}, title:\"" << graph->unit << "\"}};" << std::endl
                 << "graph.draw(data, options);" << std::endl;

            file << "var button = document.getElementById('graph_button_" << graph->name << "');" << std::endl
                 << "button.onclick = function(){" << std::endl
                 << "if(options.vAxis.logScale){" << std::endl
                 << "button.value=\"Logarithmic Scale\";" << std::endl
                 << "} else {" << std::endl
                 << "button.value=\"Normal scale\";" << std::endl
                 << "}" << std::endl
                 << "options.vAxis.logScale=!options.vAxis.logScale;" << std::endl
                 << "graph.draw(data, options);" << std::endl
                 << "};" << std::endl;

            file << "}" << std::endl;
        }

        //One function to find them
        file << "function draw_all(){" << std::endl;
        for(auto& graph : all_graphs){
            file << "draw_" << graph->name << "();" << std::endl;
        }
        file << "}" << std::endl;

        //One callback to bring them all
        file << "google.setOnLoadCallback(draw_all);" << std::endl;
        file << "</script>" << std::endl;
        file << std::endl;

        //And in the web page bind them
        for(auto& graph : all_graphs){
            file << "<div id=\"graph_" << graph->name << "\" style=\"width: 700px; height: 400px;\"></div>" << std::endl;
            file << "<input id=\"graph_button_" << graph->name << "\" type=\"button\" value=\"Logarithmic scale\">" << std::endl;
        }

        file << "</body>" << std::endl;
        file << "</html>" << std::endl;

        //...In the land of Google where shadow lies
    } else if (output == Output::PLUGIN) {
        std::ofstream file("graph.html");

        //One function to rule them all
        for(auto& graph : all_graphs){
            file << "[line_chart width=\"700px\" height=\"400px\" scale_button=\"true\" title=\"" << graph->title
                << "\" h_title=\"Number of elements\" v_title=\"" << graph->unit << "\"]" << std::endl;

            //['x', 'Cats', 'Blanket 1', 'Blanket 2'],
            auto results = compute_values(graph);

            file << "['x'";

            auto first = results.begin()->second;
            for(auto& pair : first){
                file << ", '" << pair.first << "'";
            }

            file << "]," << std::endl;

            std::vector<std::string> groups;
            for(auto& group : results){
                groups.push_back(group.first);
            }
            std::sort(groups.begin(), groups.end(), numeric_cmp);

            std::size_t max = 0;
            for(auto& group_title : groups){
                file << "['" << group_title << "'";

                for(auto& serie : results[group_title]){
                    file << ", " << serie.second;
                    max = std::max(max, serie.second);
                }

                file << "]," << std::endl;
            }

            file << "[/line_chart]" << std::endl;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
cmpl $0x1, %edi
je 0x852f3
testl %edi, %edi
jne 0x856f0
leaq 0xe0a9(%rip), %rsi      # 0x92e81
leaq 0xc8(%rsp), %rbx
pushq $0x10
popq %rdx
movq %rbx, %rdi
callq 0x41c0
leaq 0xe09a(%rip), %rsi      # 0x92e8c
movq %rbx, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xe08a(%rip), %rsi      # 0x92e93
leaq 0xc8(%rsp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xe075(%rip), %rsi      # 0x92e9a
leaq 0xc8(%rsp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xe0a5(%rip), %rsi      # 0x92ee6
leaq 0xc8(%rsp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xe0f2(%rip), %rsi      # 0x92f4f
leaq 0xc8(%rsp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xe0de(%rip), %rsi      # 0x92f57
leaq 0xc8(%rsp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xe0c9(%rip), %rsi      # 0x92f5e
leaq 0xc8(%rsp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
movq 0x106a7c7(%rip), %rcx   # 0x10ef678
movq 0x106a7b8(%rip), %rax   # 0x10ef670
leaq 0xc8(%rsp), %r12
leaq 0xe100(%rip), %r14      # 0x92fc7
leaq 0xe101(%rip), %rbp      # 0x92fcf
movq %rcx, 0x30(%rsp)
movq %rax, 0x8(%rsp)
cmpq 0x30(%rsp), %rax
je 0x85547
leaq 0xe094(%rip), %rsi      # 0x92f7e
movq %r12, %rdi
callq 0x4190
movq 0x8(%rsp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x4170
leaq 0xe30a(%rip), %rsi      # 0x93213
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xe06d(%rip), %rsi      # 0x92f8d
movq %r12, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
movq 0x8(%rsp), %rsi
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
callq 0x859a0
leaq 0x38(%rsp), %rdi
movq %rbx, %rsi
callq 0x84cff
leaq 0x88(%rsp), %rdi
callq 0x85864
leaq 0xe05a(%rip), %rsi      # 0x92fc0
movq %r12, %rdi
callq 0x4190
movq 0x48(%rsp), %rsi
addq $0x28, %rsi
leaq 0x90(%rsp), %rdi
callq 0x859d4
leaq 0xa0(%rsp), %rbx
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x84fbc
leaq 0xe02a(%rip), %rsi      # 0x92fc5
movq %r12, %rdi
callq 0x4190
leaq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x4170
movq %rax, %rdi
movq %r14, %rsi
callq 0x4190
jmp 0x84f8c
leaq 0xe006(%rip), %rsi      # 0x92fc9
movq %r12, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
andq $0x0, 0x20(%rsp)
vxorps %xmm0, %xmm0, %xmm0
leaq 0x48(%rsp), %rbx
vmovaps %xmm0, 0x10(%rsp)
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x85000
leaq 0x8(%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0x85816
jmp 0x84fe8
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
leaq -0x286(%rip), %rdx      # 0x84d8b
callq 0x86d6d
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %rbx
cmpq %rbx, %r13
je 0x8509c
leaq 0xdfa0(%rip), %rsi      # 0x92fcc
movq %r12, %rdi
callq 0x4190
movq %rax, %rdi
movq %r13, %rsi
callq 0x4170
movq %rax, %rdi
movq %r14, %rsi
callq 0x4190
leaq 0x38(%rsp), %rdi
movq %r13, %rsi
callq 0x86388
movq %rax, %r15
addq $0x10, %r15
movq (%r15), %r15
testq %r15, %r15
je 0x8507f
movq %r12, %rdi
movq %rbp, %rsi
callq 0x4190
movq 0x28(%r15), %rsi
movq %rax, %rdi
callq 0x4110
jmp 0x8505e
leaq 0xdf43(%rip), %rsi      # 0x92fc9
movq %r12, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
addq $0x20, %r13
jmp 0x85020
leaq 0xdf2f(%rip), %rsi      # 0x92fd2
movq %r12, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdf1c(%rip), %rsi      # 0x92fd6
movq %r12, %rdi
callq 0x4190
movq 0x8(%rsp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x4170
leaq 0xdf4c(%rip), %rsi      # 0x93025
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdf3a(%rip), %rsi      # 0x9302a
movq %rax, %rdi
callq 0x4190
leaq 0xdf51(%rip), %rsi      # 0x93050
movq %rax, %rdi
callq 0x4190
movq 0x8(%rsp), %rcx
movq (%rcx), %rsi
addq $0x20, %rsi
movq %rax, %rdi
callq 0x4170
leaq 0xdf2b(%rip), %rsi      # 0x9304d
movq %rax, %rdi
callq 0x4190
leaq 0xdf28(%rip), %rsi      # 0x93059
movq %rax, %rdi
callq 0x4190
leaq 0xdf42(%rip), %rsi      # 0x93082
movq %rax, %rdi
callq 0x4190
leaq 0xdf4c(%rip), %rsi      # 0x9309b
movq %rax, %rdi
callq 0x4190
leaq 0xdf74(%rip), %rsi      # 0x930d2
movq %rax, %rdi
callq 0x4190
movq 0x8(%rsp), %rcx
movq (%rcx), %rsi
addq $0x40, %rsi
movq %rax, %rdi
callq 0x4170
leaq 0xdf76(%rip), %rsi      # 0x930f7
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdf64(%rip), %rsi      # 0x930fc
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdf68(%rip), %rsi      # 0x93117
movq %r12, %rdi
callq 0x4190
movq 0x8(%rsp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x4170
leaq 0xdf7d(%rip), %rsi      # 0x9314b
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdf6a(%rip), %rsi      # 0x9314f
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdf70(%rip), %rsi      # 0x9316c
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdf75(%rip), %rsi      # 0x93188
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdf80(%rip), %rsi      # 0x931aa
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdf72(%rip), %rsi      # 0x931b3
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdf78(%rip), %rsi      # 0x931d0
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdf63(%rip), %rsi      # 0x931d2
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xde76(%rip), %rsi      # 0x930fc
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xde5c(%rip), %rsi      # 0x930f9
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdf1c(%rip), %rsi      # 0x931d0
movq %r12, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0x10(%rsp), %rdi
callq 0x85842
leaq 0x90(%rsp), %rdi
callq 0x85cda
leaq 0x38(%rsp), %rdi
callq 0x858e0
movq 0x8(%rsp), %rax
addq $0x10, %rax
jmp 0x84ed3
leaq 0xc8(%rsp), %rbx
leaq 0xdb7f(%rip), %rsi      # 0x92e81
pushq $0x10
popq %rdx
movq %rbx, %rdi
callq 0x41c0
movq 0x106a364(%rip), %rcx   # 0x10ef678
movq 0x106a355(%rip), %rax   # 0x10ef670
leaq 0xdca5(%rip), %r15      # 0x92fc7
leaq 0xdca6(%rip), %rbp      # 0x92fcf
movq %rcx, 0x30(%rsp)
movq %rax, 0x8(%rsp)
cmpq 0x30(%rsp), %rax
je 0x856e3
leaq 0xdf8c(%rip), %rsi      # 0x932d1
movq %rbx, %rdi
callq 0x4190
movq 0x8(%rsp), %rcx
movq (%rcx), %rsi
addq $0x20, %rsi
movq %rax, %rdi
callq 0x4170
leaq 0xdfae(%rip), %rsi      # 0x93316
movq %rax, %rdi
callq 0x4190
movq 0x8(%rsp), %rcx
movq (%rcx), %rsi
addq $0x40, %rsi
movq %rax, %rdi
callq 0x4170
leaq 0xdfb4(%rip), %rsi      # 0x9333f
movq %rax, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
movq 0x8(%rsp), %rsi
leaq 0x70(%rsp), %r14
movq %r14, %rdi
callq 0x859a0
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x84cff
leaq 0x78(%rsp), %rdi
callq 0x85864
leaq 0xdbf5(%rip), %rsi      # 0x92fc0
movq %rbx, %rdi
callq 0x4190
movq 0x48(%rsp), %rsi
addq $0x28, %rsi
leaq 0x90(%rsp), %rdi
callq 0x859d4
leaq 0xa0(%rsp), %r14
movq (%r14), %r14
testq %r14, %r14
je 0x85421
leaq 0xdbc5(%rip), %rsi      # 0x92fc5
movq %rbx, %rdi
callq 0x4190
leaq 0x8(%r14), %rsi
movq %rax, %rdi
callq 0x4170
movq %rax, %rdi
movq %r15, %rsi
callq 0x4190
jmp 0x853f1
leaq 0xdba1(%rip), %rsi      # 0x92fc9
movq %rbx, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
andq $0x0, 0x20(%rsp)
vxorps %xmm0, %xmm0, %xmm0
leaq 0x48(%rsp), %r14
vmovaps %xmm0, 0x10(%rsp)
movq (%r14), %r14
testq %r14, %r14
je 0x85465
leaq 0x8(%r14), %rsi
leaq 0x10(%rsp), %rdi
callq 0x85816
jmp 0x8544d
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
leaq -0x6eb(%rip), %rdx      # 0x84d8b
callq 0x86d6d
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %r12
cmpq %r12, %r13
je 0x85501
leaq 0xdb3b(%rip), %rsi      # 0x92fcc
movq %rbx, %rdi
callq 0x4190
movq %rax, %rdi
movq %r13, %rsi
callq 0x4170
movq %rax, %rdi
movq %r15, %rsi
callq 0x4190
leaq 0x38(%rsp), %rdi
movq %r13, %rsi
callq 0x86388
movq %rax, %r14
addq $0x10, %r14
movq (%r14), %r14
testq %r14, %r14
je 0x854e4
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x4190
movq 0x28(%r14), %rsi
movq %rax, %rdi
callq 0x4110
jmp 0x854c3
leaq 0xdade(%rip), %rsi      # 0x92fc9
movq %rbx, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
addq $0x20, %r13
jmp 0x85485
leaq 0xde3a(%rip), %rsi      # 0x93342
movq %rbx, %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0x10(%rsp), %rdi
callq 0x85842
leaq 0x90(%rsp), %rdi
callq 0x85cda
leaq 0x38(%rsp), %rdi
callq 0x858e0
movq 0x8(%rsp), %rax
addq $0x10, %rax
jmp 0x8532e
leaq 0xdcb4(%rip), %rsi      # 0x93202
leaq 0xc8(%rsp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
movq 0x106a106(%rip), %r12   # 0x10ef670
movq 0x106a107(%rip), %r13   # 0x10ef678
leaq 0xda0f(%rip), %rbx      # 0x92f87
leaq 0xc8(%rsp), %r14
leaq 0xdc90(%rip), %r15      # 0x93217
cmpq %r13, %r12
je 0x855bc
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4190
movq (%r12), %rsi
movq %rax, %rdi
callq 0x4170
movq %rax, %rdi
movq %r15, %rsi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
addq $0x10, %r12
jmp 0x85587
leaq 0xdc0d(%rip), %rsi      # 0x931d0
leaq 0xc8(%rsp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdc3c(%rip), %rsi      # 0x9321b
leaq 0xc8(%rsp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xd94a(%rip), %rsi      # 0x92f45
leaq 0xc8(%rsp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xc8(%rsp), %rdi
callq 0x40c0
movq 0x106a04c(%rip), %rbp   # 0x10ef670
movq 0x106a04d(%rip), %rbx   # 0x10ef678
leaq 0xc8(%rsp), %r14
leaq 0xdc15(%rip), %r15      # 0x9324f
leaq 0xdc3c(%rip), %r12      # 0x9327d
leaq 0xdc4e(%rip), %r13      # 0x93296
cmpq %rbx, %rbp
je 0x856ab
leaq 0xdbeb(%rip), %rsi      # 0x9323f
movq %r14, %rdi
callq 0x4190
movq (%rbp), %rsi
movq %rax, %rdi
callq 0x4170
movq %rax, %rdi
movq %r15, %rsi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
movq %r14, %rdi
movq %r12, %rsi
callq 0x4190
movq (%rbp), %rsi
movq %rax, %rdi
callq 0x4170
movq %rax, %rdi
movq %r13, %rsi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
addq $0x10, %rbp
jmp 0x85648
leaq 0xdc0f(%rip), %rsi      # 0x932c1
leaq 0xc8(%rsp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xdbfb(%rip), %rsi      # 0x932c9
leaq 0xc8(%rsp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x40c0
leaq 0xc8(%rsp), %rdi
callq 0x4250
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x85738
jmp 0x85754
jmp 0x85727
leaq 0x88(%rsp), %rdi
jmp 0x8571b
jmp 0x85727
jmp 0x85754
leaq 0x78(%rsp), %rdi
movq %rax, %rbx
callq 0x85864
jmp 0x85778
jmp 0x85727
movq %rax, %rbx
jmp 0x8576e
jmp 0x85754
jmp 0x85749
jmp 0x85749
jmp 0x85738
jmp 0x85738
jmp 0x85738
movq %rax, %rbx
jmp 0x85778
jmp 0x85754
jmp 0x85754
jmp 0x85754
jmp 0x85754
jmp 0x85754
jmp 0x85749
movq %rax, %rbx
jmp 0x85761
jmp 0x85754
jmp 0x85754
jmp 0x85754
leaq 0x10(%rsp), %rdi
movq %rax, %rbx
callq 0x85842
leaq 0x90(%rsp), %rdi
callq 0x85cda
leaq 0x38(%rsp), %rdi
callq 0x858e0
leaq 0xc8(%rsp), %rdi
callq 0x4250
movq %rbx, %rdi
callq 0x42c0
nop