#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 scalar_t__ cl_mem;
typedef int /*<<< orphan*/ cl_int;
typedef int /*<<< orphan*/ cl_event;
typedef scalar_t__ cl_command_queue;
typedef scalar_t__ cl_bool;

/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, unsigned int *);
cl_int
clEnqueueReadBufferRect(cl_command_queue command_queue, cl_mem buffer,
                        cl_bool blocking_read, const size_t *buffer_origin,
                        const size_t *host_origin, const size_t *region,
                        size_t buffer_row_pitch, size_t buffer_slice_pitch,
                        size_t host_row_pitch, size_t host_slice_pitch,
                        void *ptr, cl_uint num_events_in_wait_list,
                        const cl_event *event_wait_list, cl_event *event) {
  unsigned int sys_args[14];
  sys_args[0] = (unsigned int)command_queue;
  sys_args[1] = (unsigned int)buffer;
  sys_args[2] = (unsigned int)blocking_read;
  sys_args[3] = (unsigned int)buffer_origin;
  sys_args[4] = (unsigned int)host_origin;
  sys_args[5] = (unsigned int)region;
  sys_args[6] = (unsigned int)buffer_row_pitch;
  sys_args[7] = (unsigned int)buffer_slice_pitch;
  sys_args[8] = (unsigned int)host_row_pitch;
  sys_args[9] = (unsigned int)host_slice_pitch;
  sys_args[10] = (unsigned int)ptr;
  sys_args[11] = (unsigned int)num_events_in_wait_list;
  sys_args[12] = (unsigned int)event_wait_list;
  sys_args[13] = (unsigned int)event;
  return (cl_int)syscall(325, 1054, sys_args);
}


x86 assembly (clang, -O0):
<clEnqueueReadBufferRect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x48(%rbp),%rax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
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,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x6c(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,-0x68(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,-0x64(%rbp)
mov    -0x28(%rbp),%rax
mov    %eax,-0x60(%rbp)
mov    -0x30(%rbp),%rax
mov    %eax,-0x5c(%rbp)
mov    0x10(%rbp),%rax
mov    %eax,-0x58(%rbp)
mov    0x18(%rbp),%rax
mov    %eax,-0x54(%rbp)
mov    0x20(%rbp),%rax
mov    %eax,-0x50(%rbp)
mov    0x28(%rbp),%rax
mov    %eax,-0x4c(%rbp)
mov    0x30(%rbp),%rax
mov    %eax,-0x48(%rbp)
mov    0x38(%rbp),%rax
mov    %eax,-0x44(%rbp)
mov    0x40(%rbp),%rax
mov    %eax,-0x40(%rbp)
mov    0x48(%rbp),%rax
mov    %eax,-0x3c(%rbp)
lea    -0x70(%rbp),%rdx
mov    $0x145,%edi
mov    $0x41e,%esi
call   1030 <syscall@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clEnqueueReadBufferRect>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    0xa8(%rsp),%r10d
mov    0xa0(%rsp),%r11d
mov    0x98(%rsp),%r14d
mov    0x90(%rsp),%r15d
mov    0x88(%rsp),%r12d
mov    0x80(%rsp),%eax
mov    0x78(%rsp),%ebx
mov    0x70(%rsp),%ebp
mov    %edi,(%rsp)
mov    %esi,0x4(%rsp)
mov    %edx,0x8(%rsp)
mov    %ecx,0xc(%rsp)
mov    %r8d,0x10(%rsp)
mov    %r9d,0x14(%rsp)
mov    %ebp,0x18(%rsp)
mov    %ebx,0x1c(%rsp)
mov    %eax,0x20(%rsp)
mov    %r12d,0x24(%rsp)
mov    %r15d,0x28(%rsp)
mov    %r14d,0x2c(%rsp)
mov    %r11d,0x30(%rsp)
mov    %r10d,0x34(%rsp)
mov    %rsp,%rdx
mov    $0x145,%edi
mov    $0x41e,%esi
call   1030 <syscall@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @clEnqueueReadBufferRect(i64 %0, i64 %1, i64 %2, i64* %3, i64* %4, i64* %5, i64 %6, i64 %7, i64 %8, i64 %9, i8* %10, i64 %11, i32* %12, i32* %13) {
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64*
%19 = alloca i64*
%20 = alloca i64*
%21 = alloca i64
%22 = alloca i64
%23 = alloca i64
%24 = alloca i64
%25 = alloca i8*
%26 = alloca i64
%27 = alloca i32*
%28 = alloca i32*
%29 = alloca [14 x i32]
store i64 %0, i64* %15
store i64 %1, i64* %16
store i64 %2, i64* %17
store i64* %3, i64** %18
store i64* %4, i64** %19
store i64* %5, i64** %20
store i64 %6, i64* %21
store i64 %7, i64* %22
store i64 %8, i64* %23
store i64 %9, i64* %24
store i8* %10, i8** %25
store i64 %11, i64* %26
store i32* %12, i32** %27
store i32* %13, i32** %28
%30 = load i64, i64* %15
%31 = trunc i64 %30 to i32
%32 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 0
store i32 %31, i32* %32
%33 = load i64, i64* %16
%34 = trunc i64 %33 to i32
%35 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 1
store i32 %34, i32* %35
%36 = load i64, i64* %17
%37 = trunc i64 %36 to i32
%38 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 2
store i32 %37, i32* %38
%39 = load i64*, i64** %18
%40 = ptrtoint i64* %39 to i32
%41 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 3
store i32 %40, i32* %41
%42 = load i64*, i64** %19
%43 = ptrtoint i64* %42 to i32
%44 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 4
store i32 %43, i32* %44
%45 = load i64*, i64** %20
%46 = ptrtoint i64* %45 to i32
%47 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 5
store i32 %46, i32* %47
%48 = load i64, i64* %21
%49 = trunc i64 %48 to i32
%50 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 6
store i32 %49, i32* %50
%51 = load i64, i64* %22
%52 = trunc i64 %51 to i32
%53 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 7
store i32 %52, i32* %53
%54 = load i64, i64* %23
%55 = trunc i64 %54 to i32
%56 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 8
store i32 %55, i32* %56
%57 = load i64, i64* %24
%58 = trunc i64 %57 to i32
%59 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 9
store i32 %58, i32* %59
%60 = load i8*, i8** %25
%61 = ptrtoint i8* %60 to i32
%62 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 10
store i32 %61, i32* %62
%63 = load i64, i64* %26
%64 = trunc i64 %63 to i32
%65 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 11
store i32 %64, i32* %65
%66 = load i32*, i32** %27
%67 = ptrtoint i32* %66 to i32
%68 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 12
store i32 %67, i32* %68
%69 = load i32*, i32** %28
%70 = ptrtoint i32* %69 to i32
%71 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 13
store i32 %70, i32* %71
%72 = getelementptr inbounds [14 x i32], [14 x i32]* %29, i64 0, i64 0
%73 = call i32 @syscall(i32 325, i32 1054, i32* %72)
ret i32 %73
}

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