// File: /workspace/github_cpp_makefile_star2_O1/cmaureir[P]strip-packing/scattersearch.cpp
// Function: print_tikz(solution)
void print_tikz(solution sol){

 const string colors[] ={
        "blue",
        "brown",
        "cyan",
        "gray",
        "green",
        "magenta",
        "orange",
        "purple",
        "red",
        "violet",
        "yellow"};

    time_t ltime;
    struct tm *Tm;
    ltime = time(NULL);
    Tm = localtime(&ltime);

    stringstream ss;
    ss << "diagrams/";
    ss << Tm->tm_mday << "-";
    ss << Tm->tm_mon + 1  << "-";
    ss << Tm->tm_year + 1900 << "_";
    ss << Tm->tm_hour << "-";
    ss << Tm->tm_min << "-";
    ss << Tm->tm_sec << ".tex";

    string path = ss.str();
    ofstream file(path.c_str());
    file << "\\documentclass[dvipsnames]{article}\n";
    file << "\\usepackage[pdftex,active,tightpage]{preview}\n";
    file << "\\usepackage[utf8]{inputenc}\n";
    file << "\\usepackage{tikz}\n";
    file << "\\PreviewEnvironment{tikzpicture}\n";
    file << "\n";
    file << "\\begin{document}\n";
    file << "  \\begin{tikzpicture}[scale=0.75]\n";
    file << "    \\begin{scope}\n";

    file << "       \\draw (0 ," << sol.fitness << ") -- (0,0) -- (" << strip_width << ",0) -- (" << strip_width << "," << sol.fitness << ");\n";
    for (int i = 0; i < (int)sol.items.size(); i++) {
        file << "           \\filldraw["<<colors[i%11]<<",draw=black] (" << sol.a[i] << "," << sol.b[i] << ") rectangle (" << sol.a[i] + bs[sol.items[i]-1].width << "," << sol.b[i] + bs[sol.items[i]-1].height << ");\n";
        file << "           \\draw (" << sol.a[i] +  bs[sol.items[i]-1].width/2.0 << "," << sol.b[i] + bs[sol.items[i]-1].height/2.0 << ") node {" << sol.items[i] << "};\n";
        file << "\n";
    }

    file << "     \\end{scope}\n";
    file << "  \\end{tikzpicture}\n";
    file << "\\end{document}\n";

    file.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x518, %rsp            # imm = 0x518
movq %rdi, %rbx
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x71fa(%rip), %rsi      # 0xd11b
leaq 0x71f7(%rip), %rdx      # 0xd11f
leaq 0x30(%rsp), %r15
movq %r15, %rdi
callq 0x8fa8
leaq 0x50(%rsp), %r14
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x71d6(%rip), %rsi      # 0xd120
leaq 0x71d4(%rip), %rdx      # 0xd125
movq %r14, %rdi
callq 0x8fa8
leaq 0x70(%rsp), %r14
leaq 0x80(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x71b5(%rip), %rsi      # 0xd126
leaq 0x71b2(%rip), %rdx      # 0xd12a
movq %r14, %rdi
callq 0x8fa8
leaq 0x90(%rsp), %r14
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7190(%rip), %rsi      # 0xd12b
leaq 0x718d(%rip), %rdx      # 0xd12f
movq %r14, %rdi
callq 0x8fa8
leaq 0xb0(%rsp), %r14
leaq 0xc0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x716b(%rip), %rsi      # 0xd130
leaq 0x7169(%rip), %rdx      # 0xd135
movq %r14, %rdi
callq 0x8fa8
leaq 0xd0(%rsp), %r14
leaq 0xe0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7147(%rip), %rsi      # 0xd136
leaq 0x7147(%rip), %rdx      # 0xd13d
movq %r14, %rdi
callq 0x8fa8
leaq 0xf0(%rsp), %r14
leaq 0x100(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7125(%rip), %rsi      # 0xd13e
leaq 0x7124(%rip), %rdx      # 0xd144
movq %r14, %rdi
callq 0x8fa8
leaq 0x110(%rsp), %r14
leaq 0x120(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7102(%rip), %rsi      # 0xd145
leaq 0x7101(%rip), %rdx      # 0xd14b
movq %r14, %rdi
callq 0x8fa8
leaq 0x130(%rsp), %r14
leaq 0x140(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x70df(%rip), %rsi      # 0xd14c
leaq 0x70db(%rip), %rdx      # 0xd14f
movq %r14, %rdi
callq 0x8fa8
leaq 0x150(%rsp), %r14
leaq 0x160(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x70b9(%rip), %rsi      # 0xd150
leaq 0x70b8(%rip), %rdx      # 0xd156
movq %r14, %rdi
callq 0x8fa8
leaq 0x170(%rsp), %r14
leaq 0x180(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x7095(%rip), %rsi      # 0xd157
leaq 0x7094(%rip), %rdx      # 0xd15d
movq %r14, %rdi
callq 0x8fa8
xorl %edi, %edi
callq 0x4240
leaq 0x28(%rsp), %rdi
movq %rax, (%rdi)
callq 0x41d0
movq %rax, %r14
leaq 0x390(%rsp), %rdi
callq 0x4190
leaq 0x3a0(%rsp), %r15
leaq 0x705a(%rip), %rsi      # 0xd15e
movl $0x9, %edx
movq %r15, %rdi
callq 0x42e0
movl 0xc(%r14), %esi
movq %r15, %rdi
callq 0x4420
leaq 0x7044(%rip), %rsi      # 0xd168
movl $0x1, %edx
movq %rax, %rdi
callq 0x42e0
movl 0x10(%r14), %esi
incl %esi
movq %r15, %rdi
callq 0x4420
leaq 0x7022(%rip), %rsi      # 0xd168
movl $0x1, %edx
movq %rax, %rdi
callq 0x42e0
movl $0x76c, %esi            # imm = 0x76C
addl 0x14(%r14), %esi
movq %r15, %rdi
callq 0x4420
leaq 0x6fff(%rip), %rsi      # 0xd16a
movl $0x1, %edx
movq %rax, %rdi
callq 0x42e0
movl 0x8(%r14), %esi
movq %r15, %rdi
callq 0x4420
leaq 0x6fdd(%rip), %rsi      # 0xd168
movl $0x1, %edx
movq %rax, %rdi
callq 0x42e0
movl 0x4(%r14), %esi
movq %r15, %rdi
callq 0x4420
leaq 0x6fbd(%rip), %rsi      # 0xd168
movl $0x1, %edx
movq %rax, %rdi
callq 0x42e0
movl (%r14), %esi
movq %r15, %rdi
callq 0x4420
leaq 0x6fa2(%rip), %rsi      # 0xd16c
movl $0x4, %edx
movq %rax, %rdi
callq 0x42e0
leaq 0x3a8(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x43d0
movq 0x8(%rsp), %rsi
leaq 0x190(%rsp), %rdi
movl $0x10, %edx
callq 0x42a0
leaq 0x6f6a(%rip), %rsi      # 0xd171
leaq 0x190(%rsp), %rdi
movl $0x24, %edx
callq 0x42e0
leaq 0x6f76(%rip), %rsi      # 0xd196
leaq 0x190(%rsp), %rdi
movl $0x2e, %edx
callq 0x42e0
leaq 0x6f8c(%rip), %rsi      # 0xd1c5
leaq 0x190(%rsp), %rdi
movl $0x1c, %edx
callq 0x42e0
leaq 0x6f90(%rip), %rsi      # 0xd1e2
leaq 0x190(%rsp), %rdi
movl $0x12, %edx
callq 0x42e0
leaq 0x6f8a(%rip), %rsi      # 0xd1f5
leaq 0x190(%rsp), %rdi
movl $0x21, %edx
callq 0x42e0
leaq 0x6fff(%rip), %rsi      # 0xd283
leaq 0x190(%rsp), %rdi
movl $0x1, %edx
callq 0x42e0
leaq 0x6f7a(%rip), %rsi      # 0xd217
leaq 0x190(%rsp), %rdi
movl $0x11, %edx
callq 0x42e0
leaq 0x6f73(%rip), %rsi      # 0xd229
leaq 0x190(%rsp), %rdi
movl $0x22, %edx
callq 0x42e0
leaq 0x6f7d(%rip), %rsi      # 0xd24c
leaq 0x190(%rsp), %rdi
movl $0x12, %edx
callq 0x42e0
leaq 0x6f77(%rip), %rsi      # 0xd25f
leaq 0x190(%rsp), %rdi
movl $0x11, %edx
callq 0x42e0
cvtss2sd 0x50(%rbx), %xmm0
leaq 0x190(%rsp), %rdi
callq 0x43e0
movq %rax, %r14
leaq 0x6f5b(%rip), %rsi      # 0xd271
movl $0xf, %edx
movq %rax, %rdi
callq 0x42e0
movl 0xc047(%rip), %esi      # 0x12370
movq %r14, %rdi
callq 0x4420
movq %rax, %r14
leaq 0x6f3d(%rip), %rsi      # 0xd278
movl $0x8, %edx
movq %rax, %rdi
callq 0x42e0
movl 0xc022(%rip), %esi      # 0x12370
movq %r14, %rdi
callq 0x4420
movq %rax, %r14
leaq 0x6f0f(%rip), %rsi      # 0xd26f
movl $0x1, %edx
movq %rax, %rdi
callq 0x42e0
xorps %xmm0, %xmm0
cvtss2sd 0x50(%rbx), %xmm0
movq %r14, %rdi
callq 0x43e0
leaq 0x6efd(%rip), %rsi      # 0xd281
movl $0x3, %edx
movq %rax, %rdi
callq 0x42e0
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x2, %rax
testl %eax, %eax
jle 0x65de
xorl %r13d, %r13d
leaq 0x190(%rsp), %r15
xorl %ebp, %ebp
movq %rbp, %rax
movabsq $0x2e8ba2e8ba2e8ba3, %rcx # imm = 0x2E8BA2E8BA2E8BA3
mulq %rcx
movq %rdx, %r14
movl $0x15, %edx
movq %r15, %rdi
leaq 0x6eb2(%rip), %rsi      # 0xd285
callq 0x42e0
shrq %r14
imulq $-0x160, %r14, %rax     # imm = 0xFEA0
addq %rsp, %rax
addq $0x30, %rax
movq (%rax,%r13,8), %rsi
movq 0x8(%rax,%r13,8), %rdx
movq %r15, %rdi
callq 0x42e0
movq %rax, %r14
movl $0xe, %edx
movq %rax, %rdi
leaq 0x6e8f(%rip), %rsi      # 0xd29b
callq 0x42e0
movq 0x18(%rbx), %rax
movl (%rax,%r13), %esi
movq %r14, %rdi
callq 0x4420
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6e3c(%rip), %rsi      # 0xd26f
callq 0x42e0
movq 0x30(%rbx), %rax
movl (%rax,%r13), %esi
movq %r14, %rdi
callq 0x4420
movq %rax, %r14
movl $0xd, %edx
movq %rax, %rdi
leaq 0x6e50(%rip), %rsi      # 0xd2aa
callq 0x42e0
movq (%rbx), %rax
movq 0x18(%rbx), %rcx
movslq (%rax,%r13), %rax
movq 0xbee7(%rip), %rdx      # 0x12358
leaq (%rax,%rax,2), %rax
movl -0x4(%rdx,%rax,4), %esi
addl (%rcx,%r13), %esi
movq %r14, %rdi
callq 0x4420
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6dd8(%rip), %rsi      # 0xd26f
callq 0x42e0
movq (%rbx), %rax
movq 0x30(%rbx), %rcx
movslq (%rax,%r13), %rax
movq 0xbeaa(%rip), %rdx      # 0x12358
leaq (%rax,%rax,2), %rax
movl -0x8(%rdx,%rax,4), %esi
addl (%rcx,%r13), %esi
movq %r14, %rdi
callq 0x4420
movl $0x3, %edx
movq %rax, %rdi
leaq 0x6db0(%rip), %rsi      # 0xd281
callq 0x42e0
movl $0x12, %edx
movq %r15, %rdi
leaq 0x6dd3(%rip), %rsi      # 0xd2b8
callq 0x42e0
movq 0x18(%rbx), %rax
cvtsi2sdl (%rax,%r13), %xmm1
movq (%rbx), %rax
movslq (%rax,%r13), %rax
movq 0xbe56(%rip), %rcx      # 0x12358
leaq (%rax,%rax,2), %rax
cvtsi2sdl -0x4(%rcx,%rax,4), %xmm0
mulsd 0x6b3c(%rip), %xmm0     # 0xd050
addsd %xmm1, %xmm0
movq %r15, %rdi
callq 0x43e0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6d3d(%rip), %rsi      # 0xd26f
callq 0x42e0
movq 0x30(%rbx), %rax
xorps %xmm1, %xmm1
cvtsi2sdl (%rax,%r13), %xmm1
movq (%rbx), %rax
movslq (%rax,%r13), %rax
movq 0xbe06(%rip), %rcx      # 0x12358
leaq (%rax,%rax,2), %rax
xorps %xmm0, %xmm0
cvtsi2sdl -0x8(%rcx,%rax,4), %xmm0
mulsd 0x6ae9(%rip), %xmm0     # 0xd050
addsd %xmm1, %xmm0
movq %r14, %rdi
callq 0x43e0
movq %rax, %r14
movl $0x8, %edx
movq %rax, %rdi
leaq 0x6d46(%rip), %rsi      # 0xd2cb
callq 0x42e0
movq (%rbx), %rax
movl (%rax,%r13), %esi
movq %r14, %rdi
callq 0x4420
movl $0x3, %edx
movq %rax, %rdi
leaq 0x6d2c(%rip), %rsi      # 0xd2d4
callq 0x42e0
movl $0x1, %edx
movq %r15, %rdi
leaq 0x6cc7(%rip), %rsi      # 0xd283
callq 0x42e0
incq %rbp
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x2, %rax
cltq
addq $0x4, %r13
cmpq %rax, %rbp
jl 0x63b1
leaq 0x6cf3(%rip), %rsi      # 0xd2d8
leaq 0x190(%rsp), %rdi
movl $0x11, %edx
callq 0x42e0
leaq 0x6cec(%rip), %rsi      # 0xd2ea
leaq 0x190(%rsp), %rdi
movl $0x14, %edx
callq 0x42e0
leaq 0x6ce8(%rip), %rsi      # 0xd2ff
leaq 0x190(%rsp), %rdi
movl $0xf, %edx
callq 0x42e0
leaq 0x190(%rsp), %rdi
callq 0x4350
movq 0xb97b(%rip), %rax      # 0x11fb8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x198(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x190(%rsp,%rcx)
callq 0x4200
leaq 0x288(%rsp), %rdi
callq 0x40d0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6689
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4290
movq 0xb908(%rip), %rsi      # 0x11f98
leaq 0x390(%rsp), %rdi
callq 0x41c0
leaq 0x410(%rsp), %rdi
callq 0x40d0
movq $-0x160, %rbx           # imm = 0xFEA0
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0x66c7
movq (%r12), %rsi
incq %rsi
callq 0x4290
addq $-0x20, %r12
addq $0x20, %rbx
jne 0x66b1
addq $0x518, %rsp            # imm = 0x518
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x6761
jmp 0x674a
movq %rax, %rbx
jmp 0x679d
jmp 0x6704
jmp 0x6704
jmp 0x6704
jmp 0x6704
jmp 0x6704
jmp 0x6704
jmp 0x6704
jmp 0x6704
jmp 0x6704
movq %rax, %rbx
cmpq %r14, %r15
je 0x67c9
addq $-0x10, %r14
leaq 0x30(%rsp), %r15
movq -0x10(%r14), %rdi
cmpq %rdi, %r14
je 0x672d
movq (%r14), %rsi
incq %rsi
callq 0x4290
leaq -0x20(%r14), %rax
addq $-0x10, %r14
cmpq %r15, %r14
movq %rax, %r14
jne 0x6719
jmp 0x67c9
movq %rax, %rbx
movq %r15, %r14
jmp 0x6707
movq %rax, %rbx
jmp 0x677c
jmp 0x6751
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0x4370
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x677c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4290
movq 0xb815(%rip), %rsi      # 0x11f98
leaq 0x390(%rsp), %rdi
callq 0x41c0
leaq 0x410(%rsp), %rdi
callq 0x40d0
xorl %r14d, %r14d
movq 0x170(%rsp,%r14), %rdi
leaq (%r12,%r14), %rax
cmpq %rdi, %rax
je 0x67bc
movq (%rax), %rsi
incq %rsi
callq 0x4290
addq $-0x20, %r14
cmpq $-0x160, %r14           # imm = 0xFEA0
jne 0x67a0
movq %rbx, %rdi
callq 0x4450