#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);
scalar_t__ scanf(char *, int *);
int main() {
  int rev(int);
  int c, t = 0;
  scanf("%i", &c);
  for (int a = 1, n; a <= c && scanf("%i", &n); a++) {
    for (int b = 1; b <= n; b++) {
      int r = rev(b);
      if ((r + b) % 2)
        t++;
    }
    printf("%i\n", t);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x1d(%rbp)
jg     1188 <main+0x58>
lea    0xe8b(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1198 <main+0x68>
jmp    1206 <main+0xd6>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11e9 <main+0xb9>
mov    -0x18(%rbp),%edi
call   1030 <rev@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11d6 <main+0xa6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11db <main+0xab>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119f <main+0x6f>
mov    -0xc(%rbp),%esi
lea    0xe10(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115d <main+0x2d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11ca <main+0x9a>
xor    %ebp,%ebp
mov    $0x1,%r13d
lea    0xe9e(%rip),%r14
mov    %rsp,%r15
lea    0xe97(%rip),%r12
jmp    1188 <main+0x58>
xchg   %ax,%ax
mov    %r12,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
lea    0x1(%r13),%eax
cmp    0x4(%rsp),%r13d
mov    %eax,%r13d
jge    11ca <main+0x9a>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
test   %rax,%rax
je     11ca <main+0x9a>
cmpl   $0x0,(%rsp)
jle    1170 <main+0x40>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <rev@plt>
add    %ebx,%eax
and    $0x1,%eax
add    %eax,%ebp
lea    0x1(%rbx),%eax
cmp    (%rsp),%ebx
mov    %eax,%ebx
jl     11b0 <main+0x80>
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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