#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*/ Q_strcasecmp(char *, char *);
int /*<<< orphan*/ Q_strncasecmp(char *, char *, int);
int Q1_TextureContents(char *name) {
  if (!Q_strcasecmp(name, "clip")) {
    return 1;
  }
  if (name[0] == '*') {
    if (!Q_strncasecmp(name + 1, "lava", 4)) {
      return 8;
    } else if (!Q_strncasecmp(name + 1, "slime", 5)) {
      return 16;
    } else {
      return 32;
    }
  } else if (!Q_strncasecmp(name, "sky", 3)) {
    return 1;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<Q1_TextureContents>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <Q_strcasecmp@plt>
cmp    $0x0,%eax
jne    1151 <Q1_TextureContents+0x31>
movl   $0x1,-0x4(%rbp)
jmp    11fa <Q1_TextureContents+0xda>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    11c9 <Q1_TextureContents+0xa9>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
lea    0xe95(%rip),%rsi
mov    $0x4,%edx
call   1030 <Q_strncasecmp@plt>
cmp    $0x0,%eax
jne    118f <Q1_TextureContents+0x6f>
movl   $0x8,-0x4(%rbp)
jmp    11fa <Q1_TextureContents+0xda>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
lea    0xe6c(%rip),%rsi
mov    $0x5,%edx
call   1030 <Q_strncasecmp@plt>
cmp    $0x0,%eax
jne    11bd <Q1_TextureContents+0x9d>
movl   $0x10,-0x4(%rbp)
jmp    11fa <Q1_TextureContents+0xda>
movl   $0x20,-0x4(%rbp)
jmp    11fa <Q1_TextureContents+0xda>
mov    -0x10(%rbp),%rdi
lea    0xe3c(%rip),%rsi
mov    $0x3,%edx
call   1030 <Q_strncasecmp@plt>
cmp    $0x0,%eax
jne    11f3 <Q1_TextureContents+0xd3>
movl   $0x1,-0x4(%rbp)
jmp    11fa <Q1_TextureContents+0xda>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q1_TextureContents>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed3(%rip),%rsi
call   1040 <Q_strcasecmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     119b <Q1_TextureContents+0x7b>
cmpb   $0x2a,(%rbx)
jne    1180 <Q1_TextureContents+0x60>
add    $0x1,%rbx
lea    0xeba(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <Q_strncasecmp@plt>
test   %eax,%eax
je     1196 <Q1_TextureContents+0x76>
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <Q_strncasecmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
shl    $0x4,%ebp
add    $0x10,%ebp
jmp    119b <Q1_TextureContents+0x7b>
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <Q_strncasecmp@plt>
jmp    119b <Q1_TextureContents+0x7b>
mov    $0x8,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"clip\00"
@.str.1 = [5 x i8] c"lava\00"
@.str.2 = [6 x i8] c"slime\00"
@.str.3 = [4 x i8] c"sky\00"
define i32 @Q1_TextureContents(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @Q_strcasecmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
store i32 1, i32* %2
br label %33
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 42
br i1 %13, label %14, label %27
14: ; preds = %8
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = call i32 @Q_strncasecmp(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %14
store i32 8, i32* %2
br label %33
20: ; preds = %14
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = call i32 @Q_strncasecmp(i8* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %20
store i32 16, i32* %2
br label %33
26: ; preds = %20
store i32 32, i32* %2
br label %33
27: ; preds = %8
%28 = load i8*, i8** %3
%29 = call i32 @Q_strncasecmp(i8* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 3)
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %27
store i32 1, i32* %2
br label %33
32: ; preds = %27
store i32 1, i32* %2
br label %33
33: ; preds = %32, %31, %26, %25, %19, %7
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@.str = [5 x i8] c"clip\00"
@.str.1 = [5 x i8] c"lava\00"
@.str.2 = [6 x i8] c"slime\00"
@.str.3 = [4 x i8] c"sky\00"
define i32 @Q1_TextureContents(i8* %0) {
%2 = tail call i32 @Q_strcasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 42
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = tail call i32 @Q_strncasecmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%10 = icmp eq i32 %9, 0
br i1 %10, label %17, label %11
11: ; preds = %7
%12 = tail call i32 @Q_strncasecmp(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i32 16, i32 32
br label %17
15: ; preds = %4
%16 = tail call i32 @Q_strncasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 3)
br label %17
17: ; preds = %15, %11, %7, %1
%18 = phi i32 [ 1, %1 ], [ 8, %7 ], [ %14, %11 ], [ 1, %15 ]
ret i32 %18
}