// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x20
popq %rsi
pushq $0x1
popq %r15
movl %r15d, %edx
callq 0x1ced8
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 0x1d25a
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)
pushq $0xa
popq %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0xd2a0
movl %eax, 0x10(%rsp)
movq (%r15), %r15
cmpb $0x20, (%r15)
jne 0x1d228
incq %r15
movq %rsp, %r12
movq %r15, (%r12)
pushq $0x10
popq %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0xd2a0
movq (%r12), %r15
cmpb $0x20, (%r15)
jne 0x1d228
movl %ebp, 0xc(%rsp)
leaq 0x1c(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
movl %eax, %edi
callq 0x1c830
incq %r15
movq %rsp, %r13
movq %r15, (%r13)
movq %r15, %rdi
callq 0xd0f0
shrq %rax
leaq 0x47(%r14), %rbp
movq %rax, 0x20(%rsp)
movl %eax, %r15d
xorl %r12d, %r12d
cmpq %r12, %r15
je 0x1d26c
leaq (%r12,%rbp), %rsi
movq %r13, %rdi
callq 0x1ca7b
testl %eax, %eax
jne 0x1d29b
movq (%rsp), %rsi
movzbl (%rsi), %eax
cmpl $0x20, %eax
je 0x1d21c
cmpl $0x2c, %eax
jne 0x1d2bb
incq %rsi
movq %rsi, (%rsp)
incq %r12
jmp 0x1d1ee
subq %rbx, %r15
leaq 0x148e4(%rip), %rdi     # 0x31b16
movq %r15, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1bdd9
pushq $0x2
popq %r15
testb %bpl, %bpl
jne 0x1d25a
movq 0x1cd79(%rip), %rax     # 0x39fc8
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
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 0x1d25a
movq (%rsp), %rcx
movq %rcx, %rsi
subq %rbx, %rsi
leaq 0x1482c(%rip), %rdi     # 0x31ad8
movq %rbx, %rdx
movl %r12d, %r8d
xorl %eax, %eax
callq 0x1bdd9
jmp 0x1d2cf
subq %rbx, %rsi
leaq 0x14851(%rip), %rdi     # 0x31b16
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1bdd9
pushq $0x2
popq %r15
cmpb $0x0, 0xc(%rsp)
je 0x1d248
jmp 0x1d25a