// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/analyzer/../common/parse.c
// Function: parseRawFormatAirmar
int parseRawFormatAirmar(char *msg, RawMessage *m, bool showJson)
{
  unsigned int prio, pgn, dst, src, len, i;
  char        *p;
  unsigned int id;

  p = findOccurrence(msg, ' ', 1);
  if (p < msg + 4 || p >= msg + sizeof(m->timestamp))
  {
    return 1;
  }

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

  /* Moronic Windows does not support %hh<type> so we use intermediate variables */
  pgn = strtoul(p, &p, 10);
  if (*p == ' ')
  {
    id = strtoul(++p, &p, 16);
  }
  if (*p != ' ')
  {
    logError("Error reading message, scanned %zu bytes from %s", p - msg, msg);
    if (!showJson)
      fprintf(stdout, "%s", msg);
    return 2;
  }

  getISO11783BitsFromCanId(id, &prio, &pgn, &src, &dst);

  p++;
  len = strlen(p) / 2;
  for (i = 0; i < len; i++)
  {
    if (scanHex(&p, &m->data[i]))
    {
      logError("Error reading message, scanned %zu bytes from %s/%s, index %u", p - msg, msg, p, i);
      if (!showJson)
        fprintf(stdout, "%s", msg);
      return 2;
    }
    if (i < len)
    {
      if (*p != ',' && *p != ' ')
      {
        logError("Error reading message, scanned %zu bytes from %s", p - msg, msg);
        if (!showJson)
          fprintf(stdout, "%s", msg);
        return 2;
      }
      p++;
    }
  }

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl $0x1, %r15d
movl $0x20, %esi
movl $0x1, %edx
callq 0x1dff3
movq %rax, %r12
leaq 0x4(%rbx), %rax
cmpq %rax, %r12
setae %al
leaq 0x3c(%rbx), %rcx
cmpq %rcx, %r12
setb %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1e3de
movq %rbx, %r15
notq %r15
addq %r12, %r15
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xd1e0
movb $0x0, (%r14,%r15)
addq $0x3, %r12
movq %rsp, %r15
movq %r12, (%r15)
movq %r12, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0xd2a0
movl %eax, 0x10(%rsp)
movq (%r15), %r15
cmpb $0x20, (%r15)
jne 0x1e3aa
incq %r15
movq %rsp, %r12
movq %r15, (%r12)
movq %r15, %rdi
movq %r12, %rsi
movl $0x10, %edx
callq 0xd2a0
movq (%r12), %r15
cmpb $0x20, (%r15)
jne 0x1e3aa
movl %ebp, 0xc(%rsp)
leaq 0x1c(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
movl %eax, %edi
callq 0x1d8ea
incq %r15
movq %r15, (%rsp)
movq %r15, %rdi
callq 0xd0f0
shrq %rax
movq %rax, 0x20(%rsp)
testl %eax, %eax
je 0x1e37b
leaq 0x47(%r14), %rbp
movl 0x20(%rsp), %r15d
xorl %r12d, %r12d
movq %rsp, %r13
leaq (%r12,%rbp), %rsi
movq %r13, %rdi
callq 0x1db3f
testl %eax, %eax
jne 0x1e3f0
movq (%rsp), %rsi
movzbl (%rsi), %eax
cmpl $0x20, %eax
je 0x1e36c
cmpl $0x2c, %eax
jne 0x1e410
incq %rsi
movq %rsi, (%rsp)
incq %r12
cmpq %r12, %r15
jne 0x1e343
movb 0x1c(%rsp), %al
movl 0x10(%rsp), %ecx
movb 0x18(%rsp), %dl
movb 0x14(%rsp), %sil
movb %al, 0x3c(%r14)
movl %ecx, 0x40(%r14)
movb %dl, 0x44(%r14)
movb %sil, 0x45(%r14)
movq 0x20(%rsp), %rax
movb %al, 0x46(%r14)
xorl %r15d, %r15d
jmp 0x1e3de
subq %rbx, %r15
leaq 0x14762(%rip), %rdi     # 0x32b16
movq %r15, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1cde8
movl $0x2, %r15d
testb %bpl, %bpl
jne 0x1e3de
movq 0x1abf5(%rip), %rax     # 0x38fc8
movq (%rax), %rsi
movq %rbx, %rdi
callq 0xd170
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rcx
movq %rcx, %rsi
subq %rbx, %rsi
leaq 0x146d7(%rip), %rdi     # 0x32ad8
movq %rbx, %rdx
movl %r12d, %r8d
xorl %eax, %eax
callq 0x1cde8
jmp 0x1e424
subq %rbx, %rsi
leaq 0x146fc(%rip), %rdi     # 0x32b16
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1cde8
movl $0x2, %r15d
cmpb $0x0, 0xc(%rsp)
je 0x1e3cc
jmp 0x1e3de