#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 */
scalar_t__ isFireNumber(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int a, b, c, i, fire;
  scanf("%d", &c);
  for (i = 0; i < c; i++) {
    fire = 0;
    scanf("%d %d", &a, &b);
    for (a = 0; a <= b; a++) {
      if (isFireNumber(a)) {
        fire++;
      }
    }
    printf("%d\n", fire);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xebd(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11df <main+0xaf>
movl   $0x0,-0x18(%rbp)
lea    0xe8e(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11c2 <main+0x92>
mov    -0x8(%rbp),%edi
call   1040 <isFireNumber@plt>
cmp    $0x0,%rax
je     11af <main+0x7f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b4 <main+0x84>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1188 <main+0x58>
mov    -0x18(%rbp),%esi
lea    0xe3a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1158 <main+0x28>
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
sub    $0x18,%rsp
lea    0xebe(%rip),%rdi
xor    %ebx,%ebx
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jle    11df <main+0xaf>
lea    0xe9b(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x14(%rsp),%r12
lea    0xe90(%rip),%r13
jmp    1193 <main+0x63>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    0x10(%rsp),%ebx
jge    11df <main+0xaf>
xor    %ebp,%ebp
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
movl   $0x0,0xc(%rsp)
cmpl   $0x0,0x14(%rsp)
js     1180 <main+0x50>
xor    %ebp,%ebp
xor    %edi,%edi
nopl   0x0(%rax,%rax,1)
call   1040 <isFireNumber@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebp
mov    0xc(%rsp),%eax
lea    0x1(%rax),%edi
mov    %edi,0xc(%rsp)
cmp    0x14(%rsp),%eax
jl     11c0 <main+0x90>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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