#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 *, int);
scalar_t__ scanf(char *, int *);
int main() {
  int i, a[50], wall, n;
  a[0] = 1;
  a[1] = 1;
  for (i = 2; i <= 50; i++) {
    a[i] = a[i - 2] + a[i - 1];
  }
  while (scanf("%d", &wall) && wall) {
    n = a[wall];
    printf("%d\n", n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xd0(%rbp)
movl   $0x1,-0xcc(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jg     118e <main+0x6e>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
cltq
mov    -0xd0(%rbp,%rax,4),%ecx
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
add    -0xd0(%rbp,%rax,4),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0xd0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x2d>
jmp    1193 <main+0x73>
lea    0xe66(%rip),%rdi
lea    -0xd4(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xd9(%rbp)
je     11cb <main+0xab>
cmpl   $0x0,-0xd4(%rbp)
setne  %al
mov    %al,-0xd9(%rbp)
mov    -0xd9(%rbp),%al
test   $0x1,%al
jne    11de <main+0xbe>
jmp    1209 <main+0xe9>
movslq -0xd4(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%eax
mov    %eax,-0xd8(%rbp)
mov    -0xd8(%rbp),%esi
lea    0xe04(%rip),%rdi
call   1030 <printf@plt>
jmp    1193 <main+0x73>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xe0,%rsp
movabs $0x100000001,%rax
mov    %rax,0x10(%rsp)
mov    $0x1,%eax
mov    $0x5,%ecx
mov    $0x1,%edx
nopw   0x0(%rax,%rax,1)
add    %eax,%edx
mov    %edx,0x4(%rsp,%rcx,4)
cmp    $0x35,%rcx
je     1174 <main+0x54>
add    %edx,%eax
mov    %eax,0x8(%rsp,%rcx,4)
add    %eax,%edx
mov    %edx,0xc(%rsp,%rcx,4)
add    %edx,%eax
mov    %eax,0x10(%rsp,%rcx,4)
add    $0x4,%rcx
jmp    1150 <main+0x30>
lea    0xe85(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11d6 <main+0xb6>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11d6 <main+0xb6>
lea    0xe6a(%rip),%r14
lea    0xe60(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
cltq
mov    0x10(%rsp,%rax,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11d6 <main+0xb6>
mov    0xc(%rsp),%eax
test   %eax,%eax
jne    11b0 <main+0x90>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [50 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = getelementptr inbounds [50 x i32], [50 x i32]* %3, i64 0, i64 0
store i32 1, i32* %6
%7 = getelementptr inbounds [50 x i32], [50 x i32]* %3, i64 0, i64 1
store i32 1, i32* %7
store i32 2, i32* %2
br label %8
8: ; preds = %26, %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 50
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sub nsw i32 %12, 2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [50 x i32], [50 x i32]* %3, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = load i32, i32* %2
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [50 x i32], [50 x i32]* %3, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = add nsw i32 %16, %21
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [50 x i32], [50 x i32]* %3, i64 0, i64 %24
store i32 %22, i32* %25
br label %26
26: ; preds = %11
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %8
29: ; preds = %8
br label %30
30: ; preds = %38, %29
%31 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* %4
%35 = icmp ne i32 %34, 0
br label %36
36: ; preds = %33, %30
%37 = phi i1 [ false, %30 ], [ %35, %33 ]
br i1 %37, label %38, label %45
38: ; preds = %36
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [50 x i32], [50 x i32]* %3, i64 0, i64 %40
%42 = load i32, i32* %41
store i32 %42, i32* %5
%43 = load i32, i32* %5
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %43)
br label %30
45: ; preds = %36
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [50 x i32]
%2 = alloca i32
%3 = bitcast [50 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 0
store i32 1, i32* %5
%6 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 1
store i32 1, i32* %6
br label %13
7: ; preds = %13
%8 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = icmp ne i64 %8, 0
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %31, label %42
13: ; preds = %21, %0
%14 = phi i32 [ 1, %0 ], [ %28, %21 ]
%15 = phi i32 [ 1, %0 ], [ %25, %21 ]
%16 = phi i64 [ 2, %0 ], [ %30, %21 ]
%17 = add nsw i32 %14, %15
%18 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %16
store i32 %17, i32* %18
%19 = or i64 %16, 1
%20 = icmp eq i64 %19, 51
br i1 %20, label %7, label %21
21: ; preds = %13
%22 = add nsw i32 %17, %14
%23 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %19
store i32 %22, i32* %23
%24 = add nuw nsw i64 %16, 2
%25 = add nsw i32 %22, %17
%26 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %24
store i32 %25, i32* %26
%27 = add nuw nsw i64 %16, 3
%28 = add nsw i32 %25, %22
%29 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %27
store i32 %28, i32* %29
%30 = add nuw nsw i64 %16, 4
br label %13
31: ; preds = %7, %31
%32 = phi i32 [ %39, %31 ], [ %10, %7 ]
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [50 x i32], [50 x i32]* %1, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%38 = icmp ne i64 %37, 0
%39 = load i32, i32* %2
%40 = icmp ne i32 %39, 0
%41 = select i1 %38, i1 %40, i1 false
br i1 %41, label %31, label %42
42: ; preds = %31, %7
ret i32 0
}