#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 tablica[100];
  int iloscTestow;
  scanf("%d", &iloscTestow);
  int i;
  for (i = 0; i < 100; i++) {
    if (i == 0) {
      tablica[i] = 4;
    }
    if (i == 1) {
      tablica[i] = 7;
    }
    if (i > 1) {
      tablica[i] =
          ((2 * tablica[i - 1]) % 2011 + (5 * tablica[i - 2]) % 2011) % 2011;
    }
  }
  for (i = 0; i < 101; i++) {
    printf("%d = %d\n", i, tablica[i]);
  }
  for (i = 0; i < iloscTestow; i++) {
    int temp;
    scanf("%d", &temp);
    printf("%d\n", tablica[temp]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x1a8(%rbp)
cmpl   $0x64,-0x1a8(%rbp)
jge    121c <main+0xfc>
cmpl   $0x0,-0x1a8(%rbp)
jne    117b <main+0x5b>
movslq -0x1a8(%rbp),%rax
movl   $0x4,-0x1a0(%rbp,%rax,4)
cmpl   $0x1,-0x1a8(%rbp)
jne    119a <main+0x7a>
movslq -0x1a8(%rbp),%rax
movl   $0x7,-0x1a0(%rbp,%rax,4)
cmpl   $0x1,-0x1a8(%rbp)
jle    1203 <main+0xe3>
mov    -0x1a8(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x1a0(%rbp,%rax,4),%eax
shl    $0x1,%eax
mov    $0x7db,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1b0(%rbp)
mov    -0x1a8(%rbp),%eax
sub    $0x2,%eax
cltq
imul   $0x5,-0x1a0(%rbp,%rax,4),%eax
05
mov    $0x7db,%ecx
cltd
idiv   %ecx
mov    -0x1b0(%rbp),%eax
add    %edx,%eax
mov    $0x7db,%ecx
cltd
idiv   %ecx
movslq -0x1a8(%rbp),%rax
mov    %edx,-0x1a0(%rbp,%rax,4)
jmp    1208 <main+0xe8>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    114f <main+0x2f>
movl   $0x0,-0x1a8(%rbp)
cmpl   $0x65,-0x1a8(%rbp)
jge    1269 <main+0x149>
mov    -0x1a8(%rbp),%esi
movslq -0x1a8(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%edx
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    1226 <main+0x106>
movl   $0x0,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jge    12c8 <main+0x1a8>
lea    0xd74(%rip),%rdi
lea    -0x1ac(%rbp),%rsi
call   1040 <scanf@plt>
movslq -0x1ac(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xd5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    1273 <main+0x153>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x1a8,%rsp
lea    0xecc(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0xfffffffe,%eax
xor    %ecx,%ecx
jmp    11e4 <main+0xc4>
nopw   0x0(%rax,%rax,1)
lea    0x1(%rax),%edx
mov    0x10(%rsp,%rdx,4),%esi
mov    %esi,%edx
add    %esi,%edx
movslq %edx,%rdx
imul   $0xffffffff825ae461,%rdx,%rdi
shr    $0x20,%rdi
lea    (%rdi,%rsi,2),%esi
mov    %esi,%edi
shr    $0x1f,%edi
sar    $0xa,%esi
add    %edi,%esi
imul   $0x7db,%esi,%esi
sub    %esi,%edx
mov    %eax,%esi
mov    0x10(%rsp,%rsi,4),%esi
lea    (%rsi,%rsi,4),%esi
movslq %esi,%rsi
imul   $0xffffffff825ae461,%rsi,%rdi
shr    $0x20,%rdi
add    %esi,%edi
mov    %edi,%ebp
shr    $0x1f,%ebp
sar    $0xa,%edi
add    %ebp,%edi
imul   $0x7db,%edi,%edi
sub    %edi,%esi
add    %edx,%esi
movswl %si,%edx
imul   $0xffff825b,%edx,%edx
shr    $0x10,%edx
add    %esi,%edx
movzwl %dx,%edx
movswl %dx,%edi
shr    $0xf,%edx
sar    $0xa,%edi
add    %edx,%edi
imul   $0x7db,%edi,%edx
sub    %edx,%esi
movswl %si,%edx
mov    %edx,0x10(%rsp,%rcx,4)
add    $0x1,%rcx
add    $0x1,%rax
cmp    $0x64,%rcx
je     120a <main+0xea>
cmp    $0x1,%ecx
je     1200 <main+0xe0>
test   %ecx,%ecx
jne    1150 <main+0x30>
movl   $0x4,0x10(%rsp)
jmp    11d6 <main+0xb6>
nopl   0x0(%rax,%rax,1)
movl   $0x7,0x14(%rsp)
jmp    11d6 <main+0xb6>
lea    0xdf2(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp,%rbx,4),%edx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x65,%rbx
jne    1220 <main+0x100>
cmpl   $0x0,0x8(%rsp)
jle    1287 <main+0x167>
lea    0xdb8(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xdb4(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rax
mov    0x10(%rsp,%rax,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
jl     1260 <main+0x140>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%d = %d\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [100 x i32]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 1
%8 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
br label %9
9: ; preds = %0, %32
%10 = phi i64 [ 0, %0 ], [ %33, %32 ]
%11 = trunc i64 %10 to i32
switch i32 %11, label %14 [
i32 0, label %12
i32 1, label %13
]
12: ; preds = %9
store i32 4, i32* %8
br label %32
13: ; preds = %9
store i32 7, i32* %7
br label %32
14: ; preds = %9
%15 = add nuw i64 %10, 4294967295
%16 = and i64 %15, 4294967295
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = shl nsw i32 %18, 1
%20 = srem i32 %19, 2011
%21 = add nuw i64 %10, 4294967294
%22 = and i64 %21, 4294967295
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = mul nsw i32 %24, 5
%26 = srem i32 %25, 2011
%27 = add nsw i32 %26, %20
%28 = trunc i32 %27 to i16
%29 = srem i16 %28, 2011
%30 = sext i16 %29 to i32
%31 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %10
store i32 %30, i32* %31
br label %32
32: ; preds = %13, %12, %14
%33 = add nuw nsw i64 %10, 1
%34 = icmp eq i64 %33, 100
br i1 %34, label %40, label %9
35: ; preds = %40
%36 = load i32, i32* %2
%37 = icmp sgt i32 %36, 0
br i1 %37, label %38, label %59
38: ; preds = %35
%39 = bitcast i32* %3 to i8*
br label %48
40: ; preds = %32, %40
%41 = phi i64 [ %46, %40 ], [ 0, %32 ]
%42 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = trunc i64 %41 to i32
%45 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %44, i32 %43)
%46 = add nuw nsw i64 %41, 1
%47 = icmp eq i64 %46, 101
br i1 %47, label %35, label %40
48: ; preds = %38, %48
%49 = phi i32 [ 0, %38 ], [ %56, %48 ]
%50 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%51 = load i32, i32* %3
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %54)
%56 = add nuw nsw i32 %49, 1
%57 = load i32, i32* %2
%58 = icmp slt i32 %56, %57
br i1 %58, label %48, label %59
59: ; preds = %48, %35
ret i32 0
}