// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/analyzer/analyzer.c
// Function: printPgn
bool printPgn(const RawMessage *msg, const uint8_t *data, int length, bool showData, bool showJson)
{
  const Pgn *pgn;

  size_t i;
  bool   r;
  size_t variableFields = 0; // How many variable fields remain (product of repetition count * # of fields)

  if (msg == NULL)
  {
    return false;
  }
  pgn = getMatchingPgn(msg->pgn, data, length);
  if (!pgn)
  {
    logAbort("No PGN definition found for PGN %u\n", msg->pgn);
  }

  if (showData)
  {
    FILE *f = stdout;

    if (showJson)
    {
      f = stderr;
    }

    fprintf(f, "%s %u %3u %3u %6u %s: ", msg->timestamp, msg->prio, msg->src, msg->dst, msg->pgn, pgn->description);
    for (i = 0; i < length; i++)
    {
      fprintf(f, " %2.02X", data[i]);
    }
    putc('\n', f);

    fprintf(f, "%s %u %3u %3u %6u %s: ", msg->timestamp, msg->prio, msg->src, msg->dst, msg->pgn, pgn->description);
    for (i = 0; i < length; i++)
    {
      fprintf(f, "  %c", isalnum(data[i]) ? data[i] : '.');
    }
    putc('\n', f);
  }
  if (showJson)
  {
    if (pgn->camelDescription)
    {
      mprintf("{\"%s\":", pgn->camelDescription);
    }
    mprintf("{\"timestamp\":\"%s\",\"prio\":%u,\"src\":%u,\"dst\":%u,\"pgn\":%u,\"description\":\"%s\"",
            msg->timestamp,
            msg->prio,
            msg->src,
            msg->dst,
            msg->pgn,
            pgn->description);
    if (showAllBytes)
    {
      mprintf(",\"data\":\"");
      for (i = 0; i < length; i++)
      {
        mprintf("%2.02X", data[i]);
      }
      mprintf("\"");
    }
    if (pgn->camelDescription)
    {
      strcpy(closingBraces, "}}");
    }
    else
    {
      strcpy(closingBraces, "}");
    }
    sep = ",\"fields\":{";
  }
  else
  {
    mprintf("%s %u %3u %3u %6u %s:", msg->timestamp, msg->prio, msg->src, msg->dst, msg->pgn, pgn->description);
    sep = " ";
  }
  r = printFields(pgn, data, length, showData, showJson, &variableFields);

  if (showJson)
  {
    for (i = strlen(closingBraces); i;)
    {
      mprintf("%c", closingBraces[--i]);
    }
  }
  mprintf("\n");

  if (r)
  {
    mwrite(stdout);
    if (variableFields > 0 && g_variableFieldRepeat[0] < UINT8_MAX)
    {
      logError("PGN %u has %zu missing fields in repeating set\n", msg->pgn, variableFields);
    }
  }
  else
  {
    if (!showJson)
    {
      mwrite(stdout);
    }
    mreset();
    logError("PGN %u analysis error\n", msg->pgn);
  }

  if (msg->pgn == 126992 && currentDate < UINT16_MAX && currentTime < UINT32_MAX && clockSrc == msg->src)
  {
    setSystemClock();
  }
  return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movb %r8b, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
andb $0x1, %cl
movb %cl, -0x1d(%rbp)
andb $0x1, %al
movb %al, -0x1e(%rbp)
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xda29
movb $0x0, -0x1(%rbp)
jmp 0xde8e
movq -0x10(%rbp), %rax
movl 0x40(%rax), %edi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0xb6f0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xda5c
movq -0x10(%rbp), %rax
movl 0x40(%rax), %esi
leaq 0x1be4d(%rip), %rdi     # 0x298a2
movb $0x0, %al
callq 0x226d0
testb $0x1, -0x1d(%rbp)
je 0xdbf3
movq 0x3355b(%rip), %rax     # 0x40fc8
movq (%rax), %rax
movq %rax, -0x48(%rbp)
testb $0x1, -0x1e(%rbp)
je 0xda88
movq 0x3356f(%rip), %rax     # 0x40ff0
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x10(%rbp), %rax
movzbl 0x3c(%rax), %ecx
movq -0x10(%rbp), %rax
movzbl 0x45(%rax), %r8d
movq -0x10(%rbp), %rax
movzbl 0x44(%rax), %r9d
movq -0x10(%rbp), %rax
movl 0x40(%rax), %r10d
movq -0x28(%rbp), %rax
movq (%rax), %rax
leaq 0x1be06(%rip), %rsi     # 0x298c6
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0xb1d0
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
jae 0xdb11
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movzbl (%rax,%rcx), %edx
leaq 0x1bde1(%rip), %rsi     # 0x298dd
movb $0x0, %al
callq 0xb1d0
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xdad8
movq -0x48(%rbp), %rsi
movl $0xa, %edi
callq 0xb1a0
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x10(%rbp), %rax
movzbl 0x3c(%rax), %ecx
movq -0x10(%rbp), %rax
movzbl 0x45(%rax), %r8d
movq -0x10(%rbp), %rax
movzbl 0x44(%rax), %r9d
movq -0x10(%rbp), %rax
movl 0x40(%rax), %r10d
movq -0x28(%rbp), %rax
movq (%rax), %rax
leaq 0x1bd6f(%rip), %rsi     # 0x298c6
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0xb1d0
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
jae 0xdbe5
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
callq 0xb390
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0xdbb8
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x54(%rbp)
jmp 0xdbc2
movl $0x2e, %eax
movl %eax, -0x54(%rbp)
jmp 0xdbc2
movq -0x50(%rbp), %rdi
movl -0x54(%rbp), %edx
leaq 0x1bd15(%rip), %rsi     # 0x298e5
movb $0x0, %al
callq 0xb1d0
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xdb6f
movq -0x48(%rbp), %rsi
movl $0xa, %edi
callq 0xb1a0
testb $0x1, -0x1e(%rbp)
je 0xdd0a
movq -0x28(%rbp), %rax
cmpq $0x0, 0x15c8(%rax)
je 0xdc24
movq -0x28(%rbp), %rax
movq 0x15c8(%rax), %rsi
leaq 0x1bccd(%rip), %rdi     # 0x298ea
movb $0x0, %al
callq 0x1dce0
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movzbl 0x3c(%rax), %edx
movq -0x10(%rbp), %rax
movzbl 0x45(%rax), %ecx
movq -0x10(%rbp), %rax
movzbl 0x44(%rax), %r8d
movq -0x10(%rbp), %rax
movl 0x40(%rax), %r9d
movq -0x28(%rbp), %rax
movq (%rax), %rax
leaq 0x1bc9a(%rip), %rdi     # 0x298f1
movq %rax, (%rsp)
movb $0x0, %al
callq 0x1dce0
testb $0x1, 0x866de(%rip)     # 0x94347
je 0xdcc4
leaq 0x1bcc9(%rip), %rdi     # 0x2993b
movb $0x0, %al
callq 0x1dce0
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
jae 0xdcb6
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movzbl (%rax,%rcx), %esi
leaq 0x1bc3d(%rip), %rdi     # 0x298de
movb $0x0, %al
callq 0x1dce0
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xdc81
leaq 0x1cb27(%rip), %rdi     # 0x2a7e4
movb $0x0, %al
callq 0x1dce0
movq -0x28(%rbp), %rax
cmpq $0x0, 0x15c8(%rax)
je 0xdce7
leaq 0x86687(%rip), %rdi     # 0x94360
leaq 0x1bc65(%rip), %rsi     # 0x29945
callq 0xb090
jmp 0xdcfa
leaq 0x86672(%rip), %rdi     # 0x94360
leaq 0x28347(%rip), %rsi     # 0x3603c
callq 0xb090
leaq 0x1bc47(%rip), %rax     # 0x29948
movq %rax, 0x804b8(%rip)     # 0x8e1c0
jmp 0xdd56
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movzbl 0x3c(%rax), %edx
movq -0x10(%rbp), %rax
movzbl 0x45(%rax), %ecx
movq -0x10(%rbp), %rax
movzbl 0x44(%rax), %r8d
movq -0x10(%rbp), %rax
movl 0x40(%rax), %r9d
movq -0x28(%rbp), %rax
movq (%rax), %rax
leaq 0x1bc17(%rip), %rdi     # 0x29954
movq %rax, (%rsp)
movb $0x0, %al
callq 0x1dce0
leaq 0x1c247(%rip), %rax     # 0x29f96
movq %rax, 0x8046a(%rip)     # 0x8e1c0
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movb -0x1d(%rbp), %cl
movb -0x1e(%rbp), %al
leaq -0x40(%rbp), %r9
andb $0x1, %cl
andb $0x1, %al
movzbl %cl, %ecx
movzbl %al, %r8d
callq 0xdea0
andb $0x1, %al
movb %al, -0x31(%rbp)
testb $0x1, -0x1e(%rbp)
je 0xddcb
leaq 0x865d2(%rip), %rdi     # 0x94360
callq 0xb0d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xddc9
movq -0x30(%rbp), %rcx
movq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
leaq 0x865ac(%rip), %rax     # 0x94360
movsbl -0x1(%rax,%rcx), %esi
leaq 0x1bb27(%rip), %rdi     # 0x298e7
movb $0x0, %al
callq 0x1dce0
jmp 0xdd97
jmp 0xddcb
leaq 0x1b896(%rip), %rdi     # 0x29668
movb $0x0, %al
callq 0x1dce0
testb $0x1, -0x31(%rbp)
je 0xde1c
movq 0x331e2(%rip), %rax     # 0x40fc8
movq (%rax), %rdi
callq 0x1dec0
cmpq $0x0, -0x40(%rbp)
jbe 0xde1a
cmpl $0xff, 0x86571(%rip)    # 0x94370
jge 0xde1a
movq -0x10(%rbp), %rax
movl 0x40(%rax), %esi
movq -0x40(%rbp), %rdx
leaq 0x1bb57(%rip), %rdi     # 0x2996a
movb $0x0, %al
callq 0x22620
jmp 0xde4b
testb $0x1, -0x1e(%rbp)
jne 0xde31
movq 0x3319f(%rip), %rax     # 0x40fc8
movq (%rax), %rdi
callq 0x1dec0
callq 0x1ddc0
movq -0x10(%rbp), %rax
movl 0x40(%rax), %esi
leaq 0x1bb56(%rip), %rdi     # 0x2999a
movb $0x0, %al
callq 0x22620
movq -0x10(%rbp), %rax
cmpl $0x1f010, 0x40(%rax)    # imm = 0x1F010
jne 0xde86
movzwl 0x8037d(%rip), %eax     # 0x8e1dc
cmpl $0xffff, %eax           # imm = 0xFFFF
jge 0xde86
cmpl $-0x1, 0x80373(%rip)    # 0x8e1e0
jae 0xde86
movl 0x8035b(%rip), %eax     # 0x8e1d0
movq -0x10(%rbp), %rcx
movzbl 0x45(%rcx), %ecx
cmpl %ecx, %eax
jne 0xde86
callq 0xd770
movb -0x31(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)