#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 int /*<<< orphan*/ cl_mem;
typedef int /*<<< orphan*/ cl_int;
typedef int /*<<< orphan*/ cl_event;
typedef scalar_t__ cl_command_queue;

/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, unsigned int *);
cl_int clEnqueueNativeKernel(cl_command_queue command_queue,
                             void (*user_func)(void *), void *args,
                             size_t cb_args, cl_uint num_mem_objects,
                             const cl_mem *mem_list, const void **args_mem_loc,
                             cl_uint num_events_in_wait_list,
                             const cl_event *event_wait_list, cl_event *event) {
  unsigned int sys_args[10];
  sys_args[0] = (unsigned int)command_queue;
  sys_args[1] = (unsigned int)user_func;
  sys_args[2] = (unsigned int)args;
  sys_args[3] = (unsigned int)cb_args;
  sys_args[4] = (unsigned int)num_mem_objects;
  sys_args[5] = (unsigned int)mem_list;
  sys_args[6] = (unsigned int)args_mem_loc;
  sys_args[7] = (unsigned int)num_events_in_wait_list;
  sys_args[8] = (unsigned int)event_wait_list;
  sys_args[9] = (unsigned int)event;
  return (cl_int)syscall(325, 1069, sys_args);
}


x86 assembly (clang, -O0):
<clEnqueueNativeKernel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,-0x58(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,-0x54(%rbp)
mov    -0x28(%rbp),%rax
mov    %eax,-0x50(%rbp)
mov    -0x30(%rbp),%rax
mov    %eax,-0x4c(%rbp)
mov    0x10(%rbp),%rax
mov    %eax,-0x48(%rbp)
mov    0x18(%rbp),%rax
mov    %eax,-0x44(%rbp)
mov    0x20(%rbp),%rax
mov    %eax,-0x40(%rbp)
mov    0x28(%rbp),%rax
mov    %eax,-0x3c(%rbp)
lea    -0x60(%rbp),%rdx
mov    $0x145,%edi
mov    $0x42d,%esi
call   1030 <syscall@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clEnqueueNativeKernel>:
push   %rbx
sub    $0x30,%rsp
mov    0x58(%rsp),%r10d
mov    0x50(%rsp),%r11d
mov    0x48(%rsp),%eax
mov    0x40(%rsp),%ebx
mov    %edi,(%rsp)
mov    %esi,0x4(%rsp)
mov    %edx,0x8(%rsp)
mov    %ecx,0xc(%rsp)
mov    %r8d,0x10(%rsp)
mov    %r9d,0x14(%rsp)
mov    %ebx,0x18(%rsp)
mov    %eax,0x1c(%rsp)
mov    %r11d,0x20(%rsp)
mov    %r10d,0x24(%rsp)
mov    %rsp,%rdx
mov    $0x145,%edi
mov    $0x42d,%esi
call   1030 <syscall@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @clEnqueueNativeKernel(i64 %0, void (i8*)* %1, i8* %2, i64 %3, i64 %4, i32* %5, i8** %6, i64 %7, i32* %8, i32* %9) {
%11 = alloca i64
%12 = alloca void (i8*)*
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i64
%16 = alloca i32*
%17 = alloca i8**
%18 = alloca i64
%19 = alloca i32*
%20 = alloca i32*
%21 = alloca [10 x i32]
store i64 %0, i64* %11
store void (i8*)* %1, void (i8*)** %12
store i8* %2, i8** %13
store i64 %3, i64* %14
store i64 %4, i64* %15
store i32* %5, i32** %16
store i8** %6, i8*** %17
store i64 %7, i64* %18
store i32* %8, i32** %19
store i32* %9, i32** %20
%22 = load i64, i64* %11
%23 = trunc i64 %22 to i32
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %21, i64 0, i64 0
store i32 %23, i32* %24
%25 = load void (i8*)*, void (i8*)** %12
%26 = ptrtoint void (i8*)* %25 to i32
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %21, i64 0, i64 1
store i32 %26, i32* %27
%28 = load i8*, i8** %13
%29 = ptrtoint i8* %28 to i32
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %21, i64 0, i64 2
store i32 %29, i32* %30
%31 = load i64, i64* %14
%32 = trunc i64 %31 to i32
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %21, i64 0, i64 3
store i32 %32, i32* %33
%34 = load i64, i64* %15
%35 = trunc i64 %34 to i32
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %21, i64 0, i64 4
store i32 %35, i32* %36
%37 = load i32*, i32** %16
%38 = ptrtoint i32* %37 to i32
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %21, i64 0, i64 5
store i32 %38, i32* %39
%40 = load i8**, i8*** %17
%41 = ptrtoint i8** %40 to i32
%42 = getelementptr inbounds [10 x i32], [10 x i32]* %21, i64 0, i64 6
store i32 %41, i32* %42
%43 = load i64, i64* %18
%44 = trunc i64 %43 to i32
%45 = getelementptr inbounds [10 x i32], [10 x i32]* %21, i64 0, i64 7
store i32 %44, i32* %45
%46 = load i32*, i32** %19
%47 = ptrtoint i32* %46 to i32
%48 = getelementptr inbounds [10 x i32], [10 x i32]* %21, i64 0, i64 8
store i32 %47, i32* %48
%49 = load i32*, i32** %20
%50 = ptrtoint i32* %49 to i32
%51 = getelementptr inbounds [10 x i32], [10 x i32]* %21, i64 0, i64 9
store i32 %50, i32* %51
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %21, i64 0, i64 0
%53 = call i32 @syscall(i32 325, i32 1069, i32* %52)
ret i32 %53
}

LLVM IR (-O2):
define i32 @clEnqueueNativeKernel(i64 %0, void (i8*)* %1, i8* %2, i64 %3, i64 %4, i32* %5, i8** %6, i64 %7, i32* %8, i32* %9) {
%11 = alloca [10 x i32]
%12 = bitcast [10 x i32]* %11 to i8*
%13 = trunc i64 %0 to i32
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %11, i64 0, i64 0
store i32 %13, i32* %14
%15 = ptrtoint void (i8*)* %1 to i64
%16 = trunc i64 %15 to i32
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %11, i64 0, i64 1
store i32 %16, i32* %17
%18 = ptrtoint i8* %2 to i64
%19 = trunc i64 %18 to i32
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %11, i64 0, i64 2
store i32 %19, i32* %20
%21 = trunc i64 %3 to i32
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %11, i64 0, i64 3
store i32 %21, i32* %22
%23 = trunc i64 %4 to i32
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %11, i64 0, i64 4
store i32 %23, i32* %24
%25 = ptrtoint i32* %5 to i64
%26 = trunc i64 %25 to i32
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %11, i64 0, i64 5
store i32 %26, i32* %27
%28 = ptrtoint i8** %6 to i64
%29 = trunc i64 %28 to i32
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %11, i64 0, i64 6
store i32 %29, i32* %30
%31 = trunc i64 %7 to i32
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %11, i64 0, i64 7
store i32 %31, i32* %32
%33 = ptrtoint i32* %8 to i64
%34 = trunc i64 %33 to i32
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %11, i64 0, i64 8
store i32 %34, i32* %35
%36 = ptrtoint i32* %9 to i64
%37 = trunc i64 %36 to i32
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %11, i64 0, i64 9
store i32 %37, i32* %38
%39 = call i32 @syscall(i32 325, i32 1069, i32* %14)
ret i32 %39
}