#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 /*<<< orphan*/ bothexact(double, double, double *, int, double const,
                             double *, double *, double *, double *, double *,
                             double *, double *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, double *);
int /*<<< orphan*/ stderr;
int main() {
  const double SperA = 31556926.0;
  const double Cp = 200.0;
  double year, r, HF, MF, HG, MG;
  double *z = NULL, *TF = NULL, *UF = NULL, *wF = NULL, *SigF = NULL,
         *SigcF = NULL, *TG = NULL, *UG = NULL, *wG = NULL, *SigG = NULL,
         *SigcG = NULL;
  int j, Mz, scanret;
  printf("Enter  t  and  r  separated by space (or newline)\n");
  printf("       (in yrs and km, resp.; e.g. 500 500):\n");
  scanret = scanf("%lf", &year);
  if (scanret != 1) {
    printf("... input error; exiting\n");
    return 1;
  }
  scanret = scanf("%lf", &r);
  if (scanret != 1) {
    printf("... input error; exiting\n");
    return 1;
  }
  printf("Enter  z  values sep by space (in m);");
  printf(" '-1' to end; e.g. 0 100 500 1500 -1:\n");
  z = (double *)malloc(501 * sizeof(double));
  if (z == NULL) {
    fprintf(stderr, "\nERROR simpleFG: couldn't allocate memory for z!\n\n");
    goto cleanup;
  }
  j = 0;
  do {
    scanret = scanf("%lf", &z[j]);
    if (scanret != 1) {
      printf("... input error; exiting\n");
      goto cleanup;
    }
    j++;
    if (j > 490) {
      printf("\n\n\nWARNING simpleFG: enter -1 to stop soon!!!\n");
    }
  } while (z[j - 1] >= 0.0);
  Mz = j - 1;
  if (Mz < 1) {
    fprintf(stderr, "\nERROR simpleFG: need to have at least one z level!\n\n");
    goto cleanup;
  }
  TF = (double *)malloc((size_t)Mz * sizeof(double));
  if (TF == NULL) {
    fprintf(stderr, "\n memory allocation failed\n");
    goto cleanup;
  }
  UF = (double *)malloc((size_t)Mz * sizeof(double));
  if (UF == NULL) {
    fprintf(stderr, "\n memory allocation failed\n");
    goto cleanup;
  }
  wF = (double *)malloc((size_t)Mz * sizeof(double));
  if (wF == NULL) {
    fprintf(stderr, "\n memory allocation failed\n");
    goto cleanup;
  }
  SigF = (double *)malloc((size_t)Mz * sizeof(double));
  if (SigF == NULL) {
    fprintf(stderr, "\n memory allocation failed\n");
    goto cleanup;
  }
  SigcF = (double *)malloc((size_t)Mz * sizeof(double));
  if (SigcF == NULL) {
    fprintf(stderr, "\n memory allocation failed\n");
    goto cleanup;
  }
  TG = (double *)malloc((size_t)Mz * sizeof(double));
  if (TG == NULL) {
    fprintf(stderr, "\n memory allocation failed\n");
    goto cleanup;
  }
  UG = (double *)malloc((size_t)Mz * sizeof(double));
  if (UG == NULL) {
    fprintf(stderr, "\n memory allocation failed\n");
    goto cleanup;
  }
  wG = (double *)malloc((size_t)Mz * sizeof(double));
  if (wG == NULL) {
    fprintf(stderr, "\n memory allocation failed\n");
    goto cleanup;
  }
  SigG = (double *)malloc((size_t)Mz * sizeof(double));
  if (SigG == NULL) {
    fprintf(stderr, "\n memory allocation failed\n");
    goto cleanup;
  }
  SigcG = (double *)malloc((size_t)Mz * sizeof(double));
  if (SigcG == NULL) {
    fprintf(stderr, "\n memory allocation failed\n");
    goto cleanup;
  }
  bothexact(0.0, r * 1000.0, z, Mz, 0.0, &HF, &MF, TF, UF, wF, SigF, SigcF);
  bothexact(year * SperA, r * 1000.0, z, Mz, Cp, &HG, &MG, TG, UG, wG, SigG,
            SigcG);
  printf("\nResults:\n           Test F                         Test G\n");
  printf("(functions of r (resp. t and r) only):\n");
  printf("      H    = %12.6f (m)        H    = %12.6f (m)\n", HF, HG);
  printf("      M    = %12.6f (m/a)      M    = %12.6f (m/a)\n", MF * SperA,
         MG * SperA);
  for (j = 0; j < Mz; j++) {
    printf("(z=%10.3f):\n", z[j]);
    printf("      T    = %12.6f (K)        T    = %12.6f (K)\n", TF[j], TG[j]);
    printf("      U    = %12.6f (m/a)      U    = %12.6f (m/a)\n",
           UF[j] * SperA, UG[j] * SperA);
    printf("      w    = %12.6f (m/a)      w    = %12.6f (m/a)\n",
           wF[j] * SperA, wG[j] * SperA);
    printf("      Sig  = %12.6f (*)        Sig  = %12.6f (*)\n",
           SigF[j] * SperA * 1000.0, SigG[j] * SperA * 1000.0);
    printf("      Sigc = %12.6f (*)        Sigc = %12.6f (*)\n",
           SigcF[j] * SperA * 1000.0, SigcG[j] * SperA * 1000.0);
  }
  printf("(units: (*) = 10^-3 K/a)\n");
cleanup:
  free(z);
  free(TF);
  free(UF);
  free(wF);
  free(SigF);
  free(SigcF);
  free(TG);
  free(UG);
  free(wG);
  free(SigG);
  free(SigcG);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe79(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
movq   $0x0,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
movq   $0x0,-0x78(%rbp)
movq   $0x0,-0x80(%rbp)
movq   $0x0,-0x88(%rbp)
movq   $0x0,-0x90(%rbp)
movq   $0x0,-0x98(%rbp)
movq   $0x0,-0xa0(%rbp)
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe66(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1080 <scanf@plt>
mov    %eax,-0xac(%rbp)
cmpl   $0x1,-0xac(%rbp)
je     1249 <main+0xe9>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1942 <main+0x7e2>
lea    0xe29(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1080 <scanf@plt>
mov    %eax,-0xac(%rbp)
cmpl   $0x1,-0xac(%rbp)
je     1286 <main+0x126>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1942 <main+0x7e2>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfa8,%edi
call   1070 <malloc@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    12d5 <main+0x175>
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
lea    0xe19(%rip),%rsi
call   1060 <fprintf@plt>
jmp    18cc <main+0x76c>
movl   $0x0,-0xa4(%rbp)
mov    -0x50(%rbp),%rsi
movslq -0xa4(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xd81(%rip),%rdi
call   1080 <scanf@plt>
mov    %eax,-0xac(%rbp)
cmpl   $0x1,-0xac(%rbp)
je     1323 <main+0x1c3>
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18cc <main+0x76c>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
cmpl   $0x1ea,-0xa4(%rbp)
jle    1350 <main+0x1f0>
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1355 <main+0x1f5>
mov    -0x50(%rbp),%rax
mov    -0xa4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    12df <main+0x17f>
mov    -0xa4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xa8(%rbp)
cmpl   $0x1,-0xa8(%rbp)
jge    13ad <main+0x24d>
mov    0x2c46(%rip),%rax
mov    (%rax),%edi
lea    0xda3(%rip),%rsi
call   1060 <fprintf@plt>
jmp    18cc <main+0x76c>
movslq -0xa8(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    13e6 <main+0x286>
mov    0x2c0d(%rip),%rax
mov    (%rax),%edi
lea    0xda0(%rip),%rsi
call   1060 <fprintf@plt>
jmp    18cc <main+0x76c>
movslq -0xa8(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    141f <main+0x2bf>
mov    0x2bd4(%rip),%rax
mov    (%rax),%edi
lea    0xd67(%rip),%rsi
call   1060 <fprintf@plt>
jmp    18cc <main+0x76c>
movslq -0xa8(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    1458 <main+0x2f8>
mov    0x2b9b(%rip),%rax
mov    (%rax),%edi
lea    0xd2e(%rip),%rsi
call   1060 <fprintf@plt>
jmp    18cc <main+0x76c>
movslq -0xa8(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    1491 <main+0x331>
mov    0x2b62(%rip),%rax
mov    (%rax),%edi
lea    0xcf5(%rip),%rsi
call   1060 <fprintf@plt>
jmp    18cc <main+0x76c>
movslq -0xa8(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    14ca <main+0x36a>
mov    0x2b29(%rip),%rax
mov    (%rax),%edi
lea    0xcbc(%rip),%rsi
call   1060 <fprintf@plt>
jmp    18cc <main+0x76c>
movslq -0xa8(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
jne    1503 <main+0x3a3>
mov    0x2af0(%rip),%rax
mov    (%rax),%edi
lea    0xc83(%rip),%rsi
call   1060 <fprintf@plt>
jmp    18cc <main+0x76c>
movslq -0xa8(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x88(%rbp)
cmpq   $0x0,-0x88(%rbp)
jne    1542 <main+0x3e2>
mov    0x2ab1(%rip),%rax
mov    (%rax),%edi
lea    0xc44(%rip),%rsi
call   1060 <fprintf@plt>
jmp    18cc <main+0x76c>
movslq -0xa8(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x90(%rbp)
cmpq   $0x0,-0x90(%rbp)
jne    1581 <main+0x421>
mov    0x2a72(%rip),%rax
mov    (%rax),%edi
lea    0xc05(%rip),%rsi
call   1060 <fprintf@plt>
jmp    18cc <main+0x76c>
movslq -0xa8(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x98(%rbp)
cmpq   $0x0,-0x98(%rbp)
jne    15c0 <main+0x460>
mov    0x2a33(%rip),%rax
mov    (%rax),%edi
lea    0xbc6(%rip),%rsi
call   1060 <fprintf@plt>
jmp    18cc <main+0x76c>
movslq -0xa8(%rbp),%rdi
shl    $0x3,%rdi
call   1070 <malloc@plt>
mov    %rax,-0xa0(%rbp)
cmpq   $0x0,-0xa0(%rbp)
jne    15ff <main+0x49f>
mov    0x29f4(%rip),%rax
mov    (%rax),%edi
lea    0xb87(%rip),%rsi
call   1060 <fprintf@plt>
jmp    18cc <main+0x76c>
movsd  0xa09(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
mov    -0x50(%rbp),%rdi
mov    -0xa8(%rbp),%esi
mov    -0x58(%rbp),%r8
mov    -0x60(%rbp),%r9
mov    -0x68(%rbp),%r11
mov    -0x70(%rbp),%r10
mov    -0x78(%rbp),%rax
xorps  %xmm2,%xmm2
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
movaps %xmm2,%xmm0
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <bothexact@plt>
movsd  0x9b5(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0x9b0(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
mov    -0x50(%rbp),%rdi
mov    -0xa8(%rbp),%esi
mov    -0x80(%rbp),%r8
mov    -0x88(%rbp),%r9
mov    -0x90(%rbp),%r11
mov    -0x98(%rbp),%r10
mov    -0xa0(%rbp),%rax
movsd  0x969(%rip),%xmm2
lea    -0x40(%rbp),%rdx
lea    -0x48(%rbp),%rcx
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <bothexact@plt>
lea    0xadf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xb0d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
lea    0xb1d(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movsd  0x91a(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  0x90d(%rip),%xmm1
mulsd  -0x48(%rbp),%xmm1
lea    0xb27(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movl   $0x0,-0xa4(%rbp)
mov    -0xa4(%rbp),%eax
cmp    -0xa8(%rbp),%eax
jge    18be <main+0x75e>
mov    -0x50(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xb21(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x58(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x80(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xb00(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    -0x60(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsd  0x87f(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x88(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsd  0x864(%rip),%xmm1
mulsd  (%rax,%rcx,8),%xmm1
lea    0xaf1(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    -0x68(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsd  0x83e(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x90(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsd  0x823(%rip),%xmm1
mulsd  (%rax,%rcx,8),%xmm1
lea    0xae4(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    -0x70(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsd  0x7fd(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  0x7f8(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x98(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsd  0x7d6(%rip),%xmm1
mulsd  (%rax,%rcx,8),%xmm1
movsd  0x7d1(%rip),%xmm2
mulsd  %xmm2,%xmm1
lea    0xabf(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    -0x78(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsd  0x7a4(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  0x79f(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0xa0(%rbp),%rax
movslq -0xa4(%rbp),%rcx
movsd  0x77d(%rip),%xmm1
mulsd  (%rax,%rcx,8),%xmm1
movsd  0x778(%rip),%xmm2
mulsd  %xmm2,%xmm1
lea    0xa98(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    1718 <main+0x5b8>
lea    0xaa8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0x10bb(%rip),%rdi
call   1050 <puts@plt>
lea    0x10e1(%rip),%rdi
call   1050 <puts@plt>
lea    0xe83(%rip),%rdi
lea    0x70(%rsp),%rsi
call   1090 <scanf@plt>
cmp    $0x1,%eax
jne    1250 <main+0xe0>
lea    0xe69(%rip),%rdi
lea    0x48(%rsp),%rsi
call   1090 <scanf@plt>
cmp    $0x1,%eax
jne    1250 <main+0xe0>
lea    0xe53(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x10c0(%rip),%rdi
call   1050 <puts@plt>
mov    $0xfa8,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
test   %rax,%rax
je     1266 <main+0xf6>
mov    $0xffffffffffffffff,%rbp
xor    %ebx,%ebx
lea    0xe1a(%rip),%r13
lea    0x1133(%rip),%r12
jmp    1228 <main+0xb8>
nop
movsd  0x8(%r15,%rbp,8),%xmm0
add    $0x8,%rbx
ucomisd 0xdf5(%rip),%xmm0
mov    %r14,%rbp
jb     128c <main+0x11c>
lea    (%r15,%rbx,1),%rsi
mov    %r13,%rdi
call   1090 <scanf@plt>
cmp    $0x1,%eax
jne    127b <main+0x10b>
lea    0x1(%rbp),%r14
cmp    $0x1ea,%r14
jb     1210 <main+0xa0>
mov    %r12,%rdi
call   1050 <puts@plt>
jmp    1210 <main+0xa0>
lea    0x1117(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%eax
jmp    1674 <main+0x504>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
lea    0xdd4(%rip),%rsi
jmp    15db <main+0x46b>
lea    0x10ec(%rip),%rdi
call   1050 <puts@plt>
jmp    15e0 <main+0x470>
test   %r14d,%r14d
je     15b9 <main+0x449>
mov    %r14d,%ebp
shl    $0x3,%rbp
mov    %rbp,%rdi
call   1080 <malloc@plt>
test   %rax,%rax
je     15cb <main+0x45b>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1080 <malloc@plt>
mov    %rax,0x30(%rsp)
test   %rax,%rax
je     1683 <main+0x513>
mov    %rbp,%rdi
call   1080 <malloc@plt>
mov    %rax,0x38(%rsp)
test   %rax,%rax
je     169d <main+0x52d>
mov    %rbp,%rdi
call   1080 <malloc@plt>
test   %rax,%rax
je     16e8 <main+0x578>
mov    %rax,%r13
mov    %rbp,%rdi
call   1080 <malloc@plt>
test   %rax,%rax
je     1702 <main+0x592>
mov    %rax,%r12
mov    %rbp,%rdi
call   1080 <malloc@plt>
mov    %rax,0x28(%rsp)
test   %rax,%rax
je     174c <main+0x5dc>
mov    %rbp,%rdi
call   1080 <malloc@plt>
mov    %rax,0x20(%rsp)
test   %rax,%rax
je     1763 <main+0x5f3>
mov    %rbp,%rdi
call   1080 <malloc@plt>
test   %rax,%rax
je     177a <main+0x60a>
mov    %rax,0x18(%rsp)
mov    %rbp,%rdi
call   1080 <malloc@plt>
test   %rax,%rax
je     1791 <main+0x621>
mov    %rax,0x10(%rsp)
mov    %rbp,%rdi
call   1080 <malloc@plt>
test   %rax,%rax
je     17a8 <main+0x638>
movsd  0x48(%rsp),%xmm1
mulsd  0xc85(%rip),%xmm1
sub    $0x8,%rsp
lea    0x70(%rsp),%rdx
lea    0x68(%rsp),%rcx
xorpd  %xmm0,%xmm0
xorps  %xmm2,%xmm2
mov    %rax,0x10(%rsp)
mov    %r15,%rdi
mov    %r14d,%esi
mov    %rbx,0x48(%rsp)
mov    %rbx,%r8
mov    0x38(%rsp),%r9
push   %r12
push   %r13
push   0x50(%rsp)
call   1040 <bothexact@plt>
add    $0x20,%rsp
movsd  0x70(%rsp),%xmm0
mulsd  0xc41(%rip),%xmm0
movsd  0x48(%rsp),%xmm1
mulsd  0xc2b(%rip),%xmm1
sub    $0x8,%rsp
movsd  0xc2f(%rip),%xmm2
lea    0x60(%rsp),%rdx
lea    0x58(%rsp),%rcx
mov    %r15,%rdi
mov    %r14d,%esi
mov    0x30(%rsp),%r8
mov    0x28(%rsp),%rbp
mov    %rbp,%r9
mov    0x10(%rsp),%rax
push   %rax
push   0x20(%rsp)
push   0x30(%rsp)
call   1040 <bothexact@plt>
add    $0x20,%rsp
lea    0xea9(%rip),%rdi
call   1050 <puts@plt>
lea    0xed8(%rip),%rdi
call   1050 <puts@plt>
movsd  0x68(%rsp),%xmm0
movsd  0x58(%rsp),%xmm1
lea    0xc8f(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  0x60(%rsp),%xmm0
movsd  0xbb3(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0x50(%rsp),%xmm1
mulsd  %xmm2,%xmm1
lea    0xc97(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
mov    %r14d,%ebx
shl    $0x3,%rbx
xor    %r14d,%r14d
movsd  (%r15,%r14,1),%xmm0
lea    0xcad(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0x40(%rsp),%rax
movsd  (%rax,%r14,1),%xmm0
mov    0x28(%rsp),%rax
movsd  (%rax,%r14,1),%xmm1
lea    0xc96(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
mov    0x30(%rsp),%rax
movsd  (%rax,%r14,1),%xmm0
movsd  0xb42(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0x0(%rbp,%r14,1),%xmm1
mulsd  %xmm2,%xmm1
lea    0xc98(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
mov    0x38(%rsp),%rax
movsd  (%rax,%r14,1),%xmm0
movsd  0xb12(%rip),%xmm2
mulsd  %xmm2,%xmm0
mov    0x18(%rsp),%rax
movsd  (%rax,%r14,1),%xmm1
mulsd  %xmm2,%xmm1
lea    0xc98(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  0x0(%r13,%r14,1),%xmm0
movsd  0xae2(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xace(%rip),%xmm3
mulsd  %xmm3,%xmm0
mov    0x10(%rsp),%rax
movsd  (%rax,%r14,1),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
lea    0xc8c(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  (%r12,%r14,1),%xmm0
movsd  0xaa3(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xa8f(%rip),%xmm3
mulsd  %xmm3,%xmm0
mov    0x8(%rsp),%rax
movsd  (%rax,%r14,1),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
lea    0xc7f(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
add    $0x8,%r14
cmp    %r14,%rbx
jne    147b <main+0x30b>
lea    0xd7d(%rip),%rdi
call   1050 <puts@plt>
mov    0x40(%rsp),%rbx
jmp    173d <main+0x5cd>
mov    0x2a20(%rip),%rax
mov    (%rax),%edi
lea    0xab4(%rip),%rsi
jmp    15db <main+0x46b>
mov    0x2a0e(%rip),%rax
mov    (%rax),%edi
lea    0xad8(%rip),%rsi
call   1070 <fprintf@plt>
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r14d,%r14d
xor    %r13d,%r13d
xor    %r12d,%r12d
xor    %eax,%eax
mov    %rax,0x28(%rsp)
xor    %eax,%eax
mov    %rax,0x20(%rsp)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2956(%rip),%rax
mov    (%rax),%edi
lea    0xa20(%rip),%rsi
call   1070 <fprintf@plt>
jmp    15e2 <main+0x472>
mov    0x293c(%rip),%rax
mov    (%rax),%edi
lea    0xa06(%rip),%rsi
call   1070 <fprintf@plt>
xor    %r14d,%r14d
xor    %r13d,%r13d
xor    %r12d,%r12d
xor    %eax,%eax
mov    %rax,0x28(%rsp)
xor    %eax,%eax
mov    %rax,0x20(%rsp)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    0x30(%rsp),%rbp
jmp    1610 <main+0x4a0>
mov    0x28f1(%rip),%rax
mov    (%rax),%edi
lea    0x9bb(%rip),%rsi
call   1070 <fprintf@plt>
xor    %r13d,%r13d
jmp    1717 <main+0x5a7>
mov    0x28d7(%rip),%rax
mov    (%rax),%edi
lea    0x9a1(%rip),%rsi
call   1070 <fprintf@plt>
xor    %r12d,%r12d
xor    %eax,%eax
mov    %rax,0x28(%rsp)
xor    %eax,%eax
mov    %rax,0x20(%rsp)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    0x30(%rsp),%rbp
mov    0x38(%rsp),%r14
jmp    1610 <main+0x4a0>
mov    0x288d(%rip),%rax
mov    (%rax),%edi
lea    0x957(%rip),%rsi
call   1070 <fprintf@plt>
jmp    171a <main+0x5aa>
mov    0x2876(%rip),%rax
mov    (%rax),%edi
lea    0x940(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1721 <main+0x5b1>
mov    0x285f(%rip),%rax
mov    (%rax),%edi
lea    0x929(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1728 <main+0x5b8>
mov    0x2848(%rip),%rax
mov    (%rax),%edi
lea    0x912(%rip),%rsi
call   1070 <fprintf@plt>
jmp    172f <main+0x5bf>
mov    0x2831(%rip),%rax
mov    (%rax),%edi
lea    0x8fb(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1736 <main+0x5c6>

LLVM IR (-O0):
@.str = [51 x i8] c"Enter t and r separated by space (or newline)\0A\00"
@.str.1 = [46 x i8] c" (in yrs and km, resp.; e.g. 500 500):\0A\00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [26 x i8] c"... input error; exiting\0A\00"
@.str.4 = [38 x i8] c"Enter z values sep by space (in m);\00"
@.str.5 = [39 x i8] c" '-1' to end; e.g. 0 100 500 1500 -1:\0A\00"
@stderr = global i32 0
@.str.6 = [51 x i8] c"\0AERROR simpleFG: couldn't allocate memory for z!\0A\0A\00"
@.str.7 = [47 x i8] c"\0A\0A\0AWARNING simpleFG: enter -1 to stop soon!!!\0A\00"
@.str.8 = [54 x i8] c"\0AERROR simpleFG: need to have at least one z level!\0A\0A\00"
@.str.9 = [28 x i8] c"\0A memory allocation failed\0A\00"
@.str.10 = [60 x i8] c"\0AResults:\0A Test F Test G\0A\00"
@.str.11 = [40 x i8] c"(functions of r (resp. t and r) only):\0A\00"
@.str.12 = [50 x i8] c" H = %12.6f (m) H = %12.6f (m)\0A\00"
@.str.13 = [52 x i8] c" M = %12.6f (m/a) M = %12.6f (m/a)\0A\00"
@.str.14 = [13 x i8] c"(z=%10.3f):\0A\00"
@.str.15 = [50 x i8] c" T = %12.6f (K) T = %12.6f (K)\0A\00"
@.str.16 = [52 x i8] c" U = %12.6f (m/a) U = %12.6f (m/a)\0A\00"
@.str.17 = [52 x i8] c" w = %12.6f (m/a) w = %12.6f (m/a)\0A\00"
@.str.18 = [50 x i8] c" Sig = %12.6f (*) Sig = %12.6f (*)\0A\00"
@.str.19 = [50 x i8] c" Sigc = %12.6f (*) Sigc = %12.6f (*)\0A\00"
@.str.20 = [26 x i8] c"(units: (*) = 10^-3 K/a)\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 double
%9 = alloca double
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
store i32 0, i32* %1
store double 0x417E1853E0000000, double* %2
store double 2.000000e+02, double* %3
store double* null, double** %10
store double* null, double** %11
store double* null, double** %12
store double* null, double** %13
store double* null, double** %14
store double* null, double** %15
store double* null, double** %16
store double* null, double** %17
store double* null, double** %18
store double* null, double** %19
store double* null, double** %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %4)
store i32 %26, i32* %23
%27 = load i32, i32* %23
%28 = icmp ne i32 %27, 1
br i1 %28, label %29, label %31
29: ; preds = %0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %331
31: ; preds = %0
%32 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %5)
store i32 %32, i32* %23
%33 = load i32, i32* %23
%34 = icmp ne i32 %33, 1
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %331
37: ; preds = %31
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%40 = call i64 @malloc(i64 4008)
%41 = inttoptr i64 %40 to double*
store double* %41, double** %10
%42 = load double*, double** %10
%43 = icmp eq double* %42, null
br i1 %43, label %44, label %47
44: ; preds = %37
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0))
br label %308
47: ; preds = %37
store i32 0, i32* %21
br label %48
48: ; preds = %66, %47
%49 = load double*, double** %10
%50 = load i32, i32* %21
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
%53 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %52)
store i32 %53, i32* %23
%54 = load i32, i32* %23
%55 = icmp ne i32 %54, 1
br i1 %55, label %56, label %58
56: ; preds = %48
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %308
58: ; preds = %48
%59 = load i32, i32* %21
%60 = add nsw i32 %59, 1
store i32 %60, i32* %21
%61 = load i32, i32* %21
%62 = icmp sgt i32 %61, 490
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0))
br label %65
65: ; preds = %63, %58
br label %66
66: ; preds = %65
%67 = load double*, double** %10
%68 = load i32, i32* %21
%69 = sub nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %67, i64 %70
%72 = load double, double* %71
%73 = fcmp oge double %72, 0.000000e+00
br i1 %73, label %48, label %74
74: ; preds = %66
%75 = load i32, i32* %21
%76 = sub nsw i32 %75, 1
store i32 %76, i32* %22
%77 = load i32, i32* %22
%78 = icmp slt i32 %77, 1
br i1 %78, label %79, label %82
79: ; preds = %74
%80 = load i32, i32* @stderr
%81 = call i32 @fprintf(i32 %80, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0))
br label %308
82: ; preds = %74
%83 = load i32, i32* %22
%84 = sext i32 %83 to i64
%85 = mul i64 %84, 8
%86 = call i64 @malloc(i64 %85)
%87 = inttoptr i64 %86 to double*
store double* %87, double** %11
%88 = load double*, double** %11
%89 = icmp eq double* %88, null
br i1 %89, label %90, label %93
90: ; preds = %82
%91 = load i32, i32* @stderr
%92 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %308
93: ; preds = %82
%94 = load i32, i32* %22
%95 = sext i32 %94 to i64
%96 = mul i64 %95, 8
%97 = call i64 @malloc(i64 %96)
%98 = inttoptr i64 %97 to double*
store double* %98, double** %12
%99 = load double*, double** %12
%100 = icmp eq double* %99, null
br i1 %100, label %101, label %104
101: ; preds = %93
%102 = load i32, i32* @stderr
%103 = call i32 @fprintf(i32 %102, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %308
104: ; preds = %93
%105 = load i32, i32* %22
%106 = sext i32 %105 to i64
%107 = mul i64 %106, 8
%108 = call i64 @malloc(i64 %107)
%109 = inttoptr i64 %108 to double*
store double* %109, double** %13
%110 = load double*, double** %13
%111 = icmp eq double* %110, null
br i1 %111, label %112, label %115
112: ; preds = %104
%113 = load i32, i32* @stderr
%114 = call i32 @fprintf(i32 %113, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %308
115: ; preds = %104
%116 = load i32, i32* %22
%117 = sext i32 %116 to i64
%118 = mul i64 %117, 8
%119 = call i64 @malloc(i64 %118)
%120 = inttoptr i64 %119 to double*
store double* %120, double** %14
%121 = load double*, double** %14
%122 = icmp eq double* %121, null
br i1 %122, label %123, label %126
123: ; preds = %115
%124 = load i32, i32* @stderr
%125 = call i32 @fprintf(i32 %124, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %308
126: ; preds = %115
%127 = load i32, i32* %22
%128 = sext i32 %127 to i64
%129 = mul i64 %128, 8
%130 = call i64 @malloc(i64 %129)
%131 = inttoptr i64 %130 to double*
store double* %131, double** %15
%132 = load double*, double** %15
%133 = icmp eq double* %132, null
br i1 %133, label %134, label %137
134: ; preds = %126
%135 = load i32, i32* @stderr
%136 = call i32 @fprintf(i32 %135, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %308
137: ; preds = %126
%138 = load i32, i32* %22
%139 = sext i32 %138 to i64
%140 = mul i64 %139, 8
%141 = call i64 @malloc(i64 %140)
%142 = inttoptr i64 %141 to double*
store double* %142, double** %16
%143 = load double*, double** %16
%144 = icmp eq double* %143, null
br i1 %144, label %145, label %148
145: ; preds = %137
%146 = load i32, i32* @stderr
%147 = call i32 @fprintf(i32 %146, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %308
148: ; preds = %137
%149 = load i32, i32* %22
%150 = sext i32 %149 to i64
%151 = mul i64 %150, 8
%152 = call i64 @malloc(i64 %151)
%153 = inttoptr i64 %152 to double*
store double* %153, double** %17
%154 = load double*, double** %17
%155 = icmp eq double* %154, null
br i1 %155, label %156, label %159
156: ; preds = %148
%157 = load i32, i32* @stderr
%158 = call i32 @fprintf(i32 %157, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %308
159: ; preds = %148
%160 = load i32, i32* %22
%161 = sext i32 %160 to i64
%162 = mul i64 %161, 8
%163 = call i64 @malloc(i64 %162)
%164 = inttoptr i64 %163 to double*
store double* %164, double** %18
%165 = load double*, double** %18
%166 = icmp eq double* %165, null
br i1 %166, label %167, label %170
167: ; preds = %159
%168 = load i32, i32* @stderr
%169 = call i32 @fprintf(i32 %168, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %308
170: ; preds = %159
%171 = load i32, i32* %22
%172 = sext i32 %171 to i64
%173 = mul i64 %172, 8
%174 = call i64 @malloc(i64 %173)
%175 = inttoptr i64 %174 to double*
store double* %175, double** %19
%176 = load double*, double** %19
%177 = icmp eq double* %176, null
br i1 %177, label %178, label %181
178: ; preds = %170
%179 = load i32, i32* @stderr
%180 = call i32 @fprintf(i32 %179, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %308
181: ; preds = %170
%182 = load i32, i32* %22
%183 = sext i32 %182 to i64
%184 = mul i64 %183, 8
%185 = call i64 @malloc(i64 %184)
%186 = inttoptr i64 %185 to double*
store double* %186, double** %20
%187 = load double*, double** %20
%188 = icmp eq double* %187, null
br i1 %188, label %189, label %192
189: ; preds = %181
%190 = load i32, i32* @stderr
%191 = call i32 @fprintf(i32 %190, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %308
192: ; preds = %181
%193 = load double, double* %5
%194 = fmul double %193, 1.000000e+03
%195 = load double*, double** %10
%196 = load i32, i32* %22
%197 = load double*, double** %11
%198 = load double*, double** %12
%199 = load double*, double** %13
%200 = load double*, double** %14
%201 = load double*, double** %15
%202 = call i32 @bothexact(double 0.000000e+00, double %194, double* %195, i32 %196, double 0.000000e+00, double* %6, double* %7, double* %197, double* %198, double* %199, double* %200, double* %201)
%203 = load double, double* %4
%204 = fmul double %203, 0x417E1853E0000000
%205 = load double, double* %5
%206 = fmul double %205, 1.000000e+03
%207 = load double*, double** %10
%208 = load i32, i32* %22
%209 = load double*, double** %16
%210 = load double*, double** %17
%211 = load double*, double** %18
%212 = load double*, double** %19
%213 = load double*, double** %20
%214 = call i32 @bothexact(double %204, double %206, double* %207, i32 %208, double 2.000000e+02, double* %8, double* %9, double* %209, double* %210, double* %211, double* %212, double* %213)
%215 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.10, i64 0, i64 0))
%216 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0))
%217 = load double, double* %6
%218 = load double, double* %8
%219 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.12, i64 0, i64 0), double %217, double %218)
%220 = load double, double* %7
%221 = fmul double %220, 0x417E1853E0000000
%222 = load double, double* %9
%223 = fmul double %222, 0x417E1853E0000000
%224 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.13, i64 0, i64 0), double %221, double %223)
store i32 0, i32* %21
br label %225
225: ; preds = %303, %192
%226 = load i32, i32* %21
%227 = load i32, i32* %22
%228 = icmp slt i32 %226, %227
br i1 %228, label %229, label %306
229: ; preds = %225
%230 = load double*, double** %10
%231 = load i32, i32* %21
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds double, double* %230, i64 %232
%234 = load double, double* %233
%235 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), double %234)
%236 = load double*, double** %11
%237 = load i32, i32* %21
%238 = sext i32 %237 to i64
%239 = getelementptr inbounds double, double* %236, i64 %238
%240 = load double, double* %239
%241 = load double*, double** %16
%242 = load i32, i32* %21
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds double, double* %241, i64 %243
%245 = load double, double* %244
%246 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.15, i64 0, i64 0), double %240, double %245)
%247 = load double*, double** %12
%248 = load i32, i32* %21
%249 = sext i32 %248 to i64
%250 = getelementptr inbounds double, double* %247, i64 %249
%251 = load double, double* %250
%252 = fmul double %251, 0x417E1853E0000000
%253 = load double*, double** %17
%254 = load i32, i32* %21
%255 = sext i32 %254 to i64
%256 = getelementptr inbounds double, double* %253, i64 %255
%257 = load double, double* %256
%258 = fmul double %257, 0x417E1853E0000000
%259 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.16, i64 0, i64 0), double %252, double %258)
%260 = load double*, double** %13
%261 = load i32, i32* %21
%262 = sext i32 %261 to i64
%263 = getelementptr inbounds double, double* %260, i64 %262
%264 = load double, double* %263
%265 = fmul double %264, 0x417E1853E0000000
%266 = load double*, double** %18
%267 = load i32, i32* %21
%268 = sext i32 %267 to i64
%269 = getelementptr inbounds double, double* %266, i64 %268
%270 = load double, double* %269
%271 = fmul double %270, 0x417E1853E0000000
%272 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.17, i64 0, i64 0), double %265, double %271)
%273 = load double*, double** %14
%274 = load i32, i32* %21
%275 = sext i32 %274 to i64
%276 = getelementptr inbounds double, double* %273, i64 %275
%277 = load double, double* %276
%278 = fmul double %277, 0x417E1853E0000000
%279 = fmul double %278, 1.000000e+03
%280 = load double*, double** %19
%281 = load i32, i32* %21
%282 = sext i32 %281 to i64
%283 = getelementptr inbounds double, double* %280, i64 %282
%284 = load double, double* %283
%285 = fmul double %284, 0x417E1853E0000000
%286 = fmul double %285, 1.000000e+03
%287 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.18, i64 0, i64 0), double %279, double %286)
%288 = load double*, double** %15
%289 = load i32, i32* %21
%290 = sext i32 %289 to i64
%291 = getelementptr inbounds double, double* %288, i64 %290
%292 = load double, double* %291
%293 = fmul double %292, 0x417E1853E0000000
%294 = fmul double %293, 1.000000e+03
%295 = load double*, double** %20
%296 = load i32, i32* %21
%297 = sext i32 %296 to i64
%298 = getelementptr inbounds double, double* %295, i64 %297
%299 = load double, double* %298
%300 = fmul double %299, 0x417E1853E0000000
%301 = fmul double %300, 1.000000e+03
%302 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.19, i64 0, i64 0), double %294, double %301)
br label %303
303: ; preds = %229
%304 = load i32, i32* %21
%305 = add nsw i32 %304, 1
store i32 %305, i32* %21
br label %225
306: ; preds = %225
%307 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.20, i64 0, i64 0))
br label %308
308: ; preds = %306, %189, %178, %167, %156, %145, %134, %123, %112, %101, %90, %79, %56, %44
%309 = load double*, double** %10
%310 = call i32 @free(double* %309)
%311 = load double*, double** %11
%312 = call i32 @free(double* %311)
%313 = load double*, double** %12
%314 = call i32 @free(double* %313)
%315 = load double*, double** %13
%316 = call i32 @free(double* %315)
%317 = load double*, double** %14
%318 = call i32 @free(double* %317)
%319 = load double*, double** %15
%320 = call i32 @free(double* %319)
%321 = load double*, double** %16
%322 = call i32 @free(double* %321)
%323 = load double*, double** %17
%324 = call i32 @free(double* %323)
%325 = load double*, double** %18
%326 = call i32 @free(double* %325)
%327 = load double*, double** %19
%328 = call i32 @free(double* %327)
%329 = load double*, double** %20
%330 = call i32 @free(double* %329)
store i32 0, i32* %1
br label %331
331: ; preds = %308, %35, %29
%332 = load i32, i32* %1
ret i32 %332
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c"%lf\00"
@.str.4 = [38 x i8] c"Enter z values sep by space (in m);\00"
@stderr = global i32 0
@.str.6 = [51 x i8] c"\0AERROR simpleFG: couldn't allocate memory for z!\0A\0A\00"
@.str.8 = [54 x i8] c"\0AERROR simpleFG: need to have at least one z level!\0A\0A\00"
@.str.9 = [28 x i8] c"\0A memory allocation failed\0A\00"
@.str.12 = [50 x i8] c" H = %12.6f (m) H = %12.6f (m)\0A\00"
@.str.13 = [52 x i8] c" M = %12.6f (m/a) M = %12.6f (m/a)\0A\00"
@.str.14 = [13 x i8] c"(z=%10.3f):\0A\00"
@.str.15 = [50 x i8] c" T = %12.6f (K) T = %12.6f (K)\0A\00"
@.str.16 = [52 x i8] c" U = %12.6f (m/a) U = %12.6f (m/a)\0A\00"
@.str.17 = [52 x i8] c" w = %12.6f (m/a) w = %12.6f (m/a)\0A\00"
@.str.18 = [50 x i8] c" Sig = %12.6f (*) Sig = %12.6f (*)\0A\00"
@.str.19 = [50 x i8] c" Sigc = %12.6f (*) Sigc = %12.6f (*)\0A\00"
@str = [50 x i8] c"Enter t and r separated by space (or newline)\00"
@str.21 = [45 x i8] c" (in yrs and km, resp.; e.g. 500 500):\00"
@str.22 = [38 x i8] c" '-1' to end; e.g. 0 100 500 1500 -1:\00"
@str.23 = [59 x i8] c"\0AResults:\0A Test F Test G\00"
@str.24 = [39 x i8] c"(functions of r (resp. t and r) only):\00"
@str.25 = [25 x i8] c"(units: (*) = 10^-3 K/a)\00"
@str.26 = [46 x i8] c"\0A\0A\0AWARNING simpleFG: enter -1 to stop soon!!!\00"
@str.29 = [25 x i8] c"... input error; exiting\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.21, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %1)
%16 = icmp eq i32 %15, 1
br i1 %16, label %19, label %17
17: ; preds = %0
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.29, i64 0, i64 0))
br label %213
19: ; preds = %0
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %2)
%21 = icmp eq i32 %20, 1
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.29, i64 0, i64 0))
br label %213
24: ; preds = %19
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.22, i64 0, i64 0))
%27 = call i64 @malloc(i64 4008)
%28 = inttoptr i64 %27 to double*
%29 = icmp eq i64 %27, 0
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0))
br label %191
33: ; preds = %24, %45
%34 = phi i64 [ %41, %45 ], [ 0, %24 ]
%35 = getelementptr inbounds double, double* %28, i64 %34
%36 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %35)
%37 = icmp eq i32 %36, 1
br i1 %37, label %40, label %38
38: ; preds = %33
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.29, i64 0, i64 0))
br label %191
40: ; preds = %33
%41 = add nuw i64 %34, 1
%42 = icmp ugt i64 %34, 489
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.26, i64 0, i64 0))
br label %45
45: ; preds = %40, %43
%46 = load double, double* %35
%47 = fcmp ult double %46, 0.000000e+00
br i1 %47, label %48, label %33
48: ; preds = %45
%49 = trunc i64 %34 to i32
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load i32, i32* @stderr
%53 = call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0))
br label %191
54: ; preds = %48
%55 = and i64 %34, 4294967295
%56 = shl nuw nsw i64 %55, 3
%57 = call i64 @malloc(i64 %56)
%58 = inttoptr i64 %57 to double*
%59 = icmp eq i64 %57, 0
br i1 %59, label %60, label %63
60: ; preds = %54
%61 = load i32, i32* @stderr
%62 = call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %191
63: ; preds = %54
%64 = call i64 @malloc(i64 %56)
%65 = inttoptr i64 %64 to double*
%66 = icmp eq i64 %64, 0
br i1 %66, label %67, label %70
67: ; preds = %63
%68 = load i32, i32* @stderr
%69 = call i32 @fprintf(i32 %68, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %191
70: ; preds = %63
%71 = call i64 @malloc(i64 %56)
%72 = inttoptr i64 %71 to double*
%73 = icmp eq i64 %71, 0
br i1 %73, label %74, label %77
74: ; preds = %70
%75 = load i32, i32* @stderr
%76 = call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %191
77: ; preds = %70
%78 = call i64 @malloc(i64 %56)
%79 = inttoptr i64 %78 to double*
%80 = icmp eq i64 %78, 0
br i1 %80, label %81, label %84
81: ; preds = %77
%82 = load i32, i32* @stderr
%83 = call i32 @fprintf(i32 %82, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %191
84: ; preds = %77
%85 = call i64 @malloc(i64 %56)
%86 = inttoptr i64 %85 to double*
%87 = icmp eq i64 %85, 0
br i1 %87, label %88, label %91
88: ; preds = %84
%89 = load i32, i32* @stderr
%90 = call i32 @fprintf(i32 %89, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %191
91: ; preds = %84
%92 = call i64 @malloc(i64 %56)
%93 = inttoptr i64 %92 to double*
%94 = icmp eq i64 %92, 0
br i1 %94, label %95, label %98
95: ; preds = %91
%96 = load i32, i32* @stderr
%97 = call i32 @fprintf(i32 %96, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %191
98: ; preds = %91
%99 = call i64 @malloc(i64 %56)
%100 = inttoptr i64 %99 to double*
%101 = icmp eq i64 %99, 0
br i1 %101, label %102, label %105
102: ; preds = %98
%103 = load i32, i32* @stderr
%104 = call i32 @fprintf(i32 %103, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %191
105: ; preds = %98
%106 = call i64 @malloc(i64 %56)
%107 = inttoptr i64 %106 to double*
%108 = icmp eq i64 %106, 0
br i1 %108, label %109, label %112
109: ; preds = %105
%110 = load i32, i32* @stderr
%111 = call i32 @fprintf(i32 %110, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %191
112: ; preds = %105
%113 = call i64 @malloc(i64 %56)
%114 = inttoptr i64 %113 to double*
%115 = icmp eq i64 %113, 0
br i1 %115, label %116, label %119
116: ; preds = %112
%117 = load i32, i32* @stderr
%118 = call i32 @fprintf(i32 %117, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %191
119: ; preds = %112
%120 = call i64 @malloc(i64 %56)
%121 = inttoptr i64 %120 to double*
%122 = icmp eq i64 %120, 0
br i1 %122, label %123, label %126
123: ; preds = %119
%124 = load i32, i32* @stderr
%125 = call i32 @fprintf(i32 %124, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %191
126: ; preds = %119
%127 = load double, double* %2
%128 = fmul double %127, 1.000000e+03
%129 = call i32 @bothexact(double 0.000000e+00, double %128, double* %28, i32 %49, double 0.000000e+00, double* %3, double* %4, double* %58, double* %65, double* %72, double* %79, double* %86)
%130 = load double, double* %1
%131 = fmul double %130, 0x417E1853E0000000
%132 = load double, double* %2
%133 = fmul double %132, 1.000000e+03
%134 = call i32 @bothexact(double %131, double %133, double* %28, i32 %49, double 2.000000e+02, double* %5, double* %6, double* %93, double* %100, double* %107, double* %114, double* %121)
%135 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.23, i64 0, i64 0))
%136 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.24, i64 0, i64 0))
%137 = load double, double* %3
%138 = load double, double* %5
%139 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.12, i64 0, i64 0), double %137, double %138)
%140 = load double, double* %4
%141 = fmul double %140, 0x417E1853E0000000
%142 = load double, double* %6
%143 = fmul double %142, 0x417E1853E0000000
%144 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.13, i64 0, i64 0), double %141, double %143)
br label %145
145: ; preds = %126, %145
%146 = phi i64 [ 0, %126 ], [ %187, %145 ]
%147 = getelementptr inbounds double, double* %28, i64 %146
%148 = load double, double* %147
%149 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), double %148)
%150 = getelementptr inbounds double, double* %58, i64 %146
%151 = load double, double* %150
%152 = getelementptr inbounds double, double* %93, i64 %146
%153 = load double, double* %152
%154 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.15, i64 0, i64 0), double %151, double %153)
%155 = getelementptr inbounds double, double* %65, i64 %146
%156 = load double, double* %155
%157 = fmul double %156, 0x417E1853E0000000
%158 = getelementptr inbounds double, double* %100, i64 %146
%159 = load double, double* %158
%160 = fmul double %159, 0x417E1853E0000000
%161 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.16, i64 0, i64 0), double %157, double %160)
%162 = getelementptr inbounds double, double* %72, i64 %146
%163 = load double, double* %162
%164 = fmul double %163, 0x417E1853E0000000
%165 = getelementptr inbounds double, double* %107, i64 %146
%166 = load double, double* %165
%167 = fmul double %166, 0x417E1853E0000000
%168 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.17, i64 0, i64 0), double %164, double %167)
%169 = getelementptr inbounds double, double* %79, i64 %146
%170 = load double, double* %169
%171 = fmul double %170, 0x417E1853E0000000
%172 = fmul double %171, 1.000000e+03
%173 = getelementptr inbounds double, double* %114, i64 %146
%174 = load double, double* %173
%175 = fmul double %174, 0x417E1853E0000000
%176 = fmul double %175, 1.000000e+03
%177 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.18, i64 0, i64 0), double %172, double %176)
%178 = getelementptr inbounds double, double* %86, i64 %146
%179 = load double, double* %178
%180 = fmul double %179, 0x417E1853E0000000
%181 = fmul double %180, 1.000000e+03
%182 = getelementptr inbounds double, double* %121, i64 %146
%183 = load double, double* %182
%184 = fmul double %183, 0x417E1853E0000000
%185 = fmul double %184, 1.000000e+03
%186 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.19, i64 0, i64 0), double %181, double %185)
%187 = add nuw nsw i64 %146, 1
%188 = icmp eq i64 %187, %55
br i1 %188, label %189, label %145
189: ; preds = %145
%190 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.25, i64 0, i64 0))
br label %191
191: ; preds = %189, %123, %116, %109, %102, %95, %88, %81, %74, %67, %60, %51, %38, %30
%192 = phi double* [ null, %30 ], [ null, %38 ], [ null, %51 ], [ null, %60 ], [ %58, %67 ], [ %58, %74 ], [ %58, %81 ], [ %58, %88 ], [ %58, %95 ], [ %58, %102 ], [ %58, %109 ], [ %58, %116 ], [ %58, %123 ], [ %58, %189 ]
%193 = phi double* [ null, %30 ], [ null, %38 ], [ null, %51 ], [ null, %60 ], [ null, %67 ], [ %65, %74 ], [ %65, %81 ], [ %65, %88 ], [ %65, %95 ], [ %65, %102 ], [ %65, %109 ], [ %65, %116 ], [ %65, %123 ], [ %65, %189 ]
%194 = phi double* [ null, %30 ], [ null, %38 ], [ null, %51 ], [ null, %60 ], [ null, %67 ], [ null, %74 ], [ %72, %81 ], [ %72, %88 ], [ %72, %95 ], [ %72, %102 ], [ %72, %109 ], [ %72, %116 ], [ %72, %123 ], [ %72, %189 ]
%195 = phi double* [ null, %30 ], [ null, %38 ], [ null, %51 ], [ null, %60 ], [ null, %67 ], [ null, %74 ], [ null, %81 ], [ %79, %88 ], [ %79, %95 ], [ %79, %102 ], [ %79, %109 ], [ %79, %116 ], [ %79, %123 ], [ %79, %189 ]
%196 = phi double* [ null, %30 ], [ null, %38 ], [ null, %51 ], [ null, %60 ], [ null, %67 ], [ null, %74 ], [ null, %81 ], [ null, %88 ], [ %86, %95 ], [ %86, %102 ], [ %86, %109 ], [ %86, %116 ], [ %86, %123 ], [ %86, %189 ]
%197 = phi double* [ null, %30 ], [ null, %38 ], [ null, %51 ], [ null, %60 ], [ null, %67 ], [ null, %74 ], [ null, %81 ], [ null, %88 ], [ null, %95 ], [ %93, %102 ], [ %93, %109 ], [ %93, %116 ], [ %93, %123 ], [ %93, %189 ]
%198 = phi double* [ null, %30 ], [ null, %38 ], [ null, %51 ], [ null, %60 ], [ null, %67 ], [ null, %74 ], [ null, %81 ], [ null, %88 ], [ null, %95 ], [ null, %102 ], [ %100, %109 ], [ %100, %116 ], [ %100, %123 ], [ %100, %189 ]
%199 = phi double* [ null, %30 ], [ null, %38 ], [ null, %51 ], [ null, %60 ], [ null, %67 ], [ null, %74 ], [ null, %81 ], [ null, %88 ], [ null, %95 ], [ null, %102 ], [ null, %109 ], [ %107, %116 ], [ %107, %123 ], [ %107, %189 ]
%200 = phi double* [ null, %30 ], [ null, %38 ], [ null, %51 ], [ null, %60 ], [ null, %67 ], [ null, %74 ], [ null, %81 ], [ null, %88 ], [ null, %95 ], [ null, %102 ], [ null, %109 ], [ null, %116 ], [ %114, %123 ], [ %114, %189 ]
%201 = phi double* [ null, %30 ], [ null, %38 ], [ null, %51 ], [ null, %60 ], [ null, %67 ], [ null, %74 ], [ null, %81 ], [ null, %88 ], [ null, %95 ], [ null, %102 ], [ null, %109 ], [ null, %116 ], [ null, %123 ], [ %121, %189 ]
%202 = call i32 @free(double* %28)
%203 = call i32 @free(double* %192)
%204 = call i32 @free(double* %193)
%205 = call i32 @free(double* %194)
%206 = call i32 @free(double* %195)
%207 = call i32 @free(double* %196)
%208 = call i32 @free(double* %197)
%209 = call i32 @free(double* %198)
%210 = call i32 @free(double* %199)
%211 = call i32 @free(double* %200)
%212 = call i32 @free(double* %201)
br label %213
213: ; preds = %191, %22, %17
%214 = phi i32 [ 1, %17 ], [ 1, %22 ], [ 0, %191 ]
ret i32 %214
}