#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_platform_id;
typedef scalar_t__ cl_int;
typedef int /*<<< orphan*/ cl_device_id;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ CL_DEVICE_TYPE_ALL;
scalar_t__ CL_OUT_OF_HOST_MEMORY;
int /*<<< orphan*/ CL_PLATFORM_EXTENSIONS;
int /*<<< orphan*/ CL_PLATFORM_NAME;
int /*<<< orphan*/ CL_PLATFORM_PROFILE;
int /*<<< orphan*/ CL_PLATFORM_VENDOR;
int /*<<< orphan*/ CL_PLATFORM_VERSION;
scalar_t__ CL_SUCCESS;
scalar_t__ clGetDeviceIDs(int /*<<< orphan*/, int /*<<< orphan*/, int,
                          int /*<<< orphan*/ *, int *);
scalar_t__ clGetPlatformInfo(int /*<<< orphan*/, int /*<<< orphan*/, int,
                             char *, int /*<<< orphan*/);
int /*<<< orphan*/ device_info(int /*<<< orphan*/);
char *errcode_str(scalar_t__);
int /*<<< orphan*/ *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
void platform_info(cl_platform_id platform) {
  char buf[512];
  cl_int result;
  int i;
  printf("Platform : {\n");
  do {
    result =
        clGetPlatformInfo(platform, CL_PLATFORM_PROFILE, sizeof(buf), buf, 0);
    if (result != CL_SUCCESS) {
      do {
        printf("Error at %i: %s\n", 258, errcode_str(result));
      } while (0);
      ;
      return;
    }
    printf("    "
           "CL_PLATFORM_PROFILE"
           ": %s\n",
           buf);
  } while (0);
  ;
  do {
    result =
        clGetPlatformInfo(platform, CL_PLATFORM_VERSION, sizeof(buf), buf, 0);
    if (result != CL_SUCCESS) {
      do {
        printf("Error at %i: %s\n", 259, errcode_str(result));
      } while (0);
      ;
      return;
    }
    printf("    "
           "CL_PLATFORM_VERSION"
           ": %s\n",
           buf);
  } while (0);
  ;
  do {
    result = clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(buf), buf, 0);
    if (result != CL_SUCCESS) {
      do {
        printf("Error at %i: %s\n", 260, errcode_str(result));
      } while (0);
      ;
      return;
    }
    printf("    "
           "CL_PLATFORM_NAME"
           ": %s\n",
           buf);
  } while (0);
  ;
  do {
    result =
        clGetPlatformInfo(platform, CL_PLATFORM_VENDOR, sizeof(buf), buf, 0);
    if (result != CL_SUCCESS) {
      do {
        printf("Error at %i: %s\n", 261, errcode_str(result));
      } while (0);
      ;
      return;
    }
    printf("    "
           "CL_PLATFORM_VENDOR"
           ": %s\n",
           buf);
  } while (0);
  ;
  do {
    result = clGetPlatformInfo(platform, CL_PLATFORM_EXTENSIONS, sizeof(buf),
                               buf, 0);
    if (result != CL_SUCCESS) {
      do {
        printf("Error at %i: %s\n", 262, errcode_str(result));
      } while (0);
      ;
      return;
    }
    printf("    "
           "CL_PLATFORM_EXTENSIONS"
           ": %s\n",
           buf);
  } while (0);
  ;
  printf("\n");
  cl_uint num;
  cl_device_id *devices;
  result = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 0, 0, &num);
  if (result != CL_SUCCESS) {
    do {
      printf("Error at %i: %s\n", 274, errcode_str(result));
    } while (0);
    ;
    return;
  }
  devices = malloc(num * sizeof(cl_device_id));
  if (!devices) {
    do {
      printf("Error at %i: %s\n", 282, errcode_str(CL_OUT_OF_HOST_MEMORY));
    } while (0);
    ;
    return;
  }
  result = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, num, devices, 0);
  if (result != CL_SUCCESS) {
    do {
      printf("Error at %i: %s\n", 290, errcode_str(result));
    } while (0);
    ;
    return;
  }
  for (i = 0; i < num; ++i) {
    device_info(devices[i]);
  }
  printf("}\n");
}


x86 assembly (clang, -O0):
<platform_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %edi,-0x4(%rbp)
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    0x2e42(%rip),%rax
mov    (%rax),%esi
lea    -0x210(%rbp),%rcx
mov    $0x200,%edx
xor    %r8d,%r8d
call   1050 <clGetPlatformInfo@plt>
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rax
mov    0x2e07(%rip),%rcx
cmp    (%rcx),%rax
je     11e6 <platform_info+0x86>
jmp    11bf <platform_info+0x5f>
mov    -0x218(%rbp),%rdi
call   1070 <errcode_str@plt>
mov    %rax,%rdx
lea    0xe39(%rip),%rdi
mov    $0x102,%esi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1598 <platform_info+0x438>
lea    -0x210(%rbp),%rsi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1200 <platform_info+0xa0>
mov    -0x4(%rbp),%edi
mov    0x2db6(%rip),%rax
mov    (%rax),%esi
lea    -0x210(%rbp),%rcx
mov    $0x200,%edx
xor    %r8d,%r8d
call   1050 <clGetPlatformInfo@plt>
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rax
mov    0x2d83(%rip),%rcx
cmp    (%rcx),%rax
je     126a <platform_info+0x10a>
jmp    1243 <platform_info+0xe3>
mov    -0x218(%rbp),%rdi
call   1070 <errcode_str@plt>
mov    %rax,%rdx
lea    0xdb5(%rip),%rdi
mov    $0x103,%esi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1598 <platform_info+0x438>
lea    -0x210(%rbp),%rsi
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1284 <platform_info+0x124>
mov    -0x4(%rbp),%edi
mov    0x2d4a(%rip),%rax
mov    (%rax),%esi
lea    -0x210(%rbp),%rcx
mov    $0x200,%edx
xor    %r8d,%r8d
call   1050 <clGetPlatformInfo@plt>
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rax
mov    0x2cff(%rip),%rcx
cmp    (%rcx),%rax
je     12ee <platform_info+0x18e>
jmp    12c7 <platform_info+0x167>
mov    -0x218(%rbp),%rdi
call   1070 <errcode_str@plt>
mov    %rax,%rdx
lea    0xd31(%rip),%rdi
mov    $0x104,%esi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1598 <platform_info+0x438>
lea    -0x210(%rbp),%rsi
lea    0xd5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1308 <platform_info+0x1a8>
mov    -0x4(%rbp),%edi
mov    0x2c96(%rip),%rax
mov    (%rax),%esi
lea    -0x210(%rbp),%rcx
mov    $0x200,%edx
xor    %r8d,%r8d
call   1050 <clGetPlatformInfo@plt>
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rax
mov    0x2c7b(%rip),%rcx
cmp    (%rcx),%rax
je     1372 <platform_info+0x212>
jmp    134b <platform_info+0x1eb>
mov    -0x218(%rbp),%rdi
call   1070 <errcode_str@plt>
mov    %rax,%rdx
lea    0xcad(%rip),%rdi
mov    $0x105,%esi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1598 <platform_info+0x438>
lea    -0x210(%rbp),%rsi
lea    0xcf3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    138c <platform_info+0x22c>
mov    -0x4(%rbp),%edi
mov    0x2c0a(%rip),%rax
mov    (%rax),%esi
lea    -0x210(%rbp),%rcx
mov    $0x200,%edx
xor    %r8d,%r8d
call   1050 <clGetPlatformInfo@plt>
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rax
mov    0x2bf7(%rip),%rcx
cmp    (%rcx),%rax
je     13f6 <platform_info+0x296>
jmp    13cf <platform_info+0x26f>
mov    -0x218(%rbp),%rdi
call   1070 <errcode_str@plt>
mov    %rax,%rdx
lea    0xc29(%rip),%rdi
mov    $0x106,%esi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1598 <platform_info+0x438>
lea    -0x210(%rbp),%rsi
lea    0xc8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc28(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    0x2bc5(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x220(%rbp),%r8
call   1030 <clGetDeviceIDs@plt>
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rax
mov    0x2b6c(%rip),%rcx
cmp    (%rcx),%rax
je     1481 <platform_info+0x321>
jmp    145a <platform_info+0x2fa>
mov    -0x218(%rbp),%rdi
call   1070 <errcode_str@plt>
mov    %rax,%rdx
lea    0xb9e(%rip),%rdi
mov    $0x112,%esi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1598 <platform_info+0x438>
movslq -0x220(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x228(%rbp)
cmpq   $0x0,-0x228(%rbp)
jne    14d7 <platform_info+0x377>
jmp    14ad <platform_info+0x34d>
mov    0x2b1c(%rip),%rax
mov    (%rax),%rdi
call   1070 <errcode_str@plt>
mov    %rax,%rdx
lea    0xb48(%rip),%rdi
mov    $0x11a,%esi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1598 <platform_info+0x438>
mov    -0x4(%rbp),%edi
mov    0x2b07(%rip),%rax
mov    (%rax),%esi
mov    -0x220(%rbp),%edx
mov    -0x228(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <clGetDeviceIDs@plt>
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rax
mov    0x2aa9(%rip),%rcx
cmp    (%rcx),%rax
je     1544 <platform_info+0x3e4>
jmp    151d <platform_info+0x3bd>
mov    -0x218(%rbp),%rdi
call   1070 <errcode_str@plt>
mov    %rax,%rdx
lea    0xadb(%rip),%rdi
mov    $0x122,%esi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1598 <platform_info+0x438>
movl   $0x0,-0x21c(%rbp)
mov    -0x21c(%rbp),%eax
cmp    -0x220(%rbp),%eax
jge    158a <platform_info+0x42a>
mov    -0x228(%rbp),%rax
movslq -0x21c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1080 <device_info@plt>
mov    -0x21c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x21c(%rbp)
jmp    154e <platform_info+0x3ee>
lea    0xb1e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<platform_info>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x210,%rsp
mov    %edi,%ebp
lea    0xf09(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e24(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rcx
mov    %ebp,%edi
mov    $0x200,%edx
xor    %r8d,%r8d
call   1070 <clGetPlatformInfo@plt>
mov    0x2df7(%rip),%r12
cmp    (%r12),%rax
jne    1362 <platform_info+0x1e2>
lea    0xe3f(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2dd8(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    $0x200,%edx
mov    %rbx,%rcx
xor    %r8d,%r8d
call   1070 <clGetPlatformInfo@plt>
cmp    (%r12),%rax
jne    137b <platform_info+0x1fb>
lea    0xe21(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2db5(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    $0x200,%edx
mov    %rbx,%rcx
xor    %r8d,%r8d
call   1070 <clGetPlatformInfo@plt>
cmp    (%r12),%rax
jne    1394 <platform_info+0x214>
lea    0xe03(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2d4a(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    $0x200,%edx
mov    %rbx,%rcx
xor    %r8d,%r8d
call   1070 <clGetPlatformInfo@plt>
cmp    (%r12),%rax
jne    13aa <platform_info+0x22a>
lea    0xde2(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2d07(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    $0x200,%edx
mov    %rbx,%rcx
xor    %r8d,%r8d
call   1070 <clGetPlatformInfo@plt>
cmp    (%r12),%rax
jne    13c0 <platform_info+0x240>
lea    0xdc3(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2d0d(%rip),%rbx
mov    (%rbx),%esi
lea    0xc(%rsp),%r8
mov    %ebp,%edi
xor    %edx,%edx
xor    %ecx,%ecx
call   1050 <clGetDeviceIDs@plt>
cmp    (%r12),%rax
jne    13d6 <platform_info+0x256>
mov    0xc(%rsp),%r15d
lea    0x0(,%r15,4),%edi
call   1080 <malloc@plt>
test   %rax,%rax
je     13ec <platform_info+0x26c>
mov    %rax,%r14
mov    (%rbx),%esi
mov    %ebp,%edi
mov    %r15d,%edx
mov    %rax,%rcx
xor    %r8d,%r8d
call   1050 <clGetDeviceIDs@plt>
cmp    (%r12),%rax
jne    1409 <platform_info+0x289>
cmpl   $0x0,0xc(%rsp)
jle    1351 <platform_info+0x1d1>
xor    %ebx,%ebx
mov    (%r14,%rbx,4),%edi
call   10a0 <device_info@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     133a <platform_info+0x1ba>
lea    0xd56(%rip),%rdi
call   1040 <puts@plt>
jmp    1427 <platform_info+0x2a7>
mov    %rax,%rdi
call   1090 <errcode_str@plt>
lea    0xc8f(%rip),%rdi
mov    $0x102,%esi
jmp    141d <platform_info+0x29d>
mov    %rax,%rdi
call   1090 <errcode_str@plt>
lea    0xc76(%rip),%rdi
mov    $0x103,%esi
jmp    141d <platform_info+0x29d>
mov    %rax,%rdi
call   1090 <errcode_str@plt>
lea    0xc5d(%rip),%rdi
mov    $0x104,%esi
jmp    141d <platform_info+0x29d>
mov    %rax,%rdi
call   1090 <errcode_str@plt>
lea    0xc47(%rip),%rdi
mov    $0x105,%esi
jmp    141d <platform_info+0x29d>
mov    %rax,%rdi
call   1090 <errcode_str@plt>
lea    0xc31(%rip),%rdi
mov    $0x106,%esi
jmp    141d <platform_info+0x29d>
mov    %rax,%rdi
call   1090 <errcode_str@plt>
lea    0xc1b(%rip),%rdi
mov    $0x112,%esi
jmp    141d <platform_info+0x29d>
mov    0x2bdd(%rip),%rax
mov    (%rax),%rdi
call   1090 <errcode_str@plt>
lea    0xbfe(%rip),%rdi
mov    $0x11a,%esi
jmp    141d <platform_info+0x29d>
mov    %rax,%rdi
call   1090 <errcode_str@plt>
lea    0xbe8(%rip),%rdi
mov    $0x122,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x210,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Platform : {\0A\00"
@CL_PLATFORM_PROFILE = global i32 0
@CL_SUCCESS = global i64 0
@.str.1 = [17 x i8] c"Error at %i: %s\0A\00"
@.str.2 = [29 x i8] c" CL_PLATFORM_PROFILE: %s\0A\00"
@CL_PLATFORM_VERSION = global i32 0
@.str.3 = [29 x i8] c" CL_PLATFORM_VERSION: %s\0A\00"
@CL_PLATFORM_NAME = global i32 0
@.str.4 = [26 x i8] c" CL_PLATFORM_NAME: %s\0A\00"
@CL_PLATFORM_VENDOR = global i32 0
@.str.5 = [28 x i8] c" CL_PLATFORM_VENDOR: %s\0A\00"
@CL_PLATFORM_EXTENSIONS = global i32 0
@.str.6 = [32 x i8] c" CL_PLATFORM_EXTENSIONS: %s\0A\00"
@.str.7 = [2 x i8] c"\0A\00"
@CL_DEVICE_TYPE_ALL = global i32 0
@CL_OUT_OF_HOST_MEMORY = global i64 0
@.str.8 = [3 x i8] c"}\0A\00"
define void @platform_info(i32 %0) {
%2 = alloca i32
%3 = alloca [512 x i8]
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
store i32 %0, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %1
%10 = load i32, i32* %2
%11 = load i32, i32* @CL_PLATFORM_PROFILE
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%13 = call i64 @clGetPlatformInfo(i32 %10, i32 %11, i32 512, i8* %12, i32 0)
store i64 %13, i64* %4
%14 = load i64, i64* %4
%15 = load i64, i64* @CL_SUCCESS
%16 = icmp ne i64 %14, %15
br i1 %16, label %17, label %23
17: ; preds = %9
br label %18
18: ; preds = %17
%19 = load i64, i64* %4
%20 = call i8* @errcode_str(i64 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 258, i8* %20)
br label %22
22: ; preds = %18
br label %158
23: ; preds = %9
%24 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %23
br label %27
27: ; preds = %26
%28 = load i32, i32* %2
%29 = load i32, i32* @CL_PLATFORM_VERSION
%30 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%31 = call i64 @clGetPlatformInfo(i32 %28, i32 %29, i32 512, i8* %30, i32 0)
store i64 %31, i64* %4
%32 = load i64, i64* %4
%33 = load i64, i64* @CL_SUCCESS
%34 = icmp ne i64 %32, %33
br i1 %34, label %35, label %41
35: ; preds = %27
br label %36
36: ; preds = %35
%37 = load i64, i64* %4
%38 = call i8* @errcode_str(i64 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 259, i8* %38)
br label %40
40: ; preds = %36
br label %158
41: ; preds = %27
%42 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %42)
br label %44
44: ; preds = %41
br label %45
45: ; preds = %44
%46 = load i32, i32* %2
%47 = load i32, i32* @CL_PLATFORM_NAME
%48 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%49 = call i64 @clGetPlatformInfo(i32 %46, i32 %47, i32 512, i8* %48, i32 0)
store i64 %49, i64* %4
%50 = load i64, i64* %4
%51 = load i64, i64* @CL_SUCCESS
%52 = icmp ne i64 %50, %51
br i1 %52, label %53, label %59
53: ; preds = %45
br label %54
54: ; preds = %53
%55 = load i64, i64* %4
%56 = call i8* @errcode_str(i64 %55)
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 260, i8* %56)
br label %58
58: ; preds = %54
br label %158
59: ; preds = %45
%60 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %60)
br label %62
62: ; preds = %59
br label %63
63: ; preds = %62
%64 = load i32, i32* %2
%65 = load i32, i32* @CL_PLATFORM_VENDOR
%66 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%67 = call i64 @clGetPlatformInfo(i32 %64, i32 %65, i32 512, i8* %66, i32 0)
store i64 %67, i64* %4
%68 = load i64, i64* %4
%69 = load i64, i64* @CL_SUCCESS
%70 = icmp ne i64 %68, %69
br i1 %70, label %71, label %77
71: ; preds = %63
br label %72
72: ; preds = %71
%73 = load i64, i64* %4
%74 = call i8* @errcode_str(i64 %73)
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 261, i8* %74)
br label %76
76: ; preds = %72
br label %158
77: ; preds = %63
%78 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %78)
br label %80
80: ; preds = %77
br label %81
81: ; preds = %80
%82 = load i32, i32* %2
%83 = load i32, i32* @CL_PLATFORM_EXTENSIONS
%84 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%85 = call i64 @clGetPlatformInfo(i32 %82, i32 %83, i32 512, i8* %84, i32 0)
store i64 %85, i64* %4
%86 = load i64, i64* %4
%87 = load i64, i64* @CL_SUCCESS
%88 = icmp ne i64 %86, %87
br i1 %88, label %89, label %95
89: ; preds = %81
br label %90
90: ; preds = %89
%91 = load i64, i64* %4
%92 = call i8* @errcode_str(i64 %91)
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 262, i8* %92)
br label %94
94: ; preds = %90
br label %158
95: ; preds = %81
%96 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %96)
br label %98
98: ; preds = %95
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%100 = load i32, i32* %2
%101 = load i32, i32* @CL_DEVICE_TYPE_ALL
%102 = call i64 @clGetDeviceIDs(i32 %100, i32 %101, i32 0, i32* null, i32* %6)
store i64 %102, i64* %4
%103 = load i64, i64* %4
%104 = load i64, i64* @CL_SUCCESS
%105 = icmp ne i64 %103, %104
br i1 %105, label %106, label %112
106: ; preds = %98
br label %107
107: ; preds = %106
%108 = load i64, i64* %4
%109 = call i8* @errcode_str(i64 %108)
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 274, i8* %109)
br label %111
111: ; preds = %107
br label %158
112: ; preds = %98
%113 = load i32, i32* %6
%114 = sext i32 %113 to i64
%115 = mul i64 %114, 4
%116 = trunc i64 %115 to i32
%117 = call i32* @malloc(i32 %116)
store i32* %117, i32** %7
%118 = load i32*, i32** %7
%119 = icmp ne i32* %118, null
br i1 %119, label %126, label %120
120: ; preds = %112
br label %121
121: ; preds = %120
%122 = load i64, i64* @CL_OUT_OF_HOST_MEMORY
%123 = call i8* @errcode_str(i64 %122)
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 282, i8* %123)
br label %125
125: ; preds = %121
br label %158
126: ; preds = %112
%127 = load i32, i32* %2
%128 = load i32, i32* @CL_DEVICE_TYPE_ALL
%129 = load i32, i32* %6
%130 = load i32*, i32** %7
%131 = call i64 @clGetDeviceIDs(i32 %127, i32 %128, i32 %129, i32* %130, i32* null)
store i64 %131, i64* %4
%132 = load i64, i64* %4
%133 = load i64, i64* @CL_SUCCESS
%134 = icmp ne i64 %132, %133
br i1 %134, label %135, label %141
135: ; preds = %126
br label %136
136: ; preds = %135
%137 = load i64, i64* %4
%138 = call i8* @errcode_str(i64 %137)
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 290, i8* %138)
br label %140
140: ; preds = %136
br label %158
141: ; preds = %126
store i32 0, i32* %5
br label %142
142: ; preds = %153, %141
%143 = load i32, i32* %5
%144 = load i32, i32* %6
%145 = icmp slt i32 %143, %144
br i1 %145, label %146, label %156
146: ; preds = %142
%147 = load i32*, i32** %7
%148 = load i32, i32* %5
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i32, i32* %147, i64 %149
%151 = load i32, i32* %150
%152 = call i32 @device_info(i32 %151)
br label %153
153: ; preds = %146
%154 = load i32, i32* %5
%155 = add nsw i32 %154, 1
store i32 %155, i32* %5
br label %142
156: ; preds = %142
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %158
158: ; preds = %156, %140, %125, %111, %94, %76, %58, %40, %22
ret void
}

LLVM IR (-O2):
@CL_PLATFORM_PROFILE = global i32 0
@CL_SUCCESS = global i64 0
@.str.1 = [17 x i8] c"Error at %i: %s\0A\00"
@.str.2 = [29 x i8] c" CL_PLATFORM_PROFILE: %s\0A\00"
@CL_PLATFORM_VERSION = global i32 0
@.str.3 = [29 x i8] c" CL_PLATFORM_VERSION: %s\0A\00"
@CL_PLATFORM_NAME = global i32 0
@.str.4 = [26 x i8] c" CL_PLATFORM_NAME: %s\0A\00"
@CL_PLATFORM_VENDOR = global i32 0
@.str.5 = [28 x i8] c" CL_PLATFORM_VENDOR: %s\0A\00"
@CL_PLATFORM_EXTENSIONS = global i32 0
@.str.6 = [32 x i8] c" CL_PLATFORM_EXTENSIONS: %s\0A\00"
@CL_DEVICE_TYPE_ALL = global i32 0
@CL_OUT_OF_HOST_MEMORY = global i64 0
@str = [13 x i8] c"Platform : {\00"
@str.9 = [2 x i8] c"}\00"
define void @platform_info(i32 %0) {
%2 = alloca [512 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* @CL_PLATFORM_PROFILE
%7 = call i64 @clGetPlatformInfo(i32 %0, i32 %6, i32 512, i8* %4, i32 0)
%8 = load i64, i64* @CL_SUCCESS
%9 = icmp eq i64 %7, %8
br i1 %9, label %13, label %10
10: ; preds = %1
%11 = call i8* @errcode_str(i64 %7)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 258, i8* %11)
br label %92
13: ; preds = %1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%15 = load i32, i32* @CL_PLATFORM_VERSION
%16 = call i64 @clGetPlatformInfo(i32 %0, i32 %15, i32 512, i8* %4, i32 0)
%17 = load i64, i64* @CL_SUCCESS
%18 = icmp eq i64 %16, %17
br i1 %18, label %22, label %19
19: ; preds = %13
%20 = call i8* @errcode_str(i64 %16)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 259, i8* %20)
br label %92
22: ; preds = %13
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%24 = load i32, i32* @CL_PLATFORM_NAME
%25 = call i64 @clGetPlatformInfo(i32 %0, i32 %24, i32 512, i8* %4, i32 0)
%26 = load i64, i64* @CL_SUCCESS
%27 = icmp eq i64 %25, %26
br i1 %27, label %31, label %28
28: ; preds = %22
%29 = call i8* @errcode_str(i64 %25)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 260, i8* %29)
br label %92
31: ; preds = %22
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%33 = load i32, i32* @CL_PLATFORM_VENDOR
%34 = call i64 @clGetPlatformInfo(i32 %0, i32 %33, i32 512, i8* %4, i32 0)
%35 = load i64, i64* @CL_SUCCESS
%36 = icmp eq i64 %34, %35
br i1 %36, label %40, label %37
37: ; preds = %31
%38 = call i8* @errcode_str(i64 %34)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 261, i8* %38)
br label %92
40: ; preds = %31
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%42 = load i32, i32* @CL_PLATFORM_EXTENSIONS
%43 = call i64 @clGetPlatformInfo(i32 %0, i32 %42, i32 512, i8* %4, i32 0)
%44 = load i64, i64* @CL_SUCCESS
%45 = icmp eq i64 %43, %44
br i1 %45, label %49, label %46
46: ; preds = %40
%47 = call i8* @errcode_str(i64 %43)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 262, i8* %47)
br label %92
49: ; preds = %40
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%51 = call i32 @putchar(i32 10)
%52 = bitcast i32* %3 to i8*
%53 = load i32, i32* @CL_DEVICE_TYPE_ALL
%54 = call i64 @clGetDeviceIDs(i32 %0, i32 %53, i32 0, i32* null, i32* %3)
%55 = load i64, i64* @CL_SUCCESS
%56 = icmp eq i64 %54, %55
br i1 %56, label %60, label %57
57: ; preds = %49
%58 = call i8* @errcode_str(i64 %54)
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 274, i8* %58)
br label %91
60: ; preds = %49
%61 = load i32, i32* %3
%62 = shl i32 %61, 2
%63 = call i32* @malloc(i32 %62)
%64 = icmp eq i32* %63, null
br i1 %64, label %65, label %69
65: ; preds = %60
%66 = load i64, i64* @CL_OUT_OF_HOST_MEMORY
%67 = call i8* @errcode_str(i64 %66)
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 282, i8* %67)
br label %91
69: ; preds = %60
%70 = load i32, i32* @CL_DEVICE_TYPE_ALL
%71 = call i64 @clGetDeviceIDs(i32 %0, i32 %70, i32 %61, i32* %63, i32* null)
%72 = load i64, i64* @CL_SUCCESS
%73 = icmp eq i64 %71, %72
br i1 %73, label %74, label %77
74: ; preds = %69
%75 = load i32, i32* %3
%76 = icmp sgt i32 %75, 0
br i1 %76, label %80, label %89
77: ; preds = %69
%78 = call i8* @errcode_str(i64 %71)
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 290, i8* %78)
br label %91
80: ; preds = %74, %80
%81 = phi i64 [ %85, %80 ], [ 0, %74 ]
%82 = getelementptr inbounds i32, i32* %63, i64 %81
%83 = load i32, i32* %82
%84 = call i32 @device_info(i32 %83)
%85 = add nuw nsw i64 %81, 1
%86 = load i32, i32* %3
%87 = sext i32 %86 to i64
%88 = icmp slt i64 %85, %87
br i1 %88, label %80, label %89
89: ; preds = %80, %74
%90 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
br label %91
91: ; preds = %89, %77, %65, %57
br label %92
92: ; preds = %91, %46, %37, %28, %19, %10
ret void
}