// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/analyzer/analyzer-explain.c
// Function: explainPGN
static void explainPGN(Pgn pgn)
{
  int  i;
  int  len;
  bool isVariable;

  printf("PGN: %d / %08o / %05X - %s\n\n", pgn.pgn, pgn.pgn, pgn.pgn, pgn.description);

  if (pgn.explanation != NULL)
  {
    printf("     %s\n", pgn.explanation);
  }
  if (pgn.url != NULL)
  {
    printf("     URL: %s\n", pgn.url);
  }
  len = getMinimalPgnLength(&pgn, &isVariable);
  if (isVariable)
  {
    printf("     The length is variable but at least %d bytes\n", len);
  }
  else
  {
    printf("     The length is %d bytes\n", len);
  }

  if (pgn.repeatingCount1 > 0)
  {
    if (pgn.repeatingField1 < 255)
    {
      printf("     Fields %u thru %u repeat n times, where n is the value contained in field %u.\n\n",
             pgn.repeatingStart1,
             pgn.repeatingStart1 + pgn.repeatingCount1,
             pgn.repeatingField1);
    }
    else
    {
      printf("     Fields %u thru %u repeat until the data in the PGN is exhausted.\n\n",
             pgn.repeatingStart1,
             pgn.repeatingStart1 + pgn.repeatingCount1);
    }
  }

  if (pgn.repeatingCount2 > 0)
  {
    if (pgn.repeatingField2 < 255)
    {
      printf("     Fields %u thru %u repeat n times, where n is the value contained in field %u.\n\n",
             pgn.repeatingStart2,
             pgn.repeatingStart2 + pgn.repeatingCount2,
             pgn.repeatingField2);
    }
    else
    {
      printf("     Fields %u thru %u repeat until the data in the PGN is exhausted.\n\n",
             pgn.repeatingStart2,
             pgn.repeatingStart2 + pgn.repeatingCount2);
    }
  }

  if (pgn.interval != 0 && pgn.interval < UINT16_MAX)
  {
    printf("     The PGN is normally transmitted every %u ms\n", pgn.interval);
  }
  if (pgn.interval == UINT16_MAX)
  {
    printf("     The PGN is transmitted on-demand or when data is available\n");
  }
  if (pgn.priority != 0)
  {
    printf("     The default priority is %u\n", pgn.priority);
  }

  for (i = 0; i < ARRAY_SIZE(pgn.fieldList) && pgn.fieldList[i].name; i++)
  {
    Field f = pgn.fieldList[i];
    printf("  Field #%d: %s%s%s\n",
           i + 1,
           f.name,
           f.name[0] && (f.description && f.description[0] && f.description[0] != ',') ? " - " : "",
           (!f.description || f.description[0] == ',') ? "" : f.description);
    if (f.size == LEN_VARIABLE)
    {
      printf("                  Bits: variable\n");
    }
    else
    {
      printf("                  Bits: %u\n", f.size);
    }

    if (f.unit && f.unit[0] == '=')
    {
      printf("                  Match: %s\n", &f.unit[1]);
    }
    else if (f.unit && f.unit[0] != ',')
    {
      printf("                  Unit: %s\n", f.unit);
    }

    if (f.resolution != 0.0)
    {
      printf("                  Resolution: %g\n", f.resolution);
    }
    printf("                  Signed: %s\n", (f.hasSign) ? "true" : "false");
    if (f.offset != 0)
    {
      if (f.resolution == 1.0 || f.resolution == 0.0)
      {
        printf("                  Offset: %d\n", f.offset);
      }
      else
      {
        printf("                  Offset: %" PRId64 "\n", (int64_t) (f.offset * f.resolution));
      }
    }
    if (f.partOfPrimaryKey)
    {
      printf("                  Part Of Primary Key: true\n");
    }

    if (f.lookup.function.pairEnumerator != NULL)
    {
      switch (f.lookup.type)
      {
        case LOOKUP_TYPE_PAIR: {
          printf("                  Enumeration: %s\n", f.lookup.name);
          if (!(f.unit && f.unit[0] == '='))
          {
            uint64_t maxValue = (UINT64_C(1) << f.size) - 1;
            printf("                  Range: 0..%" PRIu64 "\n", maxValue);
            (f.lookup.function.pairEnumerator)(explainPairText);
          }
          break;
        }

        case LOOKUP_TYPE_TRIPLET: {
          uint64_t maxValue = (UINT64_C(1) << f.size) - 1;
          printf("                  IndirectEnumeration: %s\n", f.lookup.name);
          printf("                  Range: 0..%" PRIu64 "\n", maxValue);
          (f.lookup.function.tripletEnumerator)(explainTripletText);
          break;
        }

        case LOOKUP_TYPE_BIT: {
          uint64_t maxValue = f.size;

          printf("                  BitEnumeration: %s\n", f.lookup.name);
          printf("                  BitRange: 0..%" PRIu64 "\n", maxValue);
          (f.lookup.function.bitEnumerator)(explainBitText);
          break;
        }

        case LOOKUP_TYPE_FIELDTYPE: {
          printf("                  Enumeration: %s\n", f.lookup.name);
          if (!(f.unit && f.unit[0] == '='))
          {
            uint64_t maxValue = (UINT64_C(1) << f.size) - 1;
            printf("                  Range: 0..%" PRIu64 "\n", maxValue);
            (f.lookup.function.fieldtypeEnumerator)(explainFieldtypeText);
          }
          break;
        }

        default:
          break;
      }
    }
  }

  printf("\n\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
leaq 0x10(%rbp), %rax
movq %rax, -0xe0(%rbp)
movl 0x8(%rax), %esi
movl 0x8(%rax), %edx
movl 0x8(%rax), %ecx
movq (%rax), %r8
leaq 0x18f73(%rip), %rdi     # 0x2799c
movb $0x0, %al
callq 0xd0f0
movq -0xe0(%rbp), %rax
cmpq $0x0, 0x15d8(%rax)
je 0xea5d
movq -0xe0(%rbp), %rax
movq 0x15d8(%rax), %rsi
leaq 0x18f63(%rip), %rdi     # 0x279b9
movb $0x0, %al
callq 0xd0f0
movq -0xe0(%rbp), %rax
cmpq $0x0, 0x15e0(%rax)
je 0xea8a
movq -0xe0(%rbp), %rax
movq 0x15e0(%rax), %rsi
leaq 0x18f3f(%rip), %rdi     # 0x279c2
movb $0x0, %al
callq 0xd0f0
movq -0xe0(%rbp), %rdi
leaq -0x9(%rbp), %rsi
callq 0xf120
movl %eax, -0x8(%rbp)
testb $0x1, -0x9(%rbp)
je 0xeab6
movl -0x8(%rbp), %esi
leaq 0x18f23(%rip), %rdi     # 0x279d0
movb $0x0, %al
callq 0xd0f0
jmp 0xeac7
movl -0x8(%rbp), %esi
leaq 0x18f43(%rip), %rdi     # 0x27a03
movb $0x0, %al
callq 0xd0f0
movq -0xe0(%rbp), %rax
movzbl 0x15eb(%rax), %eax
cmpl $0x0, %eax
jle 0xeb52
movq -0xe0(%rbp), %rax
movzbl 0x15ef(%rax), %eax
cmpl $0xff, %eax
jge 0xeb24
movq -0xe0(%rbp), %rax
movzbl 0x15ed(%rax), %esi
movzbl 0x15ed(%rax), %edx
movzbl 0x15eb(%rax), %ecx
addl %ecx, %edx
movzbl 0x15ef(%rax), %ecx
leaq 0x18f05(%rip), %rdi     # 0x27a20
movb $0x0, %al
callq 0xd0f0
jmp 0xeb50
movq -0xe0(%rbp), %rax
movzbl 0x15ed(%rax), %esi
movzbl 0x15ed(%rax), %edx
movzbl 0x15eb(%rax), %eax
addl %eax, %edx
leaq 0x18f2c(%rip), %rdi     # 0x27a75
movb $0x0, %al
callq 0xd0f0
jmp 0xeb52
movq -0xe0(%rbp), %rax
movzbl 0x15ec(%rax), %eax
cmpl $0x0, %eax
jle 0xebdd
movq -0xe0(%rbp), %rax
movzbl 0x15f0(%rax), %eax
cmpl $0xff, %eax
jge 0xebaf
movq -0xe0(%rbp), %rax
movzbl 0x15ee(%rax), %esi
movzbl 0x15ee(%rax), %edx
movzbl 0x15ec(%rax), %ecx
addl %ecx, %edx
movzbl 0x15f0(%rax), %ecx
leaq 0x18e7a(%rip), %rdi     # 0x27a20
movb $0x0, %al
callq 0xd0f0
jmp 0xebdb
movq -0xe0(%rbp), %rax
movzbl 0x15ee(%rax), %esi
movzbl 0x15ee(%rax), %edx
movzbl 0x15ec(%rax), %eax
addl %eax, %edx
leaq 0x18ea1(%rip), %rdi     # 0x27a75
movb $0x0, %al
callq 0xd0f0
jmp 0xebdd
movq -0xe0(%rbp), %rax
movzwl 0x15e8(%rax), %eax
cmpl $0x0, %eax
je 0xec21
movq -0xe0(%rbp), %rax
movzwl 0x15e8(%rax), %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jge 0xec21
movq -0xe0(%rbp), %rax
movzwl 0x15e8(%rax), %esi
leaq 0x18ea3(%rip), %rdi     # 0x27abd
movb $0x0, %al
callq 0xd0f0
movq -0xe0(%rbp), %rax
movzwl 0x15e8(%rax), %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0xec44
leaq 0x18eb2(%rip), %rdi     # 0x27aef
movb $0x0, %al
callq 0xd0f0
movq -0xe0(%rbp), %rax
movzbl 0x15ea(%rax), %eax
cmpl $0x0, %eax
je 0xec73
movq -0xe0(%rbp), %rax
movzbl 0x15ea(%rax), %esi
leaq 0x18ec4(%rip), %rdi     # 0x27b30
movb $0x0, %al
callq 0xd0f0
movl $0x0, -0x4(%rbp)
movslq -0x4(%rbp), %rcx
xorl %eax, %eax
cmpq $0x21, %rcx
movb %al, -0xe1(%rbp)
jae 0xecb2
movq -0xe0(%rbp), %rax
addq $0x18, %rax
movslq -0x4(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
setne %al
movb %al, -0xe1(%rbp)
movb -0xe1(%rbp), %al
testb $0x1, %al
jne 0xecc1
jmp 0xf0ff
movq -0xe0(%rbp), %rsi
addq $0x18, %rsi
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rax
addq %rax, %rsi
leaq -0xb8(%rbp), %rdi
movl $0xa8, %edx
callq 0xd1d0
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf4(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xb8(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xe2(%rbp)
je 0xed67
xorl %eax, %eax
cmpq $0x0, -0x98(%rbp)
movb %al, -0xf5(%rbp)
je 0xed5b
movq -0x98(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xf5(%rbp)
je 0xed5b
movq -0x98(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
setne %al
movb %al, -0xf5(%rbp)
movb -0xf5(%rbp), %al
movb %al, -0xe2(%rbp)
movb -0xe2(%rbp), %dl
leaq 0x18be1(%rip), %rax     # 0x27955
leaq 0x18deb(%rip), %rcx     # 0x27b66
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x100(%rbp)
cmpq $0x0, -0x98(%rbp)
je 0xeda2
movq -0x98(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
jne 0xedb2
leaq 0x18bac(%rip), %rax     # 0x27955
movq %rax, -0x108(%rbp)
jmp 0xedc0
movq -0x98(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x100(%rbp), %rcx
movq -0xf0(%rbp), %rdx
movl -0xf4(%rbp), %esi
movq -0x108(%rbp), %r8
leaq 0x18d6f(%rip), %rdi     # 0x27b51
movb $0x0, %al
callq 0xd0f0
cmpl $0x0, -0xa8(%rbp)
jne 0xee02
leaq 0x18d71(%rip), %rdi     # 0x27b6a
movb $0x0, %al
callq 0xd0f0
jmp 0xee16
movl -0xa8(%rbp), %esi
leaq 0x18d7d(%rip), %rdi     # 0x27b8c
movb $0x0, %al
callq 0xd0f0
cmpq $0x0, -0xa0(%rbp)
je 0xee4a
movq -0xa0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3d, %eax
jne 0xee4a
movq -0xa0(%rbp), %rsi
addq $0x1, %rsi
leaq 0x18d67(%rip), %rdi     # 0x27ba8
movb $0x0, %al
callq 0xd0f0
jmp 0xee7a
cmpq $0x0, -0xa0(%rbp)
je 0xee78
movq -0xa0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
je 0xee78
movq -0xa0(%rbp), %rsi
leaq 0x18d54(%rip), %rdi     # 0x27bc5
movb $0x0, %al
callq 0xd0f0
jmp 0xee7a
movsd -0x88(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xee8f
jp 0xee8f
jmp 0xeea5
movsd -0x88(%rbp), %xmm0
leaq 0x18d43(%rip), %rdi     # 0x27be1
movb $0x1, %al
callq 0xd0f0
movb -0x6f(%rbp), %cl
leaq 0x18d77(%rip), %rsi     # 0x27c26
leaq 0x18d6b(%rip), %rax     # 0x27c21
testb $0x1, %cl
cmovneq %rax, %rsi
leaq 0x18d3f(%rip), %rdi     # 0x27c03
movb $0x0, %al
callq 0xd0f0
cmpl $0x0, -0x90(%rbp)
je 0xef3c
movsd -0x88(%rbp), %xmm0
movsd 0x154b4(%rip), %xmm1    # 0x24398
ucomisd %xmm1, %xmm0
jne 0xeeee
jp 0xeeee
jmp 0xef01
movsd -0x88(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xef17
jp 0xef17
movl -0x90(%rbp), %esi
leaq 0x18d1e(%rip), %rdi     # 0x27c2c
movb $0x0, %al
callq 0xd0f0
jmp 0xef3a
cvtsi2sdl -0x90(%rbp), %xmm0
mulsd -0x88(%rbp), %xmm0
cvttsd2si %xmm0, %rsi
leaq 0x18d17(%rip), %rdi     # 0x27c4a
movb $0x0, %al
callq 0xd0f0
jmp 0xef3c
testb $0x1, -0x6e(%rbp)
je 0xef50
leaq 0x18d20(%rip), %rdi     # 0x27c69
movb $0x0, %al
callq 0xd0f0
cmpq $0x0, -0x48(%rbp)
je 0xf0ef
movl -0x50(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x110(%rbp)
subl $0x3, %eax
ja 0xf0eb
movq -0x110(%rbp), %rax
leaq 0x15420(%rip), %rcx     # 0x243a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x58(%rbp), %rsi
leaq 0x18d02(%rip), %rdi     # 0x27c96
movb $0x0, %al
callq 0xd0f0
cmpq $0x0, -0xa0(%rbp)
je 0xefb4
movq -0xa0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3d, %eax
je 0xefee
movl -0xa8(%rbp), %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
subq $0x1, %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rsi
leaq 0x18cdc(%rip), %rdi     # 0x27cb9
movb $0x0, %al
callq 0xd0f0
leaq 0x2a5(%rip), %rdi       # 0xf290
callq *-0x48(%rbp)
jmp 0xf0ed
movl -0xa8(%rbp), %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
subq $0x1, %rax
movq %rax, -0xc8(%rbp)
movq -0x58(%rbp), %rsi
leaq 0x18cc1(%rip), %rdi     # 0x27cda
movb $0x0, %al
callq 0xd0f0
movq -0xc8(%rbp), %rsi
leaq 0x18c8b(%rip), %rdi     # 0x27cb9
movb $0x0, %al
callq 0xd0f0
leaq 0x284(%rip), %rdi       # 0xf2c0
callq *-0x48(%rbp)
jmp 0xf0ed
movl -0xa8(%rbp), %eax
movq %rax, -0xd0(%rbp)
movq -0x58(%rbp), %rsi
leaq 0x18ca9(%rip), %rdi     # 0x27d05
movb $0x0, %al
callq 0xd0f0
movq -0xd0(%rbp), %rsi
leaq 0x18cba(%rip), %rdi     # 0x27d2b
movb $0x0, %al
callq 0xd0f0
leaq 0x281(%rip), %rdi       # 0xf300
callq *-0x48(%rbp)
jmp 0xf0ed
movq -0x58(%rbp), %rsi
leaq 0x18c07(%rip), %rdi     # 0x27c96
movb $0x0, %al
callq 0xd0f0
cmpq $0x0, -0xa0(%rbp)
je 0xf0af
movq -0xa0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3d, %eax
je 0xf0e9
movl -0xa8(%rbp), %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
subq $0x1, %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rsi
leaq 0x18be1(%rip), %rdi     # 0x27cb9
movb $0x0, %al
callq 0xd0f0
leaq 0x24a(%rip), %rdi       # 0xf330
callq *-0x48(%rbp)
jmp 0xf0ed
jmp 0xf0ed
jmp 0xf0ef
jmp 0xf0f1
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0xec7a
leaq 0x1884d(%rip), %rdi     # 0x27953
movb $0x0, %al
callq 0xd0f0
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)