// File: /workspace/github_cpp_makefile_star2_O3/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, %r13
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %rsi
movq %r8, %rdi
callq 0xb2c0
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1bfcb(%rip), %rsi     # 0x6d262
leaq 0x1bfcc(%rip), %rdx     # 0x6d26a
leaq 0x50(%rsp), %rdi
callq 0x1be38
leaq 0x50(%rsp), %rsi
movq %r13, %rdi
movq %r15, %rdx
callq 0x526e7
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x512cf
movq 0x60(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x1bf8d(%rip), %rsi     # 0x6d26b
leaq 0x1bf90(%rip), %rdx     # 0x6d275
callq 0x1be38
leaq 0x1e8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1bbda(%rip), %rsi     # 0x6ced7
leaq 0x1bbd6(%rip), %rdx     # 0x6ceda
leaq 0x1d8(%rsp), %rdi
callq 0x1be38
leaq 0x50(%rsp), %rsi
leaq 0x1d8(%rsp), %rdx
movq %r13, %rdi
callq 0x526e7
movq 0x1d8(%rsp), %rdi
cmpq %r15, %rdi
je 0x51343
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x5135a
movq 0x60(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x50(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x1bf0d(%rip), %rsi     # 0x6d276
leaq 0x1bf0d(%rip), %rdx     # 0x6d27d
callq 0x1be38
leaq 0x50(%rsp), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x526e7
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x5139c
movq 0x60(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x50(%rsp), %rdi
callq 0xb360
leaq 0x1d8(%rsp), %rdi
callq 0xb360
leaq 0x4e8(%rsp), %rdi
callq 0xb360
leaq 0x360(%rsp), %rdi
callq 0xb360
movq %r13, 0x48(%rsp)
leaq 0x670(%rsp), %rdi
callq 0xb360
movq (%r14), %rbp
cmpq 0x8(%r14), %rbp
je 0x5154b
leaq 0x680(%rsp), %rbx
leaq 0x18f69(%rip), %r15     # 0x6a364
leaq 0x194af(%rip), %r12     # 0x6a8b1
cmpq (%r14), %rbp
je 0x51468
movl $0x1, %edx
leaq 0x60(%rsp), %rdi
movq %r12, %rsi
callq 0xb5f0
movl $0x1, %edx
leaq 0x1e8(%rsp), %rdi
movq %r12, %rsi
callq 0xb5f0
movl $0x1, %edx
leaq 0x4f8(%rsp), %rdi
movq %r12, %rsi
callq 0xb5f0
movl $0x1, %edx
leaq 0x370(%rsp), %rdi
movq %r12, %rsi
callq 0xb5f0
movl $0x1, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xb5f0
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
leaq 0x60(%rsp), %rdi
callq 0xb5f0
movq 0x20(%rbp), %rsi
leaq 0x1e8(%rsp), %rdi
callq 0xb1d0
movq 0x28(%rbp), %rsi
leaq 0x4f8(%rsp), %rdi
callq 0xb1d0
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
leaq 0x370(%rsp), %rdi
callq 0xb5f0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0xb5f0
movq 0x20(%rbp), %rsi
movq %r13, %rdi
callq 0xb1d0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0xb5f0
movq 0x28(%rbp), %rsi
movq %r13, %rdi
callq 0xb1d0
movq 0x28(%rbp), %rsi
movq %rbx, %rdi
callq 0xb1d0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0xb5f0
movq 0x20(%rbp), %rsi
movq %r13, %rdi
callq 0xb1d0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0xb5f0
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
movq %r13, %rdi
callq 0xb5f0
addq $0x30, %rbp
cmpq 0x8(%r14), %rbp
jne 0x51402
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1bd23(%rip), %rsi     # 0x6d27e
leaq 0x1bd23(%rip), %rdx     # 0x6d285
leaq 0x8(%rsp), %rdi
callq 0x1be38
leaq 0x68(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0xb8c0
movq 0x48(%rsp), %r12
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r12, %rdi
callq 0x526e7
leaq 0x38(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x515ad
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x515c4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1bcb3(%rip), %rsi     # 0x6d286
leaq 0x1bcb0(%rip), %rdx     # 0x6d28a
callq 0x1be38
leaq 0x1f0(%rsp), %rbx
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0xb8c0
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r12, %rdi
callq 0x526e7
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x5161d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x51634
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1bc48(%rip), %rsi     # 0x6d28b
leaq 0x1bc49(%rip), %rdx     # 0x6d293
callq 0x1be38
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0xb8c0
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r12, %rdi
callq 0x526e7
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x51685
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x5169c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1bbe9(%rip), %rsi     # 0x6d294
leaq 0x1bbe6(%rip), %rdx     # 0x6d298
callq 0x1be38
leaq 0x500(%rsp), %rbx
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0xb8c0
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r12, %rdi
callq 0x526e7
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x516f5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x5170c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1bb7e(%rip), %rsi     # 0x6d299
leaq 0x1bb7f(%rip), %rdx     # 0x6d2a1
callq 0x1be38
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0xb8c0
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r12, %rdi
callq 0x526e7
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x5175d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x51774
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1bb1f(%rip), %rsi     # 0x6d2a2
leaq 0x1bb1d(%rip), %rdx     # 0x6d2a7
callq 0x1be38
leaq 0x378(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0xb8c0
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r12, %rdi
callq 0x526e7
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x517ca
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x517e1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1bab8(%rip), %rsi     # 0x6d2a8
leaq 0x1bab6(%rip), %rdx     # 0x6d2ad
callq 0x1be38
leaq 0x688(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0xb8c0
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r12, %rdi
callq 0x526e7
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x51837
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x5184e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x3a75b(%rip), %rbx     # 0x8bfb0
leaq 0x670(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb390
movl $0x80, %r14d
addq %r14, %r15
movq %r15, %rdi
callq 0xb180
leaq 0x360(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb390
addq %r14, %r15
movq %r15, %rdi
callq 0xb180
leaq 0x4e8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb390
addq %r14, %r15
movq %r15, %rdi
callq 0xb180
leaq 0x1d8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb390
addq %r14, %r15
movq %r15, %rdi
callq 0xb180
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xb390
addq %r14, %r15
movq %r15, %rdi
callq 0xb180
addq $0x7f8, %rsp            # imm = 0x7F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5192d
jmp 0x51963
jmp 0x519fa
jmp 0x5192d
jmp 0x51963
jmp 0x519fa
jmp 0x5192d
jmp 0x51963
jmp 0x519fa
jmp 0x5192d
jmp 0x51963
jmp 0x519fa
jmp 0x5192d
jmp 0x51963
jmp 0x519fa
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x51966
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x51966
jmp 0x51963
jmp 0x519fa
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x5193a
jmp 0x51966
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x519fd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x519fd
jmp 0x519fa
movq %rax, %rbx
jmp 0x51a1e
movq %rax, %rbx
jmp 0x51a3f
movq %rax, %rbx
jmp 0x51a60
movq %rax, %rbx
jmp 0x51a81
jmp 0x519cf
jmp 0x519f2
movq %rax, %rbx
movq 0x1d8(%rsp), %rdi
cmpq %r15, %rdi
je 0x519d2
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x519d2
jmp 0x519cf
jmp 0x519f2
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x51a9f
movq 0x60(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x51a9f
movq %rax, %rbx
jmp 0x51a9f
movq %rax, %rbx
movq 0x3a5ac(%rip), %rsi     # 0x8bfb0
leaq 0x670(%rsp), %rdi
callq 0xb390
leaq 0x6f0(%rsp), %rdi
callq 0xb180
movq 0x3a58b(%rip), %rsi     # 0x8bfb0
leaq 0x360(%rsp), %rdi
callq 0xb390
leaq 0x3e0(%rsp), %rdi
callq 0xb180
movq 0x3a56a(%rip), %rsi     # 0x8bfb0
leaq 0x4e8(%rsp), %rdi
callq 0xb390
leaq 0x568(%rsp), %rdi
callq 0xb180
movq 0x3a549(%rip), %rsi     # 0x8bfb0
leaq 0x1d8(%rsp), %rdi
callq 0xb390
leaq 0x258(%rsp), %rdi
callq 0xb180
movq 0x3a528(%rip), %rsi     # 0x8bfb0
leaq 0x50(%rsp), %rdi
callq 0xb390
leaq 0xd0(%rsp), %rdi
callq 0xb180
movq %rbx, %rdi
callq 0xb9c0
nop