#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  int c = 2;
  int today = c;
  while (--n) {
    today = (today * 3) / 2;
    c += today;
  }
  printf("%d", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     117b <main+0x5b>
imul   $0x3,-0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    114c <main+0x2c>
mov    -0xc(%rbp),%esi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
mov    %ecx,%eax
add    $0xffffffff,%eax
je     114e <main+0x2e>
cmp    $0x2,%ecx
jne    1155 <main+0x35>
mov    $0x2,%ecx
mov    $0x3,%esi
jmp    119d <main+0x7d>
mov    $0x2,%esi
jmp    11a4 <main+0x84>
mov    %eax,%edx
and    $0xfffffffe,%edx
mov    $0x2,%esi
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%rsi,%rsi,2),%esi
mov    %esi,%edi
shr    $0x1f,%edi
add    %esi,%edi
sar    %edi
add    %edi,%ecx
lea    (%rdi,%rdi,2),%edi
mov    %edi,%esi
shr    $0x1f,%esi
add    %edi,%esi
sar    %esi
add    %esi,%ecx
add    $0xfffffffe,%edx
jne    1170 <main+0x50>
lea    (%rsi,%rsi,2),%edx
mov    %edx,%esi
shr    $0x1f,%esi
add    %edx,%esi
sar    %esi
add    %ecx,%esi
test   $0x1,%al
cmove  %ecx,%esi
movl   $0x0,0x4(%rsp)
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 2, i32* %3
%6 = load i32, i32* %3
store i32 %6, i32* %4
br label %7
7: ; preds = %11, %0
%8 = load i32, i32* %2
%9 = add nsw i32 %8, -1
store i32 %9, i32* %2
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %7
%12 = load i32, i32* %4
%13 = mul nsw i32 %12, 3
%14 = sdiv i32 %13, 2
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = add nsw i32 %16, %15
store i32 %17, i32* %3
br label %7
18: ; preds = %7
%19 = load i32, i32* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %19)
ret i32 0
}

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