#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*/ getchar();
int pow(double, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int i;
  long long ar[99], sa[99], at[99];
  ar[2] = 0;
  ar[3] = 8;
  ar[4] = 64;
  sa[2] = 0;
  sa[3] = 2;
  printf("N=2: 0\n");
  printf("N=3: 8\n");
  for (i = 4; i <= 28; i++) {
    sa[i] = ar[i - 1] + pow(4.0, (i - 2)) - sa[i - 1] - pow(2.0, (i - 2));
    ar[i] = pow(2.0, (i - 1)) - 2 + ar[i - 1];
    ar[i] = 2 * (sa[i] + ar[i]);
    printf("N=%d: %lld\n", i, ar[i]);
  }
  printf("N=29: 277229417298013800\n");
  printf("N=30: 1113741009496217136\n");
  printf("N=31: 4472142617535586136\n");
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x970,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x310(%rbp)
movq   $0x8,-0x308(%rbp)
movq   $0x40,-0x300(%rbp)
movq   $0x0,-0x630(%rbp)
movq   $0x2,-0x628(%rbp)
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x4,-0x8(%rbp)
cmpl   $0x1c,-0x8(%rbp)
jg     12aa <main+0x17a>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x320(%rbp,%rax,8),%rax
ff
mov    %rax,-0x970(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
movsd  0xe3d(%rip),%xmm0
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x970(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
sub    -0x640(%rbp,%rcx,8),%rax
ff
mov    %rax,-0x968(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
movsd  0xdfb(%rip),%xmm0
call   1050 <pow@plt>
mov    -0x968(%rbp),%rcx
cltq
sub    %rax,%rcx
movslq -0x8(%rbp),%rax
mov    %rcx,-0x640(%rbp,%rax,8)
ff
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
movsd  0xdd0(%rip),%xmm0
call   1050 <pow@plt>
sub    $0x2,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
add    -0x320(%rbp,%rax,8),%rcx
ff
movslq -0x8(%rbp),%rax
mov    %rcx,-0x320(%rbp,%rax,8)
ff
movslq -0x8(%rbp),%rax
mov    -0x640(%rbp,%rax,8),%rcx
ff
movslq -0x8(%rbp),%rax
add    -0x320(%rbp,%rax,8),%rcx
ff
shl    $0x1,%rcx
movslq -0x8(%rbp),%rax
mov    %rcx,-0x320(%rbp,%rax,8)
ff
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x320(%rbp,%rax,8),%rdx
ff
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119c <main+0x6c>
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x970,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x8,%ebx
mov    $0x2,%r13d
mov    $0xffffffffffffffe7,%r12
lea    0xe94(%rip),%r14
nopl   0x0(%rax)
lea    0x1b(%r12),%r15d
movsd  0xe73(%rip),%xmm0
mov    %r15d,%edi
call   1060 <pow@plt>
movslq %eax,%rbp
movsd  0xe68(%rip),%xmm0
mov    %r15d,%edi
call   1060 <pow@plt>
cltq
add    %r13,%rax
add    %rbx,%rbp
sub    %rax,%rbp
lea    0x1c(%r12),%edi
movsd  0xe48(%rip),%xmm0
call   1060 <pow@plt>
cltq
add    %rbp,%rbx
add    %rax,%rbx
add    %rbx,%rbx
add    $0xfffffffffffffffc,%rbx
lea    0x1d(%r12),%esi
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%r13
inc    %r12
jne    1180 <main+0x40>
lea    0xe35(%rip),%rdi
call   1030 <puts@plt>
lea    0xe42(%rip),%rdi
call   1030 <puts@plt>
lea    0xe50(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"N=2: 0\0A\00"
@.str.1 = [8 x i8] c"N=3: 8\0A\00"
@.str.2 = [12 x i8] c"N=%d: %lld\0A\00"
@.str.3 = [26 x i8] c"N=29: 277229417298013800\0A\00"
@.str.4 = [27 x i8] c"N=30: 1113741009496217136\0A\00"
@.str.5 = [27 x i8] c"N=31: 4472142617535586136\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [99 x i64]
%4 = alloca [99 x i64]
%5 = alloca [99 x i64]
store i32 0, i32* %1
%6 = getelementptr inbounds [99 x i64], [99 x i64]* %3, i64 0, i64 2
store i64 0, i64* %6
%7 = getelementptr inbounds [99 x i64], [99 x i64]* %3, i64 0, i64 3
store i64 8, i64* %7
%8 = getelementptr inbounds [99 x i64], [99 x i64]* %3, i64 0, i64 4
store i64 64, i64* %8
%9 = getelementptr inbounds [99 x i64], [99 x i64]* %4, i64 0, i64 2
store i64 0, i64* %9
%10 = getelementptr inbounds [99 x i64], [99 x i64]* %4, i64 0, i64 3
store i64 2, i64* %10
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i32 4, i32* %2
br label %13
13: ; preds = %74, %0
%14 = load i32, i32* %2
%15 = icmp sle i32 %14, 28
br i1 %15, label %16, label %77
16: ; preds = %13
%17 = load i32, i32* %2
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [99 x i64], [99 x i64]* %3, i64 0, i64 %19
%21 = load i64, i64* %20
%22 = load i32, i32* %2
%23 = sub nsw i32 %22, 2
%24 = call i32 @pow(double 4.000000e+00, i32 %23)
%25 = sext i32 %24 to i64
%26 = add nsw i64 %21, %25
%27 = load i32, i32* %2
%28 = sub nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [99 x i64], [99 x i64]* %4, i64 0, i64 %29
%31 = load i64, i64* %30
%32 = sub nsw i64 %26, %31
%33 = load i32, i32* %2
%34 = sub nsw i32 %33, 2
%35 = call i32 @pow(double 2.000000e+00, i32 %34)
%36 = sext i32 %35 to i64
%37 = sub nsw i64 %32, %36
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [99 x i64], [99 x i64]* %4, i64 0, i64 %39
store i64 %37, i64* %40
%41 = load i32, i32* %2
%42 = sub nsw i32 %41, 1
%43 = call i32 @pow(double 2.000000e+00, i32 %42)
%44 = sub nsw i32 %43, 2
%45 = sext i32 %44 to i64
%46 = load i32, i32* %2
%47 = sub nsw i32 %46, 1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [99 x i64], [99 x i64]* %3, i64 0, i64 %48
%50 = load i64, i64* %49
%51 = add nsw i64 %45, %50
%52 = load i32, i32* %2
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [99 x i64], [99 x i64]* %3, i64 0, i64 %53
store i64 %51, i64* %54
%55 = load i32, i32* %2
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [99 x i64], [99 x i64]* %4, i64 0, i64 %56
%58 = load i64, i64* %57
%59 = load i32, i32* %2
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [99 x i64], [99 x i64]* %3, i64 0, i64 %60
%62 = load i64, i64* %61
%63 = add nsw i64 %58, %62
%64 = mul nsw i64 2, %63
%65 = load i32, i32* %2
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [99 x i64], [99 x i64]* %3, i64 0, i64 %66
store i64 %64, i64* %67
%68 = load i32, i32* %2
%69 = load i32, i32* %2
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [99 x i64], [99 x i64]* %3, i64 0, i64 %70
%72 = load i64, i64* %71
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %68, i64 %72)
br label %74
74: ; preds = %16
%75 = load i32, i32* %2
%76 = add nsw i32 %75, 1
store i32 %76, i32* %2
br label %13
77: ; preds = %13
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%81 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [12 x i8] c"N=%d: %lld\0A\00"
@str = [7 x i8] c"N=2: 0\00"
@str.6 = [7 x i8] c"N=3: 8\00"
@str.7 = [25 x i8] c"N=29: 277229417298013800\00"
@str.8 = [26 x i8] c"N=30: 1113741009496217136\00"
@str.9 = [26 x i8] c"N=31: 4472142617535586136\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.6, i64 0, i64 0))
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 2, %0 ], [ %15, %3 ]
%5 = phi i64 [ 8, %0 ], [ %23, %3 ]
%6 = phi i64 [ 4, %0 ], [ %26, %3 ]
%7 = trunc i64 %6 to i32
%8 = add i32 %7, -2
%9 = tail call i32 @pow(double 4.000000e+00, i32 %8)
%10 = sext i32 %9 to i64
%11 = tail call i32 @pow(double 2.000000e+00, i32 %8)
%12 = sext i32 %11 to i64
%13 = add i64 %5, %10
%14 = add i64 %4, %12
%15 = sub i64 %13, %14
%16 = trunc i64 %6 to i32
%17 = add i32 %16, -1
%18 = tail call i32 @pow(double 2.000000e+00, i32 %17)
%19 = add nsw i32 %18, -2
%20 = sext i32 %19 to i64
%21 = add i64 %15, %5
%22 = add i64 %21, %20
%23 = shl nsw i64 %22, 1
%24 = trunc i64 %6 to i32
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %24, i64 %23)
%26 = add nuw nsw i64 %6, 1
%27 = icmp eq i64 %26, 29
br i1 %27, label %28, label %3
28: ; preds = %3
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.8, i64 0, i64 0))
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0))
%32 = tail call i32 (...) @getchar()
ret i32 0
}