#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *);
int main() {
  int n, i;
  long long int ar[999];
  while (scanf("%d", &n) != EOF) {
    ar[1] = 3;
    ar[2] = 6;
    ar[3] = 6;
    if (n == 1)
      printf("3\n");
    else if (n == 2)
      printf("6\n");
    else if (n == 3)
      printf("6\n");
    else {
      for (i = 4; i <= n; i++) {
        ar[i] = ar[i - 1] + 2 * ar[i - 2];
      }
      printf("%lld\n", ar[i - 1]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2e9f(%rip),%rcx
cmp    (%rcx),%rax
je     124b <main+0x12b>
movq   $0x3,-0x1f48(%rbp)
movq   $0x6,-0x1f40(%rbp)
movq   $0x6,-0x1f38(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1190 <main+0x70>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1246 <main+0x126>
cmpl   $0x2,-0x8(%rbp)
jne    11ad <main+0x8d>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1241 <main+0x121>
cmpl   $0x3,-0x8(%rbp)
jne    11ca <main+0xaa>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123c <main+0x11c>
movl   $0x4,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     121e <main+0xfe>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x1f50(%rbp,%rax,8),%rcx
ff
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
cltq
mov    -0x1f50(%rbp,%rax,8),%rax
ff
shl    $0x1,%rax
add    %rax,%rcx
movslq -0xc(%rbp),%rax
mov    %rcx,-0x1f50(%rbp,%rax,8)
ff
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d1 <main+0xb1>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x1f50(%rbp,%rax,8),%rsi
ff
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1241 <main+0x121>
jmp    1246 <main+0x126>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x1f50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1f48,%rsp
lea    0xec8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e8f(%rip),%rbp
cmp    0x0(%rbp),%rax
jne    1173 <main+0x43>
xor    %eax,%eax
add    $0x1f48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea1(%rip),%rbx
lea    0xe8f(%rip),%r15
lea    0xc(%rsp),%r14
lea    0xe8c(%rip),%r12
lea    0xe7f(%rip),%r13
jmp    11b9 <main+0x89>
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
cmp    0x0(%rbp),%rax
je     115f <main+0x2f>
movaps 0xe40(%rip),%xmm0
movups %xmm0,0x18(%rsp)
movq   $0x6,0x28(%rsp)
mov    0xc(%rsp),%eax
cmp    $0x1,%rax
je     1220 <main+0xf0>
cmp    $0x2,%eax
je     11a0 <main+0x70>
cmp    $0x3,%eax
je     11a0 <main+0x70>
mov    $0x6,%esi
cmp    $0x4,%eax
jl     1289 <main+0x159>
lea    0x1(%rax),%ecx
movq   $0x12,0x30(%rsp)
cmp    $0x5,%ecx
je     1282 <main+0x152>
cmp    $0x6,%ecx
jne    1228 <main+0xf8>
mov    $0x4,%edx
mov    $0x12,%ecx
mov    $0x5,%esi
test   $0x1,%al
jne    1274 <main+0x144>
jmp    1282 <main+0x152>
nop
mov    %rbx,%rdi
jmp    11a3 <main+0x73>
mov    %rbx,%r8
lea    -0x4(%rax),%rsi
and    $0xfffffffffffffffe,%rsi
mov    $0x12,%ecx
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
mov    0x28(%rsp,%rdx,8),%rdi
mov    0x30(%rsp,%rdx,8),%rbx
lea    (%rcx,%rdi,2),%rcx
mov    %rcx,0x38(%rsp,%rdx,8)
lea    (%rcx,%rbx,2),%rcx
mov    %rcx,0x40(%rsp,%rdx,8)
add    $0x2,%rdx
cmp    %rdx,%rsi
jne    1240 <main+0x110>
lea    0x5(%rdx),%rsi
add    $0x4,%rdx
mov    %r8,%rbx
test   $0x1,%al
je     1282 <main+0x152>
mov    0x8(%rsp,%rdx,8),%rdx
lea    (%rcx,%rdx,2),%rcx
mov    %rcx,0x10(%rsp,%rsi,8)
cltq
mov    0x10(%rsp,%rax,8),%rsi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11a8 <main+0x78>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.3 = [6 x i8] c"%lld\0A\00"
@str.4 = [2 x i8] c"6\00"
@str.5 = [2 x i8] c"3\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [999 x i64]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [999 x i64]* %2 to i8*
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %77, label %8
8: ; preds = %0
%9 = getelementptr inbounds [999 x i64], [999 x i64]* %2, i64 0, i64 1
%10 = getelementptr inbounds [999 x i64], [999 x i64]* %2, i64 0, i64 3
%11 = bitcast i64* %9 to <2 x i64>*
%12 = getelementptr inbounds [999 x i64], [999 x i64]* %2, i64 0, i64 4
br label %13
13: ; preds = %8, %73
store <2 x i64> <i64 3, i64 6>, <2 x i64>* %11
store i64 6, i64* %10
%14 = load i32, i32* %1
switch i32 %14, label %15 [
i32 1, label %27
i32 2, label %29
i32 3, label %31
]
15: ; preds = %13
%16 = icmp slt i32 %14, 4
br i1 %16, label %70, label %17
17: ; preds = %15
%18 = add nuw i32 %14, 1
store i64 18, i64* %12
%19 = icmp eq i32 %18, 5
br i1 %19, label %66, label %20
20: ; preds = %17
%21 = zext i32 %14 to i64
%22 = and i64 %21, 1
%23 = icmp eq i32 %18, 6
br i1 %23, label %54, label %24
24: ; preds = %20
%25 = add nsw i64 %21, -4
%26 = and i64 %25, -2
br label %33
27: ; preds = %13
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
br label %73
29: ; preds = %13
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
br label %73
31: ; preds = %13
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
br label %73
33: ; preds = %33, %24
%34 = phi i64 [ 5, %24 ], [ %51, %33 ]
%35 = phi i64 [ 18, %24 ], [ %49, %33 ]
%36 = phi i64 [ 4, %24 ], [ %44, %33 ]
%37 = phi i64 [ 0, %24 ], [ %52, %33 ]
%38 = add nsw i64 %36, -1
%39 = getelementptr inbounds [999 x i64], [999 x i64]* %2, i64 0, i64 %38
%40 = load i64, i64* %39
%41 = shl nsw i64 %40, 1
%42 = add nsw i64 %41, %35
%43 = getelementptr inbounds [999 x i64], [999 x i64]* %2, i64 0, i64 %34
store i64 %42, i64* %43
%44 = add nuw nsw i64 %34, 1
%45 = add nsw i64 %34, -1
%46 = getelementptr inbounds [999 x i64], [999 x i64]* %2, i64 0, i64 %45
%47 = load i64, i64* %46
%48 = shl nsw i64 %47, 1
%49 = add nsw i64 %48, %42
%50 = getelementptr inbounds [999 x i64], [999 x i64]* %2, i64 0, i64 %44
store i64 %49, i64* %50
%51 = add nuw nsw i64 %34, 2
%52 = add i64 %37, 2
%53 = icmp eq i64 %52, %26
br i1 %53, label %54, label %33
54: ; preds = %33, %20
%55 = phi i64 [ 5, %20 ], [ %51, %33 ]
%56 = phi i64 [ 18, %20 ], [ %49, %33 ]
%57 = phi i64 [ 4, %20 ], [ %44, %33 ]
%58 = icmp eq i64 %22, 0
br i1 %58, label %66, label %59
59: ; preds = %54
%60 = add nsw i64 %57, -1
%61 = getelementptr inbounds [999 x i64], [999 x i64]* %2, i64 0, i64 %60
%62 = load i64, i64* %61
%63 = shl nsw i64 %62, 1
%64 = add nsw i64 %63, %56
%65 = getelementptr inbounds [999 x i64], [999 x i64]* %2, i64 0, i64 %55
store i64 %64, i64* %65
br label %66
66: ; preds = %59, %54, %17
%67 = sext i32 %14 to i64
%68 = getelementptr inbounds [999 x i64], [999 x i64]* %2, i64 0, i64 %67
%69 = load i64, i64* %68
br label %70
70: ; preds = %66, %15
%71 = phi i64 [ 6, %15 ], [ %69, %66 ]
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 %71)
br label %73
73: ; preds = %29, %70, %31, %27
%74 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%75 = load i64, i64* @EOF
%76 = icmp eq i64 %74, %75
br i1 %76, label %77, label %13
77: ; preds = %73, %0
ret i32 0
}