// File: /workspace/github_cpp_makefile_star2_O3/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 0x58481(%rip), %xmm0    # 0x10b830
mulsd %xmm0, %xmm3
movsd 0x5846d(%rip), %xmm2    # 0x10b828
divsd %xmm2, %xmm3
mulsd %xmm0, %xmm1
divsd %xmm2, %xmm1
addsd 0x58549(%rip), %xmm3    # 0x10b918
movsd %xmm3, -0x20(%rbp)
addsd %xmm1, %xmm0
movsd 0x58760(%rip), %xmm2    # 0x10bb40
movapd %xmm0, %xmm4
divsd %xmm2, %xmm4
movapd %xmm2, %xmm1
cvttsd2si %xmm4, %eax
addb $0x41, %al
movb %al, 0x2c3128(%rip)     # 0x376520
leaq 0x2c3121(%rip), %rbx    # 0x376520
movsd 0x55ca1(%rip), %xmm2    # 0x1090a8
divsd %xmm2, %xmm3
cvttsd2si %xmm3, %eax
addb $0x41, %al
movb %al, 0x2c310a(%rip)     # 0x376521
callq 0x94d0
movsd 0x5871c(%rip), %xmm3    # 0x10bb40
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 0x55c55(%rip), %xmm1    # 0x1090a8
callq 0x94d0
movsd 0x55c48(%rip), %xmm1    # 0x1090a8
addsd %xmm0, %xmm1
movapd %xmm0, %xmm2
cmpltsd 0x55ca7(%rip), %xmm2    # 0x109118
andpd %xmm2, %xmm1
andnpd %xmm0, %xmm2
orpd %xmm1, %xmm2
movapd %xmm2, -0x20(%rbp)
movapd -0x30(%rbp), %xmm0
movapd %xmm0, %xmm1
mulsd 0x55bd5(%rip), %xmm1    # 0x109068
cvttsd2si %xmm1, %eax
addb $0x30, %al
movb %al, 0x2c3083(%rip)     # 0x376522
cvttsd2si %xmm2, %eax
addb $0x30, %al
movb %al, 0x2c3078(%rip)     # 0x376523
movsd 0x5851d(%rip), %xmm1    # 0x10b9d0
callq 0x94d0
movsd 0x58510(%rip), %xmm2    # 0x10b9d0
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x55c47(%rip), %xmm1    # 0x109118
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
movapd %xmm1, -0x30(%rbp)
movsd 0x55b86(%rip), %xmm1    # 0x109070
movapd -0x20(%rbp), %xmm0
callq 0x94d0
movsd 0x55b74(%rip), %xmm2    # 0x109070
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x55c0b(%rip), %xmm1    # 0x109118
andpd %xmm1, %xmm2
movapd %xmm2, %xmm3
andnpd %xmm0, %xmm1
movapd -0x30(%rbp), %xmm0
movapd %xmm0, %xmm2
mulsd 0x6b346(%rip), %xmm2    # 0x11e870
orpd %xmm3, %xmm1
movapd %xmm1, -0x20(%rbp)
cvttsd2si %xmm2, %eax
addb $0x61, %al
movb %al, 0x2c2fe5(%rip)     # 0x376524
movapd %xmm1, %xmm2
mulsd 0x55af5(%rip), %xmm2    # 0x109040
cvttsd2si %xmm2, %eax
addb $0x61, %al
movb %al, 0x2c2fce(%rip)     # 0x376525
movsd 0x6b319(%rip), %xmm1    # 0x11e878
callq 0x94d0
movsd 0x6b30c(%rip), %xmm2    # 0x11e878
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x55b9b(%rip), %xmm1    # 0x109118
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
movapd %xmm1, -0x30(%rbp)
movsd 0x6b2ea(%rip), %xmm1    # 0x11e880
movapd -0x20(%rbp), %xmm0
callq 0x94d0
movsd 0x6b2d8(%rip), %xmm2    # 0x11e880
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x55b5f(%rip), %xmm1    # 0x109118
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
movapd %xmm1, %xmm2
movapd %xmm1, -0x20(%rbp)
movb $0x20, %r14b
movb %r14b, 0x2c2f4e(%rip)   # 0x376526
movapd -0x30(%rbp), %xmm0
movapd %xmm0, %xmm1
mulsd 0x58367(%rip), %xmm1    # 0x10b950
cvttsd2si %xmm1, %eax
addb $0x30, %al
movb %al, 0x2c2f32(%rip)     # 0x376527
movapd %xmm2, %xmm1
mulsd 0x6b287(%rip), %xmm1    # 0x11e888
cvttsd2si %xmm1, %eax
addb $0x30, %al
movb %al, 0x2c2f1b(%rip)     # 0x376528
movsd 0x6b27b(%rip), %xmm1    # 0x11e890
callq 0x94d0
movsd 0x6b26e(%rip), %xmm2    # 0x11e890
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x55ae5(%rip), %xmm1    # 0x109118
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
movapd %xmm1, -0x30(%rbp)
movsd 0x6b24c(%rip), %xmm1    # 0x11e898
movapd -0x20(%rbp), %xmm0
callq 0x94d0
movsd 0x6b23a(%rip), %xmm2    # 0x11e898
addsd %xmm0, %xmm2
movapd %xmm0, %xmm1
cmpltsd 0x55aa9(%rip), %xmm1    # 0x109118
andpd %xmm1, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
movapd %xmm1, %xmm3
movapd %xmm1, -0x20(%rbp)
movb %r14b, 0x2c2e9e(%rip)   # 0x376529
movapd -0x30(%rbp), %xmm0
movapd %xmm0, %xmm2
mulsd 0x582b4(%rip), %xmm2    # 0x10b950
movsd 0x5599c(%rip), %xmm1    # 0x109040
mulsd %xmm1, %xmm2
cvttsd2si %xmm2, %eax
addb $0x41, %al
movb %al, 0x2c2e76(%rip)     # 0x37652a
movapd %xmm3, %xmm2
mulsd 0x6b1c8(%rip), %xmm2    # 0x11e888
mulsd %xmm1, %xmm2
cvttsd2si %xmm2, %eax
addb $0x41, %al
movb %al, 0x2c2e5b(%rip)     # 0x37652b
movsd 0x6b1c8(%rip), %xmm1    # 0x11e8a0
callq 0x94d0
movsd 0x6b1c3(%rip), %xmm1    # 0x11e8a8
movaps -0x20(%rbp), %xmm0
callq 0x94d0
movb $0x0, 0x2c2e37(%rip)    # 0x37652c
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq