// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/components/dataprov/dataprov_jobrun.cc
// Function: scdc_dataprov_jobrun::nodes_config(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, long long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, scdc_config_result&)
bool scdc_dataprov_jobrun::nodes_config(const std::string &cmd, scdcint_t param, std::string &val, scdc_config_result &result)
{
  SCDC_TRACE(__func__ << ": cmd: '" << cmd << "', param: '" << param << "', val: '" << val << "', result: '" << result << "'");

  bool ret = false;

  if (param == 0) /* nodes */
  {
    if (cmd == "put")
    {
      stringlist sl(':', val);

      string nodeid, s;
      scdc_dataprov_jobrun_node_t node(1, 1, 1.0);

      sl.front_pop(nodeid);

      if (sl.front_pop(s) && s != "") stringstream(s) >> node.cores;

      if (sl.front_pop(s) && s != "") stringstream(s) >> node.performance;

      if (sl.front_pop(s) && s != "") stringstream(s) >> node.max_parallel_jobs;
      else node.max_parallel_jobs = node.cores;

      ret = add_node(nodeid, node);

    } else if (cmd == "get")
    {
      nodes_t::iterator nodes_begin, nodes_end;

      if (val == "") { nodes_begin = nodes.begin(); nodes_end = nodes.end(); }
      else
      {
        nodes_begin = nodes_end = nodes.find(val);
        ++nodes_end;
      }

      for (nodes_t::iterator i = nodes_begin; i != nodes_end; ++i)
      {
        char s[64], *ps = s;
        sprintf(s, "%s:%" scdcint_fmt ":%f:%" scdcint_fmt, i->first.c_str(), i->second.cores, i->second.performance, i->second.max_parallel_jobs);
        ret = scdc_dataprov_config::get<char *>(result, "nodes", ps);
      }
      
    } else if (cmd == "rm")
    {
      ret = del_node(val);
    }

  } else if (param == 1) /* cores */
  {
    if (cmd == "put")
    {
      string nodeid;
      scdcint_t cores;

      ret = scdc_dataprov_config::put<string>(result, "cores", val, nodeid)
         && scdc_dataprov_config::put<scdcint_t>(result, "cores", val, cores)
         && set_node(nodeid, cores, -1, -1);

    } else if (cmd == "get")
    {
      scdc_dataprov_jobrun_node_t node;

      if (val == "") ret = scdc_dataprov_config::get<scdcint_t>(result, "cores", total_cores);
      else
      {
        if (get_node(val, node)) ret = scdc_dataprov_config::get<scdcint_t>(result, "cores", node.cores);
        else ret = scdc_dataprov_config::fail(result, "cores", "getting node " + val + " failed");
      }
    }

  } else if (param == 2) /* max_parallel_jobs */
  {
    if (cmd == "put")
    {
      string nodeid;
      scdcint_t max_parallel_jobs;

      ret = scdc_dataprov_config::put<string>(result, "max_parallel_jobs", val, nodeid)
         && scdc_dataprov_config::put<scdcint_t>(result, "max_parallel_jobs", val, max_parallel_jobs)
         && set_node(nodeid, -1, max_parallel_jobs, -1);

    } else if (cmd == "get")
    {
      scdc_dataprov_jobrun_node_t node;

      if (val == "") ret = scdc_dataprov_config::get<scdcint_t>(result, "max_parallel_jobs", max_parallel_jobs);
      else
      {
        if (get_node(val, node)) ret = scdc_dataprov_config::get<scdcint_t>(result, "max_parallel_jobs", node.max_parallel_jobs);
        else ret = scdc_dataprov_config::fail(result, "max_parallel_jobs", "getting node " + val + " failed");
      }
    }

  } else if (param == 3) /* performance */
  {
    if (cmd == "put")
    {
      string nodeid;
      double performance;

      ret = scdc_dataprov_config::put<string>(result, "performance", val, nodeid)
         && scdc_dataprov_config::put<double>(result, "performance", val, performance)
         && set_node(nodeid, -1, -1, performance);

    } else if (cmd == "get")
    {
      scdc_dataprov_jobrun_node_t node;

      if (get_node(val, node)) ret = scdc_dataprov_config::get<double>(result, "performance", node.performance);
      else ret = scdc_dataprov_config::fail(result, "performance", "getting node " + val + " failed");
    }
  }

  return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %r8, 0x8(%rsp)
cmpq $0x3, %rdx
ja 0x3d174
movq %rcx, %r15
movq %rsi, %r12
movq %rdi, %r14
leaq 0x16d76(%rip), %rax     # 0x539d8
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x14e2e(%rip), %rsi     # 0x51aa0
movq %r12, %rdi
callq 0x19be0
testb %al, %al
je 0x3d077
leaq 0x218(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb750
leaq 0x10(%rsp), %rdi
pushq $0x3a
popq %rsi
movq %rbx, %rdx
callq 0x2f05c
leaq 0x218(%rsp), %rdi
callq 0xb230
leaq 0x80(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq 0x60(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %edx, %edx
movb %dl, (%rax)
movb %dl, (%rcx)
pushq $0x1
popq %rax
movq %rax, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x48(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x19f34
leaq 0x10(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x19f34
testb %al, %al
je 0x3cd5e
leaq 0x157a1(%rip), %rsi     # 0x524bd
leaq 0x50(%rsp), %rdi
callq 0x1b1d7
testb %al, %al
je 0x3cd5e
leaq 0x90(%rsp), %rdi
leaq 0x50(%rsp), %rsi
pushq $0x18
popq %rdx
callq 0xb8e0
leaq 0x90(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xb780
leaq 0x90(%rsp), %rdi
callq 0xb3d0
leaq 0x10(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x19f34
testb %al, %al
je 0x3cdba
leaq 0x15745(%rip), %rsi     # 0x524bd
leaq 0x50(%rsp), %rdi
callq 0x1b1d7
testb %al, %al
je 0x3cdba
leaq 0x90(%rsp), %rdi
leaq 0x50(%rsp), %rsi
pushq $0x18
popq %rdx
callq 0xb8e0
leaq 0x48(%rsp), %rsi
leaq 0x90(%rsp), %rdi
callq 0xb340
leaq 0x90(%rsp), %rdi
callq 0xb3d0
leaq 0x10(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x19f34
testb %al, %al
je 0x3d104
leaq 0x156e5(%rip), %rsi     # 0x524bd
leaq 0x50(%rsp), %rdi
callq 0x1b1d7
testb %al, %al
je 0x3d104
leaq 0x90(%rsp), %rdi
leaq 0x50(%rsp), %rsi
pushq $0x18
popq %rdx
callq 0xb8e0
leaq 0x40(%rsp), %rsi
leaq 0x90(%rsp), %rdi
callq 0xb780
leaq 0x90(%rsp), %rdi
callq 0xb3d0
jmp 0x3d10e
leaq 0x14c76(%rip), %rsi     # 0x51aa0
movq %r12, %rdi
callq 0x19be0
testb %al, %al
je 0x3cfe9
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x17522(%rip), %rsi     # 0x54377
leaq 0x90(%rsp), %rcx
movq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x1eed2
testb %al, %al
je 0x3cfd5
leaq 0x174fe(%rip), %rsi     # 0x54377
leaq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x40eba
testb %al, %al
je 0x3cfd5
movq 0x10(%rsp), %rcx
leaq 0x90(%rsp), %rsi
pushq $-0x1
popq %rdx
movsd 0x13505(%rip), %xmm0    # 0x503b0
movq %r14, %rdi
callq 0x3d7ee
jmp 0x3cfd1
leaq 0x14be1(%rip), %rsi     # 0x51aa0
movq %r12, %rdi
callq 0x19be0
testb %al, %al
je 0x3d02a
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x16bb8(%rip), %rsi     # 0x53aa2
leaq 0x90(%rsp), %rcx
movq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x1eed2
testb %al, %al
je 0x3cfd5
leaq 0x16b94(%rip), %rsi     # 0x53aa2
leaq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x40faa
testb %al, %al
je 0x3cfd5
movsd 0x10(%rsp), %xmm0
leaq 0x90(%rsp), %rsi
pushq $-0x1
popq %rcx
movq %r14, %rdi
movq %rcx, %rdx
callq 0x3d7ee
jmp 0x3cfd1
leaq 0x14b50(%rip), %rsi     # 0x51aa0
movq %r12, %rdi
callq 0x19be0
testb %al, %al
je 0x3d0bb
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x16b21(%rip), %rsi     # 0x53a9c
leaq 0x90(%rsp), %rcx
movq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x1eed2
testb %al, %al
je 0x3cfd5
leaq 0x16b01(%rip), %rsi     # 0x53a9c
leaq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x40eba
testb %al, %al
je 0x3cfd5
movq 0x10(%rsp), %rdx
leaq 0x90(%rsp), %rsi
pushq $-0x1
popq %rcx
movsd 0x133e7(%rip), %xmm0    # 0x503b0
movq %r14, %rdi
callq 0x3d7ee
movl %eax, %ebp
jmp 0x3cfd7
xorl %ebp, %ebp
leaq 0x90(%rsp), %rdi
callq 0xb230
jmp 0x3d29e
leaq 0x14b28(%rip), %rsi     # 0x51b18
movq %r12, %rdi
callq 0x19be0
testb %al, %al
je 0x3d174
leaq 0x154b6(%rip), %rsi     # 0x524bd
movq %r15, %rdi
callq 0x19be0
testb %al, %al
je 0x3d17b
addq $0xc0, %r14
leaq 0x17352(%rip), %rsi     # 0x54377
jmp 0x3d0f7
leaq 0x14ae7(%rip), %rsi     # 0x51b18
movq %r12, %rdi
callq 0x19be0
testb %al, %al
je 0x3d174
leaq 0x70(%rsp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3d74a
testb %al, %al
je 0x3d1a4
leaq 0x80(%rsp), %rdx
leaq 0x16a3a(%rip), %rsi     # 0x53aa2
movq 0x8(%rsp), %rdi
callq 0x41016
jmp 0x3d29c
leaq 0x14a9a(%rip), %rsi     # 0x51b18
movq %r12, %rdi
callq 0x19be0
testb %al, %al
je 0x3d145
leaq 0x15428(%rip), %rsi     # 0x524bd
movq %r15, %rdi
callq 0x19be0
testb %al, %al
je 0x3d1f0
movq %r14, %r13
movq 0xa0(%r14), %r15
addq $0x90, %r13
jmp 0x3d210
leaq 0x14a56(%rip), %rsi     # 0x51b18
movq %r12, %rdi
callq 0x19be0
testb %al, %al
je 0x3d174
leaq 0x153e4(%rip), %rsi     # 0x524bd
movq %r15, %rdi
callq 0x19be0
testb %al, %al
je 0x3d272
addq $0xb8, %r14
leaq 0x169a5(%rip), %rsi     # 0x53a9c
movq 0x8(%rsp), %rdi
movq %r14, %rdx
jmp 0x3d297
movq 0x38(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x70(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movq %r14, %rdi
callq 0x3be6a
movl %eax, %ebp
leaq 0x50(%rsp), %rdi
callq 0xb230
leaq 0x70(%rsp), %rdi
callq 0xb230
leaq 0x10(%rsp), %rdi
callq 0x19ef4
jmp 0x3d29e
leaq 0x16373(%rip), %rsi     # 0x534bf
movq %r12, %rdi
callq 0x19be0
testb %al, %al
je 0x3d174
movq %r14, %rdi
movq %r15, %rsi
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3c0c8
xorl %ebp, %ebp
jmp 0x3d29e
leaq 0x70(%rsp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3d74a
testb %al, %al
je 0x3d2b6
leaq 0x78(%rsp), %rdx
leaq 0x171d8(%rip), %rsi     # 0x54377
jmp 0x3d292
leaq 0x16b1a(%rip), %rsi     # 0x53cc5
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rdx
callq 0x19ae2
leaq 0x15ccf(%rip), %rdx     # 0x52e91
leaq 0x90(%rsp), %rdi
movq %rbx, %rsi
callq 0x1cb18
movq 0x90(%rsp), %rdx
leaq 0x168c1(%rip), %rsi     # 0x53aa2
movq 0x8(%rsp), %rdi
callq 0x1f0f0
jmp 0x3d346
addq $0x88, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x42b62
movq %rax, %r15
movq %rax, %rdi
callq 0xb380
movq %rax, %r13
xorl %ebp, %ebp
leaq 0x90(%rsp), %r12
leaq 0x16875(%rip), %rbx     # 0x53a96
leaq 0x10(%rsp), %r14
cmpq %r13, %r15
je 0x3d29e
movq %r12, 0x10(%rsp)
movq 0x20(%r15), %rdx
movq 0x40(%r15), %rcx
movsd 0x50(%r15), %xmm0
movq 0x48(%r15), %r8
movq %r12, %rdi
leaq 0x16a69(%rip), %rsi     # 0x53cb5
movb $0x1, %al
callq 0xb0c0
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x40e36
movl %eax, %ebp
movq %r15, %rdi
callq 0xb380
movq %rax, %r15
jmp 0x3d226
leaq 0x70(%rsp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3d74a
testb %al, %al
je 0x3d2ff
leaq 0x1680f(%rip), %rsi     # 0x53a9c
leaq 0x70(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x40f26
movl %eax, %ebp
andb $0x1, %bpl
movl %ebp, %eax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x16a08(%rip), %rsi     # 0x53cc5
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rdx
callq 0x19ae2
leaq 0x15bbd(%rip), %rdx     # 0x52e91
leaq 0x90(%rsp), %rdi
movq %rbx, %rsi
callq 0x1cb18
movq 0x90(%rsp), %rdx
leaq 0x17084(%rip), %rsi     # 0x54377
movq 0x8(%rsp), %rdi
callq 0x1f0f0
jmp 0x3d346
leaq 0x169bf(%rip), %rsi     # 0x53cc5
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rdx
callq 0x19ae2
leaq 0x15b74(%rip), %rdx     # 0x52e91
leaq 0x90(%rsp), %rdi
movq %rbx, %rsi
callq 0x1cb18
movq 0x90(%rsp), %rdx
leaq 0x16760(%rip), %rsi     # 0x53a9c
movq 0x8(%rsp), %rdi
callq 0x1f0f0
movl %eax, %ebp
leaq 0x90(%rsp), %rdi
callq 0xb230
leaq 0x10(%rsp), %rdi
jmp 0x3cfdf
jmp 0x3d383
jmp 0x3d383
jmp 0x3d395
jmp 0x3d395
jmp 0x3d36f
jmp 0x3d3c2
jmp 0x3d36f
jmp 0x3d3c2
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xb3d0
jmp 0x3d3c5
jmp 0x3d3c2
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xb230
jmp 0x3d398
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0x3d3bb
movq %rax, %rbx
leaq 0x218(%rsp), %rdi
jmp 0x3d3bb
jmp 0x3d3b0
jmp 0x3d3b0
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xb230
jmp 0x3d3e3
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0xb230
leaq 0x70(%rsp), %rdi
callq 0xb230
leaq 0x10(%rsp), %rdi
callq 0x19ef4
movq %rbx, %rdi
callq 0xb9a0
nop