// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/convex.c
// Function: formulate_infeasibility_form
Linearprogramptr formulate_infeasibility_form(Linearprogramptr program)
{
 int i, j, totalvariables;
 double sum;
 Linearprogramptr newprogram;
 newprogram = safemalloc(sizeof(Linearprogram), "formulate_infeasibility_form", 2);
 newprogram->variablecount = program->variablecount + program->constraintcount;
 newprogram->constraintcount = program->constraintcount;
 totalvariables = program->variablecount + 2 * program->constraintcount;
 newprogram->isbasic = safecalloc(totalvariables, sizeof(BOOLEAN), "formulate_infeasibility_form", 7);
 newprogram->basic = safemalloc(program->constraintcount * sizeof(int), "formulate_infeasibility_form", 8);
 for (i = 0; i < newprogram->variablecount; i++)
   newprogram->isbasic[i] = BOOLEAN_FALSE;
 for (i = newprogram->variablecount; i < totalvariables; i++)
  {
   newprogram->isbasic[i] = BOOLEAN_TRUE;
   newprogram->basic[i - newprogram->variablecount] = i;
  }
 newprogram->constraints = matrix_alloc(program->constraintcount + 1, totalvariables + 1);
 for (i = 0; i < program->constraintcount; i++)
  {
   newprogram->constraints.values[i][newprogram->variablecount + i] = 1.0;
   if (program->constraints.values[i][program->constraints.col - 1] < 0)
    {
     for (j = 0; j < newprogram->variablecount; j++)
       newprogram->constraints.values[i][j] = -program->constraints.values[i][j];
     newprogram->constraints.values[i][newprogram->constraints.col - 1] = -program->constraints.values[i][program->constraints.col - 1];
    }
   else
    {
     for (j = 0; j < newprogram->variablecount; j++)
       newprogram->constraints.values[i][j] = program->constraints.values[i][j];
     newprogram->constraints.values[i][newprogram->constraints.col - 1] = program->constraints.values[i][program->constraints.col - 1];     
    }
  }
 for (j = 0; j < program->variablecount; j++)
   newprogram->constraints.values[program->constraintcount][j] = program->objectives[j];
 newprogram->objectives = safecalloc(totalvariables + 1, sizeof(double), "formulate_infeasibility_form", 26);
 for (i = 0; i < newprogram->variablecount; i++)
  {
   sum = 0.0;
   for (j = 0; j < program->constraintcount; j++)
     sum += newprogram->constraints.values[j][i];
   newprogram->objectives[i] = -sum;
  }
 sum = 0.0;
 for (j = 0; j < program->constraintcount; j++)
   sum += newprogram->constraints.values[j][newprogram->constraints.col - 1];
 newprogram->objectives[totalvariables] = -sum;
 return newprogram;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
leaq 0x967be(%rip), %r12     # 0xa62ba
movl $0x30, %edi
movq %r12, %rsi
movl $0x2, %edx
callq 0x3a0e1
movq %rax, %rbx
movslq 0x4(%r15), %rbp
movl (%r15), %eax
addl %ebp, %eax
movl %eax, (%rbx)
movl %ebp, 0x4(%rbx)
movslq (%r15), %r13
leaq (,%rbp,2), %r14
addq %r13, %r14
movl $0x4, %esi
movq %r14, %rdi
movq %r12, %rdx
movl $0x7, %ecx
callq 0x3a1fc
movq %rax, 0x20(%rbx)
movslq 0x4(%r15), %rdi
shlq $0x2, %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x3a0e1
movq %rax, 0x28(%rbx)
movl (%rbx), %ecx
testl %ecx, %ecx
jle 0xfb7d
movq 0x20(%rbx), %rdx
xorl %esi, %esi
movl $0x0, (%rdx,%rsi,4)
incq %rsi
movslq (%rbx), %rcx
cmpq %rcx, %rsi
jl 0xfb6b
cmpl %r14d, %ecx
jge 0xfbc8
addq %rbp, %rbp
movslq %ecx, %rsi
movl %ecx, %ecx
leaq (,%rsi,4), %rdx
leaq (%rax,%rsi,4), %rax
addq 0x20(%rbx), %rdx
movslq %ebp, %rdi
addq %rdi, %r13
subq %rsi, %r13
xorl %esi, %esi
movl $0x1, (%rdx,%rsi,4)
movslq (%rbx), %rdi
shlq $0x2, %rdi
movq %rax, %r8
subq %rdi, %r8
leal (%rcx,%rsi), %edi
movl %edi, (%r8,%rsi,4)
incq %rsi
cmpq %rsi, %r13
jne 0xfba5
movl 0x4(%r15), %edi
incl %edi
movq %r14, (%rsp)
leal 0x1(%r14), %ebp
movl %ebp, %esi
callq 0x3d79d
movq %rax, 0x8(%rbx)
movq %rdx, 0x10(%rbx)
movslq 0x4(%r15), %rcx
testq %rcx, %rcx
jle 0xfc98
movl (%rbx), %esi
movq 0x10(%r15), %rdi
movslq 0xc(%r15), %r8
movslq %esi, %r9
sarq $0x20, %rax
xorl %r10d, %r10d
movabsq $0x3ff0000000000000, %r11 # imm = 0x3FF0000000000000
xorpd %xmm0, %xmm0
movapd 0x965b4(%rip), %xmm1    # 0xa61d0
movq (%rdx,%r10,8), %r12
leaq (%r12,%r10,8), %r14
movq %r11, (%r14,%r9,8)
movq (%rdi,%r10,8), %r13
movsd -0x8(%r13,%r8,8), %xmm2
ucomisd %xmm2, %xmm0
jbe 0xfc66
testl %esi, %esi
jle 0xfc60
xorl %r14d, %r14d
movsd (%r13,%r14,8), %xmm2
xorpd %xmm1, %xmm2
movlpd %xmm2, (%r12,%r14,8)
incq %r14
cmpq %r14, %rsi
jne 0xfc40
movsd -0x8(%r13,%r8,8), %xmm2
xorpd %xmm1, %xmm2
jmp 0xfc89
testl %esi, %esi
jle 0xfc89
xorl %r14d, %r14d
movsd (%r13,%r14,8), %xmm2
movsd %xmm2, (%r12,%r14,8)
incq %r14
cmpq %r14, %rsi
jne 0xfc6d
movsd -0x8(%r13,%r8,8), %xmm2
movsd %xmm2, -0x8(%r12,%rax,8)
incq %r10
cmpq %rcx, %r10
jne 0xfc1c
movslq (%r15), %rax
testq %rax, %rax
jle 0xfcbc
movq 0x18(%r15), %rsi
movq (%rdx,%rcx,8), %rcx
xorl %edx, %edx
movsd (%rsi,%rdx,8), %xmm0
movsd %xmm0, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0xfcaa
movslq %ebp, %rdi
leaq 0x965f4(%rip), %rdx     # 0xa62ba
movl $0x8, %esi
movl $0x1a, %ecx
callq 0x3a1fc
movq %rax, 0x18(%rbx)
movslq (%rbx), %rdx
movl 0x4(%r15), %ecx
testq %rdx, %rdx
movq (%rsp), %r10
jle 0xfd2b
xorl %esi, %esi
movapd 0x964dd(%rip), %xmm0    # 0xa61d0
testl %ecx, %ecx
jle 0xfd16
movq 0x10(%rbx), %rdi
xorpd %xmm1, %xmm1
xorl %r8d, %r8d
movq (%rdi,%r8,8), %r9
addsd (%r9,%rsi,8), %xmm1
incq %r8
cmpq %r8, %rcx
jne 0xfd02
jmp 0xfd1a
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm1
movlpd %xmm1, (%rax,%rsi,8)
incq %rsi
cmpq %rdx, %rsi
jne 0xfcf3
testl %ecx, %ecx
jle 0xfd52
movq 0x10(%rbx), %rdx
movslq 0xc(%rbx), %rsi
xorpd %xmm0, %xmm0
xorl %edi, %edi
movq (%rdx,%rdi,8), %r8
addsd -0x8(%r8,%rsi,8), %xmm0
incq %rdi
cmpq %rdi, %rcx
jne 0xfd3d
jmp 0xfd56
xorpd %xmm0, %xmm0
xorpd 0x96472(%rip), %xmm0    # 0xa61d0
movlpd %xmm0, (%rax,%r10,8)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq