#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, ...);
void check_vertex(int vertex, int vertex_count, int graph_num) {
  int max = vertex_count - 1;
  if (vertex < 0 || vertex > max) {
    printf("*** Error- invalid graph, value %5d is not in the range [0, %5d]\n",
           vertex, vertex_count - 1);
    printf("Graph   %5d: BAD GRAPH\n", graph_num);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<check_vertex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1150 <check_vertex+0x30>
mov    -0x4(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1186 <check_vertex+0x66>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_vertex>:
push   %rbx
mov    %edx,%ebx
mov    %esi,%edx
mov    %edi,%esi
test   %edi,%edi
js     1131 <check_vertex+0x11>
cmp    %esi,%edx
jle    1131 <check_vertex+0x11>
pop    %rbx
ret
add    $0xffffffff,%edx
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef9(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [66 x i8] c"*** Error- invalid graph, value %5d is not in the range [0, %5d]\0A\00"
@.str.1 = [24 x i8] c"Graph %5d: BAD GRAPH\0A\00"
@EXIT_FAILURE = global i32 0
define void @check_vertex(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %7
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %3
%13 = load i32, i32* %4
%14 = load i32, i32* %7
%15 = icmp sgt i32 %13, %14
br i1 %15, label %16, label %25
16: ; preds = %12, %3
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = sub nsw i32 %18, 1
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %19)
%21 = load i32, i32* %6
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [66 x i8] c"*** Error- invalid graph, value %5d is not in the range [0, %5d]\0A\00"
@.str.1 = [24 x i8] c"Graph %5d: BAD GRAPH\0A\00"
@EXIT_FAILURE = global i32 0
define void @check_vertex(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, -1
%5 = icmp sgt i32 %1, %0
%6 = and i1 %4, %5
br i1 %6, label %13, label %7
7: ; preds = %3
%8 = add nsw i32 %1, -1
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %8)
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %3
ret void
}