#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 *, unsigned long);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  unsigned long int numPatternArr[50 + 1];
  int n;
  numPatternArr[0] = 0;
  numPatternArr[1] = 1;
  numPatternArr[2] = 2;
  for (n = 3; n <= 50; n++)
    numPatternArr[n] = numPatternArr[n - 1] + numPatternArr[n - 2];
  while (1) {
    scanf("%d", &n);
    if (n == 0)
      break;
    printf("%lu\n", numPatternArr[n]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x1a0(%rbp)
movq   $0x1,-0x198(%rbp)
movq   $0x2,-0x190(%rbp)
movl   $0x3,-0x1a4(%rbp)
cmpl   $0x32,-0x1a4(%rbp)
jg     11b3 <main+0x93>
mov    -0x1a4(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x1a0(%rbp,%rax,8),%rcx
ff
mov    -0x1a4(%rbp),%eax
sub    $0x2,%eax
cltq
add    -0x1a0(%rbp,%rax,8),%rcx
ff
movslq -0x1a4(%rbp),%rax
mov    %rcx,-0x1a0(%rbp,%rax,8)
ff
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    115d <main+0x3d>
jmp    11b8 <main+0x98>
lea    0xe41(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x1a4(%rbp)
jne    11dd <main+0xbd>
jmp    11fd <main+0xdd>
movslq -0x1a4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,8),%rsi
ff
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
jmp    11b8 <main+0x98>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1b0,%rsp
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    $0x3,%ecx
mov    $0x7,%eax
xchg   %ax,%ax
add    -0x18(%rsp,%rax,8),%rcx
mov    %rcx,-0x8(%rsp,%rax,8)
mov    -0x10(%rsp,%rax,8),%rdx
add    %rcx,%rdx
mov    %rdx,(%rsp,%rax,8)
add    %rcx,%rdx
mov    %rdx,0x8(%rsp,%rax,8)
cmp    $0x33,%rax
je     1186 <main+0x66>
add    (%rsp,%rax,8),%rdx
mov    %rdx,0x10(%rsp,%rax,8)
add    $0x4,%rax
mov    %rdx,%rcx
jmp    1150 <main+0x30>
movl   $0x33,0xc(%rsp)
lea    0xe8b(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11e2 <main+0xc2>
lea    0xe75(%rip),%r14
lea    0xe6b(%rip),%r15
lea    0xc(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
cltq
mov    0x10(%rsp,%rax,8),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jne    11c0 <main+0xa0>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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