#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*/ exactL(double, double *, double *, double *, double, double,
                          int);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, double *);
int main() {
  double r, H, b, a;
  int scanret;
  const double secpera = 31556926.0;
  double EPS_ABS[] = {1.0e-12, 1.0e-9, 1.0e-7};
  double EPS_REL[] = {1.0e-15, 1.0e-14, 1.0e-11};
  printf("Enter  r  (in km; e.g. 0.0):   ");
  scanret = scanf("%lf", &r);
  if (scanret != 1) {
    printf("... input error; exiting\n");
    return 1;
  }
  exactL(r * 1000.0, &H, &b, &a, EPS_ABS[0], EPS_REL[0], 4);
  printf("Results from Test L:\n");
  printf("     H = %11.5f (m)   b = %10.5f (m)   a = %8.5f (m/a)\n", H, b,
         a * secpera);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xeb9(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xebc(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xeb9(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xeb6(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x1,-0x2c(%rbp)
je     11d3 <main+0xa3>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    123a <main+0x10a>
movsd  0xe2d(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x4,%ecx
call   1040 <exactL@plt>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xde0(%rip),%xmm2
mulsd  -0x28(%rbp),%xmm2
lea    0xe70(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee4(%rip),%rdi
lea    0x18(%rsp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    11d5 <main+0x95>
movsd  0x18(%rsp),%xmm0
mulsd  0xe87(%rip),%xmm0
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
movsd  0xe7a(%rip),%xmm1
movsd  0xe7a(%rip),%xmm2
mov    $0x4,%ecx
call   1050 <exactL@plt>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm2
mulsd  0xe53(%rip),%xmm2
lea    0xe78(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
jmp    11e6 <main+0xa6>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.EPS_ABS = [3 x double] [double 0x3D719799812DEA11, double 1.000000e-09, double 0x3E7AD7F29ABCAF48]
@__const.main.EPS_REL = [3 x double] [double 1.000000e-15, double 0x3D06849B86A12B9B, double 0x3DA5FD7FE1796495]
@.str = [32 x i8] c"Enter r (in km; e.g. 0.0): \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [26 x i8] c"... input error; exiting\0A\00"
@.str.3 = [22 x i8] c"Results from Test L:\0A\00"
@.str.4 = [56 x i8] c" H = %11.5f (m) b = %10.5f (m) a = %8.5f (m/a)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca double
%8 = alloca [3 x double]
%9 = alloca [3 x double]
store i32 0, i32* %1
store double 0x417E1853E0000000, double* %7
%10 = bitcast [3 x double]* %8 to i8*
%11 = bitcast [3 x double]* %9 to i8*
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %32
18: ; preds = %0
%19 = load double, double* %2
%20 = fmul double %19, 1.000000e+03
%21 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%22 = load double, double* %21
%23 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%24 = load double, double* %23
%25 = call i32 @exactL(double %20, double* %3, double* %4, double* %5, double %22, double %24, i32 4)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%27 = load double, double* %3
%28 = load double, double* %4
%29 = load double, double* %5
%30 = fmul double %29, 0x417E1853E0000000
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), double %27, double %28, double %30)
store i32 0, i32* %1
br label %32
32: ; preds = %18, %16
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [32 x i8] c"Enter r (in km; e.g. 0.0): \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.4 = [56 x i8] c" H = %11.5f (m) b = %10.5f (m) a = %8.5f (m/a)\0A\00"
@str = [21 x i8] c"Results from Test L:\00"
@str.5 = [25 x i8] c"... input error; exiting\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%11 = icmp eq i32 %10, 1
br i1 %11, label %14, label %12
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.5, i64 0, i64 0))
br label %24
14: ; preds = %0
%15 = load double, double* %1
%16 = fmul double %15, 1.000000e+03
%17 = call i32 @exactL(double %16, double* %2, double* %3, double* %4, double 0x3D719799812DEA11, double 1.000000e-15, i32 4)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%19 = load double, double* %2
%20 = load double, double* %3
%21 = load double, double* %4
%22 = fmul double %21, 0x417E1853E0000000
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.4, i64 0, i64 0), double %19, double %20, double %22)
br label %24
24: ; preds = %14, %12
%25 = phi i32 [ 1, %12 ], [ 0, %14 ]
ret i32 %25
}