// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: maidenhead_square(double, double)
char *maidenhead_square(double Lat, double Long)
{
static char mls[16];
int i;
int Ext;
Ext = 2;

   // calculate the Maidenhead grid square
   //
   // Based on code by Yves Goergen, http://unclassified.software/source/maidenheadlocator
   // which was based upon code by Dirk Koopman, G1TLH

   Lat = Lat * 180.0 / PI;
   Long = Long * 180.0 / PI;

   i = 0;
   mls[i] = 0;

   Lat += 90.0;
   Long += 180.0;

   mls[i++] = (char) ('A' + (int) (Long / 20.0));
   mls[i++] = (char) ('A' + (int) (Lat / 10.0));

   Long = fmod(Long, 20.0);
   if(Long < 0.0) Long += 20.0;
   Lat = fmod(Lat, 10.0);
   if(Lat < 0.0) Lat += 10.0;

   mls[i++] = (char) ('0' + (int)(Long / 2.0));
   mls[i++] = (char) ('0' + (int)(Lat / 1.0));
   Long = fmod(Long, 2.0);
   if(Long < 0.0) Long += 2.0;
   Lat = fmod(Lat, 1.0);
   if(Lat < 0.0) Lat += 1.0;

   mls[i++] = (char) ('a' + (int)(Long * 12.0));
   mls[i++] = (char) ('a' + (int)(Lat * 24.0));
   Long = fmod(Long, 1.0 / 12.0);
   if(Long < 0) Long += 1.0/12.0;
   Lat = fmod(Lat, 1.0 / 24.0);
   if(Lat < 0.0) Lat += 1.0/24.0;
   mls[i] = 0;

   if(Ext >= 1) {
      mls[i++] = ' ';
      mls[i++] = (char) ('0' + (int)(Long * 120.0));
      mls[i++] = (char) ('0' + (int)(Lat * 240.0));
      Long = fmod(Long, 1.0/120.0);
      if(Long < 0.0) Long += 1.0 / 120.0;
      Lat = fmod(Lat, 1.0 / 240.0);
      if(Lat < 0.0) Lat += 1.0 / 240.0;
      mls[i] = 0;
   }

   if(Ext >= 2) {
      mls[i++] = ' ';
      mls[i++] = (char) ('A' + (int)(Long * 120.0 * 24.0));
      mls[i++] = (char) ('A' + (int)(Lat * 240.0 * 24.0));
      Long = fmod(Long, 1.0 / 120.0 / 24.0);
      if(Long < 0) Long += 1.0 / 120.0 / 24.0;
      Lat = fmod(Lat, 1.0 / 240.0 / 24.0);
      if(Lat < 0) Lat += 1.0 / 240.0 / 24.0;
      mls[i] = 0;
   }

   return &mls[0];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movapd %xmm0, %xmm3
movsd 0x58806(%rip), %xmm0    # 0x10b820
mulsd %xmm0, %xmm3
movsd 0x587f2(%rip), %xmm2    # 0x10b818
divsd %xmm2, %xmm3
mulsd %xmm0, %xmm1
divsd %xmm2, %xmm1
addsd 0x588d6(%rip), %xmm3    # 0x10b910
movsd %xmm3, -0x20(%rbp)
addsd %xmm1, %xmm0
movsd 0x58aed(%rip), %xmm2    # 0x10bb38
movapd %xmm0, %xmm4
divsd %xmm2, %xmm4
movapd %xmm2, %xmm1
cvttsd2si %xmm4, %eax
addb $0x41, %al
movb %al, 0x2c34bd(%rip)     # 0x376520
leaq 0x2c34b6(%rip), %rbx    # 0x376520
movsd 0x56036(%rip), %xmm2    # 0x1090a8
divsd %xmm2, %xmm3
cvttsd2si %xmm3, %eax
addb $0x41, %al
movb %al, 0x2c349f(%rip)     # 0x376521
callq 0x94d0
movsd 0x58aa9(%rip), %xmm3    # 0x10bb38
addsd %xmm0, %xmm3
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm2
cmpltsd %xmm1, %xmm2
andpd %xmm2, %xmm3
andnpd %xmm0, %xmm2
orpd %xmm3, %xmm2
movapd %xmm2, -0x30(%rbp)
movsd -0x20(%rbp), %xmm0
movsd 0x55fea(%rip), %xmm1    # 0x1090a8
callq 0x94d0
movsd 0x55fdd(%rip), %xmm1    # 0x1090a8
addsd %xmm0, %xmm1
movapd %xmm0, %xmm2
cmpltsd 0x5603c(%rip), %xmm2    # 0x109118
andpd %xmm2, %xmm1
andnpd %xmm0, %xmm2
orpd %xmm1, %xmm2
movapd %xmm2, -0x20(%rbp)
movapd -0x30(%rbp), %xmm0
movapd %xmm0, %xmm1
mulsd 0x55f6a(%rip), %xmm1    # 0x109068
cvttsd2si %xmm1, %eax
addb $0x30, %al
movb %al, 0x2c3418(%rip)     # 0x376522
cvttsd2si %xmm2, %eax
addb $0x30, %al
movb %al, 0x2c340d(%rip)     # 0x376523
movsd 0x588b2(%rip), %xmm1    # 0x10b9d0
callq 0x94d0
movsd 0x588a5(%rip), %xmm2    # 0x10b9d0
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x55fdc(%rip), %xmm1    # 0x109118
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
movapd %xmm1, -0x30(%rbp)
movsd 0x55f1b(%rip), %xmm1    # 0x109070
movapd -0x20(%rbp), %xmm0
callq 0x94d0
movsd 0x55f09(%rip), %xmm2    # 0x109070
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x55fa0(%rip), %xmm1    # 0x109118
andpd %xmm1, %xmm2
movapd %xmm2, %xmm3
andnpd %xmm0, %xmm1
movapd -0x30(%rbp), %xmm0
movapd %xmm0, %xmm2
mulsd 0x6b62b(%rip), %xmm2    # 0x11e7c0
orpd %xmm3, %xmm1
movapd %xmm1, -0x20(%rbp)
cvttsd2si %xmm2, %eax
addb $0x61, %al
movb %al, 0x2c337a(%rip)     # 0x376524
movapd %xmm1, %xmm2
mulsd 0x55e8a(%rip), %xmm2    # 0x109040
cvttsd2si %xmm2, %eax
addb $0x61, %al
movb %al, 0x2c3363(%rip)     # 0x376525
movsd 0x6b5fe(%rip), %xmm1    # 0x11e7c8
callq 0x94d0
movsd 0x6b5f1(%rip), %xmm2    # 0x11e7c8
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x55f30(%rip), %xmm1    # 0x109118
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
movapd %xmm1, -0x30(%rbp)
movsd 0x6b5cf(%rip), %xmm1    # 0x11e7d0
movapd -0x20(%rbp), %xmm0
callq 0x94d0
movsd 0x6b5bd(%rip), %xmm2    # 0x11e7d0
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x55ef4(%rip), %xmm1    # 0x109118
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
movapd %xmm1, %xmm2
movapd %xmm1, -0x20(%rbp)
movb $0x20, %r14b
movb %r14b, 0x2c32e3(%rip)   # 0x376526
movapd -0x30(%rbp), %xmm0
movapd %xmm0, %xmm1
mulsd 0x586f4(%rip), %xmm1    # 0x10b948
cvttsd2si %xmm1, %eax
addb $0x30, %al
movb %al, 0x2c32c7(%rip)     # 0x376527
movapd %xmm2, %xmm1
mulsd 0x6b56c(%rip), %xmm1    # 0x11e7d8
cvttsd2si %xmm1, %eax
addb $0x30, %al
movb %al, 0x2c32b0(%rip)     # 0x376528
movsd 0x6b560(%rip), %xmm1    # 0x11e7e0
callq 0x94d0
movsd 0x6b553(%rip), %xmm2    # 0x11e7e0
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x55e7a(%rip), %xmm1    # 0x109118
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
movapd %xmm1, -0x30(%rbp)
movsd 0x6b531(%rip), %xmm1    # 0x11e7e8
movapd -0x20(%rbp), %xmm0
callq 0x94d0
movsd 0x6b51f(%rip), %xmm2    # 0x11e7e8
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x55e3e(%rip), %xmm1    # 0x109118
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
movapd %xmm1, %xmm3
movapd %xmm1, -0x20(%rbp)
movb %r14b, 0x2c3233(%rip)   # 0x376529
movapd -0x30(%rbp), %xmm0
movapd %xmm0, %xmm2
mulsd 0x58641(%rip), %xmm2    # 0x10b948
movsd 0x55d31(%rip), %xmm1    # 0x109040
mulsd %xmm1, %xmm2
cvttsd2si %xmm2, %eax
addb $0x41, %al
movb %al, 0x2c320b(%rip)     # 0x37652a
movapd %xmm3, %xmm2
mulsd 0x6b4ad(%rip), %xmm2    # 0x11e7d8
mulsd %xmm1, %xmm2
cvttsd2si %xmm2, %eax
addb $0x41, %al
movb %al, 0x2c31f0(%rip)     # 0x37652b
movsd 0x6b4ad(%rip), %xmm1    # 0x11e7f0
callq 0x94d0
movsd 0x6b4a8(%rip), %xmm1    # 0x11e7f8
movaps -0x20(%rbp), %xmm0
callq 0x94d0
movb $0x0, 0x2c31cc(%rip)    # 0x37652c
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq