#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 abs(long);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int loop = 0;
  int value = 0;
  long int result = 0;
  scanf("%d", &loop);
  int i = 0;
  for (i = 0; i < loop; i++) {
    scanf("%d", &value);
    result = (((((value * 567) / 9) + 7492) * 235) / 47) - 498;
    printf("%d\n", abs((result / 10) % 10));
  }
  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)
movq   $0x0,-0x18(%rbp)
lea    0xea4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f8 <main+0xc8>
lea    0xe7a(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
imul   $0x237,-0xc(%rbp),%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
add    $0x1d44,%eax
imul   $0xeb,%eax,%eax
mov    $0x2f,%ecx
cltd
idiv   %ecx
sub    $0x1f2,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rdx,%rdi
call   1030 <abs@plt>
mov    %eax,%esi
lea    0xe1e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1173 <main+0x43>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x0,(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xeb3(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    1210 <main+0xe0>
xor    %ebp,%ebp
lea    0xe98(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xe8f(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
imul   $0x39d5,0x4(%rsp),%eax
mov    %eax,%ecx
add    $0x1add6c,%ecx
movslq %ecx,%rcx
imul   $0xffffffffae4c415d,%rcx,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
add    $0x1add6c,%eax
mov    %eax,%ecx
sar    $0x5,%ecx
shr    $0x1f,%eax
add    %ecx,%eax
add    $0xfffffe0e,%eax
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
movslq %eax,%rdi
call   1030 <abs@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    (%rsp),%ebp
jl     1180 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
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 i64
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i64 0, i64* %4
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %5
store i32 0, i32* %5
br label %7
7: ; preds = %26, %0
%8 = load i32, i32* %5
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %29
11: ; preds = %7
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = mul nsw i32 %13, 567
%15 = sdiv i32 %14, 9
%16 = add nsw i32 %15, 7492
%17 = mul nsw i32 %16, 235
%18 = sdiv i32 %17, 47
%19 = sub nsw i32 %18, 498
%20 = sext i32 %19 to i64
store i64 %20, i64* %4
%21 = load i64, i64* %4
%22 = sdiv i64 %21, 10
%23 = srem i64 %22, 10
%24 = call i32 @abs(i64 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %11
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %7
29: ; 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 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %24
8: ; preds = %0, %8
%9 = phi i32 [ %21, %8 ], [ 0, %0 ]
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = mul i32 %11, 14805
%13 = add i32 %12, 1760620
%14 = sdiv i32 %13, 47
%15 = add nsw i32 %14, -498
%16 = sdiv i32 %15, 10
%17 = srem i32 %16, 10
%18 = sext i32 %17 to i64
%19 = call i32 @abs(i64 %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = add nuw nsw i32 %9, 1
%22 = load i32, i32* %1
%23 = icmp slt i32 %21, %22
br i1 %23, label %8, label %24
24: ; preds = %8, %0
ret i32 0
}