// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/analyzer/fieldtype.c
// Function: getMaxRange
static double getMaxRange(const char *name, uint32_t size, double resolution, bool sign, int32_t offset, LookupInfo *lookup)
{
  uint64_t specialvalues = (size >= 8) ? 3 : (size >= 4) ? 2 : (size >= 2) ? 1 : 0;
  uint32_t highbit       = (sign && offset == 0) ? (size - 1) : size;
  uint64_t maxValue;
  double   r;

  maxValue = (UINT64_C(1) << highbit) - 1 - specialvalues;
  if (offset != 0)
  {
    maxValue += offset;
  }

#ifdef EXPLAIN
  if (lookup != NULL && lookup->type == LOOKUP_TYPE_PAIR)
  {
    // maybe the specialValues are actually lookups, correct these.
    // Remember, when EXPLAIN is set the lookup function is like:
    // void lookupYES_NO(EnumPairCallback cb)
    // {
    //   (cb)(0, "No");
    //   (cb)(1, "Yes");
    // }
    g_max = maxValue;
    (*lookup->function.pairEnumerator)(fillMaxRangeLookup);
    maxValue = g_max;
  }
#endif

  r = maxValue * resolution;
  logDebug(
      "%s bits=%llu sign=%u maxValue=%lld res=%g offset=%d -> rangeMax %g\n", name, highbit, sign, maxValue, resolution, offset, r);
  return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movsd %xmm0, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movl %ecx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
cmpl $0x8, -0xc(%rbp)
jb 0x1f0e2
movl $0x3, %eax
movl %eax, -0x4c(%rbp)
jmp 0x1f10b
cmpl $0x4, -0xc(%rbp)
jb 0x1f0f2
movl $0x2, %eax
movl %eax, -0x50(%rbp)
jmp 0x1f105
movl -0xc(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x2, %edx
cmovael %ecx, %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cltq
movq %rax, -0x30(%rbp)
testb $0x1, -0x19(%rbp)
je 0x1f12b
cmpl $0x0, -0x20(%rbp)
jne 0x1f12b
movl -0xc(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x1f131
movl -0xc(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
subq $0x1, %rax
subq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x1f162
movslq -0x20(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x1f197
movq -0x28(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x1f197
movq -0x40(%rbp), %rax
movq %rax, 0x74662(%rip)     # 0x937e0
movq -0x28(%rbp), %rax
leaq 0x1e7(%rip), %rdi       # 0x1f370
callq *0x10(%rax)
movq 0x7464d(%rip), %rax     # 0x937e0
movq %rax, -0x40(%rbp)
movaps 0x52b2(%rip), %xmm1     # 0x24450
movq -0x40(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x52b1(%rip), %xmm1     # 0x24460
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
mulsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x8(%rbp), %rsi
movl -0x34(%rbp), %edx
movb -0x19(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x40(%rbp), %r8
movsd -0x18(%rbp), %xmm0
movl -0x20(%rbp), %r9d
movsd -0x48(%rbp), %xmm1
leaq 0x169aa(%rip), %rdi     # 0x35b9a
movb $0x2, %al
callq 0x1f670
movsd -0x48(%rbp), %xmm0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)