#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned short *);
int sqrt(float);
int main() {
  unsigned short maxheight = 1, minheight = 1;
  printf("Enter the minimum possible height of a roller coaster:\n> ");
  scanf("%hd", &minheight);
  printf("Enter the maximum possible height of a roller coaster:\n> ");
  scanf("%hd", &maxheight);
  printf("\nCoaster Height(meters)\t\tMinimum Height(inches)\n"
         "--------------------\t\t--------------------\n");
  unsigned short i;
  float time, velocity, minheightrider;
  for (i = minheight; i <= maxheight; i++) {
    time = sqrt(i / 4.9);
    velocity = 9.8 * time;
    minheightrider = 9 * sqrt(velocity);
    printf("%hd\t\t\t\t%.2f\n", i, minheightrider);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x1,-0x6(%rbp)
movw   $0x1,-0x8(%rbp)
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x6(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%ax
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
movzwl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jg     1233 <main+0x103>
movzwl -0xa(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe4b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <sqrt@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe1c(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <sqrt@plt>
imul   $0x9,%eax,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movzwl -0xa(%rbp),%esi
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xa(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xa(%rbp)
jmp    119d <main+0x6d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movw   $0x1,0xc(%rsp)
movw   $0x1,0xe(%rsp)
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedf(%rip),%rbx
lea    0xe(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
movzwl 0xe(%rsp),%ebx
cmp    0xc(%rsp),%bx
ja     121b <main+0xdb>
lea    0xed6(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzwl %bx,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
divsd  0xe2e(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe1a(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <sqrt@plt>
lea    (%rax,%rax,8),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%bx
jbe    11c0 <main+0x80>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [58 x i8] c"Enter the minimum possible height of a roller coaster:\0A> \00"
@.str.1 = [4 x i8] c"%hd\00"
@.str.2 = [58 x i8] c"Enter the maximum possible height of a roller coaster:\0A> \00"
@.str.3 = [92 x i8] c"\0ACoaster Height(meters)\09\09Minimum Height(inches)\0A--------------------\09\09--------------------\0A\00"
@.str.4 = [13 x i8] c"%hd\09\09\09\09%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
%4 = alloca i16
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store i16 1, i16* %2
store i16 1, i16* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i16* %3)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i16* %2)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.3, i64 0, i64 0))
%13 = load i16, i16* %3
store i16 %13, i16* %4
br label %14
14: ; preds = %41, %0
%15 = load i16, i16* %4
%16 = zext i16 %15 to i32
%17 = load i16, i16* %2
%18 = zext i16 %17 to i32
%19 = icmp sle i32 %16, %18
br i1 %19, label %20, label %44
20: ; preds = %14
%21 = load i16, i16* %4
%22 = zext i16 %21 to i32
%23 = sitofp i32 %22 to double
%24 = fdiv double %23, 4.900000e+00
%25 = fptrunc double %24 to float
%26 = call i32 @sqrt(float %25)
%27 = sitofp i32 %26 to float
store float %27, float* %5
%28 = load float, float* %5
%29 = fpext float %28 to double
%30 = fmul double 9.800000e+00, %29
%31 = fptrunc double %30 to float
store float %31, float* %6
%32 = load float, float* %6
%33 = call i32 @sqrt(float %32)
%34 = mul nsw i32 9, %33
%35 = sitofp i32 %34 to float
store float %35, float* %7
%36 = load i16, i16* %4
%37 = zext i16 %36 to i32
%38 = load float, float* %7
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %37, double %39)
br label %41
41: ; preds = %20
%42 = load i16, i16* %4
%43 = add i16 %42, 1
store i16 %43, i16* %4
br label %14
44: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@.str = [58 x i8] c"Enter the minimum possible height of a roller coaster:\0A> \00"
@.str.1 = [4 x i8] c"%hd\00"
@.str.2 = [58 x i8] c"Enter the maximum possible height of a roller coaster:\0A> \00"
@.str.4 = [13 x i8] c"%hd\09\09\09\09%.2f\0A\00"
@str = [91 x i8] c"\0ACoaster Height(meters)\09\09Minimum Height(inches)\0A--------------------\09\09--------------------\00"
define i32 @main() {
%1 = alloca i16
%2 = alloca i16
%3 = bitcast i16* %1 to i8*
store i16 1, i16* %1
%4 = bitcast i16* %2 to i8*
store i16 1, i16* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i16* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i16* %1)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([91 x i8], [91 x i8]* @str, i64 0, i64 0))
%10 = load i16, i16* %2
%11 = load i16, i16* %1
%12 = icmp ugt i16 %10, %11
br i1 %12, label %32, label %13
13: ; preds = %0, %13
%14 = phi i16 [ %29, %13 ], [ %10, %0 ]
%15 = zext i16 %14 to i32
%16 = uitofp i16 %14 to double
%17 = fdiv double %16, 4.900000e+00
%18 = fptrunc double %17 to float
%19 = call i32 @sqrt(float %18)
%20 = sitofp i32 %19 to float
%21 = fpext float %20 to double
%22 = fmul double %21, 9.800000e+00
%23 = fptrunc double %22 to float
%24 = call i32 @sqrt(float %23)
%25 = mul nsw i32 %24, 9
%26 = sitofp i32 %25 to float
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %15, double %27)
%29 = add i16 %14, 1
%30 = load i16, i16* %1
%31 = icmp ugt i16 %29, %30
br i1 %31, label %32, label %13
32: ; preds = %13, %0
ret i32 0
}