#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 floor(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i, j, k, c;
  scanf("%d", &n);
  k = 5;
  for (i = 1; i <= n; i++) {
    j = floor(k / (double)2);
    c += j;
    k = 3 * j;
  }
  printf("%d", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x5,-0x14(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11a4 <main+0x74>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xe8a(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <floor@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
imul   $0x3,-0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <main+0x2d>
mov    -0x18(%rbp),%esi
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0x5,%eax
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xea1(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <floor@plt>
add    %eax,%ebx
lea    (%rax,%rax,2),%eax
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     1150 <main+0x20>
lea    0xe8b(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
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
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 5, i32* %5
store i32 1, i32* %3
br label %8
8: ; preds = %23, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %26
12: ; preds = %8
%13 = load i32, i32* %5
%14 = sitofp i32 %13 to double
%15 = fdiv double %14, 2.000000e+00
%16 = fptosi double %15 to i32
%17 = call i32 @floor(i32 %16)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = load i32, i32* %6
%20 = add nsw i32 %19, %18
store i32 %20, i32* %6
%21 = load i32, i32* %4
%22 = mul nsw i32 3, %21
store i32 %22, i32* %5
br label %23
23: ; preds = %12
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %8
26: ; preds = %8
%27 = load i32, i32* %6
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %27)
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 = icmp sgt i32 %4, 0
br label %6
6: ; preds = %0, %6
%7 = phi i32 [ %14, %6 ], [ undef, %0 ]
%8 = phi i32 [ %15, %6 ], [ 5, %0 ]
%9 = phi i32 [ %16, %6 ], [ 1, %0 ]
%10 = sitofp i32 %8 to double
%11 = fmul double %10, 5.000000e-01
%12 = fptosi double %11 to i32
%13 = call i32 @floor(i32 %12)
%14 = add nsw i32 %13, %7
%15 = mul nsw i32 %13, 3
%16 = add nuw nsw i32 %9, 1
%17 = load i32, i32* %1
%18 = icmp slt i32 %9, %17
br i1 %18, label %6, label %19
19: ; preds = %6
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}