#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*/ GLboolean;

/* Variables and functions */
int /*<<< orphan*/ GL_TRUE;
int /*<<< orphan*/ GL_VERSION;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ glGetString(int /*<<< orphan*/);
scalar_t__ glutExtensionSupported(char *);
int /*<<< orphan*/ stderr;
GLboolean ShadersSupported(void) {
  const char *version = (const char *)glGetString(GL_VERSION);
  if (version[0] == '2' && version[1] == '.') {
    return GL_TRUE;
  } else if (glutExtensionSupported("GL_ARB_vertex_shader") &&
             glutExtensionSupported("GL_ARB_fragment_shader") &&
             glutExtensionSupported("GL_ARB_shader_objects")) {
    fprintf(stderr, "Warning: Trying ARB GLSL instead of OpenGL 2.x.  This may "
                    "not work.\n");
    return GL_TRUE;
  }
  return GL_TRUE;
}


x86 assembly (clang, -O0):
<ShadersSupported>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
call   1050 <glGetString@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x32,%eax
jne    117c <ShadersSupported+0x4c>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
jne    117c <ShadersSupported+0x4c>
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11f5 <ShadersSupported+0xc5>
lea    0xe7d(%rip),%rdi
call   1030 <glutExtensionSupported@plt>
cmp    $0x0,%rax
je     11e4 <ShadersSupported+0xb4>
lea    0xe7c(%rip),%rdi
call   1030 <glutExtensionSupported@plt>
cmp    $0x0,%rax
je     11e4 <ShadersSupported+0xb4>
lea    0xe7d(%rip),%rdi
call   1030 <glutExtensionSupported@plt>
cmp    $0x0,%rax
je     11e4 <ShadersSupported+0xb4>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
lea    0xe74(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dfe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11f5 <ShadersSupported+0xc5>
jmp    11e9 <ShadersSupported+0xb9>
mov    0x2de8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShadersSupported>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1050 <glGetString@plt>
cmpb   $0x32,(%rax)
jne    114a <ShadersSupported+0x1a>
cmpb   $0x2e,0x1(%rax)
je     1192 <ShadersSupported+0x62>
lea    0xeaf(%rip),%rdi
call   1030 <glutExtensionSupported@plt>
test   %rax,%rax
je     1192 <ShadersSupported+0x62>
lea    0xeb3(%rip),%rdi
call   1030 <glutExtensionSupported@plt>
test   %rax,%rax
je     1192 <ShadersSupported+0x62>
lea    0xeb9(%rip),%rdi
call   1030 <glutExtensionSupported@plt>
test   %rax,%rax
je     1192 <ShadersSupported+0x62>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e3f(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@GL_VERSION = global i32 0
@GL_TRUE = global i32 0
@.str = [21 x i8] c"GL_ARB_vertex_shader\00"
@.str.1 = [23 x i8] c"GL_ARB_fragment_shader\00"
@.str.2 = [22 x i8] c"GL_ARB_shader_objects\00"
@stderr = global i32 0
@.str.3 = [69 x i8] c"Warning: Trying ARB GLSL instead of OpenGL 2.x. This may not work.\0A\00"
define i32 @ShadersSupported() {
%1 = alloca i32
%2 = alloca i8*
%3 = load i32, i32* @GL_VERSION
%4 = call i64 @glGetString(i32 %3)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 50
br i1 %10, label %11, label %19
11: ; preds = %0
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 46
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = load i32, i32* @GL_TRUE
store i32 %18, i32* %1
br label %35
19: ; preds = %11, %0
%20 = call i64 @glutExtensionSupported(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = call i64 @glutExtensionSupported(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %22
%26 = call i64 @glutExtensionSupported(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.3, i64 0, i64 0))
%31 = load i32, i32* @GL_TRUE
store i32 %31, i32* %1
br label %35
32: ; preds = %25, %22, %19
br label %33
33: ; preds = %32
%34 = load i32, i32* @GL_TRUE
store i32 %34, i32* %1
br label %35
35: ; preds = %33, %28, %17
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@GL_VERSION = global i32 0
@GL_TRUE = global i32 0
@.str = [21 x i8] c"GL_ARB_vertex_shader\00"
@.str.1 = [23 x i8] c"GL_ARB_fragment_shader\00"
@.str.2 = [22 x i8] c"GL_ARB_shader_objects\00"
@stderr = global i32 0
@.str.3 = [69 x i8] c"Warning: Trying ARB GLSL instead of OpenGL 2.x. This may not work.\0A\00"
define i32 @ShadersSupported() {
%1 = load i32, i32* @GL_VERSION
%2 = tail call i64 @glGetString(i32 %1)
%3 = inttoptr i64 %2 to i8*
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 50
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 46
br i1 %9, label %22, label %10
10: ; preds = %6, %0
%11 = tail call i64 @glutExtensionSupported(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %22, label %13
13: ; preds = %10
%14 = tail call i64 @glutExtensionSupported(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = tail call i64 @glutExtensionSupported(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %16, %13, %10, %6, %19
%23 = load i32, i32* @GL_TRUE
ret i32 %23
}