// File: /workspace/github_cpp_makefile_star2_O3/mororo18[P]simplex-method/src/model.cpp
// Function: Model::tableau_resize(Model::cstr)
void Model::tableau_resize(Model::cstr cstr_new){

    int row_size = tableau[0].size();
    // add new row
    //std::vector<double> row_new = row_vec;
    std::vector<double> row_new = cstr_new.coef_get();

    //if(id == G_EQ){
    if(cstr_new.type_id == G_EQ){
        for(int row = var_qnt; row < tableau[0].size(); row++)
            row_new.push_back(0); 
        row_new.push_back(-1); 
        row_new.push_back(0); 

        //row_new.push_back(value);
        row_new.push_back(cstr_new.value);

        int col_i = row_size - 1;

        for(int row = 0; row < tableau.size(); row++){
            tableau[row].insert(tableau[row].begin() + col_i, 0);
            tableau[row].insert(tableau[row].begin() + col_i, 0);
        }

    }else { 
        for(int row = var_qnt; row < tableau[0].size(); row++)
            row_new.push_back(0); 

        //row_new.push_back(value);
        row_new.push_back(cstr_new.value);

        int col_i = row_size - 1;

        for(int row = 0; row < tableau.size(); row++)
            tableau[row].insert(tableau[row].begin() + col_i, 0);
    }

    // update I_index vec
    I_index.push_back(tableau[0].size() - 2);

    //if(id == G_EQ || id == EQ)
    if(cstr_new.type_id == G_EQ || cstr_new.type_id == EQ)
        vec_add_vec(tableau[0], row_new, -BIG_M);

    int col_i = row_new.size() - 2;
    row_new[col_i] = 1;

    //clean columns of basic vars
    for(int col = 0; col < tableau[0].size() - 1; col++){

        if(tableau[0][col] == 0 && row_new[col] != 0){
            int row_i;
            for(int row = 0; row < tableau.size(); row++){
                if(tableau[row][col] == 1){
                    row_i = row;
                    break;
                }
            }

            double coef = row_new[col];

            vec_add_vec(row_new, tableau[row_i], -coef);

            break;
        }
    }

    tableau.push_back(row_new);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x88(%rdi), %rax
movq %rax, 0x28(%rsp)
movq 0x88(%rdi), %rax
movq 0x8(%rax), %rbp
subq (%rax), %rbp
addq $0x30, %rsi
leaq 0x10(%rsp), %rdi
callq 0x4ae4
movq 0x88(%r14), %rdi
movq 0x8(%rdi), %rax
subq (%rdi), %rax
sarq $0x3, %rax
cmpl $-0x1, 0x20(%rbx)
movslq (%r14), %r15
movq %rbx, 0x30(%rsp)
je 0x94f8
cmpq %r15, %rax
jbe 0x94ce
leaq 0x10(%rsp), %r12
leaq 0x8(%rsp), %r13
movq $0x0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x94a8
movq $0x0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x94bb
movq %r12, %rdi
movq %r13, %rdx
callq 0xe40c
movq 0x28(%rsp), %rax
movq (%rax), %rdi
incq %r15
movq 0x8(%rdi), %rax
subq (%rdi), %rax
sarq $0x3, %rax
cmpq %r15, %rax
ja 0x9481
leaq 0x28(%rbx), %rdx
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x9587
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x9599
cmpq %r15, %rax
jbe 0x9554
leaq 0x10(%rsp), %r12
leaq 0x8(%rsp), %r13
movq $0x0, 0x8(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x952e
movq $0x0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x9541
movq %r12, %rdi
movq %r13, %rdx
callq 0xe40c
movq 0x28(%rsp), %rax
movq (%rax), %rdi
incq %r15
movq 0x8(%rdi), %rax
subq (%rdi), %rax
sarq $0x3, %rax
cmpq %r15, %rax
ja 0x9507
movabsq $-0x4010000000000000, %rcx # imm = 0xBFF0000000000000
movq %rcx, 0x8(%rsp)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rax
cmpq %rax, %rsi
je 0x9614
movq %rcx, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x962d
leaq 0x10(%rsp), %rdi
callq 0xe528
movq 0x28(%rsp), %rax
movq (%rax), %rdi
cmpq %rdi, 0x90(%r14)
je 0x9730
shlq $0x1d, %rbp
movabsq $-0x100000000, %rbx     # imm = 0xFFFFFFFF00000000
addq %rbp, %rbx
sarq $0x1d, %rbx
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
xorl %ebp, %ebp
movq (%rdi,%r15), %rsi
addq %rbx, %rsi
addq %r15, %rdi
movq $0x0, 0x8(%rsp)
movq %r12, %rdx
callq 0xea4e
incq %rbp
movq 0x88(%r14), %rdi
movq 0x90(%r14), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r13, %rax
addq $0x18, %r15
cmpq %rbp, %rax
ja 0x95cf
jmp 0x9730
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xe40c
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rax
movq $0x0, 0x8(%rsp)
cmpq %rax, %rsi
je 0x964d
movq $0x0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x9666
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xe40c
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rax
leaq 0x28(%rbx), %rdx
cmpq %rax, %rsi
je 0x9682
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x968c
leaq 0x10(%rsp), %rdi
callq 0xe528
movq 0x88(%r14), %rdi
cmpq %rdi, 0x90(%r14)
je 0x9730
shlq $0x1d, %rbp
movabsq $-0x100000000, %r15     # imm = 0xFFFFFFFF00000000
addq %rbp, %r15
sarq $0x20, %r15
xorl %r13d, %r13d
shlq $0x3, %r15
leaq 0x8(%rsp), %r12
movabsq $-0x5555555555555555, %rbp # imm = 0xAAAAAAAAAAAAAAAB
xorl %ebx, %ebx
movq (%rdi,%r13), %rsi
addq %r15, %rsi
addq %r13, %rdi
movq $0x0, 0x8(%rsp)
movq %r12, %rdx
callq 0xea4e
movq 0x28(%rsp), %rax
movq (%rax), %rdi
movq (%rdi,%r13), %rsi
addq %r15, %rsi
addq %r13, %rdi
movq $0x0, 0x8(%rsp)
movq %r12, %rdx
callq 0xea4e
incq %rbx
movq 0x88(%r14), %rdi
movq 0x90(%r14), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %rbp, %rax
addq $0x18, %r13
cmpq %rbx, %rax
ja 0x96cd
movq 0x8(%rdi), %rax
subq (%rdi), %rax
shrq $0x3, %rax
addl $-0x2, %eax
movl %eax, 0x8(%rsp)
movq 0x198(%r14), %rsi
cmpq 0x1a0(%r14), %rsi
je 0x9766
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x198(%r14)
movq 0x30(%rsp), %rax
jmp 0x977c
leaq 0x190(%r14), %rdi
leaq 0x8(%rsp), %rdx
callq 0xe600
movq 0x30(%rsp), %rax
movl 0x20(%rax), %eax
incl %eax
cmpl $0x2, %eax
jae 0x97d9
movq 0x28(%rsp), %rax
movq (%rax), %rcx
movq (%rcx), %rsi
movq 0x8(%rcx), %rdi
movq %rdi, %rdx
movq 0x10(%rsp), %rax
subq %rsi, %rdx
je 0x97ed
sarq $0x3, %rdx
cmpq $0x1, %rdx
adcq $0x0, %rdx
xorl %r8d, %r8d
movsd 0x6b1f(%rip), %xmm0     # 0x102d8
movsd (%rax,%r8,8), %xmm1
mulsd %xmm0, %xmm1
addsd (%rsi,%r8,8), %xmm1
movsd %xmm1, (%rsi,%r8,8)
incq %r8
cmpq %r8, %rdx
jne 0x97b9
jmp 0x97ed
movq 0x10(%rsp), %rax
movq 0x28(%rsp), %rcx
movq (%rcx), %rcx
movq (%rcx), %rsi
movq 0x8(%rcx), %rdi
movq 0x18(%rsp), %r8
movq %r8, %rdx
subq %rax, %rdx
movq %rdx, %r9
shlq $0x1d, %r9
movabsq $-0x200000000, %r10     # imm = 0xFFFFFFFE00000000
addq %r9, %r10
sarq $0x1d, %r10
movabsq $0x3ff0000000000000, %r9 # imm = 0x3FF0000000000000
movq %r9, (%rax,%r10)
subq %rsi, %rdi
sarq $0x3, %rdi
decq %rdi
je 0x98f3
sarq $0x3, %rdx
xorl %r9d, %r9d
xorpd %xmm1, %xmm1
movsd (%rsi,%r9,8), %xmm0
ucomisd %xmm1, %xmm0
jne 0x9855
jp 0x9855
movsd (%rax,%r9,8), %xmm0
ucomisd %xmm1, %xmm0
jne 0x9862
jp 0x9862
incq %r9
cmpq %r9, %rdi
jne 0x9839
jmp 0x98f3
movq 0x90(%r14), %rsi
subq %rcx, %rsi
je 0x98b7
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rdi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdi
cmpq $0x1, %rdi
adcq $0x0, %rdi
xorl %esi, %esi
movsd 0x67be(%rip), %xmm1     # 0x10050
movq %rcx, %r10
movq (%r10), %r11
movsd (%r11,%r9,8), %xmm2
ucomisd %xmm1, %xmm2
jne 0x98a6
jnp 0x98b9
incq %rsi
addq $0x18, %r10
cmpq %rsi, %rdi
jne 0x9895
movq %rdi, %rsi
jmp 0x98b9
xorl %esi, %esi
cmpq %rax, %r8
je 0x98f3
xorpd 0x69ea(%rip), %xmm0     # 0x102b0
leaq (%rsi,%rsi,2), %rsi
movq (%rcx,%rsi,8), %rcx
cmpq $0x1, %rdx
adcq $0x0, %rdx
xorl %esi, %esi
movsd (%rcx,%rsi,8), %xmm1
mulsd %xmm0, %xmm1
addsd (%rax,%rsi,8), %xmm1
movsd %xmm1, (%rax,%rsi,8)
incq %rsi
cmpq %rsi, %rdx
jne 0x98d8
leaq 0x10(%rsp), %rsi
movq 0x28(%rsp), %rdi
callq 0xd628
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9911
callq 0x21c0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9932
jmp 0x9932
jmp 0x9932
jmp 0x9932
jmp 0x9932
jmp 0x9932
jmp 0x9932
jmp 0x9932
jmp 0x9932
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9944
callq 0x21c0
movq %rbx, %rdi
callq 0x2310