#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*/ exactA(double, double *, double *);
int /*<<< orphan*/ exactB(double, double, double *, double *);
int /*<<< orphan*/ exactC(double, double, double *, double *);
int /*<<< orphan*/ exactD(double, double, double *, double *);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, double *);
int main() {
  const double SperA = 31556926.0;
  double year, r, HA, MA, HB, MB, HC, MC, HD, MD;
  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;
  }
  exactA(r * 1000.0, &HA, &MA);
  exactB(year * SperA, r * 1000.0, &HB, &MB);
  exactC(year * SperA, r * 1000.0, &HC, &MC);
  exactD(year * SperA, r * 1000.0, &HD, &MD);
  printf("Results:\n");
  printf("    Test A              Test B            ");
  printf("  Test C              Test D\n");
  printf("  H = %9.4f (m)   H = %9.4f (m)   H = %9.4f (m)   ", HA, HB, HC);
  printf("H = %9.4f (m)\n", HD);
  printf("  M = %8.5f (m/a)  M = %8.5f (m/a)  M = %8.5f (m/a)  ", MA * SperA,
         MB * SperA, MC * SperA);
  printf("M = %8.5f (m/a)\n\n", MD * SperA);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xe89(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1080 <scanf@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0x1,-0x64(%rbp)
je     11cf <main+0x6f>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1346 <main+0x1e6>
lea    0xe9a(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1080 <scanf@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0x1,-0x64(%rbp)
je     1206 <main+0xa6>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1346 <main+0x1e6>
movsd  0xdfa(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <exactA@plt>
movsd  0xdd8(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xdd3(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
lea    -0x38(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1070 <exactB@plt>
movsd  0xdb1(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xdac(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
lea    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1030 <exactC@plt>
movsd  0xd8a(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xd85(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1060 <exactD@plt>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
lea    0xe0c(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movsd  -0x58(%rbp),%xmm0
lea    0xe2c(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0xd09(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  0xcfc(%rip),%xmm1
mulsd  -0x40(%rbp),%xmm1
movsd  0xcef(%rip),%xmm2
mulsd  -0x50(%rbp),%xmm2
lea    0xe06(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0xcd4(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
lea    0xe21(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xf4d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf73(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7c(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1090 <scanf@plt>
cmp    $0x1,%eax
jne    1307 <main+0x197>
lea    0xe62(%rip),%rdi
mov    %rsp,%rsi
call   1090 <scanf@plt>
cmp    $0x1,%eax
jne    1307 <main+0x197>
movsd  (%rsp),%xmm0
mulsd  0xe34(%rip),%xmm0
lea    0x48(%rsp),%rdi
lea    0x40(%rsp),%rsi
call   1050 <exactA@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xe1f(%rip),%xmm0
movsd  (%rsp),%xmm1
mulsd  0xe0a(%rip),%xmm1
lea    0x38(%rsp),%rdi
lea    0x30(%rsp),%rsi
call   1080 <exactB@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xdf5(%rip),%xmm0
movsd  (%rsp),%xmm1
mulsd  0xde0(%rip),%xmm1
lea    0x28(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1040 <exactC@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xdcb(%rip),%xmm0
movsd  0xdbb(%rip),%xmm1
mulsd  (%rsp),%xmm1
lea    0x18(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1070 <exactD@plt>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xda8(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
movsd  0x48(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
lea    0xda5(%rip),%rdi
mov    $0x3,%al
call   1060 <printf@plt>
movsd  0x18(%rsp),%xmm0
lea    0xdc4(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  0x40(%rsp),%xmm0
movsd  0xd45(%rip),%xmm3
mulsd  %xmm3,%xmm0
movsd  0x30(%rsp),%xmm1
mulsd  %xmm3,%xmm1
movsd  0x20(%rsp),%xmm2
mulsd  %xmm3,%xmm2
lea    0xd9f(%rip),%rdi
mov    $0x3,%al
call   1060 <printf@plt>
movsd  0xd17(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
lea    0xdb9(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
jmp    1318 <main+0x1a8>
lea    0xe3f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x50,%rsp
pop    %rbx
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 = [10 x i8] c"Results:\0A\00"
@.str.5 = [43 x i8] c" Test A Test B \00"
@.str.6 = [30 x i8] c" Test C Test D\0A\00"
@.str.7 = [51 x i8] c" H = %9.4f (m) H = %9.4f (m) H = %9.4f (m) \00"
@.str.8 = [15 x i8] c"H = %9.4f (m)\0A\00"
@.str.9 = [54 x i8] c" M = %8.5f (m/a) M = %8.5f (m/a) M = %8.5f (m/a) \00"
@.str.10 = [18 x i8] c"M = %8.5f (m/a)\0A\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 i32
store i32 0, i32* %1
store double 0x417E1853E0000000, double* %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %3)
store i32 %16, i32* %13
%17 = load i32, i32* %13
%18 = icmp ne i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %0
%20 = 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 %65
21: ; preds = %0
%22 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %4)
store i32 %22, i32* %13
%23 = load i32, i32* %13
%24 = icmp ne i32 %23, 1
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = 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 %65
27: ; preds = %21
%28 = load double, double* %4
%29 = fmul double %28, 1.000000e+03
%30 = call i32 @exactA(double %29, double* %5, double* %6)
%31 = load double, double* %3
%32 = fmul double %31, 0x417E1853E0000000
%33 = load double, double* %4
%34 = fmul double %33, 1.000000e+03
%35 = call i32 @exactB(double %32, double %34, double* %7, double* %8)
%36 = load double, double* %3
%37 = fmul double %36, 0x417E1853E0000000
%38 = load double, double* %4
%39 = fmul double %38, 1.000000e+03
%40 = call i32 @exactC(double %37, double %39, double* %9, double* %10)
%41 = load double, double* %3
%42 = fmul double %41, 0x417E1853E0000000
%43 = load double, double* %4
%44 = fmul double %43, 1.000000e+03
%45 = call i32 @exactD(double %42, double %44, double* %11, double* %12)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%49 = load double, double* %5
%50 = load double, double* %7
%51 = load double, double* %9
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0), double %49, double %50, double %51)
%53 = load double, double* %11
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), double %53)
%55 = load double, double* %6
%56 = fmul double %55, 0x417E1853E0000000
%57 = load double, double* %8
%58 = fmul double %57, 0x417E1853E0000000
%59 = load double, double* %10
%60 = fmul double %59, 0x417E1853E0000000
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0), double %56, double %58, double %60)
%62 = load double, double* %12
%63 = fmul double %62, 0x417E1853E0000000
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), double %63)
store i32 0, i32* %1
br label %65
65: ; preds = %27, %25, %19
%66 = load i32, i32* %1
ret i32 %66
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c"%lf\00"
@.str.5 = [43 x i8] c" Test A Test B \00"
@.str.7 = [51 x i8] c" H = %9.4f (m) H = %9.4f (m) H = %9.4f (m) \00"
@.str.8 = [15 x i8] c"H = %9.4f (m)\0A\00"
@.str.9 = [54 x i8] c" M = %8.5f (m/a) M = %8.5f (m/a) M = %8.5f (m/a) \00"
@.str.10 = [18 x i8] c"M = %8.5f (m/a)\0A\0A\00"
@str = [50 x i8] c"Enter t and r separated by space (or newline)\00"
@str.11 = [44 x i8] c" (in yrs and km, resp.; e.g. 15000 500):\00"
@str.12 = [9 x i8] c"Results:\00"
@str.13 = [29 x i8] c" Test C Test D\00"
@str.15 = [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 = alloca double
%11 = bitcast double* %1 to i8*
%12 = bitcast double* %2 to i8*
%13 = bitcast double* %3 to i8*
%14 = bitcast double* %4 to i8*
%15 = bitcast double* %5 to i8*
%16 = bitcast double* %6 to i8*
%17 = bitcast double* %7 to i8*
%18 = bitcast double* %8 to i8*
%19 = bitcast double* %9 to i8*
%20 = bitcast double* %10 to i8*
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.11, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %1)
%24 = icmp eq i32 %23, 1
br i1 %24, label %27, label %25
25: ; preds = %0
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.15, i64 0, i64 0))
br label %70
27: ; preds = %0
%28 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %2)
%29 = icmp eq i32 %28, 1
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.15, i64 0, i64 0))
br label %70
32: ; preds = %27
%33 = load double, double* %2
%34 = fmul double %33, 1.000000e+03
%35 = call i32 @exactA(double %34, double* %3, double* %4)
%36 = load double, double* %1
%37 = fmul double %36, 0x417E1853E0000000
%38 = load double, double* %2
%39 = fmul double %38, 1.000000e+03
%40 = call i32 @exactB(double %37, double %39, double* %5, double* %6)
%41 = load double, double* %1
%42 = fmul double %41, 0x417E1853E0000000
%43 = load double, double* %2
%44 = fmul double %43, 1.000000e+03
%45 = call i32 @exactC(double %42, double %44, double* %7, double* %8)
%46 = load double, double* %1
%47 = fmul double %46, 0x417E1853E0000000
%48 = load double, double* %2
%49 = fmul double %48, 1.000000e+03
%50 = call i32 @exactD(double %47, double %49, double* %9, double* %10)
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.12, i64 0, i64 0))
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.13, i64 0, i64 0))
%54 = load double, double* %3
%55 = load double, double* %5
%56 = load double, double* %7
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0), double %54, double %55, double %56)
%58 = load double, double* %9
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), double %58)
%60 = load double, double* %4
%61 = fmul double %60, 0x417E1853E0000000
%62 = load double, double* %6
%63 = fmul double %62, 0x417E1853E0000000
%64 = load double, double* %8
%65 = fmul double %64, 0x417E1853E0000000
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0), double %61, double %63, double %65)
%67 = load double, double* %10
%68 = fmul double %67, 0x417E1853E0000000
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), double %68)
br label %70
70: ; preds = %32, %30, %25
%71 = phi i32 [ 1, %25 ], [ 1, %30 ], [ 0, %32 ]
ret i32 %71
}