#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 */
unsigned short ***kv6_points();
long kv6_xsiz();
long kv6_ysiz();
long kv6_zsiz();
int point_needs_block(long x, long y, long z) {
  if (x >= kv6_xsiz() || x < 0)
    return 0;
  if (y >= kv6_ysiz() || y < 0)
    return 0;
  if (z >= kv6_zsiz() || z < 0)
    return 0;
  unsigned short ***points = kv6_points();
  if (points[x][y][z] == 1)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<point_needs_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1050 <kv6_xsiz@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jge    117e <point_needs_block+0x3e>
cmpq   $0x0,-0x10(%rbp)
jge    118a <point_needs_block+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1239 <point_needs_block+0xf9>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1040 <kv6_ysiz@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
jge    11b4 <point_needs_block+0x74>
cmpq   $0x0,-0x18(%rbp)
jge    11c0 <point_needs_block+0x80>
movl   $0x0,-0x4(%rbp)
jmp    1239 <point_needs_block+0xf9>
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   1030 <kv6_zsiz@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
cmp    %rcx,%rax
jge    11ea <point_needs_block+0xaa>
cmpq   $0x0,-0x20(%rbp)
jge    11f6 <point_needs_block+0xb6>
movl   $0x0,-0x4(%rbp)
jmp    1239 <point_needs_block+0xf9>
mov    $0x0,%al
call   1060 <kv6_points@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%rcx
movzwl (%rax,%rcx,2),%eax
cmp    $0x1,%eax
jne    1232 <point_needs_block+0xf2>
movl   $0x1,-0x4(%rbp)
jmp    1239 <point_needs_block+0xf9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<point_needs_block>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <kv6_xsiz@plt>
test   %rbx,%rbx
js     11a4 <point_needs_block+0x64>
cmp    %rbx,%rax
jle    11a4 <point_needs_block+0x64>
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <kv6_ysiz@plt>
test   %r15,%r15
js     11a4 <point_needs_block+0x64>
cmp    %r15,%rax
jle    11a4 <point_needs_block+0x64>
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <kv6_zsiz@plt>
test   %r14,%r14
js     11a4 <point_needs_block+0x64>
cmp    %r14,%rax
jle    11a4 <point_needs_block+0x64>
xor    %eax,%eax
call   1060 <kv6_points@plt>
mov    (%rax,%rbx,8),%rax
mov    (%rax,%r15,8),%rax
xor    %ebp,%ebp
cmpw   $0x1,(%rax,%r14,2)
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @point_needs_block(i64 %0, i64 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i16***
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%9 = load i64, i64* %5
%10 = call i64 (...) @kv6_xsiz()
%11 = icmp sge i64 %9, %10
br i1 %11, label %15, label %12
12: ; preds = %3
%13 = load i64, i64* %5
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12, %3
store i32 0, i32* %4
br label %48
16: ; preds = %12
%17 = load i64, i64* %6
%18 = call i64 (...) @kv6_ysiz()
%19 = icmp sge i64 %17, %18
br i1 %19, label %23, label %20
20: ; preds = %16
%21 = load i64, i64* %6
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20, %16
store i32 0, i32* %4
br label %48
24: ; preds = %20
%25 = load i64, i64* %7
%26 = call i64 (...) @kv6_zsiz()
%27 = icmp sge i64 %25, %26
br i1 %27, label %31, label %28
28: ; preds = %24
%29 = load i64, i64* %7
%30 = icmp slt i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %28, %24
store i32 0, i32* %4
br label %48
32: ; preds = %28
%33 = call i16*** (...) @kv6_points()
store i16*** %33, i16**** %8
%34 = load i16***, i16**** %8
%35 = load i64, i64* %5
%36 = getelementptr inbounds i16**, i16*** %34, i64 %35
%37 = load i16**, i16*** %36
%38 = load i64, i64* %6
%39 = getelementptr inbounds i16*, i16** %37, i64 %38
%40 = load i16*, i16** %39
%41 = load i64, i64* %7
%42 = getelementptr inbounds i16, i16* %40, i64 %41
%43 = load i16, i16* %42
%44 = zext i16 %43 to i32
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %47
46: ; preds = %32
store i32 1, i32* %4
br label %48
47: ; preds = %32
store i32 0, i32* %4
br label %48
48: ; preds = %47, %46, %31, %23, %15
%49 = load i32, i32* %4
ret i32 %49
}

LLVM IR (-O2):
define i32 @point_needs_block(i64 %0, i64 %1, i64 %2) {
%4 = tail call i64 (...) @kv6_xsiz()
%5 = icmp sle i64 %4, %0
%6 = icmp slt i64 %0, 0
%7 = or i1 %6, %5
br i1 %7, label %28, label %8
8: ; preds = %3
%9 = tail call i64 (...) @kv6_ysiz()
%10 = icmp sle i64 %9, %1
%11 = icmp slt i64 %1, 0
%12 = or i1 %11, %10
br i1 %12, label %28, label %13
13: ; preds = %8
%14 = tail call i64 (...) @kv6_zsiz()
%15 = icmp sle i64 %14, %2
%16 = icmp slt i64 %2, 0
%17 = or i1 %16, %15
br i1 %17, label %28, label %18
18: ; preds = %13
%19 = tail call i16*** (...) @kv6_points()
%20 = getelementptr inbounds i16**, i16*** %19, i64 %0
%21 = load i16**, i16*** %20
%22 = getelementptr inbounds i16*, i16** %21, i64 %1
%23 = load i16*, i16** %22
%24 = getelementptr inbounds i16, i16* %23, i64 %2
%25 = load i16, i16* %24
%26 = icmp eq i16 %25, 1
%27 = zext i1 %26 to i32
br label %28
28: ; preds = %13, %8, %3, %18
%29 = phi i32 [ %27, %18 ], [ 0, %3 ], [ 0, %8 ], [ 0, %13 ]
ret i32 %29
}