// File: /workspace/github_c_makefile_star2_O2/canboat[P]canboat/analyzer/print.c
// Function: fieldPrintLatLon
extern bool fieldPrintLatLon(const Field   *field,
                             const char    *fieldName,
                             const uint8_t *data,
                             size_t         dataLen,
                             size_t         startBit,
                             size_t        *bits)
{
  uint64_t absVal;
  int64_t  value;
  int64_t  maxValue;
  bool     isLongitude = (strstr(fieldName, "ongit") != NULL);
  double   dd;
  double   degrees;
  double   remainder;
  double   minutes;
  double   seconds;

  logDebug("fieldPrintLatLon for '%s' startbit=%zu bits=%zu\n", fieldName, startBit, *bits);

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

  absVal = (value < 0) ? -value : value;
  dd     = (double) value * field->resolution;

  if (showGeo == GEO_DD)
  {
    mprintf("%10.7f", dd);
  }
  else
  {
    if (showJsonValue)
    {
      mprintf("%" PRId64 ",\"name\":", value);
    }
    if (showGeo == GEO_DM)
    {
      dd        = (double) absVal * field->resolution;
      degrees   = floor(dd);
      remainder = dd - degrees;
      minutes   = remainder * 60.;

      mprintf((showJson ? "\"%02u&deg; %6.3f %c\"" : "%02ud %6.3f %c"),
              (uint32_t) degrees,
              minutes,
              (isLongitude ? ((value >= 0) ? 'E' : 'W') : ((value >= 0) ? 'N' : 'S')));
    }
    else
    {
      dd        = (double) absVal * field->resolution;
      degrees   = floor(dd);
      remainder = dd - degrees;
      minutes   = floor(remainder * 60.);
      seconds   = (remainder * 3600.) - 60. * minutes;

      if (seconds >= 59.9995)
      {
        minutes += 1.0;
        seconds = 0.0;
      }
      if (minutes >= 60.0)
      {
        degrees += 1.0;
        minutes = 0.0;
        seconds = 0.0;
      }

      mprintf((showJson ? "\"%02u&deg;%02u&rsquo;%06.3f&rdquo;%c\"" : "%02ud %02u' %06.3f\"%c"),
              (int) degrees,
              (int) minutes,
              seconds,
              (isLongitude ? ((value >= 0) ? 'E' : 'W') : ((value >= 0) ? 'N' : 'S')));
    }
    if (showJsonValue)
    {
      mprintf("}");
    }
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r12
movq %r8, %r14
movq %rcx, %r13
movq %rdx, %rbp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x1255f(%rip), %rsi     # 0x2c9ec
movq %rbx, %rdi
callq 0xd330
movq %rax, 0x8(%rsp)
movq (%r12), %rcx
leaq 0x1254d(%rip), %rdi     # 0x2c9f2
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1bd48
movq (%r12), %r9
leaq 0x20(%rsp), %rax
leaq 0x18(%rsp), %r10
movq %r15, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r13, %rcx
movq %r14, %r8
pushq %rax
pushq %r10
callq 0x196cf
popq %rcx
popq %rdx
testb %al, %al
je 0x1a6ae
movq 0x18(%rsp), %r14
movq %r14, %r12
negq %r12
cmovsq %r14, %r12
leaq 0x75201(%rip), %r13     # 0x8f6f8
movl (%r13), %ebp
testl %ebp, %ebp
je 0x1a5a2
leaq 0x751ea(%rip), %rbx     # 0x8f6f4
cmpb $0x1, (%rbx)
jne 0x1a524
leaq 0x125ab(%rip), %rdi     # 0x2cac1
movq %r14, %rsi
xorl %eax, %eax
callq 0x19194
movl (%r13), %ebp
cvtsi2sd %r12, %xmm0
mulsd 0x30(%r15), %xmm0
movsd %xmm0, (%rsp)
callq 0xd2b0
movsd (%rsp), %xmm2
movapd %xmm0, %xmm1
subsd %xmm0, %xmm2
movsd 0x1214a(%rip), %xmm0    # 0x2c698
mulsd %xmm2, %xmm0
cmpl $0x1, %ebp
jne 0x1a5c0
leaq 0x75194(%rip), %rax     # 0x8f6f2
leaq 0x124c5(%rip), %rcx     # 0x2ca2a
cmpb $0x0, (%rax)
leaq 0x124d0(%rip), %rdi     # 0x2ca3f
cmovneq %rcx, %rdi
testq %r14, %r14
pushq $0x45
popq %rax
pushq $0x57
popq %rcx
cmovnsl %eax, %ecx
shrq $0x3f, %r14
cvttsd2si %xmm1, %rsi
cmpq $0x0, 0x8(%rsp)
leal 0x4e(%r14,%r14,4), %edx
cmovnel %ecx, %edx
movb $0x1, %al
callq 0x19194
jmp 0x1a69b
cvtsi2sd %r14, %xmm0
mulsd 0x30(%r15), %xmm0
leaq 0x1246f(%rip), %rdi     # 0x2ca23
movb $0x1, %al
callq 0x19194
jmp 0x1a6ae
movsd %xmm1, 0x10(%rsp)
movsd %xmm2, (%rsp)
callq 0xd2b0
movsd (%rsp), %xmm6
movsd 0x10(%rsp), %xmm5
movsd 0x120bd(%rip), %xmm1    # 0x2c6a0
mulsd %xmm0, %xmm1
mulsd 0x120b9(%rip), %xmm6    # 0x2c6a8
addsd %xmm1, %xmm6
movsd 0x4d9d(%rip), %xmm4     # 0x1f398
movsd 0x120ad(%rip), %xmm3    # 0x2c6b0
movapd %xmm3, %xmm1
cmpnlesd %xmm6, %xmm1
movapd %xmm1, %xmm2
andpd %xmm0, %xmm1
addsd %xmm4, %xmm0
andnpd %xmm0, %xmm2
orpd %xmm2, %xmm1
movsd 0x12070(%rip), %xmm2    # 0x2c698
ucomisd %xmm2, %xmm1
jb 0x1a632
addsd %xmm4, %xmm5
movapd %xmm6, %xmm0
jb 0x1a63c
xorpd %xmm0, %xmm0
ucomisd %xmm3, %xmm6
jb 0x1a646
xorpd %xmm0, %xmm0
leaq 0x750a5(%rip), %rax     # 0x8f6f2
leaq 0x123fa(%rip), %rcx     # 0x2ca4e
cmpb $0x0, (%rax)
leaq 0x12416(%rip), %rdi     # 0x2ca74
cmovneq %rcx, %rdi
testq %r14, %r14
pushq $0x45
popq %rax
pushq $0x57
popq %r8
cmovnsl %eax, %r8d
shrq $0x3f, %r14
cmpnlesd %xmm1, %xmm2
andpd %xmm1, %xmm2
cvttsd2si %xmm5, %esi
cvttsd2si %xmm2, %edx
cmpq $0x0, 0x8(%rsp)
leal 0x4e(%r14,%r14,4), %ecx
cmovnel %r8d, %ecx
movb $0x1, %al
callq 0x19194
cmpb $0x1, (%rbx)
jne 0x1a6ae
leaq 0x12312(%rip), %rdi     # 0x2c9b9
xorl %eax, %eax
callq 0x19194
movb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq