#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 */
typedef scalar_t__ cl_int;

/* Variables and functions */
scalar_t__ CL_INVALID_COMMAND_QUEUE;
scalar_t__ CL_INVALID_CONTEXT;
scalar_t__ CL_INVALID_EVENT_WAIT_LIST;
scalar_t__ CL_INVALID_MEM_OBJECT;
scalar_t__ CL_INVALID_VALUE;
scalar_t__ CL_MEM_OBJECT_ALLOCATION_FAILURE;
scalar_t__ CL_OUT_OF_HOST_MEMORY;
scalar_t__ CL_OUT_OF_RESOURCES;
scalar_t__ CL_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void clEnqueueReadBufferChecker(cl_int *err) {
  if (*err == CL_INVALID_COMMAND_QUEUE)
    fprintf(stderr, "Err (EnqueueReadBuffer): The command queue is invalid\n");
  else if (*err == CL_INVALID_CONTEXT)
    fprintf(stderr, "Err (EnqueueReadBuffer): The context associated with "
                    "command queue and buffer are not the same\n");
  else if (*err == CL_INVALID_MEM_OBJECT)
    fprintf(stderr,
            "Err (EnqueueReadBuffer): Buffer is not a valid buffer object\n");
  else if (*err == CL_INVALID_VALUE)
    fprintf(stderr, "Err (EnqueueReadBuffer): The region being written is out "
                    "of bounds or pointer is of NULL value\n");
  else if (*err == CL_INVALID_EVENT_WAIT_LIST)
    fprintf(stderr,
            "Err (EnqueueReadBuffer): Something wrong with theh wait list\n");
  else if (*err == CL_MEM_OBJECT_ALLOCATION_FAILURE)
    fprintf(stderr,
            "Err (EnqueueReadBuffer): Failure to alllocate memory buffer\n");
  else if (*err == CL_OUT_OF_HOST_MEMORY)
    fprintf(stderr, "Err (EnqueueReadBuffer): Failure to allocate resources\n");
  else {
    if (*err != CL_SUCCESS)
      fprintf(stderr, "clEnqueueReadBufferChecker (%d, %d)\n", (int)*err,
              (int)CL_OUT_OF_RESOURCES);
  }
}


x86 assembly (clang, -O0):
<clEnqueueReadBufferChecker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2ebe(%rip),%rcx
cmp    (%rcx),%rax
jne    114f <clEnqueueReadBufferChecker+0x3f>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12e7 <clEnqueueReadBufferChecker+0x1d7>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%rax
jne    1182 <clEnqueueReadBufferChecker+0x72>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12e2 <clEnqueueReadBufferChecker+0x1d2>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e18(%rip),%rcx
cmp    (%rcx),%rax
jne    11b5 <clEnqueueReadBufferChecker+0xa5>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
lea    0xeee(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12dd <clEnqueueReadBufferChecker+0x1cd>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e1d(%rip),%rcx
cmp    (%rcx),%rax
jne    11e8 <clEnqueueReadBufferChecker+0xd8>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
lea    0xef9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12d8 <clEnqueueReadBufferChecker+0x1c8>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2dd2(%rip),%rcx
cmp    (%rcx),%rax
jne    121b <clEnqueueReadBufferChecker+0x10b>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
lea    0xf26(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12d3 <clEnqueueReadBufferChecker+0x1c3>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2d67(%rip),%rcx
cmp    (%rcx),%rax
jne    124e <clEnqueueReadBufferChecker+0x13e>
mov    0x2d77(%rip),%rax
mov    (%rax),%edi
lea    0xf31(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12ce <clEnqueueReadBufferChecker+0x1be>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2d5c(%rip),%rcx
cmp    (%rcx),%rax
jne    1281 <clEnqueueReadBufferChecker+0x171>
mov    0x2d44(%rip),%rax
mov    (%rax),%edi
lea    0xf3b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12c9 <clEnqueueReadBufferChecker+0x1b9>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2d11(%rip),%rcx
cmp    (%rcx),%rax
je     12c4 <clEnqueueReadBufferChecker+0x1b4>
mov    0x2d11(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %eax,%edx
mov    0x2d27(%rip),%rax
mov    (%rax),%rax
mov    %eax,%ecx
lea    0xf2b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12c9 <clEnqueueReadBufferChecker+0x1b9>
jmp    12ce <clEnqueueReadBufferChecker+0x1be>
jmp    12d3 <clEnqueueReadBufferChecker+0x1c3>
jmp    12d8 <clEnqueueReadBufferChecker+0x1c8>
jmp    12dd <clEnqueueReadBufferChecker+0x1cd>
jmp    12e2 <clEnqueueReadBufferChecker+0x1d2>
jmp    12e7 <clEnqueueReadBufferChecker+0x1d7>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clEnqueueReadBufferChecker>:
mov    (%rdi),%rdx
mov    0x2ece(%rip),%rax
cmp    (%rax),%rdx
jne    1136 <clEnqueueReadBufferChecker+0x26>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>
mov    0x2e93(%rip),%rax
cmp    (%rax),%rdx
jne    1159 <clEnqueueReadBufferChecker+0x49>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    0xee5(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>
mov    0x2e48(%rip),%rax
cmp    (%rax),%rdx
jne    117c <clEnqueueReadBufferChecker+0x6c>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xf22(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>
mov    0x2e5d(%rip),%rax
cmp    (%rax),%rdx
jne    119f <clEnqueueReadBufferChecker+0x8f>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
lea    0xf3d(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>
mov    0x2e22(%rip),%rax
cmp    (%rax),%rdx
jne    11c2 <clEnqueueReadBufferChecker+0xb2>
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
lea    0xf7a(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>
mov    0x2dc7(%rip),%rax
cmp    (%rax),%rdx
jne    11e5 <clEnqueueReadBufferChecker+0xd5>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
lea    0xf95(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>
mov    0x2dcc(%rip),%rax
cmp    (%rax),%rdx
jne    1208 <clEnqueueReadBufferChecker+0xf8>
mov    0x2db8(%rip),%rax
mov    (%rax),%edi
lea    0xfaf(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>
mov    0x2d91(%rip),%rax
cmp    (%rax),%rdx
jne    1215 <clEnqueueReadBufferChecker+0x105>
ret
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
mov    0x2db3(%rip),%rax
mov    (%rax),%ecx
lea    0xfba(%rip),%rsi
xor    %eax,%eax
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@CL_INVALID_COMMAND_QUEUE = global i64 0
@stderr = global i32 0
@.str = [55 x i8] c"Err (EnqueueReadBuffer): The command queue is invalid\0A\00"
@CL_INVALID_CONTEXT = global i64 0
@.str.1 = [96 x i8] c"Err (EnqueueReadBuffer): The context associated with command queue and buffer are not the same\0A\00"
@CL_INVALID_MEM_OBJECT = global i64 0
@.str.2 = [62 x i8] c"Err (EnqueueReadBuffer): Buffer is not a valid buffer object\0A\00"
@CL_INVALID_VALUE = global i64 0
@.str.3 = [96 x i8] c"Err (EnqueueReadBuffer): The region being written is out of bounds or pointer is of NULL value\0A\00"
@CL_INVALID_EVENT_WAIT_LIST = global i64 0
@.str.4 = [62 x i8] c"Err (EnqueueReadBuffer): Something wrong with theh wait list\0A\00"
@CL_MEM_OBJECT_ALLOCATION_FAILURE = global i64 0
@.str.5 = [61 x i8] c"Err (EnqueueReadBuffer): Failure to alllocate memory buffer\0A\00"
@CL_OUT_OF_HOST_MEMORY = global i64 0
@.str.6 = [56 x i8] c"Err (EnqueueReadBuffer): Failure to allocate resources\0A\00"
@CL_SUCCESS = global i64 0
@.str.7 = [37 x i8] c"clEnqueueReadBufferChecker (%d, %d)\0A\00"
@CL_OUT_OF_RESOURCES = global i64 0
define void @clEnqueueReadBufferChecker(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = load i64, i64* @CL_INVALID_COMMAND_QUEUE
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %78
10: ; preds = %1
%11 = load i64*, i64** %2
%12 = load i64, i64* %11
%13 = load i64, i64* @CL_INVALID_CONTEXT
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str.1, i64 0, i64 0))
br label %77
18: ; preds = %10
%19 = load i64*, i64** %2
%20 = load i64, i64* %19
%21 = load i64, i64* @CL_INVALID_MEM_OBJECT
%22 = icmp eq i64 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
br label %76
26: ; preds = %18
%27 = load i64*, i64** %2
%28 = load i64, i64* %27
%29 = load i64, i64* @CL_INVALID_VALUE
%30 = icmp eq i64 %28, %29
br i1 %30, label %31, label %34
31: ; preds = %26
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str.3, i64 0, i64 0))
br label %75
34: ; preds = %26
%35 = load i64*, i64** %2
%36 = load i64, i64* %35
%37 = load i64, i64* @CL_INVALID_EVENT_WAIT_LIST
%38 = icmp eq i64 %36, %37
br i1 %38, label %39, label %42
39: ; preds = %34
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0))
br label %74
42: ; preds = %34
%43 = load i64*, i64** %2
%44 = load i64, i64* %43
%45 = load i64, i64* @CL_MEM_OBJECT_ALLOCATION_FAILURE
%46 = icmp eq i64 %44, %45
br i1 %46, label %47, label %50
47: ; preds = %42
%48 = load i32, i32* @stderr
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0))
br label %73
50: ; preds = %42
%51 = load i64*, i64** %2
%52 = load i64, i64* %51
%53 = load i64, i64* @CL_OUT_OF_HOST_MEMORY
%54 = icmp eq i64 %52, %53
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = load i32, i32* @stderr
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
br label %72
58: ; preds = %50
%59 = load i64*, i64** %2
%60 = load i64, i64* %59
%61 = load i64, i64* @CL_SUCCESS
%62 = icmp ne i64 %60, %61
br i1 %62, label %63, label %71
63: ; preds = %58
%64 = load i32, i32* @stderr
%65 = load i64*, i64** %2
%66 = load i64, i64* %65
%67 = trunc i64 %66 to i32
%68 = load i64, i64* @CL_OUT_OF_RESOURCES
%69 = trunc i64 %68 to i32
%70 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i32 %67, i32 %69)
br label %71
71: ; preds = %63, %58
br label %72
72: ; preds = %71, %55
br label %73
73: ; preds = %72, %47
br label %74
74: ; preds = %73, %39
br label %75
75: ; preds = %74, %31
br label %76
76: ; preds = %75, %23
br label %77
77: ; preds = %76, %15
br label %78
78: ; preds = %77, %7
ret void
}

LLVM IR (-O2):
@CL_INVALID_COMMAND_QUEUE = global i64 0
@stderr = global i32 0
@.str = [55 x i8] c"Err (EnqueueReadBuffer): The command queue is invalid\0A\00"
@CL_INVALID_CONTEXT = global i64 0
@.str.1 = [96 x i8] c"Err (EnqueueReadBuffer): The context associated with command queue and buffer are not the same\0A\00"
@CL_INVALID_MEM_OBJECT = global i64 0
@.str.2 = [62 x i8] c"Err (EnqueueReadBuffer): Buffer is not a valid buffer object\0A\00"
@CL_INVALID_VALUE = global i64 0
@.str.3 = [96 x i8] c"Err (EnqueueReadBuffer): The region being written is out of bounds or pointer is of NULL value\0A\00"
@CL_INVALID_EVENT_WAIT_LIST = global i64 0
@.str.4 = [62 x i8] c"Err (EnqueueReadBuffer): Something wrong with theh wait list\0A\00"
@CL_MEM_OBJECT_ALLOCATION_FAILURE = global i64 0
@.str.5 = [61 x i8] c"Err (EnqueueReadBuffer): Failure to alllocate memory buffer\0A\00"
@CL_OUT_OF_HOST_MEMORY = global i64 0
@.str.6 = [56 x i8] c"Err (EnqueueReadBuffer): Failure to allocate resources\0A\00"
@CL_SUCCESS = global i64 0
@.str.7 = [37 x i8] c"clEnqueueReadBufferChecker (%d, %d)\0A\00"
@CL_OUT_OF_RESOURCES = global i64 0
define void @clEnqueueReadBufferChecker(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = load i64, i64* @CL_INVALID_COMMAND_QUEUE
%4 = icmp eq i64 %2, %3
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %53
8: ; preds = %1
%9 = load i64, i64* @CL_INVALID_CONTEXT
%10 = icmp eq i64 %2, %9
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str.1, i64 0, i64 0))
br label %53
14: ; preds = %8
%15 = load i64, i64* @CL_INVALID_MEM_OBJECT
%16 = icmp eq i64 %2, %15
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
br label %53
20: ; preds = %14
%21 = load i64, i64* @CL_INVALID_VALUE
%22 = icmp eq i64 %2, %21
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str.3, i64 0, i64 0))
br label %53
26: ; preds = %20
%27 = load i64, i64* @CL_INVALID_EVENT_WAIT_LIST
%28 = icmp eq i64 %2, %27
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0))
br label %53
32: ; preds = %26
%33 = load i64, i64* @CL_MEM_OBJECT_ALLOCATION_FAILURE
%34 = icmp eq i64 %2, %33
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* @stderr
%37 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0))
br label %53
38: ; preds = %32
%39 = load i64, i64* @CL_OUT_OF_HOST_MEMORY
%40 = icmp eq i64 %2, %39
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* @stderr
%43 = tail call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
br label %53
44: ; preds = %38
%45 = load i64, i64* @CL_SUCCESS
%46 = icmp eq i64 %2, %45
br i1 %46, label %53, label %47
47: ; preds = %44
%48 = load i32, i32* @stderr
%49 = trunc i64 %2 to i32
%50 = load i64, i64* @CL_OUT_OF_RESOURCES
%51 = trunc i64 %50 to i32
%52 = tail call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i32 %49, i32 %51)
br label %53
53: ; preds = %11, %23, %35, %44, %47, %41, %29, %17, %5
ret void
}