#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 check_input(int x, int y, int start_x, int start_y) {
  if (start_x >= x || start_x < 0 || start_y >= y || start_y < 0) {
    printf("Starting position is out of range.\n");
    return (1);
  }
  if (x > 20 || y > 20) {
    printf("Size can't go above 20");
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<check_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1150 <check_input+0x40>
cmpl   $0x0,-0x10(%rbp)
jl     1150 <check_input+0x40>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1150 <check_input+0x40>
cmpl   $0x0,-0x14(%rbp)
jge    1168 <check_input+0x58>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    119b <check_input+0x8b>
cmpl   $0x14,-0x8(%rbp)
jg     117c <check_input+0x6c>
cmpl   $0x14,-0xc(%rbp)
jle    1194 <check_input+0x84>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    119b <check_input+0x8b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_input>:
push   %rax
cmp    %edi,%edx
jge    113f <check_input+0x1f>
test   %edx,%edx
js     113f <check_input+0x1f>
cmp    %esi,%ecx
jge    113f <check_input+0x1f>
test   %ecx,%ecx
js     113f <check_input+0x1f>
cmp    $0x14,%edi
jg     1152 <check_input+0x32>
xor    %eax,%eax
cmp    $0x15,%esi
jge    1152 <check_input+0x32>
pop    %rcx
ret
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
jmp    114b <check_input+0x2b>

LLVM IR (-O0):
@.str = [36 x i8] c"Starting position is out of range.\0A\00"
@.str.1 = [23 x i8] c"Size can't go above 20\00"
define i32 @check_input(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load i32, i32* %8
%11 = load i32, i32* %6
%12 = icmp sge i32 %10, %11
br i1 %12, label %23, label %13
13: ; preds = %4
%14 = load i32, i32* %8
%15 = icmp slt i32 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %13
%17 = load i32, i32* %9
%18 = load i32, i32* %7
%19 = icmp sge i32 %17, %18
br i1 %19, label %23, label %20
20: ; preds = %16
%21 = load i32, i32* %9
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20, %16, %13, %4
%24 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %5
br label %34
25: ; preds = %20
%26 = load i32, i32* %6
%27 = icmp sgt i32 %26, 20
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = load i32, i32* %7
%30 = icmp sgt i32 %29, 20
br i1 %30, label %31, label %33
31: ; preds = %28, %25
%32 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %5
br label %34
33: ; preds = %28
store i32 0, i32* %5
br label %34
34: ; preds = %33, %31, %23
%35 = load i32, i32* %5
ret i32 %35
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"Size can't go above 20\00"
@str = [35 x i8] c"Starting position is out of range.\00"
define i32 @check_input(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sge i32 %2, %0
%6 = icmp slt i32 %2, 0
%7 = or i1 %5, %6
br i1 %7, label %12, label %8
8: ; preds = %4
%9 = icmp sge i32 %3, %1
%10 = icmp slt i32 %3, 0
%11 = or i1 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %8, %4
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %20
14: ; preds = %8
%15 = icmp sgt i32 %0, 20
%16 = icmp sgt i32 %1, 20
%17 = or i1 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %14, %18, %12
%21 = phi i32 [ 1, %12 ], [ 1, %18 ], [ 0, %14 ]
ret i32 %21
}