#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 getchar_unlocked();
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int ch, T, x;
  scanf("%d", &T);
  while (T-- > 0) {
    x = 0;
    for (ch = getchar_unlocked(); ch < '0' || ch > '9'; ch = getchar_unlocked())
      ;
    for (; ch >= '0' && ch <= '9'; ch = getchar_unlocked()) {
      x = (x << 3) + (x << 1) + ch - '0';
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
jle    11fa <main+0xda>
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getchar_unlocked@plt>
mov    %eax,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jl     117d <main+0x5d>
cmpl   $0x39,-0x8(%rbp)
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    118d <main+0x6d>
jmp    11a1 <main+0x81>
jmp    1192 <main+0x72>
mov    $0x0,%al
call   1030 <getchar_unlocked@plt>
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x44>
jmp    11a6 <main+0x86>
xor    %eax,%eax
cmpl   $0x30,-0x8(%rbp)
mov    %al,-0x12(%rbp)
jl     11bf <main+0x9f>
cmpl   $0x39,-0x8(%rbp)
setle  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    11cf <main+0xaf>
jmp    11f5 <main+0xd5>
mov    -0x10(%rbp),%eax
shl    $0x3,%eax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
add    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getchar_unlocked@plt>
mov    %eax,-0x8(%rbp)
jmp    11a6 <main+0x86>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
test   %eax,%eax
jle    1181 <main+0x61>
xor    %eax,%eax
call   1030 <getchar_unlocked@plt>
add    $0xffffffc6,%eax
cmp    $0xfffffff5,%eax
ja     1170 <main+0x50>
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <getchar_unlocked@plt>
add    $0xffffffc6,%eax
cmp    $0xfffffff6,%eax
jb     1160 <main+0x40>
nop
xor    %eax,%eax
call   1030 <getchar_unlocked@plt>
add    $0xffffffd0,%eax
cmp    $0xa,%eax
jb     1170 <main+0x50>
jmp    1140 <main+0x20>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %6
6: ; preds = %43, %0
%7 = load i32, i32* %3
%8 = add nsw i32 %7, -1
store i32 %8, i32* %3
%9 = icmp sgt i32 %7, 0
br i1 %9, label %10, label %44
10: ; preds = %6
store i32 0, i32* %4
%11 = call i32 (...) @getchar_unlocked()
store i32 %11, i32* %2
br label %12
12: ; preds = %21, %10
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 48
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 57
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ true, %12 ], [ %17, %15 ]
br i1 %19, label %20, label %23
20: ; preds = %18
br label %21
21: ; preds = %20
%22 = call i32 (...) @getchar_unlocked()
store i32 %22, i32* %2
br label %12
23: ; preds = %18
br label %24
24: ; preds = %41, %23
%25 = load i32, i32* %2
%26 = icmp sge i32 %25, 48
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %2
%29 = icmp sle i32 %28, 57
br label %30
30: ; preds = %27, %24
%31 = phi i1 [ false, %24 ], [ %29, %27 ]
br i1 %31, label %32, label %43
32: ; preds = %30
%33 = load i32, i32* %4
%34 = shl i32 %33, 3
%35 = load i32, i32* %4
%36 = shl i32 %35, 1
%37 = add nsw i32 %34, %36
%38 = load i32, i32* %2
%39 = add nsw i32 %37, %38
%40 = sub nsw i32 %39, 48
store i32 %40, i32* %4
br label %41
41: ; preds = %32
%42 = call i32 (...) @getchar_unlocked()
store i32 %42, i32* %2
br label %24
43: ; preds = %30
br label %6
44: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\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 = load i32, i32* %1
%5 = add nsw i32 %4, -1
store i32 %5, i32* %1
%6 = icmp sgt i32 %4, 0
br i1 %6, label %11, label %24
7: ; preds = %20
%8 = load i32, i32* %1
%9 = add nsw i32 %8, -1
store i32 %9, i32* %1
%10 = icmp sgt i32 %8, 0
br i1 %10, label %11, label %24
11: ; preds = %0, %7
%12 = call i32 (...) @getchar_unlocked()
%13 = add i32 %12, -58
%14 = icmp ult i32 %13, -10
br i1 %14, label %15, label %19
15: ; preds = %11, %15
%16 = call i32 (...) @getchar_unlocked()
%17 = add i32 %16, -58
%18 = icmp ult i32 %17, -10
br i1 %18, label %15, label %19
19: ; preds = %15, %11
br label %20
20: ; preds = %19, %20
%21 = call i32 (...) @getchar_unlocked()
%22 = add i32 %21, -48
%23 = icmp ult i32 %22, 10
br i1 %23, label %20, label %7
24: ; preds = %7, %0
ret i32 0
}