#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*/ fprintf(int /*<<< orphan*/, char *, int, int, int);
int /*<<< orphan*/ stderr;
int check_xyz(int x, int y, int z) {
  int oob, limit;
  oob = (z < 0 || z > 18);
  if (!oob) {
    limit = (1 << z) - 1;
    oob = (x < 0 || x > limit || y < 0 || y > limit);
  }
  if (oob)
    fprintf(stderr, "got bad co-ords: x(%d) y(%d) z(%d)\n", x, y, z);
  return oob;
}


x86 assembly (clang, -O0):
<check_xyz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x15(%rbp)
jl     113a <check_xyz+0x2a>
cmpl   $0x12,-0xc(%rbp)
setg   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11a5 <check_xyz+0x95>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x16(%rbp)
jl     119a <check_xyz+0x8a>
mov    -0x4(%rbp),%ecx
mov    $0x1,%al
cmp    -0x14(%rbp),%ecx
mov    %al,-0x16(%rbp)
jg     119a <check_xyz+0x8a>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x16(%rbp)
jl     119a <check_xyz+0x8a>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
setg   %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11ce <check_xyz+0xbe>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xe37(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_xyz>:
mov    %edx,%r8d
mov    %esi,%r9d
mov    %edi,%edx
cmp    $0x12,%r8d
ja     113f <check_xyz+0x2f>
mov    $0xffffffff,%esi
mov    %r8d,%ecx
shl    %cl,%esi
test   %edx,%edx
js     113f <check_xyz+0x2f>
not    %esi
cmp    %r9d,%esi
jl     113f <check_xyz+0x2f>
test   %r9d,%r9d
js     113f <check_xyz+0x2f>
xor    %eax,%eax
cmp    %edx,%esi
jl     113f <check_xyz+0x2f>
ret
push   %rax
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %r9d,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"got bad co-ords: x(%d) y(%d) z(%d)\0A\00"
define i32 @check_xyz(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = load i32, i32* %6
%13 = icmp sgt i32 %12, 18
br label %14
14: ; preds = %11, %3
%15 = phi i1 [ true, %3 ], [ %13, %11 ]
%16 = zext i1 %15 to i32
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = icmp ne i32 %17, 0
br i1 %18, label %39, label %19
19: ; preds = %14
%20 = load i32, i32* %6
%21 = shl i32 1, %20
%22 = sub nsw i32 %21, 1
store i32 %22, i32* %8
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 0
br i1 %24, label %36, label %25
25: ; preds = %19
%26 = load i32, i32* %4
%27 = load i32, i32* %8
%28 = icmp sgt i32 %26, %27
br i1 %28, label %36, label %29
29: ; preds = %25
%30 = load i32, i32* %5
%31 = icmp slt i32 %30, 0
br i1 %31, label %36, label %32
32: ; preds = %29
%33 = load i32, i32* %5
%34 = load i32, i32* %8
%35 = icmp sgt i32 %33, %34
br label %36
36: ; preds = %32, %29, %25, %19
%37 = phi i1 [ true, %29 ], [ true, %25 ], [ true, %19 ], [ %35, %32 ]
%38 = zext i1 %37 to i32
store i32 %38, i32* %7
br label %39
39: ; preds = %36, %14
%40 = load i32, i32* %7
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %39
%43 = load i32, i32* @stderr
%44 = load i32, i32* %4
%45 = load i32, i32* %5
%46 = load i32, i32* %6
%47 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %44, i32 %45, i32 %46)
br label %48
48: ; preds = %42, %39
%49 = load i32, i32* %7
ret i32 %49
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"got bad co-ords: x(%d) y(%d) z(%d)\0A\00"
define i32 @check_xyz(i32 %0, i32 %1, i32 %2) {
%4 = icmp ugt i32 %2, 18
br i1 %4, label %15, label %5
5: ; preds = %3
%6 = shl nsw i32 -1, %2
%7 = xor i32 %6, -1
%8 = icmp slt i32 %0, 0
br i1 %8, label %15, label %9
9: ; preds = %5
%10 = icmp slt i32 %7, %0
%11 = icmp slt i32 %1, 0
%12 = or i1 %11, %10
%13 = icmp slt i32 %7, %1
%14 = or i1 %13, %12
br i1 %14, label %15, label %18
15: ; preds = %5, %9, %3
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
br label %18
18: ; preds = %9, %15
%19 = phi i32 [ 1, %15 ], [ 0, %9 ]
ret i32 %19
}