// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/convex.c
// Function: solve_lp_with_basic_feasible_solution_using_simplex
Convexsolutionptr solve_lp_with_basic_feasible_solution_using_simplex(Linearprogramptr program)
{
 Convexsolutionptr solution;
 SOLUTION_TYPE solutiontype = NO_SOLUTION;
 int i, newbasic, newnonbasic;
 solution = safemalloc(sizeof(Convexsolution), "solve_lp_with_basic_feasible_solution_using_simplex", 4);
 while (BOOLEAN_TRUE)
  {
   /*print_simplex_tableau(program->constraints, program->basic, program->objectives);*/
   newbasic = find_variable_to_bring_into_basis(program);
   if (newbasic == -1)
    {
     solutiontype = INFINITE_SOLUTION;
     break;
    }
   if (newbasic == -2)
    {
     solutiontype = SINGLE_SOLUTION;
     break;    
    }
   newnonbasic = find_variable_to_remove_from_basis(program->constraints, program->constraintcount, newbasic);
   if (newnonbasic == -1)
    {
     solutiontype = UNBOUNDED_SOLUTION;
     break;
    }
   pivot_on_the_new_variables(program->constraints, program->objectives, newnonbasic, newbasic);
   program->isbasic[newbasic] = BOOLEAN_TRUE;
   program->isbasic[program->basic[newnonbasic]] = BOOLEAN_FALSE;
   program->basic[newnonbasic] = newbasic;
  }
 solution->optimalvalue = program->objectives[program->variablecount + program->constraintcount];
 solution->variablecount = program->variablecount;
 solution->solutiontype = solutiontype;
 solution->variables = safecalloc(solution->variablecount, sizeof(double), "solve_lp_with_basic_feasible_solution_using_simplex", 23);
 for (i = 0; i < program->constraintcount; i++)
   if (program->basic[i] < program->variablecount)
     solution->variables[program->basic[i]] = program->constraints.values[i][program->variablecount + program->constraintcount];
 return solution;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8747b(%rip), %rsi     # 0x96286
pushq $0x20
popq %rdi
pushq $0x4
popq %rdx
callq 0x34f59
movq %rax, (%rsp)
movq %rbx, %rdi
callq 0xe963
xorl %r14d, %r14d
cmpl $-0x2, %eax
je 0xee8b
movl %eax, %ebp
cmpl $-0x1, %eax
je 0xee87
movl 0x4(%rbx), %edx
movq 0x8(%rbx), %r12
movq 0x10(%rbx), %r13
movq %r12, %rdi
movq %r13, %rsi
movl %ebp, %ecx
callq 0xeadb
cmpl $-0x1, %eax
je 0xee8f
movl %eax, %r15d
movq 0x18(%rbx), %rdx
movq %r12, %rdi
movq %r13, %rsi
movl %eax, %ecx
movl %ebp, %r8d
callq 0xec3d
movq 0x20(%rbx), %rax
movslq %ebp, %rcx
movl $0x1, (%rax,%rcx,4)
movq 0x28(%rbx), %rcx
movslq %r15d, %rdx
movslq (%rcx,%rdx,4), %rsi
andl $0x0, (%rax,%rsi,4)
movl %ebp, (%rcx,%rdx,4)
jmp 0xee1a
pushq $0x3
jmp 0xee91
xorl %edx, %edx
jmp 0xee92
pushq $0x2
popq %rdx
movq 0x18(%rbx), %rax
movslq (%rbx), %rdi
movslq 0x4(%rbx), %rcx
addq %rdi, %rcx
movsd (%rax,%rcx,8), %xmm0
movq (%rsp), %r15
movsd %xmm0, 0x8(%r15)
movl %edi, 0x18(%r15)
movl %edx, (%r15)
leaq 0x873c9(%rip), %rdx     # 0x96286
pushq $0x8
popq %rsi
pushq $0x17
popq %rcx
callq 0x35067
movq %rax, 0x10(%r15)
movl 0x4(%rbx), %ecx
testl %ecx, %ecx
movl $0x0, %edx
cmovgl %ecx, %edx
cmpq %r14, %rdx
je 0xef09
movq 0x28(%rbx), %rsi
movslq (%rsi,%r14,4), %rsi
movl (%rbx), %edi
cmpl %edi, %esi
jge 0xef04
movq 0x10(%rbx), %r8
movq (%r8,%r14,8), %r8
addl %ecx, %edi
movslq %edi, %rdi
movsd (%r8,%rdi,8), %xmm0
movsd %xmm0, (%rax,%rsi,8)
incq %r14
jmp 0xeed9
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq