// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/analyzer/print.c
// Function: fieldPrintTime
extern bool fieldPrintTime(const Field   *field,
                           const char    *fieldName,
                           const uint8_t *data,
                           size_t         dataLen,
                           size_t         startBit,
                           size_t        *bits)
{
  uint64_t unitspersecond;
  uint32_t hours;
  uint32_t minutes;
  uint32_t seconds;
  uint32_t fraction;
  int64_t  value;
  int64_t  maxValue;
  uint64_t t;
  int      digits;

  const char *sign = "";

  if (!extractNumberNotEmpty(field, fieldName, data, dataLen, startBit, *bits, &value, &maxValue))
  {
    return true;
  }

  logDebug("fieldPrintTime(<%s>, \"%s\") v=%" PRId64 " res=%g max=0x%" PRIx64 "\n",
           field->name,
           fieldName,
           value,
           field->resolution,
           maxValue);

  if (value < 0)
  {
    value = -value;
    sign  = "-";
  }

  if (field->resolution < 1.0)
  {
    unitspersecond = (uint64_t) (1.0 / field->resolution);
  }
  else
  {
    unitspersecond = 1;
    value *= (int64_t) field->resolution;
  }

  t        = (uint64_t) value;
  seconds  = t / unitspersecond;
  fraction = t % unitspersecond;
  minutes  = seconds / 60;
  seconds  = seconds % 60;
  hours    = minutes / 60;
  minutes  = minutes % 60;

  digits = log10(unitspersecond);

  if (showJson)
  {
    if (showJsonValue)
    {
      mprintf("%s%" PRId64 ",\"name\":", sign, value);
    }
    if (fraction != 0)
    {
      mprintf("\"%s%02u:%02u:%02u.%0*u\"", sign, hours, minutes, seconds, digits, fraction);
    }
    else
    {
      mprintf("\"%s%02u:%02u:%02u\"", sign, hours, minutes, seconds);
    }
    if (showJsonValue)
    {
      mprintf("}");
    }
  }
  else
  {
    if (fraction)
    {
      mprintf("%s%02u:%02u:%02u.%0*u", sign, hours, minutes, seconds, digits, fraction);
    }
    else
    {
      mprintf("%s%02u:%02u:%02u", sign, hours, minutes, seconds);
    }
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %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)
leaq 0xa9ab(%rip), %rax      # 0x27955
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %rax
movq (%rax), %r9
leaq -0x58(%rbp), %r10
leaq -0x60(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1b770
testb $0x1, %al
jne 0x1cfec
movb $0x1, -0x1(%rbp)
jmp 0x1d23b
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq -0x10(%rbp), %rax
movsd 0x30(%rax), %xmm0
movq -0x60(%rbp), %r8
leaq 0x13ed3(%rip), %rdi     # 0x30ee2
movb $0x1, %al
callq 0x1f670
cmpq $0x0, -0x58(%rbp)
jge 0x1d032
xorl %eax, %eax
subq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq 0x13ee7(%rip), %rax     # 0x30f15
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movsd 0x735a(%rip), %xmm0     # 0x24398
ucomisd 0x30(%rax), %xmm0
jbe 0x1d086
movq -0x10(%rbp), %rax
movsd 0x30(%rax), %xmm1
movsd 0x7342(%rip), %xmm0     # 0x24398
divsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x13abf(%rip), %xmm1    # 0x30b30
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x40(%rbp)
jmp 0x1d0a1
movq $0x1, -0x40(%rbp)
movq -0x10(%rbp), %rax
cvttsd2si 0x30(%rax), %rax
imulq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq -0x40(%rbp), %rcx
xorl %edx, %edx
movq %rdx, -0x80(%rbp)
divq %rcx
movq -0x80(%rbp), %rdx
movl %eax, -0x4c(%rbp)
movq -0x68(%rbp), %rax
movq -0x40(%rbp), %rcx
divq %rcx
movl %edx, %eax
movl %eax, -0x50(%rbp)
movl -0x4c(%rbp), %eax
movl $0x88888889, %edx       # imm = 0x88888889
imulq %rdx, %rax
shrq $0x25, %rax
movl %eax, -0x48(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, %ecx
movl %ecx, %eax
imulq %rdx, %rcx
shrq $0x25, %rcx
imull $0x3c, %ecx, %ecx
subl %ecx, %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %eax
imulq %rdx, %rax
shrq $0x25, %rax
movl %eax, -0x44(%rbp)
movl -0x48(%rbp), %eax
movl %eax, %ecx
movl %ecx, %eax
imulq %rdx, %rcx
shrq $0x25, %rcx
imull $0x3c, %ecx, %ecx
subl %ecx, %eax
movl %eax, -0x48(%rbp)
movaps 0x7329(%rip), %xmm1     # 0x24450
movq -0x40(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x7328(%rip), %xmm1     # 0x24460
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
callq 0xd1a0
cvttsd2si %xmm0, %eax
movl %eax, -0x6c(%rbp)
leaq 0x74518(%rip), %rax     # 0x91672
testb $0x1, (%rax)
je 0x1d1eb
leaq 0x7450a(%rip), %rax     # 0x91674
testb $0x1, (%rax)
je 0x1d185
movq -0x78(%rbp), %rsi
movq -0x58(%rbp), %rdx
leaq 0x13d99(%rip), %rdi     # 0x30f17
movb $0x0, %al
callq 0x1ade0
cmpl $0x0, -0x50(%rbp)
je 0x1d1b3
movq -0x78(%rbp), %rsi
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %ecx
movl -0x4c(%rbp), %r8d
movl -0x6c(%rbp), %r9d
movl -0x50(%rbp), %eax
leaq 0x13d7e(%rip), %rdi     # 0x30f25
movl %eax, (%rsp)
movb $0x0, %al
callq 0x1ade0
jmp 0x1d1cf
movq -0x78(%rbp), %rsi
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %ecx
movl -0x4c(%rbp), %r8d
leaq 0x13d75(%rip), %rdi     # 0x30f3d
movb $0x0, %al
callq 0x1ade0
leaq 0x7449e(%rip), %rax     # 0x91674
testb $0x1, (%rax)
je 0x1d1e9
leaq 0x13c2f(%rip), %rdi     # 0x30e11
movb $0x0, %al
callq 0x1ade0
jmp 0x1d237
cmpl $0x0, -0x50(%rbp)
je 0x1d219
movq -0x78(%rbp), %rsi
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %ecx
movl -0x4c(%rbp), %r8d
movl -0x6c(%rbp), %r9d
movl -0x50(%rbp), %eax
leaq 0x13d43(%rip), %rdi     # 0x30f50
movl %eax, (%rsp)
movb $0x0, %al
callq 0x1ade0
jmp 0x1d235
movq -0x78(%rbp), %rsi
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %ecx
movl -0x4c(%rbp), %r8d
leaq 0x13d38(%rip), %rdi     # 0x30f66
movb $0x0, %al
callq 0x1ade0
jmp 0x1d237
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)