#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_int;

/* Variables and functions */
#define CL_INVALID_PLATFORM 130
#define CL_PLATFORM_NOT_FOUND_KHR 129
#define CL_SUCCESS 128
int /*<<< orphan*/ printf(char *, ...);
void print_error(cl_int error) {
  switch (error) {
  case CL_SUCCESS:
    break;
  case CL_PLATFORM_NOT_FOUND_KHR:
    printf("No platforms found!\n");
    break;
  case CL_INVALID_PLATFORM:
    printf("Invalid platform\n");
    break;
  default:
    printf("OpenCL error: %i\n", error);
  }
}


x86 assembly (clang, -O0):
<print_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x80,%eax
je     1157 <print_error+0x47>
jmp    1131 <print_error+0x21>
mov    -0x8(%rbp),%eax
sub    $0x81,%eax
je     115c <print_error+0x4c>
jmp    1144 <print_error+0x34>
mov    -0x8(%rbp),%eax
sub    $0x82,%eax
je     116f <print_error+0x5f>
jmp    1182 <print_error+0x72>
jmp    1193 <print_error+0x83>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1193 <print_error+0x83>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1193 <print_error+0x83>
mov    -0x4(%rbp),%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_error>:
cmp    $0x80,%edi
je     1146 <print_error+0x26>
mov    %edi,%esi
cmp    $0x82,%edi
je     1147 <print_error+0x27>
cmp    $0x81,%esi
jne    1153 <print_error+0x33>
lea    0xee2(%rip),%rdi
jmp    1030 <puts@plt>
ret
lea    0xec4(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xea6(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"No platforms found!\0A\00"
@.str.1 = [18 x i8] c"Invalid platform\0A\00"
@.str.2 = [18 x i8] c"OpenCL error: %i\0A\00"
define void @print_error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %9 [
i32 128, label %4
i32 129, label %5
i32 130, label %7
]
4: ; preds = %1
br label %12
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %12
7: ; preds = %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %7, %5, %4
ret void
}

LLVM IR (-O2):
@.str.2 = [18 x i8] c"OpenCL error: %i\0A\00"
@str = [17 x i8] c"Invalid platform\00"
@str.3 = [20 x i8] c"No platforms found!\00"
define void @print_error(i32 %0) {
switch i32 %0, label %6 [
i32 128, label %8
i32 129, label %2
i32 130, label %4
]
2: ; preds = %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.3, i64 0, i64 0))
br label %8
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %0)
br label %8
8: ; preds = %6, %4, %2, %1
ret void
}