// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/analyzer/../common/parse.c
// Function: parseFastFormat
bool parseFastFormat(StringBuffer *in, RawMessage *msg)
{
  unsigned int prio;
  unsigned int pgn;
  unsigned int src;
  unsigned int dst;
  unsigned int bytes;

  char        *p;
  int          i;
  int          b;
  unsigned int byt;
  int          r;

  p = strchr(sbGet(in), '\n');
  if (!p)
  {
    return false;
  }

  // Skip the timestamp
  p = strchr(sbGet(in), ',');
  if (!p)
  {
    return false;
  }

  r = sscanf(p, ",%u,%u,%u,%u,%u,%n", &prio, &pgn, &src, &dst, &bytes, &i);
  if (r == 5)
  {
    // now store the timestamp, unchanged
    memset(msg->timestamp, 0, sizeof msg->timestamp);
    memcpy(msg->timestamp, sbGet(in), CB_MAX(p - sbGet(in), sizeof msg->timestamp - 1));

    msg->prio = prio;
    msg->pgn  = pgn;
    msg->src  = src;
    msg->dst  = dst;
    msg->len  = bytes;

    p += i - 1;

    for (b = 0; b < CB_MIN(bytes, FASTPACKET_MAX_SIZE); b++)
    {
      if ((sscanf(p, ",%x%n", &byt, &i) == 1) && (byt < 256))
      {
        msg->data[b] = byt;
      }
      else
      {
        logError("Unable to parse incoming message '%s' data byte %u\n", sbGet(in), b);
        return false;
      }
      p += i;
    }
    return true;
  }
  logError("Unable to parse incoming message '%s', r = %d\n", sbGet(in), r);
  return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %r13
movq (%rdi), %r14
testq %r14, %r14
leaq 0x494a(%rip), %rbx      # 0x2339e
cmoveq %rbx, %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0xd100
testq %rax, %rax
je 0x1eba0
movq %r14, %rdi
movl $0x2c, %esi
callq 0xd100
testq %rax, %rax
je 0x1eba0
movq %rax, %r12
leaq 0x4(%rsp), %r10
leaq 0x8(%rsp), %r11
leaq 0x14174(%rip), %rsi     # 0x32c0c
leaq 0x1c(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x14(%rsp), %r8
leaq 0x10(%rsp), %r9
movq %rax, %rdi
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0xd220
addq $0x10, %rsp
cmpl $0x5, %eax
jne 0x1eba4
xorps %xmm0, %xmm0
movups %xmm0, 0x2c(%r15)
movups %xmm0, 0x20(%r15)
movups %xmm0, 0x10(%r15)
movups %xmm0, (%r15)
movq (%r13), %rsi
testq %rsi, %rsi
cmoveq %rbx, %rsi
movq %r12, %rax
subq %rsi, %rax
cmpq $0x3c, %rax
movl $0x3b, %edx
cmovaeq %rax, %rdx
movq %r15, %rdi
callq 0xd1e0
movb 0x1c(%rsp), %al
movb %al, 0x3c(%r15)
movl 0x18(%rsp), %eax
movl %eax, 0x40(%r15)
movb 0x14(%rsp), %al
movb %al, 0x45(%r15)
movb 0x10(%rsp), %al
movb %al, 0x44(%r15)
movl 0x8(%rsp), %eax
movb %al, 0x46(%r15)
movb $0x1, %bpl
testl %eax, %eax
je 0x1ebe4
movq %r13, 0x20(%rsp)
leaq 0x4(%rsp), %rax
movslq (%rax), %rax
leaq (%r12,%rax), %r14
decq %r14
movl $0xdf, %r13d
xorl %r12d, %r12d
movq %r14, %rdi
leaq 0x140c2(%rip), %rsi     # 0x32c1f
leaq 0xc(%rsp), %rdx
leaq 0x4(%rsp), %rcx
xorl %eax, %eax
callq 0xd220
cmpl $0x1, %eax
jne 0x1ebbf
movl 0xc(%rsp), %eax
cmpl $0xff, %eax
ja 0x1ebbf
movb %al, 0x47(%r15,%r12)
movslq 0x4(%rsp), %rax
addq %rax, %r14
incq %r12
movl 0x8(%rsp), %eax
cmpl %r13d, %eax
cmovael %r13d, %eax
cmpq %rax, %r12
jb 0x1eb53
jmp 0x1ebe4
xorl %ebp, %ebp
jmp 0x1ebe4
movq (%r13), %rcx
testq %rcx, %rcx
cmovneq %rcx, %rbx
leaq 0x140a3(%rip), %rdi     # 0x32c59
xorl %ebp, %ebp
movq %rbx, %rsi
movl %eax, %edx
jmp 0x1ebdd
movq 0x20(%rsp), %rax
movq (%rax), %rax
testq %rax, %rax
cmovneq %rax, %rbx
leaq 0x14050(%rip), %rdi     # 0x32c25
xorl %ebp, %ebp
movq %rbx, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x1cde8
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq