#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 /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int i, w, i1, w1;
  do {
    scanf("%d%d", &i, &w);
    if (i == -1 && w == -1)
      break;
    if ((i % 1000 == 0) && (w % 37 == 0)) {
      if (i / 1000 == w / 37)
        printf("Y\n");
      else
        printf("N\n");
    } else
      printf("N\n");
  } while (w != -1 && i != -1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jne    115c <main+0x3c>
cmpl   $0xffffffff,-0xc(%rbp)
jne    115c <main+0x3c>
jmp    1201 <main+0xe1>
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11cc <main+0xac>
mov    -0xc(%rbp),%eax
mov    $0x25,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11cc <main+0xac>
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x25,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jne    11bb <main+0x9b>
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
jmp    11c7 <main+0xa7>
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <main+0xb8>
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
jmp    11dd <main+0xbd>
xor    %eax,%eax
cmpl   $0xffffffff,-0xc(%rbp)
mov    %al,-0x19(%rbp)
je     11f6 <main+0xd6>
cmpl   $0xffffffff,-0x8(%rbp)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%rbx
lea    0xec2(%rip),%r12
lea    0xeb9(%rip),%r13
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%eax
cmp    $0xffffffff,%ecx
jne    1170 <main+0x50>
cmp    $0xffffffff,%eax
je     11d9 <main+0xb9>
movslq %ecx,%rdx
imul   $0x10624dd3,%rdx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
shr    $0x20,%rdx
sar    $0x6,%edx
add    %esi,%edx
imul   $0x3e8,%edx,%esi
sub    %esi,%ecx
movslq %eax,%rsi
imul   $0xffffffffdd67c8a7,%rsi,%rsi
shr    $0x20,%rsi
add    %eax,%esi
mov    %esi,%edi
shr    $0x1f,%edi
sar    $0x5,%esi
add    %edi,%esi
lea    (%rsi,%rsi,8),%edi
lea    (%rsi,%rdi,4),%edi
sub    %edi,%eax
or     %ecx,%eax
xor    %edx,%esi
or     %eax,%esi
mov    %r12,%rdi
je     11c2 <main+0xa2>
mov    %r13,%rdi
call   1030 <puts@plt>
cmpl   $0xffffffff,0x8(%rsp)
je     11d9 <main+0xb9>
cmpl   $0xffffffff,0xc(%rsp)
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@str.3 = [2 x i8] c"N\00"
@str.4 = [2 x i8] c"Y\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %12, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, -1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, -1
%11 = select i1 %8, i1 %10, i1 false
br i1 %11, label %29, label %12
12: ; preds = %5
%13 = srem i32 %7, 1000
%14 = sdiv i32 %7, 1000
%15 = icmp eq i32 %13, 0
%16 = srem i32 %9, 37
%17 = sdiv i32 %9, 37
%18 = icmp eq i32 %16, 0
%19 = select i1 %15, i1 %18, i1 false
%20 = icmp eq i32 %14, %17
%21 = select i1 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0)
%22 = select i1 %19, i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0)
%23 = call i32 @puts(i8* dereferenceable(1) %22)
%24 = load i32, i32* %2
%25 = icmp ne i32 %24, -1
%26 = load i32, i32* %1
%27 = icmp ne i32 %26, -1
%28 = select i1 %25, i1 %27, i1 false
br i1 %28, label %5, label %29
29: ; preds = %5, %12
ret i32 0
}