// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/components/compcoup/compcoup_transport.cc
// Function: scdc_compcoup_transport::dataset_cmd(scdc_dataset*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, _scdc_dataset_inout_t*, _scdc_dataset_inout_t*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool scdc_compcoup_transport::dataset_cmd(scdc_dataset *dataset, const string &cmd, scdc_dataset_input_t *input, scdc_dataset_output_t *output, scdc_result &result)
{
  SCDC_TRACE("dataset_cmd: dataset: " << dataset << ", cmd: '" << cmd << "'");

  if (!transport_connection->acquire())
  {
    result = "acquiring connection failed";
    SCDC_FAIL(__func__ << ": " << result);
    return false;
  }

  bool ret = true;

  scdc_dataset_transport *dataset_transport = static_cast<scdc_dataset_transport *>(dataset);

  /* send request: DATASET_CMD <output-info> (STATE <state>|NOSTATE) <cmd> (<input-info> <input-data> )+ */

  ret = ret && scdc_dataset_transport::write_delim(transport_connection, "DATASET_CMD", -1, default_delim);
  ret = ret && scdc_dataset_transport::write_output_info(transport_connection, output);
  if (dataset_transport)
  {
    ret = ret && scdc_dataset_transport::write_delim(transport_connection, "STATE", -1, default_delim);
    ret = ret && dataset_transport->write_state();

  } else
  {
    ret = ret && scdc_dataset_transport::write_delim(transport_connection, "NOSTATE", -1, default_delim);
  }
  ret = ret && scdc_dataset_transport::write_string(transport_connection, cmd);

  if (!ret)
  {
    result = "sending cmd request failed";
    SCDC_FAIL(__func__ << ": " << result);
    transport_connection->release();
    return false;
  }

  /* send input */
  ret = ret && dataset_input_outgoing_produce(transport_connection, input);

  ret = ret && transport->send_outgoing(transport_connection);

  if (!ret)
  {
    result = "sending input failed";
    SCDC_FAIL(__func__ << ": " << result);
    transport_connection->release();
    return false;
  }

  /* read answer: DATASET_CMD (<output-info> <output-data> )+(OK|FAILED) (STATE <state>|NOSTATE) RESULT <string> (<output-info> <output-data> )+ */

  string s;

  ret = ret && scdc_dataset_transport::read_delim(transport_connection, &s, default_delim);
  SCDC_ASSERT(s == "DATASET_CMD");

  if (!ret)
  {
    result = "reading cmd answer (1) failed";
    SCDC_FAIL(__func__ << ": " << result);
    transport_connection->release();
    return false;
  }

  bool output_next = false;

  /* consume immediate output with a given next function */
  ret = ret && dataset_output_incoming_consume(transport_connection, output, &output_next);
  SCDC_ASSERT(!output_next);

  if (!ret)
  {
    result = "reading immediate output failed";
    SCDC_FAIL(__func__ << ": " << result);
    transport_connection->release();
    return false;
  }

  bool cmd_ret = false;

  ret = ret && scdc_dataset_transport::read_delim(transport_connection, &s, default_delim);

  if (s == "OK")
  {
    cmd_ret = true;

  } else
  {
    SCDC_ASSERT(s == "FAILED");
  }

  ret = ret && scdc_dataset_transport::read_delim(transport_connection, &s, default_delim);
  if (s == "STATE")
  {
    ret = ret && dataset_transport->read_state();

  } else
  {
    SCDC_ASSERT(s == "NOSTATE");
    SCDC_ASSERT(!dataset_transport);
  }

  ret = ret && scdc_dataset_transport::read_delim(transport_connection, &s, default_delim);
  SCDC_ASSERT(s == "RESULT");
  ret = ret && scdc_dataset_transport::read_string(transport_connection, &result);

  if (!ret)
  {
    result = "reading cmd answer (2) failed";
    SCDC_FAIL(__func__ << ": " << result);
    delete dataset_transport;
    transport_connection->release();
    return false;
  }

  /* final output is either consumed by a given next function or has to be further consumed using the next function */
  output_next = false;
  ret = ret && dataset_output_incoming_consume(transport_connection, output, &output_next);

  if (output)
  {
    if (output_next)
    {
      output->next = read_output_next;
      output->data = transport_connection;

    } else
    {
      if (transport_connection->current_incoming_output_intern)
      {
        output->next = read_output_next;
        output->data = transport_connection;

        /* unset internal buffer usage for next 'next' */
        transport_connection->current_incoming_output_intern = false;

      } else
      {
        output->next = 0;
        output->data = 0;
      }
    }
  }

  if (!ret)
  {
    result = "reading output failed";
    SCDC_FAIL(__func__ << ": " << result);
    delete dataset_transport;
    transport_connection->release();
    return false;
  }

  ret = cmd_ret;

  if (!output || !output->next) transport_connection->release();

  SCDC_TRACE_F("return: " << ret << ", result: '" << result << "'");

  return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r14
movq %r8, %r12
movq %rcx, %r13
movq %rdx, %rbp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x4955c
testb %al, %al
je 0x4cd4f
movq 0x18(%rbx), %rdi
leaq 0x8261(%rip), %rsi      # 0x54f55
pushq $-0x1
popq %rdx
pushq $0x20
popq %rcx
callq 0x4ed78
testb %al, %al
je 0x4d0dd
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0x4f798
testq %r15, %r15
je 0x4cde0
testb %al, %al
je 0x4d0dd
movq 0x18(%rbx), %rdi
leaq 0x815e(%rip), %rsi      # 0x54e8d
pushq $-0x1
popq %rdx
pushq $0x20
popq %rcx
callq 0x4ed78
testb %al, %al
je 0x4d0dd
movq %r15, %rdi
callq 0x4f24e
jmp 0x4cdfe
leaq 0x808d(%rip), %rsi      # 0x54de3
movq %r14, %rdi
callq 0xba40
leaq 0x2881b(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4d16e
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x8(%rax), %rdi
leaq 0x43fe(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x8069(%rip), %rsi      # 0x54dff
movq %rax, %rdi
callq 0xb520
leaq 0x369e(%rip), %rsi      # 0x50443
movq %rax, %rdi
callq 0xb520
leaq 0x7cef(%rip), %rsi      # 0x54aa3
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movq %r14, %rsi
callq 0xb490
movq %rax, %rdi
callq 0xb270
movq (%rbx), %rdi
addq $0x20, %rdi
callq 0xb3e0
jmp 0x4d16e
testb %al, %al
je 0x4d0dd
movq 0x18(%rbx), %rdi
leaq 0x8098(%rip), %rsi      # 0x54e8b
pushq $-0x1
popq %rdx
pushq $0x20
popq %rcx
callq 0x4ed78
testb %al, %al
je 0x4d0dd
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0x4ee26
testb %al, %al
je 0x4d0dd
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0x4d710
testb %al, %al
je 0x4d181
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
movq (%rdi), %rax
callq *0xd0(%rax)
testb %al, %al
je 0x4d181
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
pushq $0x20
popq %rdx
xorl %ecx, %ecx
callq 0x4ee36
movl %eax, %ebp
leaq 0x80e1(%rip), %rsi      # 0x54f55
leaq 0x8(%rsp), %rdi
callq 0x19be0
testb %al, %al
jne 0x4cf13
leaq 0x286f3(%rip), %r13     # 0x75580
movq (%r13), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4cf13
addq $0x20, %rdi
callq 0xb800
movq (%r13), %rax
movq 0x18(%rax), %rdi
leaq 0x4699(%rip), %rsi      # 0x51549
callq 0xb520
leaq 0x7f81(%rip), %rsi      # 0x54e3d
movq %rax, %rdi
callq 0xb520
leaq 0x4479(%rip), %rsi      # 0x51344
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movl $0x2d7, %esi            # imm = 0x2D7
callq 0xb990
leaq 0x80aa(%rip), %rsi      # 0x54f91
movq %rax, %rdi
callq 0xb520
leaq 0x5f9a(%rip), %rsi      # 0x52e90
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r13), %rdi
addq $0x20, %rdi
callq 0xb3e0
testb %bpl, %bpl
je 0x4d18d
leaq 0x7(%rsp), %rdx
movb $0x0, (%rdx)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0x4d7da
movl %eax, %ebp
cmpb $0x1, 0x7(%rsp)
jne 0x4cfca
leaq 0x2863c(%rip), %r13     # 0x75580
movq (%r13), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4cfca
addq $0x20, %rdi
callq 0xb800
movq (%r13), %rax
movq 0x18(%rax), %rdi
leaq 0x45e2(%rip), %rsi      # 0x51549
callq 0xb520
leaq 0x7eca(%rip), %rsi      # 0x54e3d
movq %rax, %rdi
callq 0xb520
leaq 0x43c2(%rip), %rsi      # 0x51344
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movl $0x2e5, %esi            # imm = 0x2E5
callq 0xb990
leaq 0x8027(%rip), %rsi      # 0x54fc5
movq %rax, %rdi
callq 0xb520
leaq 0x5ee3(%rip), %rsi      # 0x52e90
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r13), %rdi
addq $0x20, %rdi
callq 0xb3e0
testb %bpl, %bpl
je 0x4d223
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
pushq $0x20
popq %rdx
xorl %ecx, %ecx
callq 0x4ee36
movl %eax, %r13d
leaq 0x3544(%rip), %rsi      # 0x50534
leaq 0x8(%rsp), %rdi
callq 0x19be0
movl %eax, %ebp
testb %al, %al
jne 0x4d0b9
leaq 0x7e68(%rip), %rsi      # 0x54e73
leaq 0x8(%rsp), %rdi
callq 0x19be0
testb %al, %al
jne 0x4d0b9
leaq 0x2855c(%rip), %rax     # 0x75580
movq (%rax), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4d0b9
addq $0x20, %rdi
callq 0xb800
leaq 0x2853e(%rip), %rax     # 0x75580
movq (%rax), %rax
movq 0x18(%rax), %rdi
leaq 0x44f9(%rip), %rsi      # 0x51549
callq 0xb520
leaq 0x7de1(%rip), %rsi      # 0x54e3d
movq %rax, %rdi
callq 0xb520
leaq 0x42d9(%rip), %rsi      # 0x51344
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movl $0x2f9, %esi            # imm = 0x2F9
callq 0xb990
leaq 0x7df3(%rip), %rsi      # 0x54e7a
movq %rax, %rdi
callq 0xb520
leaq 0x5dfa(%rip), %rsi      # 0x52e90
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
leaq 0x284d3(%rip), %rax     # 0x75580
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3e0
testb %r13b, %r13b
je 0x4d2b9
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
pushq $0x20
popq %rdx
xorl %ecx, %ecx
callq 0x4ee36
movl %eax, %r13d
jmp 0x4d2bc
leaq 0x7e7d(%rip), %rsi      # 0x54f61
movq %r14, %rdi
callq 0xba40
leaq 0x2848d(%rip), %r15     # 0x75580
movq (%r15), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4d165
addq $0x20, %rdi
callq 0xb800
movq (%r15), %rax
movq 0x8(%rax), %rdi
leaq 0x4074(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x7cdf(%rip), %rsi      # 0x54dff
movq %rax, %rdi
callq 0xb520
leaq 0x3314(%rip), %rsi      # 0x50443
movq %rax, %rdi
callq 0xb520
leaq 0x7965(%rip), %rsi      # 0x54aa3
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movq %r14, %rsi
callq 0xb490
movq %rax, %rdi
callq 0xb270
movq (%r15), %rdi
addq $0x20, %rdi
callq 0xb3e0
movq 0x18(%rbx), %rdi
callq 0x49568
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7df4(%rip), %rsi      # 0x54f7c
jmp 0x4d0e4
leaq 0x7e13(%rip), %rsi      # 0x54fa7
movq %r14, %rdi
callq 0xba40
leaq 0x283dd(%rip), %r15     # 0x75580
movq (%r15), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4d215
addq $0x20, %rdi
callq 0xb800
movq (%r15), %rax
movq 0x8(%rax), %rdi
leaq 0x3fc4(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x7c2f(%rip), %rsi      # 0x54dff
movq %rax, %rdi
callq 0xb520
leaq 0x3264(%rip), %rsi      # 0x50443
movq %rax, %rdi
callq 0xb520
leaq 0x78b5(%rip), %rsi      # 0x54aa3
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movq %r14, %rsi
callq 0xb490
movq %rax, %rdi
callq 0xb270
movq (%r15), %rdi
addq $0x20, %rdi
callq 0xb3e0
movq 0x18(%rbx), %rdi
callq 0x49568
jmp 0x4d612
leaq 0x7dab(%rip), %rsi      # 0x54fd5
movq %r14, %rdi
callq 0xba40
leaq 0x28347(%rip), %r15     # 0x75580
movq (%r15), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4d2ab
addq $0x20, %rdi
callq 0xb800
movq (%r15), %rax
movq 0x8(%rax), %rdi
leaq 0x3f2e(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x7b99(%rip), %rsi      # 0x54dff
movq %rax, %rdi
callq 0xb520
leaq 0x31ce(%rip), %rsi      # 0x50443
movq %rax, %rdi
callq 0xb520
leaq 0x781f(%rip), %rsi      # 0x54aa3
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movq %r14, %rsi
callq 0xb490
movq %rax, %rdi
callq 0xb270
movq (%r15), %rdi
addq $0x20, %rdi
callq 0xb3e0
movq 0x18(%rbx), %rdi
callq 0x49568
jmp 0x4d612
xorl %r13d, %r13d
leaq 0x7bca(%rip), %rsi      # 0x54e8d
leaq 0x8(%rsp), %rdi
callq 0x19be0
testb %al, %al
je 0x4d2ea
testb %r13b, %r13b
je 0x4d461
movq %r15, %rdi
callq 0x4ef82
movl %eax, %r13d
jmp 0x4d444
leaq 0x7b9a(%rip), %rsi      # 0x54e8b
leaq 0x8(%rsp), %rdi
callq 0x19be0
testb %al, %al
jne 0x4d39f
leaq 0x28276(%rip), %rax     # 0x75580
movq (%rax), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4d39f
addq $0x20, %rdi
callq 0xb800
leaq 0x28258(%rip), %rax     # 0x75580
movq (%rax), %rax
movq 0x18(%rax), %rdi
leaq 0x4213(%rip), %rsi      # 0x51549
callq 0xb520
leaq 0x7afb(%rip), %rsi      # 0x54e3d
movq %rax, %rdi
callq 0xb520
leaq 0x3ff3(%rip), %rsi      # 0x51344
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movl $0x303, %esi            # imm = 0x303
callq 0xb990
leaq 0x7b26(%rip), %rsi      # 0x54e93
movq %rax, %rdi
callq 0xb520
leaq 0x5b14(%rip), %rsi      # 0x52e90
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
leaq 0x281ed(%rip), %rax     # 0x75580
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3e0
testq %r15, %r15
je 0x4d444
leaq 0x281d1(%rip), %rax     # 0x75580
movq (%rax), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4d444
addq $0x20, %rdi
callq 0xb800
leaq 0x281b3(%rip), %rax     # 0x75580
movq (%rax), %rax
movq 0x18(%rax), %rdi
leaq 0x416e(%rip), %rsi      # 0x51549
callq 0xb520
leaq 0x7a56(%rip), %rsi      # 0x54e3d
movq %rax, %rdi
callq 0xb520
leaq 0x3f4e(%rip), %rsi      # 0x51344
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movl $0x304, %esi            # imm = 0x304
callq 0xb990
leaq 0x7be3(%rip), %rsi      # 0x54ff5
movq %rax, %rdi
callq 0xb520
leaq 0x5a6f(%rip), %rsi      # 0x52e90
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
leaq 0x28148(%rip), %rax     # 0x75580
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3e0
testb %r13b, %r13b
je 0x4d461
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
pushq $0x20
popq %rdx
xorl %ecx, %ecx
callq 0x4ee36
movl %eax, %r13d
jmp 0x4d464
xorl %r13d, %r13d
leaq 0x7a3a(%rip), %rsi      # 0x54ea5
leaq 0x8(%rsp), %rdi
callq 0x19be0
testb %al, %al
jne 0x4d519
leaq 0x280fc(%rip), %rax     # 0x75580
movq (%rax), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4d519
addq $0x20, %rdi
callq 0xb800
leaq 0x280de(%rip), %rax     # 0x75580
movq (%rax), %rax
movq 0x18(%rax), %rdi
leaq 0x4099(%rip), %rsi      # 0x51549
callq 0xb520
leaq 0x7981(%rip), %rsi      # 0x54e3d
movq %rax, %rdi
callq 0xb520
leaq 0x3e79(%rip), %rsi      # 0x51344
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movl $0x308, %esi            # imm = 0x308
callq 0xb990
leaq 0x79c5(%rip), %rsi      # 0x54eac
movq %rax, %rdi
callq 0xb520
leaq 0x599a(%rip), %rsi      # 0x52e90
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
leaq 0x28073(%rip), %rax     # 0x75580
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3e0
testb %r13b, %r13b
je 0x4d570
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0x4f064
testb %al, %al
je 0x4d570
leaq 0x7(%rsp), %rdx
movb $0x0, (%rdx)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0x4d7da
testq %r12, %r12
je 0x4d623
cmpb $0x1, 0x7(%rsp)
jne 0x4d62d
leaq 0x382(%rip), %rcx       # 0x4d8df
movq %rcx, 0x38(%r12)
movq 0x18(%rbx), %rcx
movq %rcx, 0x40(%r12)
jmp 0x4d652
leaq 0x7a94(%rip), %rsi      # 0x5500b
movq %r14, %rdi
callq 0xba40
leaq 0x27ffa(%rip), %r12     # 0x75580
movq (%r12), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4d5fb
addq $0x20, %rdi
callq 0xb800
movq (%r12), %rax
movq 0x8(%rax), %rdi
leaq 0x3bdf(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x784a(%rip), %rsi      # 0x54dff
movq %rax, %rdi
callq 0xb520
leaq 0x2e7f(%rip), %rsi      # 0x50443
movq %rax, %rdi
callq 0xb520
leaq 0x74d0(%rip), %rsi      # 0x54aa3
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movq %r14, %rsi
callq 0xb490
movq %rax, %rdi
callq 0xb270
movq (%r12), %rdi
addq $0x20, %rdi
callq 0xb3e0
testq %r15, %r15
je 0x4d609
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
movq 0x18(%rbx), %rdi
callq 0x49568
xorl %ebp, %ebp
leaq 0x8(%rsp), %rdi
callq 0xb230
jmp 0x4d170
testb %al, %al
je 0x4d66f
movq 0x18(%rbx), %rdi
jmp 0x4d668
movq 0x18(%rbx), %rdi
cmpb $0x1, 0x2d3(%rdi)
jne 0x4d658
leaq 0x29e(%rip), %rcx       # 0x4d8df
movq %rcx, 0x38(%r12)
movq %rdi, 0x40(%r12)
movb $0x0, 0x2d3(%rdi)
testb %al, %al
jne 0x4d614
jmp 0x4d66f
addq $0x38, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
testb %al, %al
je 0x4d66f
callq 0x49568
jmp 0x4d614
leaq 0x79b3(%rip), %rsi      # 0x55029
movq %r14, %rdi
callq 0xba40
leaq 0x27efb(%rip), %r12     # 0x75580
movq (%r12), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4d5fb
addq $0x20, %rdi
callq 0xb800
movq (%r12), %rax
movq 0x8(%rax), %rdi
leaq 0x3adc(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x7747(%rip), %rsi      # 0x54dff
movq %rax, %rdi
callq 0xb520
leaq 0x2d7c(%rip), %rsi      # 0x50443
movq %rax, %rdi
callq 0xb520
leaq 0x73cd(%rip), %rsi      # 0x54aa3
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movq %r14, %rsi
callq 0xb490
movq %rax, %rdi
callq 0xb270
jmp 0x4d5ee
jmp 0x4d6fa
jmp 0x4d6fa
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xb230
movq %rbx, %rdi
callq 0xb9a0
nop