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

  /* read request: DATASET_CLOSE <state> */

  scdc_result result;

  scdc_dataset_transport::read_state_begin(conn);
  scdc_dataset *dataset = dataprovs->dataset_open_read_state(conn->get_incoming(), result);
  scdc_dataset_transport::read_state_end(conn);

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

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

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

  } else
  {
    SCDC_FAIL("on_dataset_close: failed");
    scdc_dataset_transport::write_delim(conn, "FAILED", -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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0xa10ad
leaq -0x30(%rbp), %rdi
callq 0xc960
movq -0x10(%rbp), %rdi
callq 0xa38d0
jmp 0xa10c1
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa3650
movq %rax, -0x58(%rbp)
jmp 0xa10dc
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x2de30
movq %rax, -0x68(%rbp)
jmp 0xa10f3
movq -0x68(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa39c0
jmp 0xa1106
movq -0x10(%rbp), %rdi
leaq 0x8e2d(%rip), %rsi      # 0xa9f3e
movq $-0x1, %rdx
movl $0x20, %ecx
callq 0xa2c90
jmp 0xa1124
cmpq $0x0, -0x48(%rbp)
je 0xa117f
movq -0x10(%rbp), %rdi
leaq 0x4406(%rip), %rsi      # 0xa553c
movq $-0x1, %rdx
movl $0x20, %ecx
callq 0xa2c90
jmp 0xa1149
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x48(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x2dde0
jmp 0xa1160
jmp 0xa1261
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xc3e0
jmp 0xa12f1
jmp 0xa1181
leaq 0x33520(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x257e0
movq %rax, -0x70(%rbp)
jmp 0xa1196
movq -0x70(%rbp), %rax
cmpq $0x0, %rax
je 0xa123d
leaq 0x334fd(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x25800
jmp 0xa11b5
leaq 0x334ec(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x257e0
movq %rax, -0x78(%rbp)
jmp 0xa11ca
movq -0x78(%rbp), %rdi
leaq 0x4fdb(%rip), %rsi      # 0xa61b0
callq 0xc670
movq %rax, -0x80(%rbp)
jmp 0xa11e0
movq -0x80(%rbp), %rdi
leaq 0x8c5c(%rip), %rsi      # 0xa9e47
callq 0xc670
movq %rax, -0x88(%rbp)
jmp 0xa11f9
movq -0x88(%rbp), %rdi
leaq 0x9217(%rip), %rsi      # 0xaa41e
callq 0xc670
movq %rax, -0x90(%rbp)
jmp 0xa1215
movq -0x90(%rbp), %rdi
movq 0x32d9d(%rip), %rsi     # 0xd3fc0
callq 0xc6d0
jmp 0xa122a
leaq 0x33477(%rip), %rax     # 0xd46a8
movq (%rax), %rdi
callq 0x25820
jmp 0xa123b
jmp 0xa123d
jmp 0xa123f
jmp 0xa1241
movq -0x10(%rbp), %rdi
leaq 0x8c6f(%rip), %rsi      # 0xa9ebb
movq $-0x1, %rdx
movl $0x20, %ecx
callq 0xa2c90
jmp 0xa125f
jmp 0xa1261
movq -0x10(%rbp), %rdi
leaq 0x8c81(%rip), %rsi      # 0xa9eed
movq $-0x1, %rdx
movl $0x20, %ecx
callq 0xa2c90
jmp 0xa127f
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0xc260
movq -0xa8(%rbp), %rdi
movq %rax, -0x98(%rbp)
callq 0xc460
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq %rax, %rdx
callq 0xa37d0
jmp 0xa12c5
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rsi
movq (%rdi), %rax
movq 0xd0(%rax), %rax
callq *%rax
jmp 0xa12df
leaq -0x30(%rbp), %rdi
callq 0xc3e0
addq $0xb0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0xcba0
nopw (%rax,%rax)