#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 */
int abs(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int X = 0, Y = 0;
  FILE *fp = fopen("jeopardy.in", "r");
  fscanf(fp, "%d %d", &X, &Y);
  while (X != -1 || Y != -1) {
    int B = (X - Y) / 2;
    int A = Y + (X - Y) / 2;
    if ((((abs(X - Y)) % 2) == 1) || A < 0 || B < 0)
      printf("NOT SO FAST, TREBEKK!\n");
    else
      printf("What are the sum and difference of %d and %d?\n", A, B);
    fscanf(fp, "%d %d", &X, &Y);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe9c(%rip),%rdi
lea    0xea1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe8f(%rip),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1050 <fscanf@plt>
mov    $0x1,%al
cmpl   $0xffffffff,-0x8(%rbp)
mov    %al,-0x21(%rbp)
jne    11a5 <main+0x65>
cmpl   $0xffffffff,-0xc(%rbp)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11b5 <main+0x75>
jmp    1258 <main+0x118>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
sub    -0xc(%rbp),%edi
call   1030 <abs@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
je     1214 <main+0xd4>
cmpl   $0x0,-0x20(%rbp)
jl     1214 <main+0xd4>
cmpl   $0x0,-0x1c(%rbp)
jge    1227 <main+0xe7>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    123b <main+0xfb>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xdc8(%rip),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1050 <fscanf@plt>
jmp    118c <main+0x4c>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xe9f(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xe97(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rax,%rdi
call   1050 <fscanf@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%esi
cmp    $0xffffffff,%eax
jne    119c <main+0x5c>
cmp    $0xffffffff,%esi
je     121a <main+0xda>
lea    0xea0(%rip),%r14
lea    0xe64(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%r13
lea    0xe5b(%rip),%rbp
nopl   0x0(%rax)
sub    %esi,%eax
test   $0x1,%al
jne    11f0 <main+0xb0>
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
add    %edx,%esi
js     11f0 <main+0xb0>
cmp    $0xfffffffe,%eax
jle    11f0 <main+0xb0>
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f8 <main+0xb8>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1050 <fscanf@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%esi
cmp    $0xffffffff,%eax
jne    11c0 <main+0x80>
cmp    $0xffffffff,%esi
jne    11c0 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"jeopardy.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"%d %d\00"
@.str.3 = [23 x i8] c"NOT SO FAST, TREBEKK!\0A\00"
@.str.4 = [47 x i8] c"What are the sum and difference of %d and %d?\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
store i32 0, i32* %2
store i32 0, i32* %3
%7 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %4
%8 = load i32*, i32** %4
%9 = call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %2, i32* %3)
br label %10
10: ; preds = %47, %0
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, -1
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, -1
br label %16
16: ; preds = %13, %10
%17 = phi i1 [ true, %10 ], [ %15, %13 ]
br i1 %17, label %18, label %50
18: ; preds = %16
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = sub nsw i32 %19, %20
%22 = sdiv i32 %21, 2
store i32 %22, i32* %5
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = sub nsw i32 %24, %25
%27 = sdiv i32 %26, 2
%28 = add nsw i32 %23, %27
store i32 %28, i32* %6
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = sub nsw i32 %29, %30
%32 = call i32 @abs(i32 %31)
%33 = srem i32 %32, 2
%34 = icmp eq i32 %33, 1
br i1 %34, label %41, label %35
35: ; preds = %18
%36 = load i32, i32* %6
%37 = icmp slt i32 %36, 0
br i1 %37, label %41, label %38
38: ; preds = %35
%39 = load i32, i32* %5
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38, %35, %18
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %47
43: ; preds = %38
%44 = load i32, i32* %6
%45 = load i32, i32* %5
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i32 %44, i32 %45)
br label %47
47: ; preds = %43, %41
%48 = load i32*, i32** %4
%49 = call i32 @fscanf(i32* %48, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %2, i32* %3)
br label %10
50: ; preds = %16
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
@.str = [12 x i8] c"jeopardy.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"%d %d\00"
@.str.4 = [47 x i8] c"What are the sum and difference of %d and %d?\0A\00"
@str = [22 x i8] c"NOT SO FAST, TREBEKK!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = icmp ne i32 %7, -1
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, -1
%11 = select i1 %8, i1 true, i1 %10
br i1 %11, label %12, label %35
12: ; preds = %0, %28
%13 = phi i32 [ %32, %28 ], [ %9, %0 ]
%14 = phi i32 [ %30, %28 ], [ %7, %0 ]
%15 = sub nsw i32 %14, %13
%16 = sdiv i32 %15, 2
%17 = add nsw i32 %16, %13
%18 = and i32 %15, 1
%19 = icmp ne i32 %18, 0
%20 = icmp slt i32 %17, 0
%21 = select i1 %19, i1 true, i1 %20
%22 = icmp slt i32 %15, -1
%23 = select i1 %21, i1 true, i1 %22
br i1 %23, label %24, label %26
24: ; preds = %12
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %28
26: ; preds = %12
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i32 %17, i32 %16)
br label %28
28: ; preds = %26, %24
%29 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%30 = load i32, i32* %1
%31 = icmp ne i32 %30, -1
%32 = load i32, i32* %2
%33 = icmp ne i32 %32, -1
%34 = select i1 %31, i1 true, i1 %33
br i1 %34, label %12, label %35
35: ; preds = %28, %0
ret i32 0
}