#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__ ceil(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *, int *);
int /*<<< orphan*/ sqrt(int);
main() {
  int a, b;
  while (scanf("%d%d", &a, &b)) {
    if (a == 0 && b == 0)
      break;
    printf("%d\n", (int)(floor(sqrt(b))) - (int)ceil(sqrt(a)) + 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
cmp    $0x0,%rax
je     11d6 <main+0x86>
cmpl   $0x0,-0x8(%rbp)
jne    1196 <main+0x46>
cmpl   $0x0,-0xc(%rbp)
jne    1196 <main+0x46>
jmp    11d6 <main+0x86>
mov    -0xc(%rbp),%edi
call   1060 <sqrt@plt>
cvtsi2sd %eax,%xmm0
call   1070 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <sqrt@plt>
mov    %eax,%edi
call   1030 <ceil@plt>
mov    -0x10(%rbp),%esi
sub    %eax,%esi
add    $0x1,%esi
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
jmp    115f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xead(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1050 <scanf@plt>
test   %rax,%rax
je     11c5 <main+0x85>
lea    0xe97(%rip),%r14
lea    0xe8b(%rip),%r15
lea    0x8(%rsp),%r12
lea    0xc(%rsp),%rbx
nop
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%eax
or     %edi,%eax
je     11c5 <main+0x85>
call   1060 <sqrt@plt>
mov    %eax,%ebp
mov    0x8(%rsp),%edi
call   1060 <sqrt@plt>
mov    %eax,%edi
call   1030 <ceil@plt>
sub    %eax,%ebp
add    $0x1,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
test   %rax,%rax
jne    1180 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 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
store i32 0, i32* %1
br label %4
4: ; preds = %14, %0
%5 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %27
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
br label %27
14: ; preds = %10, %7
%15 = load i32, i32* %3
%16 = call i32 @sqrt(i32 %15)
%17 = sitofp i32 %16 to double
%18 = call double @llvm.floor.f64(double %17)
%19 = fptosi double %18 to i32
%20 = load i32, i32* %2
%21 = call i32 @sqrt(i32 %20)
%22 = call i64 @ceil(i32 %21)
%23 = trunc i64 %22 to i32
%24 = sub nsw i32 %19, %23
%25 = add nsw i32 %24, 1
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
br label %4
27: ; preds = %13, %4
ret i32 0
}

LLVM IR (-O2):
@.str = [5 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 ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %24, label %7
7: ; preds = %0, %13
%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 %24, label %13
13: ; preds = %7
%14 = call i32 @sqrt(i32 %10)
%15 = load i32, i32* %1
%16 = call i32 @sqrt(i32 %15)
%17 = call i64 @ceil(i32 %16)
%18 = trunc i64 %17 to i32
%19 = add i32 %14, 1
%20 = sub i32 %19, %18
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %7
24: ; preds = %13, %7, %0
ret i32 0
}