// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/analyzer/print.c
// Function: fieldPrintDecimal
extern bool fieldPrintDecimal(const Field   *field,
                              const char    *fieldName,
                              const uint8_t *data,
                              size_t         dataLen,
                              size_t         startBit,
                              size_t        *bits)
{
  uint8_t  value = 0;
  uint8_t  bitMask;
  uint64_t bitMagnitude = 1;
  size_t   bit;
  char     buf[128];

  if (!adjustDataLenStart(&data, &dataLen, &startBit))
  {
    return false;
  }

  bitMask = 1 << startBit;

  if (startBit + *bits > dataLen * 8)
  {
    *bits = dataLen * 8 - startBit;
  }

  for (bit = 0; bit < *bits && bit < sizeof(buf) * 8; bit++)
  {
    /* Act on the current bit */
    bool bitIsSet = (*data & bitMask) > 0;
    if (bitIsSet)
    {
      value |= bitMagnitude;
    }

    /* Find the next bit */
    if (bitMask == 128)
    {
      bitMask = 1;
      data++;
    }
    else
    {
      bitMask = bitMask << 1;
    }
    bitMagnitude = bitMagnitude << 1;

    if (bit % 8 == 7)
    {
      if (value < 100)
      {
        mprintf("%02u", value);
      }
      value        = 0;
      bitMagnitude = 1;
    }
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movb $0x0, -0x39(%rbp)
movq $0x1, -0x48(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x1b0e0
testb $0x1, %al
jne 0x1bd3d
movb $0x0, -0x1(%rbp)
jmp 0x1be64
movq -0x30(%rbp), %rax
movl %eax, %ecx
movl $0x1, %eax
shll %cl, %eax
movb %al, -0x3a(%rbp)
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
addq (%rcx), %rax
movq -0x28(%rbp), %rcx
shlq $0x3, %rcx
cmpq %rcx, %rax
jbe 0x1bd78
movq -0x28(%rbp), %rcx
shlq $0x3, %rcx
subq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rcx
movq -0x38(%rbp), %rdx
xorl %eax, %eax
cmpq (%rdx), %rcx
movb %al, -0xd2(%rbp)
jae 0x1bda6
cmpq $0x400, -0x50(%rbp)     # imm = 0x400
setb %al
movb %al, -0xd2(%rbp)
movb -0xd2(%rbp), %al
testb $0x1, %al
jne 0x1bdb5
jmp 0x1be60
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movzbl -0x3a(%rbp), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
setg %al
andb $0x1, %al
movb %al, -0xd1(%rbp)
testb $0x1, -0xd1(%rbp)
je 0x1bde7
movq -0x48(%rbp), %rcx
movzbl -0x39(%rbp), %eax
orq %rcx, %rax
movb %al, -0x39(%rbp)
movzbl -0x3a(%rbp), %eax
cmpl $0x80, %eax
jne 0x1be04
movb $0x1, -0x3a(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1be0d
movzbl -0x3a(%rbp), %eax
shll %eax
movb %al, -0x3a(%rbp)
movq -0x48(%rbp), %rax
shlq %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
andq $0x7, %rax
cmpq $0x7, %rax
jne 0x1be4d
movzbl -0x39(%rbp), %eax
cmpl $0x64, %eax
jge 0x1be41
movzbl -0x39(%rbp), %esi
leaq 0x15138(%rip), %rdi     # 0x30f72
movb $0x0, %al
callq 0x1ade0
movb $0x0, -0x39(%rbp)
movq $0x1, -0x48(%rbp)
jmp 0x1be4f
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x1bd80
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)