#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_sampler;
typedef int /*<<< orphan*/ cl_int;
typedef scalar_t__ cl_filter_mode;
typedef scalar_t__ cl_context;
typedef scalar_t__ cl_bool;
typedef scalar_t__ cl_addressing_mode;

/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, unsigned int *);
cl_sampler clCreateSampler(cl_context context, cl_bool normalized_coords,
                           cl_addressing_mode addressing_mode,
                           cl_filter_mode filter_mode, cl_int *errcode_ret) {
  unsigned int sys_args[5];
  sys_args[0] = (unsigned int)context;
  sys_args[1] = (unsigned int)normalized_coords;
  sys_args[2] = (unsigned int)addressing_mode;
  sys_args[3] = (unsigned int)filter_mode;
  sys_args[4] = (unsigned int)errcode_ret;
  return (cl_sampler)syscall(325, 1024, sys_args);
}


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

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

LLVM IR (-O0):
define i32 @clCreateSampler(i64 %0, i64 %1, i64 %2, i64 %3, i32* %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32*
%11 = alloca [5 x i32]
store i64 %0, i64* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i32* %4, i32** %10
%12 = load i64, i64* %6
%13 = trunc i64 %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 i64, i64* %8
%19 = trunc i64 %18 to i32
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %11, i64 0, i64 2
store i32 %19, i32* %20
%21 = load i64, i64* %9
%22 = trunc i64 %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 1024, i32* %27)
ret i32 %28
}

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