#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 */
scalar_t__ EOF;
double cos(double);
int /*<<< orphan*/ printf(char *, double, char *);
scalar_t__ scanf(char *, ...);
double sin(double);
double sqrt(double);
int main(void) {
  double h, a, v, d;
  int p1, p2, n;
  while (scanf("%lf", &h) != EOF) {
    scanf("%d %d", &p1, &p2);
    scanf("%d", &n);
    while (n--) {
      scanf("%lf %lf", &a, &v);
      a = (a * 3.14159) / 180.0;
      d = ((v * cos(a)) / 9.80665) *
          (v * sin(a) + sqrt(v * v * sin(a) * sin(a) + 2 * 9.80665 * h));
      printf("%.5lf -> %s\n", d, (p1 <= d && d <= p2 ? "DUCK" : "NUCK"));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec4(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    0x2e70(%rip),%rcx
cmp    (%rcx),%rax
je     131e <main+0x1ce>
lea    0xe98(%rip),%rdi
lea    -0x2c(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xe85(%rip),%rdi
lea    -0x34(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x34(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x34(%rbp)
cmp    $0x0,%eax
je     1319 <main+0x1c9>
lea    0xe62(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
movsd  0xe3d(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xe28(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xdef(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
movsd  0xd81(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm3
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
xor    %eax,%eax
ucomisd %xmm1,%xmm0
mov    %al,-0x35(%rbp)
jb     12eb <main+0x19b>
movsd  -0x28(%rbp),%xmm1
cvtsi2sdl -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x35(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x35(%rbp),%cl
lea    0xd46(%rip),%rsi
lea    0xd3a(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rsi
lea    0xd1f(%rip),%rdi
call   1030 <printf@plt>
jmp    11a9 <main+0x59>
jmp    115f <main+0xf>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0xecd(%rip),%rdi
lea    0x40(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e70(%rip),%rcx
cmp    (%rcx),%rax
jne    118e <main+0x3e>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe99(%rip),%r15
lea    0x8(%rsp),%r12
lea    0x18(%rsp),%r13
lea    0xe9d(%rip),%r14
lea    0xe9b(%rip),%rbp
lea    0xe82(%rip),%rbx
jmp    11df <main+0x8f>
cs nopw 0x0(%rax,%rax,1)
lea    0xe6b(%rip),%rdi
lea    0x40(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e0e(%rip),%rcx
cmp    (%rcx),%rax
je     117d <main+0x2d>
lea    0xe42(%rip),%rdi
lea    0x24(%rsp),%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe2d(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
jmp    1264 <main+0x114>
nopl   0x0(%rax)
call   1070 <sqrt@plt>
movsd  0x38(%rsp),%xmm2
movsd  0x30(%rsp),%xmm1
movsd  0x28(%rsp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sdl 0x24(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0x20(%rsp),%xmm1
ucomisd %xmm2,%xmm1
mov    %rbp,%rsi
cmovae %r14,%rsi
ucomisd %xmm0,%xmm2
cmovb  %rbp,%rsi
mov    %rbx,%rdi
movapd %xmm2,%xmm0
call   1030 <printf@plt>
subl   $0x1,0x14(%rsp)
jb     11c0 <main+0x70>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xd73(%rip),%xmm0
divsd  0xd73(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm1
movsd  %xmm1,(%rsp)
call   1060 <cos@plt>
mulsd  (%rsp),%xmm0
divsd  0xd58(%rip),%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x18(%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
movsd  0x40(%rsp),%xmm1
mulsd  0xd00(%rip),%xmm1
mulsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xcf7(%rip),%xmm0
jb     1210 <main+0xc0>
sqrtsd %xmm0,%xmm0
jmp    1215 <main+0xc5>

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@EOF = global i64 0
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [8 x i8] c"%lf %lf\00"
@.str.4 = [13 x i8] c"%.5lf -> %s\0A\00"
@.str.5 = [5 x i8] c"DUCK\00"
@.str.6 = [5 x i8] c"NUCK\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
br label %9
9: ; preds = %62, %0
%10 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%11 = load i64, i64* @EOF
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %63
13: ; preds = %9
%14 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %7)
%15 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
br label %16
16: ; preds = %57, %13
%17 = load i32, i32* %8
%18 = add nsw i32 %17, -1
store i32 %18, i32* %8
%19 = icmp ne i32 %17, 0
br i1 %19, label %20, label %62
20: ; preds = %16
%21 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double* %3, double* %4)
%22 = load double, double* %3
%23 = fmul double %22, 3.141590e+00
%24 = fdiv double %23, 1.800000e+02
store double %24, double* %3
%25 = load double, double* %4
%26 = load double, double* %3
%27 = call double @cos(double %26)
%28 = fmul double %25, %27
%29 = fdiv double %28, 0x40239D013A92A305
%30 = load double, double* %4
%31 = load double, double* %3
%32 = call double @sin(double %31)
%33 = load double, double* %4
%34 = load double, double* %4
%35 = fmul double %33, %34
%36 = load double, double* %3
%37 = call double @sin(double %36)
%38 = fmul double %35, %37
%39 = load double, double* %3
%40 = call double @sin(double %39)
%41 = load double, double* %2
%42 = fmul double 1.961330e+01, %41
%43 = call double @llvm.fmuladd.f64(double %38, double %40, double %42)
%44 = call double @sqrt(double %43)
%45 = call double @llvm.fmuladd.f64(double %30, double %32, double %44)
%46 = fmul double %29, %45
store double %46, double* %5
%47 = load double, double* %5
%48 = load i32, i32* %6
%49 = sitofp i32 %48 to double
%50 = load double, double* %5
%51 = fcmp ole double %49, %50
br i1 %51, label %52, label %57
52: ; preds = %20
%53 = load double, double* %5
%54 = load i32, i32* %7
%55 = sitofp i32 %54 to double
%56 = fcmp ole double %53, %55
br label %57
57: ; preds = %52, %20
%58 = phi i1 [ false, %20 ], [ %56, %52 ]
%59 = zext i1 %58 to i64
%60 = select i1 %58, 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.6, i64 0, i64 0)
%61 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double %47, i8* %60)
br label %16
62: ; preds = %16
br label %9
63: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@EOF = global i64 0
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [8 x i8] c"%lf %lf\00"
@.str.4 = [13 x i8] c"%.5lf -> %s\0A\00"
@.str.5 = [5 x i8] c"DUCK\00"
@.str.6 = [5 x i8] c"NUCK\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast double* %1 to i8*
%8 = bitcast double* %2 to i8*
%9 = bitcast double* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%14 = load i64, i64* @EOF
%15 = icmp eq i64 %13, %14
br i1 %15, label %63, label %20
16: ; preds = %26, %20
%17 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%18 = load i64, i64* @EOF
%19 = icmp eq i64 %17, %18
br i1 %19, label %63, label %20
20: ; preds = %0, %16
%21 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5)
%22 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%23 = load i32, i32* %6
%24 = add nsw i32 %23, -1
store i32 %24, i32* %6
%25 = icmp eq i32 %23, 0
br i1 %25, label %16, label %26
26: ; preds = %20, %26
%27 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double* %2, double* %3)
%28 = load double, double* %2
%29 = fmul double %28, 3.141590e+00
%30 = fdiv double %29, 1.800000e+02
store double %30, double* %2
%31 = load double, double* %3
%32 = call double @cos(double %30)
%33 = fmul double %31, %32
%34 = fdiv double %33, 0x40239D013A92A305
%35 = load double, double* %3
%36 = load double, double* %2
%37 = call double @sin(double %36)
%38 = load double, double* %3
%39 = fmul double %38, %38
%40 = load double, double* %2
%41 = call double @sin(double %40)
%42 = fmul double %39, %41
%43 = load double, double* %2
%44 = call double @sin(double %43)
%45 = load double, double* %1
%46 = fmul double %45, 1.961330e+01
%47 = call double @llvm.fmuladd.f64(double %42, double %44, double %46)
%48 = call double @sqrt(double %47)
%49 = call double @llvm.fmuladd.f64(double %35, double %37, double %48)
%50 = fmul double %34, %49
%51 = load i32, i32* %4
%52 = sitofp i32 %51 to double
%53 = fcmp oge double %50, %52
%54 = load i32, i32* %5
%55 = sitofp i32 %54 to double
%56 = fcmp ole double %50, %55
%57 = select i1 %53, i1 %56, i1 false
%58 = select i1 %57, 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.6, i64 0, i64 0)
%59 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double %50, i8* %58)
%60 = load i32, i32* %6
%61 = add nsw i32 %60, -1
store i32 %61, i32* %6
%62 = icmp eq i32 %60, 0
br i1 %62, label %16, label %26
63: ; preds = %16, %0
ret i32 0
}