// File: canzarlab[P]Trajan/src/LP.cpp
// Function: LP::SolveLP()
bool LP::SolveLP()
{
    clog << "nr_rows = " << nr_rows << " and nr_cols = " << nr_cols << endl;

    SpMat A(nr_rows, nr_cols);
    A.setFromTriplets(Triplets.begin(), Triplets.end());
    SpMat A_t = A.transpose();
    Vector b = Vector::Ones(nr_rows);

    x = warm_x;
    //x = Vector::Zero(nr_cols);
    y = Vector::Zero(nr_rows);

    Vector c1 = -c;
    PackingJRF simpleJRF(A, b, c1, warm_x, y);
    AugmentedLagrangian solver(simpleJRF, 15);
    solver.setParameter("verbose", false);
    solver.setParameter("pgtol", 1e-1); // should influence running time a lot
    solver.setParameter("constraintsTol", 1e-3);
    Timer timeGeno;
    timeGeno.start();
    solver.solve();
    timeGeno.stop();

    clog << "f = " << solver.f() << " computed in time: " << timeGeno.secs() << " secs" << endl;

    warm_x = x = Vector::ConstMapType(solver.x(), nr_cols);
    y = Vector::ConstMapType(solver.y(), nr_rows);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2e0(%rbp)
movq 0xf335f(%rip), %rdi     # 0x1a0f50
leaq 0x7c644(%rip), %rsi     # 0x12a23c
callq 0xa440
movq %rax, %rdi
movq -0x2e0(%rbp), %rax
movl 0x108(%rax), %esi
callq 0xa790
movq %rax, %rdi
leaq 0x7c62b(%rip), %rsi     # 0x12a247
callq 0xa440
movq %rax, %rdi
movq -0x2e0(%rbp), %rax
movl 0x10c(%rax), %esi
callq 0xa790
movq %rax, %rdi
movq 0xf3320(%rip), %rsi     # 0x1a0f60
callq 0xa4a0
movq -0x2e0(%rbp), %rax
movslq 0x108(%rax), %rsi
movslq 0x10c(%rax), %rdx
leaq -0x50(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0xaf0a0
movq -0x2e0(%rbp), %rdi
addq $0x88, %rdi
movq %rdi, -0x2d8(%rbp)
callq 0xaf180
movq -0x2d8(%rbp), %rdi
movq %rax, -0x58(%rbp)
callq 0xaf1b0
movq -0x2d0(%rbp), %rdi
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0xaf130
jmp 0xadcae
leaq -0x50(%rbp), %rdi
callq 0xaf1e0
movq %rdx, -0x2f0(%rbp)
movb %al, -0x2e1(%rbp)
jmp 0xadcc6
movq -0x2f0(%rbp), %rax
movb -0x2e1(%rbp), %cl
movb %cl, -0xc8(%rbp)
movq %rax, -0xc0(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xaf210
jmp 0xadcf5
movq -0x2e0(%rbp), %rax
movslq 0x108(%rax), %rsi
leaq -0xf0(%rbp), %rdi
callq 0xaf2b0
jmp 0xadd11
leaq -0xd8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0xaf2f0
jmp 0xadd26
movq -0x2e0(%rbp), %rdi
movq %rdi, %rsi
addq $0xa0, %rsi
addq $0xc0, %rdi
callq 0x145a0
jmp 0xadd45
movq -0x2e0(%rbp), %rax
movslq 0x108(%rax), %rsi
leaq -0x108(%rbp), %rdi
callq 0x13c30
jmp 0xadd61
movq -0x2e0(%rbp), %rdi
addq $0xd0, %rdi
leaq -0x108(%rbp), %rsi
callq 0x28100
jmp 0xadd7d
movq -0x2e0(%rbp), %rsi
addq $0xf8, %rsi
leaq -0x128(%rbp), %rdi
callq 0xaf330
jmp 0xadd99
leaq -0x118(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0xaf380
jmp 0xaddae
movq -0x2e0(%rbp), %r9
movq %r9, %r8
addq $0xa0, %r8
addq $0xd0, %r9
leaq -0x168(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
leaq -0x118(%rbp), %rcx
callq 0xaf3c0
jmp 0xadde6
leaq -0x1d0(%rbp), %rdi
leaq -0x168(%rbp), %rsi
movl $0xf, %edx
callq 0x124e0
jmp 0xade00
leaq -0x1f1(%rbp), %rdi
movq %rdi, -0x2f8(%rbp)
callq 0xa7d0
movq -0x2f8(%rbp), %rdx
leaq 0x5d5e9(%rip), %rsi     # 0x10b40a
leaq -0x1f0(%rbp), %rdi
callq 0xe9b0
jmp 0xade2f
leaq -0x1d0(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
xorps %xmm0, %xmm0
callq 0x139e0
jmp 0xade47
leaq -0x1f0(%rbp), %rdi
callq 0xa8d8
leaq -0x1f1(%rbp), %rdi
callq 0xa4c0
leaq -0x219(%rbp), %rdi
movq %rdi, -0x300(%rbp)
callq 0xa7d0
movq -0x300(%rbp), %rdx
leaq 0x5d568(%rip), %rsi     # 0x10b3e8
leaq -0x218(%rbp), %rdi
callq 0xe9b0
jmp 0xade8e
leaq -0x1d0(%rbp), %rdi
leaq -0x218(%rbp), %rsi
movsd 0x5fdcc(%rip), %xmm0    # 0x10dc70
callq 0x139e0
jmp 0xadeab
leaq -0x218(%rbp), %rdi
callq 0xa8d8
leaq -0x219(%rbp), %rdi
callq 0xa4c0
leaq -0x241(%rbp), %rdi
movq %rdi, -0x308(%rbp)
callq 0xa7d0
movq -0x308(%rbp), %rdx
leaq 0x5d517(%rip), %rsi     # 0x10b3fb
leaq -0x240(%rbp), %rdi
callq 0xe9b0
jmp 0xadef2
leaq -0x1d0(%rbp), %rdi
leaq -0x240(%rbp), %rsi
movsd 0x5fd78(%rip), %xmm0    # 0x10dc80
callq 0x139e0
jmp 0xadf0f
leaq -0x240(%rbp), %rdi
callq 0xa8d8
leaq -0x241(%rbp), %rdi
callq 0xa4c0
leaq -0x288(%rbp), %rdi
callq 0xeb30
jmp 0xadf35
leaq -0x288(%rbp), %rdi
callq 0xeb50
jmp 0xadf43
leaq -0x1d0(%rbp), %rdi
callq 0x125f0
jmp 0xadf51
leaq -0x288(%rbp), %rdi
callq 0xf350
jmp 0xadf5f
movq 0xf2fea(%rip), %rdi     # 0x1a0f50
leaq 0x7fdd7(%rip), %rsi     # 0x12dd44
callq 0xa440
movq %rax, -0x310(%rbp)
jmp 0xadf7b
leaq -0x1d0(%rbp), %rdi
callq 0x139c0
movsd %xmm0, -0x318(%rbp)
jmp 0xadf91
movsd -0x318(%rbp), %xmm0
movq -0x310(%rbp), %rdi
callq 0xa870
movq %rax, -0x320(%rbp)
jmp 0xadfae
movq -0x320(%rbp), %rdi
leaq 0x7c29b(%rip), %rsi     # 0x12a257
callq 0xa440
movq %rax, -0x328(%rbp)
jmp 0xadfca
leaq -0x288(%rbp), %rdi
callq 0xf3b0
movss %xmm0, -0x32c(%rbp)
jmp 0xadfe0
movss -0x32c(%rbp), %xmm0
movq -0x328(%rbp), %rdi
callq 0xa340
movq %rax, -0x338(%rbp)
jmp 0xadffd
movq -0x338(%rbp), %rdi
leaq 0x5d261(%rip), %rsi     # 0x10b26c
callq 0xa440
movq %rax, -0x340(%rbp)
jmp 0xae019
movq -0x340(%rbp), %rdi
movq 0xf2f39(%rip), %rsi     # 0x1a0f60
callq 0xa4a0
jmp 0xae02e
leaq -0x1d0(%rbp), %rdi
callq 0x13980
movq %rax, -0x348(%rbp)
jmp 0xae043
movq -0x2e0(%rbp), %rax
movslq 0x10c(%rax), %rax
movq %rax, -0x350(%rbp)
leaq -0x2a2(%rbp), %rdi
callq 0x160e0
jmp 0xae066
movq -0x350(%rbp), %rdx
movq -0x348(%rbp), %rsi
leaq -0x2a0(%rbp), %rdi
leaq -0x2a2(%rbp), %rcx
callq 0x1cea0
jmp 0xae089
movq -0x2e0(%rbp), %rdi
addq $0xc0, %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x14740
movq %rax, -0x358(%rbp)
jmp 0xae0ac
movq -0x358(%rbp), %rsi
movq -0x2e0(%rbp), %rdi
addq $0xa0, %rdi
callq 0x145a0
jmp 0xae0c8
leaq -0x1d0(%rbp), %rdi
callq 0x139a0
movq %rax, -0x360(%rbp)
jmp 0xae0dd
movq -0x2e0(%rbp), %rax
movslq 0x108(%rax), %rax
movq %rax, -0x368(%rbp)
leaq -0x2c2(%rbp), %rdi
callq 0x160e0
jmp 0xae100
movq -0x368(%rbp), %rdx
movq -0x360(%rbp), %rsi
leaq -0x2c0(%rbp), %rdi
leaq -0x2c2(%rbp), %rcx
callq 0x1cea0
jmp 0xae123
movq -0x2e0(%rbp), %rdi
addq $0xd0, %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x14740
jmp 0xae13f
leaq -0x1d0(%rbp), %rdi
callq 0xaf420
leaq -0x168(%rbp), %rdi
callq 0xaf450
leaq -0x118(%rbp), %rdi
callq 0xff40
leaq -0xd8(%rbp), %rdi
callq 0xff40
leaq -0xb8(%rbp), %rdi
callq 0xaf470
leaq -0x50(%rbp), %rdi
callq 0xaf470
movb $0x1, %al
andb $0x1, %al
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xae2ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xae2be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xae2b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xae2a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xae29a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xae20c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0xa8d8
leaq -0x1f1(%rbp), %rdi
callq 0xa4c0
jmp 0xae28e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xae240
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x218(%rbp), %rdi
callq 0xa8d8
leaq -0x219(%rbp), %rdi
callq 0xa4c0
jmp 0xae28e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xae274
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x240(%rbp), %rdi
callq 0xa8d8
leaq -0x241(%rbp), %rdi
callq 0xa4c0
jmp 0xae28e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0xaf420
leaq -0x168(%rbp), %rdi
callq 0xaf450
leaq -0x118(%rbp), %rdi
callq 0xff40
leaq -0xd8(%rbp), %rdi
callq 0xff40
leaq -0xb8(%rbp), %rdi
callq 0xaf470
leaq -0x50(%rbp), %rdi
callq 0xaf470
movq -0x68(%rbp), %rdi
callq 0xa7c0
nopl (%rax)