// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/analyzer/analyzer.c
// Function: printField
static bool printField(const Field   *field,
                       const char    *fieldName,
                       const uint8_t *data,
                       size_t         dataLen,
                       size_t         startBit,
                       size_t        *bits,
                       bool           allowKey)
{
  size_t bytes;
  double resolution;
  bool   r;

  if (fieldName == NULL)
  {
    fieldName = field->camelName ? field->camelName : (char *) field->name;
  }

  resolution = field->resolution;
  if (resolution == 0.0)
  {
    resolution = field->ft->resolution;
  }

  logDebug("PGN %u: printField(<%s>, \"%s\", ..., dataLen=%zu, data=%p, startBit=%zu) resolution=%g\n",
           field->pgn->pgn,
           field->name,
           fieldName,
           dataLen,
           data,
           startBit,
           field->resolution);

  if (field->size != 0 || field->ft != NULL)
  {
    *bits = (field->size != 0) ? field->size : field->ft->size;
    bytes = (*bits + 7) / 8;
    bytes = min(bytes, dataLen - startBit / 8);
    *bits = min(bytes * 8, *bits);
  }
  else
  {
    bytes = 0;
    *bits = 0;
  }

  fillGlobalsBasedOnFieldName(field->name, data, dataLen, startBit, *bits);

  logDebug("PGN %u: printField <%s>, \"%s\": bits=%zu proprietary=%u refPgn=%u\n",
           field->pgn->pgn,
           field->name,
           fieldName,
           *bits,
           field->proprietary,
           g_refPgn);

  if (field->proprietary)
  {
    if ((g_refPgn >= 65280 && g_refPgn <= 65535) || (g_refPgn >= 126720 && g_refPgn <= 126975)
        || (g_refPgn >= 130816 && g_refPgn <= 131071))
    {
      // proprietary, allow field
    }
    else
    {
      // standard PGN, skip field
      *bits = 0;
      return true;
    }
  }

  if (field->ft != NULL && field->ft->pf != NULL)
  {
    size_t location            = mlocation();
    char  *oldSep              = sep;
    size_t oldClosingBracesLen = strlen(closingBraces);
    size_t location2           = 0;
    size_t location3;

    if (field->ft->pf != fieldPrintVariable)
    {
      if (showJson)
      {
        mprintf("%s\"%s\":", getSep(), fieldName);
        sep = ",";
        if (showBytes || showJsonValue)
        {
          location2 = mlocation();
        }
      }
      else
      {
        mprintf("%s %s = ", getSep(), fieldName);
        sep = ";";
      }
    }
    location3 = mlocation();
    logDebug(
        "PGN %u: printField <%s>, \"%s\": calling function for %s\n", field->pgn->pgn, field->name, fieldName, field->fieldType);
    g_skip = false;
    r      = (field->ft->pf)(field, fieldName, data, dataLen, startBit, bits);
    // if match fails, r == false. If field is not printed, g_skip == true
    logDebug("PGN %u: printField <%s>, \"%s\": result %d bits=%zu\n", field->pgn->pgn, field->name, fieldName, r, *bits);
    if (r && !g_skip)
    {
      if (location3 == mlocation() && !showBytes)
      {
        logError("PGN %u: field \"%s\" print routine did not print anything\n", field->pgn->pgn, field->name);
        r = false;
      }
      else if (field->ft->pf != fieldPrintVariable)
      {
        location3     = mlocation();
        bool endQuote = mchr(location3 - 1) == '}';
        if (endQuote)
        {
          mset(location3 - 1);
          location3--;
        }
        if (showBytes)
        {
          showBytesOrBits(data + (startBit >> 3), startBit & 7, *bits);
          if (showJson)
          {
            endQuote = true;
          }
        }
        if (showJsonValue && field->partOfPrimaryKey && allowKey)
        {
          mprintf(",\"key\":true");
          endQuote = true;
        }
        if (endQuote)
        {
          mprintf("}");
        }
      }
      if (location2 != 0)
      {
        location3 = mlocation();
        if (mchr(location3 - 1) == '}')
        {
          // Prepend {"value":
          minsert(location2, "{\"value\":");
        }
      }
    }
    if (!r || g_skip)
    {
      mset(location);
      sep                                = oldSep;
      closingBraces[oldClosingBracesLen] = '\0';
    }
    return r;
  }
  logError("PGN %u: no function found to print field '%s'\n", field->pgn->pgn, fieldName);
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movb 0x10(%rbp), %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
andb $0x1, %al
movb %al, -0x39(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xe367
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0xe34e
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x90(%rbp)
jmp 0xe35c
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movsd 0x30(%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xe39a
jp 0xe39a
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
movsd 0x58(%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movl 0x8(%rax), %esi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x20(%rbp), %r9
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rdi
movsd 0x30(%rdi), %xmm0
leaq 0x1c21a(%rip), %rdi     # 0x2a5e9
movq %rax, (%rsp)
movb $0x1, %al
callq 0x22570
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0xe3f6
movq -0x10(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0xe4cd
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0xe40f
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x94(%rbp)
jmp 0xe423
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
movl 0x28(%rax), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rax
addq $0x7, %rax
shrq $0x3, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rdx
shrq $0x3, %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
ja 0xe46c
movq -0x48(%rbp), %rax
movq %rax, -0xa0(%rbp)
jmp 0xe482
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
shrq $0x3, %rcx
subq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
shlq $0x3, %rax
movq -0x38(%rbp), %rcx
cmpq (%rcx), %rax
ja 0xe4af
movq -0x48(%rbp), %rax
shlq $0x3, %rax
movq %rax, -0xa8(%rbp)
jmp 0xe4bd
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0xe4e0
movq $0x0, -0x48(%rbp)
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq (%rax), %r8
callq 0xea40
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movl 0x8(%rax), %esi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
movq (%rax), %r8
movq -0x10(%rbp), %rax
movb 0x48(%rax), %al
andb $0x1, %al
movzbl %al, %r9d
movl 0x85e46(%rip), %eax     # 0x94378
leaq 0x1c107(%rip), %rdi     # 0x2a640
movl %eax, (%rsp)
movb $0x0, %al
callq 0x22570
movq -0x10(%rbp), %rax
testb $0x1, 0x48(%rax)
je 0xe5ad
cmpl $0xff00, 0x85e21(%rip)  # imm = 0xFF00
jb 0xe565
cmpl $0xffff, 0x85e15(%rip)  # imm = 0xFFFF
jbe 0xe595
cmpl $0x1ef00, 0x85e09(%rip) # imm = 0x1EF00
jb 0xe57d
cmpl $0x1efff, 0x85dfd(%rip) # imm = 0x1EFFF
jbe 0xe595
cmpl $0x1ff00, 0x85df1(%rip) # imm = 0x1FF00
jb 0xe597
cmpl $0x1ffff, 0x85de5(%rip) # imm = 0x1FFFF
ja 0xe597
jmp 0xe5ab
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0xe92e
jmp 0xe5ad
movq -0x10(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0xe90a
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
cmpq $0x0, 0x78(%rax)
je 0xe90a
callq 0x1df10
movq %rax, -0x60(%rbp)
movq 0x7fbdb(%rip), %rax     # 0x8e1c0
movq %rax, -0x68(%rbp)
leaq 0x85d70(%rip), %rdi     # 0x94360
callq 0xb0d0
movq %rax, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
leaq 0x32d(%rip), %rcx       # 0xe940
cmpq %rcx, 0x78(%rax)
je 0xe691
testb $0x1, 0x85d28(%rip)     # 0x94348
je 0xe667
callq 0x1df30
movq %rax, %rsi
movq -0x18(%rbp), %rdx
leaq 0x1c04d(%rip), %rdi     # 0x2a682
movb $0x0, %al
callq 0x1dce0
leaq 0x2cd1d(%rip), %rax     # 0x3b360
movq %rax, 0x7fb76(%rip)     # 0x8e1c0
testb $0x1, 0x85cf5(%rip)     # 0x94346
jne 0xe65c
testb $0x1, 0x85cf0(%rip)     # 0x9434a
je 0xe665
callq 0x1df10
movq %rax, -0x78(%rbp)
jmp 0xe68f
callq 0x1df30
movq %rax, %rsi
movq -0x18(%rbp), %rdx
leaq 0x1c010(%rip), %rdi     # 0x2a68a
movb $0x0, %al
callq 0x1dce0
leaq 0x1c00b(%rip), %rax     # 0x2a693
movq %rax, 0x7fb31(%rip)     # 0x8e1c0
jmp 0xe691
callq 0x1df10
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movl 0x8(%rax), %esi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %r8
leaq 0x1bfd3(%rip), %rdi     # 0x2a695
movb $0x0, %al
callq 0x22570
leaq 0x92e40(%rip), %rax     # 0xa1510
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
movq 0x78(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq *%rax
andb $0x1, %al
movb %al, -0x51(%rbp)
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movl 0x8(%rax), %esi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rcx
movb -0x51(%rbp), %al
andb $0x1, %al
movzbl %al, %r8d
movq -0x38(%rbp), %rax
movq (%rax), %r9
leaq 0x1bf9c(%rip), %rdi     # 0x2a6cd
movb $0x0, %al
callq 0x22570
testb $0x1, -0x51(%rbp)
je 0xe8cb
leaq 0x92dc7(%rip), %rax     # 0xa1510
testb $0x1, (%rax)
jne 0xe8cb
movq -0x80(%rbp), %rax
movq %rax, -0xb0(%rbp)
callq 0x1df10
movq %rax, %rcx
movq -0xb0(%rbp), %rax
cmpq %rcx, %rax
jne 0xe7a6
testb $0x1, 0x85bce(%rip)     # 0x94346
jne 0xe7a6
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movl 0x8(%rax), %esi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x1bf6a(%rip), %rdi     # 0x2a700
movb $0x0, %al
callq 0x22620
movb $0x0, -0x51(%rbp)
jmp 0xe892
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
leaq 0x188(%rip), %rcx       # 0xe940
cmpq %rcx, 0x78(%rax)
je 0xe890
callq 0x1df10
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
subq $0x1, %rdi
callq 0x1de00
movsbl %al, %eax
cmpl $0x7d, %eax
sete %al
andb $0x1, %al
movb %al, -0x81(%rbp)
testb $0x1, -0x81(%rbp)
je 0xe80b
movq -0x80(%rbp), %rdi
subq $0x1, %rdi
callq 0x1dde0
movq -0x80(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x80(%rbp)
testb $0x1, 0x85b34(%rip)     # 0x94346
je 0xe849
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
shrq $0x3, %rax
addq %rax, %rdi
movq -0x30(%rbp), %rsi
andq $0x7, %rsi
movq -0x38(%rbp), %rax
movq (%rax), %rdx
callq 0xeb20
testb $0x1, 0x85b0a(%rip)     # 0x94348
je 0xe847
movb $0x1, -0x81(%rbp)
jmp 0xe849
testb $0x1, 0x85afa(%rip)     # 0x9434a
je 0xe877
movq -0x10(%rbp), %rax
testb $0x1, 0x4a(%rax)
je 0xe877
testb $0x1, -0x39(%rbp)
je 0xe877
leaq 0x1bed0(%rip), %rdi     # 0x2a739
movb $0x0, %al
callq 0x1dce0
movb $0x1, -0x81(%rbp)
testb $0x1, -0x81(%rbp)
je 0xe88e
leaq 0x277b5(%rip), %rdi     # 0x3603c
movb $0x0, %al
callq 0x1dce0
jmp 0xe890
jmp 0xe892
cmpq $0x0, -0x78(%rbp)
je 0xe8c9
callq 0x1df10
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
subq $0x1, %rdi
callq 0x1de00
movsbl %al, %eax
cmpl $0x7d, %eax
jne 0xe8c7
movq -0x78(%rbp), %rdi
leaq 0x1be83(%rip), %rsi     # 0x2a745
callq 0x1de20
jmp 0xe8c9
jmp 0xe8cb
testb $0x1, -0x51(%rbp)
je 0xe8dd
leaq 0x92c38(%rip), %rax     # 0xa1510
testb $0x1, (%rax)
je 0xe900
movq -0x60(%rbp), %rdi
callq 0x1dde0
movq -0x68(%rbp), %rax
movq %rax, 0x7f8cf(%rip)     # 0x8e1c0
movq -0x70(%rbp), %rcx
leaq 0x85a64(%rip), %rax     # 0x94360
movb $0x0, (%rax,%rcx)
movb -0x51(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0xe92e
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movl 0x8(%rax), %esi
movq -0x18(%rbp), %rdx
leaq 0x1be2c(%rip), %rdi     # 0x2a74f
movb $0x0, %al
callq 0x22620
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)