#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 char GLubyte;
typedef int /*<<< orphan*/ GLint;
typedef int /*<<< orphan*/ GLboolean;

/* Variables and functions */
int /*<<< orphan*/ GL_FALSE;
int /*<<< orphan*/ GL_TRUE;
int /*<<< orphan*/ strlen(char const *);
char *strstr(char const *, char const *);
GLboolean IsExtensionSupported(const GLubyte *extensionStr,
                               const GLubyte *checkExtension) {
  const GLubyte *s;
  GLint len;
  s = extensionStr;
  len = strlen(checkExtension);
  while ((s = strstr(s, checkExtension)) != NULL) {
    s += len;
    if ((*s == ' ') || (*s == '\0')) {
      return (GL_TRUE);
    }
  }
  return (GL_FALSE);
}


x86 assembly (clang, -O0):
<IsExtensionSupported>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     11a6 <IsExtensionSupported+0x86>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1190 <IsExtensionSupported+0x70>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11a1 <IsExtensionSupported+0x81>
mov    0x2e41(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11b2 <IsExtensionSupported+0x92>
jmp    1144 <IsExtensionSupported+0x24>
mov    0x2e3b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsExtensionSupported>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
movslq %eax,%r12
mov    0x2ea7(%rip),%r15
mov    0x2e90(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strstr@plt>
test   %rax,%rax
je     1170 <IsExtensionSupported+0x50>
mov    %rax,%rbx
add    %r12,%rbx
testb  $0xdf,(%rax,%r12,1)
jne    1150 <IsExtensionSupported+0x30>
mov    %r13,%r15
mov    (%r15),%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@GL_TRUE = global i32 0
@GL_FALSE = global i32 0
define i32 @IsExtensionSupported(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
store i8* %8, i8** %6
%9 = load i8*, i8** %5
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %7
br label %11
11: ; preds = %32, %2
%12 = load i8*, i8** %6
%13 = load i8*, i8** %5
%14 = call i8* @strstr(i8* %12, i8* %13)
store i8* %14, i8** %6
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %33
16: ; preds = %11
%17 = load i32, i32* %7
%18 = load i8*, i8** %6
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds i8, i8* %18, i64 %19
store i8* %20, i8** %6
%21 = load i8*, i8** %6
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 32
br i1 %24, label %30, label %25
25: ; preds = %16
%26 = load i8*, i8** %6
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %25, %16
%31 = load i32, i32* @GL_TRUE
store i32 %31, i32* %3
br label %35
32: ; preds = %25
br label %11
33: ; preds = %11
%34 = load i32, i32* @GL_FALSE
store i32 %34, i32* %3
br label %35
35: ; preds = %33, %30
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@GL_TRUE = global i32 0
@GL_FALSE = global i32 0
define i32 @IsExtensionSupported(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = sext i32 %3 to i64
br label %5
5: ; preds = %9, %2
%6 = phi i8* [ %0, %2 ], [ %10, %9 ]
%7 = tail call i8* @strstr(i8* dereferenceable(1) %6, i8* dereferenceable(1) %1)
%8 = icmp eq i8* %7, null
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %7, i64 %4
%11 = load i8, i8* %10
switch i8 %11, label %5 [
i8 32, label %12
i8 0, label %12
]
12: ; preds = %5, %9, %9
%13 = phi i32* [ @GL_TRUE, %9 ], [ @GL_TRUE, %9 ], [ @GL_FALSE, %5 ]
%14 = load i32, i32* %13
ret i32 %14
}