// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/ikonvert-serial/ikonvert-serial.c
// Function: parseIKonvertFormat
static bool parseIKonvertFormat(StringBuffer *in, RawMessage *msg)
{
  char        *end = sbGet(in) + strlen(sbGet(in)); // not sbGetLength as 'in' has been truncated
  char        *p   = sbGet(in);
  int          r;
  unsigned int pgn;
  unsigned int prio;
  unsigned int src;
  unsigned int dst;
  unsigned int t1;
  unsigned int t2;
  int          i;

  r = sscanf(p, RX_PGN_MSG_PREFIX "%n", &pgn, &prio, &src, &dst, &t1, &t2, &i);
  if (r != 6)
  {
    return false;
  }

  msg->prio = prio;
  msg->pgn  = pgn;
  msg->src  = src;
  msg->dst  = dst;

  p += i;
  if (hexMode)
  {
    sbAppendDecodeHex(&dataBuffer, p, end - p);
  }
  else
  {
    sbAppendDecodeBase64(&dataBuffer, p, end - p, BASE64_RFC);
  }
  msg->len = CB_MIN(sbGetLength(&dataBuffer), FASTPACKET_MAX_SIZE);
  memcpy(msg->data, sbGet(&dataBuffer), msg->len);
  sbEmpty(&dataBuffer);
  computeIKonvertTime(msg);
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x412a
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x4137
leaq 0x561c(%rip), %rax      # 0x974d
movq %rax, -0x50(%rbp)
jmp 0x4137
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x4156
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x4163
leaq 0x55f0(%rip), %rax      # 0x974d
movq %rax, -0x60(%rbp)
jmp 0x4163
movq -0x60(%rbp), %rdi
callq 0x20b0
movq %rax, %rcx
movq -0x58(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x4191
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x419e
leaq 0x55b5(%rip), %rax      # 0x974d
movq %rax, -0x68(%rbp)
jmp 0x419e
movq -0x68(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x5b44(%rip), %rsi      # 0x9cf5
leaq -0x30(%rbp), %rdx
leaq -0x34(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x3c(%rbp), %r9
leaq -0x40(%rbp), %r11
leaq -0x44(%rbp), %r10
leaq -0x48(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x2210
movl %eax, -0x2c(%rbp)
cmpl $0x6, -0x2c(%rbp)
je 0x41f4
movb $0x0, -0x1(%rbp)
jmp 0x434a
movl -0x34(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x3c(%rax)
movl -0x30(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x40(%rax)
movl -0x38(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x45(%rax)
movl -0x3c(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x44(%rax)
movl -0x48(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
testb $0x1, 0x87e2(%rip)      # 0xca1c
je 0x4259
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rax
subq %rax, %rdx
leaq 0x886e(%rip), %rdi      # 0xcac0
callq 0x4eb0
jmp 0x4276
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rax
subq %rax, %rdx
leaq 0x8851(%rip), %rdi      # 0xcac0
xorl %ecx, %ecx
callq 0x8080
cmpq $0xdf, 0x8847(%rip) # 0xcac8
jae 0x4290
movq 0x883e(%rip), %rax      # 0xcac8
movq %rax, -0x70(%rbp)
jmp 0x429b
movl $0xdf, %eax
movq %rax, -0x70(%rbp)
jmp 0x429b
movq -0x70(%rbp), %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x46(%rax)
movq -0x18(%rbp), %rax
addq $0x47, %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, 0x8804(%rip)      # 0xcac0
je 0x42cb
movq 0x87fb(%rip), %rax      # 0xcac0
movq %rax, -0x80(%rbp)
jmp 0x42d8
leaq 0x547b(%rip), %rax      # 0x974d
movq %rax, -0x80(%rbp)
jmp 0x42d8
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x18(%rbp), %rax
movzbl 0x46(%rax), %eax
movl %eax, %edx
callq 0x21d0
xorl %eax, %eax
cmpq 0x87d0(%rip), %rax      # 0xcac8
jae 0x4305
xorl %eax, %eax
movq %rax, -0x88(%rbp)
jmp 0x4313
movq 0x87bc(%rip), %rax      # 0xcac8
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, 0x87a7(%rip)      # 0xcac8
cmpq $0x0, 0x8797(%rip)      # 0xcac0
je 0x433d
movq 0x878e(%rip), %rax      # 0xcac0
movq 0x878f(%rip), %rcx      # 0xcac8
movb $0x0, (%rax,%rcx)
movq -0x18(%rbp), %rdi
callq 0x4360
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax,%rax)