#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 exactN(double, double *, double *, double *, double *, double *, double *);
int /*<<< orphan*/ params_exactN(double *, double *, double *, double *,
                                 double *, double *, double *, double *);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, double *);
int main() {
  double H0, L0, xc, a, Hela, k, Hc, Tc, x, H, hx, u, M, B, beta;
  const double secpera = 31556926.0;
  int scanret, retvalN;
  params_exactN(&H0, &L0, &xc, &a, &Hela, &k, &Hc, &Tc);
  printf("Enter  x  (in km; 0.0 <= x <= %5.1f):   ", L0 / 1000.0);
  scanret = scanf("%lf", &x);
  if (scanret != 1) {
    printf("... input error; exiting\n");
    return 1;
  }
  x = x * 1000.0;
  retvalN = exactN(x, &H, &hx, &u, &M, &B, &beta);
  if (retvalN) {
    printf("SIMPLEN ERROR:  x  out of allowed domain  0.0 <= x <= %5.1f km\n"
           "   ... ending ...\n",
           L0 / 1000.0);
    return 1;
  }
  if (x > xc) {
    printf(
        "WARNING:  x = %5.1f km is past the calving front at xc = %5.1f km\n",
        x / 1000.0, xc / 1000.0);
  }
  printf("Results from Test N:\n");
  printf("     H    = ice thickness        = %12.5f (m)\n"
         "     h_x  = surface slope        = %12.5e\n"
         "     u    = ice velocity         = %12.5f (m a-1)\n"
         "     M    = surface mass balance = %12.5f (cm a-1)\n"
         "     B    = ice hardness         = %12.5e (Pa s^(1/3))\n"
         "     beta = ice hardness         = %12.5e (Pa s m-1)\n",
         H, hx, u * secpera, M * secpera * 100.0, B, beta);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xeae(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x30(%rbp),%r8
lea    -0x38(%rbp),%r9
lea    -0x40(%rbp),%r10
lea    -0x48(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <params_exactN@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xe63(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe70(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
lea    -0x50(%rbp),%rsi
call   1060 <scanf@plt>
mov    %eax,-0x8c(%rbp)
cmpl   $0x1,-0x8c(%rbp)
je     11ec <main+0xac>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12fb <main+0x1bb>
movsd  0xe0c(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
lea    -0x70(%rbp),%rcx
lea    -0x78(%rbp),%r8
lea    -0x80(%rbp),%r9
call   1040 <exactN@plt>
mov    %eax,-0x90(%rbp)
cmpl   $0x0,-0x90(%rbp)
je     125e <main+0x11e>
movsd  -0x18(%rbp),%xmm0
movsd  0xdc0(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe14(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12fb <main+0x1bb>
movsd  -0x50(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    129e <main+0x15e>
movsd  -0x50(%rbp),%xmm0
movsd  0xd85(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xd74(%rip),%xmm2
divsd  %xmm2,%xmm1
lea    0xe1a(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  0xd4a(%rip),%xmm2
mulsd  -0x68(%rbp),%xmm2
movsd  0xd3d(%rip),%xmm3
mulsd  -0x70(%rbp),%xmm3
movsd  0xd38(%rip),%xmm4
mulsd  %xmm4,%xmm3
movsd  -0x78(%rbp),%xmm4
movsd  -0x80(%rbp),%xmm5
lea    0xe1d(%rip),%rdi
mov    $0x6,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x78,%rsp
lea    0x48(%rsp),%rax
lea    0x50(%rsp),%r10
lea    0x70(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x40(%rsp),%rdx
lea    0x68(%rsp),%rcx
lea    0x60(%rsp),%r8
lea    0x58(%rsp),%r9
push   %rax
push   %r10
call   1060 <params_exactN@plt>
add    $0x10,%rsp
movsd  0x8(%rsp),%xmm0
divsd  0xe6a(%rip),%xmm0
lea    0xe7b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe96(%rip),%rdi
mov    %rsp,%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    120f <main+0xbf>
movsd  (%rsp),%xmm0
mulsd  0xe3b(%rip),%xmm0
movsd  %xmm0,(%rsp)
lea    0x38(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0x28(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x10(%rsp),%r9
call   1050 <exactN@plt>
test   %eax,%eax
je     1225 <main+0xd5>
movsd  0x8(%rsp),%xmm0
divsd  0xe01(%rip),%xmm0
lea    0xe3f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    121b <main+0xcb>
lea    0x1003(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x78,%rsp
ret
movsd  (%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1254 <main+0x104>
movsd  0xdc2(%rip),%xmm2
divsd  %xmm2,%xmm0
divsd  %xmm2,%xmm1
lea    0xe4a(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xfa9(%rip),%rdi
call   1030 <puts@plt>
movsd  0x38(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  0xd94(%rip),%xmm3
movsd  0x28(%rsp),%xmm2
mulsd  %xmm3,%xmm2
mulsd  0x20(%rsp),%xmm3
mulsd  0xd84(%rip),%xmm3
movsd  0x18(%rsp),%xmm4
movsd  0x10(%rsp),%xmm5
lea    0xe3b(%rip),%rdi
mov    $0x6,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Enter x (in km; 0.0 <= x <= %5.1f): \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [26 x i8] c"... input error; exiting\0A\00"
@.str.3 = [82 x i8] c"SIMPLEN ERROR: x out of allowed domain 0.0 <= x <= %5.1f km\0A ... ending ...\0A\00"
@.str.4 = [67 x i8] c"WARNING: x = %5.1f km is past the calving front at xc = %5.1f km\0A\00"
@.str.5 = [22 x i8] c"Results from Test N:\0A\00"
@.str.6 = [298 x i8] c" H = ice thickness = %12.5f (m)\0A h_x = surface slope = %12.5e\0A u = ice velocity = %12.5f (m a-1)\0A M = surface mass balance = %12.5f (cm a-1)\0A B = ice hardness = %12.5e (Pa s^(1/3))\0A beta = ice hardness = %12.5e (Pa s m-1)\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 i32
%19 = alloca i32
store i32 0, i32* %1
store double 0x417E1853E0000000, double* %17
%20 = call i32 @params_exactN(double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* %8, double* %9)
%21 = load double, double* %3
%22 = fdiv double %21, 1.000000e+03
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), double %22)
%24 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %10)
store i32 %24, i32* %18
%25 = load i32, i32* %18
%26 = icmp ne i32 %25, 1
br i1 %26, label %27, label %29
27: ; preds = %0
%28 = 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 %62
29: ; preds = %0
%30 = load double, double* %10
%31 = fmul double %30, 1.000000e+03
store double %31, double* %10
%32 = load double, double* %10
%33 = call i32 @exactN(double %32, double* %11, double* %12, double* %13, double* %14, double* %15, double* %16)
store i32 %33, i32* %19
%34 = load i32, i32* %19
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %29
%37 = load double, double* %3
%38 = fdiv double %37, 1.000000e+03
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.3, i64 0, i64 0), double %38)
store i32 1, i32* %1
br label %62
40: ; preds = %29
%41 = load double, double* %10
%42 = load double, double* %4
%43 = fcmp ogt double %41, %42
br i1 %43, label %44, label %50
44: ; preds = %40
%45 = load double, double* %10
%46 = fdiv double %45, 1.000000e+03
%47 = load double, double* %4
%48 = fdiv double %47, 1.000000e+03
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.4, i64 0, i64 0), double %46, double %48)
br label %50
50: ; preds = %44, %40
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%52 = load double, double* %11
%53 = load double, double* %12
%54 = load double, double* %13
%55 = fmul double %54, 0x417E1853E0000000
%56 = load double, double* %14
%57 = fmul double %56, 0x417E1853E0000000
%58 = fmul double %57, 1.000000e+02
%59 = load double, double* %15
%60 = load double, double* %16
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([298 x i8], [298 x i8]* @.str.6, i64 0, i64 0), double %52, double %53, double %55, double %58, double %59, double %60)
store i32 0, i32* %1
br label %62
62: ; preds = %50, %36, %27
%63 = load i32, i32* %1
ret i32 %63
}

LLVM IR (-O2):
@.str = [41 x i8] c"Enter x (in km; 0.0 <= x <= %5.1f): \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.3 = [82 x i8] c"SIMPLEN ERROR: x out of allowed domain 0.0 <= x <= %5.1f km\0A ... ending ...\0A\00"
@.str.4 = [67 x i8] c"WARNING: x = %5.1f km is past the calving front at xc = %5.1f km\0A\00"
@.str.6 = [298 x i8] c" H = ice thickness = %12.5f (m)\0A h_x = surface slope = %12.5e\0A u = ice velocity = %12.5f (m a-1)\0A M = surface mass balance = %12.5f (cm a-1)\0A B = ice hardness = %12.5e (Pa s^(1/3))\0A beta = ice hardness = %12.5e (Pa s m-1)\0A\00"
@str = [21 x i8] c"Results from Test N:\00"
@str.7 = [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 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = bitcast double* %1 to i8*
%17 = bitcast double* %2 to i8*
%18 = bitcast double* %3 to i8*
%19 = bitcast double* %4 to i8*
%20 = bitcast double* %5 to i8*
%21 = bitcast double* %6 to i8*
%22 = bitcast double* %7 to i8*
%23 = bitcast double* %8 to i8*
%24 = bitcast double* %9 to i8*
%25 = bitcast double* %10 to i8*
%26 = bitcast double* %11 to i8*
%27 = bitcast double* %12 to i8*
%28 = bitcast double* %13 to i8*
%29 = bitcast double* %14 to i8*
%30 = bitcast double* %15 to i8*
%31 = call i32 @params_exactN(double* %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* %8)
%32 = load double, double* %2
%33 = fdiv double %32, 1.000000e+03
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), double %33)
%35 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %9)
%36 = icmp eq i32 %35, 1
br i1 %36, label %39, label %37
37: ; preds = %0
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
br label %68
39: ; preds = %0
%40 = load double, double* %9
%41 = fmul double %40, 1.000000e+03
store double %41, double* %9
%42 = call i32 @exactN(double %41, double* %10, double* %11, double* %12, double* %13, double* %14, double* %15)
%43 = icmp eq i32 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %39
%45 = load double, double* %2
%46 = fdiv double %45, 1.000000e+03
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([82 x i8], [82 x i8]* @.str.3, i64 0, i64 0), double %46)
br label %68
48: ; preds = %39
%49 = load double, double* %9
%50 = load double, double* %3
%51 = fcmp ogt double %49, %50
br i1 %51, label %52, label %56
52: ; preds = %48
%53 = fdiv double %49, 1.000000e+03
%54 = fdiv double %50, 1.000000e+03
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.4, i64 0, i64 0), double %53, double %54)
br label %56
56: ; preds = %52, %48
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%58 = load double, double* %10
%59 = load double, double* %11
%60 = load double, double* %12
%61 = fmul double %60, 0x417E1853E0000000
%62 = load double, double* %13
%63 = fmul double %62, 0x417E1853E0000000
%64 = fmul double %63, 1.000000e+02
%65 = load double, double* %14
%66 = load double, double* %15
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([298 x i8], [298 x i8]* @.str.6, i64 0, i64 0), double %58, double %59, double %61, double %64, double %65, double %66)
br label %68
68: ; preds = %56, %44, %37
%69 = phi i32 [ 1, %37 ], [ 1, %44 ], [ 0, %56 ]
ret i32 %69
}