#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*/ cl_platform_id;
typedef int /*<<< orphan*/ cl_int;

/* Variables and functions */
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;
int /*<<< orphan*/ clGetPlatformInfo(int /*<<< orphan*/, int /*<<< orphan*/,
                                     int, char *, size_t *);
int /*<<< orphan*/ printf(char *, ...);
void printPlatformInfo(cl_platform_id platform) {
  cl_int err;
  char paramValue[100];
  size_t returnSize;
  printf("===== Platform info ====\n");
  err = clGetPlatformInfo(platform, CL_PLATFORM_PROFILE, 100, paramValue,
                          &returnSize);
  printf("Platform profile:\t%s\n", paramValue);
  err = clGetPlatformInfo(platform, CL_PLATFORM_VERSION, 100, paramValue,
                          &returnSize);
  printf("Platform version:\t%s\n", paramValue);
  err = clGetPlatformInfo(platform, CL_PLATFORM_NAME, 100, paramValue,
                          &returnSize);
  printf("Platform name:\t\t%s\n", paramValue);
  err = clGetPlatformInfo(platform, CL_PLATFORM_VENDOR, 100, paramValue,
                          &returnSize);
  printf("Platform vendor:\t%s\n", paramValue);
  err = clGetPlatformInfo(platform, CL_PLATFORM_EXTENSIONS, 100, paramValue,
                          &returnSize);
  printf("Platform extensions:\t");
  if (returnSize > 0) {
    printf("%s\n", paramValue);
  } else {
    printf("(none)");
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<printPlatformInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    0x2e92(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rcx
mov    $0x64,%edx
lea    -0x78(%rbp),%r8
call   1040 <clGetPlatformInfo@plt>
mov    %eax,-0x8(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    0x2e57(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rcx
mov    $0x64,%edx
lea    -0x78(%rbp),%r8
call   1040 <clGetPlatformInfo@plt>
mov    %eax,-0x8(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    0x2e34(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rcx
mov    $0x64,%edx
lea    -0x78(%rbp),%r8
call   1040 <clGetPlatformInfo@plt>
mov    %eax,-0x8(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    0x2de1(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rcx
mov    $0x64,%edx
lea    -0x78(%rbp),%r8
call   1040 <clGetPlatformInfo@plt>
mov    %eax,-0x8(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    0x2da6(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rcx
mov    $0x64,%edx
lea    -0x78(%rbp),%r8
call   1040 <clGetPlatformInfo@plt>
mov    %eax,-0x8(%rbp)
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x78(%rbp)
jbe    1259 <printPlatformInfo+0x139>
lea    -0x70(%rbp),%rsi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1267 <printPlatformInfo+0x147>
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPlatformInfo>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %edi,%ebx
lea    0xf2d(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%r15
mov    %ebx,%edi
mov    $0x64,%edx
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <clGetPlatformInfo@plt>
lea    0xe8a(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    $0x64,%edx
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <clGetPlatformInfo@plt>
lea    0xe74(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    $0x64,%edx
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <clGetPlatformInfo@plt>
lea    0xe5e(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    $0x64,%edx
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <clGetPlatformInfo@plt>
lea    0xe46(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    $0x64,%edx
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <clGetPlatformInfo@plt>
lea    0xe2f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpq   $0x0,0x8(%rsp)
je     1241 <printPlatformInfo+0x111>
lea    0x10(%rsp),%rdi
call   1030 <puts@plt>
jmp    124f <printPlatformInfo+0x11f>
lea    0xe23(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xde8(%rip),%rdi
call   1030 <puts@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"===== Platform info ====\0A\00"
@CL_PLATFORM_PROFILE = global i32 0
@.str.1 = [22 x i8] c"Platform profile:\09%s\0A\00"
@CL_PLATFORM_VERSION = global i32 0
@.str.2 = [22 x i8] c"Platform version:\09%s\0A\00"
@CL_PLATFORM_NAME = global i32 0
@.str.3 = [20 x i8] c"Platform name:\09\09%s\0A\00"
@CL_PLATFORM_VENDOR = global i32 0
@.str.4 = [21 x i8] c"Platform vendor:\09%s\0A\00"
@CL_PLATFORM_EXTENSIONS = global i32 0
@.str.5 = [22 x i8] c"Platform extensions:\09\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [7 x i8] c"(none)\00"
@.str.8 = [3 x i8] c"\0A\0A\00"
define void @printPlatformInfo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i8]
%5 = alloca i64
store i32 %0, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = load i32, i32* @CL_PLATFORM_PROFILE
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%10 = call i32 @clGetPlatformInfo(i32 %7, i32 %8, i32 100, i8* %9, i64* %5)
store i32 %10, i32* %3
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = load i32, i32* %2
%14 = load i32, i32* @CL_PLATFORM_VERSION
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%16 = call i32 @clGetPlatformInfo(i32 %13, i32 %14, i32 100, i8* %15, i64* %5)
store i32 %16, i32* %3
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = load i32, i32* %2
%20 = load i32, i32* @CL_PLATFORM_NAME
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%22 = call i32 @clGetPlatformInfo(i32 %19, i32 %20, i32 100, i8* %21, i64* %5)
store i32 %22, i32* %3
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%25 = load i32, i32* %2
%26 = load i32, i32* @CL_PLATFORM_VENDOR
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%28 = call i32 @clGetPlatformInfo(i32 %25, i32 %26, i32 100, i8* %27, i64* %5)
store i32 %28, i32* %3
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %29)
%31 = load i32, i32* %2
%32 = load i32, i32* @CL_PLATFORM_EXTENSIONS
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%34 = call i32 @clGetPlatformInfo(i32 %31, i32 %32, i32 100, i8* %33, i64* %5)
store i32 %34, i32* %3
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%36 = load i64, i64* %5
%37 = icmp ugt i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %1
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %39)
br label %43
41: ; preds = %1
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %43
43: ; preds = %41, %38
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@CL_PLATFORM_PROFILE = global i32 0
@.str.1 = [22 x i8] c"Platform profile:\09%s\0A\00"
@CL_PLATFORM_VERSION = global i32 0
@.str.2 = [22 x i8] c"Platform version:\09%s\0A\00"
@CL_PLATFORM_NAME = global i32 0
@.str.3 = [20 x i8] c"Platform name:\09\09%s\0A\00"
@CL_PLATFORM_VENDOR = global i32 0
@.str.4 = [21 x i8] c"Platform vendor:\09%s\0A\00"
@CL_PLATFORM_EXTENSIONS = global i32 0
@.str.5 = [22 x i8] c"Platform extensions:\09\00"
@.str.7 = [7 x i8] c"(none)\00"
@str = [25 x i8] c"===== Platform info ====\00"
@str.9 = [2 x i8] c"\0A\00"
define void @printPlatformInfo(i32 %0) {
%2 = alloca [100 x i8]
%3 = alloca i64
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = bitcast i64* %3 to i8*
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%7 = load i32, i32* @CL_PLATFORM_PROFILE
%8 = call i32 @clGetPlatformInfo(i32 %0, i32 %7, i32 100, i8* %4, i64* %3)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%10 = load i32, i32* @CL_PLATFORM_VERSION
%11 = call i32 @clGetPlatformInfo(i32 %0, i32 %10, i32 100, i8* %4, i64* %3)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%13 = load i32, i32* @CL_PLATFORM_NAME
%14 = call i32 @clGetPlatformInfo(i32 %0, i32 %13, i32 100, i8* %4, i64* %3)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%16 = load i32, i32* @CL_PLATFORM_VENDOR
%17 = call i32 @clGetPlatformInfo(i32 %0, i32 %16, i32 100, i8* %4, i64* %3)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%19 = load i32, i32* @CL_PLATFORM_EXTENSIONS
%20 = call i32 @clGetPlatformInfo(i32 %0, i32 %19, i32 100, i8* %4, i64* %3)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%22 = load i64, i64* %3
%23 = icmp eq i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %1
%25 = call i32 @puts(i8* %4)
br label %28
26: ; preds = %1
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
ret void
}