#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 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 char 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;
char CL_SUCCESS;
int /*<<< orphan*/ CL_TRUE;
char clBuildProgram(int /*<<< orphan*/, int, int /*<<< orphan*/ *,
                    int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                    int /*<<< orphan*/ *);
int /*<<< orphan*/ clCreateBuffer(int /*<<< orphan*/, int /*<<< orphan*/,
                                  size_t, int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ clCreateCommandQueue(int /*<<< orphan*/, int /*<<< orphan*/,
                                        int /*<<< orphan*/, char *);
int /*<<< orphan*/ clCreateContext(int /*<<< orphan*/ *, int,
                                   int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                   int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ clCreateKernel(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ clCreateProgramWithSource(int /*<<< orphan*/, int,
                                             char const **, size_t *, char *);
char clEnqueueNDRangeKernel(int /*<<< orphan*/, int /*<<< orphan*/, int,
                            int /*<<< orphan*/ *, size_t *, size_t *,
                            int /*<<< orphan*/, int /*<<< orphan*/ *,
                            int /*<<< orphan*/ *);
char clEnqueueReadBuffer(int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/, size_t, char *,
                         int /*<<< orphan*/, int /*<<< orphan*/ *,
                         int /*<<< orphan*/ *);
char clEnqueueWriteBuffer(int /*<<< orphan*/, int /*<<< orphan*/,
                          int /*<<< orphan*/, int /*<<< orphan*/, size_t,
                          char *, int /*<<< orphan*/, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ clFinish(int /*<<< orphan*/);
char clGetDeviceIDs(int /*<<< orphan*/, int /*<<< orphan*/, int,
                    int /*<<< orphan*/ *, int *);
char clGetDeviceInfo(int /*<<< orphan*/, int /*<<< orphan*/, int, char *,
                     int /*<<< orphan*/ *);
char clGetPlatformIDs(int, int /*<<< orphan*/ *, int *);
char clGetPlatformInfo(int /*<<< orphan*/, int /*<<< orphan*/, int, char *,
                       int /*<<< orphan*/ *);
int /*<<< orphan*/ clGetProgramBuildInfo(int /*<<< orphan*/, int /*<<< orphan*/,
                                         int /*<<< orphan*/, size_t, char *,
                                         size_t *);
char clReleaseCommandQueue(int /*<<< orphan*/);
char clReleaseContext(int /*<<< orphan*/);
char clReleaseKernel(int /*<<< orphan*/);
char clReleaseMemObject(int /*<<< orphan*/);
char clReleaseProgram(int /*<<< orphan*/);
char 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_sat_intint.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_sat_intint", &ret);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clCreateKernel' failed\n");
    exit(1);
  }
  size_t num_elem = 10;
  cl_int *src_0_host_buffer;
  src_0_host_buffer = malloc(num_elem * sizeof(cl_int));
  for (int i = 0; i < num_elem; i++)
    src_0_host_buffer[i] = (cl_int)(2);
  cl_mem src_0_device_buffer;
  src_0_device_buffer = clCreateBuffer(context, CL_MEM_READ_ONLY,
                                       num_elem * sizeof(cl_int), 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_int), src_0_host_buffer, 0,
                             NULL, NULL);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clEnqueueWriteBuffer' failed\n");
    exit(1);
  }
  cl_int *src_1_host_buffer;
  src_1_host_buffer = malloc(num_elem * sizeof(cl_int));
  for (int i = 0; i < num_elem; i++)
    src_1_host_buffer[i] = (cl_int)(2);
  cl_mem src_1_device_buffer;
  src_1_device_buffer = clCreateBuffer(context, CL_MEM_READ_ONLY,
                                       num_elem * sizeof(cl_int), 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_int), src_1_host_buffer, 0,
                             NULL, NULL);
  if (ret != CL_SUCCESS) {
    printf("error: call to 'clEnqueueWriteBuffer' failed\n");
    exit(1);
  }
  cl_int *dst_host_buffer;
  dst_host_buffer = malloc(num_elem * sizeof(cl_int));
  memset((void *)dst_host_buffer, 1, num_elem * sizeof(cl_int));
  cl_mem dst_device_buffer;
  dst_device_buffer = clCreateBuffer(context, CL_MEM_WRITE_ONLY,
                                     num_elem * sizeof(cl_int), 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_int), 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_int));
  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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x2c9f(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     132c <main+0x5c>
lea    0xce5(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x18(%rbp),%esi
lea    0xcf4(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xcfc(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x14(%rbp),%edi
mov    0x2c68(%rip),%rax
mov    (%rax),%esi
lea    -0x80(%rbp),%rcx
mov    $0x64,%edx
xor    %eax,%eax
mov    %eax,%r8d
call   1120 <clGetPlatformInfo@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x2c2d(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     139e <main+0xce>
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
lea    -0x80(%rbp),%rsi
lea    0xcd2(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x14(%rbp),%edi
mov    0x2c16(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edx
lea    -0x84(%rbp),%rcx
lea    -0x88(%rbp),%r8
call   10a0 <clGetDeviceIDs@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x2bc6(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1405 <main+0x135>
lea    0xc9c(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x88(%rbp),%esi
lea    0xca6(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x84(%rbp),%esi
lea    0xca9(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x84(%rbp),%edi
mov    0x2b7e(%rip),%rax
mov    (%rax),%esi
lea    -0xf0(%rbp),%rcx
mov    $0x64,%edx
xor    %eax,%eax
mov    %eax,%r8d
call   10b0 <clGetDeviceInfo@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x2b48(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1483 <main+0x1b3>
lea    0xc68(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
lea    -0xf0(%rbp),%rsi
lea    0xc72(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
lea    0xbef(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
xor    %eax,%eax
mov    %eax,%r8d
mov    $0x1,%esi
lea    -0x84(%rbp),%rdx
lea    -0x19(%rbp),%r9
mov    %r8,%rdi
mov    %r8,%rcx
call   1130 <clCreateContext@plt>
mov    %eax,-0xf4(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x2ad1(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     14fa <main+0x22a>
lea    0xc2c(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0xf4(%rbp),%esi
lea    0xc37(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0xf4(%rbp),%edi
mov    -0x84(%rbp),%esi
xor    %edx,%edx
lea    -0x19(%rbp),%rcx
call   10e0 <clCreateCommandQueue@plt>
mov    %eax,-0xf8(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x2a72(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1559 <main+0x289>
lea    0xc02(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0xf8(%rbp),%esi
lea    0xc12(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
lea    0xb1a(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
lea    0xc08(%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    -0x19(%rbp),%r8
call   1060 <clCreateProgramWithSource@plt>
mov    %eax,-0x10c(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x29e0(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     15eb <main+0x31b>
lea    0xbc2(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    -0x10c(%rbp),%esi
lea    0xbd7(%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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x2979(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     16ce <main+0x3fe>
mov    -0x10c(%rbp),%edi
mov    -0x84(%rbp),%esi
mov    0x298b(%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    0x294f(%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    0xb2a(%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    0xb32(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
lea    0x9ab(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    -0x10c(%rbp),%edi
lea    0xb1f(%rip),%rsi
lea    -0x19(%rbp),%rdx
call   11b0 <clCreateKernel@plt>
mov    %eax,-0x124(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x2897(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1734 <main+0x464>
lea    0xb02(%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    179a <main+0x4ca>
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    1760 <main+0x490>
mov    -0xf4(%rbp),%edi
mov    0x2809(%rip),%rax
mov    (%rax),%esi
mov    -0x130(%rbp),%rdx
shl    $0x0,%rdx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x19(%rbp),%r8
call   1080 <clCreateBuffer@plt>
mov    %eax,-0x140(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x27d6(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     17f5 <main+0x525>
lea    0xa69(%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    0x27e0(%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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x275c(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     186f <main+0x59f>
lea    0xa16(%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    18ca <main+0x5fa>
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    1890 <main+0x5c0>
mov    -0xf4(%rbp),%edi
mov    0x26d9(%rip),%rax
mov    (%rax),%esi
mov    -0x130(%rbp),%rdx
shl    $0x0,%rdx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x19(%rbp),%r8
call   1080 <clCreateBuffer@plt>
mov    %eax,-0x150(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x26a6(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1925 <main+0x655>
lea    0x939(%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    0x26b0(%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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x262c(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     199f <main+0x6cf>
lea    0x8e6(%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    0x2601(%rip),%rax
mov    (%rax),%esi
mov    -0x130(%rbp),%rdx
shl    $0x0,%rdx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x19(%rbp),%r8
call   1080 <clCreateBuffer@plt>
mov    %eax,-0x15c(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x259e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1a2d <main+0x75d>
lea    0x886(%rip),%rdi
mov    $0x0,%al
call   1100 <printf@plt>
mov    $0x1,%edi
call   11d0 <exit@plt>
mov    0x2574(%rip),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x124(%rbp),%edi
xor    %esi,%esi
mov    $0x4,%edx
lea    -0x140(%rbp),%rcx
call   11e0 <clSetKernelArg@plt>
movsbl %al,%ecx
movsbl -0x19(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x19(%rbp)
mov    -0x124(%rbp),%edi
mov    $0x1,%esi
mov    $0x4,%edx
lea    -0x150(%rbp),%rcx
call   11e0 <clSetKernelArg@plt>
movsbl %al,%ecx
movsbl -0x19(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x19(%rbp)
mov    -0x124(%rbp),%edi
mov    $0x2,%esi
mov    $0x4,%edx
lea    -0x15c(%rbp),%rcx
call   11e0 <clSetKernelArg@plt>
movsbl %al,%ecx
movsbl -0x19(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x24ef(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1adc <main+0x80c>
lea    0x7fb(%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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x245f(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1b6c <main+0x89c>
lea    0x793(%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    0x245e(%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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x23da(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1bf1 <main+0x921>
lea    0x73e(%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    0x745(%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    0x71e(%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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x2345(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1c86 <main+0x9b6>
lea    0x6f5(%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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x22fd(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1cce <main+0x9fe>
lea    0x6ad(%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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x22b5(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1d16 <main+0xa46>
lea    0x665(%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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x2279(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1d52 <main+0xa82>
lea    0x655(%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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x223d(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1d8e <main+0xabe>
lea    0x642(%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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x2201(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1dca <main+0xafa>
lea    0x630(%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    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x21c5(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1e06 <main+0xb36>
lea    0x623(%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    %al,0x1b(%rsp)
mov    0x2c85(%rip),%r13
cmp    0x0(%r13),%al
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    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
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    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
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    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
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    0x1b(%rsp),%r9
xor    %edi,%edi
mov    $0x1,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1150 <clCreateContext@plt>
mov    %eax,%ebx
mov    0x1b(%rsp),%al
cmp    0x0(%r13),%al
jne    1911 <main+0x621>
lea    0xc13(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1120 <printf@plt>
mov    0x1c(%rsp),%esi
lea    0x1b(%rsp),%rcx
mov    %ebx,%edi
xor    %edx,%edx
call   1100 <clCreateCommandQueue@plt>
mov    %eax,%esi
mov    0x1b(%rsp),%al
cmp    0x0(%r13),%al
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    0x1b(%rsp),%r8
mov    %ebx,%edi
mov    $0x1,%esi
mov    %rbp,%rcx
call   1070 <clCreateProgramWithSource@plt>
mov    %eax,%ebp
mov    0x1b(%rsp),%al
cmp    0x0(%r13),%al
jne    1929 <main+0x639>
lea    0xbb3(%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    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
jne    1935 <main+0x645>
lea    0xbe2(%rip),%rdi
call   1080 <puts@plt>
mov    $0xa,%edi
call   1050 <putchar@plt>
lea    0xb9e(%rip),%rsi
lea    0x1b(%rsp),%rdx
mov    %ebp,0x3c(%rsp)
mov    %ebp,%edi
call   11d0 <clCreateKernel@plt>
mov    %eax,0x2c(%rsp)
mov    0x1b(%rsp),%al
cmp    0x0(%r13),%al
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    0x1b(%rsp),%r8
mov    $0xa,%edx
mov    %ebx,%edi
xor    %ecx,%ecx
call   10a0 <clCreateBuffer@plt>
mov    %eax,0x38(%rsp)
mov    0x1b(%rsp),%cl
cmp    0x0(%r13),%cl
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    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
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    0x1b(%rsp),%r8
mov    $0xa,%edx
mov    0x20(%rsp),%edi
xor    %ecx,%ecx
call   10a0 <clCreateBuffer@plt>
mov    %eax,0x34(%rsp)
mov    0x1b(%rsp),%cl
cmp    0x0(%r13),%cl
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    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
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    0x1b(%rsp),%r8
mov    $0xa,%edx
mov    0x20(%rsp),%edi
xor    %ecx,%ecx
call   10a0 <clCreateBuffer@plt>
mov    %eax,0x24(%rsp)
mov    0x1b(%rsp),%al
cmp    0x0(%r13),%al
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     %al,0x1b(%rsp)
lea    0x34(%rsp),%rcx
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1200 <clSetKernelArg@plt>
or     %al,0x1b(%rsp)
lea    0x24(%rsp),%rcx
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1200 <clSetKernelArg@plt>
or     0x1b(%rsp),%al
mov    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
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    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
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    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
jne    19c2 <main+0x6d2>
mov    %r12,%rbx
mov    (%r14),%rdx
lea    0x934(%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    0x91a(%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    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
jne    18bd <main+0x5cd>
mov    %rbx,%rdi
call   1040 <free@plt>
mov    0x38(%rsp),%edi
call   11c0 <clReleaseMemObject@plt>
mov    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
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    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
jne    18bd <main+0x5cd>
mov    %ebx,%edi
call   1090 <clReleaseKernel@plt>
mov    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
mov    0x20(%rsp),%ebx
jne    19cb <main+0x6db>
mov    0x3c(%rsp),%edi
call   10b0 <clReleaseProgram@plt>
mov    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
jne    19d4 <main+0x6e4>
mov    %ebp,%edi
call   1180 <clReleaseCommandQueue@plt>
mov    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
jne    19dd <main+0x6ed>
mov    %ebx,%edi
call   11b0 <clReleaseContext@plt>
mov    %al,0x1b(%rsp)
cmp    0x0(%r13),%al
jne    19e6 <main+0x6f6>
xor    %eax,%eax
add    $0x1b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x907(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x9f8(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x9bf(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0xb2d(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0xaf7(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0xac4(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0xa90(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0xa5c(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0xa23(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x9e5(%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    0x739(%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    0x949(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x8ca(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x89a(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x862(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x82d(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x7d1(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x79f(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x768(%rip),%rdi
jmp    19ed <main+0x6fd>
lea    0x736(%rip),%rdi
call   1080 <puts@plt>
mov    $0x1,%edi
call   11f0 <exit@plt>

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

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