// File: /workspace/github_c_makefile_star2_O1/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 0x937eb(%rip), %r12     # 0xa32ba
movl $0x30, %edi
movq %r12, %rsi
movl $0x2, %edx
callq 0x390f5
movq %rax, %rbx
movl 0x4(%r15), %eax
movl (%r15), %ecx
addl %eax, %ecx
movl %ecx, (%rbx)
movl %eax, 0x4(%rbx)
movslq (%r15), %r13
movslq 0x4(%r15), %rbp
leaq (%r13,%rbp,2), %r14
movl $0x4, %esi
movq %r14, %rdi
movq %r12, %rdx
movl $0x7, %ecx
callq 0x39210
movq %rax, 0x20(%rbx)
movslq 0x4(%r15), %rdi
shlq $0x2, %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x390f5
movq %rax, 0x28(%rbx)
movl (%rbx), %ecx
testl %ecx, %ecx
jle 0xfb4e
movq 0x20(%rbx), %rdx
xorl %esi, %esi
movl $0x0, (%rdx,%rsi,4)
incq %rsi
movslq (%rbx), %rcx
cmpq %rcx, %rsi
jl 0xfb3c
cmpl %r14d, %ecx
jge 0xfb99
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 0xfb76
movl 0x4(%r15), %edi
incl %edi
movq %r14, (%rsp)
leal 0x1(%r14), %ebp
movl %ebp, %esi
callq 0x3c6e5
movq %rax, 0x8(%rbx)
movq %rdx, 0x10(%rbx)
movslq 0x4(%r15), %rax
testq %rax, %rax
jle 0xfc65
movl (%rbx), %ecx
movq 0x10(%r15), %rsi
movslq 0xc(%r15), %rdi
movslq %ecx, %r8
movslq 0xc(%rbx), %r9
xorl %r10d, %r10d
movabsq $0x3ff0000000000000, %r11 # imm = 0x3FF0000000000000
xorpd %xmm0, %xmm0
movapd 0x935e3(%rip), %xmm1    # 0xa31d0
movq (%rdx,%r10,8), %r12
leaq (%r12,%r10,8), %r14
movq %r11, (%r14,%r8,8)
movq (%rsi,%r10,8), %r13
ucomisd -0x8(%r13,%rdi,8), %xmm0
jbe 0xfc33
testl %ecx, %ecx
jle 0xfc26
xorl %r14d, %r14d
movsd (%r13,%r14,8), %xmm2
xorpd %xmm1, %xmm2
movlpd %xmm2, (%r12,%r14,8)
incq %r14
cmpq %r14, %rcx
jne 0xfc0d
movsd -0x8(%r13,%rdi,8), %xmm2
xorpd %xmm1, %xmm2
jmp 0xfc56
testl %ecx, %ecx
jle 0xfc4f
xorl %r14d, %r14d
movsd (%r13,%r14,8), %xmm2
movsd %xmm2, (%r12,%r14,8)
incq %r14
cmpq %r14, %rcx
jne 0xfc3a
movsd -0x8(%r13,%rdi,8), %xmm2
movsd %xmm2, -0x8(%r12,%r9,8)
incq %r10
cmpq %rax, %r10
jne 0xfbed
movslq (%r15), %rcx
testq %rcx, %rcx
jle 0xfc89
movq 0x18(%r15), %rsi
movq (%rdx,%rax,8), %rax
xorl %edx, %edx
movsd (%rsi,%rdx,8), %xmm0
movsd %xmm0, (%rax,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0xfc77
movslq %ebp, %rdi
leaq 0x93627(%rip), %rdx     # 0xa32ba
movl $0x8, %esi
movl $0x1a, %ecx
callq 0x39210
movq %rax, 0x18(%rbx)
movslq (%rbx), %rcx
testq %rcx, %rcx
movq (%rsp), %r10
jle 0xfcf8
movl 0x4(%r15), %edx
xorl %esi, %esi
movapd 0x93510(%rip), %xmm0    # 0xa31d0
testl %edx, %edx
jle 0xfce3
movq 0x10(%rbx), %rdi
xorpd %xmm1, %xmm1
xorl %r8d, %r8d
movq (%rdi,%r8,8), %r9
addsd (%r9,%rsi,8), %xmm1
incq %r8
cmpq %r8, %rdx
jne 0xfccf
jmp 0xfce7
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm1
movlpd %xmm1, (%rax,%rsi,8)
incq %rsi
cmpq %rcx, %rsi
jne 0xfcc0
movslq 0x4(%r15), %rcx
testq %rcx, %rcx
jle 0xfd24
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 0xfd0f
jmp 0xfd28
xorpd %xmm0, %xmm0
xorpd 0x934a0(%rip), %xmm0    # 0xa31d0
movlpd %xmm0, (%rax,%r10,8)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq