// File: afinit[P]afin/process.cpp
// Function: Process::run_manager()
void Process::run_manager(){
  // create thread array with max_thread entries
  vector<thread> t;
  Queue<int> qu;

  // loop max search loops
  for( int j=0; j<max_search_loops; j++ ){
    Log::Inst()->log_it( "Begin Extensions" );
      
    // initialize threads
    for( int i=0; i<max_threads; i++ ){
      t.push_back(thread( &Process::thread_worker, this, ref(qu), i ));
    }

    if( test_run ){
      Log::Inst()->log_it( "contigs.size(): " + to_string(contigs->get_list_size()) + " max_threads: " + to_string(max_threads) );
    }

    // push each thread onto queue
    for( int i=0; i<contigs->get_list_size(); i++ ){
      qu.push( i );
    }

    // push stop signals onto queue for each thread
    for( int i=0; i<max_threads; i++ ){
      qu.push( -1 );
    }

    // join threads
    for( int i=0; i<max_threads; i++ ){
      t[i].join();
    }

    // remove threads from vector
    t.erase( t.begin(), t.begin()+max_threads );

    // removed for master branch until algorithm can be adjusted
    if( ! no_fusion )
      fuse->run_fusion( false );
    
    if( test_run ){
      contigs->output_contigs( 0, outfile + ".fus" + to_string(j), "mid" );
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x298(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xb470
leaq -0xc8(%rbp), %rdi
callq 0xb490
jmp 0xa9a1
movl $0x0, -0xd8(%rbp)
movl -0xd8(%rbp), %eax
cmpl 0x33d01(%rip), %eax     # 0x3e6b8
jge 0xb05c
callq 0x100d0
movq %rax, -0x2a0(%rbp)
jmp 0xa9cb
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0x46e0
movq -0x2a8(%rbp), %rdx
leaq 0x2147f(%rip), %rsi     # 0x2be6b
leaq -0xf8(%rbp), %rdi
callq 0x4530
jmp 0xa9fa
movq -0x2a0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x10460
jmp 0xaa0f
leaq -0xf8(%rbp), %rdi
callq 0x4270
leaq -0xf9(%rbp), %rdi
callq 0x4420
movl $0x0, -0x100(%rbp)
movl -0x100(%rbp), %eax
cmpl 0x33c93(%rip), %eax     # 0x3e6d0
jge 0xab6d
movq -0x298(%rbp), %rax
leaq 0x64f(%rip), %rcx       # 0xb0a0
movq %rcx, -0x118(%rbp)
movq $0x0, -0x110(%rbp)
movq %rax, -0x120(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0xb500
movq %rax, -0x128(%rbp)
leaq -0x108(%rbp), %rdi
leaq -0x118(%rbp), %rsi
leaq -0x120(%rbp), %rdx
leaq -0x128(%rbp), %rcx
leaq -0x100(%rbp), %r8
callq 0xb530
jmp 0xaaa7
leaq -0x20(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0xb4d0
jmp 0xaab9
leaq -0x108(%rbp), %rdi
callq 0xb600
movl -0x100(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x100(%rbp)
jmp 0xaa31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xb086
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xb07a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xab39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x4270
leaq -0xf9(%rbp), %rdi
callq 0x4420
jmp 0xb07a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x108(%rbp), %rdi
callq 0xb600
jmp 0xb07a
testb $0x1, 0x33b74(%rip)     # 0x3e6e8
je 0xad15
callq 0x100d0
movq %rax, -0x2b0(%rbp)
jmp 0xab88
movq -0x298(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x281d0
movl %eax, -0x2b4(%rbp)
jmp 0xaba0
movl -0x2b4(%rbp), %esi
leaq -0x1a8(%rbp), %rdi
callq 0xb300
jmp 0xabb4
leaq 0x212c1(%rip), %rsi     # 0x2be7c
leaq -0x188(%rbp), %rdi
leaq -0x1a8(%rbp), %rdx
callq 0xb2b0
jmp 0xabd0
leaq 0x212b6(%rip), %rdx     # 0x2be8d
leaq -0x168(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x6a60
jmp 0xabec
movl 0x33ade(%rip), %esi     # 0x3e6d0
leaq -0x1c8(%rbp), %rdi
callq 0xb300
jmp 0xac00
leaq -0x148(%rbp), %rdi
leaq -0x168(%rbp), %rsi
leaq -0x1c8(%rbp), %rdx
callq 0xb630
jmp 0xac1c
movq -0x2b0(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x10460
jmp 0xac31
leaq -0x148(%rbp), %rdi
callq 0x4270
leaq -0x1c8(%rbp), %rdi
callq 0x4270
leaq -0x168(%rbp), %rdi
callq 0x4270
leaq -0x188(%rbp), %rdi
callq 0x4270
leaq -0x1a8(%rbp), %rdi
callq 0x4270
jmp 0xad15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xad04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xacf8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xacec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xace0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x4270
leaq -0x1c8(%rbp), %rdi
callq 0x4270
leaq -0x168(%rbp), %rdi
callq 0x4270
leaq -0x188(%rbp), %rdi
callq 0x4270
leaq -0x1a8(%rbp), %rdi
callq 0x4270
jmp 0xb07a
movl $0x0, -0x1cc(%rbp)
movq -0x298(%rbp), %rax
movl -0x1cc(%rbp), %ecx
movl %ecx, -0x2bc(%rbp)
movq 0x8(%rax), %rdi
callq 0x281d0
movl %eax, -0x2b8(%rbp)
jmp 0xad43
movl -0x2bc(%rbp), %eax
movl -0x2b8(%rbp), %ecx
cmpl %ecx, %eax
jge 0xad7b
leaq -0xc8(%rbp), %rdi
leaq -0x1cc(%rbp), %rsi
callq 0xb700
jmp 0xad68
jmp 0xad6a
movl -0x1cc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1cc(%rbp)
jmp 0xad1f
movl $0x0, -0x1d0(%rbp)
movl -0x1d0(%rbp), %eax
cmpl 0x3393f(%rip), %eax     # 0x3e6d0
jge 0xadc5
movl $0xffffffff, -0x1d4(%rbp) # imm = 0xFFFFFFFF
leaq -0xc8(%rbp), %rdi
leaq -0x1d4(%rbp), %rsi
callq 0xb700
jmp 0xadb2
jmp 0xadb4
movl -0x1d0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d0(%rbp)
jmp 0xad85
movl $0x0, -0x1d8(%rbp)
movl -0x1d8(%rbp), %eax
cmpl 0x338f5(%rip), %eax     # 0x3e6d0
jge 0xae0a
movslq -0x1d8(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0xb780
movq %rax, %rdi
callq 0x4680
jmp 0xadf7
jmp 0xadf9
movl -0x1d8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d8(%rbp)
jmp 0xadcf
leaq -0x20(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0xb830
movq %rax, -0x1e8(%rbp)
leaq -0x1e0(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0xb860
movq -0x2d0(%rbp), %rdi
callq 0xb830
movq %rax, -0x200(%rbp)
movslq 0x33882(%rip), %rsi     # 0x3e6d0
leaq -0x200(%rbp), %rdi
callq 0xb8a0
movq %rax, -0x1f8(%rbp)
leaq -0x1f0(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0xb860
movq -0x2d0(%rbp), %rdi
movq -0x1e0(%rbp), %rsi
movq -0x1f0(%rbp), %rdx
callq 0xb7a0
movq %rax, -0x2c8(%rbp)
jmp 0xae97
movq -0x2c8(%rbp), %rax
movq %rax, -0x208(%rbp)
cmpl $0x0, 0x33850(%rip)     # 0x3e6fc
jne 0xaec4
movq -0x298(%rbp), %rax
movq 0x10(%rax), %rdi
xorl %esi, %esi
callq 0x14eb0
jmp 0xaec2
jmp 0xaec4
testb $0x1, 0x3381d(%rip)     # 0x3e6e8
je 0xb046
movq -0x298(%rbp), %rsi
movq 0x8(%rsi), %rax
movq %rax, -0x2d8(%rbp)
addq $0x18, %rsi
leaq 0x20f74(%rip), %rdx     # 0x2be62
leaq -0x248(%rbp), %rdi
callq 0xb230
jmp 0xaefc
movl -0xd8(%rbp), %esi
leaq -0x268(%rbp), %rdi
callq 0xb300
jmp 0xaf10
leaq -0x228(%rbp), %rdi
leaq -0x248(%rbp), %rsi
leaq -0x268(%rbp), %rdx
callq 0xb630
jmp 0xaf2c
leaq -0x289(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x46e0
movq -0x2e0(%rbp), %rdx
leaq 0x20f1a(%rip), %rsi     # 0x2be67
leaq -0x288(%rbp), %rdi
callq 0x4530
jmp 0xaf5b
movq -0x2d8(%rbp), %rdi
xorl %esi, %esi
leaq -0x228(%rbp), %rdx
leaq -0x288(%rbp), %rcx
callq 0x283a0
jmp 0xaf79
leaq -0x288(%rbp), %rdi
callq 0x4270
leaq -0x289(%rbp), %rdi
callq 0x4420
leaq -0x228(%rbp), %rdi
callq 0x4270
leaq -0x268(%rbp), %rdi
callq 0x4270
leaq -0x248(%rbp), %rdi
callq 0x4270
jmp 0xb046
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xb038
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xb02c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xb014
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x4270
leaq -0x289(%rbp), %rdi
callq 0x4420
leaq -0x228(%rbp), %rdi
callq 0x4270
leaq -0x268(%rbp), %rdi
callq 0x4270
leaq -0x248(%rbp), %rdi
callq 0x4270
jmp 0xb07a
jmp 0xb048
movl -0xd8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0xa9ab
leaq -0xc8(%rbp), %rdi
callq 0xb8e0
leaq -0x20(%rbp), %rdi
callq 0xb910
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
leaq -0xc8(%rbp), %rdi
callq 0xb8e0
leaq -0x20(%rbp), %rdi
callq 0xb910
movq -0xd0(%rbp), %rdi
callq 0x46c0
nopl (%rax,%rax)