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

/* Variables and functions */
scalar_t__ CL_SUCCESS;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ *clCreateKernel(int /*<<< orphan*/, char *, scalar_t__ *);
int CreateKernel(cl_kernel *kernel, cl_context ctx, cl_program program) {
  cl_int status = 0;
  *kernel = clCreateKernel(program, "VectorAddKernel", &status);
  assert(status == CL_SUCCESS);
  assert(*kernel != NULL);
  return 0;
}


x86 assembly (clang, -O0):
<CreateKernel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%edi
lea    0xebc(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <clCreateKernel@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreateKernel>:
push   %rbx
sub    $0x10,%rsp
mov    %edx,%eax
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
lea    0xec6(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %eax,%edi
call   1040 <clCreateKernel@plt>
mov    %rax,(%rbx)
mov    0x8(%rsp),%rax
mov    0x2e8b(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpq   $0x0,(%rbx)
setne  %dil
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"VectorAddKernel\00"
@CL_SUCCESS = global i64 0
define i32 @CreateKernel(i32** %0, i32 %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i32** %0, i32*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i64 0, i64* %7
%8 = load i32, i32* %6
%9 = call i32* @clCreateKernel(i32 %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64* %7)
%10 = load i32**, i32*** %4
store i32* %9, i32** %10
%11 = load i64, i64* %7
%12 = load i64, i64* @CL_SUCCESS
%13 = icmp eq i64 %11, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i32**, i32*** %4
%17 = load i32*, i32** %16
%18 = icmp ne i32* %17, null
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"VectorAddKernel\00"
@CL_SUCCESS = global i64 0
define i32 @CreateKernel(i32** nocapture %0, i32 %1, i32 %2) {
%4 = alloca i64
%5 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%6 = call i32* @clCreateKernel(i32 %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64* %4)
store i32* %6, i32** %0
%7 = load i64, i64* %4
%8 = load i64, i64* @CL_SUCCESS
%9 = icmp eq i64 %7, %8
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32*, i32** %0
%13 = icmp ne i32* %12, null
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
ret i32 0
}