#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 /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char const *argv[]) {
  double n = 1, m = 2, t = 0;
  double sum = 0;
  int r;
  scanf("%d", &r);
  for (int i = 0; i < r; ++i) {
    sum += m / n;
    t = n;
    n = m;
    m = t + n;
  }
  printf("%.4f", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xeca(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb5(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    0xea9(%rip),%rdi
lea    -0x34(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11c8 <main+0xa8>
movsd  -0x20(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1177 <main+0x57>
movsd  -0x30(%rbp),%xmm0
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1155 <main+0x35>
cmp    $0x1,%eax
jne    115b <main+0x3b>
movsd  0xeb9(%rip),%xmm2
movsd  0xeb9(%rip),%xmm1
xorpd  %xmm0,%xmm0
jmp    11a5 <main+0x85>
xorpd  %xmm0,%xmm0
jmp    11b1 <main+0x91>
mov    %eax,%ecx
and    $0xfffffffe,%ecx
movsd  0xe98(%rip),%xmm2
movsd  0xe98(%rip),%xmm1
xorpd  %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm1,%xmm3
divsd  %xmm2,%xmm3
addsd  %xmm0,%xmm3
addsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
divsd  %xmm1,%xmm0
addsd  %xmm3,%xmm0
addsd  %xmm2,%xmm1
add    $0xfffffffe,%ecx
jne    1180 <main+0x60>
test   $0x1,%al
je     11b1 <main+0x91>
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%.4f\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %2
%9 = and i32 %6, 1
%10 = icmp eq i32 %6, 1
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = and i32 %6, -2
br label %25
13: ; preds = %25, %8
%14 = phi double [ undef, %8 ], [ %34, %25 ]
%15 = phi double [ 0.000000e+00, %8 ], [ %34, %25 ]
%16 = phi double [ 2.000000e+00, %8 ], [ %35, %25 ]
%17 = phi double [ 1.000000e+00, %8 ], [ %32, %25 ]
%18 = icmp eq i32 %9, 0
br i1 %18, label %22, label %19
19: ; preds = %13
%20 = fdiv double %16, %17
%21 = fadd double %15, %20
br label %22
22: ; preds = %19, %13, %2
%23 = phi double [ 0.000000e+00, %2 ], [ %14, %13 ], [ %21, %19 ]
%24 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %23)
ret i32 0
25: ; preds = %25, %11
%26 = phi double [ 0.000000e+00, %11 ], [ %34, %25 ]
%27 = phi double [ 2.000000e+00, %11 ], [ %35, %25 ]
%28 = phi double [ 1.000000e+00, %11 ], [ %32, %25 ]
%29 = phi i32 [ 0, %11 ], [ %36, %25 ]
%30 = fdiv double %27, %28
%31 = fadd double %26, %30
%32 = fadd double %28, %27
%33 = fdiv double %32, %27
%34 = fadd double %31, %33
%35 = fadd double %27, %32
%36 = add i32 %29, 2
%37 = icmp eq i32 %36, %12
br i1 %37, label %13, label %25
}