#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int AACGM_v2_Convert(double, double, double, double *, double *, double *, int);
int /*<<< orphan*/ AACGM_v2_SetDateTime(int, int, int, int, int, int);
double MLTConvertYMDHMS_v2(int, int, int, int, int, int, double);
int /*<<< orphan*/ line(char, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  double lat, lon, hgt;
  double h, mlt_c, mlt_t;
  double rtp[3];
  double mlat, mlon, r;
  int k, err, npts;
  int yr, mo, dy, hr, mt, sc;
  line('=', 80);
  printf("\nAACGM-v2 Test Program\n\n");
  line('=', 80);
  printf("\n");
  printf("TEST: no date/time (this will return an error.)\n");
  lat = 45.5;
  lon = -23.5;
  hgt = 1135.;
  err = AACGM_v2_Convert(lat, lon, hgt, &mlat, &mlon, &r, 0);
  if (err == 0) {
    printf("lat = %lf, lon = %lf, height = %lf\n", lat, lon, hgt);
    printf("mlat = %lf, mlon = %lf, r = %lf\n", mlat, mlon, r);
    printf("\n\n");
  }
  yr = 2024;
  mo = 3;
  dy = 22;
  hr = 3;
  mt = 11;
  sc = 0;
  printf("TEST: Setting time to : %04d%02d%02d %02d%02d:%02d\n", yr, mo, dy, hr,
         mt, sc);
  printf("\n");
  AACGM_v2_SetDateTime(yr, mo, dy, hr, mt, sc);
  lat = 45.5;
  lon = -23.5;
  hgt = 1135.;
  printf("TEST: geographic to AACGM-v2\n");
  err = AACGM_v2_Convert(lat, lon, hgt, &mlat, &mlon, &r, 0);
  printf("     GLAT       GLON        HEIGHT       MLAT       MLON       R\n");
  printf("     %lf  %lf  %lf  %lf  %lf  %lf", lat, lon, hgt, mlat, mlon, r);
  printf("\n\n");
  printf("TEST: AACGM-v2 to geographic\n");
  hgt = (r - 1.) * 6371.2;
  err = AACGM_v2_Convert(mlat, mlon, hgt, &lat, &lon, &h, 1);
  printf("     MLAT       MLON        HEIGHT       GLAT       GLON       "
         "HEIGHT\n");
  printf("     %lf  %lf  %lf  %lf  %lf  %lf", mlat, mlon, hgt, lat, lon, h);
  printf("\n\n");
  lat = 45.5;
  lon = -23.5;
  hgt = 1135.;
  printf("Do the same thing but use field-line tracing\n\n");
  printf("TEST: geographic to AACGM-v2 (TRACE)\n");
  err = AACGM_v2_Convert(lat, lon, hgt, &mlat, &mlon, &r, 0 | 2);
  printf("     GLAT       GLON        HEIGHT       MLAT       MLON       R\n");
  printf("     %lf  %lf  %lf  %lf  %lf  %lf", lat, lon, hgt, mlat, mlon, r);
  printf("\n\n");
  printf("TEST: AACGM-v2 to geographic (TRACE)\n");
  hgt = (r - 1.) * 6371.2;
  err = AACGM_v2_Convert(mlat, mlon, hgt, &lat, &lon, &h, 1 | 2);
  printf("     MLAT       MLON        HEIGHT       GLAT       GLON       "
         "HEIGHT\n");
  printf("     %lf  %lf  %lf  %lf  %lf  %lf", mlat, mlon, hgt, lat, lon, h);
  printf("\n\n");
  lat = 45.5;
  lon = -23.5;
  hgt = 150.;
  AACGM_v2_SetDateTime(2018, 1, 1, 0, 0, 0);
  line('-', 80);
  printf("\n");
  printf("Testing MLT\n");
  line('-', 80);
  printf("\n");
  lat = 77.;
  lat = 37.;
  lon = -88.;
  hgt = 300.;
  yr = 2003;
  mo = 5;
  dy = 17;
  hr = 7;
  mt = 53;
  sc = 16;
  AACGM_v2_SetDateTime(yr, mo, dy, hr, mt, sc);
  err = AACGM_v2_Convert(lat, lon, hgt, &mlat, &mlon, &r, 0 | 2);
  mlt_t = MLTConvertYMDHMS_v2(yr, mo, dy, hr, mt, sc, mlon);
  printf(
      "      GLAT       GLON        HEIGHT       MLAT       MLON       MLT\n");
  printf("TRACE %lf  %lf  %lf  %lf  %lf  %lf", lat, lon, hgt, mlat, mlon,
         mlt_t);
  printf("\n");
  err = AACGM_v2_Convert(lat, lon, hgt, &mlat, &mlon, &r, 0);
  mlt_c = MLTConvertYMDHMS_v2(yr, mo, dy, hr, mt, sc, mlon);
  printf("COEFF %lf  %lf  %lf  %lf  %lf  %lf", lat, lon, hgt, mlat, mlon,
         mlt_c);
  printf("\n\n");
  npts = 20;
  printf("\n");
  printf("Array:\n");
  for (k = 0; k < npts; k++) {
    lat = 45.;
    lon = k;
    hgt = 150.;
    err = AACGM_v2_Convert(lat, lon, hgt, &mlat, &mlon, &r, 0 | 2);
    mlt_t = MLTConvertYMDHMS_v2(yr, mo, dy, hr, mt, sc, mlon);
    printf("      %7.4lf %8.4lf  %10.4lf  %10.4lf  %10.4lf  %10.4lf\n", lat,
           lon, hgt, mlat, mlon, mlt_t);
  }
  printf("\n\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3d,%edi
mov    $0x50,%esi
call   1060 <line@plt>
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x3d,%edi
mov    $0x50,%esi
call   1060 <line@plt>
lea    0x109a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xe5e(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe49(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe34(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
xor    %ecx,%ecx
call   1040 <AACGM_v2_Convert@plt>
mov    %eax,-0x70(%rbp)
cmpl   $0x0,-0x70(%rbp)
jne    1248 <main+0xf8>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    0xe8c(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm2
lea    0xe93(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xfed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x7e8,-0x78(%rbp)
movl   $0x3,-0x7c(%rbp)
movl   $0x16,-0x80(%rbp)
movl   $0x3,-0x84(%rbp)
movl   $0xb,-0x88(%rbp)
movl   $0x0,-0x8c(%rbp)
mov    -0x78(%rbp),%esi
mov    -0x7c(%rbp),%edx
mov    -0x80(%rbp),%ecx
mov    -0x84(%rbp),%r8d
mov    -0x88(%rbp),%r9d
mov    -0x8c(%rbp),%eax
lea    0xe48(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%edi
mov    -0x7c(%rbp),%esi
mov    -0x80(%rbp),%edx
mov    -0x84(%rbp),%ecx
mov    -0x88(%rbp),%r8d
mov    -0x8c(%rbp),%r9d
call   1070 <AACGM_v2_SetDateTime@plt>
movsd  0xd2f(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xd1a(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xd05(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
xor    %ecx,%ecx
call   1040 <AACGM_v2_Convert@plt>
mov    %eax,-0x70(%rbp)
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
movsd  -0x60(%rbp),%xmm4
movsd  -0x68(%rbp),%xmm5
lea    0xe15(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x68(%rbp),%xmm0
movsd  0xcb2(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xc9e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x1,%ecx
call   1040 <AACGM_v2_Convert@plt>
mov    %eax,-0x70(%rbp)
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  -0x28(%rbp),%xmm5
lea    0xd75(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xbed(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xbd8(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xbc3(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
mov    $0x2,%ecx
call   1040 <AACGM_v2_Convert@plt>
mov    %eax,-0x70(%rbp)
lea    0xcac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
movsd  -0x60(%rbp),%xmm4
movsd  -0x68(%rbp),%xmm5
lea    0xcc2(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
lea    0xd67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x68(%rbp),%xmm0
movsd  0xb5f(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xb4b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x3,%ecx
call   1040 <AACGM_v2_Convert@plt>
mov    %eax,-0x70(%rbp)
lea    0xc8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  -0x28(%rbp),%xmm5
lea    0xc22(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
lea    0xcc7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xa9a(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xa85(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xaa8(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x7e2,%edi
mov    $0x1,%edx
xor    %r9d,%r9d
mov    %edx,%esi
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1070 <AACGM_v2_SetDateTime@plt>
mov    $0x2d,%edi
mov    $0x50,%esi
call   1060 <line@plt>
lea    0xc6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xcaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x2d,%edi
mov    $0x50,%esi
call   1060 <line@plt>
lea    0xc3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xa31(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xa1c(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xa07(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0x9f2(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x7d3,-0x78(%rbp)
movl   $0x5,-0x7c(%rbp)
movl   $0x11,-0x80(%rbp)
movl   $0x7,-0x84(%rbp)
movl   $0x35,-0x88(%rbp)
movl   $0x10,-0x8c(%rbp)
mov    -0x78(%rbp),%edi
mov    -0x7c(%rbp),%esi
mov    -0x80(%rbp),%edx
mov    -0x84(%rbp),%ecx
mov    -0x88(%rbp),%r8d
mov    -0x8c(%rbp),%r9d
call   1070 <AACGM_v2_SetDateTime@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
mov    $0x2,%ecx
call   1040 <AACGM_v2_Convert@plt>
mov    %eax,-0x70(%rbp)
mov    -0x78(%rbp),%edi
mov    -0x7c(%rbp),%esi
mov    -0x80(%rbp),%edx
mov    -0x84(%rbp),%ecx
mov    -0x88(%rbp),%r8d
mov    -0x8c(%rbp),%r9d
movsd  -0x60(%rbp),%xmm0
call   1050 <MLTConvertYMDHMS_v2@plt>
movsd  %xmm0,-0x38(%rbp)
lea    0xbaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
movsd  -0x60(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
lea    0xbc8(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
lea    0xb1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
xor    %ecx,%ecx
call   1040 <AACGM_v2_Convert@plt>
mov    %eax,-0x70(%rbp)
mov    -0x78(%rbp),%edi
mov    -0x7c(%rbp),%esi
mov    -0x80(%rbp),%edx
mov    -0x84(%rbp),%ecx
mov    -0x88(%rbp),%r8d
mov    -0x8c(%rbp),%r9d
movsd  -0x60(%rbp),%xmm0
call   1050 <MLTConvertYMDHMS_v2@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
movsd  -0x60(%rbp),%xmm4
movsd  -0x30(%rbp),%xmm5
lea    0xb60(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
lea    0xa8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x14,-0x74(%rbp)
lea    0xa7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xb52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    188f <main+0x73f>
movsd  0x86b(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x6c(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0x83c(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
mov    $0x2,%ecx
call   1040 <AACGM_v2_Convert@plt>
mov    %eax,-0x70(%rbp)
mov    -0x78(%rbp),%edi
mov    -0x7c(%rbp),%esi
mov    -0x80(%rbp),%edx
mov    -0x84(%rbp),%ecx
mov    -0x88(%rbp),%r8d
mov    -0x8c(%rbp),%r9d
movsd  -0x60(%rbp),%xmm0
call   1050 <MLTConvertYMDHMS_v2@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
movsd  -0x60(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
lea    0xaa3(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    17d1 <main+0x681>
lea    0x998(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    $0x3d,%edi
mov    $0x50,%esi
call   1080 <line@plt>
lea    0xfce(%rip),%rdi
call   1040 <puts@plt>
mov    $0x3d,%edi
mov    $0x50,%esi
call   1080 <line@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xfc1(%rip),%rdi
call   1040 <puts@plt>
movabs $0x4046c00000000000,%rbx
c0 46 40
mov    %rbx,0x18(%rsp)
movabs $0xc037800000000000,%rbp
80 37 c0
mov    %rbp,0x10(%rsp)
movsd  0xe1c(%rip),%xmm0
movsd  0xe1c(%rip),%xmm1
movsd  0xe1c(%rip),%xmm2
lea    0x28(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0x38(%rsp),%rdx
xor    %ecx,%ecx
call   1060 <AACGM_v2_Convert@plt>
test   %eax,%eax
jne    125c <main+0xec>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
lea    0xe27(%rip),%rdi
movsd  0xde7(%rip),%xmm2
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x38(%rsp),%xmm2
lea    0xe23(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
lea    0xe68(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,(%rsp)
lea    0xe23(%rip),%rdi
mov    $0x7e8,%esi
mov    $0x3,%edx
mov    $0x16,%ecx
mov    $0x3,%r8d
mov    $0xb,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x7e8,%edi
mov    $0x3,%esi
mov    $0x16,%edx
mov    $0x3,%ecx
mov    $0xb,%r8d
xor    %r9d,%r9d
call   1090 <AACGM_v2_SetDateTime@plt>
mov    %rbx,0x18(%rsp)
mov    %rbp,0x10(%rsp)
lea    0xee1(%rip),%rdi
call   1040 <puts@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0xd2e(%rip),%xmm2
lea    0x28(%rsp),%r14
lea    0x20(%rsp),%r15
lea    0x38(%rsp),%r12
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %ecx,%ecx
call   1060 <AACGM_v2_Convert@plt>
lea    0xf2f(%rip),%rdi
call   1040 <puts@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x28(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
movsd  0x38(%rsp),%xmm5
lea    0xd8f(%rip),%r13
mov    %r13,%rdi
movsd  0xcd3(%rip),%xmm2
mov    $0x6,%al
call   1050 <printf@plt>
lea    0xd74(%rip),%rbp
mov    %rbp,%rdi
call   1040 <puts@plt>
lea    0xe6d(%rip),%rdi
call   1040 <puts@plt>
movsd  0x38(%rsp),%xmm0
addsd  0xcab(%rip),%xmm0
mulsd  0xcab(%rip),%xmm0
movapd %xmm0,%xmm2
movsd  %xmm0,0x30(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
lea    0x18(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x40(%rsp),%rdx
mov    $0x1,%ecx
call   1060 <AACGM_v2_Convert@plt>
lea    0xef2(%rip),%rdi
call   1040 <puts@plt>
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm3
movsd  0x10(%rsp),%xmm4
movsd  0x40(%rsp),%xmm5
mov    %r13,%rdi
movsd  0x30(%rsp),%xmm2
mov    $0x6,%al
call   1050 <printf@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    %rbx,0x18(%rsp)
movabs $0xc037800000000000,%rax
80 37 c0
mov    %rax,0x10(%rsp)
lea    0xde3(%rip),%rdi
call   1040 <puts@plt>
lea    0xe05(%rip),%rdi
call   1040 <puts@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0xbea(%rip),%xmm2
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    $0x2,%ecx
call   1060 <AACGM_v2_Convert@plt>
lea    0xdf7(%rip),%rdi
call   1040 <puts@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x28(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
movsd  0x38(%rsp),%xmm5
mov    %r13,%rdi
movsd  0xba2(%rip),%xmm2
mov    $0x6,%al
call   1050 <printf@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
lea    0xdf4(%rip),%rdi
call   1040 <puts@plt>
movsd  0xb87(%rip),%xmm2
addsd  0x38(%rsp),%xmm2
mulsd  0xb81(%rip),%xmm2
movsd  %xmm2,0x30(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
lea    0x18(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x40(%rsp),%rdx
mov    $0x3,%ecx
call   1060 <AACGM_v2_Convert@plt>
lea    0xdcc(%rip),%rdi
call   1040 <puts@plt>
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm3
movsd  0x10(%rsp),%xmm4
movsd  0x40(%rsp),%xmm5
mov    %r13,%rdi
movsd  0x30(%rsp),%xmm2
mov    $0x6,%al
call   1050 <printf@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    %rbx,0x18(%rsp)
movabs $0xc037800000000000,%rax
80 37 c0
mov    %rax,0x10(%rsp)
mov    $0x7e2,%edi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1090 <AACGM_v2_SetDateTime@plt>
mov    $0x2d,%edi
mov    $0x50,%esi
call   1080 <line@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd87(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2d,%edi
mov    $0x50,%esi
call   1080 <line@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movabs $0x4042800000000000,%rax
80 42 40
mov    %rax,0x18(%rsp)
movabs $0xc056000000000000,%rax
mov    %rax,0x10(%rsp)
mov    $0x7d3,%edi
mov    $0x5,%esi
mov    $0x11,%edx
mov    $0x7,%ecx
mov    $0x35,%r8d
mov    $0x10,%r9d
call   1090 <AACGM_v2_SetDateTime@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0xa57(%rip),%xmm2
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    $0x2,%ecx
call   1060 <AACGM_v2_Convert@plt>
movsd  0x20(%rsp),%xmm0
mov    $0x7d3,%edi
mov    $0x5,%esi
mov    $0x11,%edx
mov    $0x7,%ecx
mov    $0x35,%r8d
mov    $0x10,%r9d
call   1070 <MLTConvertYMDHMS_v2@plt>
movsd  %xmm0,0x30(%rsp)
lea    0xcd3(%rip),%rdi
call   1040 <puts@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x28(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
lea    0xaa3(%rip),%rdi
movsd  0x9e0(%rip),%xmm2
movsd  0x30(%rsp),%xmm5
mov    $0x6,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x9b5(%rip),%xmm2
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %ecx,%ecx
call   1060 <AACGM_v2_Convert@plt>
movsd  0x20(%rsp),%xmm0
mov    $0x7d3,%edi
mov    $0x5,%esi
mov    $0x11,%edx
mov    $0x7,%ecx
mov    $0x35,%r8d
mov    $0x10,%r9d
call   1070 <MLTConvertYMDHMS_v2@plt>
movaps %xmm0,%xmm5
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x28(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
lea    0xa36(%rip),%rdi
movsd  0x950(%rip),%xmm2
mov    $0x6,%al
call   1050 <printf@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc3b(%rip),%rdi
call   1040 <puts@plt>
xorpd  %xmm0,%xmm0
mov    $0x14,%ebx
movabs $0x4046800000000000,%r13
80 46 40
lea    0xa12(%rip),%rbp
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,0x30(%rsp)
mov    %r13,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
movsd  0x8f7(%rip),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  0x8f1(%rip),%xmm2
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    $0x2,%ecx
call   1060 <AACGM_v2_Convert@plt>
movsd  0x20(%rsp),%xmm0
mov    $0x7d3,%edi
mov    $0x5,%esi
mov    $0x11,%edx
mov    $0x7,%ecx
mov    $0x35,%r8d
mov    $0x10,%r9d
call   1070 <MLTConvertYMDHMS_v2@plt>
movaps %xmm0,%xmm5
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x28(%rsp),%xmm3
movsd  0x20(%rsp),%xmm4
mov    %rbp,%rdi
movsd  0x88d(%rip),%xmm2
mov    $0x6,%al
call   1050 <printf@plt>
movsd  0x30(%rsp),%xmm0
addsd  0x880(%rip),%xmm0
add    $0xffffffff,%ebx
jne    1720 <main+0x5b0>
lea    0x8ef(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0AAACGM-v2 Test Program\0A\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [49 x i8] c"TEST: no date/time (this will return an error.)\0A\00"
@.str.3 = [36 x i8] c"lat = %lf, lon = %lf, height = %lf\0A\00"
@.str.4 = [33 x i8] c"mlat = %lf, mlon = %lf, r = %lf\0A\00"
@.str.5 = [3 x i8] c"\0A\0A\00"
@.str.6 = [52 x i8] c"TEST: Setting time to : %04d%02d%02d %02d%02d:%02d\0A\00"
@.str.7 = [30 x i8] c"TEST: geographic to AACGM-v2\0A\00"
@.str.8 = [66 x i8] c" GLAT GLON HEIGHT MLAT MLON R\0A\00"
@.str.9 = [34 x i8] c" %lf %lf %lf %lf %lf %lf\00"
@.str.10 = [30 x i8] c"TEST: AACGM-v2 to geographic\0A\00"
@.str.11 = [71 x i8] c" MLAT MLON HEIGHT GLAT GLON HEIGHT\0A\00"
@.str.12 = [47 x i8] c"Do the same thing but use field-line tracing\0A\0A\00"
@.str.13 = [38 x i8] c"TEST: geographic to AACGM-v2 (TRACE)\0A\00"
@.str.14 = [38 x i8] c"TEST: AACGM-v2 to geographic (TRACE)\0A\00"
@.str.15 = [13 x i8] c"Testing MLT\0A\00"
@.str.16 = [69 x i8] c" GLAT GLON HEIGHT MLAT MLON MLT\0A\00"
@.str.17 = [35 x i8] c"TRACE %lf %lf %lf %lf %lf %lf\00"
@.str.18 = [35 x i8] c"COEFF %lf %lf %lf %lf %lf %lf\00"
@.str.19 = [8 x i8] c"Array:\0A\00"
@.str.20 = [57 x i8] c" %7.4lf %8.4lf %10.4lf %10.4lf %10.4lf %10.4lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca [3 x double]
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32 0, i32* %1
%21 = call i32 @line(i8 signext 61, i32 80)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @line(i8 signext 61, i32 80)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
store double 4.550000e+01, double* %2
store double -2.350000e+01, double* %3
store double 1.135000e+03, double* %4
%26 = load double, double* %2
%27 = load double, double* %3
%28 = load double, double* %4
%29 = call i32 @AACGM_v2_Convert(double %26, double %27, double %28, double* %9, double* %10, double* %11, i32 0)
store i32 %29, i32* %13
%30 = load i32, i32* %13
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %42
32: ; preds = %0
%33 = load double, double* %2
%34 = load double, double* %3
%35 = load double, double* %4
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double %33, double %34, double %35)
%37 = load double, double* %9
%38 = load double, double* %10
%39 = load double, double* %11
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), double %37, double %38, double %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %42
42: ; preds = %32, %0
store i32 2024, i32* %15
store i32 3, i32* %16
store i32 22, i32* %17
store i32 3, i32* %18
store i32 11, i32* %19
store i32 0, i32* %20
%43 = load i32, i32* %15
%44 = load i32, i32* %16
%45 = load i32, i32* %17
%46 = load i32, i32* %18
%47 = load i32, i32* %19
%48 = load i32, i32* %20
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.6, i64 0, i64 0), i32 %43, i32 %44, i32 %45, i32 %46, i32 %47, i32 %48)
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%51 = load i32, i32* %15
%52 = load i32, i32* %16
%53 = load i32, i32* %17
%54 = load i32, i32* %18
%55 = load i32, i32* %19
%56 = load i32, i32* %20
%57 = call i32 @AACGM_v2_SetDateTime(i32 %51, i32 %52, i32 %53, i32 %54, i32 %55, i32 %56)
store double 4.550000e+01, double* %2
store double -2.350000e+01, double* %3
store double 1.135000e+03, double* %4
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%59 = load double, double* %2
%60 = load double, double* %3
%61 = load double, double* %4
%62 = call i32 @AACGM_v2_Convert(double %59, double %60, double %61, double* %9, double* %10, double* %11, i32 0)
store i32 %62, i32* %13
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0))
%64 = load double, double* %2
%65 = load double, double* %3
%66 = load double, double* %4
%67 = load double, double* %9
%68 = load double, double* %10
%69 = load double, double* %11
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), double %64, double %65, double %66, double %67, double %68, double %69)
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
%73 = load double, double* %11
%74 = fsub double %73, 1.000000e+00
%75 = fmul double %74, 6.371200e+03
store double %75, double* %4
%76 = load double, double* %9
%77 = load double, double* %10
%78 = load double, double* %4
%79 = call i32 @AACGM_v2_Convert(double %76, double %77, double %78, double* %2, double* %3, double* %5, i32 1)
store i32 %79, i32* %13
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.11, i64 0, i64 0))
%81 = load double, double* %9
%82 = load double, double* %10
%83 = load double, double* %4
%84 = load double, double* %2
%85 = load double, double* %3
%86 = load double, double* %5
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), double %81, double %82, double %83, double %84, double %85, double %86)
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store double 4.550000e+01, double* %2
store double -2.350000e+01, double* %3
store double 1.135000e+03, double* %4
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.12, i64 0, i64 0))
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0))
%91 = load double, double* %2
%92 = load double, double* %3
%93 = load double, double* %4
%94 = call i32 @AACGM_v2_Convert(double %91, double %92, double %93, double* %9, double* %10, double* %11, i32 2)
store i32 %94, i32* %13
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0))
%96 = load double, double* %2
%97 = load double, double* %3
%98 = load double, double* %4
%99 = load double, double* %9
%100 = load double, double* %10
%101 = load double, double* %11
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), double %96, double %97, double %98, double %99, double %100, double %101)
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0))
%105 = load double, double* %11
%106 = fsub double %105, 1.000000e+00
%107 = fmul double %106, 6.371200e+03
store double %107, double* %4
%108 = load double, double* %9
%109 = load double, double* %10
%110 = load double, double* %4
%111 = call i32 @AACGM_v2_Convert(double %108, double %109, double %110, double* %2, double* %3, double* %5, i32 3)
store i32 %111, i32* %13
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.11, i64 0, i64 0))
%113 = load double, double* %9
%114 = load double, double* %10
%115 = load double, double* %4
%116 = load double, double* %2
%117 = load double, double* %3
%118 = load double, double* %5
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), double %113, double %114, double %115, double %116, double %117, double %118)
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store double 4.550000e+01, double* %2
store double -2.350000e+01, double* %3
store double 1.500000e+02, double* %4
%121 = call i32 @AACGM_v2_SetDateTime(i32 2018, i32 1, i32 1, i32 0, i32 0, i32 0)
%122 = call i32 @line(i8 signext 45, i32 80)
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0))
%125 = call i32 @line(i8 signext 45, i32 80)
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store double 7.700000e+01, double* %2
store double 3.700000e+01, double* %2
store double -8.800000e+01, double* %3
store double 3.000000e+02, double* %4
store i32 2003, i32* %15
store i32 5, i32* %16
store i32 17, i32* %17
store i32 7, i32* %18
store i32 53, i32* %19
store i32 16, i32* %20
%127 = load i32, i32* %15
%128 = load i32, i32* %16
%129 = load i32, i32* %17
%130 = load i32, i32* %18
%131 = load i32, i32* %19
%132 = load i32, i32* %20
%133 = call i32 @AACGM_v2_SetDateTime(i32 %127, i32 %128, i32 %129, i32 %130, i32 %131, i32 %132)
%134 = load double, double* %2
%135 = load double, double* %3
%136 = load double, double* %4
%137 = call i32 @AACGM_v2_Convert(double %134, double %135, double %136, double* %9, double* %10, double* %11, i32 2)
store i32 %137, i32* %13
%138 = load i32, i32* %15
%139 = load i32, i32* %16
%140 = load i32, i32* %17
%141 = load i32, i32* %18
%142 = load i32, i32* %19
%143 = load i32, i32* %20
%144 = load double, double* %10
%145 = call double @MLTConvertYMDHMS_v2(i32 %138, i32 %139, i32 %140, i32 %141, i32 %142, i32 %143, double %144)
store double %145, double* %7
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.16, i64 0, i64 0))
%147 = load double, double* %2
%148 = load double, double* %3
%149 = load double, double* %4
%150 = load double, double* %9
%151 = load double, double* %10
%152 = load double, double* %7
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.17, i64 0, i64 0), double %147, double %148, double %149, double %150, double %151, double %152)
%154 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%155 = load double, double* %2
%156 = load double, double* %3
%157 = load double, double* %4
%158 = call i32 @AACGM_v2_Convert(double %155, double %156, double %157, double* %9, double* %10, double* %11, i32 0)
store i32 %158, i32* %13
%159 = load i32, i32* %15
%160 = load i32, i32* %16
%161 = load i32, i32* %17
%162 = load i32, i32* %18
%163 = load i32, i32* %19
%164 = load i32, i32* %20
%165 = load double, double* %10
%166 = call double @MLTConvertYMDHMS_v2(i32 %159, i32 %160, i32 %161, i32 %162, i32 %163, i32 %164, double %165)
store double %166, double* %6
%167 = load double, double* %2
%168 = load double, double* %3
%169 = load double, double* %4
%170 = load double, double* %9
%171 = load double, double* %10
%172 = load double, double* %6
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.18, i64 0, i64 0), double %167, double %168, double %169, double %170, double %171, double %172)
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32 20, i32* %14
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0))
store i32 0, i32* %12
br label %177
177: ; preds = %203, %42
%178 = load i32, i32* %12
%179 = load i32, i32* %14
%180 = icmp slt i32 %178, %179
br i1 %180, label %181, label %206
181: ; preds = %177
store double 4.500000e+01, double* %2
%182 = load i32, i32* %12
%183 = sitofp i32 %182 to double
store double %183, double* %3
store double 1.500000e+02, double* %4
%184 = load double, double* %2
%185 = load double, double* %3
%186 = load double, double* %4
%187 = call i32 @AACGM_v2_Convert(double %184, double %185, double %186, double* %9, double* %10, double* %11, i32 2)
store i32 %187, i32* %13
%188 = load i32, i32* %15
%189 = load i32, i32* %16
%190 = load i32, i32* %17
%191 = load i32, i32* %18
%192 = load i32, i32* %19
%193 = load i32, i32* %20
%194 = load double, double* %10
%195 = call double @MLTConvertYMDHMS_v2(i32 %188, i32 %189, i32 %190, i32 %191, i32 %192, i32 %193, double %194)
store double %195, double* %7
%196 = load double, double* %2
%197 = load double, double* %3
%198 = load double, double* %4
%199 = load double, double* %9
%200 = load double, double* %10
%201 = load double, double* %7
%202 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.20, i64 0, i64 0), double %196, double %197, double %198, double %199, double %200, double %201)
br label %203
203: ; preds = %181
%204 = load i32, i32* %12
%205 = add nsw i32 %204, 1
store i32 %205, i32* %12
br label %177
206: ; preds = %177
%207 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [36 x i8] c"lat = %lf, lon = %lf, height = %lf\0A\00"
@.str.4 = [33 x i8] c"mlat = %lf, mlon = %lf, r = %lf\0A\00"
@.str.6 = [52 x i8] c"TEST: Setting time to : %04d%02d%02d %02d%02d:%02d\0A\00"
@.str.9 = [34 x i8] c" %lf %lf %lf %lf %lf %lf\00"
@.str.17 = [35 x i8] c"TRACE %lf %lf %lf %lf %lf %lf\00"
@.str.18 = [35 x i8] c"COEFF %lf %lf %lf %lf %lf %lf\00"
@.str.20 = [57 x i8] c" %7.4lf %8.4lf %10.4lf %10.4lf %10.4lf %10.4lf\0A\00"
@str = [24 x i8] c"\0AAACGM-v2 Test Program\0A\00"
@str.21 = [48 x i8] c"TEST: no date/time (this will return an error.)\00"
@str.22 = [29 x i8] c"TEST: geographic to AACGM-v2\00"
@str.25 = [29 x i8] c"TEST: AACGM-v2 to geographic\00"
@str.28 = [46 x i8] c"Do the same thing but use field-line tracing\0A\00"
@str.29 = [37 x i8] c"TEST: geographic to AACGM-v2 (TRACE)\00"
@str.30 = [65 x i8] c" GLAT GLON HEIGHT MLAT MLON R\00"
@str.32 = [37 x i8] c"TEST: AACGM-v2 to geographic (TRACE)\00"
@str.33 = [70 x i8] c" MLAT MLON HEIGHT GLAT GLON HEIGHT\00"
@str.35 = [12 x i8] c"Testing MLT\00"
@str.36 = [68 x i8] c" GLAT GLON HEIGHT MLAT MLON MLT\00"
@str.38 = [7 x i8] c"Array:\00"
@str.40 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = bitcast double* %1 to i8*
%8 = bitcast double* %2 to i8*
%9 = bitcast double* %3 to i8*
%10 = bitcast double* %4 to i8*
%11 = bitcast double* %5 to i8*
%12 = bitcast double* %6 to i8*
%13 = tail call i32 @line(i8 signext 61, i32 80)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @line(i8 signext 61, i32 80)
%16 = tail call i32 @putchar(i32 10)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.21, i64 0, i64 0))
store double 4.550000e+01, double* %1
store double -2.350000e+01, double* %2
%18 = call i32 @AACGM_v2_Convert(double 4.550000e+01, double -2.350000e+01, double 1.135000e+03, double* %4, double* %5, double* %6, i32 0)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %0
%21 = load double, double* %1
%22 = load double, double* %2
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double %21, double %22, double 1.135000e+03)
%24 = load double, double* %4
%25 = load double, double* %5
%26 = load double, double* %6
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), double %24, double %25, double %26)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.40, i64 0, i64 0))
br label %29
29: ; preds = %20, %0
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.6, i64 0, i64 0), i32 2024, i32 3, i32 22, i32 3, i32 11, i32 0)
%31 = call i32 @putchar(i32 10)
%32 = call i32 @AACGM_v2_SetDateTime(i32 2024, i32 3, i32 22, i32 3, i32 11, i32 0)
store double 4.550000e+01, double* %1
store double -2.350000e+01, double* %2
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.22, i64 0, i64 0))
%34 = load double, double* %1
%35 = load double, double* %2
%36 = call i32 @AACGM_v2_Convert(double %34, double %35, double 1.135000e+03, double* %4, double* %5, double* %6, i32 0)
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.30, i64 0, i64 0))
%38 = load double, double* %1
%39 = load double, double* %2
%40 = load double, double* %4
%41 = load double, double* %5
%42 = load double, double* %6
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), double %38, double %39, double 1.135000e+03, double %40, double %41, double %42)
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.40, i64 0, i64 0))
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.25, i64 0, i64 0))
%46 = load double, double* %6
%47 = fadd double %46, -1.000000e+00
%48 = fmul double %47, 6.371200e+03
%49 = load double, double* %4
%50 = load double, double* %5
%51 = call i32 @AACGM_v2_Convert(double %49, double %50, double %48, double* %1, double* %2, double* %3, i32 1)
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.33, i64 0, i64 0))
%53 = load double, double* %4
%54 = load double, double* %5
%55 = load double, double* %1
%56 = load double, double* %2
%57 = load double, double* %3
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), double %53, double %54, double %48, double %55, double %56, double %57)
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.40, i64 0, i64 0))
store double 4.550000e+01, double* %1
store double -2.350000e+01, double* %2
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.28, i64 0, i64 0))
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.29, i64 0, i64 0))
%62 = load double, double* %1
%63 = load double, double* %2
%64 = call i32 @AACGM_v2_Convert(double %62, double %63, double 1.135000e+03, double* %4, double* %5, double* %6, i32 2)
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.30, i64 0, i64 0))
%66 = load double, double* %1
%67 = load double, double* %2
%68 = load double, double* %4
%69 = load double, double* %5
%70 = load double, double* %6
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), double %66, double %67, double 1.135000e+03, double %68, double %69, double %70)
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.40, i64 0, i64 0))
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.32, i64 0, i64 0))
%74 = load double, double* %6
%75 = fadd double %74, -1.000000e+00
%76 = fmul double %75, 6.371200e+03
%77 = load double, double* %4
%78 = load double, double* %5
%79 = call i32 @AACGM_v2_Convert(double %77, double %78, double %76, double* %1, double* %2, double* %3, i32 3)
%80 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.33, i64 0, i64 0))
%81 = load double, double* %4
%82 = load double, double* %5
%83 = load double, double* %1
%84 = load double, double* %2
%85 = load double, double* %3
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), double %81, double %82, double %76, double %83, double %84, double %85)
%87 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.40, i64 0, i64 0))
store double 4.550000e+01, double* %1
store double -2.350000e+01, double* %2
%88 = call i32 @AACGM_v2_SetDateTime(i32 2018, i32 1, i32 1, i32 0, i32 0, i32 0)
%89 = call i32 @line(i8 signext 45, i32 80)
%90 = call i32 @putchar(i32 10)
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.35, i64 0, i64 0))
%92 = call i32 @line(i8 signext 45, i32 80)
%93 = call i32 @putchar(i32 10)
store double 3.700000e+01, double* %1
store double -8.800000e+01, double* %2
%94 = call i32 @AACGM_v2_SetDateTime(i32 2003, i32 5, i32 17, i32 7, i32 53, i32 16)
%95 = load double, double* %1
%96 = load double, double* %2
%97 = call i32 @AACGM_v2_Convert(double %95, double %96, double 3.000000e+02, double* %4, double* %5, double* %6, i32 2)
%98 = load double, double* %5
%99 = call double @MLTConvertYMDHMS_v2(i32 2003, i32 5, i32 17, i32 7, i32 53, i32 16, double %98)
%100 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str.36, i64 0, i64 0))
%101 = load double, double* %1
%102 = load double, double* %2
%103 = load double, double* %4
%104 = load double, double* %5
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.17, i64 0, i64 0), double %101, double %102, double 3.000000e+02, double %103, double %104, double %99)
%106 = call i32 @putchar(i32 10)
%107 = load double, double* %1
%108 = load double, double* %2
%109 = call i32 @AACGM_v2_Convert(double %107, double %108, double 3.000000e+02, double* %4, double* %5, double* %6, i32 0)
%110 = load double, double* %5
%111 = call double @MLTConvertYMDHMS_v2(i32 2003, i32 5, i32 17, i32 7, i32 53, i32 16, double %110)
%112 = load double, double* %1
%113 = load double, double* %2
%114 = load double, double* %4
%115 = load double, double* %5
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.18, i64 0, i64 0), double %112, double %113, double 3.000000e+02, double %114, double %115, double %111)
%117 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.40, i64 0, i64 0))
%118 = call i32 @putchar(i32 10)
%119 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.38, i64 0, i64 0))
br label %120
120: ; preds = %29, %120
%121 = phi i32 [ 0, %29 ], [ %131, %120 ]
store double 4.500000e+01, double* %1
%122 = sitofp i32 %121 to double
store double %122, double* %2
%123 = call i32 @AACGM_v2_Convert(double 4.500000e+01, double %122, double 1.500000e+02, double* %4, double* %5, double* %6, i32 2)
%124 = load double, double* %5
%125 = call double @MLTConvertYMDHMS_v2(i32 2003, i32 5, i32 17, i32 7, i32 53, i32 16, double %124)
%126 = load double, double* %1
%127 = load double, double* %2
%128 = load double, double* %4
%129 = load double, double* %5
%130 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.20, i64 0, i64 0), double %126, double %127, double 1.500000e+02, double %128, double %129, double %125)
%131 = add nuw nsw i32 %121, 1
%132 = icmp eq i32 %131, 20
br i1 %132, label %133, label %120
133: ; preds = %120
%134 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.40, i64 0, i64 0))
ret i32 0
}