// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/components/compcoup/compcoup_transport.cc
// Function: scdc_compcoup_transport::on_dataset_open(scdc_transport_connection_t*)
void scdc_compcoup_transport::on_dataset_open(scdc_transport_connection_t *conn)
{
  SCDC_TRACE("on_dataset_open:");

  SCDC_ASSERT(dataprovs);

  /* read request: DATASET_OPEN <path> */

  string path;
  scdc_dataset_transport::read_string(conn, &path);
  SCDC_TRACE("on_dataset_open: path: '" << path << "'");

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

  scdc_dataset_transport::write_delim(conn, "DATASET_OPEN", -1, default_delim);

  scdc_result result;

  scdc_dataset *dataset = dataprovs->dataset_open(path, result);

  if (dataset)
  {
    scdc_dataset_transport::write_delim(conn, "OK", -1, default_delim);

    scdc_dataset_transport::write_delim(conn, "STATE", -1, default_delim);
    scdc_dataset_transport::write_state_begin(conn);
    dataprovs->dataset_close_write_state(dataset, conn->get_outgoing(), result);
    scdc_dataset_transport::write_state_end(conn);

  } else
  {
    SCDC_FAIL("on_dataset_open: failed");
    scdc_dataset_transport::write_delim(conn, "FAILED", -1, default_delim);

    scdc_dataset_transport::write_delim(conn, "NOSTATE", -1, default_delim);
  }

  scdc_dataset_transport::write_delim(conn, "RESULT", -1, default_delim);
  scdc_dataset_transport::write_string(conn, result.c_str(), result.size());

  transport->send_outgoing(conn);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpq $0x0, 0x8(%rdi)
jne 0x4dc6c
leaq 0x27997(%rip), %r15     # 0x75580
movq (%r15), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4dc6c
addq $0x20, %rdi
callq 0xb800
movq (%r15), %rax
movq 0x18(%rax), %rdi
leaq 0x393f(%rip), %rsi      # 0x51549
callq 0xb520
leaq 0x7227(%rip), %rsi      # 0x54e3d
movq %rax, %rdi
callq 0xb520
leaq 0x371f(%rip), %rsi      # 0x51344
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movl $0x4c0, %esi            # imm = 0x4C0
callq 0xb990
leaq 0x7770(%rip), %rsi      # 0x553b1
movq %rax, %rdi
callq 0xb520
leaq 0x5240(%rip), %rsi      # 0x52e90
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r15), %rdi
addq $0x20, %rdi
callq 0xb3e0
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x4f064
leaq 0x7183(%rip), %rsi      # 0x54e14
pushq $-0x1
popq %rdx
pushq $0x20
popq %rcx
movq %rbx, %rdi
callq 0x4ed78
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x8(%r14), %rdi
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
callq 0x1c23e
movq %rax, %r15
testq %rax, %rax
je 0x4dd1b
leaq 0x2864(%rip), %rsi      # 0x50534
pushq $-0x1
popq %rdx
pushq $0x20
popq %rcx
movq %rbx, %rdi
callq 0x4ed78
leaq 0x71a8(%rip), %rsi      # 0x54e8d
pushq $-0x1
popq %rdx
pushq $0x20
popq %rcx
movq %rbx, %rdi
callq 0x4ed78
movq %rbx, %rdi
callq 0x4f290
movq 0x8(%r14), %rdi
leaq 0x70(%rbx), %rdx
movq %rsp, %rcx
movq %r15, %rsi
callq 0x1c5f2
movq %rbx, %rdi
callq 0x4f2a0
jmp 0x4dda4
leaq 0x2785e(%rip), %r15     # 0x75580
movq (%r15), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4dd7a
addq $0x20, %rdi
callq 0xb800
movq (%r15), %rax
movq 0x8(%rax), %rdi
leaq 0x3445(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x70b0(%rip), %rsi      # 0x54dff
movq %rax, %rdi
callq 0xb520
leaq 0x7660(%rip), %rsi      # 0x553be
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r15), %rdi
addq $0x20, %rdi
callq 0xb3e0
leaq 0x70f2(%rip), %rsi      # 0x54e73
pushq $-0x1
popq %rdx
pushq $0x20
popq %rcx
movq %rbx, %rdi
callq 0x4ed78
leaq 0x70f5(%rip), %rsi      # 0x54e8b
pushq $-0x1
popq %rdx
pushq $0x20
popq %rcx
movq %rbx, %rdi
callq 0x4ed78
leaq 0x70fa(%rip), %rsi      # 0x54ea5
pushq $-0x1
popq %rdx
pushq $0x20
popq %rcx
movq %rbx, %rdi
callq 0x4ed78
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x4f2ce
movq 0x10(%r14), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0xd0(%rax)
movq %rsp, %rdi
callq 0xb230
leaq 0x20(%rsp), %rdi
callq 0xb230
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
jmp 0x4de06
movq %rax, %rbx
movq %rsp, %rdi
callq 0xb230
leaq 0x20(%rsp), %rdi
callq 0xb230
movq %rbx, %rdi
callq 0xb9a0