#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*/ exactE(double, double, double *, double *, double *,
                          double *, double *);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, double *);
int main() {
  const double SperA = 31556926.0;
  double year, r, x, y, HE, ME, muE, ubE, vbE;
  int scanret;
  printf("Enter  t  and  r  separated by space (or newline)\n");
  printf("    (in yrs and km, resp.; e.g. 15000 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("exact test E also requires cartesian location ...\n");
  printf("Enter  x  and  y  separated by space ");
  printf("(in km; e.g. 400 200):\n");
  scanret = scanf("%lf", &x);
  if (scanret != 1) {
    printf("... input error; exiting\n");
    return 1;
  }
  scanret = scanf("%lf", &y);
  if (scanret != 1) {
    printf("... input error; exiting\n");
    return 1;
  }
  exactE(x * 1000.0, y * 1000.0, &HE, &ME, &muE, &ubE, &vbE);
  printf("Results for Test E:\n");
  printf("    H = %12.6f (m)     M = %12.6f (m/a)    mu = %11.5e (m/(Pa s))\n",
         HE, ME * SperA, muE);
  printf("    u_b = %10.6f (m/a)   v_b = %10.6f (m/a)\n", ubE * SperA,
         vbE * SperA);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xeb9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf01(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x1,-0x5c(%rbp)
je     119f <main+0x6f>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1303 <main+0x1d3>
lea    0xeca(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x1,-0x5c(%rbp)
je     11d6 <main+0xa6>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1303 <main+0x1d3>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe69(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x1,-0x5c(%rbp)
je     1237 <main+0x107>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1303 <main+0x1d3>
lea    0xe32(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x1,-0x5c(%rbp)
je     126e <main+0x13e>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1303 <main+0x1d3>
movsd  0xd92(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xd85(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
lea    -0x38(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x50(%rbp),%rcx
lea    -0x58(%rbp),%r8
call   1030 <exactE@plt>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x38(%rbp),%xmm0
movsd  0xd44(%rip),%xmm1
mulsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
lea    0xe47(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movsd  0xd24(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  0xd17(%rip),%xmm1
mulsd  -0x58(%rbp),%xmm1
lea    0xe62(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
lea    0xf5f(%rip),%rdi
call   1030 <puts@plt>
lea    0xf85(%rip),%rdi
call   1030 <puts@plt>
lea    0xead(%rip),%rdi
lea    0x40(%rsp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    127e <main+0x13e>
lea    0xe93(%rip),%rdi
lea    0x38(%rsp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    127e <main+0x13e>
lea    0xf71(%rip),%rdi
call   1030 <puts@plt>
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf89(%rip),%rdi
call   1030 <puts@plt>
lea    0xe53(%rip),%rdi
lea    0x30(%rsp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    127e <main+0x13e>
lea    0xe39(%rip),%rdi
lea    0x28(%rsp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    127e <main+0x13e>
movsd  0xe0e(%rip),%xmm1
movsd  0x30(%rsp),%xmm0
mulsd  %xmm1,%xmm0
mulsd  0x28(%rsp),%xmm1
lea    0x20(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rsp,%r8
call   1040 <exactE@plt>
lea    0xf2c(%rip),%rdi
call   1030 <puts@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0xdca(%rip),%xmm1
movsd  0x10(%rsp),%xmm2
lea    0xdef(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
movsd  0xda8(%rip),%xmm1
mulsd  %xmm1,%xmm0
mulsd  (%rsp),%xmm1
lea    0xe0d(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Enter t and r separated by space (or newline)\0A\00"
@.str.1 = [45 x i8] c" (in yrs and km, resp.; e.g. 15000 500):\0A\00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [26 x i8] c"... input error; exiting\0A\00"
@.str.4 = [51 x i8] c"exact test E also requires cartesian location ...\0A\00"
@.str.5 = [38 x i8] c"Enter x and y separated by space \00"
@.str.6 = [24 x i8] c"(in km; e.g. 400 200):\0A\00"
@.str.7 = [21 x i8] c"Results for Test E:\0A\00"
@.str.8 = [67 x i8] c" H = %12.6f (m) M = %12.6f (m/a) mu = %11.5e (m/(Pa s))\0A\00"
@.str.9 = [45 x i8] c" u_b = %10.6f (m/a) v_b = %10.6f (m/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 i32
store i32 0, i32* %1
store double 0x417E1853E0000000, double* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %3)
store i32 %15, i32* %12
%16 = load i32, i32* %12
%17 = icmp ne i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %0
%19 = 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 %58
20: ; preds = %0
%21 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %4)
store i32 %21, i32* %12
%22 = load i32, i32* %12
%23 = icmp ne i32 %22, 1
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = 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 %58
26: ; preds = %20
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %5)
store i32 %30, i32* %12
%31 = load i32, i32* %12
%32 = icmp ne i32 %31, 1
br i1 %32, label %33, label %35
33: ; preds = %26
%34 = 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 %58
35: ; preds = %26
%36 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %6)
store i32 %36, i32* %12
%37 = load i32, i32* %12
%38 = icmp ne i32 %37, 1
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = 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 %58
41: ; preds = %35
%42 = load double, double* %5
%43 = fmul double %42, 1.000000e+03
%44 = load double, double* %6
%45 = fmul double %44, 1.000000e+03
%46 = call i32 @exactE(double %43, double %45, double* %7, double* %8, double* %9, double* %10, double* %11)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%48 = load double, double* %7
%49 = load double, double* %8
%50 = fmul double %49, 0x417E1853E0000000
%51 = load double, double* %9
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.8, i64 0, i64 0), double %48, double %50, double %51)
%53 = load double, double* %10
%54 = fmul double %53, 0x417E1853E0000000
%55 = load double, double* %11
%56 = fmul double %55, 0x417E1853E0000000
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0), double %54, double %56)
store i32 0, i32* %1
br label %58
58: ; preds = %41, %39, %33, %24, %18
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c"%lf\00"
@.str.5 = [38 x i8] c"Enter x and y separated by space \00"
@.str.8 = [67 x i8] c" H = %12.6f (m) M = %12.6f (m/a) mu = %11.5e (m/(Pa s))\0A\00"
@.str.9 = [45 x i8] c" u_b = %10.6f (m/a) v_b = %10.6f (m/a)\0A\00"
@str = [50 x i8] c"Enter t and r separated by space (or newline)\00"
@str.10 = [44 x i8] c" (in yrs and km, resp.; e.g. 15000 500):\00"
@str.11 = [50 x i8] c"exact test E also requires cartesian location ...\00"
@str.12 = [23 x i8] c"(in km; e.g. 400 200):\00"
@str.13 = [20 x i8] c"Results for Test E:\00"
@str.17 = [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 = alloca double
%8 = alloca double
%9 = alloca double
%10 = bitcast double* %1 to i8*
%11 = bitcast double* %2 to i8*
%12 = bitcast double* %3 to i8*
%13 = bitcast double* %4 to i8*
%14 = bitcast double* %5 to i8*
%15 = bitcast double* %6 to i8*
%16 = bitcast double* %7 to i8*
%17 = bitcast double* %8 to i8*
%18 = bitcast double* %9 to i8*
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.10, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %1)
%22 = icmp eq i32 %21, 1
br i1 %22, label %25, label %23
23: ; preds = %0
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.17, i64 0, i64 0))
br label %60
25: ; preds = %0
%26 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %2)
%27 = icmp eq i32 %26, 1
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.17, i64 0, i64 0))
br label %60
30: ; preds = %25
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.11, i64 0, i64 0))
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.12, i64 0, i64 0))
%34 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %3)
%35 = icmp eq i32 %34, 1
br i1 %35, label %38, label %36
36: ; preds = %30
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.17, i64 0, i64 0))
br label %60
38: ; preds = %30
%39 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %4)
%40 = icmp eq i32 %39, 1
br i1 %40, label %43, label %41
41: ; preds = %38
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.17, i64 0, i64 0))
br label %60
43: ; preds = %38
%44 = load double, double* %3
%45 = fmul double %44, 1.000000e+03
%46 = load double, double* %4
%47 = fmul double %46, 1.000000e+03
%48 = call i32 @exactE(double %45, double %47, double* %5, double* %6, double* %7, double* %8, double* %9)
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.13, i64 0, i64 0))
%50 = load double, double* %5
%51 = load double, double* %6
%52 = fmul double %51, 0x417E1853E0000000
%53 = load double, double* %7
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.8, i64 0, i64 0), double %50, double %52, double %53)
%55 = load double, double* %8
%56 = fmul double %55, 0x417E1853E0000000
%57 = load double, double* %9
%58 = fmul double %57, 0x417E1853E0000000
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0), double %56, double %58)
br label %60
60: ; preds = %43, %41, %36, %28, %23
%61 = phi i32 [ 1, %23 ], [ 1, %28 ], [ 1, %36 ], [ 1, %41 ], [ 0, %43 ]
ret i32 %61
}