// File: /workspace/github_cpp_makefile_star2_O3/mh0fm4[P]SCDC/src/components/compcoup/compcoup_transport.cc
// Function: scdc_compcoup_transport::dataset_input_incoming_recv(scdc_transport_connection_t*, _scdc_dataset_inout_t*, bool*)
bool scdc_compcoup_transport::dataset_input_incoming_recv(scdc_transport_connection_t *conn, scdc_dataset_input_t *input, bool *next)
{
  SCDC_TRACE("dataset_input_incoming_recv:");

  SCDC_ASSERT(conn->current_incoming_input_size >= 0);

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

  bool cont_recv = true;

  do
  {
    if (conn->current_incoming_input_size <= 0)
    {
      SCDC_TRACE("dataset_input_incoming_recv: read_input_info");
      if (!scdc_dataset_transport::read_input_info(conn, &conn->current_incoming_input, conn->current_incoming_input_next))
      {
        SCDC_FAIL("dataset_input_incoming_recv: read input info failed");
        return false;
      }

      conn->current_incoming_input_size = SCDC_DATASET_INOUT_BUF_CURRENT(&conn->current_incoming_input);
    }

    strncpy(input->format, conn->current_incoming_input.format, SCDC_FORMAT_MAX_SIZE);
    input->total_size = conn->current_incoming_input.total_size;
    input->total_size_given = conn->current_incoming_input.total_size_given;

    scdcint_t prev_current = SCDC_DATASET_INOUT_BUF_CURRENT(input);

    if (!conn->transport->recv_incoming_dataset_input(conn, input, conn->current_incoming_input_size, cont_recv))
    {
      SCDC_FAIL("dataset_input_incoming_recv: receive dataset input failed");
      return false;
    }

    conn->current_incoming_input_size -= SCDC_DATASET_INOUT_BUF_CURRENT(input) - prev_current;

    *next = (conn->current_incoming_input_next || conn->current_incoming_input_size > 0);

    SCDC_TRACE("dataset_input_incoming_recv: cont: '" << cont_recv << "', next: '" << *next << "', buf: " << SCDC_DATASET_INOUT_BUF_CURRENT(input) << " of " << SCDC_DATASET_INOUT_BUF_SIZE(input));

  } while (cont_recv && *next && SCDC_DATASET_INOUT_BUF_CURRENT(input) < SCDC_DATASET_INOUT_BUF_SIZE(input));

  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 0x2c0(%rdi), %rbp
testq %rbp, %rbp
jns 0x65936
leaq 0x26d0a(%rip), %r13     # 0x8c570
movq (%r13), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x65936
addq $0x20, %rdi
callq 0xb7d0
movq (%r13), %rax
movq 0x18(%rax), %r12
leaq 0x4cdc(%rip), %rsi      # 0x6a569
movl $0xd, %edx
movq %r12, %rdi
callq 0xb5f0
leaq 0x860c(%rip), %rsi      # 0x6dead
movl $0x1e, %edx
movq %r12, %rdi
callq 0xb5f0
leaq 0x4aaf(%rip), %rsi      # 0x6a364
movl $0x1, %edx
movq %r12, %rdi
callq 0xb5f0
movq %r12, %rdi
movl $0x3a8, %esi            # imm = 0x3A8
callq 0xb9a0
movq %rax, %r12
leaq 0x87fa(%rip), %rsi      # 0x6e0d3
movl $0x29, %edx
movq %rax, %rdi
callq 0xb5f0
leaq 0x6613(%rip), %rsi      # 0x6bf00
movl $0x8, %edx
movq %r12, %rdi
callq 0xb5f0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0xb4d0
movsbl %al, %esi
movq %r12, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb340
movq (%r13), %rdi
addq $0x20, %rdi
callq 0xb3b0
movq 0x2c0(%r15), %rbp
movq $0x0, 0x20(%r14)
leaq 0xf(%rsp), %r12
movb $0x1, (%r12)
leaq 0x210(%r15), %r13
leaq 0x2d0(%r15), %rax
movq %rax, 0x10(%rsp)
xorl %ecx, %ecx
testq %rbp, %rbp
movq %rcx, %rbp
jg 0x6598f
movq %r15, %rdi
movq %r13, %rsi
movq 0x10(%rsp), %rdx
callq 0x675a6
testb %al, %al
je 0x65a78
movq 0x230(%r15), %rax
movq %rax, 0x2c0(%r15)
movq 0x20(%r14), %rbp
movl $0x10, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0xb2a0
movq 0x238(%r15), %rax
movq %rax, 0x28(%r14)
movb 0x240(%r15), %al
movb %al, 0x30(%r14)
movq (%r15), %rdi
movq 0x2c0(%r15), %rcx
movq (%rdi), %rax
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %r8
callq *0xa8(%rax)
testb %al, %al
je 0x65a1d
movq 0x20(%r14), %rcx
subq %rcx, %rbp
addq 0x2c0(%r15), %rbp
movq %rbp, 0x2c0(%r15)
testq %rbp, %rbp
setg %dl
orb 0x2d0(%r15), %dl
movb %dl, (%rbx)
movb $0x1, %al
cmpb $0x1, 0xf(%rsp)
jne 0x65b15
testb %dl, %dl
je 0x65b15
cmpq 0x18(%r14), %rcx
jl 0x6595d
jmp 0x65b15
leaq 0x26b4c(%rip), %rbx     # 0x8c570
movq (%rbx), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x65b13
addq $0x20, %rdi
callq 0xb7d0
movq (%rbx), %rax
movq 0x8(%rax), %rbx
leaq 0x475f(%rip), %rsi      # 0x6a1a8
movl $0xb, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x8412(%rip), %rsi      # 0x6de6f
movl $0x14, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x86c0(%rip), %rsi      # 0x6e131
movl $0x39, %edx
jmp 0x65ad1
leaq 0x26af1(%rip), %rbx     # 0x8c570
movq (%rbx), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x65b13
addq $0x20, %rdi
callq 0xb7d0
movq (%rbx), %rax
movq 0x8(%rax), %rbx
leaq 0x4704(%rip), %rsi      # 0x6a1a8
movl $0xb, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x83b7(%rip), %rsi      # 0x6de6f
movl $0x14, %edx
movq %rbx, %rdi
callq 0xb5f0
leaq 0x8631(%rip), %rsi      # 0x6e0fd
movl $0x33, %edx
movq %rbx, %rdi
callq 0xb5f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0xb4d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb340
leaq 0x26a69(%rip), %rax     # 0x8c570
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3b0
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq