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

/* Variables and functions */
int /*<<< orphan*/ __gleGetIntegerv(int, int *);
scalar_t__ __gleGetStringi(int, int);
scalar_t__ strcasecmp(char const *, char *);
int CheckCompatibilityExt() {
  int iLoop = 0;
  int iNumExtensions = 0;
  __gleGetIntegerv(0x821D, &iNumExtensions);
  for (iLoop = 0; iLoop < iNumExtensions; iLoop++) {
    const char *strExtensionName = (const char *)__gleGetStringi(0x1F03, iLoop);
    if (strcasecmp(strExtensionName, "GL_ARB_compatibility") == 0) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<CheckCompatibilityExt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x821d,%edi
lea    -0xc(%rbp),%rsi
call   1040 <__gleGetIntegerv@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b1 <CheckCompatibilityExt+0x81>
mov    -0x8(%rbp),%esi
mov    $0x1f03,%edi
call   1050 <__gleGetStringi@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    119e <CheckCompatibilityExt+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    11b8 <CheckCompatibilityExt+0x88>
jmp    11a3 <CheckCompatibilityExt+0x73>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115b <CheckCompatibilityExt+0x2b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckCompatibilityExt>:
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x821d,%edi
call   1040 <__gleGetIntegerv@plt>
cmpl   $0x0,0x4(%rsp)
jle    1185 <CheckCompatibilityExt+0x55>
xor    %ebx,%ebx
lea    0xea5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    $0x1f03,%edi
mov    %ebx,%esi
call   1050 <__gleGetStringi@plt>
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1189 <CheckCompatibilityExt+0x59>
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
jl     1160 <CheckCompatibilityExt+0x30>
xor    %eax,%eax
jmp    118e <CheckCompatibilityExt+0x5e>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [21 x i8] c"GL_ARB_compatibility\00"
define i32 @CheckCompatibilityExt() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 0, i32* %2
store i32 0, i32* %3
%5 = call i32 @__gleGetIntegerv(i32 33309, i32* %3)
store i32 0, i32* %2
br label %6
6: ; preds = %19, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %22
10: ; preds = %6
%11 = load i32, i32* %2
%12 = call i64 @__gleGetStringi(i32 7939, i32 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = call i64 @strcasecmp(i8* %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %10
store i32 1, i32* %1
br label %23
18: ; preds = %10
br label %19
19: ; preds = %18
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %6
22: ; preds = %6
store i32 0, i32* %1
br label %23
23: ; preds = %22, %17
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str = [21 x i8] c"GL_ARB_compatibility\00"
define i32 @CheckCompatibilityExt() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @__gleGetIntegerv(i32 33309, i32* %1)
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %9, label %16
6: ; preds = %9
%7 = load i32, i32* %1
%8 = icmp slt i32 %15, %7
br i1 %8, label %9, label %16
9: ; preds = %0, %6
%10 = phi i32 [ %15, %6 ], [ 0, %0 ]
%11 = call i64 @__gleGetStringi(i32 7939, i32 %10)
%12 = inttoptr i64 %11 to i8*
%13 = call i64 @strcasecmp(i8* %12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
%15 = add nuw nsw i32 %10, 1
br i1 %14, label %16, label %6
16: ; preds = %9, %6, %0
%17 = phi i32 [ 0, %0 ], [ 0, %6 ], [ 1, %9 ]
ret i32 %17
}