// File: /workspace/github_c_makefile_star2_O3/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 0x9690d(%rip), %rsi     # 0xa6286
movl $0x20, %edi
movl $0x4, %edx
callq 0x3a0e1
movq %rax, %r14
movabsq $-0x100000000, %r12     # imm = 0xFFFFFFFF00000000
movq %rbx, %rdi
callq 0xf3f6
cmpl $-0x2, %eax
je 0xfa5c
movl %eax, %ebp
cmpl $-0x1, %eax
je 0xfa55
movslq 0x4(%rbx), %rcx
movl $0x2, %eax
testq %rcx, %rcx
jle 0xfa5e
movq 0x8(%rbx), %rdi
movq 0x10(%rbx), %rsi
movslq %ebp, %r13
leaq (%rdi,%r12), %rdx
sarq $0x20, %rdx
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %r8d, %r8d
movsd 0x95b31(%rip), %xmm0    # 0xa5518
xorpd %xmm3, %xmm3
movq (%rsi,%r8,8), %r9
movsd (%r9,%r13,8), %xmm2
ucomisd %xmm3, %xmm2
jbe 0xfa12
movsd (%r9,%rdx,8), %xmm1
divsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xfa12
movl %r8d, %r15d
movapd %xmm1, %xmm0
incq %r8
cmpq %r8, %rcx
jne 0xf9eb
cmpl $-0x1, %r15d
je 0xfa5e
movq 0x18(%rbx), %rdx
movl %r15d, %ecx
movl %ebp, %r8d
callq 0xf797
movq 0x20(%rbx), %rax
movl $0x1, (%rax,%r13,4)
movq 0x28(%rbx), %rcx
movslq %r15d, %rdx
movslq (%rcx,%rdx,4), %rsi
movl $0x0, (%rax,%rsi,4)
movl %ebp, (%rcx,%rdx,4)
jmp 0xf995
movl $0x3, %eax
jmp 0xfa5e
xorl %eax, %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 0x96801(%rip), %rdx     # 0xa6286
movl $0x8, %esi
movl $0x17, %ecx
callq 0x3a1fc
movq %rax, 0x10(%r14)
movslq 0x4(%rbx), %rcx
testq %rcx, %rcx
jle 0xfad5
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 0xfacd
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 0xfab0
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq