// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/convex.c
// Function: find_variable_to_bring_into_basis_qp_random
int find_variable_to_bring_into_basis_qp_random(Quadraticprogramptr program)
{
 int i, index = -2, pos, complementary, newnonbasic, *candidate, size;
 Linklistptr candidates;
 candidates = link_list();
 for (i = 0; i < program->variablecount + program->constraintcount; i++)
   if (!program->isbasic[i] && program->objectives[i] < 0)
    {
     complementary = complementary_variable(program->m, program->n, i);
     newnonbasic = find_variable_to_remove_from_basis(program->constraints, program->constraintcount, i);
     if ((i >= 2 * program->m + 2 * program->n) || !program->isbasic[complementary] || (newnonbasic >= 0 && program->basic[newnonbasic] == complementary))
      {
       candidate = safemalloc(sizeof(int), "find_variable_to_bring_into_basis_qp", 10);
       *candidate = i;
       link_list_insert(candidates, candidate);
      }
    }
 size = link_list_size(candidates);
 if (size != 0)
  {
   pos = myrand() % size;
   candidate = (int*) link_list_get_i(candidates, pos);
   index = *candidate;
  }
 else
   index = -1;
 free_link_list(candidates, safe_free);
 return index;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl $0xfffffffe, -0x10(%rbp) # imm = 0xFFFFFFFE
movb $0x0, %al
callq 0x273e0
movq %rax, -0x38(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
movl 0xc(%rcx), %ecx
movq -0x8(%rbp), %rdx
addl 0x8(%rdx), %ecx
cmpl %ecx, %eax
jge 0x1516c
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x1515c
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0xc(%rbp), %rcx
xorps %xmm0, %xmm0
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x1515c
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x8(%rbp), %rax
movl (%rax), %esi
movl -0xc(%rbp), %edx
callq 0x15000
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x8(%rcx), %edx
movl -0xc(%rbp), %ecx
movq 0x10(%rax), %rdi
movq 0x18(%rax), %rsi
callq 0x151d0
movl %eax, -0x1c(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
movl 0x4(%rcx), %ecx
shll %ecx
movq -0x8(%rbp), %rdx
movl (%rdx), %edx
shll %edx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x1512a
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x18(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x1512a
cmpl $0x0, -0x1c(%rbp)
jl 0x1515a
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x18(%rbp), %eax
jne 0x1515a
movl $0x4, %edi
leaq 0xcdd9a(%rip), %rsi     # 0xe2ed0
movl $0xa, %edx
callq 0x52d70
movq %rax, -0x28(%rbp)
movl -0xc(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x27430
jmp 0x1515c
jmp 0x1515e
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x15065
movq -0x38(%rbp), %rdi
callq 0x27600
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x151a7
movb $0x0, %al
callq 0x54550
cltd
idivl -0x2c(%rbp)
movl %edx, -0x14(%rbp)
movq -0x38(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x27640
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x10(%rbp)
jmp 0x151ae
movl $0xffffffff, -0x10(%rbp) # imm = 0xFFFFFFFF
movq -0x38(%rbp), %rdi
leaq 0x3dcc7(%rip), %rsi     # 0x52e80
callq 0x276a0
movl -0x10(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)