#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;
  int gap;
  int platform;
  scanf("%d", &road);
  scanf("%d", &gap);
  scanf("%d", &platform);
  while (42) {
    int speed;
    int coordX;
    scanf("%d", &speed);
    scanf("%d", &coordX);
    if (road < 0) {
      printf("SLOW\n");
      speed--;
      continue;
    }
    if (speed > gap + 1) {
      printf("SLOW\n");
      speed--;
    } else if (speed < gap + 1) {
      printf("SPEED\n");
      speed++;
    } else {
      if (road == 1)
        printf("JUMP\n");
      else
        printf("WAIT\n");
    }
    road -= speed;
  }
  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>
cmpl   $0x0,-0x8(%rbp)
jge    11a3 <main+0x83>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    115f <main+0x3f>
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jle    11ce <main+0xae>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    122a <main+0x10a>
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11f9 <main+0xd9>
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1225 <main+0x105>
cmpl   $0x1,-0x8(%rbp)
jne    1214 <main+0xf4>
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
jmp    1220 <main+0x100>
lea    0xdfb(%rip),%rdi
call   1030 <printf@plt>
jmp    1225 <main+0x105>
jmp    122a <main+0x10a>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
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),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0xea6(%rip),%r12
lea    0xe8f(%rip),%rbp
lea    0xe92(%rip),%r13
jmp    1188 <main+0x68>
nopl   (%rax)
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
js     1180 <main+0x60>
mov    0x4(%rsp),%ecx
mov    0xc(%rsp),%edx
lea    0x1(%rdx),%esi
cmp    %esi,%ecx
jle    11d0 <main+0xb0>
mov    %r12,%rdi
call   1030 <puts@plt>
addl   $0xffffffff,0x4(%rsp)
jmp    11f9 <main+0xd9>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %edx,%ecx
jle    11e2 <main+0xc2>
cmp    $0x1,%eax
jne    11f1 <main+0xd1>
lea    0xe28(%rip),%rdi
jmp    11f4 <main+0xd4>
mov    %r13,%rdi
call   1030 <puts@plt>
addl   $0x1,0x4(%rsp)
jmp    11f9 <main+0xd9>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%eax
sub    %eax,0x8(%rsp)
jmp    1188 <main+0x68>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [5 x i8] c"WAIT\00"
@str.5 = [5 x i8] c"JUMP\00"
@str.6 = [6 x i8] c"SPEED\00"
@str.8 = [5 x i8] c"SLOW\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 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%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 = %46, %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* %1
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.8, i64 0, i64 0))
br label %46
21: ; preds = %14
%22 = load i32, i32* %4
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
%25 = icmp sgt i32 %22, %24
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.8, i64 0, i64 0))
%28 = load i32, i32* %4
%29 = add nsw i32 %28, -1
store i32 %29, i32* %4
br label %42
30: ; preds = %21
%31 = icmp sgt i32 %22, %23
br i1 %31, label %36, label %32
32: ; preds = %30
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.6, i64 0, i64 0))
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %42
36: ; preds = %30
%37 = icmp eq i32 %17, 1
br i1 %37, label %38, label %40
38: ; preds = %36
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.5, i64 0, i64 0))
br label %42
40: ; preds = %36
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %42
42: ; preds = %32, %40, %38, %26
%43 = load i32, i32* %4
%44 = load i32, i32* %1
%45 = sub nsw i32 %44, %43
store i32 %45, i32* %1
br label %46
46: ; preds = %42, %19
br label %14
}