// File: /workspace/github_cpp_makefile_star2_O2/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 $0x478, %rsp            # imm = 0x478
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x278(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x96e0
movq 0x30(%rbx), %rsi
leaq 0x40(%rsp), %rdi
callq 0x312e0
movq %r14, 0x18(%rsp)
movq 0x38(%rbx), %rsi
leaq 0x28(%rsp), %rdi
callq 0x312e0
leaq 0xc0(%rbx), %r15
leaq 0xf8(%rbx), %rax
movq %rax, 0x20(%rsp)
movq 0xe0(%rbx), %rcx
xorl %r14d, %r14d
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0xe8(%rbx), %rax
subq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
cmpq %rax, %r14
jae 0x32e78
imulq $0x18, %r14, %r12
xorl %ebp, %ebp
movq (%rcx,%r12), %rax
movq 0x8(%rcx,%r12), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rdx, %rbp
jae 0x32e70
movslq (%rax,%rbp,4), %rsi
cmpq $-0x1, %rsi
je 0x32e68
movq %r15, %rdi
callq 0xd27a
movsd (%rax), %xmm0
ucomisd 0x1e68b(%rip), %xmm0    # 0x51408
movq 0xe0(%rbx), %rcx
jbe 0x32e68
movq (%rcx,%r12), %rax
movslq (%rax,%rbp,4), %rsi
movq %r15, %rdi
callq 0xd27a
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0xe0(%rbx), %rax
movq (%rax,%r12), %rax
movslq (%rax,%rbp,4), %rsi
movq 0x20(%rsp), %rdi
callq 0xd27a
movsd 0x10(%rsp), %xmm0
mulsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x40(%rsp), %rax
movq (%rax,%r14,8), %rsi
addq $0x8, %rsi
leaq 0x278(%rsp), %rdi
callq 0x92d0
movq %rax, %rdi
leaq 0x1e471(%rip), %rsi     # 0x51262
callq 0x9330
movq 0x28(%rsp), %rcx
movq (%rcx,%rbp,8), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x92d0
movq %rax, %rdi
leaq 0x1e44d(%rip), %rsi     # 0x51262
callq 0x9330
movq %rax, %r13
movq 0xe0(%rbx), %rax
movq (%rax,%r12), %rax
movslq (%rax,%rbp,4), %rsi
movq %r15, %rdi
callq 0xd27a
movsd (%rax), %xmm0
movq %r13, %rdi
callq 0x9540
movq %rax, %rdi
leaq 0x3b1e6(%rip), %rsi     # 0x6e030
callq 0x9330
movsd 0x8(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0xe0(%rbx), %rcx
incq %rbp
jmp 0x32d42
incq %r14
jmp 0x32d21
leaq 0x39bac(%rip), %rdx     # 0x6ca2b
leaq 0x58(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x33423
leaq 0x78(%rsp), %rdi
leaq 0x58(%rsp), %rsi
pushq $0x10
popq %rdx
callq 0x96e0
leaq 0x58(%rsp), %rdi
callq 0x9708
movq 0x88(%rbx), %r12
movq 0x90(%rbx), %r13
leaq 0x78(%rsp), %r14
leaq 0x1e39e(%rip), %r15     # 0x51262
pushq $0xa
popq %rbp
cmpq %r13, %r12
je 0x32f1a
movl (%r12), %esi
movq %r14, %rdi
callq 0x9610
movq %rax, %rdi
movq %r15, %rsi
callq 0x9330
movl 0x4(%r12), %esi
movq %rax, %rdi
callq 0x9610
movq %rax, %rdi
movq %r15, %rsi
callq 0x9330
movsd 0x8(%r12), %xmm0
movq %rax, %rdi
callq 0x9540
movq %rax, %rdi
movl %ebp, %esi
callq 0x93b0
addq $0x10, %r12
jmp 0x32ec7
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x31c84
leaq 0x78(%rsp), %rdi
callq 0x94f0
leaq 0x28(%rsp), %rdi
callq 0xbeac
leaq 0x40(%rsp), %rdi
callq 0xbeac
leaq 0x278(%rsp), %rdi
callq 0x94f0
addq $0x478, %rsp            # imm = 0x478
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x32f82
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x9708
jmp 0x32f94
jmp 0x32f91
movq %rax, %rbx
jmp 0x32f9e
movq %rax, %rbx
jmp 0x32fa8
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x94f0
jmp 0x32f94
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xbeac
leaq 0x40(%rsp), %rdi
callq 0xbeac
leaq 0x278(%rsp), %rdi
callq 0x94f0
movq %rbx, %rdi
callq 0x9640
nop