// File: /workspace/github_c_makefile_star2_O2/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 0x8738a(%rip), %r12     # 0x962ba
pushq $0x30
popq %rdi
pushq $0x2
popq %rdx
movq %r12, %rsi
callq 0x34f59
movq %rax, %rbx
movslq 0x4(%r15), %rax
movl (%r15), %ecx
addl %eax, %ecx
movl %ecx, (%rbx)
movl %eax, 0x4(%rbx)
movslq (%r15), %rcx
leaq (%rcx,%rax,2), %r14
pushq $0x4
popq %rsi
pushq $0x7
popq %rcx
movq %r14, %rdi
movq %r12, %rdx
callq 0x35067
movq %rax, 0x20(%rbx)
movslq 0x4(%r15), %rdi
shlq $0x2, %rdi
pushq $0x8
popq %rdx
movq %r12, %rsi
callq 0x34f59
movq %rax, 0x28(%rbx)
xorl %edx, %edx
movslq (%rbx), %rcx
cmpq %rcx, %rdx
jge 0xefb7
movq 0x20(%rbx), %rcx
andl $0x0, (%rcx,%rdx,4)
incq %rdx
jmp 0xef84
movq 0x20(%rbx), %rdx
movl $0x1, (%rdx,%rcx,4)
movslq (%rbx), %rdx
shlq $0x2, %rdx
movq %rax, %rsi
subq %rdx, %rsi
movl %ecx, (%rsi,%rcx,4)
incq %rcx
cmpq %r14, %rcx
jl 0xef99
movl 0x4(%r15), %edi
incl %edi
leal 0x1(%r14), %esi
movl %esi, 0x4(%rsp)
callq 0x380d3
movq %rax, 0x8(%rbx)
movq %rdx, 0x10(%rbx)
movslq 0x4(%r15), %rcx
xorl %esi, %esi
testl %ecx, %ecx
movl $0x0, %edi
cmovgl %ecx, %edi
sarq $0x20, %rax
movabsq $0x3ff0000000000000, %r8 # imm = 0x3FF0000000000000
xorpd %xmm0, %xmm0
movapd 0x871cf(%rip), %xmm2    # 0x961d0
xorl %r9d, %r9d
cmpq %rdi, %r9
je 0xf092
movq (%rdx,%r9,8), %r10
movl (%rbx), %r11d
leal (%r9,%r11), %ebp
movslq %ebp, %r12
movq %r8, (%r10,%r12,8)
movq 0x10(%r15), %r12
movq (%r12,%r9,8), %r12
testl %r11d, %r11d
cmovlel %esi, %r11d
movslq 0xc(%r15), %r13
ucomisd -0x8(%r12,%r13,8), %xmm0
jbe 0xf057
xorl %ebp, %ebp
cmpq %rbp, %r11
je 0xf06f
movsd (%r12,%rbp,8), %xmm1
xorpd %xmm2, %xmm1
movlpd %xmm1, (%r10,%rbp,8)
incq %rbp
jmp 0xf03d
xorl %ebp, %ebp
cmpq %rbp, %r11
je 0xf07c
movsd (%r12,%rbp,8), %xmm1
movsd %xmm1, (%r10,%rbp,8)
incq %rbp
jmp 0xf059
movsd -0x8(%r12,%r13,8), %xmm1
xorpd %xmm2, %xmm1
jmp 0xf083
movsd -0x8(%r12,%r13,8), %xmm1
movsd %xmm1, -0x8(%r10,%rax,8)
incq %r9
jmp 0xf004
movl (%r15), %eax
xorl %esi, %esi
testl %eax, %eax
cmovlel %esi, %eax
cmpq %rsi, %rax
je 0xf0b8
movq 0x18(%r15), %rdi
movsd (%rdi,%rsi,8), %xmm0
movq (%rdx,%rcx,8), %rdi
movsd %xmm0, (%rdi,%rsi,8)
incq %rsi
jmp 0xf09c
movslq 0x4(%rsp), %rdi
leaq 0x871f6(%rip), %rdx     # 0x962ba
pushq $0x8
popq %rsi
pushq $0x1a
popq %rcx
callq 0x35067
movapd 0x870f9(%rip), %xmm1    # 0x961d0
movq %rax, 0x18(%rbx)
movl (%rbx), %edx
xorl %esi, %esi
testl %edx, %edx
cmovlel %esi, %edx
movl 0x4(%r15), %ecx
testl %ecx, %ecx
cmovlel %esi, %ecx
xorpd %xmm0, %xmm0
cmpq %rdx, %rsi
je 0xf11e
xorl %edi, %edi
cmpq %rdi, %rcx
je 0xf110
movq 0x10(%rbx), %r8
movq (%r8,%rdi,8), %r8
addsd (%r8,%rsi,8), %xmm0
incq %rdi
jmp 0xf0f8
xorpd %xmm1, %xmm0
movlpd %xmm0, (%rax,%rsi,8)
incq %rsi
jmp 0xf0ed
xorl %edx, %edx
cmpq %rdx, %rcx
je 0xf13c
movq 0x10(%rbx), %rsi
movq (%rsi,%rdx,8), %rsi
movslq 0xc(%rbx), %rdi
addsd -0x8(%rsi,%rdi,8), %xmm0
incq %rdx
jmp 0xf120
xorpd 0x8708c(%rip), %xmm0    # 0x961d0
movlpd %xmm0, (%rax,%r14,8)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq