#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_BUILD_PROGRAM_FAILURE;
scalar_t__ CL_INVALID_BUILD_OPTIONS;
scalar_t__ CL_INVALID_DEVICE;
scalar_t__ CL_INVALID_PROGRAM;
scalar_t__ CL_INVALID_VALUE;
scalar_t__ CL_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void clBuildProgramChecker(cl_int *err, char *p) {
  if (*err != CL_SUCCESS) {
    if (*err == CL_INVALID_PROGRAM)
      fprintf(stderr,
              "Err (clBuildProgram): Program is not valid Program Object\n");
    else if (*err == CL_INVALID_VALUE)
      fprintf(stderr, "Err (clBuildProgram): Device list is NULL and number of "
                      "devices >0 ... Incompatible\n");
    else if (*err == CL_INVALID_DEVICE)
      fprintf(stderr, "Err (clBuildProgram): Device specified does not match "
                      "the device specified in program object\n");
    else if (*err == CL_INVALID_BUILD_OPTIONS)
      fprintf(stderr, "Err (clBuildProgram): Invalid Build Options\n");
    else if (*err == CL_BUILD_PROGRAM_FAILURE)
      fprintf(stderr,
              "Err (clBuildProgram): Failure in building the program\n");
    else
      fprintf(stderr, "clBuildProgramChecker\n");
    fprintf(stderr, "Build Log: %s\n", p);
    exit(0);
  }
}


x86 assembly (clang, -O0):
<clBuildProgramChecker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e72(%rip),%rcx
cmp    (%rcx),%rax
je     1293 <clBuildProgramChecker+0x173>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e7b(%rip),%rcx
cmp    (%rcx),%rax
jne    117a <clBuildProgramChecker+0x5a>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1271 <clBuildProgramChecker+0x151>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e60(%rip),%rcx
cmp    (%rcx),%rax
jne    11ad <clBuildProgramChecker+0x8d>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    126c <clBuildProgramChecker+0x14c>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2e25(%rip),%rcx
cmp    (%rcx),%rax
jne    11e0 <clBuildProgramChecker+0xc0>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1267 <clBuildProgramChecker+0x147>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2dca(%rip),%rcx
cmp    (%rcx),%rax
jne    1213 <clBuildProgramChecker+0xf3>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
lea    0xee7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1262 <clBuildProgramChecker+0x142>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2db7(%rip),%rcx
cmp    (%rcx),%rax
jne    1246 <clBuildProgramChecker+0x126>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
lea    0xee1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    125d <clBuildProgramChecker+0x13d>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
lea    0xefc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1262 <clBuildProgramChecker+0x142>
jmp    1267 <clBuildProgramChecker+0x147>
jmp    126c <clBuildProgramChecker+0x14c>
jmp    1271 <clBuildProgramChecker+0x151>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xee4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clBuildProgramChecker>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rax
mov    0x2e82(%rip),%rcx
cmp    (%rcx),%rax
jne    113b <clBuildProgramChecker+0x1b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rsi,%rbx
mov    0x2e8b(%rip),%rcx
cmp    (%rcx),%rax
jne    1153 <clBuildProgramChecker+0x33>
lea    0xeaf(%rip),%rsi
jmp    11ae <clBuildProgramChecker+0x8e>
mov    0x2e8e(%rip),%rcx
cmp    (%rcx),%rax
jne    1168 <clBuildProgramChecker+0x48>
lea    0xed5(%rip),%rsi
jmp    11ae <clBuildProgramChecker+0x8e>
mov    0x2e71(%rip),%rcx
cmp    (%rcx),%rax
jne    117d <clBuildProgramChecker+0x5d>
lea    0xf15(%rip),%rsi
jmp    11ae <clBuildProgramChecker+0x8e>
mov    0x2e34(%rip),%rcx
cmp    (%rcx),%rax
jne    1192 <clBuildProgramChecker+0x72>
lea    0xf5e(%rip),%rsi
jmp    11ae <clBuildProgramChecker+0x8e>
mov    0x2e3f(%rip),%rcx
cmp    (%rcx),%rax
lea    0xf78(%rip),%rax
lea    0xfa8(%rip),%rsi
cmove  %rax,%rsi
mov    0x2e0b(%rip),%r14
mov    (%r14),%edi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xfa0(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@CL_SUCCESS = global i64 0
@CL_INVALID_PROGRAM = global i64 0
@stderr = global i32 0
@.str = [59 x i8] c"Err (clBuildProgram): Program is not valid Program Object\0A\00"
@CL_INVALID_VALUE = global i64 0
@.str.1 = [85 x i8] c"Err (clBuildProgram): Device list is NULL and number of devices >0 ... Incompatible\0A\00"
@CL_INVALID_DEVICE = global i64 0
@.str.2 = [94 x i8] c"Err (clBuildProgram): Device specified does not match the device specified in program object\0A\00"
@CL_INVALID_BUILD_OPTIONS = global i64 0
@.str.3 = [45 x i8] c"Err (clBuildProgram): Invalid Build Options\0A\00"
@CL_BUILD_PROGRAM_FAILURE = global i64 0
@.str.4 = [55 x i8] c"Err (clBuildProgram): Failure in building the program\0A\00"
@.str.5 = [23 x i8] c"clBuildProgramChecker\0A\00"
@.str.6 = [15 x i8] c"Build Log: %s\0A\00"
define void @clBuildProgramChecker(i64* %0, i8* %1) {
%3 = alloca i64*
%4 = alloca i8*
store i64* %0, i64** %3
store i8* %1, i8** %4
%5 = load i64*, i64** %3
%6 = load i64, i64* %5
%7 = load i64, i64* @CL_SUCCESS
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %61
9: ; preds = %2
%10 = load i64*, i64** %3
%11 = load i64, i64* %10
%12 = load i64, i64* @CL_INVALID_PROGRAM
%13 = icmp eq i64 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
br label %56
17: ; preds = %9
%18 = load i64*, i64** %3
%19 = load i64, i64* %18
%20 = load i64, i64* @CL_INVALID_VALUE
%21 = icmp eq i64 %19, %20
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0))
br label %55
25: ; preds = %17
%26 = load i64*, i64** %3
%27 = load i64, i64* %26
%28 = load i64, i64* @CL_INVALID_DEVICE
%29 = icmp eq i64 %27, %28
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.2, i64 0, i64 0))
br label %54
33: ; preds = %25
%34 = load i64*, i64** %3
%35 = load i64, i64* %34
%36 = load i64, i64* @CL_INVALID_BUILD_OPTIONS
%37 = icmp eq i64 %35, %36
br i1 %37, label %38, label %41
38: ; preds = %33
%39 = load i32, i32* @stderr
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
br label %53
41: ; preds = %33
%42 = load i64*, i64** %3
%43 = load i64, i64* %42
%44 = load i64, i64* @CL_BUILD_PROGRAM_FAILURE
%45 = icmp eq i64 %43, %44
br i1 %45, label %46, label %49
46: ; preds = %41
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0))
br label %52
49: ; preds = %41
%50 = load i32, i32* @stderr
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %52
52: ; preds = %49, %46
br label %53
53: ; preds = %52, %38
br label %54
54: ; preds = %53, %30
br label %55
55: ; preds = %54, %22
br label %56
56: ; preds = %55, %14
%57 = load i32, i32* @stderr
%58 = load i8*, i8** %4
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* %58)
%60 = call i32 @exit(i32 0)
unreachable
61: ; preds = %2
ret void
}

LLVM IR (-O2):
@CL_SUCCESS = global i64 0
@CL_INVALID_PROGRAM = global i64 0
@stderr = global i32 0
@.str = [59 x i8] c"Err (clBuildProgram): Program is not valid Program Object\0A\00"
@CL_INVALID_VALUE = global i64 0
@.str.1 = [85 x i8] c"Err (clBuildProgram): Device list is NULL and number of devices >0 ... Incompatible\0A\00"
@CL_INVALID_DEVICE = global i64 0
@.str.2 = [94 x i8] c"Err (clBuildProgram): Device specified does not match the device specified in program object\0A\00"
@CL_INVALID_BUILD_OPTIONS = global i64 0
@.str.3 = [45 x i8] c"Err (clBuildProgram): Invalid Build Options\0A\00"
@CL_BUILD_PROGRAM_FAILURE = global i64 0
@.str.4 = [55 x i8] c"Err (clBuildProgram): Failure in building the program\0A\00"
@.str.5 = [23 x i8] c"clBuildProgramChecker\0A\00"
@.str.6 = [15 x i8] c"Build Log: %s\0A\00"
define void @clBuildProgramChecker(i64* nocapture %0, i8* %1) {
%3 = load i64, i64* %0
%4 = load i64, i64* @CL_SUCCESS
%5 = icmp eq i64 %3, %4
br i1 %5, label %29, label %6
6: ; preds = %2
%7 = load i64, i64* @CL_INVALID_PROGRAM
%8 = icmp eq i64 %3, %7
br i1 %8, label %22, label %9
9: ; preds = %6
%10 = load i64, i64* @CL_INVALID_VALUE
%11 = icmp eq i64 %3, %10
br i1 %11, label %22, label %12
12: ; preds = %9
%13 = load i64, i64* @CL_INVALID_DEVICE
%14 = icmp eq i64 %3, %13
br i1 %14, label %22, label %15
15: ; preds = %12
%16 = load i64, i64* @CL_INVALID_BUILD_OPTIONS
%17 = icmp eq i64 %3, %16
br i1 %17, label %22, label %18
18: ; preds = %15
%19 = load i64, i64* @CL_BUILD_PROGRAM_FAILURE
%20 = icmp eq i64 %3, %19
%21 = select i1 %20, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0)
br label %22
22: ; preds = %15, %12, %9, %6, %18
%23 = phi i8* [ %21, %18 ], [ getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), %6 ], [ getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0), %9 ], [ getelementptr inbounds ([94 x i8], [94 x i8]* @.str.2, i64 0, i64 0), %12 ], [ getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), %15 ]
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* %23)
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* %1)
%28 = tail call i32 @exit(i32 0)
unreachable
29: ; preds = %2
ret void
}