#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__ EOF;
int pow(int, double);
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, int *, int *);
int main() {
  int x, y, n, S, doudou, i;
  while (scanf("%d %d", &x, &y) != EOF) {
    if (x == 0 && y == 0)
      break;
    S = 0;
    doudou = 1;
    for (n = x; n <= y; n++) {
      S = pow(n, 2.0) + n + 41;
      for (i = 2; (i * i) <= S; i++)
        if (S % i == 0) {
          doudou = 0;
          break;
        }
      if (doudou == 0)
        break;
    }
    if (doudou)
      printf("OK\n");
    if (doudou == 0)
      printf("Sorry\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    0x2e8e(%rip),%rcx
cmp    (%rcx),%rax
je     124e <main+0x11e>
cmpl   $0x0,-0x8(%rbp)
jne    117c <main+0x4c>
cmpl   $0x0,-0xc(%rbp)
jne    117c <main+0x4c>
jmp    124e <main+0x11e>
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     121d <main+0xed>
mov    -0x10(%rbp),%edi
movsd  0xe59(%rip),%xmm0
call   1050 <pow@plt>
add    -0x10(%rbp),%eax
add    $0x29,%eax
mov    %eax,-0x14(%rbp)
movl   $0x2,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11fb <main+0xcb>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
cmp    $0x0,%edx
jne    11e8 <main+0xb8>
movl   $0x0,-0x18(%rbp)
jmp    11fb <main+0xcb>
jmp    11ed <main+0xbd>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11bc <main+0x8c>
cmpl   $0x0,-0x18(%rbp)
jne    120a <main+0xda>
jmp    121d <main+0xed>
jmp    120f <main+0xdf>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1190 <main+0x60>
cmpl   $0x0,-0x18(%rbp)
je     1233 <main+0x103>
lea    0xde0(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    1249 <main+0x119>
lea    0xdce(%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    0xec6(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x2e92(%rip),%r13
cmp    0x0(%r13),%rax
jne    116d <main+0x3d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea0(%rip),%rbp
lea    0xe8d(%rip),%r14
lea    0x4(%rsp),%r15
mov    %rsp,%r12
jmp    11b0 <main+0x80>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <scanf@plt>
cmp    0x0(%r13),%rax
je     115c <main+0x2c>
mov    0x4(%rsp),%ebx
mov    (%rsp),%eax
mov    %ebx,%ecx
or     %eax,%ecx
je     115c <main+0x2c>
mov    %rbp,%rdi
cmp    %eax,%ebx
jle    11da <main+0xaa>
jmp    1197 <main+0x67>
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rbx),%eax
cmp    (%rsp),%ebx
mov    %eax,%ebx
jge    1217 <main+0xe7>
mov    %ebx,%edi
movsd  0xe1c(%rip),%xmm0
call   1050 <pow@plt>
lea    (%rbx,%rax,1),%ecx
add    $0x29,%ecx
cmp    $0x4,%ecx
jl     11d0 <main+0xa0>
mov    $0x2,%esi
nopl   0x0(%rax)
mov    %ecx,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1190 <main+0x60>
add    $0x1,%esi
mov    %esi,%eax
imul   %esi,%eax
cmp    %ecx,%eax
jle    1200 <main+0xd0>
jmp    11d0 <main+0xa0>
mov    %rbp,%rdi
jmp    1197 <main+0x67>

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"OK\0A\00"
@.str.2 = [7 x i8] c"Sorry\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
br label %8
8: ; preds = %65, %0
%9 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%10 = load i64, i64* @EOF
%11 = icmp ne i64 %9, %10
br i1 %11, label %12, label %66
12: ; preds = %8
%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 %66
19: ; preds = %15, %12
store i32 0, i32* %5
store i32 1, i32* %6
%20 = load i32, i32* %2
store i32 %20, i32* %4
br label %21
21: ; preds = %52, %19
%22 = load i32, i32* %4
%23 = load i32, i32* %3
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %55
25: ; preds = %21
%26 = load i32, i32* %4
%27 = call i32 @pow(i32 %26, double 2.000000e+00)
%28 = load i32, i32* %4
%29 = add nsw i32 %27, %28
%30 = add nsw i32 %29, 41
store i32 %30, i32* %5
store i32 2, i32* %7
br label %31
31: ; preds = %44, %25
%32 = load i32, i32* %7
%33 = load i32, i32* %7
%34 = mul nsw i32 %32, %33
%35 = load i32, i32* %5
%36 = icmp sle i32 %34, %35
br i1 %36, label %37, label %47
37: ; preds = %31
%38 = load i32, i32* %5
%39 = load i32, i32* %7
%40 = srem i32 %38, %39
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %37
store i32 0, i32* %6
br label %47
43: ; preds = %37
br label %44
44: ; preds = %43
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
store i32 %46, i32* %7
br label %31
47: ; preds = %42, %31
%48 = load i32, i32* %6
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %47
br label %55
51: ; preds = %47
br label %52
52: ; preds = %51
%53 = load i32, i32* %4
%54 = add nsw i32 %53, 1
store i32 %54, i32* %4
br label %21
55: ; preds = %50, %21
%56 = load i32, i32* %6
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %55
%59 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %60
60: ; preds = %58, %55
%61 = load i32, i32* %6
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %65
65: ; preds = %63, %60
br label %8
66: ; preds = %18, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@EOF = global i64 0
@str = [6 x i8] c"Sorry\00"
@str.3 = [3 x i8] c"OK\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 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %40, label %8
8: ; preds = %0, %34
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 0
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 0
%13 = select i1 %10, i1 %12, i1 false
br i1 %13, label %40, label %14
14: ; preds = %8
%15 = icmp sgt i32 %9, %11
br i1 %15, label %34, label %16
16: ; preds = %14, %30
%17 = phi i32 [ %31, %30 ], [ %9, %14 ]
%18 = call i32 @pow(i32 %17, double 2.000000e+00)
%19 = add i32 %17, 41
%20 = add i32 %19, %18
%21 = icmp slt i32 %20, 4
br i1 %21, label %30, label %25
22: ; preds = %25
%23 = mul nsw i32 %29, %29
%24 = icmp sgt i32 %23, %20
br i1 %24, label %30, label %25
25: ; preds = %16, %22
%26 = phi i32 [ %29, %22 ], [ 2, %16 ]
%27 = srem i32 %20, %26
%28 = icmp eq i32 %27, 0
%29 = add nuw nsw i32 %26, 1
br i1 %28, label %34, label %22
30: ; preds = %22, %16
%31 = add nsw i32 %17, 1
%32 = load i32, i32* %2
%33 = icmp slt i32 %17, %32
br i1 %33, label %16, label %34
34: ; preds = %30, %25, %14
%35 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.3, i64 0, i64 0), %14 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0), %25 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.3, i64 0, i64 0), %30 ]
%36 = call i32 @puts(i8* dereferenceable(1) %35)
%37 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%38 = load i64, i64* @EOF
%39 = icmp eq i64 %37, %38
br i1 %39, label %40, label %8
40: ; preds = %34, %8, %0
ret i32 0
}