#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_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void clEnqueueWriteBufferChecker(cl_int *err) {
  if (*err == CL_INVALID_MEM_OBJECT)
    fprintf(stderr,
            "Err (clEnqueueWriteBuffer): buffer is not valid buffer object\n");
  else if (*err == CL_INVALID_VALUE)
    fprintf(
        stderr,
        "Err (clEnqueueWriteBuffer): region is out of bounds or ptr is NULL\n");
  else if (*err == CL_INVALID_EVENT_WAIT_LIST)
    fprintf(stderr,
            "Err (clEnqueueWriteBuffer): Events are not valid events\n");
  else if (*err == CL_OUT_OF_HOST_MEMORY)
    fprintf(stderr, "Err (clEnqueueWriteBuffer): Failure to allocate resources "
                    "at runtime\n");
  else if (*err == CL_INVALID_COMMAND_QUEUE)
    fprintf(stderr, "Err (clEnqueueWriteBuffer): Command Queue not valid\n");
  else if (*err == CL_INVALID_CONTEXT)
    fprintf(stderr,
            "Err (clEnqueueWriteBuffer): Context is not correct. Check it\n");
  else if (*err == CL_MEM_OBJECT_ALLOCATION_FAILURE)
    fprintf(
        stderr,
        "Err (clEnqueueWriteBuffer): Failure to allocate memory for buffer\n");
  else {
    if (*err != CL_SUCCESS)
      fprintf(stderr, "clEnqueueWriteBufferChecker\n");
  }
}


x86 assembly (clang, -O0):
<clEnqueueWriteBufferChecker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e86(%rip),%rcx
cmp    (%rcx),%rax
jne    114d <clEnqueueWriteBufferChecker+0x3d>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12c2 <clEnqueueWriteBufferChecker+0x1b2>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%rax
jne    117e <clEnqueueWriteBufferChecker+0x6e>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xecb(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12bd <clEnqueueWriteBufferChecker+0x1ad>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e44(%rip),%rcx
cmp    (%rcx),%rax
jne    11af <clEnqueueWriteBufferChecker+0x9f>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12b8 <clEnqueueWriteBufferChecker+0x1a8>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e03(%rip),%rcx
cmp    (%rcx),%rax
jne    11e0 <clEnqueueWriteBufferChecker+0xd0>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
lea    0xee6(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12b3 <clEnqueueWriteBufferChecker+0x1a3>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2dfa(%rip),%rcx
cmp    (%rcx),%rax
jne    1211 <clEnqueueWriteBufferChecker+0x101>
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
lea    0xefb(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12ae <clEnqueueWriteBufferChecker+0x19e>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2db9(%rip),%rcx
cmp    (%rcx),%rax
jne    1242 <clEnqueueWriteBufferChecker+0x132>
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
lea    0xeff(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a9 <clEnqueueWriteBufferChecker+0x199>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2d48(%rip),%rcx
cmp    (%rcx),%rax
jne    1273 <clEnqueueWriteBufferChecker+0x163>
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
lea    0xf0c(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a4 <clEnqueueWriteBufferChecker+0x194>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2d27(%rip),%rcx
cmp    (%rcx),%rax
je     129f <clEnqueueWriteBufferChecker+0x18f>
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
lea    0xf1e(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a4 <clEnqueueWriteBufferChecker+0x194>
jmp    12a9 <clEnqueueWriteBufferChecker+0x199>
jmp    12ae <clEnqueueWriteBufferChecker+0x19e>
jmp    12b3 <clEnqueueWriteBufferChecker+0x1a3>
jmp    12b8 <clEnqueueWriteBufferChecker+0x1a8>
jmp    12bd <clEnqueueWriteBufferChecker+0x1ad>
jmp    12c2 <clEnqueueWriteBufferChecker+0x1b2>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clEnqueueWriteBufferChecker>:
mov    (%rdi),%rax
mov    0x2e96(%rip),%rcx
cmp    (%rcx),%rax
jne    112b <clEnqueueWriteBufferChecker+0x1b>
lea    0xeda(%rip),%rsi
jmp    11bd <clEnqueueWriteBufferChecker+0xad>
mov    0x2eae(%rip),%rcx
cmp    (%rcx),%rax
jne    1140 <clEnqueueWriteBufferChecker+0x30>
lea    0xf01(%rip),%rsi
jmp    11bd <clEnqueueWriteBufferChecker+0xad>
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%rax
jne    1155 <clEnqueueWriteBufferChecker+0x45>
lea    0xf30(%rip),%rsi
jmp    11bd <clEnqueueWriteBufferChecker+0xad>
mov    0x2e64(%rip),%rcx
cmp    (%rcx),%rax
jne    116a <clEnqueueWriteBufferChecker+0x5a>
lea    0xf54(%rip),%rsi
jmp    11bd <clEnqueueWriteBufferChecker+0xad>
mov    0x2e77(%rip),%rcx
cmp    (%rcx),%rax
jne    117f <clEnqueueWriteBufferChecker+0x6f>
lea    0xf85(%rip),%rsi
jmp    11bd <clEnqueueWriteBufferChecker+0xad>
mov    0x2e52(%rip),%rcx
cmp    (%rcx),%rax
jne    1194 <clEnqueueWriteBufferChecker+0x84>
lea    0xfa5(%rip),%rsi
jmp    11bd <clEnqueueWriteBufferChecker+0xad>
mov    0x2dfd(%rip),%rcx
cmp    (%rcx),%rax
jne    11a9 <clEnqueueWriteBufferChecker+0x99>
lea    0xfce(%rip),%rsi
jmp    11bd <clEnqueueWriteBufferChecker+0xad>
mov    0x2df8(%rip),%rcx
cmp    (%rcx),%rax
jne    11b6 <clEnqueueWriteBufferChecker+0xa6>
ret
lea    0xffb(%rip),%rsi
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@CL_INVALID_MEM_OBJECT = global i64 0
@stderr = global i32 0
@.str = [63 x i8] c"Err (clEnqueueWriteBuffer): buffer is not valid buffer object\0A\00"
@CL_INVALID_VALUE = global i64 0
@.str.1 = [68 x i8] c"Err (clEnqueueWriteBuffer): region is out of bounds or ptr is NULL\0A\00"
@CL_INVALID_EVENT_WAIT_LIST = global i64 0
@.str.2 = [57 x i8] c"Err (clEnqueueWriteBuffer): Events are not valid events\0A\00"
@CL_OUT_OF_HOST_MEMORY = global i64 0
@.str.3 = [70 x i8] c"Err (clEnqueueWriteBuffer): Failure to allocate resources at runtime\0A\00"
@CL_INVALID_COMMAND_QUEUE = global i64 0
@.str.4 = [53 x i8] c"Err (clEnqueueWriteBuffer): Command Queue not valid\0A\00"
@CL_INVALID_CONTEXT = global i64 0
@.str.5 = [62 x i8] c"Err (clEnqueueWriteBuffer): Context is not correct. Check it\0A\00"
@CL_MEM_OBJECT_ALLOCATION_FAILURE = global i64 0
@.str.6 = [67 x i8] c"Err (clEnqueueWriteBuffer): Failure to allocate memory for buffer\0A\00"
@CL_SUCCESS = global i64 0
@.str.7 = [29 x i8] c"clEnqueueWriteBufferChecker\0A\00"
define void @clEnqueueWriteBufferChecker(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_MEM_OBJECT
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
br label %73
10: ; preds = %1
%11 = load i64*, i64** %2
%12 = load i64, i64* %11
%13 = load i64, i64* @CL_INVALID_VALUE
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0))
br label %72
18: ; preds = %10
%19 = load i64*, i64** %2
%20 = load i64, i64* %19
%21 = load i64, i64* @CL_INVALID_EVENT_WAIT_LIST
%22 = icmp eq i64 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0))
br label %71
26: ; preds = %18
%27 = load i64*, i64** %2
%28 = load i64, i64* %27
%29 = load i64, i64* @CL_OUT_OF_HOST_MEMORY
%30 = icmp eq i64 %28, %29
br i1 %30, label %31, label %34
31: ; preds = %26
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0))
br label %70
34: ; preds = %26
%35 = load i64*, i64** %2
%36 = load i64, i64* %35
%37 = load i64, i64* @CL_INVALID_COMMAND_QUEUE
%38 = icmp eq i64 %36, %37
br i1 %38, label %39, label %42
39: ; preds = %34
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0))
br label %69
42: ; preds = %34
%43 = load i64*, i64** %2
%44 = load i64, i64* %43
%45 = load i64, i64* @CL_INVALID_CONTEXT
%46 = icmp eq i64 %44, %45
br i1 %46, label %47, label %50
47: ; preds = %42
%48 = load i32, i32* @stderr
%49 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0))
br label %68
50: ; preds = %42
%51 = load i64*, i64** %2
%52 = load i64, i64* %51
%53 = load i64, i64* @CL_MEM_OBJECT_ALLOCATION_FAILURE
%54 = icmp eq i64 %52, %53
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = load i32, i32* @stderr
%57 = call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.6, i64 0, i64 0))
br label %67
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 %66
63: ; preds = %58
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
br label %66
66: ; preds = %63, %58
br label %67
67: ; preds = %66, %55
br label %68
68: ; preds = %67, %47
br label %69
69: ; preds = %68, %39
br label %70
70: ; preds = %69, %31
br label %71
71: ; preds = %70, %23
br label %72
72: ; preds = %71, %15
br label %73
73: ; preds = %72, %7
ret void
}

LLVM IR (-O2):
@CL_INVALID_MEM_OBJECT = global i64 0
@stderr = global i32 0
@.str = [63 x i8] c"Err (clEnqueueWriteBuffer): buffer is not valid buffer object\0A\00"
@CL_INVALID_VALUE = global i64 0
@.str.1 = [68 x i8] c"Err (clEnqueueWriteBuffer): region is out of bounds or ptr is NULL\0A\00"
@CL_INVALID_EVENT_WAIT_LIST = global i64 0
@.str.2 = [57 x i8] c"Err (clEnqueueWriteBuffer): Events are not valid events\0A\00"
@CL_OUT_OF_HOST_MEMORY = global i64 0
@.str.3 = [70 x i8] c"Err (clEnqueueWriteBuffer): Failure to allocate resources at runtime\0A\00"
@CL_INVALID_COMMAND_QUEUE = global i64 0
@.str.4 = [53 x i8] c"Err (clEnqueueWriteBuffer): Command Queue not valid\0A\00"
@CL_INVALID_CONTEXT = global i64 0
@.str.5 = [62 x i8] c"Err (clEnqueueWriteBuffer): Context is not correct. Check it\0A\00"
@CL_MEM_OBJECT_ALLOCATION_FAILURE = global i64 0
@.str.6 = [67 x i8] c"Err (clEnqueueWriteBuffer): Failure to allocate memory for buffer\0A\00"
@CL_SUCCESS = global i64 0
@.str.7 = [29 x i8] c"clEnqueueWriteBufferChecker\0A\00"
define void @clEnqueueWriteBufferChecker(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = load i64, i64* @CL_INVALID_MEM_OBJECT
%4 = icmp eq i64 %2, %3
br i1 %4, label %26, label %5
5: ; preds = %1
%6 = load i64, i64* @CL_INVALID_VALUE
%7 = icmp eq i64 %2, %6
br i1 %7, label %26, label %8
8: ; preds = %5
%9 = load i64, i64* @CL_INVALID_EVENT_WAIT_LIST
%10 = icmp eq i64 %2, %9
br i1 %10, label %26, label %11
11: ; preds = %8
%12 = load i64, i64* @CL_OUT_OF_HOST_MEMORY
%13 = icmp eq i64 %2, %12
br i1 %13, label %26, label %14
14: ; preds = %11
%15 = load i64, i64* @CL_INVALID_COMMAND_QUEUE
%16 = icmp eq i64 %2, %15
br i1 %16, label %26, label %17
17: ; preds = %14
%18 = load i64, i64* @CL_INVALID_CONTEXT
%19 = icmp eq i64 %2, %18
br i1 %19, label %26, label %20
20: ; preds = %17
%21 = load i64, i64* @CL_MEM_OBJECT_ALLOCATION_FAILURE
%22 = icmp eq i64 %2, %21
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load i64, i64* @CL_SUCCESS
%25 = icmp eq i64 %2, %24
br i1 %25, label %30, label %26
26: ; preds = %23, %20, %17, %14, %11, %8, %5, %1
%27 = phi i8* [ getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), %8 ], [ getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0), %11 ], [ getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0), %14 ], [ getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0), %17 ], [ getelementptr inbounds ([67 x i8], [67 x i8]* @.str.6, i64 0, i64 0), %20 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), %23 ]
%28 = load i32, i32* @stderr
%29 = tail call i32 @fprintf(i32 %28, i8* %27)
br label %30
30: ; preds = %26, %23
ret void
}