#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_BUFFER_SIZE;
scalar_t__ CL_INVALID_CONTEXT;
scalar_t__ CL_INVALID_VALUE;
scalar_t__ CL_MEM_OBJECT_ALLOCATION_FAILURE;
scalar_t__ CL_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void clCreateBufferChecker(cl_int *err) {
  if (*err == CL_INVALID_CONTEXT)
    fprintf(stderr, "Err (clCreateBuffer): Context is not valid context\n");
  else if (*err == CL_INVALID_VALUE)
    fprintf(stderr, "Err (clCreateBuffer): Flag (arg2) is not valid\n");
  else if (*err == CL_INVALID_BUFFER_SIZE)
    fprintf(stderr, "Err (clCreateBuffer): Size is 0 !! or is greater than "
                    "maximum allocatable size\n");
  else if (*err == CL_MEM_OBJECT_ALLOCATION_FAILURE)
    fprintf(
        stderr,
        "Err (clCreateBuffer): Failure to allocate memory for buffer object\n");
  else {
    if (*err != CL_SUCCESS)
      fprintf(stderr, "clCreateBufferChecker\n");
  }
}


x86 assembly (clang, -O0):
<clCreateBufferChecker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2eae(%rip),%rcx
cmp    (%rcx),%rax
jne    114d <clCreateBufferChecker+0x3d>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1220 <clCreateBufferChecker+0x110>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%rax
jne    117e <clCreateBufferChecker+0x6e>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
jmp    121b <clCreateBufferChecker+0x10b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e64(%rip),%rcx
cmp    (%rcx),%rax
jne    11af <clCreateBufferChecker+0x9f>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1216 <clCreateBufferChecker+0x106>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2df3(%rip),%rcx
cmp    (%rcx),%rax
jne    11e0 <clCreateBufferChecker+0xd0>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1211 <clCreateBufferChecker+0x101>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2dd2(%rip),%rcx
cmp    (%rcx),%rax
je     120c <clCreateBufferChecker+0xfc>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
lea    0xef1(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1211 <clCreateBufferChecker+0x101>
jmp    1216 <clCreateBufferChecker+0x106>
jmp    121b <clCreateBufferChecker+0x10b>
jmp    1220 <clCreateBufferChecker+0x110>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clCreateBufferChecker>:
mov    (%rdi),%rax
mov    0x2ebe(%rip),%rcx
cmp    (%rcx),%rax
jne    1128 <clCreateBufferChecker+0x18>
lea    0xeda(%rip),%rsi
jmp    117b <clCreateBufferChecker+0x6b>
mov    0x2eb1(%rip),%rcx
cmp    (%rcx),%rax
jne    113d <clCreateBufferChecker+0x2d>
lea    0xef9(%rip),%rsi
jmp    117b <clCreateBufferChecker+0x6b>
mov    0x2eac(%rip),%rcx
cmp    (%rcx),%rax
jne    1152 <clCreateBufferChecker+0x42>
lea    0xf14(%rip),%rsi
jmp    117b <clCreateBufferChecker+0x6b>
mov    0x2e57(%rip),%rcx
cmp    (%rcx),%rax
jne    1167 <clCreateBufferChecker+0x57>
lea    0xf4f(%rip),%rsi
jmp    117b <clCreateBufferChecker+0x6b>
mov    0x2e52(%rip),%rcx
cmp    (%rcx),%rax
jne    1174 <clCreateBufferChecker+0x64>
ret
lea    0xf7d(%rip),%rsi
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@CL_INVALID_CONTEXT = global i64 0
@stderr = global i32 0
@.str = [52 x i8] c"Err (clCreateBuffer): Context is not valid context\0A\00"
@CL_INVALID_VALUE = global i64 0
@.str.1 = [48 x i8] c"Err (clCreateBuffer): Flag (arg2) is not valid\0A\00"
@CL_INVALID_BUFFER_SIZE = global i64 0
@.str.2 = [80 x i8] c"Err (clCreateBuffer): Size is 0 !! or is greater than maximum allocatable size\0A\00"
@CL_MEM_OBJECT_ALLOCATION_FAILURE = global i64 0
@.str.3 = [68 x i8] c"Err (clCreateBuffer): Failure to allocate memory for buffer object\0A\00"
@CL_SUCCESS = global i64 0
@.str.4 = [23 x i8] c"clCreateBufferChecker\0A\00"
define void @clCreateBufferChecker(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_CONTEXT
%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 ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
br label %46
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 ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
br label %45
18: ; preds = %10
%19 = load i64*, i64** %2
%20 = load i64, i64* %19
%21 = load i64, i64* @CL_INVALID_BUFFER_SIZE
%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 ([80 x i8], [80 x i8]* @.str.2, i64 0, i64 0))
br label %44
26: ; preds = %18
%27 = load i64*, i64** %2
%28 = load i64, i64* %27
%29 = load i64, i64* @CL_MEM_OBJECT_ALLOCATION_FAILURE
%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 ([68 x i8], [68 x i8]* @.str.3, i64 0, i64 0))
br label %43
34: ; preds = %26
%35 = load i64*, i64** %2
%36 = load i64, i64* %35
%37 = load i64, i64* @CL_SUCCESS
%38 = icmp ne 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 ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %39, %34
br label %43
43: ; preds = %42, %31
br label %44
44: ; preds = %43, %23
br label %45
45: ; preds = %44, %15
br label %46
46: ; preds = %45, %7
ret void
}

LLVM IR (-O2):
@CL_INVALID_CONTEXT = global i64 0
@stderr = global i32 0
@.str = [52 x i8] c"Err (clCreateBuffer): Context is not valid context\0A\00"
@CL_INVALID_VALUE = global i64 0
@.str.1 = [48 x i8] c"Err (clCreateBuffer): Flag (arg2) is not valid\0A\00"
@CL_INVALID_BUFFER_SIZE = global i64 0
@.str.2 = [80 x i8] c"Err (clCreateBuffer): Size is 0 !! or is greater than maximum allocatable size\0A\00"
@CL_MEM_OBJECT_ALLOCATION_FAILURE = global i64 0
@.str.3 = [68 x i8] c"Err (clCreateBuffer): Failure to allocate memory for buffer object\0A\00"
@CL_SUCCESS = global i64 0
@.str.4 = [23 x i8] c"clCreateBufferChecker\0A\00"
define void @clCreateBufferChecker(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = load i64, i64* @CL_INVALID_CONTEXT
%4 = icmp eq i64 %2, %3
br i1 %4, label %17, label %5
5: ; preds = %1
%6 = load i64, i64* @CL_INVALID_VALUE
%7 = icmp eq i64 %2, %6
br i1 %7, label %17, label %8
8: ; preds = %5
%9 = load i64, i64* @CL_INVALID_BUFFER_SIZE
%10 = icmp eq i64 %2, %9
br i1 %10, label %17, label %11
11: ; preds = %8
%12 = load i64, i64* @CL_MEM_OBJECT_ALLOCATION_FAILURE
%13 = icmp eq i64 %2, %12
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i64, i64* @CL_SUCCESS
%16 = icmp eq i64 %2, %15
br i1 %16, label %21, label %17
17: ; preds = %14, %11, %8, %5, %1
%18 = phi i8* [ getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([80 x i8], [80 x i8]* @.str.2, i64 0, i64 0), %8 ], [ getelementptr inbounds ([68 x i8], [68 x i8]* @.str.3, i64 0, i64 0), %11 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), %14 ]
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* %18)
br label %21
21: ; preds = %17, %14
ret void
}