#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 = 50;
  int i;
  for (i = 0; i < 9; ++i) {
    sn = sn + hn * 2;
    hn = hn / 2;
  }
  printf("第10次落地时共经过%f米\n", sn);
  printf("第10次弹起的高度为%f米\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  0xecc(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x9,-0x1c(%rbp)
jge    1185 <main+0x75>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xea2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1140 <main+0x30>
movsd  -0x10(%rbp),%xmm0
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xe97(%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    0xf05(%rip),%rdi
movsd  0xed4(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"\E7\AC\AC10\E6\AC\A1\E8\90\BD\E5\9C\B0\E6\97\B6\E5\85\B1\E7\BB\8F\E8\BF\87%f\E7\B1\B3\0A\00"
@.str.1 = [33 x i8] c"\E7\AC\AC10\E6\AC\A1\E5\BC\B9\E8\B5\B7\E7\9A\84\E9\AB\98\E5\BA\A6\E4\B8\BA%f\E7\B1\B3\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
store double 5.000000e+01, double* %3
store i32 0, i32* %4
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 9
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load double, double* %2
%10 = load double, double* %3
%11 = call double @llvm.fmuladd.f64(double %10, double 2.000000e+00, double %9)
store double %11, double* %2
%12 = load double, double* %3
%13 = fdiv double %12, 2.000000e+00
store double %13, double* %3
br label %14
14: ; preds = %8
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
br label %5
17: ; preds = %5
%18 = load double, double* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), double %18)
%20 = load double, double* %3
%21 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), double %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"\E7\AC\AC10\E6\AC\A1\E8\90\BD\E5\9C\B0\E6\97\B6\E5\85\B1\E7\BB\8F\E8\BF\87%f\E7\B1\B3\0A\00"
@.str.1 = [33 x i8] c"\E7\AC\AC10\E6\AC\A1\E5\BC\B9\E8\B5\B7\E7\9A\84\E9\AB\98\E5\BA\A6\E4\B8\BA%f\E7\B1\B3\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), double 0x4072B9C000000000)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), double 0x3FB9000000000000)
ret i32 0
}