#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 *, int);
scalar_t__ scanf(char *, int *);
int main() {
  int count, d;
  while (EOF != scanf("%d", &d)) {
    count = 1;
    while (--d)
      count = 2 * count + 2;
    printf("%d\n", count);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
lea    0xebc(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     119b <main+0x7b>
movl   $0x1,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     1187 <main+0x67>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x44>
mov    -0x8(%rbp),%esi
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x2eb4(%rip),%r12
mov    (%r12),%rbx
lea    0xec1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmp    %rax,%rbx
jne    115e <main+0x3e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe9e(%rip),%r14
lea    0xe94(%rip),%r15
lea    0xc(%rsp),%r13
jmp    11a9 <main+0x89>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%esi
movl   $0x0,0xc(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%r12),%rbx
mov    %r15,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
cmp    %rax,%rbx
je     114e <main+0x2e>
mov    0xc(%rsp),%edx
mov    %edx,%ecx
add    $0xffffffff,%ecx
je     1180 <main+0x60>
add    $0xfffffffe,%edx
mov    %ecx,%eax
and    $0x7,%eax
mov    $0x1,%esi
cmp    $0x7,%edx
jb     11de <main+0xbe>
and    $0xfffffff8,%ecx
mov    $0x1,%esi
xchg   %ax,%ax
shl    $0x8,%esi
add    $0x1fe,%esi
add    $0xfffffff8,%ecx
jne    11d0 <main+0xb0>
test   %eax,%eax
je     1185 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    %esi,%esi
add    $0x2,%esi
add    $0xffffffff,%eax
jne    11f0 <main+0xd0>
jmp    1185 <main+0x65>

LLVM IR (-O0):
@EOF = global i64 0
@.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 i32
store i32 0, i32* %1
br label %4
4: ; preds = %17, %0
%5 = load i64, i64* @EOF
%6 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = icmp ne i64 %5, %6
br i1 %7, label %8, label %20
8: ; preds = %4
store i32 1, i32* %2
br label %9
9: ; preds = %13, %8
%10 = load i32, i32* %3
%11 = add nsw i32 %10, -1
store i32 %11, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %2
%15 = mul nsw i32 2, %14
%16 = add nsw i32 %15, 2
store i32 %16, i32* %2
br label %9
17: ; preds = %9
%18 = load i32, i32* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %4
20: ; preds = %4
ret i32 0
}

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