#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *, int *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  FILE *fp;
  int x1, y1, x2, y2;
  if (argc != 2) {
    printf("Usage: %s [FILE]\n", argv[0]);
    return 1;
  }
  fp = fopen(*++argv, "r");
  while (fscanf(fp, "%d %d %d %d", &x1, &y1, &x2, &y2) != EOF) {
    puts((x1 == x2)   ? ((y1 == y2)  ? "here"
                         : (y1 < y2) ? "N"
                                     : "S")
         : (y1 == y2) ? ((x1 < x2) ? "E" : "W")
                      : ((x1 < x2) ? ((y1 < y2) ? "NE" : "SE")
                                   : ((y1 < y2) ? "NW" : "SW")));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12c6 <main+0x186>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe79(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe67(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%r8
lea    -0x28(%rbp),%r9
call   1050 <fscanf@plt>
mov    0x2e1f(%rip),%rcx
cmp    (%rcx),%rax
je     12bf <main+0x17f>
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    1225 <main+0xe5>
mov    -0x20(%rbp),%eax
cmp    -0x28(%rbp),%eax
jne    11fa <main+0xba>
lea    0xe2f(%rip),%rax
mov    %rax,-0x30(%rbp)
jmp    1218 <main+0xd8>
mov    -0x20(%rbp),%edx
mov    -0x28(%rbp),%esi
lea    0xe20(%rip),%rax
lea    0xe17(%rip),%rcx
cmp    %esi,%edx
cmovl  %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    12b1 <main+0x171>
mov    -0x20(%rbp),%eax
cmp    -0x28(%rbp),%eax
jne    1254 <main+0x114>
mov    -0x1c(%rbp),%edx
mov    -0x24(%rbp),%esi
lea    0xdf2(%rip),%rax
lea    0xde5(%rip),%rcx
cmp    %esi,%edx
cmovl  %rcx,%rax
mov    %rax,-0x40(%rbp)
jmp    12a9 <main+0x169>
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1283 <main+0x143>
mov    -0x20(%rbp),%edx
mov    -0x28(%rbp),%esi
lea    0xdbf(%rip),%rax
lea    0xdb5(%rip),%rcx
cmp    %esi,%edx
cmovl  %rcx,%rax
mov    %rax,-0x48(%rbp)
jmp    12a1 <main+0x161>
mov    -0x20(%rbp),%edx
mov    -0x28(%rbp),%esi
lea    0xda2(%rip),%rax
lea    0xd98(%rip),%rcx
cmp    %esi,%edx
cmovl  %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <puts@plt>
jmp    11a2 <main+0x62>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jne    127a <main+0x13a>
mov    0x8(%rsi),%rdi
lea    0xeb0(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xea3(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0x8(%rsp),%r9
mov    %rax,%rdi
call   1050 <fscanf@plt>
mov    0x2e54(%rip),%rdx
xor    %ecx,%ecx
cmp    (%rdx),%rax
je     1292 <main+0x152>
lea    0xe6e(%rip),%r15
lea    0x14(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%rbp
lea    0x8(%rsp),%r14
jmp    11ec <main+0xac>
nopl   0x0(%rax)
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
mov    %r14,%r9
call   1050 <fscanf@plt>
mov    0x2e05(%rip),%rcx
cmp    (%rcx),%rax
je     1290 <main+0x150>
mov    0x14(%rsp),%edx
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%eax
mov    0x8(%rsp),%ecx
cmp    %esi,%edx
jne    1220 <main+0xe0>
lea    0xe19(%rip),%rdi
cmp    %ecx,%eax
je     11c0 <main+0x80>
lea    0xe13(%rip),%rdi
jl     11c0 <main+0x80>
lea    0xe0c(%rip),%rdi
jmp    11c0 <main+0x80>
nopl   (%rax)
cmp    %ecx,%eax
jne    1240 <main+0x100>
lea    0xdff(%rip),%rdi
cmp    %esi,%edx
jl     11c0 <main+0x80>
lea    0xdfa(%rip),%rdi
jmp    11c0 <main+0x80>
nopl   0x0(%rax,%rax,1)
cmp    %esi,%edx
jge    125f <main+0x11f>
lea    0xdde(%rip),%rdi
cmp    %ecx,%eax
jl     11c0 <main+0x80>
lea    0xdd2(%rip),%rdi
jmp    11c0 <main+0x80>
lea    0xdc9(%rip),%rdi
cmp    %ecx,%eax
jl     11c0 <main+0x80>
lea    0xdbd(%rip),%rdi
jmp    11c0 <main+0x80>
mov    (%rsi),%rsi
lea    0xd7c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%ecx
jmp    1292 <main+0x152>
xor    %ecx,%ecx
mov    %ecx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [12 x i8] c"%d %d %d %d\00"
@EOF = global i64 0
@.str.3 = [5 x i8] c"here\00"
@.str.4 = [2 x i8] c"N\00"
@.str.5 = [2 x i8] c"S\00"
@.str.6 = [2 x i8] c"E\00"
@.str.7 = [2 x i8] c"W\00"
@.str.8 = [3 x i8] c"NE\00"
@.str.9 = [3 x i8] c"SE\00"
@.str.10 = [3 x i8] c"NW\00"
@.str.11 = [3 x i8] c"SW\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = icmp eq i32 %0, 2
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = load i8*, i8** %1
%14 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %49
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = call i64 @fscanf(i32* %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6)
%20 = load i64, i64* @EOF
%21 = icmp eq i64 %19, %20
br i1 %21, label %49, label %22
22: ; preds = %15, %43
%23 = load i32, i32* %3
%24 = load i32, i32* %5
%25 = icmp eq i32 %23, %24
%26 = load i32, i32* %4
%27 = load i32, i32* %6
%28 = icmp eq i32 %26, %27
br i1 %25, label %29, label %33
29: ; preds = %22
br i1 %28, label %43, label %30
30: ; preds = %29
%31 = icmp slt i32 %26, %27
%32 = select i1 %31, 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.5, i64 0, i64 0)
br label %43
33: ; preds = %22
%34 = icmp slt i32 %23, %24
br i1 %28, label %35, label %37
35: ; preds = %33
%36 = select i1 %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0)
br label %43
37: ; preds = %33
%38 = icmp slt i32 %26, %27
br i1 %34, label %39, label %41
39: ; preds = %37
%40 = select i1 %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0)
br label %43
41: ; preds = %37
%42 = select i1 %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0)
br label %43
43: ; preds = %35, %41, %39, %30, %29
%44 = phi i8* [ %32, %30 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %29 ], [ %36, %35 ], [ %40, %39 ], [ %42, %41 ]
%45 = call i32 @puts(i8* dereferenceable(1) %44)
%46 = call i64 @fscanf(i32* %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6)
%47 = load i64, i64* @EOF
%48 = icmp eq i64 %46, %47
br i1 %48, label %49, label %22
49: ; preds = %43, %15, %12
%50 = phi i32 [ 1, %12 ], [ 0, %15 ], [ 0, %43 ]
ret i32 %50
}