#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 */
struct vision {
  int dummy;
};
struct grid {
  int dummy;
};

/* Variables and functions */
scalar_t__ is_within_ij(struct grid *, int, int);
int /*<<< orphan*/ vmark(struct vision *, int, int, int, int);
void vmark_safe(struct grid *g, struct vision *v, int i, int j, int k,
                int value) {
  if (is_within_ij(g, i, j) && k >= 0 && k < 8) {
    vmark(v, i, j, k, value);
  }
}


x86 assembly (clang, -O0):
<vmark_safe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <is_within_ij@plt>
cmp    $0x0,%rax
je     1181 <vmark_safe+0x61>
cmpl   $0x0,-0x1c(%rbp)
jl     1181 <vmark_safe+0x61>
cmpl   $0x8,-0x1c(%rbp)
jge    1181 <vmark_safe+0x61>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1040 <vmark@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vmark_safe>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %ecx,%ebx
mov    %edx,%ebp
mov    %rsi,%r12
mov    %edx,%esi
mov    %ecx,%edx
call   1030 <is_within_ij@plt>
cmp    $0x7,%r15d
ja     1163 <vmark_safe+0x43>
test   %rax,%rax
je     1163 <vmark_safe+0x43>
mov    %r12,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <vmark@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.grid = type { i32 }
%struct.vision = type { i32 }
define void @vmark_safe(%struct.grid* %0, %struct.vision* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca %struct.grid*
%8 = alloca %struct.vision*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store %struct.grid* %0, %struct.grid** %7
store %struct.vision* %1, %struct.vision** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load %struct.grid*, %struct.grid** %7
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i64 @is_within_ij(%struct.grid* %13, i32 %14, i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %31
18: ; preds = %6
%19 = load i32, i32* %11
%20 = icmp sge i32 %19, 0
br i1 %20, label %21, label %31
21: ; preds = %18
%22 = load i32, i32* %11
%23 = icmp slt i32 %22, 8
br i1 %23, label %24, label %31
24: ; preds = %21
%25 = load %struct.vision*, %struct.vision** %8
%26 = load i32, i32* %9
%27 = load i32, i32* %10
%28 = load i32, i32* %11
%29 = load i32, i32* %12
%30 = call i32 @vmark(%struct.vision* %25, i32 %26, i32 %27, i32 %28, i32 %29)
br label %31
31: ; preds = %24, %21, %18, %6
ret void
}

LLVM IR (-O2):
%struct.grid = type { i32 }
%struct.vision = type { i32 }
define void @vmark_safe(%struct.grid* %0, %struct.vision* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i64 @is_within_ij(%struct.grid* %0, i32 %2, i32 %3)
%8 = icmp ne i64 %7, 0
%9 = icmp ult i32 %4, 8
%10 = and i1 %9, %8
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @vmark(%struct.vision* %1, i32 %2, i32 %3, i32 %4, i32 %5)
br label %13
13: ; preds = %11, %6
ret void
}