// File: /workspace/github_cpp_makefile_star2_O1/mh0fm4[P]SCDC/src/components/compcoup/compcoup_transport.cc
// Function: scdc_compcoup_transport::dataset_close(scdc_dataset*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool scdc_compcoup_transport::dataset_close(scdc_dataset *dataset, scdc_result &result)
{
  SCDC_TRACE("dataset_close: dataset: '" << dataset << "'");

  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_CLOSE <state> */

  ret = ret && scdc_dataset_transport::write_delim(transport_connection, "DATASET_CLOSE", -1, default_delim);
  ret = ret && dataset_transport->write_state();

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

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

  /* read answer: DATASET_CLOSE (OK|FAILED) RESULT <string> */

  string s;

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

  ret = ret && scdc_dataset_transport::read_delim(transport_connection, &s, default_delim);
  if (s == "OK")
  {
    /* nothing to do here */

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

  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 close answer failed";
    SCDC_FAIL(__func__ << ": " << result);
    delete dataset_transport;
    transport_connection->release();
    return false;
  }

  delete dataset_transport;
  dataset_transport = 0;

  transport_connection->release();

  return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x5f888
testb %al, %al
je 0x638ce
movq 0x18(%rbx), %rdi
leaq 0xa783(%rip), %rsi      # 0x6def6
movq $-0x1, %rdx
movl $0x20, %ecx
callq 0x668c4
testb %al, %al
je 0x639ab
movq %r15, %rdi
callq 0x66ed4
testb %al, %al
je 0x639ab
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
movq (%rdi), %rax
callq *0xd0(%rax)
testb %al, %al
je 0x639ab
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
movl $0x20, %edx
xorl %ecx, %ecx
callq 0x669b2
movl %eax, %ebp
leaq 0xa70f(%rip), %rsi      # 0x6def6
leaq 0x8(%rsp), %rdi
callq 0xb110
testl %eax, %eax
je 0x638a9
leaq 0x28d70(%rip), %r13     # 0x8c570
movq (%r13), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x638a9
addq $0x20, %rdi
callq 0xb7d0
movq (%r13), %rax
movq 0x18(%rax), %r12
leaq 0x6d22(%rip), %rsi      # 0x6a549
movl $0xd, %edx
movq %r12, %rdi
callq 0xb5f0
leaq 0xa602(%rip), %rsi      # 0x6de3d
movl $0x1e, %edx
movq %r12, %rdi
callq 0xb5f0
leaq 0x6af5(%rip), %rsi      # 0x6a344
movl $0x1, %edx
movq %r12, %rdi
callq 0xb5f0
movq %r12, %rdi
movl $0x277, %esi            # imm = 0x277
callq 0xb9a0
movq %rax, %r12
leaq 0xa6ae(%rip), %rsi      # 0x6df21
movl $0x17, %edx
movq %rax, %rdi
callq 0xb5f0
leaq 0x8601(%rip), %rsi      # 0x6be88
movl $0x8, %edx
movq %r12, %rdi
callq 0xb5f0
movq %r12, %rdi
callq 0xb250
movq (%r13), %rdi
addq $0x20, %rdi
callq 0xb3b0
testb %bpl, %bpl
je 0x63aa1
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
movl $0x20, %edx
xorl %ecx, %ecx
callq 0x669b2
movl %eax, %ebp
jmp 0x63aa3
movq 0x8(%r14), %rdx
leaq 0xa50a(%rip), %rcx      # 0x6dde3
xorl %r12d, %r12d
movl $0x1b, %r8d
movq %r14, %rdi
xorl %esi, %esi
callq 0xb870
leaq 0x28c7d(%rip), %r15     # 0x8c570
movq (%r15), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x63a8f
addq $0x20, %rdi
callq 0xb7d0
movq (%r15), %rax
movq 0x8(%rax), %rbx
leaq 0x6870(%rip), %rsi      # 0x6a188
movl $0xb, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0xa4d3(%rip), %rsi      # 0x6ddff
movl $0x14, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x687c(%rip), %rsi      # 0x6a1bc
movl $0xd, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0xa14f(%rip), %rsi      # 0x6daa3
movl $0x2, %edx
movq %rbx, %rdi
callq 0xb5f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0xb5f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0xb4d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb340
movq (%r15), %rdi
addq $0x20, %rdi
callq 0xb3b0
jmp 0x63a8c
movq 0x8(%r14), %rdx
leaq 0xa54e(%rip), %rcx      # 0x6df04
movl $0x1c, %r8d
movq %r14, %rdi
xorl %esi, %esi
callq 0xb870
leaq 0x28ba3(%rip), %r12     # 0x8c570
movq (%r12), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x63a83
addq $0x20, %rdi
callq 0xb7d0
movq (%r12), %rax
movq 0x8(%rax), %r15
leaq 0x6794(%rip), %rsi      # 0x6a188
movl $0xb, %edx
movq %r15, %rdi
callq 0xb5f0
leaq 0xa3f7(%rip), %rsi      # 0x6ddff
movl $0x14, %edx
movq %r15, %rdi
callq 0xb5f0
leaq 0x67a0(%rip), %rsi      # 0x6a1bc
movl $0xd, %edx
movq %r15, %rdi
callq 0xb5f0
leaq 0xa073(%rip), %rsi      # 0x6daa3
movl $0x2, %edx
movq %r15, %rdi
callq 0xb5f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0xb5f0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0xb4d0
movsbl %al, %esi
movq %r14, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb340
movq (%r12), %rdi
addq $0x20, %rdi
callq 0xb3b0
movq 0x18(%rbx), %rdi
callq 0x5f894
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
leaq 0x5a8a(%rip), %rsi      # 0x69534
leaq 0x8(%rsp), %rdi
callq 0xb110
testl %eax, %eax
je 0x63b85
leaq 0xa3b0(%rip), %rsi      # 0x6de73
leaq 0x8(%rsp), %rdi
callq 0xb110
testl %eax, %eax
je 0x63b85
leaq 0x28a94(%rip), %r13     # 0x8c570
movq (%r13), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x63b85
addq $0x20, %rdi
callq 0xb7d0
movq (%r13), %rax
movq 0x18(%rax), %r12
leaq 0x6a46(%rip), %rsi      # 0x6a549
movl $0xd, %edx
movq %r12, %rdi
callq 0xb5f0
leaq 0xa326(%rip), %rsi      # 0x6de3d
movl $0x1e, %edx
movq %r12, %rdi
callq 0xb5f0
leaq 0x6819(%rip), %rsi      # 0x6a344
movl $0x1, %edx
movq %r12, %rdi
callq 0xb5f0
movq %r12, %rdi
movl $0x280, %esi            # imm = 0x280
callq 0xb9a0
movq %rax, %r12
leaq 0xa32b(%rip), %rsi      # 0x6de7a
movl $0x10, %edx
movq %rax, %rdi
callq 0xb5f0
leaq 0x8325(%rip), %rsi      # 0x6be88
movl $0x8, %edx
movq %r12, %rdi
callq 0xb5f0
movq %r12, %rdi
callq 0xb250
movq (%r13), %rdi
addq $0x20, %rdi
callq 0xb3b0
testb %bpl, %bpl
je 0x63ba3
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
movl $0x20, %edx
xorl %ecx, %ecx
callq 0x669b2
movl %eax, %ebp
jmp 0x63ba5
xorl %ebp, %ebp
leaq 0xa2f9(%rip), %rsi      # 0x6dea5
leaq 0x8(%rsp), %rdi
callq 0xb110
testl %eax, %eax
je 0x63c6e
leaq 0x289ab(%rip), %r13     # 0x8c570
movq (%r13), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x63c6e
addq $0x20, %rdi
callq 0xb7d0
movq (%r13), %rax
movq 0x18(%rax), %r12
leaq 0x695d(%rip), %rsi      # 0x6a549
movl $0xd, %edx
movq %r12, %rdi
callq 0xb5f0
leaq 0xa23d(%rip), %rsi      # 0x6de3d
movl $0x1e, %edx
movq %r12, %rdi
callq 0xb5f0
leaq 0x6730(%rip), %rsi      # 0x6a344
movl $0x1, %edx
movq %r12, %rdi
callq 0xb5f0
movq %r12, %rdi
movl $0x284, %esi            # imm = 0x284
callq 0xb9a0
movq %rax, %r12
leaq 0xa274(%rip), %rsi      # 0x6deac
movl $0x10, %edx
movq %rax, %rdi
callq 0xb5f0
leaq 0x823c(%rip), %rsi      # 0x6be88
movl $0x8, %edx
movq %r12, %rdi
callq 0xb5f0
movq %r12, %rdi
callq 0xb250
movq (%r13), %rdi
addq $0x20, %rdi
callq 0xb3b0
testb %bpl, %bpl
je 0x63c84
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0x66c34
movl %eax, %r12d
jmp 0x63c87
xorl %r12d, %r12d
testb %r12b, %r12b
jne 0x63d46
movq 0x8(%r14), %rdx
leaq 0xa29e(%rip), %rcx      # 0x6df39
movl $0x1b, %r8d
movq %r14, %rdi
xorl %esi, %esi
callq 0xb870
leaq 0x288be(%rip), %rbp     # 0x8c570
movq (%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x63d46
addq $0x20, %rdi
callq 0xb7d0
movq (%rbp), %rax
movq 0x8(%rax), %r13
leaq 0x64af(%rip), %rsi      # 0x6a188
movl $0xb, %edx
movq %r13, %rdi
callq 0xb5f0
leaq 0xa112(%rip), %rsi      # 0x6ddff
movl $0x14, %edx
movq %r13, %rdi
callq 0xb5f0
leaq 0x64bb(%rip), %rsi      # 0x6a1bc
movl $0xd, %edx
movq %r13, %rdi
callq 0xb5f0
leaq 0x9d8e(%rip), %rsi      # 0x6daa3
movl $0x2, %edx
movq %r13, %rdi
callq 0xb5f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r13, %rdi
callq 0xb5f0
movq %rax, %rdi
callq 0xb250
movq (%rbp), %rdi
addq $0x20, %rdi
callq 0xb3b0
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
movq 0x18(%rbx), %rdi
callq 0x5f894
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x63a8f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x63a8f
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x63d9c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xb9c0