#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*/ error(char *);
int in_image(int x, int y, unsigned int xsize, unsigned int ysize) {
  if ((xsize <= 0) || (ysize <= 0))
    error("in_image: invalid input image dimension.");
  if ((x >= 0) && (x < (int)xsize) && (y >= 0) && (y < (int)ysize))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<in_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
jbe    1138 <in_image+0x28>
cmpl   $0x0,-0x14(%rbp)
ja     1144 <in_image+0x34>
lea    0xec1(%rip),%rdi
call   1030 <error@plt>
cmpl   $0x0,-0x8(%rbp)
jl     117c <in_image+0x6c>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    117c <in_image+0x6c>
cmpl   $0x0,-0xc(%rbp)
jl     117c <in_image+0x6c>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    117c <in_image+0x6c>
movl   $0x1,-0x4(%rbp)
jmp    1183 <in_image+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_image>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%ebp
mov    %esi,%r14d
mov    %edi,%ebx
test   %edx,%edx
je     1130 <in_image+0x20>
test   %r15d,%r15d
je     1130 <in_image+0x20>
test   %ebx,%ebx
jns    1140 <in_image+0x30>
jmp    1153 <in_image+0x43>
lea    0xec9(%rip),%rdi
call   1030 <error@plt>
test   %ebx,%ebx
js     1153 <in_image+0x43>
test   %r14d,%r14d
js     1153 <in_image+0x43>
cmp    %ebp,%ebx
jge    1153 <in_image+0x43>
mov    $0x1,%eax
cmp    %r15d,%r14d
jl     1155 <in_image+0x45>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"in_image: invalid input image dimension.\00"
define i32 @in_image(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 = icmp ule i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %4
%13 = load i32, i32* %9
%14 = icmp ule i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12, %4
%16 = call i32 @error(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = load i32, i32* %6
%19 = icmp sge i32 %18, 0
br i1 %19, label %20, label %32
20: ; preds = %17
%21 = load i32, i32* %6
%22 = load i32, i32* %8
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %32
24: ; preds = %20
%25 = load i32, i32* %7
%26 = icmp sge i32 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %24
%28 = load i32, i32* %7
%29 = load i32, i32* %9
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %27
store i32 1, i32* %5
br label %33
32: ; preds = %27, %24, %20, %17
store i32 0, i32* %5
br label %33
33: ; preds = %32, %31
%34 = load i32, i32* %5
ret i32 %34
}

LLVM IR (-O2):
@.str = [41 x i8] c"in_image: invalid input image dimension.\00"
define i32 @in_image(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %2, 0
%6 = icmp eq i32 %3, 0
%7 = or i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @error(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %4, %8
%11 = icmp sgt i32 %0, -1
br i1 %11, label %12, label %18
12: ; preds = %10
%13 = icmp slt i32 %0, %2
%14 = icmp sgt i32 %1, -1
%15 = and i1 %14, %13
%16 = icmp slt i32 %1, %3
%17 = and i1 %15, %16
br i1 %17, label %19, label %18
18: ; preds = %12, %10
br label %19
19: ; preds = %12, %18
%20 = phi i32 [ 0, %18 ], [ 1, %12 ]
ret i32 %20
}