// File: /workspace/github_cpp_makefile_star2_O1/canzarlab[P]Trajan/src/LP.cpp
// Function: LP::WriteSolution(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void LP::WriteSolution(string fileName)
{
    ofstream sol_file(fileName);
    double weight = 0;
    vn n1 = t1.GetNodes(), n2 = t2.GetNodes();
    for (size_t i = 0; i < K.size(); i++)
    {
        for (size_t j = 0; j < K[i].size(); j++)
        {
            if (K[i][j] != -1 && x(K[i][j]) > 0)
            {
                weight += x(K[i][j]) * c(K[i][j]);
                sol_file << n1[i]->taxon << " " << n2[j]->taxon << " " << x(K[i][j]) << "\n"; 
            }
        }
    }
    ofstream trp_file(fileName + ".trp");
    for (auto& t : Triplets)
        trp_file << t.row() << " " << t.col() << " " << t.value() << '\n';
    PrintScore(weight);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x468, %rsp            # imm = 0x468
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x268(%rsp), %rdi
movl $0x10, %edx
callq 0x9700
movq 0x30(%rbx), %rax
movq 0x68(%rax), %rsi
movl 0x70(%rax), %edx
leaq 0x50(%rsp), %rdi
callq 0x3d303
movq 0x38(%rbx), %rax
movq 0x68(%rax), %rsi
movl 0x70(%rax), %edx
leaq 0x38(%rsp), %rdi
callq 0x3d303
movq %r14, 0x28(%rsp)
movq 0xe8(%rbx), %rax
cmpq 0xe0(%rbx), %rax
je 0x363c7
xorpd %xmm1, %xmm1
xorl %r14d, %r14d
leaq 0x26028(%rip), %r12     # 0x5c262
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movq 0xe0(%rbx), %rcx
leaq (%r14,%r14,2), %r15
movq (%rcx,%r15,8), %rax
cmpq %rax, 0x8(%rcx,%r15,8)
je 0x36399
xorl %r13d, %r13d
movslq (%rax,%r13,4), %rax
cmpq $-0x1, %rax
je 0x36376
testl %eax, %eax
js 0x3655f
cmpq %rax, 0xc8(%rbx)
jle 0x3655f
movq 0xc0(%rbx), %rcx
movsd (%rcx,%rax,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x36376
cmpq %rax, 0x100(%rbx)
jle 0x3655f
movq 0xf8(%rbx), %rcx
mulsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x50(%rsp), %rax
movq (%rax,%r14,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
leaq 0x268(%rsp), %rdi
callq 0x93a0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x93a0
movq 0x38(%rsp), %rax
movq (%rax,%r13,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %rbp, %rdi
callq 0x93a0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x93a0
movq 0xe0(%rbx), %rax
movq (%rax,%r15,8), %rax
movslq (%rax,%r13,4), %rax
testq %rax, %rax
js 0x3655f
cmpq %rax, 0xc8(%rbx)
jle 0x3655f
movq 0xc0(%rbx), %rcx
movsd (%rcx,%rax,8), %xmm0
movq %rbp, %rdi
callq 0x9560
movl $0x1, %edx
movq %rax, %rdi
leaq 0x39c5b(%rip), %rsi     # 0x6ffb8
callq 0x93a0
movsd (%rsp), %xmm0
addsd 0x30(%rsp), %xmm0
movsd %xmm0, (%rsp)
xorpd %xmm1, %xmm1
incq %r13
movq 0xe0(%rbx), %rcx
movq (%rcx,%r15,8), %rax
movq 0x8(%rcx,%r15,8), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rcx, %r13
jb 0x36260
movq 0xe8(%rbx), %rax
subq 0xe0(%rbx), %rax
incq %r14
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
cmpq %rax, %r14
jb 0x36243
jmp 0x363d0
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0xda94
leaq 0x38f4e(%rip), %rsi     # 0x6f347
leaq 0x8(%rsp), %rdi
callq 0x96f0
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movl $0x10, %edx
callq 0x9700
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3642e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x9340
movq 0x88(%rbx), %rbp
movq 0x90(%rbx), %r14
cmpq %r14, %rbp
je 0x364b6
leaq 0x25e1a(%rip), %r15     # 0x5c262
leaq 0x8(%rsp), %r12
movl (%rbp), %esi
leaq 0x68(%rsp), %rdi
callq 0x9640
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x93a0
movl 0x4(%rbp), %esi
movq %r13, %rdi
callq 0x9640
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x93a0
movsd 0x8(%rbp), %xmm0
movq %r13, %rdi
callq 0x9560
movb $0xa, 0x8(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x93a0
addq $0x10, %rbp
cmpq %r14, %rbp
jne 0x3644d
movq %rbx, %rdi
movsd (%rsp), %xmm0
callq 0x3472a
movq 0x51ad6(%rip), %rax     # 0x87fa0
movq (%rax), %rbx
movq 0x18(%rax), %r14
leaq 0x70(%rsp), %rdi
movq %rbx, -0x8(%rdi)
movq -0x18(%rbx), %rax
movq %r14, 0x68(%rsp,%rax)
callq 0x92c0
leaq 0x160(%rsp), %rdi
callq 0x9110
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x3650c
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x9340
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x36523
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x9340
leaq 0x270(%rsp), %rdi
movq %rbx, -0x8(%rdi)
movq -0x18(%rbx), %rax
movq %r14, 0x268(%rsp,%rax)
callq 0x92c0
leaq 0x360(%rsp), %rdi
callq 0x9110
addq $0x468, %rsp            # imm = 0x468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x26cbf(%rip), %rdi     # 0x5d225
leaq 0x26cd5(%rip), %rsi     # 0x5d242
leaq 0x26cf1(%rip), %rcx     # 0x5d265
movl $0x1a9, %edx            # imm = 0x1A9
callq 0x9200
jmp 0x365aa
jmp 0x36582
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x365bc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x9340
jmp 0x365bc
jmp 0x365b9
movq %rax, %rbx
jmp 0x365d3
movq %rax, %rbx
jmp 0x365ea
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x9500
jmp 0x365bc
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x365d3
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x9340
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x365ea
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x9340
leaq 0x268(%rsp), %rdi
callq 0x9500
movq %rbx, %rdi
callq 0x9670
nop