#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;

/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, unsigned int *);
cl_int clEnqueueCopyBufferToImage(cl_command_queue command_queue,
                                  cl_mem src_buffer, cl_mem dst_image,
                                  size_t src_offset, const size_t *dst_origin3,
                                  const size_t *region3,
                                  cl_uint num_events_in_wait_list,
                                  const cl_event *event_wait_list,
                                  cl_event *event) {
  unsigned int sys_args[9];
  sys_args[0] = (unsigned int)command_queue;
  sys_args[1] = (unsigned int)src_buffer;
  sys_args[2] = (unsigned int)dst_image;
  sys_args[3] = (unsigned int)src_offset;
  sys_args[4] = (unsigned int)dst_origin3;
  sys_args[5] = (unsigned int)region3;
  sys_args[6] = (unsigned int)num_events_in_wait_list;
  sys_args[7] = (unsigned int)event_wait_list;
  sys_args[8] = (unsigned int)event;
  return (cl_int)syscall(325, 1063, sys_args);
}


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

x86 assembly (clang, -O2):
<clEnqueueCopyBufferToImage>:
sub    $0x28,%rsp
mov    0x40(%rsp),%r10d
mov    0x38(%rsp),%r11d
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    %r11d,0x1c(%rsp)
mov    %r10d,0x20(%rsp)
mov    %rsp,%rdx
mov    $0x145,%edi
mov    $0x427,%esi
call   1030 <syscall@plt>
add    $0x28,%rsp
ret

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

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