#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 pow(int, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int d = 0, n = 0;
  while (1) {
    n++;
    scanf("%d", &d);
    if (d == -1)
      break;
    printf("Teste %d\n%d\n\n", n, (int)(pow(2, 2 * d) + 2 * pow(2, d) + 1));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xea3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jne    1175 <main+0x45>
jmp    11ba <main+0x8a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x2,%edi
call   1050 <pow@plt>
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%esi
shl    $0x1,%eax
add    %eax,%edx
add    $0x1,%edx
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
jmp    114d <main+0x1d>
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
movl   $0x0,0xc(%rsp)
lea    0xeb4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0xffffffff,%esi
je     11c3 <main+0x93>
mov    $0x1,%ebx
lea    0xe98(%rip),%r14
lea    0xe8e(%rip),%r15
lea    0xc(%rsp),%r12
nopw   0x0(%rax,%rax,1)
add    %esi,%esi
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %eax,%r13d
mov    0xc(%rsp),%esi
mov    $0x2,%edi
call   1050 <pow@plt>
lea    0x1(%r13,%rax,2),%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0xffffffff,%esi
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [14 x i8] c"Teste %d\0A%d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%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 eq i32 %4, -1
br i1 %5, label %21, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %19, %6 ], [ %4, %0 ]
%8 = phi i32 [ %17, %6 ], [ 1, %0 ]
%9 = shl nsw i32 %7, 1
%10 = call i32 @pow(i32 2, i32 %9)
%11 = load i32, i32* %1
%12 = call i32 @pow(i32 2, i32 %11)
%13 = shl nsw i32 %12, 1
%14 = add i32 %10, 1
%15 = add i32 %14, %13
%16 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %15)
%17 = add nuw nsw i32 %8, 1
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %6
21: ; preds = %6, %0
ret i32 0
}