#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*/ maxComputeUnits;
typedef int cl_uint;
typedef char cl_platform_id;
typedef char cl_device_id;

/* Variables and functions */
int /*<<< orphan*/ CL_DEVICE_MAX_COMPUTE_UNITS;
int /*<<< orphan*/ CL_DEVICE_NAME;
int /*<<< orphan*/ CL_DEVICE_OPENCL_C_VERSION;
int /*<<< orphan*/ CL_DEVICE_TYPE_ALL;
int /*<<< orphan*/ CL_DEVICE_VERSION;
int /*<<< orphan*/ CL_DRIVER_VERSION;
int /*<<< orphan*/ clGetDeviceIDs(char, int /*<<< orphan*/, int, char *, int *);
int /*<<< orphan*/ clGetDeviceInfo(char, int /*<<< orphan*/, int, ...);
int /*<<< orphan*/ clGetPlatformIDs(int, char *, int *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  int i, j;
  char *value;
  size_t valueSize;
  cl_uint platformCount;
  cl_platform_id *platforms;
  cl_uint deviceCount;
  cl_device_id *devices;
  cl_uint maxComputeUnits;
  clGetPlatformIDs(0, NULL, &platformCount);
  platforms = (cl_platform_id *)malloc(sizeof(cl_platform_id) * platformCount);
  clGetPlatformIDs(platformCount, platforms, NULL);
  for (i = 0; i < platformCount; i++) {
    clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, 0, NULL, &deviceCount);
    devices = (cl_device_id *)malloc(sizeof(cl_device_id) * deviceCount);
    clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, deviceCount, devices,
                   NULL);
    for (j = 0; j < deviceCount; j++) {
      clGetDeviceInfo(devices[j], CL_DEVICE_NAME, 0, NULL, &valueSize);
      value = (char *)malloc(valueSize);
      clGetDeviceInfo(devices[j], CL_DEVICE_NAME, valueSize, value, NULL);
      printf("%d. Device: %s\n", j + 1, value);
      free(value);
      clGetDeviceInfo(devices[j], CL_DEVICE_VERSION, 0, NULL, &valueSize);
      value = (char *)malloc(valueSize);
      clGetDeviceInfo(devices[j], CL_DEVICE_VERSION, valueSize, value, NULL);
      printf(" %d.%d Hardware version: %s\n", j + 1, 1, value);
      free(value);
      clGetDeviceInfo(devices[j], CL_DRIVER_VERSION, 0, NULL, &valueSize);
      value = (char *)malloc(valueSize);
      clGetDeviceInfo(devices[j], CL_DRIVER_VERSION, valueSize, value, NULL);
      printf(" %d.%d Software version: %s\n", j + 1, 2, value);
      free(value);
      clGetDeviceInfo(devices[j], CL_DEVICE_OPENCL_C_VERSION, 0, NULL,
                      &valueSize);
      value = (char *)malloc(valueSize);
      clGetDeviceInfo(devices[j], CL_DEVICE_OPENCL_C_VERSION, valueSize, value,
                      NULL);
      printf(" %d.%d OpenCL C version: %s\n", j + 1, 3, value);
      free(value);
      clGetDeviceInfo(devices[j], CL_DEVICE_MAX_COMPUTE_UNITS,
                      sizeof(maxComputeUnits), &maxComputeUnits, NULL);
      printf(" %d.%d Parallel compute units: %d\n", j + 1, 4, maxComputeUnits);
    }
    free(devices);
  }
  free(platforms);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%esi
lea    -0x24(%rbp),%rdx
call   1060 <clGetPlatformIDs@plt>
movslq -0x24(%rbp),%rdi
shl    $0x0,%rdi
call   1080 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x30(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1060 <clGetPlatformIDs@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    14a2 <main+0x342>
mov    -0x30(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    0x2e04(%rip),%rcx
mov    (%rcx),%esi
xor    %edx,%edx
xor    %ecx,%ecx
lea    -0x34(%rbp),%r8
movsbl %al,%edi
call   1040 <clGetDeviceIDs@plt>
movslq -0x34(%rbp),%rdi
shl    $0x0,%rdi
call   1080 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    0x2dcf(%rip),%rcx
mov    (%rcx),%esi
mov    -0x34(%rbp),%edx
mov    -0x40(%rbp),%rcx
xor    %edi,%edi
mov    %edi,%r8d
movsbl %al,%edi
call   1040 <clGetDeviceIDs@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    148b <main+0x32b>
mov    -0x40(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    0x2d84(%rip),%rcx
mov    (%rcx),%esi
xor    %edx,%edx
xor    %ecx,%ecx
lea    -0x20(%rbp),%r8
movsbl %al,%edi
mov    $0x0,%al
call   1050 <clGetDeviceInfo@plt>
mov    -0x20(%rbp),%rdi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x40(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    0x2d51(%rip),%rcx
mov    (%rcx),%esi
mov    -0x20(%rbp),%rcx
mov    %ecx,%edx
mov    -0x18(%rbp),%rcx
xor    %edi,%edi
mov    %edi,%r8d
movsbl %al,%edi
mov    $0x0,%al
call   1050 <clGetDeviceInfo@plt>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%rdx
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    0x2d2b(%rip),%rcx
mov    (%rcx),%esi
xor    %edx,%edx
xor    %ecx,%ecx
lea    -0x20(%rbp),%r8
movsbl %al,%edi
mov    $0x0,%al
call   1050 <clGetDeviceInfo@plt>
mov    -0x20(%rbp),%rdi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x40(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    0x2cf8(%rip),%rcx
mov    (%rcx),%esi
mov    -0x20(%rbp),%rcx
mov    %ecx,%edx
mov    -0x18(%rbp),%rcx
xor    %edi,%edi
mov    %edi,%r8d
movsbl %al,%edi
mov    $0x0,%al
call   1050 <clGetDeviceInfo@plt>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%rcx
lea    0xcfc(%rip),%rdi
mov    $0x1,%edx
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    0x2c9d(%rip),%rcx
mov    (%rcx),%esi
xor    %edx,%edx
xor    %ecx,%ecx
lea    -0x20(%rbp),%r8
movsbl %al,%edi
mov    $0x0,%al
call   1050 <clGetDeviceInfo@plt>
mov    -0x20(%rbp),%rdi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x40(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    0x2c6a(%rip),%rcx
mov    (%rcx),%esi
mov    -0x20(%rbp),%rcx
mov    %ecx,%edx
mov    -0x18(%rbp),%rcx
xor    %edi,%edi
mov    %edi,%r8d
movsbl %al,%edi
mov    $0x0,%al
call   1050 <clGetDeviceInfo@plt>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%rcx
lea    0xc93(%rip),%rdi
mov    $0x2,%edx
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    0x2c0f(%rip),%rcx
mov    (%rcx),%esi
xor    %edx,%edx
xor    %ecx,%ecx
lea    -0x20(%rbp),%r8
movsbl %al,%edi
mov    $0x0,%al
call   1050 <clGetDeviceInfo@plt>
mov    -0x20(%rbp),%rdi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x40(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    0x2bdc(%rip),%rcx
mov    (%rcx),%esi
mov    -0x20(%rbp),%rcx
mov    %ecx,%edx
mov    -0x18(%rbp),%rcx
xor    %edi,%edi
mov    %edi,%r8d
movsbl %al,%edi
mov    $0x0,%al
call   1050 <clGetDeviceInfo@plt>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%rcx
lea    0xc2a(%rip),%rdi
mov    $0x3,%edx
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    0x2ba9(%rip),%rcx
mov    (%rcx),%esi
mov    $0x4,%edx
lea    -0x44(%rbp),%rcx
xor    %edi,%edi
mov    %edi,%r8d
movsbl %al,%edi
mov    $0x0,%al
call   1050 <clGetDeviceInfo@plt>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x44(%rbp),%ecx
lea    0xbf6(%rip),%rdi
mov    $0x4,%edx
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1216 <main+0xb6>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a6 <main+0x46>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0x4(%rsp),%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1060 <clGetPlatformIDs@plt>
movslq 0x4(%rsp),%rdi
call   1080 <malloc@plt>
mov    0x4(%rsp),%edi
mov    %rax,0x18(%rsp)
mov    %rax,%rsi
xor    %edx,%edx
call   1060 <clGetPlatformIDs@plt>
cmpl   $0x0,0x4(%rsp)
jle    141d <main+0x2bd>
mov    0x2e0d(%rip),%r15
xor    %ebp,%ebp
jmp    11cf <main+0x6f>
nop
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rbp
add    $0x1,%rbp
movslq 0x4(%rsp),%rax
cmp    %rax,%rbp
jge    141d <main+0x2bd>
mov    0x18(%rsp),%rbx
movsbl (%rbx,%rbp,1),%edi
mov    0x2de9(%rip),%r12
mov    (%r12),%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rsp,%r8
call   1040 <clGetDeviceIDs@plt>
movslq (%rsp),%rdi
call   1080 <malloc@plt>
mov    %rax,%r13
mov    %rbp,0x20(%rsp)
movsbl (%rbx,%rbp,1),%edi
mov    (%r12),%esi
mov    (%rsp),%edx
mov    %rax,%rcx
xor    %r8d,%r8d
call   1040 <clGetDeviceIDs@plt>
cmpl   $0x0,(%rsp)
jle    11b0 <main+0x50>
xor    %ebp,%ebp
xchg   %ax,%ax
movsbl 0x0(%r13,%rbp,1),%edi
mov    (%r15),%esi
xor    %edx,%edx
xor    %ecx,%ecx
lea    0x8(%rsp),%rbx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    0x8(%rsp),%rdi
call   1080 <malloc@plt>
mov    %rax,%r14
movsbl 0x0(%r13,%rbp,1),%edi
mov    (%r15),%esi
mov    0x8(%rsp),%edx
mov    %rax,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
lea    0x1(%rbp),%r12
lea    0xd92(%rip),%rdi
mov    %r12d,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%r14
call   1030 <free@plt>
movsbl 0x0(%r13,%rbp,1),%edi
mov    0x2d4d(%rip),%r15
mov    (%r15),%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    0x8(%rsp),%rdi
call   1080 <malloc@plt>
mov    %rax,%rbx
movsbl 0x0(%r13,%rbp,1),%edi
mov    (%r15),%esi
mov    0x8(%rsp),%edx
mov    %rax,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
lea    0xd3e(%rip),%rdi
mov    %r12d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movsbl 0x0(%r13,%rbp,1),%edi
mov    0x2cdf(%rip),%r15
mov    (%r15),%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r14,%r8
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    0x8(%rsp),%rdi
call   1080 <malloc@plt>
mov    %rax,%rbx
movsbl 0x0(%r13,%rbp,1),%edi
mov    (%r15),%esi
mov    0x8(%rsp),%edx
mov    %rax,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
lea    0xcf5(%rip),%rdi
mov    %r12d,%esi
mov    $0x2,%edx
mov    %rbx,%rcx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
movsbl 0x0(%r13,%rbp,1),%edi
mov    0x2c71(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r14,%r8
mov    0x2c61(%rip),%r14
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    0x8(%rsp),%rdi
call   1080 <malloc@plt>
mov    %rax,%rbx
movsbl 0x0(%r13,%rbp,1),%edi
mov    (%r14),%esi
lea    0xcb7(%rip),%r14
mov    0x8(%rsp),%edx
mov    %rax,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    %r14,%rdi
mov    %r12d,%esi
mov    $0x3,%edx
mov    %rbx,%rcx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    0x2c2d(%rip),%rbx
call   1030 <free@plt>
movsbl 0x0(%r13,%rbp,1),%edi
mov    (%rbx),%esi
lea    0xc90(%rip),%rbx
lea    0x14(%rsp),%rcx
mov    $0x4,%edx
xor    %r8d,%r8d
xor    %eax,%eax
call   1050 <clGetDeviceInfo@plt>
mov    0x14(%rsp),%ecx
mov    %rbx,%rdi
mov    %r12d,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1070 <printf@plt>
movslq (%rsp),%rax
mov    %r12,%rbp
cmp    %rax,%r12
mov    0x2ba6(%rip),%r15
jl     1220 <main+0xc0>
jmp    11b0 <main+0x50>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@CL_DEVICE_TYPE_ALL = global i32 0
@CL_DEVICE_NAME = global i32 0
@.str = [16 x i8] c"%d. Device: %s\0A\00"
@CL_DEVICE_VERSION = global i32 0
@.str.1 = [29 x i8] c" %d.%d Hardware version: %s\0A\00"
@CL_DRIVER_VERSION = global i32 0
@.str.2 = [29 x i8] c" %d.%d Software version: %s\0A\00"
@CL_DEVICE_OPENCL_C_VERSION = global i32 0
@.str.3 = [29 x i8] c" %d.%d OpenCL C version: %s\0A\00"
@CL_DEVICE_MAX_COMPUTE_UNITS = global i32 0
@.str.4 = [35 x i8] c" %d.%d Parallel compute units: %d\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 i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32 @clGetPlatformIDs(i32 0, i8* null, i32* %6)
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = mul i64 1, %13
%15 = call i64 @malloc(i64 %14)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %7
%17 = load i32, i32* %6
%18 = load i8*, i8** %7
%19 = call i32 @clGetPlatformIDs(i32 %17, i8* %18, i32* null)
store i32 0, i32* %2
br label %20
20: ; preds = %172, %0
%21 = load i32, i32* %2
%22 = load i32, i32* %6
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %175
24: ; preds = %20
%25 = load i8*, i8** %7
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = load i32, i32* @CL_DEVICE_TYPE_ALL
%31 = call i32 @clGetDeviceIDs(i8 signext %29, i32 %30, i32 0, i8* null, i32* %8)
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = mul i64 1, %33
%35 = call i64 @malloc(i64 %34)
%36 = inttoptr i64 %35 to i8*
store i8* %36, i8** %9
%37 = load i8*, i8** %7
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i8, i8* %40
%42 = load i32, i32* @CL_DEVICE_TYPE_ALL
%43 = load i32, i32* %8
%44 = load i8*, i8** %9
%45 = call i32 @clGetDeviceIDs(i8 signext %41, i32 %42, i32 %43, i8* %44, i32* null)
store i32 0, i32* %3
br label %46
46: ; preds = %166, %24
%47 = load i32, i32* %3
%48 = load i32, i32* %8
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %169
50: ; preds = %46
%51 = load i8*, i8** %9
%52 = load i32, i32* %3
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = load i8, i8* %54
%56 = load i32, i32* @CL_DEVICE_NAME
%57 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %55, i32 %56, i32 0, i8* null, i64* %5)
%58 = load i64, i64* %5
%59 = call i64 @malloc(i64 %58)
%60 = inttoptr i64 %59 to i8*
store i8* %60, i8** %4
%61 = load i8*, i8** %9
%62 = load i32, i32* %3
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %61, i64 %63
%65 = load i8, i8* %64
%66 = load i32, i32* @CL_DEVICE_NAME
%67 = load i64, i64* %5
%68 = trunc i64 %67 to i32
%69 = load i8*, i8** %4
%70 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %65, i32 %66, i32 %68, i8* %69, i8* null)
%71 = load i32, i32* %3
%72 = add nsw i32 %71, 1
%73 = load i8*, i8** %4
%74 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %72, i8* %73)
%75 = load i8*, i8** %4
%76 = call i32 @free(i8* %75)
%77 = load i8*, i8** %9
%78 = load i32, i32* %3
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8, i8* %77, i64 %79
%81 = load i8, i8* %80
%82 = load i32, i32* @CL_DEVICE_VERSION
%83 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %81, i32 %82, i32 0, i8* null, i64* %5)
%84 = load i64, i64* %5
%85 = call i64 @malloc(i64 %84)
%86 = inttoptr i64 %85 to i8*
store i8* %86, i8** %4
%87 = load i8*, i8** %9
%88 = load i32, i32* %3
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8, i8* %87, i64 %89
%91 = load i8, i8* %90
%92 = load i32, i32* @CL_DEVICE_VERSION
%93 = load i64, i64* %5
%94 = trunc i64 %93 to i32
%95 = load i8*, i8** %4
%96 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %91, i32 %92, i32 %94, i8* %95, i8* null)
%97 = load i32, i32* %3
%98 = add nsw i32 %97, 1
%99 = load i8*, i8** %4
%100 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %98, i32 1, i8* %99)
%101 = load i8*, i8** %4
%102 = call i32 @free(i8* %101)
%103 = load i8*, i8** %9
%104 = load i32, i32* %3
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i8, i8* %103, i64 %105
%107 = load i8, i8* %106
%108 = load i32, i32* @CL_DRIVER_VERSION
%109 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %107, i32 %108, i32 0, i8* null, i64* %5)
%110 = load i64, i64* %5
%111 = call i64 @malloc(i64 %110)
%112 = inttoptr i64 %111 to i8*
store i8* %112, i8** %4
%113 = load i8*, i8** %9
%114 = load i32, i32* %3
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i8, i8* %113, i64 %115
%117 = load i8, i8* %116
%118 = load i32, i32* @CL_DRIVER_VERSION
%119 = load i64, i64* %5
%120 = trunc i64 %119 to i32
%121 = load i8*, i8** %4
%122 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %117, i32 %118, i32 %120, i8* %121, i8* null)
%123 = load i32, i32* %3
%124 = add nsw i32 %123, 1
%125 = load i8*, i8** %4
%126 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %124, i32 2, i8* %125)
%127 = load i8*, i8** %4
%128 = call i32 @free(i8* %127)
%129 = load i8*, i8** %9
%130 = load i32, i32* %3
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8, i8* %129, i64 %131
%133 = load i8, i8* %132
%134 = load i32, i32* @CL_DEVICE_OPENCL_C_VERSION
%135 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %133, i32 %134, i32 0, i8* null, i64* %5)
%136 = load i64, i64* %5
%137 = call i64 @malloc(i64 %136)
%138 = inttoptr i64 %137 to i8*
store i8* %138, i8** %4
%139 = load i8*, i8** %9
%140 = load i32, i32* %3
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8, i8* %139, i64 %141
%143 = load i8, i8* %142
%144 = load i32, i32* @CL_DEVICE_OPENCL_C_VERSION
%145 = load i64, i64* %5
%146 = trunc i64 %145 to i32
%147 = load i8*, i8** %4
%148 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %143, i32 %144, i32 %146, i8* %147, i8* null)
%149 = load i32, i32* %3
%150 = add nsw i32 %149, 1
%151 = load i8*, i8** %4
%152 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %150, i32 3, i8* %151)
%153 = load i8*, i8** %4
%154 = call i32 @free(i8* %153)
%155 = load i8*, i8** %9
%156 = load i32, i32* %3
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i8, i8* %155, i64 %157
%159 = load i8, i8* %158
%160 = load i32, i32* @CL_DEVICE_MAX_COMPUTE_UNITS
%161 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %159, i32 %160, i32 4, i32* %10, i8* null)
%162 = load i32, i32* %3
%163 = add nsw i32 %162, 1
%164 = load i32, i32* %10
%165 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %163, i32 4, i32 %164)
br label %166
166: ; preds = %50
%167 = load i32, i32* %3
%168 = add nsw i32 %167, 1
store i32 %168, i32* %3
br label %46
169: ; preds = %46
%170 = load i8*, i8** %9
%171 = call i32 @free(i8* %170)
br label %172
172: ; preds = %169
%173 = load i32, i32* %2
%174 = add nsw i32 %173, 1
store i32 %174, i32* %2
br label %20
175: ; preds = %20
%176 = load i8*, i8** %7
%177 = call i32 @free(i8* %176)
ret i32 0
}

LLVM IR (-O2):
@CL_DEVICE_TYPE_ALL = global i32 0
@CL_DEVICE_NAME = global i32 0
@.str = [16 x i8] c"%d. Device: %s\0A\00"
@CL_DEVICE_VERSION = global i32 0
@.str.1 = [29 x i8] c" %d.%d Hardware version: %s\0A\00"
@CL_DRIVER_VERSION = global i32 0
@.str.2 = [29 x i8] c" %d.%d Software version: %s\0A\00"
@CL_DEVICE_OPENCL_C_VERSION = global i32 0
@.str.3 = [29 x i8] c" %d.%d OpenCL C version: %s\0A\00"
@CL_DEVICE_MAX_COMPUTE_UNITS = global i32 0
@.str.4 = [35 x i8] c" %d.%d Parallel compute units: %d\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i64* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @clGetPlatformIDs(i32 0, i8* null, i32* %2)
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = call i64 @malloc(i64 %11)
%13 = inttoptr i64 %12 to i8*
%14 = load i32, i32* %2
%15 = call i32 @clGetPlatformIDs(i32 %14, i8* %13, i32* null)
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %105
18: ; preds = %0, %99
%19 = phi i64 [ %101, %99 ], [ 0, %0 ]
%20 = getelementptr inbounds i8, i8* %13, i64 %19
%21 = load i8, i8* %20
%22 = load i32, i32* @CL_DEVICE_TYPE_ALL
%23 = call i32 @clGetDeviceIDs(i8 signext %21, i32 %22, i32 0, i8* null, i32* %3)
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = call i64 @malloc(i64 %25)
%27 = inttoptr i64 %26 to i8*
%28 = load i8, i8* %20
%29 = load i32, i32* @CL_DEVICE_TYPE_ALL
%30 = load i32, i32* %3
%31 = call i32 @clGetDeviceIDs(i8 signext %28, i32 %29, i32 %30, i8* %27, i32* null)
%32 = load i32, i32* %3
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %99
34: ; preds = %18, %34
%35 = phi i64 [ %48, %34 ], [ 0, %18 ]
%36 = getelementptr inbounds i8, i8* %27, i64 %35
%37 = load i8, i8* %36
%38 = load i32, i32* @CL_DEVICE_NAME
%39 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %37, i32 %38, i32 0, i8* null, i64* %1)
%40 = load i64, i64* %1
%41 = call i64 @malloc(i64 %40)
%42 = inttoptr i64 %41 to i8*
%43 = load i8, i8* %36
%44 = load i32, i32* @CL_DEVICE_NAME
%45 = load i64, i64* %1
%46 = trunc i64 %45 to i32
%47 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %43, i32 %44, i32 %46, i8* %42, i8* null)
%48 = add nuw nsw i64 %35, 1
%49 = trunc i64 %48 to i32
%50 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %49, i8* %42)
%51 = call i32 @free(i8* %42)
%52 = load i8, i8* %36
%53 = load i32, i32* @CL_DEVICE_VERSION
%54 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %52, i32 %53, i32 0, i8* null, i64* %1)
%55 = load i64, i64* %1
%56 = call i64 @malloc(i64 %55)
%57 = inttoptr i64 %56 to i8*
%58 = load i8, i8* %36
%59 = load i32, i32* @CL_DEVICE_VERSION
%60 = load i64, i64* %1
%61 = trunc i64 %60 to i32
%62 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %58, i32 %59, i32 %61, i8* %57, i8* null)
%63 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %49, i32 1, i8* %57)
%64 = call i32 @free(i8* %57)
%65 = load i8, i8* %36
%66 = load i32, i32* @CL_DRIVER_VERSION
%67 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %65, i32 %66, i32 0, i8* null, i64* %1)
%68 = load i64, i64* %1
%69 = call i64 @malloc(i64 %68)
%70 = inttoptr i64 %69 to i8*
%71 = load i8, i8* %36
%72 = load i32, i32* @CL_DRIVER_VERSION
%73 = load i64, i64* %1
%74 = trunc i64 %73 to i32
%75 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %71, i32 %72, i32 %74, i8* %70, i8* null)
%76 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %49, i32 2, i8* %70)
%77 = call i32 @free(i8* %70)
%78 = load i8, i8* %36
%79 = load i32, i32* @CL_DEVICE_OPENCL_C_VERSION
%80 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %78, i32 %79, i32 0, i8* null, i64* %1)
%81 = load i64, i64* %1
%82 = call i64 @malloc(i64 %81)
%83 = inttoptr i64 %82 to i8*
%84 = load i8, i8* %36
%85 = load i32, i32* @CL_DEVICE_OPENCL_C_VERSION
%86 = load i64, i64* %1
%87 = trunc i64 %86 to i32
%88 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %84, i32 %85, i32 %87, i8* %83, i8* null)
%89 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %49, i32 3, i8* %83)
%90 = call i32 @free(i8* %83)
%91 = load i8, i8* %36
%92 = load i32, i32* @CL_DEVICE_MAX_COMPUTE_UNITS
%93 = call i32 (i8, i32, i32, ...) @clGetDeviceInfo(i8 signext %91, i32 %92, i32 4, i32* %4, i8* null)
%94 = load i32, i32* %4
%95 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %49, i32 4, i32 %94)
%96 = load i32, i32* %3
%97 = sext i32 %96 to i64
%98 = icmp slt i64 %48, %97
br i1 %98, label %34, label %99
99: ; preds = %34, %18
%100 = call i32 @free(i8* %27)
%101 = add nuw nsw i64 %19, 1
%102 = load i32, i32* %2
%103 = sext i32 %102 to i64
%104 = icmp slt i64 %101, %103
br i1 %104, label %18, label %105
105: ; preds = %99, %0
%106 = call i32 @free(i8* %13)
ret i32 0
}