#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 light_x;
  int light_y;
  int current_x;
  int current_y;
  scanf("%d%d%d%d", &light_x, &light_y, &current_x, &current_y);
  while (1) {
    int remainingTurns;
    scanf("%d", &remainingTurns);
    if (light_x > current_x) {
      current_x++;
      if (light_y > current_y) {
        current_y++;
        printf("SE\n");
      } else if (light_y < current_y) {
        current_y--;
        printf("NE\n");
      } else {
        printf("E\n");
      }
    } else if (light_x < current_x) {
      current_x--;
      if (light_y > current_y) {
        current_y++;
        printf("SW\n");
      } else if (light_y < current_y) {
        current_y--;
        printf("NW\n");
      } else {
        printf("W\n");
      }
    } else {
      if (light_y > current_y) {
        current_y++;
        printf("S\n");
      } else if (light_y < current_y) {
        current_y--;
        printf("N\n");
      } else {
        printf("ERROR\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
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb2(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11d6 <main+0xb6>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    119a <main+0x7a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
jmp    11d1 <main+0xb1>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c0 <main+0xa0>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
jmp    11cc <main+0xac>
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
jmp    11d1 <main+0xb1>
jmp    12b4 <main+0x194>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    124d <main+0x12d>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1211 <main+0xf1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    0xe0a(%rip),%rdi
call   1030 <printf@plt>
jmp    1248 <main+0x128>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1237 <main+0x117>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
lea    0xde8(%rip),%rdi
call   1030 <printf@plt>
jmp    1243 <main+0x123>
lea    0xdd8(%rip),%rdi
call   1030 <printf@plt>
jmp    1248 <main+0x128>
jmp    12af <main+0x18f>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1273 <main+0x153>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    0xdb0(%rip),%rdi
call   1030 <printf@plt>
jmp    12aa <main+0x18a>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1299 <main+0x179>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
lea    0xd8d(%rip),%rdi
call   1030 <printf@plt>
jmp    12a5 <main+0x185>
lea    0xd7f(%rip),%rdi
call   1030 <printf@plt>
jmp    12aa <main+0x18a>
jmp    12af <main+0x18f>
jmp    12b4 <main+0x194>
jmp    114d <main+0x2d>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeaf(%rip),%r14
lea    0x14(%rsp),%rbx
lea    0xeb9(%rip),%r15
lea    0xeb0(%rip),%r12
lea    0xea0(%rip),%rbp
lea    0xe91(%rip),%r13
jmp    1185 <main+0x65>
nopw   0x0(%rax,%rax,1)
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    %eax,0x10(%rsp)
jle    11c0 <main+0xa0>
add    $0x1,%eax
mov    %eax,0x8(%rsp)
mov    0x4(%rsp),%eax
cmp    %eax,0xc(%rsp)
jle    11f0 <main+0xd0>
add    $0x1,%eax
mov    %eax,0x4(%rsp)
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    1185 <main+0x65>
xchg   %ax,%ax
jge    1210 <main+0xf0>
add    $0xffffffff,%eax
mov    %eax,0x8(%rsp)
mov    0x4(%rsp),%eax
cmp    %eax,0xc(%rsp)
jle    122e <main+0x10e>
add    $0x1,%eax
mov    %eax,0x4(%rsp)
lea    0xe35(%rip),%rdi
call   1030 <puts@plt>
jmp    1185 <main+0x65>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
jge    1180 <main+0x60>
add    $0xffffffff,%eax
mov    %eax,0x4(%rsp)
lea    0xe16(%rip),%rdi
call   1030 <puts@plt>
jmp    1185 <main+0x65>
nopl   (%rax)
mov    0x4(%rsp),%eax
cmp    %eax,0xc(%rsp)
jle    1253 <main+0x133>
add    $0x1,%eax
mov    %eax,0x4(%rsp)
mov    %rbp,%rdi
call   1030 <puts@plt>
jmp    1185 <main+0x65>
lea    0xddf(%rip),%rdi
jge    1180 <main+0x60>
add    $0xffffffff,%eax
mov    %eax,0x4(%rsp)
lea    0xdca(%rip),%rdi
call   1030 <puts@plt>
jmp    1185 <main+0x65>
mov    %r13,%rdi
jge    1180 <main+0x60>
add    $0xffffffff,%eax
mov    %eax,0x4(%rsp)
lea    0xda5(%rip),%rdi
jmp    1180 <main+0x60>

LLVM IR (-O0):
@.str = [9 x i8] c"%d%d%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"SE\0A\00"
@.str.3 = [4 x i8] c"NE\0A\00"
@.str.4 = [3 x i8] c"E\0A\00"
@.str.5 = [4 x i8] c"SW\0A\00"
@.str.6 = [4 x i8] c"NW\0A\00"
@.str.7 = [3 x i8] c"W\0A\00"
@.str.8 = [3 x i8] c"S\0A\00"
@.str.9 = [3 x i8] c"N\0A\00"
@.str.10 = [7 x i8] c"ERROR\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 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
br label %8
8: ; preds = %0, %82
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%10 = load i32, i32* %2
%11 = load i32, i32* %4
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %35
13: ; preds = %8
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
%16 = load i32, i32* %3
%17 = load i32, i32* %5
%18 = icmp sgt i32 %16, %17
br i1 %18, label %19, label %23
19: ; preds = %13
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %34
23: ; preds = %13
%24 = load i32, i32* %3
%25 = load i32, i32* %5
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = load i32, i32* %5
%29 = add nsw i32 %28, -1
store i32 %29, i32* %5
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %33
31: ; preds = %23
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %33
33: ; preds = %31, %27
br label %34
34: ; preds = %33, %19
br label %82
35: ; preds = %8
%36 = load i32, i32* %2
%37 = load i32, i32* %4
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %61
39: ; preds = %35
%40 = load i32, i32* %4
%41 = add nsw i32 %40, -1
store i32 %41, i32* %4
%42 = load i32, i32* %3
%43 = load i32, i32* %5
%44 = icmp sgt i32 %42, %43
br i1 %44, label %45, label %49
45: ; preds = %39
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
store i32 %47, i32* %5
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %60
49: ; preds = %39
%50 = load i32, i32* %3
%51 = load i32, i32* %5
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %57
53: ; preds = %49
%54 = load i32, i32* %5
%55 = add nsw i32 %54, -1
store i32 %55, i32* %5
%56 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %59
57: ; preds = %49
%58 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %59
59: ; preds = %57, %53
br label %60
60: ; preds = %59, %45
br label %81
61: ; preds = %35
%62 = load i32, i32* %3
%63 = load i32, i32* %5
%64 = icmp sgt i32 %62, %63
br i1 %64, label %65, label %69
65: ; preds = %61
%66 = load i32, i32* %5
%67 = add nsw i32 %66, 1
store i32 %67, i32* %5
%68 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %80
69: ; preds = %61
%70 = load i32, i32* %3
%71 = load i32, i32* %5
%72 = icmp slt i32 %70, %71
br i1 %72, label %73, label %77
73: ; preds = %69
%74 = load i32, i32* %5
%75 = add nsw i32 %74, -1
store i32 %75, i32* %5
%76 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br label %79
77: ; preds = %69
%78 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
br label %79
79: ; preds = %77, %73
br label %80
80: ; preds = %79, %65
br label %81
81: ; preds = %80, %60
br label %82
82: ; preds = %81, %34
br label %8
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d%d%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [6 x i8] c"ERROR\00"
@str.11 = [2 x i8] c"N\00"
@str.12 = [2 x i8] c"S\00"
@str.13 = [2 x i8] c"W\00"
@str.14 = [3 x i8] c"NW\00"
@str.15 = [3 x i8] c"SW\00"
@str.16 = [2 x i8] c"E\00"
@str.17 = [3 x i8] c"NE\00"
@str.18 = [3 x i8] c"SE\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 = bitcast i32* %4 to i8*
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%11 = bitcast i32* %5 to i8*
br label %12
12: ; preds = %51, %0
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%14 = load i32, i32* %1
%15 = load i32, i32* %3
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %28
17: ; preds = %12
%18 = add nsw i32 %15, 1
store i32 %18, i32* %3
%19 = load i32, i32* %2
%20 = load i32, i32* %4
%21 = icmp sgt i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = add nsw i32 %20, 1
store i32 %23, i32* %4
br label %51
24: ; preds = %17
%25 = icmp slt i32 %19, %20
br i1 %25, label %26, label %51
26: ; preds = %24
%27 = add nsw i32 %20, -1
store i32 %27, i32* %4
br label %51
28: ; preds = %12
%29 = icmp slt i32 %14, %15
br i1 %29, label %30, label %41
30: ; preds = %28
%31 = add nsw i32 %15, -1
store i32 %31, i32* %3
%32 = load i32, i32* %2
%33 = load i32, i32* %4
%34 = icmp sgt i32 %32, %33
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = add nsw i32 %33, 1
store i32 %36, i32* %4
br label %51
37: ; preds = %30
%38 = icmp slt i32 %32, %33
br i1 %38, label %39, label %51
39: ; preds = %37
%40 = add nsw i32 %33, -1
store i32 %40, i32* %4
br label %51
41: ; preds = %28
%42 = load i32, i32* %2
%43 = load i32, i32* %4
%44 = icmp sgt i32 %42, %43
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = add nsw i32 %43, 1
store i32 %46, i32* %4
br label %51
47: ; preds = %41
%48 = icmp slt i32 %42, %43
br i1 %48, label %49, label %51
49: ; preds = %47
%50 = add nsw i32 %43, -1
store i32 %50, i32* %4
br label %51
51: ; preds = %47, %37, %24, %39, %35, %49, %45, %22, %26
%52 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.14, i64 0, i64 0), %39 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.15, i64 0, i64 0), %35 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0), %49 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.12, i64 0, i64 0), %45 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.18, i64 0, i64 0), %22 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.17, i64 0, i64 0), %26 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.16, i64 0, i64 0), %24 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0), %37 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0), %47 ]
%53 = call i32 @puts(i8* dereferenceable(1) %52)
br label %12
}