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

/* Variables and functions */
scalar_t__ CL_SUCCESS;
int /*<<< orphan*/ assert(int);
scalar_t__ clSetKernelArg(int /*<<< orphan*/, int, int, void *);
int SetKernelArg(cl_kernel kernel, cl_mem c_dev, cl_mem a_dev, cl_mem b_dev,
                 int num_elem) {
  cl_int status = 0;
  status = clSetKernelArg(kernel, 0, sizeof(cl_mem), (void *)&c_dev);
  assert(status == CL_SUCCESS);
  status = clSetKernelArg(kernel, 1, sizeof(cl_mem), (void *)&a_dev);
  assert(status == CL_SUCCESS);
  status = clSetKernelArg(kernel, 2, sizeof(cl_mem), (void *)&b_dev);
  assert(status == CL_SUCCESS);
  status = clSetKernelArg(kernel, 3, sizeof(int), (void *)&num_elem);
  assert(status == CL_SUCCESS);
  return 0;
}


x86 assembly (clang, -O0):
<SetKernelArg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rcx
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <clSetKernelArg@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%edi
lea    -0xc(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <clSetKernelArg@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2e49(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rcx
mov    $0x2,%esi
mov    $0x4,%edx
call   1040 <clSetKernelArg@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2e14(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rcx
mov    $0x3,%esi
mov    $0x4,%edx
call   1040 <clSetKernelArg@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2ddf(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetKernelArg>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
mov    %esi,0x14(%rsp)
mov    %edx,0x10(%rsp)
mov    %ecx,0xc(%rsp)
mov    %r8d,0x8(%rsp)
lea    0x14(%rsp),%rcx
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <clSetKernelArg@plt>
mov    0x2e8e(%rip),%r14
xor    %edi,%edi
cmp    (%r14),%rax
sete   %dil
call   1030 <assert@plt>
lea    0x10(%rsp),%rcx
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <clSetKernelArg@plt>
xor    %edi,%edi
cmp    (%r14),%rax
sete   %dil
call   1030 <assert@plt>
lea    0xc(%rsp),%rcx
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1040 <clSetKernelArg@plt>
xor    %edi,%edi
cmp    (%r14),%rax
sete   %dil
call   1030 <assert@plt>
lea    0x8(%rsp),%rcx
mov    %ebx,%edi
mov    $0x3,%esi
mov    $0x4,%edx
call   1040 <clSetKernelArg@plt>
xor    %edi,%edi
cmp    (%r14),%rax
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@CL_SUCCESS = global i64 0
define i32 @SetKernelArg(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i64 0, i64* %11
%12 = load i32, i32* %6
%13 = bitcast i32* %7 to i8*
%14 = call i64 @clSetKernelArg(i32 %12, i32 0, i32 4, i8* %13)
store i64 %14, i64* %11
%15 = load i64, i64* %11
%16 = load i64, i64* @CL_SUCCESS
%17 = icmp eq i64 %15, %16
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i32, i32* %6
%21 = bitcast i32* %8 to i8*
%22 = call i64 @clSetKernelArg(i32 %20, i32 1, i32 4, i8* %21)
store i64 %22, i64* %11
%23 = load i64, i64* %11
%24 = load i64, i64* @CL_SUCCESS
%25 = icmp eq i64 %23, %24
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = load i32, i32* %6
%29 = bitcast i32* %9 to i8*
%30 = call i64 @clSetKernelArg(i32 %28, i32 2, i32 4, i8* %29)
store i64 %30, i64* %11
%31 = load i64, i64* %11
%32 = load i64, i64* @CL_SUCCESS
%33 = icmp eq i64 %31, %32
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = load i32, i32* %6
%37 = bitcast i32* %10 to i8*
%38 = call i64 @clSetKernelArg(i32 %36, i32 3, i32 4, i8* %37)
store i64 %38, i64* %11
%39 = load i64, i64* %11
%40 = load i64, i64* @CL_SUCCESS
%41 = icmp eq i64 %39, %40
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
ret i32 0
}

LLVM IR (-O2):
@CL_SUCCESS = global i64 0
define i32 @SetKernelArg(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 %4, i32* %9
%10 = bitcast i32* %6 to i8*
%11 = call i64 @clSetKernelArg(i32 %0, i32 0, i32 4, i8* %10)
%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 = bitcast i32* %7 to i8*
%17 = call i64 @clSetKernelArg(i32 %0, i32 1, i32 4, i8* %16)
%18 = load i64, i64* @CL_SUCCESS
%19 = icmp eq i64 %17, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = bitcast i32* %8 to i8*
%23 = call i64 @clSetKernelArg(i32 %0, i32 2, i32 4, i8* %22)
%24 = load i64, i64* @CL_SUCCESS
%25 = icmp eq i64 %23, %24
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = bitcast i32* %9 to i8*
%29 = call i64 @clSetKernelArg(i32 %0, i32 3, i32 4, i8* %28)
%30 = load i64, i64* @CL_SUCCESS
%31 = icmp eq i64 %29, %30
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
ret i32 0
}