// File: /workspace/github_c_makefile_star2_O2/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), %rbx
testq %rbx, %rbx
leaq 0x4af7(%rip), %r14      # 0x2239e
cmoveq %r14, %rbx
pushq $0xa
popq %rsi
movq %rbx, %rdi
callq 0xd100
testq %rax, %rax
je 0x1d9e6
pushq $0x2c
popq %rsi
movq %rbx, %rdi
callq 0xd100
testq %rax, %rax
je 0x1d9e6
movq %rax, %r12
leaq 0x4(%rsp), %r10
leaq 0x8(%rsp), %r11
leaq 0x14325(%rip), %rsi     # 0x31c0c
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 0x1d9ea
xorps %xmm0, %xmm0
movups %xmm0, 0x2c(%r15)
movups %xmm0, 0x20(%r15)
movups %xmm0, 0x10(%r15)
movups %xmm0, (%r15)
movq %r13, 0x20(%rsp)
movq (%r13), %rsi
testq %rsi, %rsi
cmoveq %r14, %rsi
movq %r12, %rax
subq %rsi, %rax
cmpq $0x3c, %rax
pushq $0x3b
popq %rdx
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)
leaq 0x4(%rsp), %rcx
movslq (%rcx), %rcx
leaq -0x1(%r12,%rcx), %rbp
movl $0xdf, %r13d
leaq 0x14288(%rip), %r14     # 0x31c1f
leaq 0xc(%rsp), %rbx
xorl %r12d, %r12d
cmpl %r13d, %eax
cmovael %r13d, %eax
cmpq %rax, %r12
jae 0x1da05
movq %rbp, %rdi
movq %r14, %rsi
movq %rbx, %rdx
leaq 0x4(%rsp), %rcx
xorl %eax, %eax
callq 0xd220
cmpl $0x1, %eax
jne 0x1da09
movl 0xc(%rsp), %eax
cmpl $0xff, %eax
ja 0x1da09
movb %al, 0x47(%r15,%r12)
movslq 0x4(%rsp), %rax
addq %rax, %rbp
incq %r12
movl 0x8(%rsp), %eax
jmp 0x1d99f
xorl %ebx, %ebx
jmp 0x1da32
movq (%r13), %rcx
testq %rcx, %rcx
cmovneq %rcx, %r14
leaq 0x1425d(%rip), %rdi     # 0x31c59
xorl %ebx, %ebx
movq %r14, %rsi
movl %eax, %edx
jmp 0x1da2b
movb $0x1, %bl
jmp 0x1da32
movq 0x20(%rsp), %rax
movq (%rax), %rax
testq %rax, %rax
leaq 0x4983(%rip), %rsi      # 0x2239e
cmovneq %rax, %rsi
leaq 0x141ff(%rip), %rdi     # 0x31c25
xorl %ebx, %ebx
movl %r12d, %edx
xorl %eax, %eax
callq 0x1bdd9
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq