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

/* Variables and functions */
int /*<<< orphan*/ GL_FALSE;
int /*<<< orphan*/ GL_TRUE;
int /*<<< orphan*/ free(void *);
scalar_t__ malloc(scalar_t__);
scalar_t__ strcmp(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *strtok(char *, char *);
GLboolean gluCheckExtension(const GLubyte *extName, const GLubyte *extString) {
  GLboolean flag = GL_FALSE;
  char *word;
  char *lookHere;
  char *deleteThis;
  if (extString == NULL)
    return GL_FALSE;
  deleteThis = lookHere = (char *)malloc(strlen((const char *)extString) + 1);
  if (lookHere == NULL)
    return GL_FALSE;
  strcpy(lookHere, (const char *)extString);
  while ((word = strtok(lookHere, " ")) != NULL) {
    if (strcmp(word, (const char *)extName) == 0) {
      flag = GL_TRUE;
      break;
    }
    lookHere = NULL;
  }
  free((void *)deleteThis);
  return flag;
}


x86 assembly (clang, -O0):
<gluCheckExtension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1198 <gluCheckExtension+0x38>
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1240 <gluCheckExtension+0xe0>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11d1 <gluCheckExtension+0x71>
mov    0x2e21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1240 <gluCheckExtension+0xe0>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x30(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1080 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     1231 <gluCheckExtension+0xd1>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1224 <gluCheckExtension+0xc4>
mov    0x2dbe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
jmp    1231 <gluCheckExtension+0xd1>
movq   $0x0,-0x30(%rbp)
jmp    11de <gluCheckExtension+0x7e>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gluCheckExtension>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2e79(%rip),%r12
mov    (%r12),%r14d
test   %rsi,%rsi
je     11ea <gluCheckExtension+0x8a>
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%rdi
call   1070 <malloc@plt>
test   %rax,%rax
je     11e6 <gluCheckExtension+0x86>
mov    %rax,%r15
mov    %rax,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
lea    0xe57(%rip),%rbp
mov    %r15,%rdi
nopl   0x0(%rax)
mov    %rbp,%rsi
call   1080 <strtok@plt>
test   %rax,%rax
je     11dc <gluCheckExtension+0x7c>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
mov    $0x0,%edi
test   %rax,%rax
jne    11b0 <gluCheckExtension+0x50>
mov    0x2dff(%rip),%rax
mov    (%rax),%r14d
mov    %r15,%rdi
call   1030 <free@plt>
jmp    11ea <gluCheckExtension+0x8a>
mov    (%r12),%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@GL_FALSE = global i32 0
@.str = [2 x i8] c" \00"
@GL_TRUE = global i32 0
define i32 @gluCheckExtension(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32* %0, i32** %4
store i32* %1, i32** %5
%10 = load i32, i32* @GL_FALSE
store i32 %10, i32* %6
%11 = load i32*, i32** %5
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i32, i32* @GL_FALSE
store i32 %14, i32* %3
br label %48
15: ; preds = %2
%16 = load i32*, i32** %5
%17 = bitcast i32* %16 to i8*
%18 = call i64 @strlen(i8* %17)
%19 = add nsw i64 %18, 1
%20 = call i64 @malloc(i64 %19)
%21 = inttoptr i64 %20 to i8*
store i8* %21, i8** %8
store i8* %21, i8** %9
%22 = load i8*, i8** %8
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %26
24: ; preds = %15
%25 = load i32, i32* @GL_FALSE
store i32 %25, i32* %3
br label %48
26: ; preds = %15
%27 = load i8*, i8** %8
%28 = load i32*, i32** %5
%29 = bitcast i32* %28 to i8*
%30 = call i32 @strcpy(i8* %27, i8* %29)
br label %31
31: ; preds = %43, %26
%32 = load i8*, i8** %8
%33 = call i8* @strtok(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %33, i8** %7
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %44
35: ; preds = %31
%36 = load i8*, i8** %7
%37 = load i32*, i32** %4
%38 = bitcast i32* %37 to i8*
%39 = call i64 @strcmp(i8* %36, i8* %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %35
%42 = load i32, i32* @GL_TRUE
store i32 %42, i32* %6
br label %44
43: ; preds = %35
store i8* null, i8** %8
br label %31
44: ; preds = %41, %31
%45 = load i8*, i8** %9
%46 = call i32 @free(i8* %45)
%47 = load i32, i32* %6
store i32 %47, i32* %3
br label %48
48: ; preds = %44, %24, %13
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@GL_FALSE = global i32 0
@.str = [2 x i8] c" \00"
@GL_TRUE = global i32 0
define i32 @gluCheckExtension(i32* %0, i32* %1) {
%3 = load i32, i32* @GL_FALSE
%4 = icmp eq i32* %1, null
br i1 %4, label %29, label %5
5: ; preds = %2
%6 = bitcast i32* %1 to i8*
%7 = tail call i64 @strlen(i8* %6)
%8 = add nsw i64 %7, 1
%9 = tail call i64 @malloc(i64 %8)
%10 = inttoptr i64 %9 to i8*
%11 = icmp eq i64 %9, 0
br i1 %11, label %12, label %14
12: ; preds = %5
%13 = load i32, i32* @GL_FALSE
br label %29
14: ; preds = %5
%15 = tail call i32 @strcpy(i8* %10, i8* %6)
%16 = bitcast i32* %0 to i8*
br label %17
17: ; preds = %21, %14
%18 = phi i8* [ %10, %14 ], [ null, %21 ]
%19 = tail call i8* @strtok(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i8* %19, null
br i1 %20, label %26, label %21
21: ; preds = %17
%22 = tail call i64 @strcmp(i8* %19, i8* %16)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %17
24: ; preds = %21
%25 = load i32, i32* @GL_TRUE
br label %26
26: ; preds = %17, %24
%27 = phi i32 [ %25, %24 ], [ %3, %17 ]
%28 = tail call i32 @free(i8* %10)
br label %29
29: ; preds = %2, %26, %12
%30 = phi i32 [ %13, %12 ], [ %27, %26 ], [ %3, %2 ]
ret i32 %30
}