// File: /workspace/github_cpp_makefile_star2_O1/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 0x64ff7
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 0x669b2
movl %eax, %ebp
testb %al, %al
je 0x64fd7
leaq 0x58(%rsp), %r12
movq %r12, %rdi
leaq 0x38(%rsp), %rsi
movq %r15, %rdx
callq 0x466ef
movq %r15, %rdi
movq %r12, %rsi
callq 0xb670
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x64e1a
movq 0x68(%rsp), %rsi
incq %rsi
callq 0xb510
movq $0x0, 0x40(%rsp)
movq 0x38(%rsp), %rax
movb $0x0, (%rax)
movq %r15, %rdi
leaq 0x8fdf(%rip), %rsi      # 0x6de14
callq 0xb110
testl %eax, %eax
jne 0x64e57
cmpb $0x1, 0xf(%rsp)
jne 0x64e57
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x65062
jmp 0x64fd7
movq %r15, %rdi
leaq 0x9095(%rip), %rsi      # 0x6def6
callq 0xb110
testl %eax, %eax
jne 0x64e83
cmpb $0x1, 0xf(%rsp)
jne 0x64e83
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x653b2
jmp 0x64fd7
movq %r15, %rdi
leaq 0x90c8(%rip), %rsi      # 0x6df55
callq 0xb110
testl %eax, %eax
jne 0x64eaf
cmpb $0x1, 0xf(%rsp)
jne 0x64eaf
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x65584
jmp 0x64fd7
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x64ef1
movq 0x18(%rsp), %rsi
cmpb $0x0, (%rsi)
je 0x64fd7
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 0x64fd7
cmpb $0x1, 0xf(%rsp)
jne 0x64fca
leaq 0x2766d(%rip), %rax     # 0x8c570
movq (%rax), %rdi
cmpq $0x0, 0x18(%rdi)
je 0x64fd7
addq $0x20, %rdi
callq 0xb7d0
leaq 0x2764f(%rip), %rax     # 0x8c570
movq (%rax), %rax
movq 0x18(%rax), %r12
movl $0xc, %edx
movq %r12, %rdi
leaq 0x5551(%rip), %rsi      # 0x6a488
callq 0xb5f0
movl $0x14, %edx
movq %r12, %rdi
leaq 0x8eb4(%rip), %rsi      # 0x6ddff
callq 0xb5f0
movl $0x23, %edx
movq %r12, %rdi
leaq 0x90e0(%rip), %rsi      # 0x6e03f
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 0x73d3(%rip), %rsi      # 0x6c35b
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 0x275b4(%rip), %rax     # 0x8c570
movq (%rax), %rdi
addq $0x20, %rdi
callq 0xb3b0
jmp 0x64fd7
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0xb2c0
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x64fee
movq 0x28(%rsp), %rsi
incq %rsi
callq 0xb510
testb %bpl, %bpl
jne 0x64d9d
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x65013
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 0x65024
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x6503e
movq 0x28(%rsp), %rsi
incq %rsi
callq 0xb510
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x6505a
movq 0x48(%rsp), %rsi
incq %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xb9c0