// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/components/compcoup/compcoup_transport.cc
// Function: scdc_compcoup_transport::dataset_output_incoming_recv(scdc_transport_connection_t*, _scdc_dataset_inout_t*, bool*)
bool scdc_compcoup_transport::dataset_output_incoming_recv(scdc_transport_connection_t *conn, scdc_dataset_output_t *output, bool *next)
{
  SCDC_TRACE("dataset_output_incoming_recv:");

  SCDC_ASSERT(conn->current_incoming_output_size >= 0);

  /* empty output */
  SCDC_DATASET_INOUT_BUF_CURRENT(output) = 0;

  bool cont_recv = true;

  do
  {
    if (conn->current_incoming_output_size <= 0)
    {
      if (!scdc_dataset_transport::read_output_info(conn, &conn->current_incoming_output, conn->current_incoming_output_next))
      {
        SCDC_FAIL("dataset_output_incoming_recv: read output info failed");
        return false;
      }

      conn->current_incoming_output_size = SCDC_DATASET_INOUT_BUF_CURRENT(&conn->current_incoming_output);

      SCDC_TRACE("dataset_output_incoming_recv: current_incoming_output_next/size: " << conn->current_incoming_output_next << " / " << conn->current_incoming_output_size);
    }

    strncpy(output->format, conn->current_incoming_output.format, SCDC_FORMAT_MAX_SIZE);
    output->total_size = conn->current_incoming_output.total_size;
    output->total_size_given = conn->current_incoming_output.total_size_given;

    scdcint_t prev_current = SCDC_DATASET_INOUT_BUF_CURRENT(output);

    if (!conn->transport->recv_incoming_dataset_output(conn, output, conn->current_incoming_output_size, cont_recv))
    {
      SCDC_FAIL("dataset_output_incoming_recv: receive dataset output failed");
      return false;
    }

    conn->current_incoming_output_size -= SCDC_DATASET_INOUT_BUF_CURRENT(output) - prev_current;

    *next = (conn->current_incoming_output_next || conn->current_incoming_output_size > 0);

    SCDC_TRACE("dataset_output_incoming_recv: cont: '" << cont_recv << "', next: '" << *next << "', buf: " << SCDC_DATASET_INOUT_BUF_CURRENT(output) << " of " << SCDC_DATASET_INOUT_BUF_SIZE(output));
 
  } while (cont_recv && *next && SCDC_DATASET_INOUT_BUF_CURRENT(output) < SCDC_DATASET_INOUT_BUF_SIZE(output));

  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x2c8(%rdi), %rbp
testq %rbp, %rbp
jns 0x4e8e7
leaq 0x26d2a(%rip), %r12     # 0x75580
movq (%r12), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x4e8e7
addq $0x20, %rdi
callq 0xb800
movq (%r12), %rax
movq 0x18(%rax), %rdi
leaq 0x2ccc(%rip), %rsi      # 0x51549
callq 0xb520
leaq 0x65b4(%rip), %rsi      # 0x54e3d
movq %rax, %rdi
callq 0xb520
leaq 0x2aac(%rip), %rsi      # 0x51344
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movl $0x3f0, %esi            # imm = 0x3F0
callq 0xb990
leaq 0x68b3(%rip), %rsi      # 0x55167
movq %rax, %rdi
callq 0xb520
leaq 0x45cd(%rip), %rsi      # 0x52e90
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r12), %rdi
addq $0x20, %rdi
callq 0xb3e0
movq 0x2c8(%r15), %rbp
andq $0x0, 0x20(%r14)
leaq 0xf(%rsp), %r12
movb $0x1, (%r12)
leaq 0x268(%r15), %r13
leaq 0x2d1(%r15), %rax
movq %rax, 0x10(%rsp)
xorl %ecx, %ecx
testq %rbp, %rbp
movq %rcx, %rbp
jg 0x4e93d
movq %r15, %rdi
movq %r13, %rsi
movq 0x10(%rsp), %rdx
callq 0x4f8ac
testb %al, %al
je 0x4e9e3
movq 0x288(%r15), %rax
movq %rax, 0x2c8(%r15)
movq 0x20(%r14), %rbp
movq %r14, %rdi
movq %r13, %rsi
pushq $0x10
popq %rdx
callq 0xb2c0
movq 0x290(%r15), %rax
movq %rax, 0x28(%r14)
movb 0x298(%r15), %al
movb %al, 0x30(%r14)
movq (%r15), %rdi
movq 0x2c8(%r15), %rcx
movq (%rdi), %rax
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %r8
callq *0xb0(%rax)
testb %al, %al
je 0x4e9c9
movq 0x20(%r14), %rcx
subq %rcx, %rbp
addq 0x2c8(%r15), %rbp
movq %rbp, 0x2c8(%r15)
testq %rbp, %rbp
setg %dl
orb 0x2d1(%r15), %dl
movb %dl, (%rbx)
movb $0x1, %al
cmpb $0x1, 0xf(%rsp)
jne 0x4ea4e
testb %dl, %dl
je 0x4ea4e
cmpq 0x18(%r14), %rcx
jl 0x4e90b
jmp 0x4ea4e
leaq 0x26bb0(%rip), %rax     # 0x75580
movq (%rax), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4ea4c
leaq 0x67e7(%rip), %rbx      # 0x551c8
jmp 0x4e9fb
leaq 0x26b96(%rip), %rax     # 0x75580
movq (%rax), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x4ea4c
leaq 0x6797(%rip), %rbx      # 0x55192
addq $0x20, %rdi
callq 0xb800
leaq 0x26b75(%rip), %r14     # 0x75580
movq (%r14), %rax
movq 0x8(%rax), %rdi
leaq 0x276f(%rip), %rsi      # 0x51188
callq 0xb520
leaq 0x63da(%rip), %rsi      # 0x54dff
movq %rax, %rdi
callq 0xb520
movq %rax, %rdi
movq %rbx, %rsi
callq 0xb520
movq %rax, %rdi
callq 0xb270
movq (%r14), %rdi
addq $0x20, %rdi
callq 0xb3e0
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop