// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpq $0x0, 0x8(%rdi)
jne 0x64cd0
leaq 0x27968(%rip), %r12     # 0x8c570
movq (%r12), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x64cd0
addq $0x20, %rdi
callq 0xb7d0
movq (%r12), %rax
movq 0x18(%rax), %r15
leaq 0x593a(%rip), %rsi      # 0x6a569
movl $0xd, %edx
movq %r15, %rdi
callq 0xb5f0
leaq 0x926a(%rip), %rsi      # 0x6dead
movl $0x1e, %edx
movq %r15, %rdi
callq 0xb5f0
leaq 0x570d(%rip), %rsi      # 0x6a364
movl $0x1, %edx
movq %r15, %rdi
callq 0xb5f0
movq %r15, %rdi
movl $0x4c0, %esi            # imm = 0x4C0
callq 0xb9a0
movq %rax, %r15
leaq 0x97a6(%rip), %rsi      # 0x6e421
movl $0xc, %edx
movq %rax, %rdi
callq 0xb5f0
leaq 0x7271(%rip), %rsi      # 0x6bf00
movl $0x8, %edx
movq %r15, %rdi
callq 0xb5f0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0xb4d0
movsbl %al, %esi
movq %r15, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb340
movq (%r12), %rdi
addq $0x20, %rdi
callq 0xb3b0
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x667ca
leaq 0x9188(%rip), %rsi      # 0x6de84
movq %rbx, %rdi
movq $-0x1, %rdx
movl $0x20, %ecx
callq 0x6638a
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
movq 0x8(%r14), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x1e2ce
movq %rax, %r15
testq %rax, %rax
je 0x64da1
leaq 0x480c(%rip), %rsi      # 0x69554
movq %rbx, %rdi
movq $-0x1, %rdx
movl $0x20, %ecx
callq 0x6638a
leaq 0x919a(%rip), %rsi      # 0x6defd
movq %rbx, %rdi
movq $-0x1, %rdx
movl $0x20, %ecx
callq 0x6638a
movq %rbx, %rdi
callq 0x66bfe
movq 0x8(%r14), %rdi
leaq 0x70(%rbx), %rdx
leaq 0x8(%rsp), %rcx
movq %r15, %rsi
callq 0x1e84a
movq %rbx, %rdi
callq 0x66c76
jmp 0x64e6e
leaq 0x277c8(%rip), %rbp     # 0x8c570
movq (%rbp), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x64e38
addq $0x20, %rdi
callq 0xb7d0
movq (%rbp), %rax
movq 0x8(%rax), %r15
leaq 0x53d9(%rip), %rsi      # 0x6a1a8
movl $0xb, %edx
movq %r15, %rdi
callq 0xb5f0
leaq 0x908c(%rip), %rsi      # 0x6de6f
movl $0x14, %edx
movq %r15, %rdi
callq 0xb5f0
leaq 0x9637(%rip), %rsi      # 0x6e42e
movl $0x17, %edx
movq %r15, %rdi
callq 0xb5f0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0xb4d0
movsbl %al, %esi
movq %r15, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb340
movq (%rbp), %rdi
addq $0x20, %rdi
callq 0xb3b0
leaq 0x90a4(%rip), %rsi      # 0x6dee3
movq %rbx, %rdi
movq $-0x1, %rdx
movl $0x20, %ecx
callq 0x6638a
leaq 0x90a1(%rip), %rsi      # 0x6defb
movq %rbx, %rdi
movq $-0x1, %rdx
movl $0x20, %ecx
callq 0x6638a
leaq 0x90a0(%rip), %rsi      # 0x6df15
movq %rbx, %rdi
movq $-0x1, %rdx
movl $0x20, %ecx
callq 0x6638a
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x66d5a
movq 0x10(%r14), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0xd0(%rax)
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x64ec2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x64ed9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x64f07
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x64f07
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x64f1e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xb9c0