// File: /workspace/github_cpp_makefile_star2_O3/ncbi[P]amr/common.cpp
// Function: Common_sp::ShellApplication::getBlastThreadsParam(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long) const
string ShellApplication::getBlastThreadsParam (const string &blast,
                                               size_t threads_max_max) const
{
  ASSERT (! tmp. empty ());

  const size_t t = min (threads_max, threads_max_max);
  if (t <= 1)  // One thread is main
    return noString;
  
	bool num_threadsP = false;
	bool mt_modeP = false;
	{
	  const string blast_help (tmp + "/blast_help");
    exec (fullProg (blast) + " -help > " + blast_help);
    LineInput f (blast_help);
    while (f. nextLine ())
    {
      trim (f. line);
      if (contains (f. line, "-num_threads "))
        num_threadsP = true;
      if (contains (f. line, "-mt_mode "))
        mt_modeP = true;
    }
  }
  
  if (! num_threadsP)
    return noString;
  
  string s ("  -num_threads " + to_string (t));
  
  bool mt_mode_works = true;
#ifdef __APPLE__
  {
    mt_mode_works = false;
    const string blast_version (tmp + "/blast_version");
    exec (fullProg (blast) + " -version > " + blast_version);
    LineInput f (blast_version);
    while (f. nextLine ())
    {
      trim (f. line);
      const string prefix (blast + ": ");
      if (isLeft (f. line, prefix))
      {
        trimSuffix (f. line, "+");
        Istringstream iss;
        iss. reset (f. line. substr (prefix. size ()));
        const SoftwareVersion v (iss);
      //PRINT (v);  
        iss. reset ("2.13.0");  // PD-4560
        const SoftwareVersion threshold (iss);;
      //PRINT (threshold);  
        mt_mode_works = (threshold <= v);
      }
      break;
    }
  }
#endif

  if (mt_modeP && mt_mode_works)  
    s += "  -mt_mode 1";
    
  return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x398, %rsp            # imm = 0x398
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r13
callq 0xa070
movl $0x0, (%rax)
movq 0x170(%r14), %rdx
testq %rdx, %rdx
je 0x63fd7
movq 0x4caff(%rip), %rax     # 0xb05b8
cmpq %r15, %rax
cmovbq %rax, %r15
cmpq $0x1, %r15
ja 0x63aef
leaq 0x10(%r13), %rax
movq %rax, (%r13)
movq 0x4d003(%rip), %rsi     # 0xb0ad8
movq 0x4d004(%rip), %rdx     # 0xb0ae0
addq %rsi, %rdx
movq %r13, %rdi
callq 0x2c212
movq %r13, %rax
jmp 0x63fc5
movq %r15, 0x68(%rsp)
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x168(%r14), %rsi
addq %rsi, %rdx
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x2c212
leaq 0x2b2d8(%rip), %rsi     # 0x8edf4
movq %r15, %rdi
callq 0xaac0
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x6221c
leaq 0x2b2c5(%rip), %rsi     # 0x8ee00
leaq 0x48(%rsp), %rdi
callq 0xaac0
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x63b6b
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x63b72
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rsp, %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0xa190
leaq 0x100(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x63bcb
movq %rdx, 0xf0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x100(%rsp)
jmp 0x63bd1
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
leaq 0xf0(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x4cee1(%rip), %rsi     # 0xb0ad8
callq 0x3f921
movq 0xf0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x63c19
movq 0x100(%rsp), %rsi
incq %rsi
callq 0xa5a0
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x63c2f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xa5a0
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x63c4a
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xa5a0
movq %r13, 0x40(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0x20(%rsp), %rsi
xorl %edx, %edx
callq 0x30bc4
leaq 0x4a9ae(%rip), %rax     # 0xae618
leaq 0x358(%rsp), %r15
movq %rax, -0x268(%r15)
movl $0x0, -0x8(%r15)
leaq 0x368(%rsp), %rax
movq %rax, -0x10(%rax)
xorl %r13d, %r13d
movq %r13, -0x8(%rax)
movb %r13b, (%rax)
leaq 0x388(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r13, -0x8(%rax)
movb %r13b, (%rax)
xorl %ebp, %ebp
leaq 0xf0(%rsp), %rdi
callq 0x33b76
testb %al, %al
je 0x63d87
movq %r15, %rdi
callq 0x37275
movq %r15, %rdi
callq 0x384ed
movq %rbp, %r12
leaq 0x10(%rsp), %rbx
movq %rbx, (%rsp)
movq %rsp, %rdi
leaq 0x2b12f(%rip), %rsi     # 0x8ee16
leaq 0x2b135(%rip), %rdx     # 0x8ee23
callq 0x2fa1a
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
movq %r15, %rdi
xorl %edx, %edx
callq 0xa9e0
movq %rax, %rbp
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x63d1f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xa5a0
cmpq $-0x1, %rbp
setne %r14b
leaq 0x10(%rsp), %rbx
movq %rbx, (%rsp)
movq %rsp, %rdi
leaq 0x2b0d0(%rip), %rsi     # 0x8ee0a
leaq 0x2b0d2(%rip), %rdx     # 0x8ee13
callq 0x2fa1a
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
movq %r15, %rdi
xorl %edx, %edx
callq 0xa9e0
movq %rax, %rbp
movq (%rsp), %rdi
cmpq %rbx, %rdi
je 0x63d72
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xa5a0
orb %r14b, %r13b
cmpq $-0x1, %rbp
setne %al
movq %r12, %rbp
orb %al, %bpl
jmp 0x63cac
leaq 0x4a88a(%rip), %rax     # 0xae618
movq %rax, 0xf0(%rsp)
movq 0x378(%rsp), %rdi
leaq 0x388(%rsp), %rax
cmpq %rax, %rdi
je 0x63dbb
movq 0x388(%rsp), %rsi
incq %rsi
callq 0xa5a0
movq 0x358(%rsp), %rdi
leaq 0x368(%rsp), %rax
cmpq %rax, %rdi
leaq 0x30(%rsp), %r14
movq 0x68(%rsp), %r12
je 0x63dea
movq 0x368(%rsp), %rsi
incq %rsi
callq 0xa5a0
leaq 0x4a8df(%rip), %rax     # 0xae6d0
leaq 0x310(%rsp), %rbx
movq %rax, -0x220(%rbx)
movq %rbx, %rdi
callq 0x436fc
leaq 0x4a921(%rip), %rax     # 0xae730
movq %rax, -0x218(%rbx)
leaq 0x1f8(%rsp), %rbx
leaq 0x4a933(%rip), %rax     # 0xae758
movq %rax, (%rbx)
leaq 0x108(%rsp), %r15
movq %r15, %rdi
callq 0xa4b0
leaq 0x4a941(%rip), %rax     # 0xae780
movq %rax, -0x10(%r15)
leaq 0x4a95e(%rip), %rax     # 0xae7a8
movq %rax, (%rbx)
movq $0x0, -0x8(%r15)
movq %rbx, %rdi
callq 0xa1c0
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x63e74
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xa5a0
testb $0x1, %r13b
je 0x63ed2
movl $0x1, %esi
cmpq $0xa, %r12
movq 0x40(%rsp), %r15
jb 0x63f03
movl $0x4, %esi
movabsq $0x346dc5d63886594b, %rdi # imm = 0x346DC5D63886594B
movq %r12, %rcx
cmpq $0x63, %rcx
jbe 0x63efc
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x63f01
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x63f03
movq %rcx, %rax
mulq %rdi
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x63e9c
addl $-0x3, %esi
jmp 0x63f03
movq 0x40(%rsp), %r15
leaq 0x10(%r15), %rax
movq %rax, (%r15)
movq 0x4cbf3(%rip), %rsi     # 0xb0ad8
movq 0x4cbf4(%rip), %rdx     # 0xb0ae0
addq %rsi, %rdx
movq %r15, %rdi
callq 0x2c212
jmp 0x63fc2
addl $-0x2, %esi
jmp 0x63f03
decl %esi
movl %esi, %esi
leaq 0xf0(%rsp), %rbx
leaq 0x100(%rsp), %rax
movq %rax, (%rbx)
movq %rbx, %rdi
xorl %edx, %edx
callq 0xa670
movq (%rbx), %rdi
movl 0x8(%rbx), %esi
movq %r12, %rdx
callq 0x2c726
leaq 0x2aedd(%rip), %rcx     # 0x8ee14
movl $0xf, %r8d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xa620
leaq 0x10(%r15), %rbx
movq %rbx, (%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x63f6b
movq %rdx, (%r15)
movq (%rcx), %rdx
movq %rdx, 0x10(%r15)
jmp 0x63f71
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%r15)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x63fad
movq 0x100(%rsp), %rsi
incq %rsi
callq 0xa5a0
testb $0x1, %bpl
je 0x63fc2
leaq 0x2ae6a(%rip), %rsi     # 0x8ee24
movq %r15, %rdi
callq 0xaac0
movq %r15, %rax
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xa6b0
testl %eax, %eax
jne 0x64069
leaq 0xc0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x2893f(%rip), %rsi     # 0x8c936
leaq 0x2894b(%rip), %rdx     # 0x8c949
leaq 0xb0(%rsp), %rdi
callq 0x2fa1a
leaq 0xd0(%rsp), %rdi
movl $0x1148, %esi           # imm = 0x1148
callq 0x2d1fa
leaq 0x48(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0x2d152
leaq 0x26ba7(%rip), %rsi     # 0x8abe5
leaq 0x48(%rsp), %rdi
callq 0xaac0
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x64073
movups (%rcx), %xmm0
movups %xmm0, (%r15)
jmp 0x6407f
movl $0x1, %edi
callq 0xa6c0
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xa0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x2acf2(%rip), %rsi     # 0x8ed9d
leaq 0x2ad41(%rip), %rdx     # 0x8edf3
leaq 0x90(%rsp), %rdi
callq 0x2fa1a
leaq 0x2886d(%rip), %rsi     # 0x8c933
leaq 0x90(%rsp), %rdi
callq 0xaac0
leaq 0x80(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x640f8
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x64108
movq %rdx, 0x70(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x80(%rsp)
movq 0x8(%rax), %rsi
leaq 0x70(%rsp), %rdx
movq %rsi, 0x8(%rdx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x2d152
leaq 0x2abae(%rip), %rsi     # 0x8ece6
leaq 0x20(%rsp), %rdi
callq 0xaac0
leaq 0x100(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x64166
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
jmp 0x64179
movq %rdx, 0xf0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x100(%rsp)
movq 0x8(%rax), %rdx
leaq 0xf0(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0x34fa2
movq %rax, %r14
movq 0xf0(%rsp), %rdi
cmpq %rbp, %rdi
je 0x641c2
movq 0x100(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x641c2
movq %rax, %r14
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x641e2
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x641e2
movq %rax, %r14
movq 0x70(%rsp), %rdi
cmpq %r13, %rdi
je 0x64201
movq 0x80(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x64201
movq %rax, %r14
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0x64223
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x64223
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x6423e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x6423e
movq %rax, %r14
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6425e
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x6425e
movq %rax, %r14
leaq 0xe0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6429b
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x6429b
movq %rax, %r14
movq (%r15), %rdi
cmpq %rbx, %rdi
je 0x64392
movq (%rbx), %rsi
jmp 0x6438a
movq %rax, %r14
movq 0xb0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x64392
movq 0xc0(%rsp), %rsi
jmp 0x6438a
movq %rax, %r14
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x64392
movq 0x100(%rsp), %rsi
jmp 0x6438a
movq %rax, %r14
jmp 0x64392
jmp 0x6434e
movq %rax, %r14
movq 0xf0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x64311
movq 0x100(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x64311
movq %rax, %r14
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x64331
movq 0x10(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x64331
movq %rax, %r14
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x64376
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x64376
movq %rax, %r14
jmp 0x64376
movq %rax, %r14
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
jne 0x64385
jmp 0x64392
jmp 0x64366
jmp 0x64366
movq %rax, %r14
leaq 0xf0(%rsp), %rdi
callq 0x2defc
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x64392
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xa5a0
movq %r14, %rdi
callq 0xaa10