#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*/ string;
typedef int /*<<< orphan*/ dims;
typedef int cl_ulong;
typedef int cl_uint;
typedef int /*<<< orphan*/ cl_platform_id;
typedef int /*<<< orphan*/ cl_int;
typedef int /*<<< orphan*/ cl_device_id;
typedef char cl_char;

/* Variables and functions */
int /*<<< orphan*/ CL_DEVICE_GLOBAL_MEM_SIZE;
int /*<<< orphan*/ CL_DEVICE_LOCAL_MEM_SIZE;
int /*<<< orphan*/ CL_DEVICE_MAX_CLOCK_FREQUENCY;
int /*<<< orphan*/ CL_DEVICE_MAX_COMPUTE_UNITS;
int /*<<< orphan*/ CL_DEVICE_MAX_MEM_ALLOC_SIZE;
int /*<<< orphan*/ CL_DEVICE_MAX_WORK_GROUP_SIZE;
int /*<<< orphan*/ CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS;
int /*<<< orphan*/ CL_DEVICE_MAX_WORK_ITEM_SIZES;
int /*<<< orphan*/ CL_DEVICE_NAME;
int /*<<< orphan*/ CL_DEVICE_OPENCL_C_VERSION;
int /*<<< orphan*/ CL_DEVICE_TYPE_ALL;
int /*<<< orphan*/ CL_PLATFORM_NAME;
int /*<<< orphan*/ CL_PLATFORM_VENDOR;
int /*<<< orphan*/ CL_PLATFORM_VERSION;
int /*<<< orphan*/ clGetDeviceIDs(int /*<<< orphan*/, int /*<<< orphan*/, int,
                                  int /*<<< orphan*/ *, int *);
int /*<<< orphan*/ clGetDeviceInfo(int /*<<< orphan*/, int /*<<< orphan*/, int,
                                   ...);
int /*<<< orphan*/ clGetPlatformIDs(int, int /*<<< orphan*/ *, int *);
int /*<<< orphan*/ clGetPlatformInfo(int /*<<< orphan*/, int /*<<< orphan*/,
                                     int, char **, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  cl_int err;
  cl_uint num_platforms;
  err = clGetPlatformIDs(0, NULL, &num_platforms);
  printf("[INFO]  Number of OpenCL platforms: %d\n", num_platforms);
  cl_platform_id platform[num_platforms];
  err = clGetPlatformIDs(num_platforms, platform, NULL);
  for (int i = 0; i < num_platforms; ++i) {
    printf("\n---------------------------------------------\n");
    printf("[INFO]  Platform: %d\n", i);
    cl_char string[10240] = {0};
    err = clGetPlatformInfo(platform[i], CL_PLATFORM_NAME, sizeof(string),
                            &string, NULL);
    printf("[INFO]  Platform name: %s\n", string);
    err = clGetPlatformInfo(platform[i], CL_PLATFORM_VENDOR, sizeof(string),
                            &string, NULL);
    printf("[INFO]  Platform vendor: %s\n", string);
    err = clGetPlatformInfo(platform[i], CL_PLATFORM_VERSION, sizeof(string),
                            &string, NULL);
    printf("[INFO]  Platform version: %s\n", string);
    cl_uint num_devices;
    err =
        clGetDeviceIDs(platform[i], CL_DEVICE_TYPE_ALL, 0, NULL, &num_devices);
    printf("[INFO]  Number of devices: %d\n", num_devices);
    cl_device_id device[num_devices];
    err = clGetDeviceIDs(platform[i], CL_DEVICE_TYPE_ALL, num_devices, device,
                         NULL);
    for (int j = 0; j < num_devices; ++j) {
      printf("\n----------------------------------------\n");
      printf("[INFO]  Device ID: %d\n", j);
      err = clGetDeviceInfo(device[j], CL_DEVICE_NAME, sizeof(string), &string,
                            NULL);
      printf("[INFO]  Device name: %s\n", string);
      cl_uint max_clock_frequency;
      err = clGetDeviceInfo(device[j], CL_DEVICE_MAX_CLOCK_FREQUENCY,
                            sizeof(cl_uint), &max_clock_frequency, NULL);
      printf("[INFO]  Device max clock frequency: %d MHz\n",
             max_clock_frequency);
      err = clGetDeviceInfo(device[j], CL_DEVICE_OPENCL_C_VERSION,
                            sizeof(string), &string, NULL);
      printf("[INFO]  Device OpenCL C version: %s\n", string);
      cl_uint num_compute_units;
      err = clGetDeviceInfo(device[j], CL_DEVICE_MAX_COMPUTE_UNITS,
                            sizeof(cl_uint), &num_compute_units, NULL);
      printf("[INFO]  Device max compute units: %d\n", num_compute_units);
      cl_ulong local_mem_size;
      err = clGetDeviceInfo(device[j], CL_DEVICE_LOCAL_MEM_SIZE,
                            sizeof(cl_ulong), &local_mem_size, NULL);
      printf("[INFO]  Device local memory size: %lu KB\n",
             local_mem_size / 1024);
      cl_ulong global_mem_size;
      err = clGetDeviceInfo(device[j], CL_DEVICE_GLOBAL_MEM_SIZE,
                            sizeof(cl_ulong), &global_mem_size, NULL);
      printf("[INFO]  Device global memory size: %lu GB\n",
             global_mem_size / (1024 * 1024 * 1024));
      cl_ulong max_buffer_alloc;
      err = clGetDeviceInfo(device[j], CL_DEVICE_MAX_MEM_ALLOC_SIZE,
                            sizeof(cl_ulong), &max_buffer_alloc, NULL);
      printf("[INFO]  Device Max Memory Alloc. Size: %lu MB\n",
             max_buffer_alloc / (1024 * 1024));
      size_t work_group_size;
      err = clGetDeviceInfo(device[j], CL_DEVICE_MAX_WORK_GROUP_SIZE,
                            sizeof(size_t), &work_group_size, NULL);
      printf("[INFO]  Device Max Workgroup Size"
             "(max number of work-items in a workgroup): %ld\n",
             work_group_size);
      size_t max_dim_workgroup;
      err = clGetDeviceInfo(device[j], CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS,
                            sizeof(cl_uint), &max_dim_workgroup, NULL);
      printf("[INFO]  Device Max work-item dims: %ld\n", max_dim_workgroup);
      size_t dims[max_dim_workgroup];
      err = clGetDeviceInfo(device[j], CL_DEVICE_MAX_WORK_ITEM_SIZES,
                            sizeof(dims), &dims, NULL);
      printf("[INFO]  Max Work-group Dims: ( ");
      for (size_t k = 0; k < max_dim_workgroup; ++k) {
        printf("%ld ", dims[k]);
      }
      printf(")\n");
      printf("\n----------------------------------------\n");
    }
    printf("\n---------------------------------------------\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2900,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
mov    %edi,-0x2894(%rbp)
mov    %edi,%esi
lea    -0xc(%rbp),%rdx
call   1050 <clGetPlatformIDs@plt>
mov    %eax,%ecx
mov    -0x2894(%rbp),%eax
mov    %ecx,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe66(%rip),%rdi
call   1060 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x2890(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <clGetPlatformIDs@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    18a4 <main+0x744>
lea    0xe36(%rip),%rdi
xor    %eax,%eax
mov    %eax,-0x28b4(%rbp)
mov    %al,-0x28a1(%rbp)
call   1060 <printf@plt>
mov    -0x28a1(%rbp),%al
mov    -0x24(%rbp),%esi
lea    0xe43(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28b4(%rbp),%esi
lea    -0x2830(%rbp),%rdi
mov    %rdi,-0x28c0(%rbp)
mov    $0x2800,%edx
call   1070 <memset@plt>
mov    -0x28c0(%rbp),%rcx
mov    -0x2890(%rbp),%rdx
mov    -0x28b4(%rbp),%eax
movslq -0x24(%rbp),%rsi
mov    (%rdx,%rsi,4),%edi
mov    0x2d4e(%rip),%rdx
mov    (%rdx),%esi
mov    %eax,%r8d
mov    %r8,-0x28b0(%rbp)
mov    $0x2800,%edx
mov    %edx,-0x28c4(%rbp)
call   1080 <clGetPlatformInfo@plt>
mov    -0x28c0(%rbp),%rsi
mov    %eax,%ecx
mov    -0x28a1(%rbp),%al
mov    %ecx,-0x8(%rbp)
lea    0xddf(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28c4(%rbp),%edx
mov    -0x28c0(%rbp),%rcx
mov    -0x28b0(%rbp),%r8
mov    -0x2890(%rbp),%rax
movslq -0x24(%rbp),%rsi
mov    (%rax,%rsi,4),%edi
mov    0x2cbb(%rip),%rax
mov    (%rax),%esi
call   1080 <clGetPlatformInfo@plt>
mov    -0x28c0(%rbp),%rsi
mov    %eax,%ecx
mov    -0x28a1(%rbp),%al
mov    %ecx,-0x8(%rbp)
lea    0xdac(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28c4(%rbp),%edx
mov    -0x28c0(%rbp),%rcx
mov    -0x28b0(%rbp),%r8
mov    -0x2890(%rbp),%rax
movslq -0x24(%rbp),%rsi
mov    (%rax,%rsi,4),%edi
mov    0x2c7d(%rip),%rax
mov    (%rax),%esi
call   1080 <clGetPlatformInfo@plt>
mov    -0x28c0(%rbp),%rsi
mov    %eax,%ecx
mov    -0x28a1(%rbp),%al
mov    %ecx,-0x8(%rbp)
lea    0xd7b(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28b4(%rbp),%edx
mov    -0x28b0(%rbp),%rcx
mov    -0x2890(%rbp),%rax
movslq -0x24(%rbp),%rsi
mov    (%rax,%rsi,4),%edi
mov    0x2c66(%rip),%rax
mov    (%rax),%esi
lea    -0x2834(%rbp),%r8
call   1030 <clGetDeviceIDs@plt>
mov    %eax,%ecx
mov    -0x28a1(%rbp),%al
mov    %ecx,-0x8(%rbp)
mov    -0x2834(%rbp),%esi
lea    0xd4c(%rip),%rdi
call   1060 <printf@plt>
mov    -0x2890(%rbp),%rax
mov    -0x2834(%rbp),%ecx
mov    %ecx,%edx
mov    %rsp,%rcx
mov    %rcx,-0x2840(%rbp)
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rcx
sub    %rsi,%rcx
mov    %rcx,-0x28a0(%rbp)
mov    %rcx,%rsp
mov    %rdx,-0x2848(%rbp)
movslq -0x24(%rbp),%rdx
mov    (%rax,%rdx,4),%edi
mov    0x2bf1(%rip),%rax
mov    (%rax),%esi
mov    -0x2834(%rbp),%edx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <clGetDeviceIDs@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x284c(%rbp)
mov    -0x284c(%rbp),%eax
cmp    -0x2834(%rbp),%eax
jge    187e <main+0x71e>
lea    0xce4(%rip),%rdi
xor    %eax,%eax
mov    %eax,-0x28f8(%rbp)
mov    %al,-0x28d1(%rbp)
call   1060 <printf@plt>
mov    -0x28d1(%rbp),%al
mov    -0x284c(%rbp),%esi
lea    0xce9(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28f8(%rbp),%ecx
mov    -0x28a0(%rbp),%rdx
mov    -0x28d1(%rbp),%al
movslq -0x284c(%rbp),%rsi
mov    (%rdx,%rsi,4),%edi
mov    0x2b52(%rip),%rdx
mov    (%rdx),%esi
mov    %ecx,%r8d
mov    %r8,-0x28e0(%rbp)
mov    $0x2800,%edx
mov    %edx,-0x28f4(%rbp)
lea    -0x2830(%rbp),%rcx
mov    %rcx,-0x28f0(%rbp)
call   1040 <clGetDeviceInfo@plt>
mov    -0x28f0(%rbp),%rsi
mov    %eax,%ecx
mov    -0x28d1(%rbp),%al
mov    %ecx,-0x8(%rbp)
lea    0xc94(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28e0(%rbp),%r8
mov    -0x28a0(%rbp),%rcx
mov    -0x28d1(%rbp),%al
movslq -0x284c(%rbp),%rdx
mov    (%rcx,%rdx,4),%edi
mov    0x2b15(%rip),%rcx
mov    (%rcx),%esi
mov    $0x4,%edx
mov    %edx,-0x28e4(%rbp)
lea    -0x2850(%rbp),%rcx
call   1040 <clGetDeviceInfo@plt>
mov    %eax,%ecx
mov    -0x28d1(%rbp),%al
mov    %ecx,-0x8(%rbp)
mov    -0x2850(%rbp),%esi
lea    0xc52(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28f4(%rbp),%edx
mov    -0x28f0(%rbp),%rcx
mov    -0x28e0(%rbp),%r8
mov    -0x28a0(%rbp),%rsi
mov    -0x28d1(%rbp),%al
movslq -0x284c(%rbp),%rdi
mov    (%rsi,%rdi,4),%edi
mov    0x2a9d(%rip),%rsi
mov    (%rsi),%esi
call   1040 <clGetDeviceInfo@plt>
mov    -0x28f0(%rbp),%rsi
mov    %eax,%ecx
mov    -0x28d1(%rbp),%al
mov    %ecx,-0x8(%rbp)
lea    0xc27(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28e4(%rbp),%edx
mov    -0x28e0(%rbp),%r8
mov    -0x28a0(%rbp),%rcx
mov    -0x28d1(%rbp),%al
movslq -0x284c(%rbp),%rsi
mov    (%rcx,%rsi,4),%edi
mov    0x2a6d(%rip),%rcx
mov    (%rcx),%esi
lea    -0x2854(%rbp),%rcx
call   1040 <clGetDeviceInfo@plt>
mov    %eax,%ecx
mov    -0x28d1(%rbp),%al
mov    %ecx,-0x8(%rbp)
mov    -0x2854(%rbp),%esi
lea    0xbf6(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28e4(%rbp),%edx
mov    -0x28e0(%rbp),%r8
mov    -0x28a0(%rbp),%rcx
mov    -0x28d1(%rbp),%al
movslq -0x284c(%rbp),%rsi
mov    (%rcx,%rsi,4),%edi
mov    0x29c7(%rip),%rcx
mov    (%rcx),%esi
lea    -0x2858(%rbp),%rcx
call   1040 <clGetDeviceInfo@plt>
mov    %eax,%ecx
mov    -0x28d1(%rbp),%al
mov    %ecx,-0x8(%rbp)
mov    -0x2858(%rbp),%esi
mov    %esi,%ecx
add    $0x3ff,%ecx
test   %esi,%esi
cmovs  %ecx,%esi
sar    $0xa,%esi
lea    0xbb6(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28e4(%rbp),%edx
mov    -0x28e0(%rbp),%r8
mov    -0x28a0(%rbp),%rcx
mov    -0x28d1(%rbp),%al
movslq -0x284c(%rbp),%rsi
mov    (%rcx,%rsi,4),%edi
mov    0x2941(%rip),%rcx
mov    (%rcx),%esi
lea    -0x285c(%rbp),%rcx
call   1040 <clGetDeviceInfo@plt>
mov    %eax,%ecx
mov    -0x28d1(%rbp),%al
mov    %ecx,-0x8(%rbp)
mov    -0x285c(%rbp),%esi
mov    %esi,%ecx
add    $0x3fffffff,%ecx
test   %esi,%esi
cmovs  %ecx,%esi
sar    $0x1e,%esi
lea    0xb7a(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28e4(%rbp),%edx
mov    -0x28e0(%rbp),%r8
mov    -0x28a0(%rbp),%rcx
mov    -0x28d1(%rbp),%al
movslq -0x284c(%rbp),%rsi
mov    (%rcx,%rsi,4),%edi
mov    0x295b(%rip),%rcx
mov    (%rcx),%esi
lea    -0x2860(%rbp),%rcx
call   1040 <clGetDeviceInfo@plt>
mov    %eax,%ecx
mov    -0x28d1(%rbp),%al
mov    %ecx,-0x8(%rbp)
mov    -0x2860(%rbp),%esi
mov    %esi,%ecx
add    $0xfffff,%ecx
test   %esi,%esi
cmovs  %ecx,%esi
sar    $0x14,%esi
lea    0xb3f(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28e0(%rbp),%r8
mov    -0x28a0(%rbp),%rcx
mov    -0x28d1(%rbp),%al
movslq -0x284c(%rbp),%rdx
mov    (%rcx,%rdx,4),%edi
mov    0x2903(%rip),%rcx
mov    (%rcx),%esi
mov    $0x8,%edx
lea    -0x2868(%rbp),%rcx
call   1040 <clGetDeviceInfo@plt>
mov    %eax,%ecx
mov    -0x28d1(%rbp),%al
mov    %ecx,-0x8(%rbp)
mov    -0x2868(%rbp),%rsi
lea    0xb18(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28e4(%rbp),%edx
mov    -0x28e0(%rbp),%r8
mov    -0x28a0(%rbp),%rcx
mov    -0x28d1(%rbp),%al
movslq -0x284c(%rbp),%rsi
mov    (%rcx,%rsi,4),%edi
mov    0x2847(%rip),%rcx
mov    (%rcx),%esi
lea    -0x2870(%rbp),%rcx
call   1040 <clGetDeviceInfo@plt>
mov    %eax,%ecx
mov    -0x28d1(%rbp),%al
mov    %ecx,-0x8(%rbp)
mov    -0x2870(%rbp),%rsi
lea    0xb12(%rip),%rdi
call   1060 <printf@plt>
mov    -0x28a0(%rbp),%rdx
mov    -0x2870(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x2878(%rbp)
lea    0xf(,%rax,8),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rcx
sub    %rsi,%rcx
mov    %rcx,-0x28d0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x2880(%rbp)
movslq -0x284c(%rbp),%rsi
mov    (%rdx,%rsi,4),%edi
mov    0x27ff(%rip),%rdx
mov    (%rdx),%esi
shl    $0x3,%rax
mov    %eax,%edx
xor    %eax,%eax
mov    %eax,%r8d
mov    $0x0,%al
call   1040 <clGetDeviceInfo@plt>
mov    %eax,-0x8(%rbp)
lea    0xacb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movq   $0x0,-0x2888(%rbp)
mov    -0x2888(%rbp),%rax
cmp    -0x2870(%rbp),%rax
jae    1844 <main+0x6e4>
mov    -0x28d0(%rbp),%rax
mov    -0x2888(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xaac(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x2888(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x2888(%rbp)
jmp    17f9 <main+0x699>
lea    0xa8c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0x88a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x2878(%rbp),%rax
mov    %rax,%rsp
mov    -0x284c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x284c(%rbp)
jmp    13e6 <main+0x286>
lea    0x7a3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x2840(%rbp),%rax
mov    %rax,%rsp
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11df <main+0x7f>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2858,%rsp
lea    -0x30(%rbp),%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1060 <clGetPlatformIDs@plt>
mov    -0x30(%rbp),%esi
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rsp,-0x58(%rbp)
mov    -0x30(%rbp),%eax
mov    %rsp,%rsi
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rsi
mov    %rsi,%rsp
mov    -0x30(%rbp),%edi
mov    %rsi,-0x60(%rbp)
xor    %edx,%edx
call   1060 <clGetPlatformIDs@plt>
cmpl   $0x0,-0x30(%rbp)
jle    160d <main+0x49d>
lea    0x109f(%rip),%r15
lea    0x1093(%rip),%r14
xor    %ebx,%ebx
jmp    1218 <main+0xa8>
nopl   0x0(%rax,%rax,1)
lea    0x1085(%rip),%r15
mov    %r15,%rdi
call   1030 <puts@plt>
mov    -0x68(%rbp),%rsp
mov    -0x70(%rbp),%rbx
add    $0x1,%rbx
movslq -0x30(%rbp),%rax
cmp    %rax,%rbx
jge    160d <main+0x49d>
mov    %r15,%rdi
call   1030 <puts@plt>
lea    0xe01(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x2800,%edx
lea    -0x2880(%rbp),%r15
mov    %r15,%rdi
xor    %esi,%esi
call   1080 <memset@plt>
mov    -0x60(%rbp),%r12
mov    (%r12,%rbx,4),%edi
mov    0x2d53(%rip),%rax
mov    (%rax),%esi
mov    $0x2800,%edx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1090 <clGetPlatformInfo@plt>
lea    0xdd0(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r12,%rbx,4),%edi
mov    0x2cf5(%rip),%rax
mov    (%rax),%esi
mov    $0x2800,%edx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1090 <clGetPlatformInfo@plt>
lea    0xdbd(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r12,%rbx,4),%edi
mov    0x2cd7(%rip),%rax
mov    (%rax),%esi
mov    $0x2800,%edx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1090 <clGetPlatformInfo@plt>
lea    0xdac(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r12,%rbx,4),%edi
mov    0x2cd9(%rip),%r15
mov    (%r15),%esi
xor    %edx,%edx
xor    %ecx,%ecx
lea    -0x2c(%rbp),%r8
call   1040 <clGetDeviceIDs@plt>
mov    -0x2c(%rbp),%esi
lea    0xd9b(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rsp,-0x68(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r13
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    %rbx,-0x70(%rbp)
mov    (%r12,%rbx,4),%edi
mov    (%r15),%esi
lea    0xf7f(%rip),%rbx
mov    -0x2c(%rbp),%edx
mov    %r13,%rcx
xor    %r8d,%r8d
call   1040 <clGetDeviceIDs@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    11f0 <main+0x80>
xor    %r12d,%r12d
jmp    1380 <main+0x210>
nopl   0x0(%rax,%rax,1)
lea    0xf54(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4a(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    -0x78(%rbp),%rsp
add    $0x1,%r12
movslq -0x2c(%rbp),%rax
cmp    %rax,%r12
jge    11f0 <main+0x80>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xd24(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13,%r12,4),%edi
mov    0x2bfb(%rip),%rax
mov    (%rax),%esi
mov    $0x2800,%edx
lea    -0x2880(%rbp),%rbx
mov    %rbx,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
lea    0xd03(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13,%r12,4),%edi
mov    0x2bf3(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edx
lea    -0x4c(%rbp),%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    -0x4c(%rbp),%esi
lea    0xce7(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13,%r12,4),%edi
mov    0x2bb1(%rip),%rax
mov    (%rax),%esi
mov    $0x2800,%edx
mov    %rbx,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
lea    0xce5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13,%r12,4),%edi
mov    0x2ba0(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edx
lea    -0x48(%rbp),%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    -0x48(%rbp),%esi
lea    0xcd5(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13,%r12,4),%edi
mov    0x2b1e(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edx
lea    -0x44(%rbp),%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    -0x44(%rbp),%eax
lea    0x3ff(%rax),%esi
test   %eax,%eax
cmovns %eax,%esi
sar    $0xa,%esi
lea    0xcbb(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13,%r12,4),%edi
mov    0x2abe(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edx
lea    -0x40(%rbp),%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    -0x40(%rbp),%eax
lea    0x3fffffff(%rax),%esi
test   %eax,%eax
cmovns %eax,%esi
sar    $0x1e,%esi
lea    0xca5(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13,%r12,4),%edi
mov    0x2afe(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edx
lea    -0x3c(%rbp),%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    -0x3c(%rbp),%eax
lea    0xfffff(%rax),%esi
test   %eax,%eax
cmovns %eax,%esi
sar    $0x14,%esi
lea    0xc90(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13,%r12,4),%edi
mov    0x2ac6(%rip),%rax
mov    (%rax),%esi
mov    $0x8,%edx
lea    -0x80(%rbp),%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    -0x80(%rbp),%rsi
lea    0xc8c(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13,%r12,4),%edi
mov    0x2a33(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edx
lea    -0x38(%rbp),%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    -0x38(%rbp),%rsi
lea    0xcaa(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rsp,-0x78(%rbp)
mov    -0x38(%rbp),%rdx
mov    %rsp,%r15
lea    0xf(,%rdx,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    0x0(%r13,%r12,4),%edi
mov    0x2a13(%rip),%rax
mov    (%rax),%esi
shl    $0x3,%edx
mov    %r15,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
lea    0xc89(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmpq   $0x0,-0x38(%rbp)
je     1350 <main+0x1e0>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
cmp    -0x38(%rbp),%rbx
jb     15f0 <main+0x480>
jmp    1350 <main+0x1e0>
mov    -0x58(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"[INFO] Number of OpenCL platforms: %d\0A\00"
@.str.1 = [48 x i8] c"\0A---------------------------------------------\0A\00"
@.str.2 = [22 x i8] c"[INFO] Platform: %d\0A\00"
@CL_PLATFORM_NAME = global i32 0
@.str.3 = [27 x i8] c"[INFO] Platform name: %s\0A\00"
@CL_PLATFORM_VENDOR = global i32 0
@.str.4 = [29 x i8] c"[INFO] Platform vendor: %s\0A\00"
@CL_PLATFORM_VERSION = global i32 0
@.str.5 = [30 x i8] c"[INFO] Platform version: %s\0A\00"
@CL_DEVICE_TYPE_ALL = global i32 0
@.str.6 = [31 x i8] c"[INFO] Number of devices: %d\0A\00"
@.str.7 = [43 x i8] c"\0A----------------------------------------\0A\00"
@.str.8 = [23 x i8] c"[INFO] Device ID: %d\0A\00"
@CL_DEVICE_NAME = global i32 0
@.str.9 = [25 x i8] c"[INFO] Device name: %s\0A\00"
@CL_DEVICE_MAX_CLOCK_FREQUENCY = global i32 0
@.str.10 = [44 x i8] c"[INFO] Device max clock frequency: %d MHz\0A\00"
@CL_DEVICE_OPENCL_C_VERSION = global i32 0
@.str.11 = [37 x i8] c"[INFO] Device OpenCL C version: %s\0A\00"
@CL_DEVICE_MAX_COMPUTE_UNITS = global i32 0
@.str.12 = [38 x i8] c"[INFO] Device max compute units: %d\0A\00"
@CL_DEVICE_LOCAL_MEM_SIZE = global i32 0
@.str.13 = [42 x i8] c"[INFO] Device local memory size: %lu KB\0A\00"
@CL_DEVICE_GLOBAL_MEM_SIZE = global i32 0
@.str.14 = [43 x i8] c"[INFO] Device global memory size: %lu GB\0A\00"
@CL_DEVICE_MAX_MEM_ALLOC_SIZE = global i32 0
@.str.15 = [47 x i8] c"[INFO] Device Max Memory Alloc. Size: %lu MB\0A\00"
@CL_DEVICE_MAX_WORK_GROUP_SIZE = global i32 0
@.str.16 = [81 x i8] c"[INFO] Device Max Workgroup Size(max number of work-items in a workgroup): %ld\0A\00"
@CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = global i32 0
@.str.17 = [40 x i8] c"[INFO] Device Max work-item dims: %ld\0A\00"
@CL_DEVICE_MAX_WORK_ITEM_SIZES = global i32 0
@.str.18 = [32 x i8] c"[INFO] Max Work-group Dims: ( \00"
@.str.19 = [5 x i8] c"%ld \00"
@.str.20 = [3 x i8] c")\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca [10240 x i8]
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i64
%18 = alloca i64
%19 = alloca i8*
%20 = alloca i64
%21 = alloca i64
store i32 0, i32* %1
%22 = call i32 @clGetPlatformIDs(i32 0, i32* null, i32* %3)
store i32 %22, i32* %2
%23 = load i32, i32* %3
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %3
%26 = zext i32 %25 to i64
%27 = call i8* @llvm.stacksave()
store i8* %27, i8** %4
%28 = alloca i32, i64 %26
store i64 %26, i64* %5
%29 = load i32, i32* %3
%30 = call i32 @clGetPlatformIDs(i32 %29, i32* %28, i32* null)
store i32 %30, i32* %2
store i32 0, i32* %6
br label %31
31: ; preds = %203, %0
%32 = load i32, i32* %6
%33 = load i32, i32* %3
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %206
35: ; preds = %31
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%37 = load i32, i32* %6
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %37)
%39 = bitcast [10240 x i8]* %7 to i8*
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %28, i64 %41
%43 = load i32, i32* %42
%44 = load i32, i32* @CL_PLATFORM_NAME
%45 = bitcast [10240 x i8]* %7 to i8**
%46 = call i32 @clGetPlatformInfo(i32 %43, i32 %44, i32 10240, i8** %45, i32* null)
store i32 %46, i32* %2
%47 = getelementptr inbounds [10240 x i8], [10240 x i8]* %7, i64 0, i64 0
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %47)
%49 = load i32, i32* %6
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i32, i32* %28, i64 %50
%52 = load i32, i32* %51
%53 = load i32, i32* @CL_PLATFORM_VENDOR
%54 = bitcast [10240 x i8]* %7 to i8**
%55 = call i32 @clGetPlatformInfo(i32 %52, i32 %53, i32 10240, i8** %54, i32* null)
store i32 %55, i32* %2
%56 = getelementptr inbounds [10240 x i8], [10240 x i8]* %7, i64 0, i64 0
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %56)
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i32, i32* %28, i64 %59
%61 = load i32, i32* %60
%62 = load i32, i32* @CL_PLATFORM_VERSION
%63 = bitcast [10240 x i8]* %7 to i8**
%64 = call i32 @clGetPlatformInfo(i32 %61, i32 %62, i32 10240, i8** %63, i32* null)
store i32 %64, i32* %2
%65 = getelementptr inbounds [10240 x i8], [10240 x i8]* %7, i64 0, i64 0
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %65)
%67 = load i32, i32* %6
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i32, i32* %28, i64 %68
%70 = load i32, i32* %69
%71 = load i32, i32* @CL_DEVICE_TYPE_ALL
%72 = call i32 @clGetDeviceIDs(i32 %70, i32 %71, i32 0, i32* null, i32* %8)
store i32 %72, i32* %2
%73 = load i32, i32* %8
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %73)
%75 = load i32, i32* %8
%76 = zext i32 %75 to i64
%77 = call i8* @llvm.stacksave()
store i8* %77, i8** %9
%78 = alloca i32, i64 %76
store i64 %76, i64* %10
%79 = load i32, i32* %6
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i32, i32* %28, i64 %80
%82 = load i32, i32* %81
%83 = load i32, i32* @CL_DEVICE_TYPE_ALL
%84 = load i32, i32* %8
%85 = call i32 @clGetDeviceIDs(i32 %82, i32 %83, i32 %84, i32* %78, i32* null)
store i32 %85, i32* %2
store i32 0, i32* %11
br label %86
86: ; preds = %197, %35
%87 = load i32, i32* %11
%88 = load i32, i32* %8
%89 = icmp slt i32 %87, %88
br i1 %89, label %90, label %200
90: ; preds = %86
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0))
%92 = load i32, i32* %11
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %92)
%94 = load i32, i32* %11
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i32, i32* %78, i64 %95
%97 = load i32, i32* %96
%98 = load i32, i32* @CL_DEVICE_NAME
%99 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %97, i32 %98, i32 10240, [10240 x i8]* %7, i8* null)
store i32 %99, i32* %2
%100 = getelementptr inbounds [10240 x i8], [10240 x i8]* %7, i64 0, i64 0
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i8* %100)
%102 = load i32, i32* %11
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i32, i32* %78, i64 %103
%105 = load i32, i32* %104
%106 = load i32, i32* @CL_DEVICE_MAX_CLOCK_FREQUENCY
%107 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %105, i32 %106, i32 4, i32* %12, i8* null)
store i32 %107, i32* %2
%108 = load i32, i32* %12
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0), i32 %108)
%110 = load i32, i32* %11
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i32, i32* %78, i64 %111
%113 = load i32, i32* %112
%114 = load i32, i32* @CL_DEVICE_OPENCL_C_VERSION
%115 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %113, i32 %114, i32 10240, [10240 x i8]* %7, i8* null)
store i32 %115, i32* %2
%116 = getelementptr inbounds [10240 x i8], [10240 x i8]* %7, i64 0, i64 0
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0), i8* %116)
%118 = load i32, i32* %11
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i32, i32* %78, i64 %119
%121 = load i32, i32* %120
%122 = load i32, i32* @CL_DEVICE_MAX_COMPUTE_UNITS
%123 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %121, i32 %122, i32 4, i32* %13, i8* null)
store i32 %123, i32* %2
%124 = load i32, i32* %13
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i32 %124)
%126 = load i32, i32* %11
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i32, i32* %78, i64 %127
%129 = load i32, i32* %128
%130 = load i32, i32* @CL_DEVICE_LOCAL_MEM_SIZE
%131 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %129, i32 %130, i32 4, i32* %14, i8* null)
store i32 %131, i32* %2
%132 = load i32, i32* %14
%133 = sdiv i32 %132, 1024
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i32 %133)
%135 = load i32, i32* %11
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds i32, i32* %78, i64 %136
%138 = load i32, i32* %137
%139 = load i32, i32* @CL_DEVICE_GLOBAL_MEM_SIZE
%140 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %138, i32 %139, i32 4, i32* %15, i8* null)
store i32 %140, i32* %2
%141 = load i32, i32* %15
%142 = sdiv i32 %141, 1073741824
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.14, i64 0, i64 0), i32 %142)
%144 = load i32, i32* %11
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds i32, i32* %78, i64 %145
%147 = load i32, i32* %146
%148 = load i32, i32* @CL_DEVICE_MAX_MEM_ALLOC_SIZE
%149 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %147, i32 %148, i32 4, i32* %16, i8* null)
store i32 %149, i32* %2
%150 = load i32, i32* %16
%151 = sdiv i32 %150, 1048576
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.15, i64 0, i64 0), i32 %151)
%153 = load i32, i32* %11
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds i32, i32* %78, i64 %154
%156 = load i32, i32* %155
%157 = load i32, i32* @CL_DEVICE_MAX_WORK_GROUP_SIZE
%158 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %156, i32 %157, i32 8, i64* %17, i8* null)
store i32 %158, i32* %2
%159 = load i64, i64* %17
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.16, i64 0, i64 0), i64 %159)
%161 = load i32, i32* %11
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds i32, i32* %78, i64 %162
%164 = load i32, i32* %163
%165 = load i32, i32* @CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS
%166 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %164, i32 %165, i32 4, i64* %18, i8* null)
store i32 %166, i32* %2
%167 = load i64, i64* %18
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.17, i64 0, i64 0), i64 %167)
%169 = load i64, i64* %18
%170 = call i8* @llvm.stacksave()
store i8* %170, i8** %19
%171 = alloca i64, i64 %169
store i64 %169, i64* %20
%172 = load i32, i32* %11
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds i32, i32* %78, i64 %173
%175 = load i32, i32* %174
%176 = load i32, i32* @CL_DEVICE_MAX_WORK_ITEM_SIZES
%177 = mul nuw i64 8, %169
%178 = trunc i64 %177 to i32
%179 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %175, i32 %176, i32 %178, i64* %171, i8* null)
store i32 %179, i32* %2
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.18, i64 0, i64 0))
store i64 0, i64* %21
br label %181
181: ; preds = %190, %90
%182 = load i64, i64* %21
%183 = load i64, i64* %18
%184 = icmp ult i64 %182, %183
br i1 %184, label %185, label %193
185: ; preds = %181
%186 = load i64, i64* %21
%187 = getelementptr inbounds i64, i64* %171, i64 %186
%188 = load i64, i64* %187
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i64 %188)
br label %190
190: ; preds = %185
%191 = load i64, i64* %21
%192 = add i64 %191, 1
store i64 %192, i64* %21
br label %181
193: ; preds = %181
%194 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0))
%195 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0))
%196 = load i8*, i8** %19
br label %197
197: ; preds = %193
%198 = load i32, i32* %11
%199 = add nsw i32 %198, 1
store i32 %199, i32* %11
br label %86
200: ; preds = %86
%201 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%202 = load i8*, i8** %9
br label %203
203: ; preds = %200
%204 = load i32, i32* %6
%205 = add nsw i32 %204, 1
store i32 %205, i32* %6
br label %31
206: ; preds = %31
store i32 0, i32* %1
%207 = load i8*, i8** %4
%208 = load i32, i32* %1
ret i32 %208
}

LLVM IR (-O2):
@.str = [40 x i8] c"[INFO] Number of OpenCL platforms: %d\0A\00"
@.str.2 = [22 x i8] c"[INFO] Platform: %d\0A\00"
@CL_PLATFORM_NAME = global i32 0
@.str.3 = [27 x i8] c"[INFO] Platform name: %s\0A\00"
@CL_PLATFORM_VENDOR = global i32 0
@.str.4 = [29 x i8] c"[INFO] Platform vendor: %s\0A\00"
@CL_PLATFORM_VERSION = global i32 0
@.str.5 = [30 x i8] c"[INFO] Platform version: %s\0A\00"
@CL_DEVICE_TYPE_ALL = global i32 0
@.str.6 = [31 x i8] c"[INFO] Number of devices: %d\0A\00"
@.str.8 = [23 x i8] c"[INFO] Device ID: %d\0A\00"
@CL_DEVICE_NAME = global i32 0
@.str.9 = [25 x i8] c"[INFO] Device name: %s\0A\00"
@CL_DEVICE_MAX_CLOCK_FREQUENCY = global i32 0
@.str.10 = [44 x i8] c"[INFO] Device max clock frequency: %d MHz\0A\00"
@CL_DEVICE_OPENCL_C_VERSION = global i32 0
@.str.11 = [37 x i8] c"[INFO] Device OpenCL C version: %s\0A\00"
@CL_DEVICE_MAX_COMPUTE_UNITS = global i32 0
@.str.12 = [38 x i8] c"[INFO] Device max compute units: %d\0A\00"
@CL_DEVICE_LOCAL_MEM_SIZE = global i32 0
@.str.13 = [42 x i8] c"[INFO] Device local memory size: %lu KB\0A\00"
@CL_DEVICE_GLOBAL_MEM_SIZE = global i32 0
@.str.14 = [43 x i8] c"[INFO] Device global memory size: %lu GB\0A\00"
@CL_DEVICE_MAX_MEM_ALLOC_SIZE = global i32 0
@.str.15 = [47 x i8] c"[INFO] Device Max Memory Alloc. Size: %lu MB\0A\00"
@CL_DEVICE_MAX_WORK_GROUP_SIZE = global i32 0
@.str.16 = [81 x i8] c"[INFO] Device Max Workgroup Size(max number of work-items in a workgroup): %ld\0A\00"
@CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = global i32 0
@.str.17 = [40 x i8] c"[INFO] Device Max work-item dims: %ld\0A\00"
@CL_DEVICE_MAX_WORK_ITEM_SIZES = global i32 0
@.str.18 = [32 x i8] c"[INFO] Max Work-group Dims: ( \00"
@.str.19 = [5 x i8] c"%ld \00"
@str.21 = [47 x i8] c"\0A---------------------------------------------\00"
@str.23 = [2 x i8] c")\00"
@str.24 = [42 x i8] c"\0A----------------------------------------\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10240 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = bitcast i32* %1 to i8*
%12 = call i32 @clGetPlatformIDs(i32 0, i32* null, i32* %1)
%13 = load i32, i32* %1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %1
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
%18 = alloca i32, i64 %16
%19 = load i32, i32* %1
%20 = call i32 @clGetPlatformIDs(i32 %19, i32* %18, i32* null)
%21 = load i32, i32* %1
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %34
23: ; preds = %0
%24 = getelementptr inbounds [10240 x i8], [10240 x i8]* %2, i64 0, i64 0
%25 = bitcast [10240 x i8]* %2 to i8**
%26 = bitcast i32* %3 to i8*
%27 = bitcast i32* %4 to i8*
%28 = bitcast i32* %5 to i8*
%29 = bitcast i32* %6 to i8*
%30 = bitcast i32* %7 to i8*
%31 = bitcast i32* %8 to i8*
%32 = bitcast i64* %9 to i8*
%33 = bitcast i64* %10 to i8*
br label %35
34: ; preds = %68, %0
ret i32 0
35: ; preds = %23, %68
%36 = phi i64 [ 0, %23 ], [ %70, %68 ]
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.21, i64 0, i64 0))
%38 = trunc i64 %36 to i32
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds i32, i32* %18, i64 %36
%41 = load i32, i32* %40
%42 = load i32, i32* @CL_PLATFORM_NAME
%43 = call i32 @clGetPlatformInfo(i32 %41, i32 %42, i32 10240, i8** %25, i32* null)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %24)
%45 = load i32, i32* %40
%46 = load i32, i32* @CL_PLATFORM_VENDOR
%47 = call i32 @clGetPlatformInfo(i32 %45, i32 %46, i32 10240, i8** %25, i32* null)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %24)
%49 = load i32, i32* %40
%50 = load i32, i32* @CL_PLATFORM_VERSION
%51 = call i32 @clGetPlatformInfo(i32 %49, i32 %50, i32 10240, i8** %25, i32* null)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %24)
%53 = load i32, i32* %40
%54 = load i32, i32* @CL_DEVICE_TYPE_ALL
%55 = call i32 @clGetDeviceIDs(i32 %53, i32 %54, i32 0, i32* null, i32* %3)
%56 = load i32, i32* %3
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %56)
%58 = load i32, i32* %3
%59 = zext i32 %58 to i64
%60 = call i8* @llvm.stacksave()
%61 = alloca i32, i64 %59
%62 = load i32, i32* %40
%63 = load i32, i32* @CL_DEVICE_TYPE_ALL
%64 = load i32, i32* %3
%65 = call i32 @clGetDeviceIDs(i32 %62, i32 %63, i32 %64, i32* %61, i32* null)
%66 = load i32, i32* %3
%67 = icmp sgt i32 %66, 0
br i1 %67, label %74, label %68
68: ; preds = %137, %35
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.21, i64 0, i64 0))
%70 = add nuw nsw i64 %36, 1
%71 = load i32, i32* %1
%72 = sext i32 %71 to i64
%73 = icmp slt i64 %70, %72
br i1 %73, label %35, label %34
74: ; preds = %35, %137
%75 = phi i64 [ %140, %137 ], [ 0, %35 ]
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.24, i64 0, i64 0))
%77 = trunc i64 %75 to i32
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %77)
%79 = getelementptr inbounds i32, i32* %61, i64 %75
%80 = load i32, i32* %79
%81 = load i32, i32* @CL_DEVICE_NAME
%82 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %80, i32 %81, i32 10240, [10240 x i8]* %2, i8* null)
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i8* %24)
%84 = load i32, i32* %79
%85 = load i32, i32* @CL_DEVICE_MAX_CLOCK_FREQUENCY
%86 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %84, i32 %85, i32 4, i32* %4, i8* null)
%87 = load i32, i32* %4
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0), i32 %87)
%89 = load i32, i32* %79
%90 = load i32, i32* @CL_DEVICE_OPENCL_C_VERSION
%91 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %89, i32 %90, i32 10240, [10240 x i8]* %2, i8* null)
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0), i8* %24)
%93 = load i32, i32* %79
%94 = load i32, i32* @CL_DEVICE_MAX_COMPUTE_UNITS
%95 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %93, i32 %94, i32 4, i32* %5, i8* null)
%96 = load i32, i32* %5
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i32 %96)
%98 = load i32, i32* %79
%99 = load i32, i32* @CL_DEVICE_LOCAL_MEM_SIZE
%100 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %98, i32 %99, i32 4, i32* %6, i8* null)
%101 = load i32, i32* %6
%102 = sdiv i32 %101, 1024
%103 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.13, i64 0, i64 0), i32 %102)
%104 = load i32, i32* %79
%105 = load i32, i32* @CL_DEVICE_GLOBAL_MEM_SIZE
%106 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %104, i32 %105, i32 4, i32* %7, i8* null)
%107 = load i32, i32* %7
%108 = sdiv i32 %107, 1073741824
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.14, i64 0, i64 0), i32 %108)
%110 = load i32, i32* %79
%111 = load i32, i32* @CL_DEVICE_MAX_MEM_ALLOC_SIZE
%112 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %110, i32 %111, i32 4, i32* %8, i8* null)
%113 = load i32, i32* %8
%114 = sdiv i32 %113, 1048576
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.15, i64 0, i64 0), i32 %114)
%116 = load i32, i32* %79
%117 = load i32, i32* @CL_DEVICE_MAX_WORK_GROUP_SIZE
%118 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %116, i32 %117, i32 8, i64* %9, i8* null)
%119 = load i64, i64* %9
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @.str.16, i64 0, i64 0), i64 %119)
%121 = load i32, i32* %79
%122 = load i32, i32* @CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS
%123 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %121, i32 %122, i32 4, i64* %10, i8* null)
%124 = load i64, i64* %10
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.17, i64 0, i64 0), i64 %124)
%126 = load i64, i64* %10
%127 = call i8* @llvm.stacksave()
%128 = alloca i64, i64 %126
%129 = load i32, i32* %79
%130 = load i32, i32* @CL_DEVICE_MAX_WORK_ITEM_SIZES
%131 = trunc i64 %126 to i32
%132 = shl i32 %131, 3
%133 = call i32 (i32, i32, i32, ...) @clGetDeviceInfo(i32 %129, i32 %130, i32 %132, i64* %128, i8* null)
%134 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.18, i64 0, i64 0))
%135 = load i64, i64* %10
%136 = icmp eq i64 %135, 0
br i1 %136, label %137, label %144
137: ; preds = %144, %74
%138 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.23, i64 0, i64 0))
%139 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.24, i64 0, i64 0))
%140 = add nuw nsw i64 %75, 1
%141 = load i32, i32* %3
%142 = sext i32 %141 to i64
%143 = icmp slt i64 %140, %142
br i1 %143, label %74, label %68
144: ; preds = %74, %144
%145 = phi i64 [ %149, %144 ], [ 0, %74 ]
%146 = getelementptr inbounds i64, i64* %128, i64 %145
%147 = load i64, i64* %146
%148 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i64 %147)
%149 = add nuw i64 %145, 1
%150 = load i64, i64* %10
%151 = icmp ult i64 %149, %150
br i1 %151, label %144, label %137
}