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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11fa <main+0xda>
lea    0xea2(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    118c <main+0x6c>
mov    -0x14(%rbp),%esi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
jmp    11ec <main+0xcc>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11dd <main+0xbd>
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11c1 <main+0xa1>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ca <main+0xaa>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11cf <main+0xaf>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1193 <main+0x73>
mov    -0x14(%rbp),%esi
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x2d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x0,(%rsp)
lea    0xeca(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movl   $0x0,0x4(%rsp)
cmpl   $0x0,(%rsp)
je     11f9 <main+0xd9>
lea    0xea9(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xea0(%rip),%r12
jmp    1183 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%esi
mov    %r12,%rdi
call   1030 <printf@plt>
addl   $0xffffffff,(%rsp)
je     11f9 <main+0xd9>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edx
test   %edx,%edx
jle    1170 <main+0x50>
lea    -0x1(%rdx),%edi
mov    %edx,%eax
and    $0x3,%eax
mov    $0x1,%esi
mov    $0x1,%ecx
cmp    $0x3,%edi
jb     11d9 <main+0xb9>
and    $0xfffffffc,%edx
neg    %edx
mov    $0x1,%esi
mov    $0x1,%edi
nopl   0x0(%rax)
lea    0x3(,%rsi,4),%esi
mov    %edi,%ecx
add    $0x4,%ecx
lea    (%rdx,%rdi,1),%ebx
add    $0x4,%ebx
mov    %ecx,%edi
cmp    $0x1,%ebx
jne    11c0 <main+0xa0>
test   %eax,%eax
je     1175 <main+0x55>
nopl   (%rax)
lea    (%rsi,%rsi,1),%edx
add    $0x1,%esi
test   $0x1,%cl
cmovne %edx,%esi
add    $0x1,%ecx
add    $0xffffffff,%eax
jne    11e0 <main+0xc0>
jmp    1175 <main+0x55>
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 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %7
7: ; preds = %39, %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %42
10: ; preds = %7
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 1, i32* %5
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %5
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %39
17: ; preds = %10
store i32 1, i32* %4
br label %18
18: ; preds = %33, %17
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %36
22: ; preds = %18
%23 = load i32, i32* %4
%24 = srem i32 %23, 2
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i32, i32* %5
%28 = mul nsw i32 %27, 2
store i32 %28, i32* %5
br label %32
29: ; preds = %22
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %32
32: ; preds = %29, %26
br label %33
33: ; preds = %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %18
36: ; preds = %18
%37 = load i32, i32* %5
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %36, %14
%40 = load i32, i32* %2
%41 = add nsw i32 %40, -1
store i32 %41, i32* %2
br label %7
42: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.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 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %50, label %8
8: ; preds = %0, %44
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 1
br i1 %11, label %44, label %12
12: ; preds = %8
%13 = add i32 %10, -1
%14 = and i32 %10, 3
%15 = icmp ult i32 %13, 3
br i1 %15, label %27, label %16
16: ; preds = %12
%17 = and i32 %10, -4
br label %18
18: ; preds = %18, %16
%19 = phi i32 [ 1, %16 ], [ %23, %18 ]
%20 = phi i32 [ 1, %16 ], [ %24, %18 ]
%21 = phi i32 [ 0, %16 ], [ %25, %18 ]
%22 = shl i32 %19, 2
%23 = or i32 %22, 3
%24 = add nuw i32 %20, 4
%25 = add i32 %21, 4
%26 = icmp eq i32 %25, %17
br i1 %26, label %27, label %18
27: ; preds = %18, %12
%28 = phi i32 [ undef, %12 ], [ %23, %18 ]
%29 = phi i32 [ 1, %12 ], [ %23, %18 ]
%30 = phi i32 [ 1, %12 ], [ %24, %18 ]
%31 = icmp eq i32 %14, 0
br i1 %31, label %44, label %32
32: ; preds = %27, %32
%33 = phi i32 [ %40, %32 ], [ %29, %27 ]
%34 = phi i32 [ %41, %32 ], [ %30, %27 ]
%35 = phi i32 [ %42, %32 ], [ 0, %27 ]
%36 = and i32 %34, 1
%37 = icmp eq i32 %36, 0
%38 = shl nsw i32 %33, 1
%39 = add nsw i32 %33, 1
%40 = select i1 %37, i32 %39, i32 %38
%41 = add nuw i32 %34, 1
%42 = add i32 %35, 1
%43 = icmp eq i32 %42, %14
br i1 %43, label %44, label %32
44: ; preds = %27, %32, %8
%45 = phi i32 [ 1, %8 ], [ %28, %27 ], [ %40, %32 ]
%46 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = load i32, i32* %1
%48 = add nsw i32 %47, -1
store i32 %48, i32* %1
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %8
50: ; preds = %44, %0
ret i32 0
}