#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 *);
int sqrt(int);
int main() {
  int a, b, c, d, i, j;
  int x;
  while (scanf("%d %d", &a, &b)) {
    if (a == 0 && b == 0) {
      break;
    } else {
      x = 0;
      for (i = a; i <= b; i++) {
        c = sqrt(i);
        d = c * c;
        if (d == i) {
          x++;
        }
      }
      printf("%d\n", x);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmp    $0x0,%rax
je     11e0 <main+0xb0>
cmpl   $0x0,-0x8(%rbp)
jne    1176 <main+0x46>
cmpl   $0x0,-0xc(%rbp)
jne    1176 <main+0x46>
jmp    11e0 <main+0xb0>
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11cc <main+0x9c>
mov    -0x18(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    11b9 <main+0x89>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11be <main+0x8e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1183 <main+0x53>
mov    -0x20(%rbp),%esi
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0xf>
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
mov    %rsp,%rdx
call   1040 <scanf@plt>
test   %rax,%rax
je     11cf <main+0x9f>
lea    0xeab(%rip),%r14
lea    0xe9e(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%r13
jmp    118d <main+0x5d>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1040 <scanf@plt>
test   %rax,%rax
je     11cf <main+0x9f>
mov    0x4(%rsp),%ebx
mov    (%rsp),%eax
mov    %ebx,%ecx
or     %eax,%ecx
je     11cf <main+0x9f>
xor    %ebp,%ebp
cmp    %eax,%ebx
jg     1170 <main+0x40>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
call   1050 <sqrt@plt>
imul   %eax,%eax
xor    %ecx,%ecx
cmp    %eax,%ebx
sete   %cl
add    %ecx,%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 = [6 x i8] c"%d %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 i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
br label %9
9: ; preds = %44, %0
%10 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %45
12: ; preds = %9
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
br label %45
19: ; preds = %15, %12
store i32 0, i32* %8
%20 = load i32, i32* %2
store i32 %20, i32* %6
br label %21
21: ; preds = %38, %19
%22 = load i32, i32* %6
%23 = load i32, i32* %3
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %41
25: ; preds = %21
%26 = load i32, i32* %6
%27 = call i32 @sqrt(i32 %26)
store i32 %27, i32* %4
%28 = load i32, i32* %4
%29 = load i32, i32* %4
%30 = mul nsw i32 %28, %29
store i32 %30, i32* %5
%31 = load i32, i32* %5
%32 = load i32, i32* %6
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %37
34: ; preds = %25
%35 = load i32, i32* %8
%36 = add nsw i32 %35, 1
store i32 %36, i32* %8
br label %37
37: ; preds = %34, %25
br label %38
38: ; preds = %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %21
41: ; preds = %21
%42 = load i32, i32* %8
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %41
br label %9
45: ; preds = %18, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %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*
%4 = bitcast i32* %2 to i8*
%5 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %31, label %7
7: ; preds = %0, %26
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 0
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 0
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %31, label %13
13: ; preds = %7
%14 = icmp sgt i32 %8, %10
br i1 %14, label %26, label %15
15: ; preds = %13, %15
%16 = phi i32 [ %22, %15 ], [ 0, %13 ]
%17 = phi i32 [ %23, %15 ], [ %8, %13 ]
%18 = call i32 @sqrt(i32 %17)
%19 = mul nsw i32 %18, %18
%20 = icmp eq i32 %19, %17
%21 = zext i1 %20 to i32
%22 = add nuw nsw i32 %16, %21
%23 = add nsw i32 %17, 1
%24 = load i32, i32* %2
%25 = icmp slt i32 %17, %24
br i1 %25, label %15, label %26
26: ; preds = %15, %13
%27 = phi i32 [ 0, %13 ], [ %22, %15 ]
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %7
31: ; preds = %26, %7, %0
ret i32 0
}