#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*/ platform_name;
typedef int /*<<< orphan*/ device_name;
typedef char cl_ushort;
typedef int cl_uint;
typedef int /*<<< orphan*/ cl_program;
typedef int /*<<< orphan*/ cl_platform_id;
typedef int /*<<< orphan*/ cl_mem;
typedef int /*<<< orphan*/ cl_kernel;
typedef int /*<<< orphan*/ cl_int;
typedef int /*<<< orphan*/ cl_device_id;
typedef int /*<<< orphan*/ cl_context;
typedef int /*<<< orphan*/ cl_command_queue;

/* Variables and functions */
int /*<<< orphan*/ CL_DEVICE_NAME;
int /*<<< orphan*/ CL_DEVICE_TYPE_GPU;
int /*<<< orphan*/ CL_MEM_READ_ONLY;
int /*<<< orphan*/ CL_MEM_WRITE_ONLY;
int /*<<< orphan*/ CL_PLATFORM_NAME;
int /*<<< orphan*/ CL_PROGRAM_BUILD_LOG;
int /*<<< orphan*/ CL_SUCCESS;
int /*<<< orphan*/ CL_TRUE;
int /*<<< orphan*/ clBuildProgram(int /*<<< orphan*/, int, int /*<<< orphan*/ *,
                                  int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  int /*<<< orphan*/ *);
int /*<<< orphan*/ clCreateBuffer(int /*<<< orphan*/, int /*<<< orphan*/,
                                  size_t, int /*<<< orphan*/ *,
                                  int /*<<< orphan*/ *);
int /*<<< orphan*/ clCreateCommandQueue(int /*<<< orphan*/, int /*<<< orphan*/,
                                        int /*<<< orphan*/,
                                        int /*<<< orphan*/ *);
int /*<<< orphan*/ clCreateContext(int /*<<< orphan*/ *, int,
                                   int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                   int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ clCreateKernel(int /*<<< orphan*/, char *,
                                  int /*<<< orphan*/ *);
int /*<<< orphan*/ clCreateProgramWithSource(int /*<<< orphan*/, int,
                                             char const **, size_t *,
                                             int /*<<< orphan*/ *);
int /*<<< orphan*/ clEnqueueNDRangeKernel(
    int /*<<< orphan*/, int /*<<< orphan*/, int, int /*<<< orphan*/ *, size_t *,
    size_t *, int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ clEnqueueReadBuffer(int /*<<< orphan*/, int /*<<< orphan*/,
                                       int /*<<< orphan*/, int /*<<< orphan*/,
                                       size_t, char *, int /*<<< orphan*/,
                                       int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ clEnqueueWriteBuffer(int /*<<< orphan*/, int /*<<< orphan*/,
                                        int /*<<< orphan*/, int /*<<< orphan*/,
                                        size_t, char *, int /*<<< orphan*/,
                                        int /*<<< orphan*/ *,
                                        int /*<<< orphan*/ *);
int /*<<< orphan*/ clFinish(int /*<<< orphan*/);
int /*<<< orphan*/ clGetDeviceIDs(int /*<<< orphan*/, int /*<<< orphan*/, int,
                                  int /*<<< orphan*/ *, int *);
int /*<<< orphan*/ clGetDeviceInfo(int /*<<< orphan*/, int /*<<< orphan*/, int,
                                   char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ clGetPlatformIDs(int, int /*<<< orphan*/ *, int *);
int /*<<< orphan*/ clGetPlatformInfo(int /*<<< orphan*/, int /*<<< orphan*/,
                                     int, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ clGetProgramBuildInfo(int /*<<< orphan*/, int /*<<< orphan*/,
                                         int /*<<< orphan*/, size_t, char *,
                                         size_t *);
int /*<<< orphan*/ clReleaseCommandQueue(int /*<<< orphan*/);
int /*<<< orphan*/ clReleaseContext(int /*<<< orphan*/);
int /*<<< orphan*/ clReleaseKernel(int /*<<< orphan*/);
int /*<<< orphan*/ clReleaseMemObject(int /*<<< orphan*/);
int /*<<< orphan*/ clReleaseProgram(int /*<<< orphan*/);
int /*<<< orphan*/ clSetKernelArg(int /*<<< orphan*/, int, int,
                                  int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(char *);
char *malloc(size_t);
int /*<<< orphan*/ memset(void *, int, size_t);
int /*<<< orphan*/ printf(char *, ...);
unsigned char *read_buffer(char *, size_t *);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
int /*<<< orphan*/ write_buffer(char *, char const *, size_t);
int main(int argc, char const *argv[]) {
  cl_platform_id platform;
  cl_uint num_platforms;
  cl_int ret = clGetPlatformIDs(1, &platform, &num_platforms);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clGetPlatformIDs' failed\n");
    exit(1);
  }
  printf("Number of platforms: %d\n", num_platforms);
  printf("platform=%p\n", platform);
  char platform_name[100];
  ret = clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(platform_name),
                          platform_name, NULL);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clGetPlatformInfo' failed\n");
    exit(1);
  }
  printf("platform.name='%s'\n\n", platform_name);
  cl_device_id device;
  cl_uint num_devices;
  ret = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, &num_devices);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clGetDeviceIDs' failed\n");
    exit(1);
  }
  printf("Number of devices: %d\n", num_devices);
  printf("device=%p\n", device);
  char device_name[100];
  ret = clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(device_name),
                        device_name, NULL);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clGetDeviceInfo' failed\n");
    exit(1);
  }
  printf("device.name='%s'\n", device_name);
  printf("\n");
  cl_context context;
  context = clCreateContext(NULL, 1, &device, NULL, NULL, &ret);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clCreateContext' failed\n");
    exit(1);
  }
  printf("context=%p\n", context);
  cl_command_queue command_queue;
  command_queue = clCreateCommandQueue(context, device, 0, &ret);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clCreateCommandQueue' failed\n");
    exit(1);
  }
  printf("command_queue=%p\n", command_queue);
  printf("\n");
  unsigned char *source_code;
  size_t source_length;
  source_code = read_buffer("add_ushortushort.cl", &source_length);
  cl_program program;
  program = clCreateProgramWithSource(context, 1, (const char **)&source_code,
                                      &source_length, &ret);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clCreateProgramWithSource' failed\n");
    exit(1);
  }
  printf("program=%p\n", program);
  ret = clBuildProgram(program, 1, &device, NULL, NULL, NULL);
  if (ret != CL_SUCCESS) {
    size_t size;
    char *log;
    clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, 0, NULL,
                          &size);
    log = malloc(size);
    clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, size, log,
                          NULL);
    printf("error: call to 'clBuildProgram' failed:\n%s\n", log);
    free(log);
    exit(1);
  }
  printf("program built\n");
  printf("\n");
  cl_kernel kernel;
  kernel = clCreateKernel(program, "add_ushortushort", &ret);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clCreateKernel' failed\n");
    exit(1);
  }
  size_t num_elem = 10;
  cl_ushort *src_0_host_buffer;
  src_0_host_buffer = malloc(num_elem * sizeof(cl_ushort));
  for (int i = 0; i < num_elem; i++)
    src_0_host_buffer[i] = (cl_ushort)(2);
  cl_mem src_0_device_buffer;
  src_0_device_buffer = clCreateBuffer(
      context, CL_MEM_READ_ONLY, num_elem * sizeof(cl_ushort), NULL, &ret);
  if (ret != CL_SUCCESS) {
    printf("error: could not create source buffer\n");
    exit(1);
  }
  ret = clEnqueueWriteBuffer(command_queue, src_0_device_buffer, CL_TRUE, 0,
                             num_elem * sizeof(cl_ushort), src_0_host_buffer, 0,
                             NULL, NULL);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clEnqueueWriteBuffer' failed\n");
    exit(1);
  }
  cl_ushort *src_1_host_buffer;
  src_1_host_buffer = malloc(num_elem * sizeof(cl_ushort));
  for (int i = 0; i < num_elem; i++)
    src_1_host_buffer[i] = (cl_ushort)(2);
  cl_mem src_1_device_buffer;
  src_1_device_buffer = clCreateBuffer(
      context, CL_MEM_READ_ONLY, num_elem * sizeof(cl_ushort), NULL, &ret);
  if (ret != CL_SUCCESS) {
    printf("error: could not create source buffer\n");
    exit(1);
  }
  ret = clEnqueueWriteBuffer(command_queue, src_1_device_buffer, CL_TRUE, 0,
                             num_elem * sizeof(cl_ushort), src_1_host_buffer, 0,
                             NULL, NULL);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clEnqueueWriteBuffer' failed\n");
    exit(1);
  }
  cl_ushort *dst_host_buffer;
  dst_host_buffer = malloc(num_elem * sizeof(cl_ushort));
  memset((void *)dst_host_buffer, 1, num_elem * sizeof(cl_ushort));
  cl_mem dst_device_buffer;
  dst_device_buffer = clCreateBuffer(context, CL_MEM_WRITE_ONLY,
                                     num_elem * sizeof(cl_ushort), NULL, &ret);
  if (ret != CL_SUCCESS) {
    printf("error: could not create dst buffer\n");
    exit(1);
  }
  ret = CL_SUCCESS;
  ret |= clSetKernelArg(kernel, 0, sizeof(cl_mem), &src_0_device_buffer);
  ret |= clSetKernelArg(kernel, 1, sizeof(cl_mem), &src_1_device_buffer);
  ret |= clSetKernelArg(kernel, 2, sizeof(cl_mem), &dst_device_buffer);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clSetKernelArg' failed\n");
    exit(1);
  }
  size_t global_work_size = num_elem;
  size_t local_work_size = num_elem;
  ret =
      clEnqueueNDRangeKernel(command_queue, kernel, 1, NULL, &global_work_size,
                             &local_work_size, 0, NULL, NULL);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clEnqueueNDRangeKernel' failed\n");
    exit(1);
  }
  clFinish(command_queue);
  ret = clEnqueueReadBuffer(command_queue, dst_device_buffer, CL_TRUE, 0,
                            num_elem * sizeof(cl_ushort), dst_host_buffer, 0,
                            NULL, NULL);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clEnqueueReadBuffer' failed\n");
    exit(1);
  }
  char dump_file[100];
  sprintf((char *)&dump_file, "%s.result", argv[0]);
  write_buffer(dump_file, (const char *)dst_host_buffer,
               num_elem * sizeof(cl_ushort));
  printf("Result dumped to %s\n", dump_file);
  free(dst_host_buffer);
  ret = clReleaseMemObject(dst_device_buffer);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clReleaseMemObject' failed\n");
    exit(1);
  }
  free(src_0_host_buffer);
  ret = clReleaseMemObject(src_0_device_buffer);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clReleaseMemObject' failed\n");
    exit(1);
  }
  free(src_1_host_buffer);
  ret = clReleaseMemObject(src_1_device_buffer);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clReleaseMemObject' failed\n");
    exit(1);
  }
  ret = clReleaseKernel(kernel);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clReleaseKernel' failed\n");
    exit(1);
  }
  ret = clReleaseProgram(program);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clReleaseProgram' failed\n");
    exit(1);
  }
  ret = clReleaseCommandQueue(command_queue);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clReleaseCommandQueue' failed\n");
    exit(1);
  }
  ret = clReleaseContext(context);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clReleaseContext' failed\n");
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   10f0 <clGetPlatformIDs@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2ca0(%rip),%rcx
cmp    (%rcx),%eax
je     1328 <main+0x58>
lea    0xce9(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x18(%rbp),%esi
lea    0xcf8(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xd00(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x14(%rbp),%edi
mov    0x2c6c(%rip),%rax
mov    (%rax),%esi
lea    -0x80(%rbp),%rcx
mov    $0x64,%edx
xor    %eax,%eax
mov    %eax,%r8d
call   1120 <clGetPlatformInfo@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2c32(%rip),%rcx
cmp    (%rcx),%eax
je     1396 <main+0xc6>
lea    0xccb(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
lea    -0x80(%rbp),%rsi
lea    0xcda(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x14(%rbp),%edi
mov    0x2c1e(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edx
lea    -0x84(%rbp),%rcx
lea    -0x88(%rbp),%r8
call   10a0 <clGetDeviceIDs@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2bcf(%rip),%rcx
cmp    (%rcx),%eax
je     13f9 <main+0x129>
lea    0xca8(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x88(%rbp),%esi
lea    0xcb2(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x84(%rbp),%esi
lea    0xcb5(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x84(%rbp),%edi
mov    0x2b8a(%rip),%rax
mov    (%rax),%esi
lea    -0xf0(%rbp),%rcx
mov    $0x64,%edx
xor    %eax,%eax
mov    %eax,%r8d
call   10b0 <clGetDeviceInfo@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2b55(%rip),%rcx
cmp    (%rcx),%eax
je     1473 <main+0x1a3>
lea    0xc78(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
lea    -0xf0(%rbp),%rsi
lea    0xc82(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
lea    0xbff(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
xor    %eax,%eax
mov    %eax,%r8d
mov    $0x1,%esi
lea    -0x84(%rbp),%rdx
lea    -0x1c(%rbp),%r9
mov    %r8,%rdi
mov    %r8,%rcx
call   1130 <clCreateContext@plt>
mov    %eax,-0xf4(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2ae2(%rip),%rcx
cmp    (%rcx),%eax
je     14e6 <main+0x216>
lea    0xc40(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0xf4(%rbp),%esi
lea    0xc4b(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0xf4(%rbp),%edi
mov    -0x84(%rbp),%esi
xor    %edx,%edx
lea    -0x1c(%rbp),%rcx
call   10e0 <clCreateCommandQueue@plt>
mov    %eax,-0xf8(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2a87(%rip),%rcx
cmp    (%rcx),%eax
je     1541 <main+0x271>
lea    0xc1a(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0xf8(%rbp),%esi
lea    0xc2a(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
lea    0xb32(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
lea    0xc20(%rip),%rdi
lea    -0x108(%rbp),%rsi
call   1150 <read_buffer@plt>
mov    %rax,-0x100(%rbp)
mov    -0xf4(%rbp),%edi
mov    $0x1,%esi
lea    -0x100(%rbp),%rdx
lea    -0x108(%rbp),%rcx
lea    -0x1c(%rbp),%r8
call   1060 <clCreateProgramWithSource@plt>
mov    %eax,-0x10c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x29f9(%rip),%rcx
cmp    (%rcx),%eax
je     15cf <main+0x2ff>
lea    0xbe0(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x10c(%rbp),%esi
lea    0xbf5(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x10c(%rbp),%edi
mov    $0x1,%esi
lea    -0x84(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%rcx
mov    %r9,%r8
call   1030 <clBuildProgram@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2996(%rip),%rcx
cmp    (%rcx),%eax
je     16ae <main+0x3de>
mov    -0x10c(%rbp),%edi
mov    -0x84(%rbp),%esi
mov    0x29ab(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%r8d
lea    -0x118(%rbp),%r9
mov    %r8,%rcx
call   1140 <clGetProgramBuildInfo@plt>
mov    -0x118(%rbp),%rdi
call   1170 <malloc@plt>
mov    %rax,-0x120(%rbp)
mov    -0x10c(%rbp),%edi
mov    -0x84(%rbp),%esi
mov    0x296f(%rip),%rax
mov    (%rax),%edx
mov    -0x118(%rbp),%rcx
mov    -0x120(%rbp),%r8
xor    %eax,%eax
mov    %eax,%r9d
call   1140 <clGetProgramBuildInfo@plt>
mov    -0x120(%rbp),%rsi
lea    0xb4c(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x120(%rbp),%rdi
call   1040 <free@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
lea    0xb54(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
lea    0x9cb(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x10c(%rbp),%edi
lea    0xb41(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   11b0 <clCreateKernel@plt>
mov    %eax,-0x124(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x28b8(%rip),%rcx
cmp    (%rcx),%eax
je     1710 <main+0x440>
lea    0xb2a(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
movq   $0xa,-0x130(%rbp)
mov    -0x130(%rbp),%rdi
shl    $0x0,%rdi
call   1170 <malloc@plt>
mov    %rax,-0x138(%rbp)
movl   $0x0,-0x13c(%rbp)
movslq -0x13c(%rbp),%rax
cmp    -0x130(%rbp),%rax
jae    1776 <main+0x4a6>
mov    -0x138(%rbp),%rax
movslq -0x13c(%rbp),%rcx
movb   $0x2,(%rax,%rcx,1)
mov    -0x13c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13c(%rbp)
jmp    173c <main+0x46c>
mov    -0xf4(%rbp),%edi
mov    0x282d(%rip),%rax
mov    (%rax),%esi
mov    -0x130(%rbp),%rdx
shl    $0x0,%rdx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x1c(%rbp),%r8
call   1080 <clCreateBuffer@plt>
mov    %eax,-0x140(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x27fb(%rip),%rcx
cmp    (%rcx),%eax
je     17cd <main+0x4fd>
lea    0xa95(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0xf8(%rbp),%edi
mov    -0x140(%rbp),%esi
mov    0x2808(%rip),%rax
mov    (%rax),%edx
mov    -0x130(%rbp),%r8
shl    $0x0,%r8
mov    -0x138(%rbp),%r9
xor    %ecx,%ecx
xor    %eax,%eax
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   11f0 <clEnqueueWriteBuffer@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2785(%rip),%rcx
cmp    (%rcx),%eax
je     1843 <main+0x573>
lea    0xa46(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x130(%rbp),%rdi
shl    $0x0,%rdi
call   1170 <malloc@plt>
mov    %rax,-0x148(%rbp)
movl   $0x0,-0x14c(%rbp)
movslq -0x14c(%rbp),%rax
cmp    -0x130(%rbp),%rax
jae    189e <main+0x5ce>
mov    -0x148(%rbp),%rax
movslq -0x14c(%rbp),%rcx
movb   $0x2,(%rax,%rcx,1)
mov    -0x14c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14c(%rbp)
jmp    1864 <main+0x594>
mov    -0xf4(%rbp),%edi
mov    0x2705(%rip),%rax
mov    (%rax),%esi
mov    -0x130(%rbp),%rdx
shl    $0x0,%rdx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x1c(%rbp),%r8
call   1080 <clCreateBuffer@plt>
mov    %eax,-0x150(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x26d3(%rip),%rcx
cmp    (%rcx),%eax
je     18f5 <main+0x625>
lea    0x96d(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0xf8(%rbp),%edi
mov    -0x150(%rbp),%esi
mov    0x26e0(%rip),%rax
mov    (%rax),%edx
mov    -0x130(%rbp),%r8
shl    $0x0,%r8
mov    -0x148(%rbp),%r9
xor    %ecx,%ecx
xor    %eax,%eax
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   11f0 <clEnqueueWriteBuffer@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x265d(%rip),%rcx
cmp    (%rcx),%eax
je     196b <main+0x69b>
lea    0x91e(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x130(%rbp),%rdi
shl    $0x0,%rdi
call   1170 <malloc@plt>
mov    %rax,-0x158(%rbp)
mov    -0x158(%rbp),%rdi
mov    -0x130(%rbp),%rdx
shl    $0x0,%rdx
mov    $0x1,%esi
call   1110 <memset@plt>
mov    -0xf4(%rbp),%edi
mov    0x2635(%rip),%rax
mov    (%rax),%esi
mov    -0x130(%rbp),%rdx
shl    $0x0,%rdx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x1c(%rbp),%r8
call   1080 <clCreateBuffer@plt>
mov    %eax,-0x15c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x25d3(%rip),%rcx
cmp    (%rcx),%eax
je     19f5 <main+0x725>
lea    0x8c2(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    0x25ac(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x124(%rbp),%edi
xor    %esi,%esi
mov    $0x4,%edx
lea    -0x140(%rbp),%rcx
call   11e0 <clSetKernelArg@plt>
or     -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x124(%rbp),%edi
mov    $0x1,%esi
mov    $0x4,%edx
lea    -0x150(%rbp),%rcx
call   11e0 <clSetKernelArg@plt>
or     -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x124(%rbp),%edi
mov    $0x2,%esi
mov    $0x4,%edx
lea    -0x15c(%rbp),%rcx
call   11e0 <clSetKernelArg@plt>
or     -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x253a(%rip),%rcx
cmp    (%rcx),%eax
je     1a8e <main+0x7be>
lea    0x84d(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x130(%rbp),%rax
mov    %rax,-0x168(%rbp)
mov    -0x130(%rbp),%rax
mov    %rax,-0x170(%rbp)
mov    -0xf8(%rbp),%edi
mov    -0x124(%rbp),%esi
mov    $0x1,%edx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x168(%rbp),%r8
lea    -0x170(%rbp),%r9
xor    %eax,%eax
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   10d0 <clEnqueueNDRangeKernel@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x24ae(%rip),%rcx
cmp    (%rcx),%eax
je     1b1a <main+0x84a>
lea    0x7e9(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0xf8(%rbp),%edi
call   1050 <clFinish@plt>
mov    -0xf8(%rbp),%edi
mov    -0x15c(%rbp),%esi
mov    0x24b0(%rip),%rax
mov    (%rax),%edx
mov    -0x130(%rbp),%r8
shl    $0x0,%r8
mov    -0x158(%rbp),%r9
xor    %ecx,%ecx
xor    %eax,%eax
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   1180 <clEnqueueReadBuffer@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x242d(%rip),%rcx
cmp    (%rcx),%eax
je     1b9b <main+0x8cb>
lea    0x798(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
lea    -0x1e0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0x79f(%rip),%rsi
call   11c0 <sprintf@plt>
lea    -0x1e0(%rbp),%rdi
mov    -0x158(%rbp),%rsi
mov    -0x130(%rbp),%rdx
shl    $0x0,%rdx
call   10c0 <write_buffer@plt>
lea    -0x1e0(%rbp),%rsi
lea    0x778(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x158(%rbp),%rdi
call   1040 <free@plt>
mov    -0x15c(%rbp),%edi
call   11a0 <clReleaseMemObject@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x239c(%rip),%rcx
cmp    (%rcx),%eax
je     1c2c <main+0x95c>
lea    0x753(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x138(%rbp),%rdi
call   1040 <free@plt>
mov    -0x140(%rbp),%edi
call   11a0 <clReleaseMemObject@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2358(%rip),%rcx
cmp    (%rcx),%eax
je     1c70 <main+0x9a0>
lea    0x70f(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x148(%rbp),%rdi
call   1040 <free@plt>
mov    -0x150(%rbp),%edi
call   11a0 <clReleaseMemObject@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2314(%rip),%rcx
cmp    (%rcx),%eax
je     1cb4 <main+0x9e4>
lea    0x6cb(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x124(%rbp),%edi
call   1070 <clReleaseKernel@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x22dc(%rip),%rcx
cmp    (%rcx),%eax
je     1cec <main+0xa1c>
lea    0x6bf(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x10c(%rbp),%edi
call   1090 <clReleaseProgram@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x22a4(%rip),%rcx
cmp    (%rcx),%eax
je     1d24 <main+0xa54>
lea    0x6b0(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0xf8(%rbp),%edi
call   1160 <clReleaseCommandQueue@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x226c(%rip),%rcx
cmp    (%rcx),%eax
je     1d5c <main+0xa8c>
lea    0x6a2(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0xf4(%rbp),%edi
call   1190 <clReleaseContext@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2234(%rip),%rcx
cmp    (%rcx),%eax
je     1d94 <main+0xac4>
lea    0x699(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1b8,%rsp
mov    %rsi,%r14
lea    0x28(%rsp),%rsi
lea    0x44(%rsp),%rdx
mov    $0x1,%edi
call   1110 <clGetPlatformIDs@plt>
mov    %eax,0x18(%rsp)
mov    0x2c85(%rip),%r13
cmp    0x0(%r13),%eax
jne    18e1 <main+0x5f1>
mov    0x44(%rsp),%esi
lea    0xcd8(%rip),%rdi
xor    %eax,%eax
call   1120 <printf@plt>
mov    0x28(%rsp),%esi
lea    0xcdf(%rip),%rdi
xor    %eax,%eax
call   1120 <printf@plt>
mov    0x28(%rsp),%edi
mov    0x2c64(%rip),%rax
mov    (%rax),%esi
lea    0x150(%rsp),%rcx
mov    $0x64,%edx
xor    %r8d,%r8d
call   1140 <clGetPlatformInfo@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    18ed <main+0x5fd>
lea    0xcae(%rip),%rdi
lea    0x150(%rsp),%rsi
xor    %eax,%eax
call   1120 <printf@plt>
mov    0x28(%rsp),%edi
mov    0x2c2e(%rip),%rax
mov    (%rax),%esi
lea    0x1c(%rsp),%rcx
lea    0x40(%rsp),%r8
mov    $0x1,%edx
call   10c0 <clGetDeviceIDs@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    18f9 <main+0x609>
mov    0x40(%rsp),%esi
lea    0xc7a(%rip),%rdi
xor    %eax,%eax
call   1120 <printf@plt>
mov    0x1c(%rsp),%esi
lea    0xc7f(%rip),%rdi
xor    %eax,%eax
call   1120 <printf@plt>
mov    0x1c(%rsp),%edi
mov    0x2bc3(%rip),%rax
mov    (%rax),%esi
lea    0xe0(%rsp),%rcx
mov    $0x64,%edx
xor    %r8d,%r8d
call   10d0 <clGetDeviceInfo@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    1905 <main+0x615>
lea    0xc4c(%rip),%rdi
lea    0xe0(%rsp),%rsi
xor    %eax,%eax
call   1120 <printf@plt>
mov    $0xa,%edi
call   1050 <putchar@plt>
lea    0x1c(%rsp),%rdx
lea    0x18(%rsp),%r9
xor    %edi,%edi
mov    $0x1,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1150 <clCreateContext@plt>
mov    %eax,%ebx
mov    0x18(%rsp),%eax
cmp    0x0(%r13),%eax
jne    1911 <main+0x621>
lea    0xc13(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1120 <printf@plt>
mov    0x1c(%rsp),%esi
lea    0x18(%rsp),%rcx
mov    %ebx,%edi
xor    %edx,%edx
call   1100 <clCreateCommandQueue@plt>
mov    %eax,%esi
mov    0x18(%rsp),%eax
cmp    0x0(%r13),%eax
jne    191d <main+0x62d>
lea    0xbed(%rip),%rdi
mov    %esi,0x30(%rsp)
xor    %eax,%eax
call   1120 <printf@plt>
mov    $0xa,%edi
call   1050 <putchar@plt>
lea    0xbe3(%rip),%rdi
lea    0x68(%rsp),%rbp
mov    %rbp,%rsi
call   1170 <read_buffer@plt>
mov    %rax,0x60(%rsp)
lea    0x60(%rsp),%rdx
lea    0x18(%rsp),%r8
mov    %ebx,%edi
mov    $0x1,%esi
mov    %rbp,%rcx
call   1070 <clCreateProgramWithSource@plt>
mov    %eax,%ebp
mov    0x18(%rsp),%eax
cmp    0x0(%r13),%eax
jne    1929 <main+0x639>
lea    0xbb5(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1120 <printf@plt>
lea    0x1c(%rsp),%rdx
mov    %ebp,%edi
mov    $0x1,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <clBuildProgram@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    1935 <main+0x645>
lea    0xbe6(%rip),%rdi
call   1080 <puts@plt>
mov    $0xa,%edi
call   1050 <putchar@plt>
lea    0xba0(%rip),%rsi
lea    0x18(%rsp),%rdx
mov    %ebp,0x3c(%rsp)
mov    %ebp,%edi
call   11d0 <clCreateKernel@plt>
mov    %eax,0x2c(%rsp)
mov    0x18(%rsp),%eax
cmp    0x0(%r13),%eax
jne    199e <main+0x6ae>
mov    $0xa,%edi
call   1190 <malloc@plt>
mov    %rax,%r12
movabs $0x202020202020202,%r15
02 02 02
mov    %r15,(%rax)
movw   $0x202,0x8(%rax)
mov    0x2a1e(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0x18(%rsp),%r8
mov    $0xa,%edx
mov    %ebx,%edi
xor    %ecx,%ecx
call   10a0 <clCreateBuffer@plt>
mov    %eax,0x38(%rsp)
mov    0x18(%rsp),%ecx
cmp    0x0(%r13),%ecx
jne    18c9 <main+0x5d9>
mov    %ebx,0x20(%rsp)
mov    0x2a23(%rip),%rcx
mov    (%rcx),%edx
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movl   $0x0,(%rsp)
mov    $0xa,%r8d
mov    0x30(%rsp),%edi
mov    %eax,%esi
xor    %ecx,%ecx
mov    %r12,%r9
call   1210 <clEnqueueWriteBuffer@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    18d5 <main+0x5e5>
mov    $0xa,%edi
call   1190 <malloc@plt>
mov    %rax,%rbx
mov    %r15,(%rax)
movw   $0x202,0x8(%rax)
mov    0x0(%rbp),%esi
lea    0x18(%rsp),%r8
mov    $0xa,%edx
mov    0x20(%rsp),%edi
xor    %ecx,%ecx
call   10a0 <clCreateBuffer@plt>
mov    %eax,0x34(%rsp)
mov    0x18(%rsp),%ecx
cmp    0x0(%r13),%ecx
jne    18c9 <main+0x5d9>
mov    0x29a7(%rip),%rcx
mov    (%rcx),%edx
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movl   $0x0,(%rsp)
mov    $0xa,%r8d
mov    0x30(%rsp),%ebp
mov    %ebp,%edi
mov    %eax,%esi
xor    %ecx,%ecx
mov    %rbx,0x48(%rsp)
mov    %rbx,%r9
call   1210 <clEnqueueWriteBuffer@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    18d5 <main+0x5e5>
mov    $0xa,%edi
call   1190 <malloc@plt>
mov    %rax,%r15
mov    $0xa,%edx
mov    %rax,%rdi
mov    $0x1,%esi
call   1130 <memset@plt>
mov    0x293d(%rip),%rax
mov    (%rax),%esi
lea    0x18(%rsp),%r8
mov    $0xa,%edx
mov    0x20(%rsp),%edi
xor    %ecx,%ecx
call   10a0 <clCreateBuffer@plt>
mov    %eax,0x24(%rsp)
mov    0x18(%rsp),%eax
cmp    0x0(%r13),%eax
mov    0x2c(%rsp),%ebx
jne    19a7 <main+0x6b7>
lea    0x38(%rsp),%rcx
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x4,%edx
call   1200 <clSetKernelArg@plt>
or     %eax,0x18(%rsp)
lea    0x34(%rsp),%rcx
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1200 <clSetKernelArg@plt>
or     %eax,0x18(%rsp)
lea    0x24(%rsp),%rcx
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1200 <clSetKernelArg@plt>
or     0x18(%rsp),%eax
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    19b0 <main+0x6c0>
movq   $0xa,0x58(%rsp)
movq   $0xa,0x50(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movl   $0x0,(%rsp)
lea    0x58(%rsp),%r8
lea    0x50(%rsp),%r9
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   10f0 <clEnqueueNDRangeKernel@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    19b9 <main+0x6c9>
mov    %ebp,%edi
call   1060 <clFinish@plt>
mov    0x24(%rsp),%esi
mov    0x2864(%rip),%rax
mov    (%rax),%edx
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movl   $0x0,(%rsp)
mov    $0xa,%r8d
mov    %ebp,%edi
xor    %ecx,%ecx
mov    %r15,%r9
call   11a0 <clEnqueueReadBuffer@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    19c2 <main+0x6d2>
mov    %r12,%rbx
mov    (%r14),%rdx
lea    0x938(%rip),%rsi
lea    0x70(%rsp),%r12
mov    %r12,%rdi
call   11e0 <sprintf@plt>
mov    $0xa,%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   10e0 <write_buffer@plt>
lea    0x91e(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1120 <printf@plt>
mov    %r15,%rdi
call   1040 <free@plt>
mov    0x24(%rsp),%edi
call   11c0 <clReleaseMemObject@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    18bd <main+0x5cd>
mov    %rbx,%rdi
call   1040 <free@plt>
mov    0x38(%rsp),%edi
call   11c0 <clReleaseMemObject@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
mov    0x2c(%rsp),%ebx
jne    18bd <main+0x5cd>
mov    0x48(%rsp),%rdi
call   1040 <free@plt>
mov    0x34(%rsp),%edi
call   11c0 <clReleaseMemObject@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    18bd <main+0x5cd>
mov    %ebx,%edi
call   1090 <clReleaseKernel@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
mov    0x20(%rsp),%ebx
jne    19cb <main+0x6db>
mov    0x3c(%rsp),%edi
call   10b0 <clReleaseProgram@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    19d4 <main+0x6e4>
mov    %ebp,%edi
call   1180 <clReleaseCommandQueue@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    19dd <main+0x6ed>
mov    %ebx,%edi
call   11b0 <clReleaseContext@plt>
mov    %eax,0x18(%rsp)
cmp    0x0(%r13),%eax
jne    19e6 <main+0x6f6>
xor    %eax,%eax
add    $0x1b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x90b(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x9fc(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x9c3(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0xb31(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0xafb(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0xac8(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0xa94(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0xa60(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0xa27(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x9e9(%rip),%rdi
jmp    19ed <main+0x6fd>
mov    0x1c(%rsp),%esi
mov    0x2698(%rip),%r14
mov    (%r14),%edx
lea    0x70(%rsp),%r9
mov    %ebp,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1160 <clGetProgramBuildInfo@plt>
mov    0x70(%rsp),%rbx
mov    %rbx,%rdi
call   1190 <malloc@plt>
mov    %ebp,%edi
mov    %rax,%rbp
mov    0x1c(%rsp),%esi
mov    (%r14),%edx
mov    %rbx,%rcx
mov    %rax,%r8
xor    %r9d,%r9d
call   1160 <clGetProgramBuildInfo@plt>
lea    0x73b(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1120 <printf@plt>
mov    %rbp,%rdi
call   1040 <free@plt>
mov    $0x1,%edi
call   11f0 <exit@plt>
lea    0x94d(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x8ce(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x89e(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x866(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x831(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x7d5(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x7a3(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x76c(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x73a(%rip),%rdi
call   1080 <puts@plt>
mov    $0x1,%edi
call   11f0 <exit@plt>

LLVM IR (-O0):
@CL_SUCCESS = global i32 0
@.str = [42 x i8] c"error: call to 'clGetPlatformIDs' failed\0A\00"
@.str.1 = [25 x i8] c"Number of platforms: %d\0A\00"
@.str.2 = [13 x i8] c"platform=%p\0A\00"
@CL_PLATFORM_NAME = global i32 0
@.str.3 = [43 x i8] c"error: call to 'clGetPlatformInfo' failed\0A\00"
@.str.4 = [21 x i8] c"platform.name='%s'\0A\0A\00"
@CL_DEVICE_TYPE_GPU = global i32 0
@.str.5 = [40 x i8] c"error: call to 'clGetDeviceIDs' failed\0A\00"
@.str.6 = [23 x i8] c"Number of devices: %d\0A\00"
@.str.7 = [11 x i8] c"device=%p\0A\00"
@CL_DEVICE_NAME = global i32 0
@.str.8 = [41 x i8] c"error: call to 'clGetDeviceInfo' failed\0A\00"
@.str.9 = [18 x i8] c"device.name='%s'\0A\00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [41 x i8] c"error: call to 'clCreateContext' failed\0A\00"
@.str.12 = [12 x i8] c"context=%p\0A\00"
@.str.13 = [46 x i8] c"error: call to 'clCreateCommandQueue' failed\0A\00"
@.str.14 = [18 x i8] c"command_queue=%p\0A\00"
@.str.15 = [20 x i8] c"add_ushortushort.cl\00"
@.str.16 = [51 x i8] c"error: call to 'clCreateProgramWithSource' failed\0A\00"
@.str.17 = [12 x i8] c"program=%p\0A\00"
@CL_PROGRAM_BUILD_LOG = global i32 0
@.str.18 = [44 x i8] c"error: call to 'clBuildProgram' failed:\0A%s\0A\00"
@.str.19 = [15 x i8] c"program built\0A\00"
@.str.20 = [17 x i8] c"add_ushortushort\00"
@.str.21 = [40 x i8] c"error: call to 'clCreateKernel' failed\0A\00"
@CL_MEM_READ_ONLY = global i32 0
@.str.22 = [39 x i8] c"error: could not create source buffer\0A\00"
@CL_TRUE = global i32 0
@.str.23 = [46 x i8] c"error: call to 'clEnqueueWriteBuffer' failed\0A\00"
@CL_MEM_WRITE_ONLY = global i32 0
@.str.24 = [36 x i8] c"error: could not create dst buffer\0A\00"
@.str.25 = [40 x i8] c"error: call to 'clSetKernelArg' failed\0A\00"
@.str.26 = [48 x i8] c"error: call to 'clEnqueueNDRangeKernel' failed\0A\00"
@.str.27 = [45 x i8] c"error: call to 'clEnqueueReadBuffer' failed\0A\00"
@.str.28 = [10 x i8] c"%s.result\00"
@.str.29 = [21 x i8] c"Result dumped to %s\0A\00"
@.str.30 = [44 x i8] c"error: call to 'clReleaseMemObject' failed\0A\00"
@.str.31 = [41 x i8] c"error: call to 'clReleaseKernel' failed\0A\00"
@.str.32 = [42 x i8] c"error: call to 'clReleaseProgram' failed\0A\00"
@.str.33 = [47 x i8] c"error: call to 'clReleaseCommandQueue' failed\0A\00"
@.str.34 = [42 x i8] c"error: call to 'clReleaseContext' failed\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [100 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca [100 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i32
%18 = alloca i64
%19 = alloca i8*
%20 = alloca i32
%21 = alloca i64
%22 = alloca i8*
%23 = alloca i32
%24 = alloca i32
%25 = alloca i8*
%26 = alloca i32
%27 = alloca i32
%28 = alloca i8*
%29 = alloca i32
%30 = alloca i64
%31 = alloca i64
%32 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%33 = call i32 @clGetPlatformIDs(i32 1, i32* %6, i32* %7)
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = load i32, i32* @CL_SUCCESS
%36 = icmp ne i32 %34, %35
br i1 %36, label %37, label %40
37: ; preds = %2
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %2
%41 = load i32, i32* %7
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %6
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %6
%46 = load i32, i32* @CL_PLATFORM_NAME
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%48 = call i32 @clGetPlatformInfo(i32 %45, i32 %46, i32 100, i8* %47, i32* null)
store i32 %48, i32* %8
%49 = load i32, i32* %8
%50 = load i32, i32* @CL_SUCCESS
%51 = icmp ne i32 %49, %50
br i1 %51, label %52, label %55
52: ; preds = %40
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%54 = call i32 @exit(i32 1)
unreachable
55: ; preds = %40
%56 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %56)
%58 = load i32, i32* %6
%59 = load i32, i32* @CL_DEVICE_TYPE_GPU
%60 = call i32 @clGetDeviceIDs(i32 %58, i32 %59, i32 1, i32* %10, i32* %11)
store i32 %60, i32* %8
%61 = load i32, i32* %8
%62 = load i32, i32* @CL_SUCCESS
%63 = icmp ne i32 %61, %62
br i1 %63, label %64, label %67
64: ; preds = %55
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %55
%68 = load i32, i32* %11
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %68)
%70 = load i32, i32* %10
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %10
%73 = load i32, i32* @CL_DEVICE_NAME
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%75 = call i32 @clGetDeviceInfo(i32 %72, i32 %73, i32 100, i8* %74, i32* null)
store i32 %75, i32* %8
%76 = load i32, i32* %8
%77 = load i32, i32* @CL_SUCCESS
%78 = icmp ne i32 %76, %77
br i1 %78, label %79, label %82
79: ; preds = %67
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
%81 = call i32 @exit(i32 1)
unreachable
82: ; preds = %67
%83 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %83)
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%86 = call i32 @clCreateContext(i32* null, i32 1, i32* %10, i32* null, i32* null, i32* %8)
store i32 %86, i32* %13
%87 = load i32, i32* %8
%88 = load i32, i32* @CL_SUCCESS
%89 = icmp ne i32 %87, %88
br i1 %89, label %90, label %93
90: ; preds = %82
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0))
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %82
%94 = load i32, i32* %13
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i32 %94)
%96 = load i32, i32* %13
%97 = load i32, i32* %10
%98 = call i32 @clCreateCommandQueue(i32 %96, i32 %97, i32 0, i32* %8)
store i32 %98, i32* %14
%99 = load i32, i32* %8
%100 = load i32, i32* @CL_SUCCESS
%101 = icmp ne i32 %99, %100
br i1 %101, label %102, label %105
102: ; preds = %93
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.13, i64 0, i64 0))
%104 = call i32 @exit(i32 1)
unreachable
105: ; preds = %93
%106 = load i32, i32* %14
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i32 %106)
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%109 = call i8* @read_buffer(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i64* %16)
store i8* %109, i8** %15
%110 = load i32, i32* %13
%111 = call i32 @clCreateProgramWithSource(i32 %110, i32 1, i8** %15, i64* %16, i32* %8)
store i32 %111, i32* %17
%112 = load i32, i32* %8
%113 = load i32, i32* @CL_SUCCESS
%114 = icmp ne i32 %112, %113
br i1 %114, label %115, label %118
115: ; preds = %105
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.16, i64 0, i64 0))
%117 = call i32 @exit(i32 1)
unreachable
118: ; preds = %105
%119 = load i32, i32* %17
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.17, i64 0, i64 0), i32 %119)
%121 = load i32, i32* %17
%122 = call i32 @clBuildProgram(i32 %121, i32 1, i32* %10, i32* null, i32* null, i32* null)
store i32 %122, i32* %8
%123 = load i32, i32* %8
%124 = load i32, i32* @CL_SUCCESS
%125 = icmp ne i32 %123, %124
br i1 %125, label %126, label %144
126: ; preds = %118
%127 = load i32, i32* %17
%128 = load i32, i32* %10
%129 = load i32, i32* @CL_PROGRAM_BUILD_LOG
%130 = call i32 @clGetProgramBuildInfo(i32 %127, i32 %128, i32 %129, i64 0, i8* null, i64* %18)
%131 = load i64, i64* %18
%132 = call i8* @malloc(i64 %131)
store i8* %132, i8** %19
%133 = load i32, i32* %17
%134 = load i32, i32* %10
%135 = load i32, i32* @CL_PROGRAM_BUILD_LOG
%136 = load i64, i64* %18
%137 = load i8*, i8** %19
%138 = call i32 @clGetProgramBuildInfo(i32 %133, i32 %134, i32 %135, i64 %136, i8* %137, i64* null)
%139 = load i8*, i8** %19
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.18, i64 0, i64 0), i8* %139)
%141 = load i8*, i8** %19
%142 = call i32 @free(i8* %141)
%143 = call i32 @exit(i32 1)
unreachable
144: ; preds = %118
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0))
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%147 = load i32, i32* %17
%148 = call i32 @clCreateKernel(i32 %147, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.20, i64 0, i64 0), i32* %8)
store i32 %148, i32* %20
%149 = load i32, i32* %8
%150 = load i32, i32* @CL_SUCCESS
%151 = icmp ne i32 %149, %150
br i1 %151, label %152, label %155
152: ; preds = %144
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.21, i64 0, i64 0))
%154 = call i32 @exit(i32 1)
unreachable
155: ; preds = %144
store i64 10, i64* %21
%156 = load i64, i64* %21
%157 = mul i64 %156, 1
%158 = call i8* @malloc(i64 %157)
store i8* %158, i8** %22
store i32 0, i32* %23
br label %159
159: ; preds = %169, %155
%160 = load i32, i32* %23
%161 = sext i32 %160 to i64
%162 = load i64, i64* %21
%163 = icmp ult i64 %161, %162
br i1 %163, label %164, label %172
164: ; preds = %159
%165 = load i8*, i8** %22
%166 = load i32, i32* %23
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds i8, i8* %165, i64 %167
store i8 2, i8* %168
br label %169
169: ; preds = %164
%170 = load i32, i32* %23
%171 = add nsw i32 %170, 1
store i32 %171, i32* %23
br label %159
172: ; preds = %159
%173 = load i32, i32* %13
%174 = load i32, i32* @CL_MEM_READ_ONLY
%175 = load i64, i64* %21
%176 = mul i64 %175, 1
%177 = call i32 @clCreateBuffer(i32 %173, i32 %174, i64 %176, i32* null, i32* %8)
store i32 %177, i32* %24
%178 = load i32, i32* %8
%179 = load i32, i32* @CL_SUCCESS
%180 = icmp ne i32 %178, %179
br i1 %180, label %181, label %184
181: ; preds = %172
%182 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.22, i64 0, i64 0))
%183 = call i32 @exit(i32 1)
unreachable
184: ; preds = %172
%185 = load i32, i32* %14
%186 = load i32, i32* %24
%187 = load i32, i32* @CL_TRUE
%188 = load i64, i64* %21
%189 = mul i64 %188, 1
%190 = load i8*, i8** %22
%191 = call i32 @clEnqueueWriteBuffer(i32 %185, i32 %186, i32 %187, i32 0, i64 %189, i8* %190, i32 0, i32* null, i32* null)
store i32 %191, i32* %8
%192 = load i32, i32* %8
%193 = load i32, i32* @CL_SUCCESS
%194 = icmp ne i32 %192, %193
br i1 %194, label %195, label %198
195: ; preds = %184
%196 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.23, i64 0, i64 0))
%197 = call i32 @exit(i32 1)
unreachable
198: ; preds = %184
%199 = load i64, i64* %21
%200 = mul i64 %199, 1
%201 = call i8* @malloc(i64 %200)
store i8* %201, i8** %25
store i32 0, i32* %26
br label %202
202: ; preds = %212, %198
%203 = load i32, i32* %26
%204 = sext i32 %203 to i64
%205 = load i64, i64* %21
%206 = icmp ult i64 %204, %205
br i1 %206, label %207, label %215
207: ; preds = %202
%208 = load i8*, i8** %25
%209 = load i32, i32* %26
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds i8, i8* %208, i64 %210
store i8 2, i8* %211
br label %212
212: ; preds = %207
%213 = load i32, i32* %26
%214 = add nsw i32 %213, 1
store i32 %214, i32* %26
br label %202
215: ; preds = %202
%216 = load i32, i32* %13
%217 = load i32, i32* @CL_MEM_READ_ONLY
%218 = load i64, i64* %21
%219 = mul i64 %218, 1
%220 = call i32 @clCreateBuffer(i32 %216, i32 %217, i64 %219, i32* null, i32* %8)
store i32 %220, i32* %27
%221 = load i32, i32* %8
%222 = load i32, i32* @CL_SUCCESS
%223 = icmp ne i32 %221, %222
br i1 %223, label %224, label %227
224: ; preds = %215
%225 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.22, i64 0, i64 0))
%226 = call i32 @exit(i32 1)
unreachable
227: ; preds = %215
%228 = load i32, i32* %14
%229 = load i32, i32* %27
%230 = load i32, i32* @CL_TRUE
%231 = load i64, i64* %21
%232 = mul i64 %231, 1
%233 = load i8*, i8** %25
%234 = call i32 @clEnqueueWriteBuffer(i32 %228, i32 %229, i32 %230, i32 0, i64 %232, i8* %233, i32 0, i32* null, i32* null)
store i32 %234, i32* %8
%235 = load i32, i32* %8
%236 = load i32, i32* @CL_SUCCESS
%237 = icmp ne i32 %235, %236
br i1 %237, label %238, label %241
238: ; preds = %227
%239 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.23, i64 0, i64 0))
%240 = call i32 @exit(i32 1)
unreachable
241: ; preds = %227
%242 = load i64, i64* %21
%243 = mul i64 %242, 1
%244 = call i8* @malloc(i64 %243)
store i8* %244, i8** %28
%245 = load i8*, i8** %28
%246 = load i64, i64* %21
%247 = mul i64 %246, 1
%248 = call i32 @memset(i8* %245, i32 1, i64 %247)
%249 = load i32, i32* %13
%250 = load i32, i32* @CL_MEM_WRITE_ONLY
%251 = load i64, i64* %21
%252 = mul i64 %251, 1
%253 = call i32 @clCreateBuffer(i32 %249, i32 %250, i64 %252, i32* null, i32* %8)
store i32 %253, i32* %29
%254 = load i32, i32* %8
%255 = load i32, i32* @CL_SUCCESS
%256 = icmp ne i32 %254, %255
br i1 %256, label %257, label %260
257: ; preds = %241
%258 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.24, i64 0, i64 0))
%259 = call i32 @exit(i32 1)
unreachable
260: ; preds = %241
%261 = load i32, i32* @CL_SUCCESS
store i32 %261, i32* %8
%262 = load i32, i32* %20
%263 = call i32 @clSetKernelArg(i32 %262, i32 0, i32 4, i32* %24)
%264 = load i32, i32* %8
%265 = or i32 %264, %263
store i32 %265, i32* %8
%266 = load i32, i32* %20
%267 = call i32 @clSetKernelArg(i32 %266, i32 1, i32 4, i32* %27)
%268 = load i32, i32* %8
%269 = or i32 %268, %267
store i32 %269, i32* %8
%270 = load i32, i32* %20
%271 = call i32 @clSetKernelArg(i32 %270, i32 2, i32 4, i32* %29)
%272 = load i32, i32* %8
%273 = or i32 %272, %271
store i32 %273, i32* %8
%274 = load i32, i32* %8
%275 = load i32, i32* @CL_SUCCESS
%276 = icmp ne i32 %274, %275
br i1 %276, label %277, label %280
277: ; preds = %260
%278 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.25, i64 0, i64 0))
%279 = call i32 @exit(i32 1)
unreachable
280: ; preds = %260
%281 = load i64, i64* %21
store i64 %281, i64* %30
%282 = load i64, i64* %21
store i64 %282, i64* %31
%283 = load i32, i32* %14
%284 = load i32, i32* %20
%285 = call i32 @clEnqueueNDRangeKernel(i32 %283, i32 %284, i32 1, i32* null, i64* %30, i64* %31, i32 0, i32* null, i32* null)
store i32 %285, i32* %8
%286 = load i32, i32* %8
%287 = load i32, i32* @CL_SUCCESS
%288 = icmp ne i32 %286, %287
br i1 %288, label %289, label %292
289: ; preds = %280
%290 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.26, i64 0, i64 0))
%291 = call i32 @exit(i32 1)
unreachable
292: ; preds = %280
%293 = load i32, i32* %14
%294 = call i32 @clFinish(i32 %293)
%295 = load i32, i32* %14
%296 = load i32, i32* %29
%297 = load i32, i32* @CL_TRUE
%298 = load i64, i64* %21
%299 = mul i64 %298, 1
%300 = load i8*, i8** %28
%301 = call i32 @clEnqueueReadBuffer(i32 %295, i32 %296, i32 %297, i32 0, i64 %299, i8* %300, i32 0, i32* null, i32* null)
store i32 %301, i32* %8
%302 = load i32, i32* %8
%303 = load i32, i32* @CL_SUCCESS
%304 = icmp ne i32 %302, %303
br i1 %304, label %305, label %308
305: ; preds = %292
%306 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.27, i64 0, i64 0))
%307 = call i32 @exit(i32 1)
unreachable
308: ; preds = %292
%309 = bitcast [100 x i8]* %32 to i8*
%310 = load i8**, i8*** %5
%311 = getelementptr inbounds i8*, i8** %310, i64 0
%312 = load i8*, i8** %311
%313 = call i32 @sprintf(i8* %309, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.28, i64 0, i64 0), i8* %312)
%314 = getelementptr inbounds [100 x i8], [100 x i8]* %32, i64 0, i64 0
%315 = load i8*, i8** %28
%316 = load i64, i64* %21
%317 = mul i64 %316, 1
%318 = call i32 @write_buffer(i8* %314, i8* %315, i64 %317)
%319 = getelementptr inbounds [100 x i8], [100 x i8]* %32, i64 0, i64 0
%320 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.29, i64 0, i64 0), i8* %319)
%321 = load i8*, i8** %28
%322 = call i32 @free(i8* %321)
%323 = load i32, i32* %29
%324 = call i32 @clReleaseMemObject(i32 %323)
store i32 %324, i32* %8
%325 = load i32, i32* %8
%326 = load i32, i32* @CL_SUCCESS
%327 = icmp ne i32 %325, %326
br i1 %327, label %328, label %331
328: ; preds = %308
%329 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.30, i64 0, i64 0))
%330 = call i32 @exit(i32 1)
unreachable
331: ; preds = %308
%332 = load i8*, i8** %22
%333 = call i32 @free(i8* %332)
%334 = load i32, i32* %24
%335 = call i32 @clReleaseMemObject(i32 %334)
store i32 %335, i32* %8
%336 = load i32, i32* %8
%337 = load i32, i32* @CL_SUCCESS
%338 = icmp ne i32 %336, %337
br i1 %338, label %339, label %342
339: ; preds = %331
%340 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.30, i64 0, i64 0))
%341 = call i32 @exit(i32 1)
unreachable
342: ; preds = %331
%343 = load i8*, i8** %25
%344 = call i32 @free(i8* %343)
%345 = load i32, i32* %27
%346 = call i32 @clReleaseMemObject(i32 %345)
store i32 %346, i32* %8
%347 = load i32, i32* %8
%348 = load i32, i32* @CL_SUCCESS
%349 = icmp ne i32 %347, %348
br i1 %349, label %350, label %353
350: ; preds = %342
%351 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.30, i64 0, i64 0))
%352 = call i32 @exit(i32 1)
unreachable
353: ; preds = %342
%354 = load i32, i32* %20
%355 = call i32 @clReleaseKernel(i32 %354)
store i32 %355, i32* %8
%356 = load i32, i32* %8
%357 = load i32, i32* @CL_SUCCESS
%358 = icmp ne i32 %356, %357
br i1 %358, label %359, label %362
359: ; preds = %353
%360 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.31, i64 0, i64 0))
%361 = call i32 @exit(i32 1)
unreachable
362: ; preds = %353
%363 = load i32, i32* %17
%364 = call i32 @clReleaseProgram(i32 %363)
store i32 %364, i32* %8
%365 = load i32, i32* %8
%366 = load i32, i32* @CL_SUCCESS
%367 = icmp ne i32 %365, %366
br i1 %367, label %368, label %371
368: ; preds = %362
%369 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.32, i64 0, i64 0))
%370 = call i32 @exit(i32 1)
unreachable
371: ; preds = %362
%372 = load i32, i32* %14
%373 = call i32 @clReleaseCommandQueue(i32 %372)
store i32 %373, i32* %8
%374 = load i32, i32* %8
%375 = load i32, i32* @CL_SUCCESS
%376 = icmp ne i32 %374, %375
br i1 %376, label %377, label %380
377: ; preds = %371
%378 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.33, i64 0, i64 0))
%379 = call i32 @exit(i32 1)
unreachable
380: ; preds = %371
%381 = load i32, i32* %13
%382 = call i32 @clReleaseContext(i32 %381)
store i32 %382, i32* %8
%383 = load i32, i32* %8
%384 = load i32, i32* @CL_SUCCESS
%385 = icmp ne i32 %383, %384
br i1 %385, label %386, label %389
386: ; preds = %380
%387 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.34, i64 0, i64 0))
%388 = call i32 @exit(i32 1)
unreachable
389: ; preds = %380
ret i32 0
}

LLVM IR (-O2):
@CL_SUCCESS = global i32 0
@.str.1 = [25 x i8] c"Number of platforms: %d\0A\00"
@.str.2 = [13 x i8] c"platform=%p\0A\00"
@CL_PLATFORM_NAME = global i32 0
@.str.4 = [21 x i8] c"platform.name='%s'\0A\0A\00"
@CL_DEVICE_TYPE_GPU = global i32 0
@.str.6 = [23 x i8] c"Number of devices: %d\0A\00"
@.str.7 = [11 x i8] c"device=%p\0A\00"
@CL_DEVICE_NAME = global i32 0
@.str.9 = [18 x i8] c"device.name='%s'\0A\00"
@.str.12 = [12 x i8] c"context=%p\0A\00"
@.str.14 = [18 x i8] c"command_queue=%p\0A\00"
@.str.15 = [20 x i8] c"add_ushortushort.cl\00"
@.str.17 = [12 x i8] c"program=%p\0A\00"
@CL_PROGRAM_BUILD_LOG = global i32 0
@.str.18 = [44 x i8] c"error: call to 'clBuildProgram' failed:\0A%s\0A\00"
@.str.20 = [17 x i8] c"add_ushortushort\00"
@CL_MEM_READ_ONLY = global i32 0
@CL_TRUE = global i32 0
@CL_MEM_WRITE_ONLY = global i32 0
@.str.28 = [10 x i8] c"%s.result\00"
@.str.29 = [21 x i8] c"Result dumped to %s\0A\00"
@str = [14 x i8] c"program built\00"
@str.35 = [41 x i8] c"error: call to 'clReleaseContext' failed\00"
@str.36 = [46 x i8] c"error: call to 'clReleaseCommandQueue' failed\00"
@str.37 = [41 x i8] c"error: call to 'clReleaseProgram' failed\00"
@str.38 = [40 x i8] c"error: call to 'clReleaseKernel' failed\00"
@str.41 = [43 x i8] c"error: call to 'clReleaseMemObject' failed\00"
@str.42 = [44 x i8] c"error: call to 'clEnqueueReadBuffer' failed\00"
@str.43 = [47 x i8] c"error: call to 'clEnqueueNDRangeKernel' failed\00"
@str.44 = [39 x i8] c"error: call to 'clSetKernelArg' failed\00"
@str.45 = [35 x i8] c"error: could not create dst buffer\00"
@str.48 = [45 x i8] c"error: call to 'clEnqueueWriteBuffer' failed\00"
@str.49 = [38 x i8] c"error: could not create source buffer\00"
@str.50 = [39 x i8] c"error: call to 'clCreateKernel' failed\00"
@str.51 = [50 x i8] c"error: call to 'clCreateProgramWithSource' failed\00"
@str.52 = [45 x i8] c"error: call to 'clCreateCommandQueue' failed\00"
@str.53 = [40 x i8] c"error: call to 'clCreateContext' failed\00"
@str.54 = [40 x i8] c"error: call to 'clGetDeviceInfo' failed\00"
@str.55 = [39 x i8] c"error: call to 'clGetDeviceIDs' failed\00"
@str.56 = [42 x i8] c"error: call to 'clGetPlatformInfo' failed\00"
@str.57 = [41 x i8] c"error: call to 'clGetPlatformIDs' failed\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [100 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca [100 x i8]
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i64
%17 = alloca i64
%18 = alloca [100 x i8]
%19 = bitcast i32* %3 to i8*
%20 = bitcast i32* %4 to i8*
%21 = bitcast i32* %5 to i8*
%22 = call i32 @clGetPlatformIDs(i32 1, i32* %3, i32* %4)
store i32 %22, i32* %5
%23 = load i32, i32* @CL_SUCCESS
%24 = icmp eq i32 %22, %23
br i1 %24, label %28, label %25
25: ; preds = %2
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.57, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %2
%29 = load i32, i32* %4
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %3
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%34 = load i32, i32* %3
%35 = load i32, i32* @CL_PLATFORM_NAME
%36 = call i32 @clGetPlatformInfo(i32 %34, i32 %35, i32 100, i8* %33, i32* null)
store i32 %36, i32* %5
%37 = load i32, i32* @CL_SUCCESS
%38 = icmp eq i32 %36, %37
br i1 %38, label %42, label %39
39: ; preds = %28
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.56, i64 0, i64 0))
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %28
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %33)
%44 = bitcast i32* %7 to i8*
%45 = bitcast i32* %8 to i8*
%46 = load i32, i32* %3
%47 = load i32, i32* @CL_DEVICE_TYPE_GPU
%48 = call i32 @clGetDeviceIDs(i32 %46, i32 %47, i32 1, i32* %7, i32* %8)
store i32 %48, i32* %5
%49 = load i32, i32* @CL_SUCCESS
%50 = icmp eq i32 %48, %49
br i1 %50, label %54, label %51
51: ; preds = %42
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.55, i64 0, i64 0))
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %42
%55 = load i32, i32* %8
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %7
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %57)
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%60 = load i32, i32* %7
%61 = load i32, i32* @CL_DEVICE_NAME
%62 = call i32 @clGetDeviceInfo(i32 %60, i32 %61, i32 100, i8* %59, i32* null)
store i32 %62, i32* %5
%63 = load i32, i32* @CL_SUCCESS
%64 = icmp eq i32 %62, %63
br i1 %64, label %68, label %65
65: ; preds = %54
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.54, i64 0, i64 0))
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %54
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %59)
%70 = call i32 @putchar(i32 10)
%71 = call i32 @clCreateContext(i32* null, i32 1, i32* %7, i32* null, i32* null, i32* %5)
%72 = load i32, i32* %5
%73 = load i32, i32* @CL_SUCCESS
%74 = icmp eq i32 %72, %73
br i1 %74, label %78, label %75
75: ; preds = %68
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.53, i64 0, i64 0))
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %68
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i32 %71)
%80 = load i32, i32* %7
%81 = call i32 @clCreateCommandQueue(i32 %71, i32 %80, i32 0, i32* %5)
%82 = load i32, i32* %5
%83 = load i32, i32* @CL_SUCCESS
%84 = icmp eq i32 %82, %83
br i1 %84, label %88, label %85
85: ; preds = %78
%86 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.52, i64 0, i64 0))
%87 = call i32 @exit(i32 1)
unreachable
88: ; preds = %78
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i32 %81)
%90 = call i32 @putchar(i32 10)
%91 = bitcast i8** %10 to i8*
%92 = bitcast i64* %11 to i8*
%93 = call i8* @read_buffer(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i64* %11)
store i8* %93, i8** %10
%94 = call i32 @clCreateProgramWithSource(i32 %71, i32 1, i8** %10, i64* %11, i32* %5)
%95 = load i32, i32* %5
%96 = load i32, i32* @CL_SUCCESS
%97 = icmp eq i32 %95, %96
br i1 %97, label %101, label %98
98: ; preds = %88
%99 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.51, i64 0, i64 0))
%100 = call i32 @exit(i32 1)
unreachable
101: ; preds = %88
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.17, i64 0, i64 0), i32 %94)
%103 = call i32 @clBuildProgram(i32 %94, i32 1, i32* %7, i32* null, i32* null, i32* null)
store i32 %103, i32* %5
%104 = load i32, i32* @CL_SUCCESS
%105 = icmp eq i32 %103, %104
br i1 %105, label %119, label %106
106: ; preds = %101
%107 = bitcast i64* %12 to i8*
%108 = load i32, i32* %7
%109 = load i32, i32* @CL_PROGRAM_BUILD_LOG
%110 = call i32 @clGetProgramBuildInfo(i32 %94, i32 %108, i32 %109, i64 0, i8* null, i64* %12)
%111 = load i64, i64* %12
%112 = call i8* @malloc(i64 %111)
%113 = load i32, i32* %7
%114 = load i32, i32* @CL_PROGRAM_BUILD_LOG
%115 = call i32 @clGetProgramBuildInfo(i32 %94, i32 %113, i32 %114, i64 %111, i8* %112, i64* null)
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.18, i64 0, i64 0), i8* %112)
%117 = call i32 @free(i8* %112)
%118 = call i32 @exit(i32 1)
unreachable
119: ; preds = %101
%120 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%121 = call i32 @putchar(i32 10)
%122 = call i32 @clCreateKernel(i32 %94, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.20, i64 0, i64 0), i32* %5)
%123 = load i32, i32* %5
%124 = load i32, i32* @CL_SUCCESS
%125 = icmp eq i32 %123, %124
br i1 %125, label %129, label %126
126: ; preds = %119
%127 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.50, i64 0, i64 0))
%128 = call i32 @exit(i32 1)
unreachable
129: ; preds = %119
%130 = call dereferenceable_or_null(10) i8* @malloc(i64 10)
%131 = bitcast i32* %13 to i8*
%132 = load i32, i32* @CL_MEM_READ_ONLY
%133 = call i32 @clCreateBuffer(i32 %71, i32 %132, i64 10, i32* null, i32* %5)
store i32 %133, i32* %13
%134 = load i32, i32* %5
%135 = load i32, i32* @CL_SUCCESS
%136 = icmp eq i32 %134, %135
br i1 %136, label %140, label %137
137: ; preds = %129
%138 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.49, i64 0, i64 0))
%139 = call i32 @exit(i32 1)
unreachable
140: ; preds = %129
%141 = load i32, i32* @CL_TRUE
%142 = call i32 @clEnqueueWriteBuffer(i32 %81, i32 %133, i32 %141, i32 0, i64 10, i8* %130, i32 0, i32* null, i32* null)
store i32 %142, i32* %5
%143 = load i32, i32* @CL_SUCCESS
%144 = icmp eq i32 %142, %143
br i1 %144, label %148, label %145
145: ; preds = %140
%146 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.48, i64 0, i64 0))
%147 = call i32 @exit(i32 1)
unreachable
148: ; preds = %140
%149 = call dereferenceable_or_null(10) i8* @malloc(i64 10)
%150 = bitcast i32* %14 to i8*
%151 = load i32, i32* @CL_MEM_READ_ONLY
%152 = call i32 @clCreateBuffer(i32 %71, i32 %151, i64 10, i32* null, i32* %5)
store i32 %152, i32* %14
%153 = load i32, i32* %5
%154 = load i32, i32* @CL_SUCCESS
%155 = icmp eq i32 %153, %154
br i1 %155, label %159, label %156
156: ; preds = %148
%157 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.49, i64 0, i64 0))
%158 = call i32 @exit(i32 1)
unreachable
159: ; preds = %148
%160 = load i32, i32* @CL_TRUE
%161 = call i32 @clEnqueueWriteBuffer(i32 %81, i32 %152, i32 %160, i32 0, i64 10, i8* %149, i32 0, i32* null, i32* null)
store i32 %161, i32* %5
%162 = load i32, i32* @CL_SUCCESS
%163 = icmp eq i32 %161, %162
br i1 %163, label %167, label %164
164: ; preds = %159
%165 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.48, i64 0, i64 0))
%166 = call i32 @exit(i32 1)
unreachable
167: ; preds = %159
%168 = call dereferenceable_or_null(10) i8* @malloc(i64 10)
%169 = call i32 @memset(i8* %168, i32 1, i64 10)
%170 = bitcast i32* %15 to i8*
%171 = load i32, i32* @CL_MEM_WRITE_ONLY
%172 = call i32 @clCreateBuffer(i32 %71, i32 %171, i64 10, i32* null, i32* %5)
store i32 %172, i32* %15
%173 = load i32, i32* %5
%174 = load i32, i32* @CL_SUCCESS
%175 = icmp eq i32 %173, %174
br i1 %175, label %179, label %176
176: ; preds = %167
%177 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.45, i64 0, i64 0))
%178 = call i32 @exit(i32 1)
unreachable
179: ; preds = %167
%180 = call i32 @clSetKernelArg(i32 %122, i32 0, i32 4, i32* %13)
%181 = load i32, i32* %5
%182 = or i32 %181, %180
store i32 %182, i32* %5
%183 = call i32 @clSetKernelArg(i32 %122, i32 1, i32 4, i32* %14)
%184 = load i32, i32* %5
%185 = or i32 %184, %183
store i32 %185, i32* %5
%186 = call i32 @clSetKernelArg(i32 %122, i32 2, i32 4, i32* %15)
%187 = load i32, i32* %5
%188 = or i32 %187, %186
store i32 %188, i32* %5
%189 = load i32, i32* @CL_SUCCESS
%190 = icmp eq i32 %188, %189
br i1 %190, label %194, label %191
191: ; preds = %179
%192 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.44, i64 0, i64 0))
%193 = call i32 @exit(i32 1)
unreachable
194: ; preds = %179
%195 = bitcast i64* %16 to i8*
store i64 10, i64* %16
%196 = bitcast i64* %17 to i8*
store i64 10, i64* %17
%197 = call i32 @clEnqueueNDRangeKernel(i32 %81, i32 %122, i32 1, i32* null, i64* %16, i64* %17, i32 0, i32* null, i32* null)
store i32 %197, i32* %5
%198 = load i32, i32* @CL_SUCCESS
%199 = icmp eq i32 %197, %198
br i1 %199, label %203, label %200
200: ; preds = %194
%201 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.43, i64 0, i64 0))
%202 = call i32 @exit(i32 1)
unreachable
203: ; preds = %194
%204 = call i32 @clFinish(i32 %81)
%205 = load i32, i32* %15
%206 = load i32, i32* @CL_TRUE
%207 = call i32 @clEnqueueReadBuffer(i32 %81, i32 %205, i32 %206, i32 0, i64 10, i8* %168, i32 0, i32* null, i32* null)
store i32 %207, i32* %5
%208 = load i32, i32* @CL_SUCCESS
%209 = icmp eq i32 %207, %208
br i1 %209, label %213, label %210
210: ; preds = %203
%211 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.42, i64 0, i64 0))
%212 = call i32 @exit(i32 1)
unreachable
213: ; preds = %203
%214 = getelementptr inbounds [100 x i8], [100 x i8]* %18, i64 0, i64 0
%215 = load i8*, i8** %1
%216 = call i32 @sprintf(i8* %214, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.28, i64 0, i64 0), i8* %215)
%217 = call i32 @write_buffer(i8* %214, i8* %168, i64 10)
%218 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.29, i64 0, i64 0), i8* %214)
%219 = call i32 @free(i8* %168)
%220 = load i32, i32* %15
%221 = call i32 @clReleaseMemObject(i32 %220)
store i32 %221, i32* %5
%222 = load i32, i32* @CL_SUCCESS
%223 = icmp eq i32 %221, %222
br i1 %223, label %227, label %224
224: ; preds = %213
%225 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.41, i64 0, i64 0))
%226 = call i32 @exit(i32 1)
unreachable
227: ; preds = %213
%228 = call i32 @free(i8* %130)
%229 = load i32, i32* %13
%230 = call i32 @clReleaseMemObject(i32 %229)
store i32 %230, i32* %5
%231 = load i32, i32* @CL_SUCCESS
%232 = icmp eq i32 %230, %231
br i1 %232, label %236, label %233
233: ; preds = %227
%234 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.41, i64 0, i64 0))
%235 = call i32 @exit(i32 1)
unreachable
236: ; preds = %227
%237 = call i32 @free(i8* %149)
%238 = load i32, i32* %14
%239 = call i32 @clReleaseMemObject(i32 %238)
store i32 %239, i32* %5
%240 = load i32, i32* @CL_SUCCESS
%241 = icmp eq i32 %239, %240
br i1 %241, label %245, label %242
242: ; preds = %236
%243 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.41, i64 0, i64 0))
%244 = call i32 @exit(i32 1)
unreachable
245: ; preds = %236
%246 = call i32 @clReleaseKernel(i32 %122)
store i32 %246, i32* %5
%247 = load i32, i32* @CL_SUCCESS
%248 = icmp eq i32 %246, %247
br i1 %248, label %252, label %249
249: ; preds = %245
%250 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.38, i64 0, i64 0))
%251 = call i32 @exit(i32 1)
unreachable
252: ; preds = %245
%253 = call i32 @clReleaseProgram(i32 %94)
store i32 %253, i32* %5
%254 = load i32, i32* @CL_SUCCESS
%255 = icmp eq i32 %253, %254
br i1 %255, label %259, label %256
256: ; preds = %252
%257 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.37, i64 0, i64 0))
%258 = call i32 @exit(i32 1)
unreachable
259: ; preds = %252
%260 = call i32 @clReleaseCommandQueue(i32 %81)
store i32 %260, i32* %5
%261 = load i32, i32* @CL_SUCCESS
%262 = icmp eq i32 %260, %261
br i1 %262, label %266, label %263
263: ; preds = %259
%264 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.36, i64 0, i64 0))
%265 = call i32 @exit(i32 1)
unreachable
266: ; preds = %259
%267 = call i32 @clReleaseContext(i32 %71)
store i32 %267, i32* %5
%268 = load i32, i32* @CL_SUCCESS
%269 = icmp eq i32 %267, %268
br i1 %269, label %273, label %270
270: ; preds = %266
%271 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.35, i64 0, i64 0))
%272 = call i32 @exit(i32 1)
unreachable
273: ; preds = %266
ret i32 0
}