// File: /workspace/github_cpp_makefile_star2_O3/mh0fm4[P]SCDC/src/components/compcoup/compcoup_transport.cc
// Function: scdc_compcoup_transport::serve(scdc_transport_connection_t*)
void scdc_compcoup_transport::serve(scdc_transport_connection_t *conn)
{
  handshake();

  const scdcint_t loop_max = -1;

  scdcint_t l = 0;
  string prev;

  while (conn->open && (loop_max < 0 || l < loop_max))
  {
    string head;
    bool stop_at_delim = false;

    bool ret = scdc_dataset_transport::read_delim(conn, &head, default_delim, &stop_at_delim);

    if (!ret)
    {
      SCDC_TRACE("serve_connection: read failed!");
      break;
    }

    head = prev + head;

    SCDC_TRACE("serve_connection: head: '" << head << "', stop_at_delim: '" << stop_at_delim << "'");

    prev.erase();

    if (head == "DATASET_OPEN" && stop_at_delim) on_dataset_open(conn);
    else if (head == "DATASET_CLOSE" && stop_at_delim) on_dataset_close(conn);
    else if (head == "DATASET_CMD" && stop_at_delim) on_dataset_cmd(conn);
    else if (on_cmd_handler(head.c_str(), conn->get_incoming()))
    {
      SCDC_TRACE("serve_connection: cmd_handler sccessfull");

    } else if (stop_at_delim)
    {
      SCDC_ERROR("serve_connection: unknown command '" << head << "'");

    } else prev = head;

    ++l;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq (%rdi), %rax
movq %rdi, 0x10(%rsp)
callq *0x40(%rax)
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x28(%rsp), %r13
xorl %r14d, %r14d
leaq 0x18(%rsp), %r15
cmpb $0x1, 0x8(%rbx)
jne 0x64b77
movq %r13, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movb %r14b, 0x28(%rsp)
movb %r14b, 0xf(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movl $0x20, %edx
leaq 0xf(%rsp), %rcx
callq 0x66504
movl %eax, %ebp
testb %al, %al
je 0x64b57
leaq 0x58(%rsp), %r12
movq %r12, %rdi
leaq 0x38(%rsp), %rsi
movq %r15, %rdx
callq 0x4619f
movq %r15, %rdi
movq %r12, %rsi
callq 0xb670
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x6499a
movq 0x68(%rsp), %rsi
incq %rsi
callq 0xb510
movq $0x0, 0x40(%rsp)
movq 0x38(%rsp), %rax
movb $0x0, (%rax)
movq %r15, %rdi
leaq 0x94cf(%rip), %rsi      # 0x6de84
callq 0xb110
testl %eax, %eax
jne 0x649d7
cmpb $0x1, 0xf(%rsp)
jne 0x649d7
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x64be2
jmp 0x64b57
movq %r15, %rdi
leaq 0x9585(%rip), %rsi      # 0x6df66
callq 0xb110
testl %eax, %eax
jne 0x64a03
cmpb $0x1, 0xf(%rsp)
jne 0x64a03
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x64f26
jmp 0x64b57
movq %r15, %rdi
leaq 0x95b8(%rip), %rsi      # 0x6dfc5
callq 0xb110
testl %eax, %eax
jne 0x64a2f
cmpb $0x1, 0xf(%rsp)
jne 0x64a2f
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x650f8
jmp 0x64b57
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x64a71
movq 0x18(%rsp), %rsi
cmpb $0x0, (%rsi)
je 0x64b57
movq 0x10(%rsp), %rcx
movq 0x28(%rcx), %rdi
movq 0x50(%rbx), %rcx
movq 0x58(%rbx), %r8
movq 0x38(%rbx), %rdx
addq %r8, %rdx
subq %r8, %rcx
callq *%rax
testq %rax, %rax
jns 0x64b57
cmpb $0x1, 0xf(%rsp)
jne 0x64b4a
leaq 0x27aed(%rip), %rax     # 0x8c570
movq (%rax), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x64b57
addq $0x20, %rdi
callq 0xb7d0
leaq 0x27acf(%rip), %rax     # 0x8c570
movq (%rax), %rax
movq 0x18(%rax), %r12
movl $0xc, %edx
movq %r12, %rdi
leaq 0x59f1(%rip), %rsi      # 0x6a4a8
callq 0xb5f0
movl $0x14, %edx
movq %r12, %rdi
leaq 0x93a4(%rip), %rsi      # 0x6de6f
callq 0xb5f0
movl $0x23, %edx
movq %r12, %rdi
leaq 0x95d0(%rip), %rsi      # 0x6e0af
callq 0xb5f0
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %r12, %rdi
callq 0xb5f0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x78cb(%rip), %rsi      # 0x6c3d3
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
leaq 0x27a34(%rip), %rax     # 0x8c570
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3b0
jmp 0x64b57
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0xb2c0
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x64b6e
movq 0x28(%rsp), %rsi
incq %rsi
callq 0xb510
testb %bpl, %bpl
jne 0x6491d
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x64b93
movq 0x48(%rsp), %rsi
incq %rsi
callq 0xb510
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x64ba4
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x64bbe
movq 0x28(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x64bda
movq 0x48(%rsp), %rsi
incq %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xb9c0