#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 size_t cl_uint;
typedef int /*<<< orphan*/ cl_program;
typedef int /*<<< orphan*/ *cl_kernel;
typedef int /*<<< orphan*/ cl_int;
typedef int /*<<< orphan*/ cl_device_id;
typedef int /*<<< orphan*/ cl_context;
typedef scalar_t__ cl_build_status;
typedef int cl_bool;

/* Variables and functions */
scalar_t__ CL_BUILD_IN_PROGRESS;
scalar_t__ CL_BUILD_SUCCESS;
int /*<<< orphan*/ CL_CONTEXT_DEVICES;
int /*<<< orphan*/ CL_PROGRAM_BUILD_STATUS;
int /*<<< orphan*/ CL_SUCCESS;
int /*<<< orphan*/ clBuildProgram(int /*<<< orphan*/, size_t,
                                  int /*<<< orphan*/ *, char const *,
                                  void (*)(cl_program, void *), void *);
int /*<<< orphan*/ *clCreateKernel(int /*<<< orphan*/, char *,
                                   int /*<<< orphan*/ *);
int /*<<< orphan*/ clCreateProgramWithSource(int /*<<< orphan*/, int,
                                             char const **,
                                             int /*<<< orphan*/ *,
                                             int /*<<< orphan*/ *);
int /*<<< orphan*/ clGetContextInfo(int /*<<< orphan*/, int /*<<< orphan*/,
                                    size_t, int /*<<< orphan*/ *, size_t *);
int /*<<< orphan*/ clGetProgramBuildInfo(int /*<<< orphan*/, int /*<<< orphan*/,
                                         int /*<<< orphan*/, int, scalar_t__ *,
                                         int /*<<< orphan*/ *);
int /*<<< orphan*/ clReleaseProgram(int /*<<< orphan*/);
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
scalar_t__ malloc(size_t);
cl_kernel CL_MT_global_ziggurat_normal_floatT_create_kernel(
    cl_context context, cl_uint num_devices, const cl_device_id *device_list,
    const char *options, void (*pfn_notify)(cl_program, void *user_data),
    void *user_data, cl_int *errcode_ret) {
  char source_string[] =
      "#define DISABLE_DOUBLES\n"
      "#undef DISABLE_"
      "FLOAT"
      "S\n"
      "#define ZIGGURAT_NORMAL_"
      "FLOAT"
      "\n"
      "#include \""
      "MT"
      "_"
      "global"
      ".hcl\"\n"
      "#ifndef __RND_WORKGROUP_SIZE\n"
      "__kernel __ziggurat_normal_"
      "float"
      "_kernel( "
      "MT"
      ", "
      "T"
      " );\n"
      "#else\n"
      "__kernel __attribute__((reqd_work_group_size(__RND_WORKGROUP_SIZE, 1, "
      "1))) __ziggurat_normal_"
      "float"
      "_kernel( "
      "MT"
      ", "
      "T"
      " );\n"
      "#endif";
  cl_int errcode;
  if (errcode_ret == NULL)
    errcode_ret = &errcode;
  volatile char *tmp_source_string = &source_string[0];
  cl_program program = clCreateProgramWithSource(
      context, 1, (const char **)&tmp_source_string, NULL, errcode_ret);
  if (*errcode_ret != CL_SUCCESS)
    return NULL;
  cl_bool alloc;
  cl_device_id *tmp = (cl_device_id *)device_list;
  if (alloc = (device_list == NULL)) {
    size_t size;
    *errcode_ret =
        clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &size);
    if (*errcode_ret != CL_SUCCESS)
      return NULL;
    if (num_devices == 0 || num_devices > (size / sizeof(cl_device_id)))
      num_devices = size / sizeof(cl_device_id);
    tmp = (cl_device_id *)malloc(size);
    *errcode_ret =
        clGetContextInfo(context, CL_CONTEXT_DEVICES, size, tmp, NULL);
    if (*errcode_ret != CL_SUCCESS)
      return NULL;
  }
  *errcode_ret =
      clBuildProgram(program, num_devices, tmp, options, pfn_notify, user_data);
  if (*errcode_ret != CL_SUCCESS)
    return NULL;
  cl_build_status status = CL_BUILD_IN_PROGRESS;
  int i;
  for (i = 0; i < num_devices; i++) {
    while (status == CL_BUILD_IN_PROGRESS)
      clGetProgramBuildInfo(program, tmp[i], CL_PROGRAM_BUILD_STATUS,
                            sizeof(cl_build_status), &status, NULL);
    if (status != CL_BUILD_SUCCESS)
      return NULL;
  }
  cl_kernel kernel = clCreateKernel(program,
                                    "MT"
                                    "_ziggurat_normal_"
                                    "float"
                                    "T"
                                    "_kernel",
                                    errcode_ret);
  clReleaseProgram(program);
  if (alloc)
    free(tmp);
  return kernel;
}


x86 assembly (clang, -O0):
<CL_MT_global_ziggurat_normal_floatT_create_kernel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
lea    -0x170(%rbp),%rdi
lea    0xe3c(%rip),%rsi
mov    $0x135,%edx
call   1090 <memcpy@plt>
cmpq   $0x0,0x10(%rbp)
jne    11e4 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x54>
lea    -0x174(%rbp),%rax
mov    %rax,0x10(%rbp)
lea    -0x170(%rbp),%rax
mov    %rax,-0x180(%rbp)
mov    -0xc(%rbp),%edi
mov    0x10(%rbp),%r8
mov    $0x1,%esi
lea    -0x180(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1060 <clCreateProgramWithSource@plt>
mov    %eax,-0x184(%rbp)
mov    0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2da7(%rip),%rcx
cmp    (%rcx),%eax
je     1236 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0xa6>
movq   $0x0,-0x8(%rbp)
jmp    149d <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x30d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x190(%rbp)
cmpq   $0x0,-0x20(%rbp)
sete   %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x188(%rbp)
test   $0x1,%al
jne    1264 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0xd4>
jmp    1345 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x1b5>
mov    -0xc(%rbp),%edi
mov    0x2d7a(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x198(%rbp),%r8
mov    %rcx,%rdx
call   1040 <clGetContextInfo@plt>
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2d30(%rip),%rcx
cmp    (%rcx),%eax
je     12ad <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x11d>
movq   $0x0,-0x8(%rbp)
jmp    149d <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x30d>
cmpq   $0x0,-0x18(%rbp)
je     12d0 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x140>
mov    -0x18(%rbp),%rax
mov    -0x198(%rbp),%rcx
shr    $0x2,%rcx
cmp    %rcx,%rax
jbe    12df <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x14f>
mov    -0x198(%rbp),%rax
shr    $0x2,%rax
mov    %rax,-0x18(%rbp)
mov    -0x198(%rbp),%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x190(%rbp)
mov    -0xc(%rbp),%edi
mov    0x2cec(%rip),%rax
mov    (%rax),%esi
mov    -0x198(%rbp),%rdx
mov    -0x190(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <clGetContextInfo@plt>
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2c9d(%rip),%rcx
cmp    (%rcx),%eax
je     1340 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x1b0>
movq   $0x0,-0x8(%rbp)
jmp    149d <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x30d>
jmp    1345 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x1b5>
mov    -0x184(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x190(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
call   1030 <clBuildProgram@plt>
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2c4c(%rip),%rcx
cmp    (%rcx),%eax
je     1391 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x201>
movq   $0x0,-0x8(%rbp)
jmp    149d <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x30d>
mov    0x2c40(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x1a0(%rbp)
movl   $0x0,-0x1a4(%rbp)
movslq -0x1a4(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1451 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x2c1>
jmp    13c2 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x232>
mov    -0x1a0(%rbp),%rax
mov    0x2c08(%rip),%rcx
cmp    (%rcx),%rax
jne    1414 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x284>
mov    -0x184(%rbp),%edi
mov    -0x190(%rbp),%rax
movslq -0x1a4(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    0x2be9(%rip),%rax
mov    (%rax),%edx
mov    $0x8,%ecx
lea    -0x1a0(%rbp),%r8
xor    %eax,%eax
mov    %eax,%r9d
call   1080 <clGetProgramBuildInfo@plt>
jmp    13c2 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x232>
mov    -0x1a0(%rbp),%rax
mov    0x2b96(%rip),%rcx
cmp    (%rcx),%rax
je     1438 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x2a8>
movq   $0x0,-0x8(%rbp)
jmp    149d <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x30d>
jmp    143d <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x2ad>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    13ac <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x21c>
mov    -0x184(%rbp),%edi
mov    0x10(%rbp),%rdx
lea    0xcd3(%rip),%rsi
call   10b0 <clCreateKernel@plt>
mov    %rax,-0x1b0(%rbp)
mov    -0x184(%rbp),%edi
call   1070 <clReleaseProgram@plt>
cmpl   $0x0,-0x188(%rbp)
je     1492 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x302>
mov    -0x190(%rbp),%rdi
call   1050 <free@plt>
mov    -0x1b0(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CL_MT_global_ziggurat_normal_floatT_create_kernel>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x188,%rsp
mov    %r9,0x38(%rsp)
mov    %r8,0x30(%rsp)
mov    %rcx,0x28(%rsp)
mov    %rdx,%r15
mov    %rsi,0x10(%rsp)
mov    %edi,%r14d
mov    0x1c0(%rsp),%rbp
lea    0xe36(%rip),%rsi
lea    0x50(%rsp),%rbx
mov    $0x135,%edx
mov    %rbx,%rdi
call   1090 <memcpy@plt>
test   %rbp,%rbp
lea    0x4c(%rsp),%r13
cmovne %rbp,%r13
mov    %rbx,0x40(%rsp)
lea    0x40(%rsp),%rdx
mov    %r14d,%edi
mov    $0x1,%esi
xor    %ecx,%ecx
mov    %r13,%r8
call   1060 <clCreateProgramWithSource@plt>
mov    %eax,%r12d
mov    %r13,0x20(%rsp)
mov    0x0(%r13),%eax
xor    %ebp,%ebp
mov    0x2daf(%rip),%r13
cmp    0x0(%r13),%eax
jne    138f <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x1ff>
test   %r15,%r15
je     130a <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x17a>
mov    %r15,%rbx
mov    %r12d,%edi
mov    0x10(%rsp),%rbp
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    0x28(%rsp),%rcx
mov    0x30(%rsp),%r8
mov    0x38(%rsp),%r9
call   1030 <clBuildProgram@plt>
mov    0x20(%rsp),%rcx
mov    %eax,(%rcx)
cmp    0x0(%r13),%eax
jne    138d <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x1fd>
mov    %r15,0x18(%rsp)
mov    0x2d6a(%rip),%r14
mov    (%r14),%rax
mov    %rax,0x8(%rsp)
test   %rbp,%rbp
je     12d2 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x142>
mov    0x2d5e(%rip),%r15
lea    0x8(%rsp),%rbp
mov    %rax,%rcx
xor    %r13d,%r13d
jmp    12b2 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x122>
nop
mov    (%rbx,%r13,4),%esi
mov    (%r15),%edx
mov    %r12d,%edi
mov    $0x8,%ecx
mov    %rbp,%r8
xor    %r9d,%r9d
call   1080 <clGetProgramBuildInfo@plt>
mov    0x8(%rsp),%rcx
mov    (%r14),%rax
cmp    %rax,%rcx
je     1290 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x100>
mov    0x2cfa(%rip),%rdx
cmp    (%rdx),%rcx
jne    138d <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x1fd>
add    $0x1,%r13
cmp    0x10(%rsp),%r13
jne    12b2 <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x122>
lea    0xe5c(%rip),%rsi
mov    %r12d,%edi
mov    0x20(%rsp),%rdx
call   10b0 <clCreateKernel@plt>
mov    %rax,%rbp
mov    %r12d,%edi
call   1070 <clReleaseProgram@plt>
cmpq   $0x0,0x18(%rsp)
jne    138f <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x1ff>
mov    %rbx,%rdi
call   1050 <free@plt>
jmp    138f <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x1ff>
mov    %r15,0x18(%rsp)
mov    0x10(%rsp),%rbx
mov    0x2ccd(%rip),%r15
mov    (%r15),%esi
lea    0x8(%rsp),%r8
mov    %r14d,%edi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <clGetContextInfo@plt>
mov    0x20(%rsp),%rbp
mov    %eax,0x0(%rbp)
cmp    0x0(%r13),%eax
jne    138d <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x1fd>
mov    0x8(%rsp),%rdi
mov    %rdi,%rax
shr    $0x2,%rax
lea    -0x1(%rbx),%rcx
cmp    %rax,%rcx
cmovae %rax,%rbx
mov    %rbx,0x10(%rsp)
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    (%r15),%esi
mov    0x8(%rsp),%rdx
mov    %r14d,%edi
mov    %rax,%rcx
xor    %r8d,%r8d
call   1040 <clGetContextInfo@plt>
mov    %eax,0x0(%rbp)
xor    %ebp,%ebp
cmp    0x0(%r13),%eax
mov    0x18(%rsp),%r15
je     122f <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x9f>
jmp    138f <CL_MT_global_ziggurat_normal_floatT_create_kernel+0x1ff>
xor    %ebp,%ebp
mov    %rbp,%rax
add    $0x188,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.CL_MT_global_ziggurat_normal_floatT_create_kernel.source_string = [309 x i8] c"#define DISABLE_DOUBLES\0A#undef DISABLE_FLOATS\0A#define ZIGGURAT_NORMAL_FLOAT\0A#include \22MT_global.hcl\22\0A#ifndef __RND_WORKGROUP_SIZE\0A__kernel __ziggurat_normal_float_kernel( MT, T );\0A#else\0A__kernel __attribute__((reqd_work_group_size(__RND_WORKGROUP_SIZE, 1, 1))) __ziggurat_normal_float_kernel( MT, T );\0A#endif\00"
@CL_SUCCESS = global i32 0
@CL_CONTEXT_DEVICES = global i32 0
@CL_BUILD_IN_PROGRESS = global i64 0
@CL_PROGRAM_BUILD_STATUS = global i32 0
@CL_BUILD_SUCCESS = global i64 0
@.str = [33 x i8] c"MT_ziggurat_normal_floatT_kernel\00"
define i32* @CL_MT_global_ziggurat_normal_floatT_create_kernel(i32 %0, i64 %1, i32* %2, i8* %3, void (i32, i8*)* %4, i8* %5, i32* %6) {
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i64
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca void (i32, i8*)*
%14 = alloca i8*
%15 = alloca i32*
%16 = alloca [309 x i8]
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32*
%22 = alloca i64
%23 = alloca i64
%24 = alloca i32
%25 = alloca i32*
store i32 %0, i32* %9
store i64 %1, i64* %10
store i32* %2, i32** %11
store i8* %3, i8** %12
store void (i32, i8*)* %4, void (i32, i8*)** %13
store i8* %5, i8** %14
store i32* %6, i32** %15
%26 = bitcast [309 x i8]* %16 to i8*
%27 = load i32*, i32** %15
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %30
29: ; preds = %7
store i32* %17, i32** %15
br label %30
30: ; preds = %29, %7
%31 = getelementptr inbounds [309 x i8], [309 x i8]* %16, i64 0, i64 0
store i8* %31, i8** %18
%32 = load i32, i32* %9
%33 = load i32*, i32** %15
%34 = call i32 @clCreateProgramWithSource(i32 %32, i32 1, i8** %18, i32* null, i32* %33)
store i32 %34, i32* %19
%35 = load i32*, i32** %15
%36 = load i32, i32* %35
%37 = load i32, i32* @CL_SUCCESS
%38 = icmp ne i32 %36, %37
br i1 %38, label %39, label %40
39: ; preds = %30
store i32* null, i32** %8
br label %139
40: ; preds = %30
%41 = load i32*, i32** %11
store i32* %41, i32** %21
%42 = load i32*, i32** %11
%43 = icmp eq i32* %42, null
%44 = zext i1 %43 to i32
store i32 %44, i32* %20
br i1 %43, label %45, label %82
45: ; preds = %40
%46 = load i32, i32* %9
%47 = load i32, i32* @CL_CONTEXT_DEVICES
%48 = call i32 @clGetContextInfo(i32 %46, i32 %47, i64 0, i32* null, i64* %22)
%49 = load i32*, i32** %15
store i32 %48, i32* %49
%50 = load i32*, i32** %15
%51 = load i32, i32* %50
%52 = load i32, i32* @CL_SUCCESS
%53 = icmp ne i32 %51, %52
br i1 %53, label %54, label %55
54: ; preds = %45
store i32* null, i32** %8
br label %139
55: ; preds = %45
%56 = load i64, i64* %10
%57 = icmp eq i64 %56, 0
br i1 %57, label %63, label %58
58: ; preds = %55
%59 = load i64, i64* %10
%60 = load i64, i64* %22
%61 = udiv i64 %60, 4
%62 = icmp ugt i64 %59, %61
br i1 %62, label %63, label %66
63: ; preds = %58, %55
%64 = load i64, i64* %22
%65 = udiv i64 %64, 4
store i64 %65, i64* %10
br label %66
66: ; preds = %63, %58
%67 = load i64, i64* %22
%68 = call i64 @malloc(i64 %67)
%69 = inttoptr i64 %68 to i32*
store i32* %69, i32** %21
%70 = load i32, i32* %9
%71 = load i32, i32* @CL_CONTEXT_DEVICES
%72 = load i64, i64* %22
%73 = load i32*, i32** %21
%74 = call i32 @clGetContextInfo(i32 %70, i32 %71, i64 %72, i32* %73, i64* null)
%75 = load i32*, i32** %15
store i32 %74, i32* %75
%76 = load i32*, i32** %15
%77 = load i32, i32* %76
%78 = load i32, i32* @CL_SUCCESS
%79 = icmp ne i32 %77, %78
br i1 %79, label %80, label %81
80: ; preds = %66
store i32* null, i32** %8
br label %139
81: ; preds = %66
br label %82
82: ; preds = %81, %40
%83 = load i32, i32* %19
%84 = load i64, i64* %10
%85 = load i32*, i32** %21
%86 = load i8*, i8** %12
%87 = load void (i32, i8*)*, void (i32, i8*)** %13
%88 = load i8*, i8** %14
%89 = call i32 @clBuildProgram(i32 %83, i64 %84, i32* %85, i8* %86, void (i32, i8*)* %87, i8* %88)
%90 = load i32*, i32** %15
store i32 %89, i32* %90
%91 = load i32*, i32** %15
%92 = load i32, i32* %91
%93 = load i32, i32* @CL_SUCCESS
%94 = icmp ne i32 %92, %93
br i1 %94, label %95, label %96
95: ; preds = %82
store i32* null, i32** %8
br label %139
96: ; preds = %82
%97 = load i64, i64* @CL_BUILD_IN_PROGRESS
store i64 %97, i64* %23
store i32 0, i32* %24
br label %98
98: ; preds = %123, %96
%99 = load i32, i32* %24
%100 = sext i32 %99 to i64
%101 = load i64, i64* %10
%102 = icmp ult i64 %100, %101
br i1 %102, label %103, label %126
103: ; preds = %98
br label %104
104: ; preds = %108, %103
%105 = load i64, i64* %23
%106 = load i64, i64* @CL_BUILD_IN_PROGRESS
%107 = icmp eq i64 %105, %106
br i1 %107, label %108, label %117
108: ; preds = %104
%109 = load i32, i32* %19
%110 = load i32*, i32** %21
%111 = load i32, i32* %24
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i32, i32* %110, i64 %112
%114 = load i32, i32* %113
%115 = load i32, i32* @CL_PROGRAM_BUILD_STATUS
%116 = call i32 @clGetProgramBuildInfo(i32 %109, i32 %114, i32 %115, i32 8, i64* %23, i32* null)
br label %104
117: ; preds = %104
%118 = load i64, i64* %23
%119 = load i64, i64* @CL_BUILD_SUCCESS
%120 = icmp ne i64 %118, %119
br i1 %120, label %121, label %122
121: ; preds = %117
store i32* null, i32** %8
br label %139
122: ; preds = %117
br label %123
123: ; preds = %122
%124 = load i32, i32* %24
%125 = add nsw i32 %124, 1
store i32 %125, i32* %24
br label %98
126: ; preds = %98
%127 = load i32, i32* %19
%128 = load i32*, i32** %15
%129 = call i32* @clCreateKernel(i32 %127, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32* %128)
store i32* %129, i32** %25
%130 = load i32, i32* %19
%131 = call i32 @clReleaseProgram(i32 %130)
%132 = load i32, i32* %20
%133 = icmp ne i32 %132, 0
br i1 %133, label %134, label %137
134: ; preds = %126
%135 = load i32*, i32** %21
%136 = call i32 @free(i32* %135)
br label %137
137: ; preds = %134, %126
%138 = load i32*, i32** %25
store i32* %138, i32** %8
br label %139
139: ; preds = %137, %121, %95, %80, %54, %39
%140 = load i32*, i32** %8
ret i32* %140
}

LLVM IR (-O2):
@__const.CL_MT_global_ziggurat_normal_floatT_create_kernel.source_string = [309 x i8] c"#define DISABLE_DOUBLES\0A#undef DISABLE_FLOATS\0A#define ZIGGURAT_NORMAL_FLOAT\0A#include \22MT_global.hcl\22\0A#ifndef __RND_WORKGROUP_SIZE\0A__kernel __ziggurat_normal_float_kernel( MT, T );\0A#else\0A__kernel __attribute__((reqd_work_group_size(__RND_WORKGROUP_SIZE, 1, 1))) __ziggurat_normal_float_kernel( MT, T );\0A#endif\00"
@CL_SUCCESS = global i32 0
@CL_CONTEXT_DEVICES = global i32 0
@CL_BUILD_IN_PROGRESS = global i64 0
@CL_PROGRAM_BUILD_STATUS = global i32 0
@CL_BUILD_SUCCESS = global i64 0
@.str = [33 x i8] c"MT_ziggurat_normal_floatT_kernel\00"
define i32* @CL_MT_global_ziggurat_normal_floatT_create_kernel(i32 %0, i64 %1, i32* %2, i8* %3, void (i32, i8*)* %4, i8* %5, i32* %6) {
%8 = alloca [309 x i8]
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
%13 = getelementptr inbounds [309 x i8], [309 x i8]* %8, i64 0, i64 0
%14 = bitcast i32* %9 to i8*
%15 = icmp eq i32* %6, null
%16 = select i1 %15, i32* %9, i32* %6
%17 = bitcast i8** %10 to i8*
store i8* %13, i8** %10
%18 = call i32 @clCreateProgramWithSource(i32 %0, i32 1, i8** %10, i32* null, i32* %16)
%19 = load i32, i32* %16
%20 = load i32, i32* @CL_SUCCESS
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %83
22: ; preds = %7
%23 = icmp eq i32* %2, null
br i1 %23, label %24, label %44
24: ; preds = %22
%25 = bitcast i64* %11 to i8*
%26 = load i32, i32* @CL_CONTEXT_DEVICES
%27 = call i32 @clGetContextInfo(i32 %0, i32 %26, i64 0, i32* null, i64* %11)
store i32 %27, i32* %16
%28 = load i32, i32* @CL_SUCCESS
%29 = icmp eq i32 %27, %28
br i1 %29, label %31, label %30
30: ; preds = %24
br label %83
31: ; preds = %24
%32 = load i64, i64* %11
%33 = lshr i64 %32, 2
%34 = add i64 %1, -1
%35 = icmp ult i64 %34, %33
%36 = select i1 %35, i64 %1, i64 %33
%37 = call i64 @malloc(i64 %32)
%38 = inttoptr i64 %37 to i32*
%39 = load i32, i32* @CL_CONTEXT_DEVICES
%40 = load i64, i64* %11
%41 = call i32 @clGetContextInfo(i32 %0, i32 %39, i64 %40, i32* %38, i64* null)
store i32 %41, i32* %16
%42 = load i32, i32* @CL_SUCCESS
%43 = icmp eq i32 %41, %42
br i1 %43, label %44, label %83
44: ; preds = %31, %22
%45 = phi i64 [ %36, %31 ], [ %1, %22 ]
%46 = phi i32* [ %38, %31 ], [ %2, %22 ]
%47 = call i32 @clBuildProgram(i32 %18, i64 %45, i32* %46, i8* %3, void (i32, i8*)* %4, i8* %5)
store i32 %47, i32* %16
%48 = load i32, i32* @CL_SUCCESS
%49 = icmp eq i32 %47, %48
br i1 %49, label %50, label %83
50: ; preds = %44
%51 = bitcast i64* %12 to i8*
%52 = load i64, i64* @CL_BUILD_IN_PROGRESS
store i64 %52, i64* %12
%53 = icmp eq i64 %45, 0
br i1 %53, label %76, label %56
54: ; preds = %70
%55 = icmp eq i64 %75, %45
br i1 %55, label %76, label %56
56: ; preds = %50, %54
%57 = phi i64 [ %71, %54 ], [ %52, %50 ]
%58 = phi i64 [ %72, %54 ], [ %52, %50 ]
%59 = phi i64 [ %75, %54 ], [ 0, %50 ]
%60 = icmp eq i64 %58, %57
br i1 %60, label %61, label %70
61: ; preds = %56
%62 = getelementptr inbounds i32, i32* %46, i64 %59
br label %63
63: ; preds = %61, %63
%64 = load i32, i32* %62
%65 = load i32, i32* @CL_PROGRAM_BUILD_STATUS
%66 = call i32 @clGetProgramBuildInfo(i32 %18, i32 %64, i32 %65, i32 8, i64* %12, i32* null)
%67 = load i64, i64* %12
%68 = load i64, i64* @CL_BUILD_IN_PROGRESS
%69 = icmp eq i64 %67, %68
br i1 %69, label %63, label %70
70: ; preds = %63, %56
%71 = phi i64 [ %57, %56 ], [ %68, %63 ]
%72 = phi i64 [ %58, %56 ], [ %67, %63 ]
%73 = load i64, i64* @CL_BUILD_SUCCESS
%74 = icmp eq i64 %72, %73
%75 = add nuw i64 %59, 1
br i1 %74, label %54, label %81
76: ; preds = %54, %50
%77 = call i32* @clCreateKernel(i32 %18, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32* %16)
%78 = call i32 @clReleaseProgram(i32 %18)
br i1 %23, label %79, label %81
79: ; preds = %76
%80 = call i32 @free(i32* %46)
br label %81
81: ; preds = %70, %76, %79
%82 = phi i32* [ %77, %79 ], [ %77, %76 ], [ null, %70 ]
br label %83
83: ; preds = %30, %81, %31, %44, %7
%84 = phi i32* [ null, %7 ], [ %82, %81 ], [ null, %31 ], [ null, %44 ], [ null, %30 ]
ret i32* %84
}