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

/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, unsigned int *);
cl_int clSetKernelArg(cl_kernel kernel, cl_uint arg_index, size_t arg_size,
                      const void *arg_value) {
  unsigned int sys_args[4];
  sys_args[0] = (unsigned int)kernel;
  sys_args[1] = (unsigned int)arg_index;
  sys_args[2] = (unsigned int)arg_size;
  sys_args[3] = (unsigned int)arg_value;
  return (cl_int)syscall(325, 1040, sys_args);
}


x86 assembly (clang, -O0):
<clSetKernelArg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,-0x24(%rbp)
lea    -0x30(%rbp),%rdx
mov    $0x145,%edi
mov    $0x410,%esi
call   1030 <syscall@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clSetKernelArg>:
sub    $0x18,%rsp
mov    %edi,(%rsp)
mov    %esi,0x4(%rsp)
mov    %edx,0x8(%rsp)
mov    %ecx,0xc(%rsp)
mov    %rsp,%rdx
mov    $0x145,%edi
mov    $0x410,%esi
call   1030 <syscall@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @clSetKernelArg(i64 %0, i64 %1, i64 %2, i8* %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca [4 x i32]
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i8* %3, i8** %8
%10 = load i64, i64* %5
%11 = trunc i64 %10 to i32
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
store i32 %11, i32* %12
%13 = load i64, i64* %6
%14 = trunc i64 %13 to i32
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
store i32 %14, i32* %15
%16 = load i64, i64* %7
%17 = trunc i64 %16 to i32
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 2
store i32 %17, i32* %18
%19 = load i8*, i8** %8
%20 = ptrtoint i8* %19 to i32
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 3
store i32 %20, i32* %21
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%23 = call i32 @syscall(i32 325, i32 1040, i32* %22)
ret i32 %23
}

LLVM IR (-O2):
define i32 @clSetKernelArg(i64 %0, i64 %1, i64 %2, i8* %3) {
%5 = alloca [4 x i32]
%6 = bitcast [4 x i32]* %5 to i8*
%7 = trunc i64 %0 to i32
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
store i32 %7, i32* %8
%9 = trunc i64 %1 to i32
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 1
store i32 %9, i32* %10
%11 = trunc i64 %2 to i32
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 2
store i32 %11, i32* %12
%13 = ptrtoint i8* %3 to i64
%14 = trunc i64 %13 to i32
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 3
store i32 %14, i32* %15
%16 = call i32 @syscall(i32 325, i32 1040, i32* %8)
ret i32 %16
}