// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x93933(%rip), %rsi     # 0xa3286
movl $0x20, %edi
movl $0x4, %edx
callq 0x390f5
movq %rax, %r14
movabsq $-0x100000000, %r12     # imm = 0xFFFFFFFF00000000
movq %rbx, %rdi
callq 0xf3de
cmpl $-0x2, %eax
je 0xfa2e
cmpl $-0x1, %eax
je 0xfa27
movslq 0x4(%rbx), %rcx
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rsi
movslq %eax, %r15
testq %rcx, %rcx
jle 0xf9e8
leaq (%rdi,%r12), %rax
sarq $0x20, %rax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %edx, %edx
movsd 0x92b64(%rip), %xmm0    # 0xa2518
xorpd %xmm3, %xmm3
movq (%rsi,%rdx,8), %r8
movsd (%r8,%r15,8), %xmm2
ucomisd %xmm3, %xmm2
jbe 0xf9de
movsd (%r8,%rax,8), %xmm1
divsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xf9de
movl %edx, %ebp
movapd %xmm1, %xmm0
incq %rdx
cmpq %rdx, %rcx
jne 0xf9b8
jmp 0xf9ed
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $-0x1, %ebp
je 0xfa32
movq 0x18(%rbx), %rdx
movl %ebp, %ecx
movl %r15d, %r8d
callq 0xf774
movq 0x20(%rbx), %rax
movl $0x1, (%rax,%r15,4)
movq 0x28(%rbx), %rcx
movslq %ebp, %rdx
movslq (%rcx,%rdx,4), %rsi
movl $0x0, (%rax,%rsi,4)
movl %r15d, (%rcx,%rdx,4)
jmp 0xf96f
movl $0x3, %eax
jmp 0xfa37
xorl %eax, %eax
jmp 0xfa37
movl $0x2, %eax
movq 0x18(%rbx), %rcx
movslq (%rbx), %rdi
movslq 0x4(%rbx), %rdx
addq %rdi, %rdx
movsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, 0x8(%r14)
movl %edi, 0x18(%r14)
movl %eax, (%r14)
leaq 0x93828(%rip), %rdx     # 0xa3286
movl $0x8, %esi
movl $0x17, %ecx
callq 0x39210
movq %rax, 0x10(%r14)
movslq 0x4(%rbx), %rcx
testq %rcx, %rcx
jle 0xfaae
movq 0x28(%rbx), %rdx
movl (%rbx), %esi
leal (%rsi,%rcx), %edi
movslq %edi, %rdi
xorl %r8d, %r8d
movslq (%rdx,%r8,4), %r9
cmpl %esi, %r9d
jge 0xfaa6
movq 0x10(%rbx), %r10
movq (%r10,%r8,8), %r10
movsd (%r10,%rdi,8), %xmm0
movsd %xmm0, (%rax,%r9,8)
incq %r8
cmpq %r8, %rcx
jne 0xfa89
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq