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

/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, unsigned int *);
cl_context clCreateContextFromType(
    const cl_context_properties *properties, cl_device_type device_type,
    void (*pfn_notify)(const char *, const void *, size_t, void *),
    void *user_data, cl_int *errcode_ret) {
  unsigned int sys_args[5];
  sys_args[0] = (unsigned int)properties;
  sys_args[1] = (unsigned int)device_type;
  sys_args[2] = (unsigned int)pfn_notify;
  sys_args[3] = (unsigned int)user_data;
  sys_args[4] = (unsigned int)errcode_ret;
  return (cl_context)syscall(325, 1005, sys_args);
}


x86 assembly (clang, -O0):
<clCreateContextFromType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    %eax,-0x30(%rbp)
lea    -0x40(%rbp),%rdx
mov    $0x145,%edi
mov    $0x3ed,%esi
call   1030 <syscall@plt>
add    $0x40,%rsp
pop    %rbp
ret

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

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

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