// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/analyzer/../common/parse.c
// Function: parseRawFormatPlain
int parseRawFormatPlain(char *msg, RawMessage *m, bool showJson)
{
  unsigned int prio, pgn, dst, src, len, junk, r, i;
  char        *p;
  unsigned int data[8];

  p = findOccurrence(msg, ',', 1);
  if (!p)
  {
    return 1;
  }
  p--; // Back to comma

  memcpy(m->timestamp, msg, p - msg);
  m->timestamp[p - msg] = 0;

  /* Moronic Windows does not support %hh<type> so we use intermediate variables */
  r = sscanf(p,
             ",%u,%u,%u,%u,%u"
             ",%x,%x,%x,%x,%x,%x,%x,%x,%x",
             &prio,
             &pgn,
             &src,
             &dst,
             &len,
             &data[0],
             &data[1],
             &data[2],
             &data[3],
             &data[4],
             &data[5],
             &data[6],
             &data[7],
             &junk);
  if (r < 5)
  {
    logError("Error reading message, scanned %zu from %s", r, msg);
    if (!showJson)
      fprintf(stdout, "%s", msg);
    return 2;
  }

  if (len > 8)
  {
    // This is not PLAIN format but FAST format */
    return -1;
  }

  if (r <= 5 + 8)
  {
    for (i = 0; i < len; i++)
    {
      m->data[i] = data[i];
    }
  }
  else
  {
    return -1;
  }

  return setParsedValues(m, prio, pgn, dst, src, len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movb %dl, %al
movq %rdi, -0x38(%rbp)
movq %rsi, -0x40(%rbp)
andb $0x1, %al
movb %al, -0x41(%rbp)
movq -0x38(%rbp), %rdi
movl $0x2c, %esi
movl $0x1, %edx
callq 0x216c0
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
jne 0x214dd
movl $0x1, -0x2c(%rbp)
jmp 0x216a4
movq -0x70(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x70(%rbp)
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq -0x38(%rbp), %rax
subq %rax, %rdx
callq 0xd1d0
movq -0x40(%rbp), %rax
movq -0x70(%rbp), %rcx
movq -0x38(%rbp), %rdx
subq %rdx, %rcx
movb $0x0, (%rax,%rcx)
movq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0x90(%rbp), %r13
addq $0x4, %r13
leaq -0x90(%rbp), %r12
addq $0x8, %r12
leaq -0x90(%rbp), %r15
addq $0xc, %r15
leaq -0x90(%rbp), %r14
addq $0x10, %r14
leaq -0x90(%rbp), %rbx
addq $0x14, %rbx
leaq -0x90(%rbp), %r11
addq $0x18, %r11
leaq -0x90(%rbp), %r10
addq $0x1c, %r10
leaq 0x14910(%rip), %rsi     # 0x35e8a
leaq -0x48(%rbp), %rdx
leaq -0x4c(%rbp), %rcx
leaq -0x54(%rbp), %r8
leaq -0x50(%rbp), %r9
leaq -0x58(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x5c(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, (%rsp)
movq -0xa0(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0x98(%rbp), %rax
movq %r13, 0x10(%rsp)
movq %r12, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movq %r14, 0x28(%rsp)
movq %rbx, 0x30(%rsp)
movq %r11, 0x38(%rsp)
movq %r10, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movb $0x0, %al
callq 0xd220
movl %eax, -0x60(%rbp)
cmpl $0x5, -0x60(%rbp)
jae 0x21636
movl -0x60(%rbp), %esi
movq -0x38(%rbp), %rdx
leaq 0x148b1(%rip), %rdi     # 0x35eb5
movb $0x0, %al
callq 0x1f720
testb $0x1, -0x41(%rbp)
jne 0x2162d
movq 0x1a9c0(%rip), %rax     # 0x3bfd8
movq (%rax), %rdi
movq -0x38(%rbp), %rdx
leaq 0x149e6(%rip), %rsi     # 0x3600c
movb $0x0, %al
callq 0xd1b0
movl $0x2, -0x2c(%rbp)
jmp 0x216a4
cmpl $0x8, -0x58(%rbp)
jbe 0x21645
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
jmp 0x216a4
cmpl $0xd, -0x60(%rbp)
ja 0x2167e
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x58(%rbp), %eax
jae 0x2167c
movl -0x64(%rbp), %eax
movl -0x90(%rbp,%rax,4), %eax
movb %al, %dl
movq -0x40(%rbp), %rax
movl -0x64(%rbp), %ecx
movb %dl, 0x47(%rax,%rcx)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x21652
jmp 0x21687
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
jmp 0x216a4
movq -0x40(%rbp), %rdi
movl -0x48(%rbp), %esi
movl -0x4c(%rbp), %edx
movl -0x50(%rbp), %ecx
movl -0x54(%rbp), %r8d
movl -0x58(%rbp), %r9d
callq 0x21780
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)