#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_mem_flags;
typedef int /*<<< orphan*/ cl_mem;
typedef int /*<<< orphan*/ cl_int;
typedef int /*<<< orphan*/ cl_image_format;
typedef scalar_t__ cl_context;

/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, unsigned int *);
cl_mem clCreateImage2D(cl_context context, cl_mem_flags flags,
                       const cl_image_format *image_format, size_t image_width,
                       size_t image_height, size_t image_row_pitch,
                       void *host_ptr, cl_int *errcode_ret) {
  unsigned int sys_args[8];
  sys_args[0] = (unsigned int)context;
  sys_args[1] = (unsigned int)flags;
  sys_args[2] = (unsigned int)image_format;
  sys_args[3] = (unsigned int)image_width;
  sys_args[4] = (unsigned int)image_height;
  sys_args[5] = (unsigned int)image_row_pitch;
  sys_args[6] = (unsigned int)host_ptr;
  sys_args[7] = (unsigned int)errcode_ret;
  return (cl_mem)syscall(325, 1016, sys_args);
}


x86 assembly (clang, -O0):
<clCreateImage2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
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,-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)
mov    0x10(%rbp),%rax
mov    %eax,-0x38(%rbp)
mov    0x18(%rbp),%rax
mov    %eax,-0x34(%rbp)
lea    -0x50(%rbp),%rdx
mov    $0x145,%edi
mov    $0x3f8,%esi
call   1030 <syscall@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clCreateImage2D>:
sub    $0x28,%rsp
mov    0x38(%rsp),%r10d
mov    0x30(%rsp),%eax
mov    %edi,(%rsp)
mov    %esi,0x4(%rsp)
mov    %edx,0x8(%rsp)
mov    %ecx,0xc(%rsp)
mov    %r8d,0x10(%rsp)
mov    %r9d,0x14(%rsp)
mov    %eax,0x18(%rsp)
mov    %r10d,0x1c(%rsp)
mov    %rsp,%rdx
mov    $0x145,%edi
mov    $0x3f8,%esi
call   1030 <syscall@plt>
add    $0x28,%rsp
ret

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

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