// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/analyzer/../common/parse.c
// Function: parseRawFormatYDWG02
int parseRawFormatYDWG02(char *msg, RawMessage *m, bool showJson)
{
  char        *token;
  char        *nexttoken;
  time_t       tiden;
  struct tm    tm;
  unsigned int msgid;
  unsigned int prio, pgn, src, dst;
  int          i;

  // parse timestamp. YDWG doesn't give us date so let's figure it out ourself
  token = strtok_r(msg, " ", &nexttoken);
  if (!token)
  {
    return -1;
  }
  tiden = (time_t) (getNow() / UINT64_C(1000));
  localtime_r(&tiden, &tm);
  strftime(m->timestamp, sizeof(m->timestamp), "%Y-%m-%dT", &tm);
  sprintf(m->timestamp + strlen(m->timestamp), "%s", token);

  // parse direction, not really used in analyzer
  token = strtok_r(NULL, " ", &nexttoken);
  if (!token)
  {
    return -1;
  }

  // parse msgid
  token = strtok_r(NULL, " ", &nexttoken);
  if (!token)
  {
    return -1;
  }
  msgid = strtoul(token, NULL, 16);
  getISO11783BitsFromCanId(msgid, &prio, &pgn, &src, &dst);

  // parse data
  i = 0;
  while ((token = strtok_r(NULL, " ", &nexttoken)) != 0)
  {
    m->data[i] = strtoul(token, NULL, 16);
    i++;
    if (i > FASTPACKET_MAX_SIZE)
    {
      return -1;
    }
  }

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x5843(%rip), %rsi      # 0x27b68
leaq -0x30(%rbp), %rdx
callq 0xd180
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x22345
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x224c8
callq 0x1f3b0
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divq %rcx
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xd090
movq -0x18(%rbp), %rdi
movl $0x3c, %esi
leaq 0x13cdb(%rip), %rdx     # 0x36050
leaq -0x70(%rbp), %rcx
callq 0xd260
movq -0x18(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd0d0
movq -0x90(%rbp), %rdi
addq %rax, %rdi
movq -0x28(%rbp), %rdx
leaq 0x13c65(%rip), %rsi     # 0x3600c
movb $0x0, %al
callq 0xd2d0
xorl %eax, %eax
movl %eax, %edi
leaq 0x57af(%rip), %rsi      # 0x27b68
leaq -0x30(%rbp), %rdx
callq 0xd180
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x223d9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x224c8
xorl %eax, %eax
movl %eax, %edi
leaq 0x5784(%rip), %rsi      # 0x27b68
leaq -0x30(%rbp), %rdx
callq 0xd180
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x22404
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x224c8
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x10, %edx
callq 0xd2a0
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %edi
leaq -0x78(%rbp), %rsi
leaq -0x7c(%rbp), %rdx
leaq -0x80(%rbp), %rcx
leaq -0x84(%rbp), %r8
callq 0x209b0
movl $0x0, -0x88(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x571f(%rip), %rsi      # 0x27b68
leaq -0x30(%rbp), %rdx
callq 0xd180
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x224a5
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x10, %edx
callq 0xd2a0
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0x88(%rbp), %rcx
movb %dl, 0x47(%rax,%rcx)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
cmpl $0xdf, -0x88(%rbp)
jle 0x224a3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x224c8
jmp 0x2243e
movq -0x18(%rbp), %rdi
movl -0x78(%rbp), %esi
movl -0x7c(%rbp), %edx
movl -0x84(%rbp), %ecx
movl -0x80(%rbp), %r8d
movl -0x88(%rbp), %r9d
callq 0x21780
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)