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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0xd(%rbp)
jne    1160 <main+0x40>
cmpl   $0x0,-0x8(%rbp)
setg   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1170 <main+0x50>
jmp    1199 <main+0x79>
mov    -0xc(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
sub    $0x1,%edx
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xed1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    118e <main+0x6e>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jle    118e <main+0x6e>
mov    $0x1,%ebx
lea    0xeb1(%rip),%r14
lea    0xea7(%rip),%r15
lea    0x4(%rsp),%r12
xchg   %ax,%ax
mov    $0xffffffff,%edx
shl    %cl,%edx
not    %edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    118e <main+0x6e>
add    $0x1,%ebx
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jg     1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
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 1, i32* %3
br label %4
4: ; preds = %12, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br label %10
10: ; preds = %7, %4
%11 = phi i1 [ false, %4 ], [ %9, %7 ]
br i1 %11, label %12, label %19
12: ; preds = %10
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
%15 = load i32, i32* %2
%16 = shl i32 1, %15
%17 = sub nsw i32 %16, 1
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %17)
br label %4
19: ; 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*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp eq i32 %3, 1
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
%7 = select i1 %4, i1 %6, i1 false
br i1 %7, label %8, label %20
8: ; preds = %0, %8
%9 = phi i32 [ %17, %8 ], [ %5, %0 ]
%10 = phi i32 [ %11, %8 ], [ 1, %0 ]
%11 = add nuw nsw i32 %10, 1
%12 = shl nsw i32 -1, %9
%13 = xor i32 %12, -1
%14 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %13)
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%16 = icmp eq i32 %15, 1
%17 = load i32, i32* %1
%18 = icmp sgt i32 %17, 0
%19 = select i1 %16, i1 %18, i1 false
br i1 %19, label %8, label %20
20: ; preds = %8, %0
ret i32 0
}