// File: /workspace/github_c_makefile_star2_O1/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 0x267af
movq %rax, %r12
movq %rax, (%rsp)
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 0x26b86
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), %rdi
cmpb $0x20, (%rdi)
jne 0x26a97
incq %rdi
movq %rsp, %rsi
movq %rdi, (%rsi)
movl $0x10, %edx
callq 0xd2a0
movq (%rsp), %rsi
cmpb $0x20, (%rsi)
jne 0x26b55
movl %ebp, 0xc(%rsp)
leaq 0x1c(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
movl %eax, %edi
callq 0x26077
movq (%rsp), %rdi
incq %rdi
movq %rdi, (%rsp)
callq 0xd0f0
shrq %rax
movq %rax, 0x20(%rsp)
testl %eax, %eax
je 0x26b26
leaq 0x47(%r14), %rbp
movl 0x20(%rsp), %r15d
xorl %r12d, %r12d
movq %rsp, %r13
leaq (%r12,%rbp), %rsi
movq %r13, %rdi
callq 0x262e5
testl %eax, %eax
jne 0x26b98
movq (%rsp), %rsi
movzbl (%rsi), %eax
cmpl $0x20, %eax
je 0x26b17
cmpl $0x2c, %eax
jne 0x26bb8
incq %rsi
movq %rsi, (%rsp)
incq %r12
cmpq %r12, %r15
jne 0x26aee
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 0x26b86
subq %rbx, %rsi
leaq 0x1921a(%rip), %rdi     # 0x3fd79
movq %rbx, %rdx
xorl %eax, %eax
callq 0x25570
movl $0x2, %r15d
testb %bpl, %bpl
jne 0x26b86
movq 0x1f44d(%rip), %rax     # 0x45fc8
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 0x19192(%rip), %rdi     # 0x3fd3b
movq %rbx, %rdx
movl %r12d, %r8d
xorl %eax, %eax
callq 0x25570
jmp 0x26bcc
subq %rbx, %rsi
leaq 0x191b7(%rip), %rdi     # 0x3fd79
movq %rbx, %rdx
xorl %eax, %eax
callq 0x25570
movl $0x2, %r15d
cmpb $0x0, 0xc(%rsp)
je 0x26b74
jmp 0x26b86