// File: /workspace/github_cpp_makefile_star2_O1/iu-vail[P]iprimal/iPrimal.cpp
// Function: Primal::PrimalAlgo()
void
Primal::PrimalAlgo(void){

  //initiation is moved outside
  //RandInitAlgo();

  Utils utils;
  cell next;

  for(uint i=0; i<col_size; i++){
    
      InitStage();
      next = NextStartEntry(i);

      //_cout("Root cell_node: ("<<next.row_idx<<", "<<next.col_idx<<")"<<endl);
      if(next.row_idx != -1){

/*
#ifdef USE_HEAP
        Preprocess();
#endif
*/
        SearchSwapLoop(next);
        SwapTasks();

      }//if

  }//for

  // double check the reduced cost to see if all become feasible
  DoubleCheck();

//#ifdef DEBUG
  cout<<endl<<"***********************************************"<<endl;
  cout<<"Final solution:"<<endl;
  DisplayMatrix(orig_matrix, assignment);
  cout<<"Assigned row-col pairs: "<<endl;
  DisplayAssignment();
  cout<<"Minimization result: "<<ComputeCostSum(orig_matrix, assignment)<<endl;
  cout<<"***********************************************"<<endl<<endl;
//#else
//  cout<<"Minimization result: "<<ComputeCostSum(orig_matrix, assignment)<<endl;
//#endif

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
callq 0x8880
cmpl $0x0, 0x4(%rbx)
je 0x5f7f
xorl %r15d, %r15d
movq %rsp, %r14
movq %rbx, %rdi
callq 0x4c0e
movl (%rbx), %eax
testq %rax, %rax
je 0x5f4d
movq 0xc8(%rbx), %rdx
xorpd %xmm0, %xmm0
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %edi, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq (%rdx), %r8
movsd (%r8,%r15,8), %xmm1
ucomisd %xmm1, %xmm0
cmoval %edi, %esi
minsd %xmm0, %xmm1
cmoval %r15d, %ecx
incq %rdi
addq $0x18, %rdx
movapd %xmm1, %xmm0
cmpq %rdi, %rax
jne 0x5f1a
shlq $0x20, %rcx
movl %esi, %eax
orq %rcx, %rax
jmp 0x5f54
movq $-0x1, %rax
movq %rax, (%rsp)
cmpl $-0x1, %eax
je 0x5f70
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4e9a
movq %rbx, %rdi
callq 0x5d58
incq %r15
movl 0x4(%rbx), %eax
cmpq %rax, %r15
jb 0x5ef4
movq %rbx, %rdi
callq 0x6198
movq 0x903a(%rip), %rdi      # 0xefc8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0x901f(%rip), %rdi      # 0xefc8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %rax, %r14
leaq 0x5353(%rip), %rsi      # 0xb313
movl $0x2f, %edx
movq %rax, %rdi
callq 0x32a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq 0x8fcd(%rip), %r14      # 0xefc8
leaq 0x5341(%rip), %rsi      # 0xb343
movl $0xf, %edx
movq %r14, %rdi
callq 0x32a0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0x8f9b(%rip), %rdi      # 0xefc8
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0xb0(%rbx), %r14
leaq 0xf8(%rbx), %r15
movq %r14, %rsi
movq %r15, %rdx
callq 0x621a
movq 0x8f6e(%rip), %r12      # 0xefc8
leaq 0x52f2(%rip), %rsi      # 0xb353
movl $0x18, %edx
movq %r12, %rdi
callq 0x32a0
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0x8f3b(%rip), %rdi      # 0xefc8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x6388
movq 0x8f1f(%rip), %rdi      # 0xefc8
leaq 0x52bc(%rip), %rsi      # 0xb36c
movl $0x15, %edx
callq 0x32a0
movq %r14, %rsi
movq %r15, %rdx
callq 0x6472
movq 0x8efc(%rip), %rdi      # 0xefc8
callq 0x3370
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq 0x8ec6(%rip), %rbx      # 0xefc8
leaq 0x520a(%rip), %rsi      # 0xb313
movl $0x2f, %edx
movq %rbx, %rdi
callq 0x32a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0x8e94(%rip), %rdi      # 0xefc8
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x8(%rsp), %rdi
callq 0x88f4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x6183
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x88f4
movq %rbx, %rdi
callq 0x33d0