#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 */
double findLandingPosition(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main(void) {
  int numTests, poolLength, distance, height, horizonSpeed;
  double landingPos;
  scanf("%d", &numTests);
  while (numTests) {
    scanf("%d %d %d %d", &poolLength, &distance, &height, &horizonSpeed);
    landingPos = findLandingPosition(height, horizonSpeed);
    if (landingPos < distance - 500.0 ||
        landingPos > distance + poolLength + 500.0) {
      printf("FLOOR\n");
    } else {
      if (landingPos > distance + 500.0 &&
          landingPos < distance + poolLength - 500.0) {
        printf("POOL\n");
      } else {
        printf("EDGE\n");
      }
    }
    numTests--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     1254 <main+0x124>
lea    0xea6(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <findLandingPosition@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xe65(%rip),%xmm2
subsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
ja     11ce <main+0x9e>
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xe40(%rip),%xmm2
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    11df <main+0xaf>
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
jmp    1246 <main+0x116>
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xe0f(%rip),%xmm2
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    1235 <main+0x105>
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xdea(%rip),%xmm2
subsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    1235 <main+0x105>
lea    0xdf0(%rip),%rdi
call   1030 <printf@plt>
jmp    1241 <main+0x111>
lea    0xde5(%rip),%rdi
call   1030 <printf@plt>
jmp    1246 <main+0x116>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1151 <main+0x21>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xed4(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
je     122f <main+0xff>
lea    0xead(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
lea    0x8(%rsp),%rbx
lea    0xea8(%rip),%rbp
jmp    119f <main+0x6f>
ucomisd %xmm1,%xmm0
lea    0xe91(%rip),%rax
cmovbe %rax,%rdi
call   1030 <puts@plt>
addl   $0xffffffff,0x4(%rsp)
je     122f <main+0xff>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1040 <findLandingPosition@plt>
mov    0x10(%rsp),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movapd %xmm1,%xmm2
addsd  0xe27(%rip),%xmm2
ucomisd %xmm0,%xmm2
mov    %rbp,%rdi
ja     118f <main+0x5f>
add    0x14(%rsp),%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
movapd %xmm2,%xmm3
addsd  0xe0f(%rip),%xmm3
ucomisd %xmm3,%xmm0
mov    %rbp,%rdi
ja     118f <main+0x5f>
addsd  0xdfe(%rip),%xmm1
addsd  0xdee(%rip),%xmm2
ucomisd %xmm0,%xmm2
lea    0xe04(%rip),%rdi
ja     1180 <main+0x50>
lea    0xdf2(%rip),%rdi
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"%d %d %d %d\00"
@.str.2 = [7 x i8] c"FLOOR\0A\00"
@.str.3 = [6 x i8] c"POOL\0A\00"
@.str.4 = [6 x i8] c"EDGE\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store i32 0, i32* %1
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %9
9: ; preds = %51, %0
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %54
12: ; preds = %9
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6)
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = call double @findLandingPosition(i32 %14, i32 %15)
store double %16, double* %7
%17 = load double, double* %7
%18 = load i32, i32* %4
%19 = sitofp i32 %18 to double
%20 = fsub double %19, 5.000000e+02
%21 = fcmp olt double %17, %20
br i1 %21, label %30, label %22
22: ; preds = %12
%23 = load double, double* %7
%24 = load i32, i32* %4
%25 = load i32, i32* %3
%26 = add nsw i32 %24, %25
%27 = sitofp i32 %26 to double
%28 = fadd double %27, 5.000000e+02
%29 = fcmp ogt double %23, %28
br i1 %29, label %30, label %32
30: ; preds = %22, %12
%31 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %51
32: ; preds = %22
%33 = load double, double* %7
%34 = load i32, i32* %4
%35 = sitofp i32 %34 to double
%36 = fadd double %35, 5.000000e+02
%37 = fcmp ogt double %33, %36
br i1 %37, label %38, label %48
38: ; preds = %32
%39 = load double, double* %7
%40 = load i32, i32* %4
%41 = load i32, i32* %3
%42 = add nsw i32 %40, %41
%43 = sitofp i32 %42 to double
%44 = fsub double %43, 5.000000e+02
%45 = fcmp olt double %39, %44
br i1 %45, label %46, label %48
46: ; preds = %38
%47 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %50
48: ; preds = %38, %32
%49 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %50
50: ; preds = %48, %46
br label %51
51: ; preds = %50, %30
%52 = load i32, i32* %2
%53 = add nsw i32 %52, -1
store i32 %53, i32* %2
br label %9
54: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"%d %d %d %d\00"
@str = [5 x i8] c"EDGE\00"
@str.5 = [5 x i8] c"POOL\00"
@str.6 = [6 x i8] c"FLOOR\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 = bitcast i32* %5 to i8*
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, 0
br i1 %13, label %42, label %14
14: ; preds = %0, %36
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = call double @findLandingPosition(i32 %16, i32 %17)
%19 = load i32, i32* %3
%20 = sitofp i32 %19 to double
%21 = fadd double %20, -5.000000e+02
%22 = fcmp olt double %18, %21
br i1 %22, label %36, label %23
23: ; preds = %14
%24 = load i32, i32* %2
%25 = add nsw i32 %24, %19
%26 = sitofp i32 %25 to double
%27 = fadd double %26, 5.000000e+02
%28 = fcmp ogt double %18, %27
br i1 %28, label %36, label %29
29: ; preds = %23
%30 = fadd double %20, 5.000000e+02
%31 = fcmp ogt double %18, %30
%32 = fadd double %26, -5.000000e+02
%33 = fcmp olt double %18, %32
%34 = select i1 %31, i1 %33, i1 false
%35 = select i1 %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0)
br label %36
36: ; preds = %29, %14, %23
%37 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @str.6, i64 0, i64 0), %23 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @str.6, i64 0, i64 0), %14 ], [ %35, %29 ]
%38 = call i32 @puts(i8* dereferenceable(1) %37)
%39 = load i32, i32* %1
%40 = add nsw i32 %39, -1
store i32 %40, i32* %1
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %14
42: ; preds = %36, %0
ret i32 0
}