#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*/ honeycomb_walk(int, long long *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  long long walks[15];
  walks[0] = 1;
  walks[1] = 0;
  walks[2] = 6;
  for (int i = 3; i < 15; i++)
    walks[i] = -1;
  int n;
  scanf("%d", &n);
  while (n--) {
    int path;
    scanf("%d", &path);
    printf("%lld\n", honeycomb_walk(path, walks));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x1,-0x80(%rbp)
movq   $0x0,-0x78(%rbp)
movq   $0x6,-0x70(%rbp)
movl   $0x3,-0x84(%rbp)
cmpl   $0xf,-0x84(%rbp)
jge    1195 <main+0x65>
movslq -0x84(%rbp),%rax
movq   $0xffffffffffffffff,-0x80(%rbp,%rax,8)
ff ff
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1164 <main+0x34>
lea    0xe64(%rip),%rdi
lea    -0x88(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x88(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x88(%rbp)
cmp    $0x0,%eax
je     11f7 <main+0xc7>
lea    0xe37(%rip),%rdi
lea    -0x8c(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8c(%rbp),%edi
lea    -0x80(%rbp),%rsi
call   1030 <honeycomb_walk@plt>
mov    %eax,%esi
lea    0xe16(%rip),%rdi
call   1040 <printf@plt>
jmp    11a8 <main+0x78>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x88,%rsp
movdqa 0xeba(%rip),%xmm0
movdqa %xmm0,0x10(%rsp)
movq   $0x6,0x20(%rsp)
pcmpeqd %xmm0,%xmm0
movdqu %xmm0,0x28(%rsp)
movdqu %xmm0,0x38(%rsp)
movdqu %xmm0,0x48(%rsp)
movdqu %xmm0,0x58(%rsp)
movdqu %xmm0,0x68(%rsp)
movdqu %xmm0,0x78(%rsp)
lea    0xe8c(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
subl   $0x1,0x8(%rsp)
jb     11d8 <main+0xa8>
lea    0xe74(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xe66(%rip),%rbx
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
mov    %r12,%rsi
call   1030 <honeycomb_walk@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
subl   $0x1,0x8(%rsp)
jae    11b0 <main+0x80>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i64]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = getelementptr inbounds [15 x i64], [15 x i64]* %2, i64 0, i64 0
store i64 1, i64* %6
%7 = getelementptr inbounds [15 x i64], [15 x i64]* %2, i64 0, i64 1
store i64 0, i64* %7
%8 = getelementptr inbounds [15 x i64], [15 x i64]* %2, i64 0, i64 2
store i64 6, i64* %8
store i32 3, i32* %3
br label %9
9: ; preds = %16, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 15
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [15 x i64], [15 x i64]* %2, i64 0, i64 %14
store i64 -1, i64* %15
br label %16
16: ; preds = %12
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %9
19: ; preds = %9
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %21
21: ; preds = %25, %19
%22 = load i32, i32* %4
%23 = add nsw i32 %22, -1
store i32 %23, i32* %4
%24 = icmp ne i32 %22, 0
br i1 %24, label %25, label %31
25: ; preds = %21
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%27 = load i32, i32* %5
%28 = getelementptr inbounds [15 x i64], [15 x i64]* %2, i64 0, i64 0
%29 = call i32 @honeycomb_walk(i32 %27, i64* %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %21
31: ; preds = %21
ret i32 0
}

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