// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/components/compcoup/compcoup_transport.cc
// Function: scdc_compcoup_transport::dataset_open(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>>&)
scdc_dataset *scdc_compcoup_transport::dataset_open(const string &path, scdc_result &result)
{
  SCDC_TRACE("dataset_open: path: '" << path << "'");

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

  bool ret = true;

  /* send request: DATASET_OPEN <path> */

  ret = ret && scdc_dataset_transport::write_delim(transport_connection, "DATASET_OPEN", -1, default_delim);
  ret = ret && scdc_dataset_transport::write_string(transport_connection, path);

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

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

  /* read answer: DATASET_OPEN (OK|FAILED) (STATE <state>|NOSTATE) RESULT <string> */

  string s;

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

  scdc_dataset_transport *dataset_transport = 0;

  ret = ret && scdc_dataset_transport::read_delim(transport_connection, &s, default_delim);
  if (s == "OK")
  {
    dataset_transport = new scdc_dataset_transport();

    dataset_transport->set_compcoup_transport(this);
    dataset_transport->set_transport_connection(transport_connection);

  } 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");
  }

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

  if (!dataset_transport)
  {
    result = "creating local dataset failed";
    SCDC_FAIL(__func__ << ": " << result);
  }

  transport_connection->release();

  return dataset_transport;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x4955c
testb %al, %al
je 0x4c261
movq 0x18(%rbx), %rdi
leaq 0x8cd9(%rip), %rsi      # 0x54e14
pushq $-0x1
popq %rdx
pushq $0x20
popq %rcx
callq 0x4ed78
testb %al, %al
je 0x4c2f2
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0x4ee26
testb %al, %al
je 0x4c2f2
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
movq (%rdi), %rax
callq *0xd0(%rax)
testb %al, %al
je 0x4c2f2
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x18(%rbx), %rdi
movq %rsp, %rsi
pushq $0x20
popq %rdx
xorl %ecx, %ecx
callq 0x4ee36
movl %eax, %ebp
leaq 0x8c6e(%rip), %rsi      # 0x54e14
movq %rsp, %rdi
callq 0x19be0
testb %al, %al
jne 0x4c240
leaq 0x293c3(%rip), %r15     # 0x75580
movq (%r15), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4c240
addq $0x20, %rdi
callq 0xb800
movq (%r15), %rax
movq 0x18(%rax), %rdi
leaq 0x536b(%rip), %rsi      # 0x51549
callq 0xb520
leaq 0x8c53(%rip), %rsi      # 0x54e3d
movq %rax, %rdi
callq 0xb520
leaq 0x514b(%rip), %rsi      # 0x51344
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movl $0x220, %esi            # imm = 0x220
callq 0xb990
leaq 0x8c47(%rip), %rsi      # 0x54e5c
movq %rax, %rdi
callq 0xb520
leaq 0x6c6c(%rip), %rsi      # 0x52e90
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r15), %rdi
addq $0x20, %rdi
callq 0xb3e0
testb %bpl, %bpl
je 0x4c396
movq 0x18(%rbx), %rdi
movq %rsp, %rsi
pushq $0x20
popq %rdx
xorl %ecx, %ecx
callq 0x4ee36
movl %eax, %ebp
jmp 0x4c398
leaq 0x8b7b(%rip), %rsi      # 0x54de3
movq %r14, %rdi
callq 0xba40
leaq 0x29309(%rip), %rbx     # 0x75580
movq (%rbx), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4c383
addq $0x20, %rdi
callq 0xb800
movq (%rbx), %rax
movq 0x8(%rax), %rdi
leaq 0x4eec(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x8b57(%rip), %rsi      # 0x54dff
movq %rax, %rdi
callq 0xb520
leaq 0x5232(%rip), %rsi      # 0x514e9
movq %rax, %rdi
callq 0xb520
leaq 0x87dd(%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 0x4c383
leaq 0x8b28(%rip), %rsi      # 0x54e21
movq %r14, %rdi
callq 0xba40
leaq 0x29278(%rip), %r15     # 0x75580
movq (%r15), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4c37a
addq $0x20, %rdi
callq 0xb800
movq (%r15), %rax
movq 0x8(%rax), %rdi
leaq 0x4e5f(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x8aca(%rip), %rsi      # 0x54dff
movq %rax, %rdi
callq 0xb520
leaq 0x51a5(%rip), %rsi      # 0x514e9
movq %rax, %rdi
callq 0xb520
leaq 0x8750(%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 %r15d, %r15d
movq %r15, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
leaq 0x4195(%rip), %rsi      # 0x50534
movq %rsp, %rdi
callq 0x19be0
testb %al, %al
je 0x4c3cf
pushq $0x68
popq %rdi
callq 0xb540
movq %rax, %r15
movq %rax, %rdi
callq 0x4ef46
movq %rbx, 0x58(%r15)
movq 0x18(%rbx), %rax
movq %rax, 0x60(%r15)
jmp 0x4c473
leaq 0x8a9d(%rip), %rsi      # 0x54e73
movq %rsp, %rdi
callq 0x19be0
testb %al, %al
jne 0x4c470
leaq 0x29193(%rip), %r15     # 0x75580
movq (%r15), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4c470
addq $0x20, %rdi
callq 0xb800
movq (%r15), %rax
movq 0x18(%rax), %rdi
leaq 0x513b(%rip), %rsi      # 0x51549
callq 0xb520
leaq 0x8a23(%rip), %rsi      # 0x54e3d
movq %rax, %rdi
callq 0xb520
leaq 0x4f1b(%rip), %rsi      # 0x51344
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movl $0x22e, %esi            # imm = 0x22E
callq 0xb990
leaq 0x8a35(%rip), %rsi      # 0x54e7a
movq %rax, %rdi
callq 0xb520
leaq 0x6a3c(%rip), %rsi      # 0x52e90
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r15), %rdi
addq $0x20, %rdi
callq 0xb3e0
xorl %r15d, %r15d
testb %bpl, %bpl
je 0x4c48d
movq 0x18(%rbx), %rdi
movq %rsp, %rsi
pushq $0x20
popq %rdx
xorl %ecx, %ecx
callq 0x4ee36
movl %eax, %ebp
jmp 0x4c48f
xorl %ebp, %ebp
leaq 0x89f7(%rip), %rsi      # 0x54e8d
movq %rsp, %rdi
callq 0x19be0
testb %al, %al
je 0x4c4ba
testb %bpl, %bpl
je 0x4c578
movq %r15, %rdi
callq 0x4ef82
movl %eax, %ebp
jmp 0x4c55e
leaq 0x89ca(%rip), %rsi      # 0x54e8b
movq %rsp, %rdi
callq 0x19be0
testb %al, %al
jne 0x4c55e
leaq 0x290a8(%rip), %r12     # 0x75580
movq (%r12), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4c55e
addq $0x20, %rdi
callq 0xb800
movq (%r12), %rax
movq 0x18(%rax), %rdi
leaq 0x504e(%rip), %rsi      # 0x51549
callq 0xb520
leaq 0x8936(%rip), %rsi      # 0x54e3d
movq %rax, %rdi
callq 0xb520
leaq 0x4e2e(%rip), %rsi      # 0x51344
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movl $0x238, %esi            # imm = 0x238
callq 0xb990
leaq 0x8961(%rip), %rsi      # 0x54e93
movq %rax, %rdi
callq 0xb520
leaq 0x694f(%rip), %rsi      # 0x52e90
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r12), %rdi
addq $0x20, %rdi
callq 0xb3e0
testb %bpl, %bpl
je 0x4c578
movq 0x18(%rbx), %rdi
movq %rsp, %rsi
pushq $0x20
popq %rdx
xorl %ecx, %ecx
callq 0x4ee36
movl %eax, %ebp
jmp 0x4c57a
xorl %ebp, %ebp
leaq 0x8924(%rip), %rsi      # 0x54ea5
movq %rsp, %rdi
callq 0x19be0
testb %al, %al
jne 0x4c61e
leaq 0x28fe8(%rip), %r12     # 0x75580
movq (%r12), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4c61e
addq $0x20, %rdi
callq 0xb800
movq (%r12), %rax
movq 0x18(%rax), %rdi
leaq 0x4f8e(%rip), %rsi      # 0x51549
callq 0xb520
leaq 0x8876(%rip), %rsi      # 0x54e3d
movq %rax, %rdi
callq 0xb520
leaq 0x4d6e(%rip), %rsi      # 0x51344
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movl $0x23c, %esi            # imm = 0x23C
callq 0xb990
leaq 0x88ba(%rip), %rsi      # 0x54eac
movq %rax, %rdi
callq 0xb520
leaq 0x688f(%rip), %rsi      # 0x52e90
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r12), %rdi
addq $0x20, %rdi
callq 0xb3e0
testb %bpl, %bpl
je 0x4c6dd
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0x4f064
testb %al, %al
je 0x4c6dd
testq %r15, %r15
jne 0x4c6cf
leaq 0x888d(%rip), %rsi      # 0x54ed8
movq %r14, %rdi
callq 0xba40
leaq 0x28f26(%rip), %r12     # 0x75580
movq (%r12), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4c6cf
addq $0x20, %rdi
callq 0xb800
movq (%r12), %rax
movq 0x8(%rax), %rdi
leaq 0x4b0b(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x8776(%rip), %rsi      # 0x54dff
movq %rax, %rdi
callq 0xb520
leaq 0x4e51(%rip), %rsi      # 0x514e9
movq %rax, %rdi
callq 0xb520
leaq 0x83fc(%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
movq 0x18(%rbx), %rdi
callq 0x49568
jmp 0x4c782
leaq 0x87d9(%rip), %rsi      # 0x54ebd
movq %r14, %rdi
callq 0xba40
leaq 0x28e8d(%rip), %r12     # 0x75580
movq (%r12), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4c768
addq $0x20, %rdi
callq 0xb800
movq (%r12), %rax
movq 0x8(%rax), %rdi
leaq 0x4a72(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x86dd(%rip), %rsi      # 0x54dff
movq %rax, %rdi
callq 0xb520
leaq 0x4db8(%rip), %rsi      # 0x514e9
movq %rax, %rdi
callq 0xb520
leaq 0x8363(%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 0x4c776
movq (%r15), %rax
movq %r15, %rdi
callq *0x8(%rax)
movq 0x18(%rbx), %rdi
callq 0x49568
xorl %r15d, %r15d
movq %rsp, %rdi
callq 0xb230
jmp 0x4c386
movq %rax, %rbx
pushq $0x68
popq %rsi
movq %r15, %rdi
callq 0xb550
jmp 0x4c7a4
jmp 0x4c7a1
movq %rax, %rbx
movq %rsp, %rdi
callq 0xb230
movq %rbx, %rdi
callq 0xb9a0