// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/convex.c
// Function: prepare_quadratic_program
Quadraticprogramptr prepare_quadratic_program(matrix Q, matrix A, double* c, double* b)
{
 int i, j, totalvariables;
 Quadraticprogramptr program;
 double sum;
 program = safemalloc(sizeof(Quadraticprogram), "read_quadratic_program", 6);
 program->n = Q.row;
 program->m = A.row;
 totalvariables = 3 * program->n + 3 * program->m;
 program->Q = matrix_copy(Q);
 program->c = clone_array(c, program->n);
 program->objectives = safecalloc(totalvariables + 1, sizeof(double), "read_quadratic_program", 10);
 program->basic = safemalloc((program->n + program->m) * sizeof(int), "read_quadratic_program", 11);
 program->isbasic = safecalloc(totalvariables, sizeof(BOOLEAN), "read_quadratic_program", 12);
 for (i = 0; i < 2 * program->n + 2 * program->m; i++)
   program->isbasic[i] = BOOLEAN_FALSE;
 for (i = 2 * program->n + 2 * program->m; i < 3 * program->n + 3 * program->m; i++)
  {
   program->basic[i - (2 * program->n + 2 * program->m)] = i;
   program->objectives[i] = 1;
   program->isbasic[i] = BOOLEAN_TRUE;
  }
 program->constraints = matrix_alloc(program->n + program->m, totalvariables + 1);
 for (i = 0; i < program->n; i++)
  {
   for (j = 0; j < program->n; j++)
     program->constraints.values[i][j] = Q.values[i][j];
   for (j = 0; j < program->m; j++)
     program->constraints.values[i][program->n + j] = A.values[j][i];
   for (j = 0; j < program->n; j++)
     if (j == i)
       program->constraints.values[i][program->m + program->n + j] = -1;
   for (j = 0; j < program->n; j++)
     if (j == i)
       program->constraints.values[i][2 * program->m + 2 * program->n + j] = 1;
   program->constraints.values[i][totalvariables] = -c[i];
  }
 for (i = 0; i < program->m; i++)
  {
   for (j = 0; j < program->n; j++)
     program->constraints.values[program->n + i][j] = A.values[i][j];
   for (j = 0; j < program->m; j++)
     if (j == i)
       program->constraints.values[program->n + i][program->m + 2 * program->n + j] = 1;
   for (j = 0; j < program->m; j++)
     if (j == i)
       program->constraints.values[program->n + i][2 * program->m + 3 * program->n + j] = 1;
   program->constraints.values[program->n + i][totalvariables] = b[i];
  }
 for (i = 0; i < program->constraints.row; i++)
   if (program->constraints.values[i][totalvariables] < 0)
    {
     for (j = 0; j < 2 * program->m + 2 * program->n; j++)
       program->constraints.values[i][j] *= - 1;
     program->constraints.values[i][totalvariables] *= - 1;
    }
 sum = 0;
 for (i = 0; i < program->m + program->n; i++)
   sum += program->constraints.values[i][totalvariables];
 program->objectives[totalvariables] = -sum;
 for (i = 0; i < 2 * program->m + 2 * program->n; i++)
  {
   sum = 0;
   for (j = 0; j < program->m + program->n; j++)
     sum += program->constraints.values[j][i];
   program->objectives[i] = -sum;
  }
 program->variablecount = 2 * program->m + 2 * program->n;
 program->constraintcount = program->m + program->n;
 return program;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl $0x50, %edi
leaq 0xceaaa(%rip), %rsi     # 0xe2eb9
movl $0x6, %edx
callq 0x52d70
movq %rax, -0x48(%rbp)
movl -0x10(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, (%rax)
movl -0x20(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x48(%rbp), %rax
imull $0x3, (%rax), %eax
movq -0x48(%rbp), %rcx
imull $0x3, 0x4(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x3c(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x58550
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
movq -0x60(%rbp), %rcx
movq %rcx, 0x20(%rax)
movq -0x58(%rbp), %rcx
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rdi
movq -0x48(%rbp), %rax
movl (%rax), %esi
callq 0x4f9d0
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x30(%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
movl $0x8, %esi
leaq 0xcea12(%rip), %rdx     # 0xe2eb9
movl $0xa, %ecx
callq 0x52f40
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x48(%rbp), %rax
movl (%rax), %eax
movq -0x48(%rbp), %rcx
addl 0x4(%rcx), %eax
movslq %eax, %rdi
shlq $0x2, %rdi
leaq 0xce9e2(%rip), %rsi     # 0xe2eb9
movl $0xb, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x48(%rax)
movslq -0x3c(%rbp), %rdi
movl $0x4, %esi
leaq 0xce9bd(%rip), %rdx     # 0xe2eb9
movl $0xc, %ecx
callq 0x52f40
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x40(%rax)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x48(%rbp), %rcx
movl (%rcx), %ecx
shll %ecx
movq -0x48(%rbp), %rdx
movl 0x4(%rdx), %edx
shll %edx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x14550
movq -0x48(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x34(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x14518
movq -0x48(%rbp), %rax
movl (%rax), %eax
shll %eax
movq -0x48(%rbp), %rcx
movl 0x4(%rcx), %ecx
shll %ecx
addl %ecx, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x48(%rbp), %rcx
imull $0x3, (%rcx), %ecx
movq -0x48(%rbp), %rdx
imull $0x3, 0x4(%rdx), %edx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x145de
movl -0x34(%rbp), %edx
movq -0x48(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x34(%rbp), %ecx
movq -0x48(%rbp), %rsi
movl (%rsi), %esi
shll %esi
movq -0x48(%rbp), %rdi
movl 0x4(%rdi), %edi
shll %edi
addl %edi, %esi
subl %esi, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x34(%rbp), %rcx
movsd 0xcda5d(%rip), %xmm0    # 0xe2018
movsd %xmm0, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x34(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x14566
movq -0x48(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x48(%rbp), %rax
movl (%rax), %edi
movq -0x48(%rbp), %rax
addl 0x4(%rax), %edi
movl -0x3c(%rbp), %esi
addl $0x1, %esi
callq 0x57fc0
movq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, -0x70(%rbp)
movq %rdx, -0x68(%rbp)
movq -0x70(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x68(%rbp), %rcx
movq %rcx, 0x18(%rax)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x147d1
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x1467e
movq -0x8(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1463a
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x146d2
movq -0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
movl (%rcx), %ecx
addl -0x38(%rbp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x14685
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x14729
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x1471c
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
movl 0x4(%rcx), %ecx
movq -0x48(%rbp), %rdx
addl (%rdx), %ecx
addl -0x38(%rbp), %ecx
movslq %ecx, %rcx
movsd 0xce331(%rip), %xmm0    # 0xe2a48
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1471e
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x146d9
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x14786
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x14779
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
movl 0x4(%rcx), %ecx
shll %ecx
movq -0x48(%rbp), %rdx
movl (%rdx), %edx
shll %edx
addl %edx, %ecx
addl -0x38(%rbp), %ecx
movslq %ecx, %rcx
movsd 0xcd8a4(%rip), %xmm0    # 0xe2018
movsd %xmm0, (%rax,%rcx,8)
jmp 0x1477b
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x14730
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x3c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x14624
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x14940
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x1483b
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x48(%rbp), %rcx
movl (%rcx), %ecx
addl -0x34(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x147ef
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x1489f
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x14892
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x48(%rbp), %rcx
movl (%rcx), %ecx
addl -0x34(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
movl 0x4(%rcx), %ecx
movq -0x48(%rbp), %rdx
movl (%rdx), %edx
shll %edx
addl %edx, %ecx
addl -0x38(%rbp), %ecx
movslq %ecx, %rcx
movsd 0xcd78b(%rip), %xmm0    # 0xe2018
movsd %xmm0, (%rax,%rcx,8)
jmp 0x14894
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x14842
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x14904
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x148f7
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x48(%rbp), %rcx
movl (%rcx), %ecx
addl -0x34(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
movl 0x4(%rcx), %ecx
shll %ecx
movq -0x48(%rbp), %rdx
imull $0x3, (%rdx), %edx
addl %edx, %ecx
addl -0x38(%rbp), %ecx
movslq %ecx, %rcx
movsd 0xcd726(%rip), %xmm0    # 0xe2018
movsd %xmm0, (%rax,%rcx,8)
jmp 0x148f9
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x148a6
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x48(%rbp), %rcx
movl (%rcx), %ecx
addl -0x34(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x3c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x147d8
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x149fd
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x3c(%rbp), %rcx
xorps %xmm0, %xmm0
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x149ed
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x48(%rbp), %rcx
movl 0x4(%rcx), %ecx
shll %ecx
movq -0x48(%rbp), %rdx
movl (%rdx), %edx
shll %edx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x149c7
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd 0xce096(%rip), %xmm0    # 0xe2a48
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1497c
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x3c(%rbp), %rcx
movsd 0xce065(%rip), %xmm0    # 0xe2a48
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x149ef
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x14947
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x48(%rbp), %rcx
movl 0x4(%rcx), %ecx
movq -0x48(%rbp), %rdx
addl (%rdx), %ecx
cmpl %ecx, %eax
jge 0x14a4e
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x14a0c
movsd -0x50(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x48(%rbp), %rcx
movl 0x4(%rcx), %ecx
shll %ecx
movq -0x48(%rbp), %rdx
movl (%rdx), %edx
shll %edx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x14b2c
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x48(%rbp), %rcx
movl 0x4(%rcx), %ecx
movq -0x48(%rbp), %rdx
addl (%rdx), %ecx
cmpl %ecx, %eax
jge 0x14af1
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x14aaf
movsd -0x50(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x34(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x14a82
movq -0x48(%rbp), %rax
movl 0x4(%rax), %ecx
shll %ecx
movq -0x48(%rbp), %rax
movl (%rax), %eax
shll %eax
addl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x48(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x48(%rbp), %rax
addl (%rax), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x48(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)