// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0xc(%rbp)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
leaq 0x16ad6(%rip), %rcx     # 0x24438
cmpq (%rcx), %rax
jae 0xdbe7
movl $0x0, -0x10(%rbp)
leaq 0x2e987(%rip), %rax     # 0x3c300
imulq $0x15f8, -0x8(%rbp), %rcx # imm = 0x15F8
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xd9ad
movl -0x14(%rbp), %esi
leaq 0x16881(%rip), %rdi     # 0x2421d
movb $0x0, %al
callq 0x1f720
movl $0x2, %edi
callq 0xd2e0
cmpl $0x40000, -0x14(%rbp)   # imm = 0x40000
jge 0xdb67
jmp 0xd9bc
movl -0x14(%rbp), %ecx
movslq -0x10(%rbp), %rax
leaq 0x2e836(%rip), %rdx     # 0x3c200
shlq $0x5, %rax
addq %rax, %rdx
xorl %eax, %eax
cmpl 0x4(%rdx), %ecx
movb %al, -0x21(%rbp)
jbe 0xd9ef
movslq -0x10(%rbp), %rax
leaq 0x16a5a(%rip), %rcx     # 0x24440
cmpq (%rcx), %rax
setb %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0xd9f8
jmp 0xda03
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xd9bc
movl -0x14(%rbp), %eax
movslq -0x10(%rbp), %rdx
leaq 0x2e7ef(%rip), %rcx     # 0x3c200
shlq $0x5, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jb 0xda36
movl -0x14(%rbp), %eax
movslq -0x10(%rbp), %rdx
leaq 0x2e7d6(%rip), %rcx     # 0x3c200
shlq $0x5, %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
jbe 0xda51
movl -0x14(%rbp), %esi
leaq 0x1680d(%rip), %rdi     # 0x2424d
movb $0x0, %al
callq 0x1f720
movl $0x2, %edi
callq 0xd2e0
movslq -0x10(%rbp), %rcx
leaq 0x2e7a4(%rip), %rax     # 0x3c200
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x100, 0x8(%rax)       # imm = 0x100
jne 0xda97
movl -0x14(%rbp), %eax
andl $0xff, %eax
cmpl $0x0, %eax
je 0xda97
movl -0x14(%rbp), %esi
movl -0x14(%rbp), %edx
leaq 0x16800(%rip), %rdi     # 0x24286
movb $0x0, %al
callq 0x1f720
movl $0x2, %edi
callq 0xd2e0
movslq -0x10(%rbp), %rcx
leaq 0x2e75e(%rip), %rax     # 0x3c200
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
leaq 0x2e84d(%rip), %rcx     # 0x3c300
imulq $0x15f8, -0x8(%rbp), %rdx # imm = 0x15F8
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
je 0xdb65
movslq -0x10(%rbp), %rcx
leaq 0x2e72e(%rip), %rax     # 0x3c200
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x3, 0x18(%rax)
je 0xdb65
leaq 0x2e816(%rip), %rax     # 0x3c300
imulq $0x15f8, -0x8(%rbp), %rcx # imm = 0x15F8
addq %rcx, %rax
cmpl $0x2, 0x10(%rax)
je 0xdb65
movl -0x14(%rbp), %esi
movl -0x14(%rbp), %edx
movslq -0x10(%rbp), %rcx
leaq 0x2e6f4(%rip), %rax     # 0x3c200
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %ecx
movslq -0x10(%rbp), %rdi
leaq 0x2e6e0(%rip), %rax     # 0x3c200
shlq $0x5, %rdi
addq %rdi, %rax
movl 0x4(%rax), %r8d
movslq -0x10(%rbp), %rdi
leaq 0x2e6ca(%rip), %rax     # 0x3c200
shlq $0x5, %rdi
addq %rdi, %rax
movl 0x18(%rax), %eax
movl %eax, %edi
leaq 0x2e697(%rip), %rax     # 0x3c1e0
movq (%rax,%rdi,8), %r9
leaq 0x1677c(%rip), %rdi     # 0x242d0
movb $0x0, %al
callq 0x1f720
movl $0x2, %edi
callq 0xd2e0
jmp 0xdb67
movl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
je 0xdb8a
leaq 0x2e78a(%rip), %rax     # 0x3c300
imulq $0x15f8, -0x8(%rbp), %rcx # imm = 0x15F8
addq %rcx, %rax
testb $0x1, 0x15d0(%rax)
je 0xdb8c
jmp 0xdbd6
movl -0x14(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %edi
callq 0xd490
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
leaq 0x2e757(%rip), %rcx     # 0x3c300
imulq $0x15f8, -0x8(%rbp), %rdx # imm = 0x15F8
addq %rdx, %rcx
cmpq %rcx, %rax
je 0xdbd4
movl -0xc(%rbp), %esi
leaq 0x1675f(%rip), %rdi     # 0x24322
movb $0x0, %al
callq 0x1f720
movl $0x2, %edi
callq 0xd2e0
jmp 0xdbd6
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0xd957
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)