// File: /workspace/github_c_makefile_star2_O3/canboat[P]canboat/analyzer/pgn.c
// Function: checkPgnList
void checkPgnList(void)
{
  size_t i;
  int    prev_prn = 0;

  for (i = 0; i < pgnListSize; i++)
  {
    int        pgnRangeIndex = 0;
    int        prn           = pgnList[i].pgn;
    const Pgn *pgn;

    if (prn < prev_prn)
    {
      logError("Internal error: PGN %d is not sorted correctly\n", prn);
      exit(2);
    }

    if (prn < ACTISENSE_BEM)
    {
      while (prn > pgnRange[pgnRangeIndex].pgnEnd && pgnRangeIndex < pgnRangeSize)
      {
        pgnRangeIndex++;
      }
      if (prn < pgnRange[pgnRangeIndex].pgnStart || prn > pgnRange[pgnRangeIndex].pgnEnd)
      {
        logError("Internal error: PGN %d is not part of a valid PRN range\n", prn);
        exit(2);
      }
      if (pgnRange[pgnRangeIndex].pgnStep == 256 && (prn & 0xff) != 0)
      {
        logError("Internal error: PGN %d (0x%x) is PDU1 and must have a PGN ending in 0x00\n", prn, prn);
        exit(2);
      }
      if (!(pgnRange[pgnRangeIndex].type == pgnList[i].type || pgnRange[pgnRangeIndex].type == PACKET_MIXED
            || pgnList[i].type == PACKET_ISO_TP))
      {
        logError("Internal error: PGN %d (0x%x) is in range 0x%x-0x%x and must have packet type %s\n",
                 prn,
                 prn,
                 pgnRange[pgnRangeIndex].pgnStart,
                 pgnRange[pgnRangeIndex].pgnEnd,
                 PACKET_TYPE_STR[pgnRange[pgnRangeIndex].type]);
        exit(2);
      }
    }

    if (prn == prev_prn || pgnList[i].fallback)
    {
      continue;
    }
    prev_prn = prn;
    pgn      = searchForPgn(prev_prn);
    if (pgn != &pgnList[i])
    {
      logError("Internal error: PGN %d is not found correctly\n", prev_prn);
      exit(2);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x12c3f(%rip), %rax     # 0x203c8
movq (%rax), %r10
testq %r10, %r10
je 0xd84e
leaq 0x12c34(%rip), %rax     # 0x203d0
movq (%rax), %r15
xorl %r12d, %r12d
leaq 0x2bb57(%rip), %r14     # 0x39300
leaq 0x2ba50(%rip), %r13     # 0x39200
addq $0x4, %r13
xorl %eax, %eax
movq %r10, (%rsp)
imulq $0x15f8, %r12, %rbp     # imm = 0x15F8
movl 0x8(%r14,%rbp), %ebx
cmpl %eax, %ebx
jl 0xd85d
addq %r14, %rbp
cmpl $0x3ffff, %ebx          # imm = 0x3FFFF
jg 0xd823
movq %r13, %rdx
xorl %ecx, %ecx
movl (%rdx), %r8d
addq $0x20, %rdx
cmpl %r8d, %ebx
jbe 0xd7f6
leaq 0x1(%rcx), %rsi
cmpq %rcx, %r15
movq %rsi, %rcx
ja 0xd7de
cmpl %r8d, %ebx
ja 0xd866
movl -0x24(%rdx), %ecx
cmpl %ecx, %ebx
jb 0xd866
testb %bl, %bl
je 0xd80f
cmpl $0x100, -0x1c(%rdx)     # imm = 0x100
je 0xd88e
movl 0x10(%rbp), %esi
cmpl $0x2, %esi
je 0xd823
movl -0xc(%rdx), %edx
cmpl $0x3, %edx
je 0xd823
cmpl %esi, %edx
jne 0xd86f
cmpl %eax, %ebx
je 0xd842
cmpb $0x0, 0x15d0(%rbp)
jne 0xd842
movl %ebx, %edi
callq 0xd48c
cmpq %rbp, %rax
jne 0xd8a2
movl %ebx, %eax
movq (%rsp), %r10
incq %r12
cmpq %r10, %r12
jne 0xd7ba
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x129b9(%rip), %rdi     # 0x2021d
jmp 0xd8a9
leaq 0x129e0(%rip), %rdi     # 0x2024d
jmp 0xd8a9
leaq 0x2b96a(%rip), %rax     # 0x391e0
movq (%rax,%rdx,8), %r9
leaq 0x12a4f(%rip), %rdi     # 0x202d0
movl %ebx, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x1cde8
jmp 0xd8b2
leaq 0x129f1(%rip), %rdi     # 0x20286
movl %ebx, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x1cde8
jmp 0xd8b2
leaq 0x12a79(%rip), %rdi     # 0x20322
movl %ebx, %esi
xorl %eax, %eax
callq 0x1cde8
movl $0x2, %edi
callq 0xd2d0