// File: /workspace/github_c_makefile_star2_O0/canboat[P]canboat/n2kd/gps_ais.c
// Function: nmea0183GLL
extern void nmea0183GLL(StringBuffer *msg183, int src, const char *msg)
{
  char latString[LAT_LENGTH];
  char lonString[LON_LENGTH];

  if (getJSONValue(msg, "Latitude", latString, sizeof(latString)) && getJSONValue(msg, "Longitude", lonString, sizeof(lonString)))
  {
    char    dateString[OTHER_LENGTH] = "";
    char    timeString[OTHER_LENGTH] = "";
    char    sogString[OTHER_LENGTH]  = "";
    char    cogString[OTHER_LENGTH]  = "";
    char    latHemisphere;
    char    lonHemisphere;
    double  latitude  = convert2kCoordinateToNMEA0183(latString, "NS", &latHemisphere);
    double  longitude = convert2kCoordinateToNMEA0183(lonString, "EW", &lonHemisphere);
    int64_t date;

    if (getJSONInt64(msg, "Date", &date))
    {
      time_t     t  = date * 86400;
      struct tm *tm = gmtime(&t);

      snprintf(dateString, STRSIZE(dateString), "%02d%02d%02d", tm->tm_mday, tm->tm_mon + 1, tm->tm_year % 100);
    }

    if (getJSONLookupName(msg, "Time", timeString, sizeof(timeString)))
    {
      logDebug("Got time string '%s'\n", timeString);
      removeChar(timeString, ':');
      logDebug("Cleaned time string '%s'\n", timeString);
    }

    if (g_sog_cog_ts >= getNow() - 1000)
    {
      snprintf(sogString, STRSIZE(sogString), "%.2f", SPEED_M_S_TO_KNOTS(g_sog));
      snprintf(cogString, STRSIZE(cogString), "%.1f", g_cog);
    }

    nmea0183CreateMessage(msg183, src, "GLL,%.4f,%c,%.4f,%c,%s,A", latitude, latHemisphere, longitude, lonHemisphere, timeString);
    nmea0183CreateMessage(msg183,
                          src,
                          "RMC,%s,A,%.4f,%c,%.4f,%c,%s,%s,%s,,,A",
                          timeString,
                          latitude,
                          latHemisphere,
                          longitude,
                          lonHemisphere,
                          sogString,
                          cogString,
                          dateString);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x30(%rbp), %rdx
leaq 0x7264(%rip), %rsi      # 0xd169
movl $0x10, %ecx
callq 0xa660
testb $0x1, %al
jne 0x5f18
jmp 0x619c
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rdx
leaq 0x724b(%rip), %rsi      # 0xd172
movl $0x10, %ecx
callq 0xa660
testb $0x1, %al
jne 0x5f3a
jmp 0x619c
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0x2190
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0x2190
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0x2190
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0x2190
leaq -0x30(%rbp), %rdi
leaq 0x71f1(%rip), %rsi      # 0xd17c
leaq -0xc1(%rbp), %rdx
callq 0x61b0
movsd %xmm0, -0xd0(%rbp)
leaq -0x40(%rbp), %rdi
leaq 0x71d5(%rip), %rsi      # 0xd17f
leaq -0xc2(%rbp), %rdx
callq 0x61b0
movsd %xmm0, -0xd8(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x723e(%rip), %rsi      # 0xd207
leaq -0xe0(%rbp), %rdx
callq 0xad20
testb $0x1, %al
jne 0x5fdb
jmp 0x6045
imulq $0x15180, -0xe0(%rbp), %rax # imm = 0x15180
movq %rax, -0xe8(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x22d0
movq %rax, -0xf0(%rbp)
leaq -0x60(%rbp), %rdi
movq -0xf0(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0xf0(%rbp), %rax
movl 0x10(%rax), %r8d
addl $0x1, %r8d
movq -0xf0(%rbp), %rax
movl 0x14(%rax), %eax
movl $0x64, %esi
cltd
idivl %esi
movl %edx, %r9d
movl $0x13, %esi
leaq 0x7144(%rip), %rdx      # 0xd182
movb $0x0, %al
callq 0x2130
movq -0x18(%rbp), %rdi
leaq -0x80(%rbp), %rdx
leaq 0x71bc(%rip), %rsi      # 0xd210
movl $0x14, %ecx
callq 0xaaf0
testb $0x1, %al
jne 0x6064
jmp 0x6096
leaq -0x80(%rbp), %rsi
leaq 0x7120(%rip), %rdi      # 0xd18f
movb $0x0, %al
callq 0x9ae0
leaq -0x80(%rbp), %rdi
movl $0x3a, %esi
callq 0x6260
leaq -0x80(%rbp), %rsi
leaq 0x7116(%rip), %rdi      # 0xd1a5
movb $0x0, %al
callq 0x9ae0
movq 0x20a7353(%rip), %rax   # 0x20ad3f0
movq %rax, -0xf8(%rbp)
callq 0x9820
movq %rax, %rcx
movq -0xf8(%rbp), %rax
subq $0x3e8, %rcx            # imm = 0x3E8
cmpq %rcx, %rax
jb 0x610b
leaq -0xa0(%rbp), %rdi
movsd 0x6f7a(%rip), %xmm0     # 0xd048
mulsd 0x20a730a(%rip), %xmm0  # 0x20ad3e0
movl $0x13, %esi
leaq 0x70dd(%rip), %rdx      # 0xd1bf
movb $0x1, %al
callq 0x2130
leaq -0xc0(%rbp), %rdi
movsd 0x20a72f0(%rip), %xmm0  # 0x20ad3e8
movl $0x13, %esi
leaq 0x7688(%rip), %rdx      # 0xd78c
movb $0x1, %al
callq 0x2130
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movsd -0xd0(%rbp), %xmm0
movsbl -0xc1(%rbp), %ecx
movsd -0xd8(%rbp), %xmm1
movsbl -0xc2(%rbp), %r8d
leaq -0x80(%rbp), %r9
leaq 0x7088(%rip), %rdx      # 0xd1c4
movb $0x2, %al
callq 0x89b0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x80(%rbp), %rcx
movsd -0xd0(%rbp), %xmm0
movsbl -0xc1(%rbp), %r8d
movsd -0xd8(%rbp), %xmm1
movsbl -0xc2(%rbp), %r9d
leaq -0xa0(%rbp), %r11
leaq -0xc0(%rbp), %r10
leaq -0x60(%rbp), %rax
leaq 0x7056(%rip), %rdx      # 0xd1dd
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x2, %al
callq 0x89b0
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)