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

/* Variables and functions */
int /*<<< orphan*/ CL_DEVICE_TYPE_GPU;
int /*<<< orphan*/ CL_MEM_READ_ONLY;
int /*<<< orphan*/ CL_MEM_WRITE_ONLY;
scalar_t__ CL_SUCCESS;
int /*<<< orphan*/ CL_TRUE;
scalar_t__ clBuildProgram(int /*<<< orphan*/, int, int /*<<< orphan*/ **,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ clCreateBuffer(int /*<<< orphan*/, int /*<<< orphan*/,
                                  size_t const, int /*<<< orphan*/ *,
                                  scalar_t__ *);
int /*<<< orphan*/ clCreateCommandQueue(int /*<<< orphan*/,
                                        int /*<<< orphan*/ *,
                                        int /*<<< orphan*/, scalar_t__ *);
int /*<<< orphan*/ clCreateContext(int /*<<< orphan*/ *, int,
                                   int /*<<< orphan*/ **, int /*<<< orphan*/ *,
                                   int /*<<< orphan*/ *, scalar_t__ *);
int /*<<< orphan*/ clCreateKernel(int /*<<< orphan*/, char *, scalar_t__ *);
int /*<<< orphan*/ clCreateProgramWithSource(int /*<<< orphan*/, int,
                                             char const **, size_t const *,
                                             scalar_t__ *);
scalar_t__ clEnqueueNDRangeKernel(int /*<<< orphan*/, int /*<<< orphan*/, int,
                                  int /*<<< orphan*/ *, size_t *, size_t *,
                                  int /*<<< orphan*/, int /*<<< orphan*/ *,
                                  int /*<<< orphan*/ *);
scalar_t__ clEnqueueReadBuffer(int /*<<< orphan*/, int /*<<< orphan*/,
                               int /*<<< orphan*/, int /*<<< orphan*/,
                               size_t const, scalar_t__ *, int /*<<< orphan*/,
                               int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ clEnqueueWriteBuffer(int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/, int /*<<< orphan*/,
                                size_t const, scalar_t__ *, int /*<<< orphan*/,
                                int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ clFinish(int /*<<< orphan*/);
scalar_t__ clGetDeviceIDs(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                          int /*<<< orphan*/ **, int *);
scalar_t__ clGetPlatformIDs(int, int /*<<< orphan*/ **, int *);
scalar_t__ clSetKernelArg(int /*<<< orphan*/, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
size_t fread(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main() {
  cl_int ret;
  cl_platform_id platform = NULL;
  cl_uint num_platforms;
  cl_uint num_entries = 1;
  ret = clGetPlatformIDs(num_entries, &platform, &num_platforms);
  if (ret != CL_SUCCESS)
    printf("Error: in getting the platform IDs \n");
  else
    printf("The platform number is :%d \n", num_platforms);
  cl_device_id devices = NULL;
  cl_uint num_devices;
  ret = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, num_entries, &devices,
                       &num_devices);
  if (ret != CL_SUCCESS)
    printf("Error: in getting the Device IDs \n");
  else
    printf("The device id is :%d \n", num_devices);
  cl_context context;
  context = clCreateContext(NULL, num_devices, &devices, NULL, NULL, &ret);
  if (ret != CL_SUCCESS)
    printf("Error: in Creating Context \n");
  cl_command_queue cq;
  cq = clCreateCommandQueue(context, devices, 0, &ret);
  if (ret != CL_SUCCESS)
    printf("Error: in Creating command Queue \n");
  FILE *fp;
  char *source_str;
  size_t source_size;
  fp = fopen("matrix_mul.txt", "r");
  if (!fp) {
    fprintf(stderr, "Failed to load the kernel \n");
    exit(1);
  }
  source_str = (char *)malloc((0x100000));
  source_size = fread(source_str, 1, (0x100000), fp);
  fclose(fp);
  cl_program program;
  fprintf(stderr, "%s", source_str);
  program = clCreateProgramWithSource(context, 1, (const char **)&source_str,
                                      (const size_t *)&source_size, &ret);
  if (ret != CL_SUCCESS)
    printf("Error: in Creating The program \n");
  ret = clBuildProgram(program, 1, &devices, NULL, NULL, NULL);
  if (ret != CL_SUCCESS)
    printf("Error: in Building The program \n");
  cl_kernel kernel;
  kernel = clCreateKernel(program, "matrix_mul", &ret);
  if (ret != CL_SUCCESS)
    printf("Error: in Creating The Kernel \n");
  size_t dim = 8;
  size_t ldim = 4;
  const size_t num_elem = dim * dim;
  cl_int *A_host = (cl_int *)malloc(sizeof(cl_int) * num_elem);
  cl_int *B_host = (cl_int *)malloc(sizeof(cl_int) * num_elem);
  cl_int *C_host = (cl_int *)malloc(sizeof(cl_int) * num_elem);
  cl_int i;
  for (i = 0; i < num_elem; i++) {
    A_host[i] = i;
    B_host[i] = i;
  }
  cl_mem A_device;
  cl_mem B_device;
  cl_mem C_device;
  A_device = clCreateBuffer(context, CL_MEM_READ_ONLY,
                            num_elem * sizeof(cl_int), NULL, &ret);
  if (ret != CL_SUCCESS)
    printf("Error: in allocating buffer A in GPU \n");
  B_device = clCreateBuffer(context, CL_MEM_READ_ONLY,
                            num_elem * sizeof(cl_int), NULL, &ret);
  if (ret != CL_SUCCESS)
    printf("Error: in allocating buffer B in GPU \n");
  C_device = clCreateBuffer(context, CL_MEM_WRITE_ONLY,
                            num_elem * sizeof(cl_int), NULL, &ret);
  if (ret != CL_SUCCESS)
    printf("Error: in allocating buffer C in GPU \n");
  ret = clEnqueueWriteBuffer(cq, A_device, CL_TRUE, 0,
                             num_elem * sizeof(cl_int), A_host, 0, NULL, NULL);
  if (ret != CL_SUCCESS)
    printf("Error: in copying source buffer into GPU \n");
  ret = clEnqueueWriteBuffer(cq, B_device, CL_TRUE, 0,
                             num_elem * sizeof(cl_int), B_host, 0, NULL, NULL);
  if (ret != CL_SUCCESS)
    printf("Error: in copying source buffer into GPU \n");
  ret = clSetKernelArg(kernel, 0, sizeof(cl_mem), &A_device);
  if (ret != CL_SUCCESS)
    printf("Error: setting the first argument \n");
  ret = clSetKernelArg(kernel, 1, sizeof(cl_mem), &B_device);
  if (ret != CL_SUCCESS)
    printf("Error: setting the second argument \n");
  ret = clSetKernelArg(kernel, 2, sizeof(cl_mem), &C_device);
  if (ret != CL_SUCCESS)
    printf("Error: setting the third argument \n");
  ret = clSetKernelArg(kernel, 3, sizeof(cl_int) * ldim * ldim, NULL);
  if (ret != CL_SUCCESS)
    printf("Error: setting the forth argument \n");
  ret = clSetKernelArg(kernel, 4, sizeof(cl_int) * ldim * ldim, NULL);
  if (ret != CL_SUCCESS)
    printf("Error: setting the fifth argument \n");
  cl_uint dimension = 2;
  size_t global_work_size[2] = {dim, dim};
  size_t local_work_size[2] = {ldim, ldim};
  ret = clEnqueueNDRangeKernel(cq, kernel, dimension, NULL, global_work_size,
                               local_work_size, 0, NULL, NULL);
  if (ret != CL_SUCCESS)
    printf("Error: Launching Kernel \n");
  ret = clFinish(cq);
  if (ret != CL_SUCCESS)
    printf("Error: Finishing the execution \n");
  ret = clEnqueueReadBuffer(cq, C_device, CL_TRUE, 0, num_elem * sizeof(cl_int),
                            C_host, 0, NULL, NULL);
  if (ret != CL_SUCCESS)
    printf("Error: retrieving DST buffer into CPU \n");
  int j = 0;
  for (i = 0; i < dim; i++) {
    for (j = 0; j < dim; j++)
      printf("A[%d.%d] = %d \t", A_host[i], A_host[j], A_host[i * dim + j]);
    printf("\n");
  }
  printf("\n--------------------------------------------------------\n");
  for (i = 0; i < dim; i++) {
    for (j = 0; j < dim; j++)
      printf("C[%d.%d] = %d \t", A_host[i], B_host[j], C_host[i * dim + j]);
    printf("\n");
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10c0 <clGetPlatformIDs@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2d38(%rip),%rcx
cmp    (%rcx),%rax
je     129c <main+0x5c>
lea    0xd70(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
jmp    12ad <main+0x6d>
mov    -0x1c(%rbp),%esi
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2d18(%rip),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%edx
lea    -0x28(%rbp),%rcx
lea    -0x2c(%rbp),%r8
call   1080 <clGetDeviceIDs@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2cd7(%rip),%rcx
cmp    (%rcx),%rax
je     12fd <main+0xbd>
lea    0xd51(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
jmp    130e <main+0xce>
mov    -0x2c(%rbp),%esi
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x2c(%rbp),%esi
xor    %eax,%eax
mov    %eax,%r8d
lea    -0x28(%rbp),%rdx
lea    -0x10(%rbp),%r9
mov    %r8,%rdi
mov    %r8,%rcx
call   10e0 <clCreateContext@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2c81(%rip),%rcx
cmp    (%rcx),%rax
je     134e <main+0x10e>
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x30(%rbp),%edi
mov    -0x28(%rbp),%rsi
xor    %edx,%edx
lea    -0x10(%rbp),%rcx
call   10b0 <clCreateCommandQueue@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2c4a(%rip),%rcx
cmp    (%rcx),%rax
je     1385 <main+0x145>
lea    0xd1b(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
lea    0xd30(%rip),%rdi
lea    0xd38(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    13c8 <main+0x188>
mov    0x2c1a(%rip),%rax
mov    (%rax),%edi
lea    0xd16(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    $0x100000,%edi
call   1100 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rcx
mov    $0x1,%esi
mov    $0x100000,%edx
call   1060 <fread@plt>
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rdi
call   1090 <fclose@plt>
mov    0x2bc7(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rdx
lea    0xcdb(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    -0x30(%rbp),%edi
mov    $0x1,%esi
lea    -0x48(%rbp),%rdx
lea    -0x50(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1050 <clCreateProgramWithSource@plt>
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2b7c(%rip),%rcx
cmp    (%rcx),%rax
je     1453 <main+0x213>
lea    0xca0(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x54(%rbp),%edi
mov    $0x1,%esi
lea    -0x28(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%rcx
mov    %r9,%r8
call   1030 <clBuildProgram@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2b3a(%rip),%rcx
cmp    (%rcx),%rax
je     1495 <main+0x255>
lea    0xc7f(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x54(%rbp),%edi
lea    0xc8f(%rip),%rsi
lea    -0x10(%rbp),%rdx
call   1130 <clCreateKernel@plt>
mov    %eax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2b02(%rip),%rcx
cmp    (%rcx),%rax
je     14cd <main+0x28d>
lea    0xc73(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
movq   $0x8,-0x60(%rbp)
movq   $0x4,-0x68(%rbp)
mov    -0x60(%rbp),%rax
imul   -0x60(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1100 <malloc@plt>
mov    %rax,-0x78(%rbp)
mov    -0x70(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1100 <malloc@plt>
mov    %rax,-0x80(%rbp)
mov    -0x70(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1100 <malloc@plt>
mov    %rax,-0x88(%rbp)
movq   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%rax
cmp    -0x70(%rbp),%rax
jae    1585 <main+0x345>
mov    -0x90(%rbp),%rdx
mov    -0x78(%rbp),%rax
mov    -0x90(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x90(%rbp),%rdx
mov    -0x80(%rbp),%rax
mov    -0x90(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x90(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x90(%rbp)
jmp    1531 <main+0x2f1>
mov    -0x30(%rbp),%edi
mov    0x2a31(%rip),%rax
mov    (%rax),%esi
mov    -0x70(%rbp),%rdx
shl    $0x3,%rdx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x10(%rbp),%r8
call   1070 <clCreateBuffer@plt>
mov    %eax,-0x94(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2a01(%rip),%rcx
cmp    (%rcx),%rax
je     15ce <main+0x38e>
lea    0xb92(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x30(%rbp),%edi
mov    0x29e8(%rip),%rax
mov    (%rax),%esi
mov    -0x70(%rbp),%rdx
shl    $0x3,%rdx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x10(%rbp),%r8
call   1070 <clCreateBuffer@plt>
mov    %eax,-0x98(%rbp)
mov    -0x10(%rbp),%rax
mov    0x29b8(%rip),%rcx
cmp    (%rcx),%rax
je     1617 <main+0x3d7>
lea    0xb70(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x30(%rbp),%edi
mov    0x29bf(%rip),%rax
mov    (%rax),%esi
mov    -0x70(%rbp),%rdx
shl    $0x3,%rdx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x10(%rbp),%r8
call   1070 <clCreateBuffer@plt>
mov    %eax,-0x9c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x296f(%rip),%rcx
cmp    (%rcx),%rax
je     1660 <main+0x420>
lea    0xb4e(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x34(%rbp),%edi
mov    -0x94(%rbp),%esi
mov    0x2978(%rip),%rax
mov    (%rax),%edx
mov    -0x70(%rbp),%r8
shl    $0x3,%r8
mov    -0x78(%rbp),%r9
xor    %ecx,%ecx
xor    %eax,%eax
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   1160 <clEnqueueWriteBuffer@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2909(%rip),%rcx
cmp    (%rcx),%rax
je     16c6 <main+0x486>
lea    0xb0f(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x34(%rbp),%edi
mov    -0x98(%rbp),%esi
mov    0x2912(%rip),%rax
mov    (%rax),%edx
mov    -0x70(%rbp),%r8
shl    $0x3,%r8
mov    -0x80(%rbp),%r9
xor    %ecx,%ecx
xor    %eax,%eax
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   1160 <clEnqueueWriteBuffer@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28a3(%rip),%rcx
cmp    (%rcx),%rax
je     172c <main+0x4ec>
lea    0xaa9(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x58(%rbp),%edi
xor    %esi,%esi
mov    $0x4,%edx
lea    -0x94(%rbp),%rcx
call   1150 <clSetKernelArg@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2867(%rip),%rcx
cmp    (%rcx),%rax
je     1768 <main+0x528>
lea    0xa98(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x58(%rbp),%edi
mov    $0x1,%esi
mov    $0x4,%edx
lea    -0x98(%rbp),%rcx
call   1150 <clSetKernelArg@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2828(%rip),%rcx
cmp    (%rcx),%rax
je     17a7 <main+0x567>
lea    0xa7d(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x58(%rbp),%edi
mov    $0x2,%esi
mov    $0x4,%edx
lea    -0x9c(%rbp),%rcx
call   1150 <clSetKernelArg@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x27e9(%rip),%rcx
cmp    (%rcx),%rax
je     17e6 <main+0x5a6>
lea    0xa63(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x58(%rbp),%edi
mov    -0x68(%rbp),%rax
shl    $0x3,%rax
imul   -0x68(%rbp),%rax
mov    %eax,%edx
mov    $0x3,%esi
xor    %eax,%eax
mov    %eax,%ecx
call   1150 <clSetKernelArg@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x27a3(%rip),%rcx
cmp    (%rcx),%rax
je     182c <main+0x5ec>
lea    0xa41(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x58(%rbp),%edi
mov    -0x68(%rbp),%rax
shl    $0x3,%rax
imul   -0x68(%rbp),%rax
mov    %eax,%edx
mov    $0x4,%esi
xor    %eax,%eax
mov    %eax,%ecx
call   1150 <clSetKernelArg@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x275d(%rip),%rcx
cmp    (%rcx),%rax
je     1872 <main+0x632>
lea    0xa1f(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
movl   $0x2,-0xa0(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x58(%rbp),%esi
mov    -0xa0(%rbp),%edx
lea    -0xb0(%rbp),%r8
lea    -0xc0(%rbp),%r9
xor    %eax,%eax
mov    %eax,%ecx
xor    %eax,%eax
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   10a0 <clEnqueueNDRangeKernel@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x26c3(%rip),%rcx
cmp    (%rcx),%rax
je     190c <main+0x6cc>
lea    0x9a9(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x34(%rbp),%edi
call   1040 <clFinish@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2695(%rip),%rcx
cmp    (%rcx),%rax
je     193a <main+0x6fa>
lea    0x995(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x34(%rbp),%edi
mov    -0x9c(%rbp),%esi
mov    0x269e(%rip),%rax
mov    (%rax),%edx
mov    -0x70(%rbp),%r8
shl    $0x3,%r8
mov    -0x88(%rbp),%r9
xor    %ecx,%ecx
xor    %eax,%eax
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   1110 <clEnqueueReadBuffer@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x262c(%rip),%rcx
cmp    (%rcx),%rax
je     19a3 <main+0x763>
lea    0x94d(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
movl   $0x0,-0xc4(%rbp)
movq   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%rax
cmp    -0x60(%rbp),%rax
jae    1a67 <main+0x827>
movl   $0x0,-0xc4(%rbp)
movslq -0xc4(%rbp),%rax
cmp    -0x60(%rbp),%rax
jae    1a42 <main+0x802>
mov    -0x78(%rbp),%rax
mov    -0x90(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x78(%rbp),%rax
movslq -0xc4(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x78(%rbp),%rax
mov    -0x90(%rbp),%rcx
imul   -0x60(%rbp),%rcx
movslq -0xc4(%rbp),%rdi
add    %rdi,%rcx
mov    (%rax,%rcx,8),%rcx
lea    0x8ea(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    19d3 <main+0x793>
lea    0x8c6(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x90(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x90(%rbp)
jmp    19b8 <main+0x778>
lea    0x8b3(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
movq   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%rax
cmp    -0x60(%rbp),%rax
jae    1b32 <main+0x8f2>
movl   $0x0,-0xc4(%rbp)
movslq -0xc4(%rbp),%rax
cmp    -0x60(%rbp),%rax
jae    1b0d <main+0x8cd>
mov    -0x78(%rbp),%rax
mov    -0x90(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x80(%rbp),%rax
movslq -0xc4(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x88(%rbp),%rax
mov    -0x90(%rbp),%rcx
imul   -0x60(%rbp),%rcx
movslq -0xc4(%rbp),%rdi
add    %rdi,%rcx
mov    (%rax,%rcx,8),%rcx
lea    0x86a(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    1a9b <main+0x85b>
lea    0x7fb(%rip),%rdi
mov    $0x0,%al
call   10d0 <printf@plt>
mov    -0x90(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x90(%rbp)
jmp    1a80 <main+0x840>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
movq   $0x0,0x60(%rsp)
lea    0x60(%rsp),%rsi
lea    0x54(%rsp),%rdx
mov    $0x1,%edi
call   10e0 <clGetPlatformIDs@plt>
mov    %rax,0x20(%rsp)
mov    0x2d1e(%rip),%rbp
cmp    0x0(%rbp),%rax
jne    12b4 <main+0x54>
mov    0x54(%rsp),%esi
lea    0xf85(%rip),%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
jmp    12c0 <main+0x60>
lea    0x12a9(%rip),%rdi
call   1070 <puts@plt>
movq   $0x0,0x38(%rsp)
mov    0x60(%rsp),%rdi
mov    0x2d03(%rip),%rax
mov    (%rax),%esi
lea    0x38(%rsp),%rcx
lea    0x34(%rsp),%r8
mov    $0x1,%edx
call   10a0 <clGetDeviceIDs@plt>
mov    %rax,0x20(%rsp)
cmp    0x0(%rbp),%rax
jne    130a <main+0xaa>
mov    0x34(%rsp),%esi
lea    0xf4c(%rip),%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
jmp    1316 <main+0xb6>
lea    0x1231(%rip),%rdi
call   1070 <puts@plt>
mov    0x34(%rsp),%esi
lea    0x38(%rsp),%rdx
lea    0x20(%rsp),%r9
xor    %edi,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1100 <clCreateContext@plt>
mov    %eax,%r12d
mov    0x20(%rsp),%rax
cmp    0x0(%rbp),%rax
je     134a <main+0xea>
lea    0x11e1(%rip),%rdi
call   1070 <puts@plt>
mov    0x38(%rsp),%rsi
lea    0x20(%rsp),%rcx
mov    %r12d,%edi
xor    %edx,%edx
call   10d0 <clCreateCommandQueue@plt>
mov    %eax,%r13d
mov    0x20(%rsp),%rax
cmp    0x0(%rbp),%rax
je     1378 <main+0x118>
lea    0x1191(%rip),%rdi
call   1070 <puts@plt>
lea    0xee5(%rip),%rdi
lea    0xeed(%rip),%rsi
call   1140 <fopen@plt>
test   %rax,%rax
je     1c52 <main+0x9f2>
mov    %rax,%rbx
mov    $0x100000,%edi
call   1120 <malloc@plt>
mov    %rax,0x58(%rsp)
mov    %rax,%rdi
mov    $0x1,%esi
mov    $0x100000,%edx
mov    %rbx,%rcx
call   1080 <fread@plt>
mov    %rax,0x68(%rsp)
mov    %rbx,%rdi
call   10b0 <fclose@plt>
mov    0x2bf9(%rip),%rax
mov    (%rax),%edi
mov    0x58(%rsp),%rdx
lea    0xeb4(%rip),%rsi
xor    %eax,%eax
call   1110 <fprintf@plt>
lea    0x58(%rsp),%rdx
lea    0x68(%rsp),%rcx
lea    0x20(%rsp),%r8
mov    %r12d,%edi
mov    $0x1,%esi
call   1060 <clCreateProgramWithSource@plt>
mov    %eax,%ebx
mov    0x20(%rsp),%rax
cmp    0x0(%rbp),%rax
je     1419 <main+0x1b9>
lea    0x10d0(%rip),%rdi
call   1070 <puts@plt>
lea    0x38(%rsp),%rdx
mov    %ebx,%edi
mov    $0x1,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <clBuildProgram@plt>
mov    %rax,0x20(%rsp)
cmp    0x0(%rbp),%rax
je     1449 <main+0x1e9>
lea    0x1080(%rip),%rdi
call   1070 <puts@plt>
lea    0xe44(%rip),%rsi
lea    0x20(%rsp),%rdx
mov    %ebx,%edi
call   1150 <clCreateKernel@plt>
mov    %eax,0x48(%rsp)
mov    0x20(%rsp),%rax
cmp    0x0(%rbp),%rax
je     1477 <main+0x217>
lea    0x1033(%rip),%rdi
call   1070 <puts@plt>
mov    $0x200,%edi
call   1120 <malloc@plt>
mov    %rax,%rbx
mov    $0x200,%edi
call   1120 <malloc@plt>
mov    %rax,%r14
mov    $0x200,%edi
call   1120 <malloc@plt>
mov    %rax,%r15
lea    0x200(%r14),%rax
cmp    %rax,%rbx
mov    %r13d,0x2c(%rsp)
jae    1501 <main+0x2a1>
mov    %rbx,%rax
add    $0x200,%rax
cmp    %rax,%r14
jae    1501 <main+0x2a1>
xor    %eax,%eax
nop
mov    %rax,(%rbx,%rax,8)
mov    %rax,(%r14,%rax,8)
lea    0x1(%rax),%rcx
mov    %rcx,0x8(%rbx,%rax,8)
mov    %rcx,0x8(%r14,%rax,8)
lea    0x2(%rax),%rcx
mov    %rcx,0x10(%rbx,%rax,8)
mov    %rcx,0x10(%r14,%rax,8)
lea    0x3(%rax),%rcx
mov    %rcx,0x18(%rbx,%rax,8)
mov    %rcx,0x18(%r14,%rax,8)
add    $0x4,%rax
cmp    $0x40,%rax
jne    14c0 <main+0x260>
jmp    178f <main+0x52f>
movaps 0xaf8(%rip),%xmm0
movups %xmm0,(%rbx)
movups %xmm0,(%r14)
movaps 0xafa(%rip),%xmm0
movups %xmm0,0x10(%rbx)
movups %xmm0,0x10(%r14)
movaps 0xafa(%rip),%xmm0
movups %xmm0,0x20(%rbx)
movups %xmm0,0x20(%r14)
movaps 0xafa(%rip),%xmm0
movups %xmm0,0x30(%rbx)
movups %xmm0,0x30(%r14)
movaps 0xafa(%rip),%xmm0
movups %xmm0,0x40(%rbx)
movups %xmm0,0x40(%r14)
movaps 0xafa(%rip),%xmm0
movups %xmm0,0x50(%rbx)
movups %xmm0,0x50(%r14)
movaps 0xafa(%rip),%xmm0
movups %xmm0,0x60(%rbx)
movups %xmm0,0x60(%r14)
movaps 0xafa(%rip),%xmm0
movups %xmm0,0x70(%rbx)
movups %xmm0,0x70(%r14)
movaps 0xafa(%rip),%xmm0
movups %xmm0,0x80(%rbx)
movups %xmm0,0x80(%r14)
movaps 0xaf4(%rip),%xmm0
movups %xmm0,0x90(%rbx)
movups %xmm0,0x90(%r14)
movaps 0xaee(%rip),%xmm0
movups %xmm0,0xa0(%rbx)
movups %xmm0,0xa0(%r14)
movaps 0xae8(%rip),%xmm0
movups %xmm0,0xb0(%rbx)
movups %xmm0,0xb0(%r14)
movaps 0xae2(%rip),%xmm0
movups %xmm0,0xc0(%rbx)
movups %xmm0,0xc0(%r14)
movaps 0xadc(%rip),%xmm0
movups %xmm0,0xd0(%rbx)
movups %xmm0,0xd0(%r14)
movaps 0xad6(%rip),%xmm0
movups %xmm0,0xe0(%rbx)
movups %xmm0,0xe0(%r14)
movaps 0xad0(%rip),%xmm0
movups %xmm0,0xf0(%rbx)
movups %xmm0,0xf0(%r14)
movaps 0xaca(%rip),%xmm0
movups %xmm0,0x100(%rbx)
movups %xmm0,0x100(%r14)
movaps 0xac4(%rip),%xmm0
movups %xmm0,0x110(%rbx)
movups %xmm0,0x110(%r14)
movaps 0xabe(%rip),%xmm0
movups %xmm0,0x120(%rbx)
movups %xmm0,0x120(%r14)
movaps 0xab8(%rip),%xmm0
movups %xmm0,0x130(%rbx)
movups %xmm0,0x130(%r14)
movaps 0xab2(%rip),%xmm0
movups %xmm0,0x140(%rbx)
movups %xmm0,0x140(%r14)
movaps 0xaac(%rip),%xmm0
movups %xmm0,0x150(%rbx)
movups %xmm0,0x150(%r14)
movaps 0xaa6(%rip),%xmm0
movups %xmm0,0x160(%rbx)
movups %xmm0,0x160(%r14)
movaps 0xaa0(%rip),%xmm0
movups %xmm0,0x170(%rbx)
movups %xmm0,0x170(%r14)
movaps 0xa9a(%rip),%xmm0
movups %xmm0,0x180(%rbx)
movups %xmm0,0x180(%r14)
movaps 0xa94(%rip),%xmm0
movups %xmm0,0x190(%rbx)
movups %xmm0,0x190(%r14)
movaps 0xa8e(%rip),%xmm0
movups %xmm0,0x1a0(%rbx)
movups %xmm0,0x1a0(%r14)
movaps 0xa88(%rip),%xmm0
movups %xmm0,0x1b0(%rbx)
movups %xmm0,0x1b0(%r14)
movaps 0xa82(%rip),%xmm0
movups %xmm0,0x1c0(%rbx)
movups %xmm0,0x1c0(%r14)
movaps 0xa7c(%rip),%xmm0
movups %xmm0,0x1d0(%rbx)
movups %xmm0,0x1d0(%r14)
movaps 0xa76(%rip),%xmm0
movups %xmm0,0x1e0(%rbx)
movups %xmm0,0x1e0(%r14)
movaps 0xa70(%rip),%xmm0
movups %xmm0,0x1f0(%rbx)
movups %xmm0,0x1f0(%r14)
mov    0x282a(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0x20(%rsp),%r8
mov    $0x200,%edx
mov    %r12d,%r13d
mov    %r12d,%edi
xor    %ecx,%ecx
call   1090 <clCreateBuffer@plt>
mov    %eax,0x40(%rsp)
mov    %eax,0x50(%rsp)
mov    0x20(%rsp),%rax
mov    0x27f4(%rip),%rcx
cmp    (%rcx),%rax
je     17d5 <main+0x575>
lea    0xcaf(%rip),%rdi
call   1070 <puts@plt>
mov    0x0(%rbp),%esi
lea    0x20(%rsp),%r8
mov    $0x200,%edx
mov    %r13d,%edi
xor    %ecx,%ecx
call   1090 <clCreateBuffer@plt>
mov    %eax,0x44(%rsp)
mov    %eax,0x4c(%rsp)
mov    0x20(%rsp),%rax
mov    0x27b8(%rip),%r12
cmp    (%r12),%rax
je     1812 <main+0x5b2>
lea    0xc4c(%rip),%rdi
call   1070 <puts@plt>
mov    0x27c7(%rip),%rax
mov    (%rax),%esi
lea    0x20(%rsp),%r8
mov    $0x200,%edx
mov    %r13d,%edi
xor    %ecx,%ecx
call   1090 <clCreateBuffer@plt>
mov    %eax,0x30(%rsp)
mov    0x20(%rsp),%rax
cmp    (%r12),%rax
je     184a <main+0x5ea>
lea    0xbee(%rip),%rdi
call   1070 <puts@plt>
mov    0x2797(%rip),%rbp
mov    0x0(%rbp),%edx
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movl   $0x0,(%rsp)
mov    $0x200,%r8d
mov    0x2c(%rsp),%edi
mov    0x40(%rsp),%esi
xor    %ecx,%ecx
mov    %rbx,%r9
call   1180 <clEnqueueWriteBuffer@plt>
mov    %rax,0x20(%rsp)
cmp    (%r12),%rax
je     1892 <main+0x632>
lea    0xb7c(%rip),%rdi
call   1070 <puts@plt>
mov    0x0(%rbp),%edx
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movl   $0x0,(%rsp)
mov    $0x200,%r8d
mov    0x2c(%rsp),%r13d
mov    %r13d,%edi
mov    0x44(%rsp),%esi
xor    %ecx,%ecx
mov    %r14,%r9
call   1180 <clEnqueueWriteBuffer@plt>
mov    %rax,0x20(%rsp)
cmp    (%r12),%rax
je     18d7 <main+0x677>
lea    0xb37(%rip),%rdi
call   1070 <puts@plt>
lea    0x50(%rsp),%rcx
mov    0x48(%rsp),%ebp
mov    %ebp,%edi
xor    %esi,%esi
mov    $0x4,%edx
call   1170 <clSetKernelArg@plt>
mov    %rax,0x20(%rsp)
cmp    (%r12),%rax
je     1905 <main+0x6a5>
lea    0xae6(%rip),%rdi
call   1070 <puts@plt>
lea    0x4c(%rsp),%rcx
mov    %ebp,%edi
mov    $0x1,%esi
mov    $0x4,%edx
call   1170 <clSetKernelArg@plt>
mov    %rax,0x20(%rsp)
cmp    (%r12),%rax
je     1932 <main+0x6d2>
lea    0xa95(%rip),%rdi
call   1070 <puts@plt>
lea    0x30(%rsp),%rcx
mov    %ebp,%edi
mov    $0x2,%esi
mov    $0x4,%edx
call   1170 <clSetKernelArg@plt>
mov    %rax,0x20(%rsp)
cmp    (%r12),%rax
je     195f <main+0x6ff>
lea    0xa45(%rip),%rdi
call   1070 <puts@plt>
mov    %ebp,%edi
mov    $0x3,%esi
mov    $0x80,%edx
xor    %ecx,%ecx
call   1170 <clSetKernelArg@plt>
mov    %rax,0x20(%rsp)
cmp    (%r12),%rax
je     1989 <main+0x729>
lea    0x9f8(%rip),%rdi
call   1070 <puts@plt>
mov    %ebp,%edi
mov    $0x4,%esi
mov    $0x80,%edx
xor    %ecx,%ecx
call   1170 <clSetKernelArg@plt>
mov    %rax,0x20(%rsp)
cmp    (%r12),%rax
je     19b3 <main+0x753>
lea    0x9ab(%rip),%rdi
call   1070 <puts@plt>
movaps 0x846(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0x847(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movl   $0x0,(%rsp)
lea    0x80(%rsp),%r8
lea    0x70(%rsp),%r9
mov    %r13d,%edi
mov    %ebp,%esi
mov    $0x2,%edx
xor    %ecx,%ecx
call   10c0 <clEnqueueNDRangeKernel@plt>
mov    %rax,0x20(%rsp)
cmp    (%r12),%rax
je     1a12 <main+0x7b2>
lea    0x933(%rip),%rdi
call   1070 <puts@plt>
mov    %r13d,%edi
call   1050 <clFinish@plt>
mov    %rax,0x20(%rsp)
cmp    (%r12),%rax
je     1a31 <main+0x7d1>
lea    0x8f4(%rip),%rdi
call   1070 <puts@plt>
mov    0x30(%rsp),%esi
mov    0x25ac(%rip),%rax
mov    (%rax),%edx
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movl   $0x0,(%rsp)
mov    $0x200,%r8d
mov    %r13d,%edi
xor    %ecx,%ecx
mov    %r15,%r9
call   1130 <clEnqueueReadBuffer@plt>
mov    %rax,0x20(%rsp)
cmp    (%r12),%rax
je     1a77 <main+0x817>
lea    0x887(%rip),%rdi
call   1070 <puts@plt>
lea    0x821(%rip),%r12
xor    %ebp,%ebp
mov    (%rbx,%rbp,1),%rsi
mov    (%rbx),%rdx
mov    (%rbx,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x8(%rbx),%rdx
mov    0x8(%rbx,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x10(%rbx),%rdx
mov    0x10(%rbx,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x18(%rbx),%rdx
mov    0x18(%rbx,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x20(%rbx),%rdx
mov    0x20(%rbx,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x28(%rbx),%rdx
mov    0x28(%rbx,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x30(%rbx),%rdx
mov    0x30(%rbx,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x38(%rbx),%rdx
mov    0x38(%rbx,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
add    $0x8,%rbp
cmp    $0x40,%rbp
jne    1a80 <main+0x820>
lea    0x76a(%rip),%rdi
call   1070 <puts@plt>
lea    0x74e(%rip),%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx,%rbp,1),%rsi
mov    (%r14),%rdx
mov    (%r15,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x8(%r14),%rdx
mov    0x8(%r15,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x10(%r14),%rdx
mov    0x10(%r15,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x18(%r14),%rdx
mov    0x18(%r15,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x20(%r14),%rdx
mov    0x20(%r15,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x28(%r14),%rdx
mov    0x28(%r15,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x30(%r14),%rdx
mov    0x30(%r15,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    (%rbx,%rbp,1),%rsi
mov    0x38(%r14),%rdx
mov    0x38(%r15,%rbp,8),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10f0 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
add    $0x8,%rbp
cmp    $0x40,%rbp
jne    1b70 <main+0x910>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x236f(%rip),%rax
mov    (%rax),%edi
lea    0x613(%rip),%rsi
xor    %eax,%eax
call   1110 <fprintf@plt>
mov    $0x1,%edi
call   1160 <exit@plt>

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

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