// File: /workspace/github_c_makefile_star2_O1/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 0x1abd0(%rip), %rax     # 0x283c8
movq (%rax), %r10
testq %r10, %r10
je 0xd8bd
leaq 0x1abc5(%rip), %rax     # 0x283d0
movq (%rax), %r15
xorl %r12d, %r12d
leaq 0x38ae8(%rip), %r14     # 0x46300
leaq 0x389e1(%rip), %r13     # 0x46200
addq $0x4, %r13
xorl %eax, %eax
movq %r10, (%rsp)
imulq $0x15f8, %r12, %rbp     # imm = 0x15F8
movl 0x8(%r14,%rbp), %ebx
cmpl %eax, %ebx
jl 0xd8cc
addq %r14, %rbp
cmpl $0x3ffff, %ebx          # imm = 0x3FFFF
jg 0xd892
movq %r13, %rdx
xorl %ecx, %ecx
movl (%rdx), %r8d
addq $0x20, %rdx
cmpl %r8d, %ebx
jbe 0xd865
leaq 0x1(%rcx), %rsi
cmpq %rcx, %r15
movq %rsi, %rcx
ja 0xd84d
cmpl %r8d, %ebx
ja 0xd8d5
movl -0x24(%rdx), %ecx
cmpl %ecx, %ebx
jb 0xd8d5
testb %bl, %bl
je 0xd87e
cmpl $0x100, -0x1c(%rdx)     # imm = 0x100
je 0xd8fd
movl 0x10(%rbp), %esi
cmpl $0x2, %esi
je 0xd892
movl -0xc(%rdx), %edx
cmpl $0x3, %edx
je 0xd892
cmpl %esi, %edx
jne 0xd8de
cmpl %eax, %ebx
je 0xd8b1
cmpb $0x0, 0x15d0(%rbp)
jne 0xd8b1
movl %ebx, %edi
callq 0xd48c
cmpq %rbp, %rax
jne 0xd911
movl %ebx, %eax
movq (%rsp), %r10
incq %r12
cmpq %r10, %r12
jne 0xd829
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a94a(%rip), %rdi     # 0x2821d
jmp 0xd918
leaq 0x1a971(%rip), %rdi     # 0x2824d
jmp 0xd918
leaq 0x388fb(%rip), %rax     # 0x461e0
movq (%rax,%rdx,8), %r9
leaq 0x1a9e0(%rip), %rdi     # 0x282d0
movl %ebx, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x25570
jmp 0xd921
leaq 0x1a982(%rip), %rdi     # 0x28286
movl %ebx, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x25570
jmp 0xd921
leaq 0x1aa0a(%rip), %rdi     # 0x28322
movl %ebx, %esi
xorl %eax, %eax
callq 0x25570
movl $0x2, %edi
callq 0xd2d0