#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 *, double);
int main() {
  double sn = 100, hn = sn / 2;
  int n;
  for (n = 2; n <= 10; n++) {
    sn = sn + 2 * hn;
    hn = hn / 2;
  }
  printf("The 10th dropping passing %f meter\n", sn);
  printf("The 10th bounce %f meter\n", hn);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xec7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x2,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jg     118e <main+0x7e>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe89(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1149 <main+0x39>
movsd  -0x10(%rbp),%xmm0
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
movsd  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xf08(%rip),%rdi
movsd  0xed4(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"The 10th dropping passing %f meter\0A\00"
@.str.1 = [26 x i8] c"The 10th bounce %f meter\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca i32
store i32 0, i32* %1
store double 1.000000e+02, double* %2
%5 = load double, double* %2
%6 = fdiv double %5, 2.000000e+00
store double %6, double* %3
store i32 2, i32* %4
br label %7
7: ; preds = %16, %0
%8 = load i32, i32* %4
%9 = icmp sle i32 %8, 10
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = load double, double* %2
%12 = load double, double* %3
%13 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %12, double %11)
store double %13, double* %2
%14 = load double, double* %3
%15 = fdiv double %14, 2.000000e+00
store double %15, double* %3
br label %16
16: ; preds = %10
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %7
19: ; preds = %7
%20 = load double, double* %2
%21 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double %20)
%22 = load double, double* %3
%23 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), double %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"The 10th dropping passing %f meter\0A\00"
@.str.1 = [26 x i8] c"The 10th bounce %f meter\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double 0x4072B9C000000000)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), double 0x3FB9000000000000)
ret i32 0
}