#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_int;
typedef scalar_t__ cl_event;

/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, unsigned int *);
cl_int clSetEventCallback(cl_event event, cl_int command_exec_callback_type,
                          void (*pfn_notify)(cl_event, cl_int, void *),
                          void *user_data) {
  unsigned int sys_args[4];
  sys_args[0] = (unsigned int)event;
  sys_args[1] = (unsigned int)command_exec_callback_type;
  sys_args[2] = (unsigned int)pfn_notify;
  sys_args[3] = (unsigned int)user_data;
  return (cl_int)syscall(325, 1049, sys_args);
}


x86 assembly (clang, -O0):
<clSetEventCallback>:
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    $0x419,%esi
call   1030 <syscall@plt>
cltq
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clSetEventCallback>:
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    $0x419,%esi
call   1030 <syscall@plt>
cltq
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i64 @clSetEventCallback(i64 %0, i64 %1, void (i64, i64, i8*)* %2, i8* %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca void (i64, i64, i8*)*
%8 = alloca i8*
%9 = alloca [4 x i32]
store i64 %0, i64* %5
store i64 %1, i64* %6
store void (i64, i64, i8*)* %2, void (i64, i64, i8*)** %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 void (i64, i64, i8*)*, void (i64, i64, i8*)** %7
%17 = ptrtoint void (i64, i64, i8*)* %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 1049, i32* %22)
%24 = sext i32 %23 to i64
ret i64 %24
}

LLVM IR (-O2):
define i64 @clSetEventCallback(i64 %0, i64 %1, void (i64, i64, i8*)* %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 = ptrtoint void (i64, i64, i8*)* %2 to i64
%12 = trunc i64 %11 to i32
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 2
store i32 %12, i32* %13
%14 = ptrtoint i8* %3 to i64
%15 = trunc i64 %14 to i32
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 3
store i32 %15, i32* %16
%17 = call i32 @syscall(i32 325, i32 1049, i32* %8)
%18 = sext i32 %17 to i64
ret i64 %18
}