// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2250a
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x22517
leaq 0x5444(%rip), %rax      # 0x27955
movq %rax, -0x50(%rbp)
jmp 0x22517
movq -0x50(%rbp), %rdi
movl $0xa, %esi
callq 0xd0e0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x22539
movb $0x0, -0x1(%rbp)
jmp 0x22832
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x22550
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x2255d
leaq 0x53fe(%rip), %rax      # 0x27955
movq %rax, -0x58(%rbp)
jmp 0x2255d
movq -0x58(%rbp), %rdi
movl $0x2c, %esi
callq 0xd0e0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x2257f
movb $0x0, -0x1(%rbp)
jmp 0x22832
movq -0x38(%rbp), %rdi
leaq 0x13ad0(%rip), %rsi     # 0x3605a
leaq -0x1c(%rbp), %rdx
leaq -0x20(%rbp), %rcx
leaq -0x24(%rbp), %r8
leaq -0x28(%rbp), %r9
leaq -0x2c(%rbp), %r10
leaq -0x3c(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0xd220
movl %eax, -0x48(%rbp)
cmpl $0x5, -0x48(%rbp)
jne 0x227ec
movq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0x3c, %edx
callq 0xd160
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x225ee
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x225fb
leaq 0x5360(%rip), %rax      # 0x27955
movq %rax, -0x68(%rbp)
jmp 0x225fb
movq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x22622
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x80(%rbp)
jmp 0x2262f
leaq 0x532c(%rip), %rax      # 0x27955
movq %rax, -0x80(%rbp)
jmp 0x2262f
movq -0x70(%rbp), %rax
movq -0x80(%rbp), %rcx
subq %rcx, %rax
cmpq $0x3b, %rax
jbe 0x2268f
movq -0x38(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x22665
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x90(%rbp)
jmp 0x22675
leaq 0x52e9(%rip), %rax      # 0x27955
movq %rax, -0x90(%rbp)
jmp 0x22675
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x98(%rbp)
jmp 0x2269d
movl $0x3b, %eax
movq %rax, -0x98(%rbp)
jmp 0x2269d
movq -0x78(%rbp), %rsi
movq -0x60(%rbp), %rdi
movq -0x98(%rbp), %rdx
callq 0xd1d0
movl -0x1c(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x3c(%rax)
movl -0x20(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x40(%rax)
movl -0x24(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x45(%rax)
movl -0x28(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x44(%rax)
movl -0x2c(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x46(%rax)
movl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x9c(%rbp)
cmpl $0xdf, -0x2c(%rbp)
jae 0x22723
movl -0x2c(%rbp), %eax
movl %eax, -0xa0(%rbp)
jmp 0x22730
movl $0xdf, %eax
movl %eax, -0xa0(%rbp)
jmp 0x22730
movl -0x9c(%rbp), %eax
movl -0xa0(%rbp), %ecx
cmpl %ecx, %eax
jae 0x227e6
movq -0x38(%rbp), %rdi
leaq 0x1391e(%rip), %rsi     # 0x3606d
leaq -0x44(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
movb $0x0, %al
callq 0xd220
cmpl $0x1, %eax
jne 0x2277f
cmpl $0x100, -0x44(%rbp)     # imm = 0x100
jae 0x2277f
movl -0x44(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0x40(%rbp), %rcx
movb %dl, 0x47(%rax,%rcx)
jmp 0x227c7
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x22799
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
jmp 0x227a9
leaq 0x51b5(%rip), %rax      # 0x27955
movq %rax, -0xa8(%rbp)
jmp 0x227a9
movq -0xa8(%rbp), %rsi
movl -0x40(%rbp), %edx
leaq 0x138b9(%rip), %rdi     # 0x36073
movb $0x0, %al
callq 0x1f720
movb $0x0, -0x1(%rbp)
jmp 0x22832
movl -0x3c(%rbp), %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x22706
movb $0x1, -0x1(%rbp)
jmp 0x22832
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x22806
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
jmp 0x22816
leaq 0x5148(%rip), %rax      # 0x27955
movq %rax, -0xb0(%rbp)
jmp 0x22816
movq -0xb0(%rbp), %rsi
movl -0x48(%rbp), %edx
leaq 0x13880(%rip), %rdi     # 0x360a7
movb $0x0, %al
callq 0x1f720
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xc0, %rsp
popq %rbp
retq