#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 *, float);
int main() {
  float m = 1, n = 2, temp, s = 0;
  int i, minus = 1;
  for (i = 1; i <= 10; i++) {
    s += minus * (n / m);
    temp = m;
    m = n;
    n += temp;
    minus *= -1;
  }
  printf("sum=%f\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xedd(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xecc(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jg     11b2 <main+0xa2>
cvtsi2ssl -0x1c(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
divss  -0x8(%rbp),%xmm2
movss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x10(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
imul   $0xffffffff,-0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114f <main+0x3f>
movss  -0x14(%rbp),%xmm0
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"sum=%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store float 1.000000e+00, float* %2
store float 2.000000e+00, float* %3
store float 0.000000e+00, float* %5
store i32 1, i32* %7
store i32 1, i32* %6
br label %8
8: ; preds = %26, %0
%9 = load i32, i32* %6
%10 = icmp sle i32 %9, 10
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = load i32, i32* %7
%13 = sitofp i32 %12 to float
%14 = load float, float* %3
%15 = load float, float* %2
%16 = fdiv float %14, %15
%17 = load float, float* %5
%18 = call float @llvm.fmuladd.f32(float %13, float %16, float %17)
store float %18, float* %5
%19 = load float, float* %2
store float %19, float* %4
%20 = load float, float* %3
store float %20, float* %2
%21 = load float, float* %4
%22 = load float, float* %3
%23 = fadd float %22, %21
store float %23, float* %3
%24 = load i32, i32* %7
%25 = mul nsw i32 %24, -1
store i32 %25, i32* %7
br label %26
26: ; preds = %11
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %8
29: ; preds = %8
%30 = load float, float* %5
%31 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"sum=%f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float 0x3FE27E0CC0000000)
ret i32 0
}