// File: /workspace/github_c_makefile_star2_O2/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 0x11c58(%rip), %rax     # 0x1f3c8
movq (%rax), %r10
leaq 0x11c56(%rip), %rax     # 0x1f3d0
movq (%rax), %r15
xorl %eax, %eax
leaq 0x2cb7a(%rip), %r14     # 0x3a300
leaq 0x2ca73(%rip), %r12     # 0x3a200
addq $0x4, %r12
xorl %ebp, %ebp
movq %r10, (%rsp)
cmpq %r10, %rbp
je 0xd832
imulq $0x15f8, %rbp, %r13     # imm = 0x15F8
movl 0x8(%r14,%r13), %ebx
cmpl %eax, %ebx
jl 0xd841
addq %r14, %r13
cmpl $0x3ffff, %ebx          # imm = 0x3FFFF
jg 0xd80a
movq %r12, %rdx
xorl %ecx, %ecx
movl (%rdx), %r8d
addq $0x20, %rdx
cmpl %r8d, %ebx
jbe 0xd7dc
leaq 0x1(%rcx), %rsi
cmpq %rcx, %r15
movq %rsi, %rcx
ja 0xd7c4
cmpl %r8d, %ebx
ja 0xd84a
movl -0x24(%rdx), %ecx
cmpl %ecx, %ebx
jb 0xd84a
testb %bl, %bl
je 0xd7f5
cmpl $0x100, -0x1c(%rdx)     # imm = 0x100
je 0xd872
movl 0x10(%r13), %esi
cmpl $0x2, %esi
je 0xd80a
movl -0xc(%rdx), %edx
cmpl $0x3, %edx
je 0xd80a
cmpl %esi, %edx
jne 0xd853
cmpl %eax, %ebx
je 0xd82a
cmpb $0x0, 0x15d0(%r13)
jne 0xd82a
movl %ebx, %edi
callq 0xd48c
cmpq %r13, %rax
jne 0xd886
movl %ebx, %eax
movq (%rsp), %r10
incq %rbp
jmp 0xd797
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x119d5(%rip), %rdi     # 0x1f21d
jmp 0xd88d
leaq 0x119fc(%rip), %rdi     # 0x1f24d
jmp 0xd88d
leaq 0x2c986(%rip), %rax     # 0x3a1e0
movq (%rax,%rdx,8), %r9
leaq 0x11a6b(%rip), %rdi     # 0x1f2d0
movl %ebx, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x1bdd9
jmp 0xd896
leaq 0x11a0d(%rip), %rdi     # 0x1f286
movl %ebx, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x1bdd9
jmp 0xd896
leaq 0x11a95(%rip), %rdi     # 0x1f322
movl %ebx, %esi
xorl %eax, %eax
callq 0x1bdd9
pushq $0x2
popq %rdi
callq 0xd2d0