// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/components/dataprov/dataprov_jobrun.cc
// Function: build_cmd(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<scdc_dataprov_jobrun_res_proc_t, std::allocator<scdc_dataprov_jobrun_res_proc_t>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
static void build_cmd(const std::string &format, const char *run_time, const std::string &jobid, const std::string &params, const scdc_dataprov_jobrun_res_t &res, std::string &cmd)
{
  cmd = format;

  SCDC_TRACE(__func__ << ": format: '" << format << "'");

  /* replace $PARAMS$ first so that all following placeholders are also replaced in the params string */
  string_replace_all(cmd, "$PARAMS$", params);

  string_replace_all(cmd, "$RUN_TIME$", run_time);
  string_replace_all(cmd, "$JOBID$", jobid);

  stringstream nodes, nprocs, nthrds, npt, tpn;

  /* - $NODES$ = '<node0>,<node1>,...',
     - $NT$ bzw. $NTHRDS$ = '<nt0>,<nt1>,...',
     - $NP$ bzw. $NPROCS$ = '<np0>,<np1>,...',
     - $NPT$ = '<node0>:<np0>:<nt0>,<node1>:<np1>:<nt1>,...'
     - $TPN$ = '<nt0>:<np0>:<node0>,<nt1>:<np1>:<node1>,...' */

  for (scdc_dataprov_jobrun_res_t::const_iterator i = res.begin(); i != res.end(); ++i)
  {
    if (i != res.begin())
    {
      nodes << ",";
      nprocs << ",";
      nthrds << ",";
      npt << ",";
      tpn << ",";
    }

    nodes << i->node;
    nprocs << i->np;
    nthrds << i->nt;
    npt << i->node << ":" << i->np << ":" << i->nt;
    tpn << i->nt << ":" << i->np << ":" << i->node;
  }

  SCDC_TRACE(__func__ << ": nodes: '" << nodes.str() << "'");
  SCDC_TRACE(__func__ << ": nprocs: '" << nprocs.str() << "'");
  SCDC_TRACE(__func__ << ": nthrds: '" << nthrds.str() << "'");
  SCDC_TRACE(__func__ << ": npt: '" << npt.str() << "'");
  SCDC_TRACE(__func__ << ": tpn: '" << tpn.str() << "'");

  string_replace_all(cmd, "$NODES$", nodes.str());
  string_replace_all(cmd, "$NP$", nprocs.str());
  string_replace_all(cmd, "$NPROCS$", nprocs.str());
  string_replace_all(cmd, "$NT$", nthrds.str());
  string_replace_all(cmd, "$NTHRDS$", nthrds.str());
  string_replace_all(cmd, "$NPT$", npt.str());
  string_replace_all(cmd, "$TPN$", tpn.str());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7f8, %rsp            # imm = 0x7F8
movq %r8, %r12
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %rsi
movq %r8, %rdi
callq 0xb2e0
leaq 0x14c21(%rip), %rsi     # 0x541f2
leaq 0x50(%rsp), %rdi
leaq 0x1d8(%rsp), %rdx
callq 0x1a132
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x40342
leaq 0x50(%rsp), %rdi
callq 0xb230
leaq 0x14bf7(%rip), %rsi     # 0x541fb
leaq 0x50(%rsp), %rdi
leaq 0x360(%rsp), %rdx
callq 0x1a132
leaq 0x1484a(%rip), %rsi     # 0x53e67
leaq 0x1d8(%rsp), %rdi
leaq 0x4e8(%rsp), %rdx
callq 0x1a132
leaq 0x50(%rsp), %rsi
leaq 0x1d8(%rsp), %rdx
movq %r12, %rdi
callq 0x40342
leaq 0x1d8(%rsp), %rdi
callq 0xb230
leaq 0x50(%rsp), %rdi
callq 0xb230
leaq 0x14ba1(%rip), %rsi     # 0x54206
leaq 0x50(%rsp), %rdi
leaq 0x1d8(%rsp), %rdx
callq 0x1a132
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x40342
leaq 0x50(%rsp), %rdi
callq 0xb230
leaq 0x50(%rsp), %rdi
callq 0xb390
leaq 0x1d8(%rsp), %rdi
callq 0xb390
leaq 0x360(%rsp), %rdi
callq 0xb390
leaq 0x4e8(%rsp), %rdi
callq 0xb390
movq %r12, 0x48(%rsp)
leaq 0x670(%rsp), %rdi
callq 0xb390
movq (%r14), %r15
leaq 0x4f8(%rsp), %rbx
leaq 0x680(%rsp), %r12
leaq 0x11c56(%rip), %r13     # 0x51344
leaq 0x12151(%rip), %rbp     # 0x51846
cmpq 0x8(%r14), %r15
je 0x3f7f1
cmpq (%r14), %r15
je 0x3f747
leaq 0x60(%rsp), %rdi
movq %rbp, %rsi
callq 0xb520
leaq 0x1e8(%rsp), %rdi
movq %rbp, %rsi
callq 0xb520
leaq 0x370(%rsp), %rdi
movq %rbp, %rsi
callq 0xb520
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xb520
movq %r12, %rdi
movq %rbp, %rsi
callq 0xb520
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0xb490
movq 0x20(%r15), %rsi
leaq 0x1e8(%rsp), %rdi
callq 0xb1d0
movq 0x28(%r15), %rsi
leaq 0x370(%rsp), %rdi
callq 0xb1d0
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb490
movq %rax, %rdi
movq %r13, %rsi
callq 0xb520
movq 0x20(%r15), %rsi
movq %rax, %rdi
callq 0xb1d0
movq %rax, %rdi
movq %r13, %rsi
callq 0xb520
movq 0x28(%r15), %rsi
movq %rax, %rdi
callq 0xb1d0
movq 0x28(%r15), %rsi
movq %r12, %rdi
callq 0xb1d0
movq %rax, %rdi
movq %r13, %rsi
callq 0xb520
movq 0x20(%r15), %rsi
movq %rax, %rdi
callq 0xb1d0
movq %rax, %rdi
movq %r13, %rsi
callq 0xb520
movq %rax, %rdi
movq %r15, %rsi
callq 0xb490
addq $0x30, %r15
jmp 0x3f6f5
leaq 0x14a16(%rip), %rsi     # 0x5420e
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1a132
leaq 0x68(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0xb8d0
movq 0x48(%rsp), %r14
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x40342
leaq 0x8(%rsp), %rdi
callq 0xb230
leaq 0x28(%rsp), %rdi
callq 0xb230
leaq 0x149ce(%rip), %rsi     # 0x54216
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1a132
leaq 0x1f0(%rsp), %rbx
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0xb8d0
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x40342
leaq 0x8(%rsp), %rdi
callq 0xb230
leaq 0x28(%rsp), %rdi
callq 0xb230
leaq 0x14982(%rip), %rsi     # 0x5421b
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1a132
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0xb8d0
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x40342
leaq 0x8(%rsp), %rdi
callq 0xb230
leaq 0x28(%rsp), %rdi
callq 0xb230
leaq 0x14942(%rip), %rsi     # 0x54224
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1a132
leaq 0x378(%rsp), %rbx
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0xb8d0
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x40342
leaq 0x8(%rsp), %rdi
callq 0xb230
leaq 0x28(%rsp), %rdi
callq 0xb230
leaq 0x148f6(%rip), %rsi     # 0x54229
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1a132
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0xb8d0
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x40342
leaq 0x8(%rsp), %rdi
callq 0xb230
leaq 0x28(%rsp), %rdi
callq 0xb230
leaq 0x148b6(%rip), %rsi     # 0x54232
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1a132
leaq 0x500(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0xb8d0
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x40342
leaq 0x8(%rsp), %rdi
callq 0xb230
leaq 0x28(%rsp), %rdi
callq 0xb230
leaq 0x1486e(%rip), %rsi     # 0x54238
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1a132
leaq 0x688(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0xb8d0
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x40342
leaq 0x8(%rsp), %rdi
callq 0xb230
leaq 0x28(%rsp), %rdi
callq 0xb230
leaq 0x670(%rsp), %rdi
callq 0xb3d0
leaq 0x4e8(%rsp), %rdi
callq 0xb3d0
leaq 0x360(%rsp), %rdi
callq 0xb3d0
leaq 0x1d8(%rsp), %rdi
callq 0xb3d0
leaq 0x50(%rsp), %rdi
callq 0xb3d0
addq $0x7f8, %rsp            # imm = 0x7F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3fa88
jmp 0x3fa97
jmp 0x3faea
jmp 0x3fa88
jmp 0x3fa97
jmp 0x3faea
jmp 0x3fa88
jmp 0x3fa97
jmp 0x3faea
jmp 0x3fa88
jmp 0x3fa97
jmp 0x3faea
jmp 0x3fa88
jmp 0x3fa97
jmp 0x3faea
jmp 0x3fa88
jmp 0x3fa97
jmp 0x3faea
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xb230
jmp 0x3fa9a
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xb230
jmp 0x3faed
jmp 0x3faea
movq %rax, %rbx
jmp 0x3fafa
movq %rax, %rbx
jmp 0x3fb07
movq %rax, %rbx
jmp 0x3fb14
movq %rax, %rbx
jmp 0x3fb21
jmp 0x3fad6
jmp 0x3fae5
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0xb230
jmp 0x3fad9
jmp 0x3fad6
jmp 0x3fae5
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0xb230
jmp 0x3fb2b
movq %rax, %rbx
jmp 0x3fb2b
movq %rax, %rbx
leaq 0x670(%rsp), %rdi
callq 0xb3d0
leaq 0x4e8(%rsp), %rdi
callq 0xb3d0
leaq 0x360(%rsp), %rdi
callq 0xb3d0
leaq 0x1d8(%rsp), %rdi
callq 0xb3d0
leaq 0x50(%rsp), %rdi
callq 0xb3d0
movq %rbx, %rdi
callq 0xb9a0
nop