#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 pow(int, double);
int /*<<< orphan*/ printf(char *, double);
int scanf(char *, double *);
int sqrt(int);
int main() {
  double n, f;
  while (scanf("%lf", &n) == 1) {
    if (n == 0)
      break;
    n++;
    f = (pow((1 + sqrt(5)) / 2, n) - pow((1 - sqrt(5)) / 2, n)) * 1 / sqrt(5);
    printf("%.0lf\n", f);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1220 <main+0xe0>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1185 <main+0x45>
jp     1185 <main+0x45>
jmp    1220 <main+0xe0>
movsd  0xe73(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x5,%edi
call   1060 <sqrt@plt>
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
movsd  -0x10(%rbp),%xmm0
call   1050 <pow@plt>
mov    %eax,-0x20(%rbp)
mov    $0x5,%edi
call   1060 <sqrt@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
movsd  -0x10(%rbp),%xmm0
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
sub    %ecx,%eax
shl    $0x0,%eax
mov    %eax,-0x1c(%rbp)
mov    $0x5,%edi
call   1060 <sqrt@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xdf6(%rip),%rdi
call   1030 <printf@plt>
jmp    114f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1232 <main+0xf2>
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1174 <main+0x34>
jnp    1232 <main+0xf2>
lea    0xe99(%rip),%r14
lea    0xe8e(%rip),%r15
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
addsd  0xe68(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    $0x5,%edi
call   1060 <sqrt@plt>
mov    %eax,%ecx
add    $0x1,%ecx
shr    $0x1f,%ecx
lea    (%rax,%rcx,1),%edi
add    $0x1,%edi
sar    %edi
movsd  (%rsp),%xmm0
call   1050 <pow@plt>
mov    %eax,%ebp
mov    $0x5,%edi
call   1060 <sqrt@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
mov    %ecx,%edi
shr    $0x1f,%edi
add    %ecx,%edi
sar    %edi
movsd  (%rsp),%xmm0
call   1050 <pow@plt>
sub    %eax,%ebp
mov    $0x5,%edi
call   1060 <sqrt@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1232 <main+0xf2>
movsd  (%rsp),%xmm0
ucomisd 0xde2(%rip),%xmm0
jne    1190 <main+0x50>
jp     1190 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [7 x i8] c"%.0lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = icmp ne i32 %3, 1
%5 = load double, double* %1
%6 = fcmp oeq double %5, 0.000000e+00
%7 = select i1 %4, i1 true, i1 %6
br i1 %7, label %31, label %8
8: ; preds = %0, %8
%9 = phi double [ %28, %8 ], [ %5, %0 ]
%10 = fadd double %9, 1.000000e+00
store double %10, double* %1
%11 = call i32 @sqrt(i32 5)
%12 = add nsw i32 %11, 1
%13 = sdiv i32 %12, 2
%14 = load double, double* %1
%15 = call i32 @pow(i32 %13, double %14)
%16 = call i32 @sqrt(i32 5)
%17 = sub nsw i32 1, %16
%18 = sdiv i32 %17, 2
%19 = load double, double* %1
%20 = call i32 @pow(i32 %18, double %19)
%21 = sub nsw i32 %15, %20
%22 = call i32 @sqrt(i32 5)
%23 = sdiv i32 %21, %22
%24 = sitofp i32 %23 to double
%25 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %24)
%26 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%27 = icmp ne i32 %26, 1
%28 = load double, double* %1
%29 = fcmp oeq double %28, 0.000000e+00
%30 = select i1 %27, i1 true, i1 %29
br i1 %30, label %31, label %8
31: ; preds = %8, %0
ret i32 0
}