#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;
  long limit;
  oob = (z < 0 || z > 40);
  if (!oob) {
    limit = (0x1L << 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,-0x19(%rbp)
jl     113a <check_xyz+0x2a>
cmpl   $0x28,-0xc(%rbp)
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11ae <check_xyz+0x9e>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
sub    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x1a(%rbp)
jl     11a3 <check_xyz+0x93>
movslq -0x4(%rbp),%rcx
mov    $0x1,%al
cmp    -0x18(%rbp),%rcx
mov    %al,-0x1a(%rbp)
jg     11a3 <check_xyz+0x93>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x1a(%rbp)
jl     11a3 <check_xyz+0x93>
movslq -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
setg   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11d7 <check_xyz+0xc7>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xe2e(%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    $0x28,%r8d
ja     1149 <check_xyz+0x39>
mov    $0xffffffffffffffff,%rsi
mov    %r8d,%ecx
shl    %cl,%rsi
test   %edx,%edx
js     1149 <check_xyz+0x39>
not    %rsi
mov    %r9d,%eax
cmp    %rsi,%rax
jg     1149 <check_xyz+0x39>
test   %r9d,%r9d
js     1149 <check_xyz+0x39>
mov    %edx,%ecx
xor    %eax,%eax
cmp    %rsi,%rcx
jg     1149 <check_xyz+0x39>
ret
push   %rax
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%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 i64
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, 40
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 %42, label %19
19: ; preds = %14
%20 = load i32, i32* %6
%21 = zext i32 %20 to i64
%22 = shl i64 1, %21
%23 = sub nsw i64 %22, 1
store i64 %23, i64* %8
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 0
br i1 %25, label %39, label %26
26: ; preds = %19
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = load i64, i64* %8
%30 = icmp sgt i64 %28, %29
br i1 %30, label %39, label %31
31: ; preds = %26
%32 = load i32, i32* %5
%33 = icmp slt i32 %32, 0
br i1 %33, label %39, label %34
34: ; preds = %31
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = load i64, i64* %8
%38 = icmp sgt i64 %36, %37
br label %39
39: ; preds = %34, %31, %26, %19
%40 = phi i1 [ true, %31 ], [ true, %26 ], [ true, %19 ], [ %38, %34 ]
%41 = zext i1 %40 to i32
store i32 %41, i32* %7
br label %42
42: ; preds = %39, %14
%43 = load i32, i32* %7
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %51
45: ; preds = %42
%46 = load i32, i32* @stderr
%47 = load i32, i32* %4
%48 = load i32, i32* %5
%49 = load i32, i32* %6
%50 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %47, i32 %48, i32 %49)
br label %51
51: ; preds = %45, %42
%52 = load i32, i32* %7
ret i32 %52
}

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, 40
br i1 %4, label %18, label %5
5: ; preds = %3
%6 = zext i32 %2 to i64
%7 = shl nsw i64 -1, %6
%8 = xor i64 %7, -1
%9 = icmp slt i32 %0, 0
br i1 %9, label %18, label %10
10: ; preds = %5
%11 = zext i32 %0 to i64
%12 = icmp sgt i64 %11, %8
%13 = icmp slt i32 %1, 0
%14 = or i1 %13, %12
%15 = zext i32 %1 to i64
%16 = icmp sgt i64 %15, %8
%17 = or i1 %16, %14
br i1 %17, label %18, label %21
18: ; preds = %5, %10, %3
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
br label %21
21: ; preds = %10, %18
%22 = phi i32 [ 1, %18 ], [ 0, %10 ]
ret i32 %22
}