#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_int;
typedef int /*<<< orphan*/ cl_device_id;
typedef int /*<<< orphan*/ cl_context_properties;
typedef int /*<<< orphan*/ cl_context;

/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, unsigned int *);
cl_context clCreateContext(const cl_context_properties *properties,
                           cl_uint num_devices, const cl_device_id *devices,
                           void (*pfn_notify)(const char *, const void *,
                                              size_t, void *),
                           void *user_data, cl_int *errcode_ret) {
  unsigned int sys_args[6];
  sys_args[0] = (unsigned int)properties;
  sys_args[1] = (unsigned int)num_devices;
  sys_args[2] = (unsigned int)devices;
  sys_args[3] = (unsigned int)pfn_notify;
  sys_args[4] = (unsigned int)user_data;
  sys_args[5] = (unsigned int)errcode_ret;
  return (cl_context)syscall(325, 1004, sys_args);
}


x86 assembly (clang, -O0):
<clCreateContext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
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,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,-0x48(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%rax
mov    %eax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    %eax,-0x3c(%rbp)
lea    -0x50(%rbp),%rdx
mov    $0x145,%edi
mov    $0x3ec,%esi
call   1030 <syscall@plt>
add    $0x50,%rsp
pop    %rbp
ret

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

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

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