#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 main() {
  int road;
  scanf("%d", &road);
  int gap;
  scanf("%d", &gap);
  int platform;
  scanf("%d", &platform);
  while (1) {
    int speed;
    scanf("%d", &speed);
    int x;
    scanf("%d", &x);
    if (x + speed >= road + gap && x < road)
      printf("JUMP\n");
    else if (speed < gap + 1 && x < road)
      printf("SPEED\n");
    else if (speed > gap + 1 && x < road)
      printf("SLOW\n");
    else if (x >= road + gap) {
      printf("SLOW\n");
    } else {
      printf("WAIT\n");
    }
  }
  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
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe9a(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe8a(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jl     11b0 <main+0x90>
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b0 <main+0x90>
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
jmp    1249 <main+0x129>
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11de <main+0xbe>
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11de <main+0xbe>
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
jmp    1244 <main+0x124>
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jle    120c <main+0xec>
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    120c <main+0xec>
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
jmp    123f <main+0x11f>
mov    -0x18(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jl     122e <main+0x10e>
lea    0xdec(%rip),%rdi
call   1030 <printf@plt>
jmp    123a <main+0x11a>
lea    0xde1(%rip),%rdi
call   1030 <printf@plt>
jmp    123f <main+0x11f>
jmp    1244 <main+0x124>
jmp    1249 <main+0x129>
jmp    115f <main+0x3f>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%r13
lea    0x10(%rsp),%rsi
mov    %r13,%rdi
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %r13,%rdi
call   1040 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %r13,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%r14
lea    0x4(%rsp),%r15
lea    0xea6(%rip),%r12
jmp    1189 <main+0x69>
nop
cmp    %ecx,%eax
lea    0xe8f(%rip),%rdi
lea    0xe83(%rip),%rax
cmovl  %rax,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
mov    0x8(%rsp),%esi
lea    (%rsi,%rax,1),%ebx
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ebp
lea    (%rdx,%rbp,1),%ecx
cmp    %edx,%eax
jge    11c0 <main+0xa0>
mov    %r12,%rdi
cmp    %ecx,%ebx
jge    1184 <main+0x64>
cmp    %ebp,%esi
jle    11e0 <main+0xc0>
add    $0x1,%ebp
cmp    %ebp,%esi
jle    1170 <main+0x50>
lea    0xe36(%rip),%rdi
cmp    %edx,%eax
jl     1184 <main+0x64>
jmp    1170 <main+0x50>
nopl   0x0(%rax,%rax,1)
lea    0xe26(%rip),%rdi
cmp    %edx,%eax
jl     1184 <main+0x64>
jmp    1170 <main+0x50>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"JUMP\0A\00"
@.str.2 = [7 x i8] c"SPEED\0A\00"
@.str.3 = [6 x i8] c"SLOW\0A\00"
@.str.4 = [6 x i8] c"WAIT\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 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %10
10: ; preds = %0, %61
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%13 = load i32, i32* %6
%14 = load i32, i32* %5
%15 = add nsw i32 %13, %14
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = add nsw i32 %16, %17
%19 = icmp sge i32 %15, %18
br i1 %19, label %20, label %26
20: ; preds = %10
%21 = load i32, i32* %6
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %61
26: ; preds = %20, %10
%27 = load i32, i32* %5
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
%30 = icmp slt i32 %27, %29
br i1 %30, label %31, label %37
31: ; preds = %26
%32 = load i32, i32* %6
%33 = load i32, i32* %2
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %60
37: ; preds = %31, %26
%38 = load i32, i32* %5
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
%41 = icmp sgt i32 %38, %40
br i1 %41, label %42, label %48
42: ; preds = %37
%43 = load i32, i32* %6
%44 = load i32, i32* %2
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %59
48: ; preds = %42, %37
%49 = load i32, i32* %6
%50 = load i32, i32* %2
%51 = load i32, i32* %3
%52 = add nsw i32 %50, %51
%53 = icmp sge i32 %49, %52
br i1 %53, label %54, label %56
54: ; preds = %48
%55 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %58
56: ; preds = %48
%57 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %58
58: ; preds = %56, %54
br label %59
59: ; preds = %58, %46
br label %60
60: ; preds = %59, %35
br label %61
61: ; preds = %60, %24
br label %10
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [5 x i8] c"WAIT\00"
@str.6 = [5 x i8] c"SLOW\00"
@str.7 = [6 x i8] c"SPEED\00"
@str.8 = [5 x i8] c"JUMP\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = bitcast i32* %2 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = bitcast i32* %3 to i8*
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
br label %14
14: ; preds = %37, %0
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%17 = load i32, i32* %5
%18 = load i32, i32* %4
%19 = add nsw i32 %18, %17
%20 = load i32, i32* %1
%21 = load i32, i32* %2
%22 = add nsw i32 %21, %20
%23 = icmp sge i32 %19, %22
%24 = icmp slt i32 %17, %20
%25 = and i1 %24, %23
br i1 %25, label %37, label %26
26: ; preds = %14
%27 = icmp sgt i32 %18, %21
br i1 %27, label %29, label %28
28: ; preds = %26
br i1 %24, label %37, label %34
29: ; preds = %26
%30 = add nsw i32 %21, 1
%31 = icmp sle i32 %18, %30
%32 = xor i1 %24, true
%33 = select i1 %31, i1 true, i1 %32
br i1 %33, label %34, label %37
34: ; preds = %29, %28
%35 = icmp slt i32 %17, %22
%36 = select i1 %35, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0)
br label %37
37: ; preds = %34, %29, %28, %14
%38 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @str.8, i64 0, i64 0), %14 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @str.7, i64 0, i64 0), %28 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0), %29 ], [ %36, %34 ]
%39 = call i32 @puts(i8* dereferenceable(1) %38)
br label %14
}