#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*/ strncmp(char const *, char const *, int);
const char *extract_mimemajor(const char *token) {
  const char *lookfor;
  if ((lookfor = "application", !strncmp(token, lookfor, 11)) ||
      (lookfor = "audio", !strncmp(token, lookfor, 5)) ||
      (lookfor = "font", !strncmp(token, lookfor, 4)) ||
      (lookfor = "example", !strncmp(token, lookfor, 7)) ||
      (lookfor = "image", !strncmp(token, lookfor, 5)) ||
      (lookfor = "message", !strncmp(token, lookfor, 7)) ||
      (lookfor = "model", !strncmp(token, lookfor, 5)) ||
      (lookfor = "multipart", !strncmp(token, lookfor, 9)) ||
      (lookfor = "text", !strncmp(token, lookfor, 4)) ||
      (lookfor = "video", !strncmp(token, lookfor, 5)))
    return lookfor;
  return NULL;
}


x86 assembly (clang, -O0):
<extract_mimemajor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xedd(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0xb,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12e3 <extract_mimemajor+0x1d3>
lea    0xebc(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12e3 <extract_mimemajor+0x1d3>
lea    0xe95(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12e3 <extract_mimemajor+0x1d3>
lea    0xe6d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12e3 <extract_mimemajor+0x1d3>
lea    0xe48(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12e3 <extract_mimemajor+0x1d3>
lea    0xe21(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12e3 <extract_mimemajor+0x1d3>
lea    0xdfc(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12e3 <extract_mimemajor+0x1d3>
lea    0xdd5(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12e3 <extract_mimemajor+0x1d3>
lea    0xdb2(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12e3 <extract_mimemajor+0x1d3>
lea    0xd8a(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12e3 <extract_mimemajor+0x1d3>
jmp    12f0 <extract_mimemajor+0x1e0>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12f8 <extract_mimemajor+0x1e8>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_mimemajor>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0xee1(%rip),%rbx
mov    %rbx,%rsi
mov    $0xb,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     123b <extract_mimemajor+0x12b>
lea    0xed1(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     123b <extract_mimemajor+0x12b>
lea    0xeb8(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     123b <extract_mimemajor+0x12b>
lea    0xe9e(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     123b <extract_mimemajor+0x12b>
lea    0xe87(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     123b <extract_mimemajor+0x12b>
lea    0xe6e(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     123b <extract_mimemajor+0x12b>
lea    0xe5b(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     123b <extract_mimemajor+0x12b>
lea    0xe46(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     123b <extract_mimemajor+0x12b>
lea    0xe35(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     123b <extract_mimemajor+0x12b>
lea    0xe1f(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
cmove  %r15,%rbx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"application\00"
@.str.1 = [6 x i8] c"audio\00"
@.str.2 = [5 x i8] c"font\00"
@.str.3 = [8 x i8] c"example\00"
@.str.4 = [6 x i8] c"image\00"
@.str.5 = [8 x i8] c"message\00"
@.str.6 = [6 x i8] c"model\00"
@.str.7 = [10 x i8] c"multipart\00"
@.str.8 = [5 x i8] c"text\00"
@.str.9 = [6 x i8] c"video\00"
define i8* @extract_mimemajor(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @strncmp(i8* %5, i8* %6, i32 11)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %64, label %10
10: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %4
%11 = load i8*, i8** %3
%12 = load i8*, i8** %4
%13 = call i32 @strncmp(i8* %11, i8* %12, i32 5)
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
br i1 %15, label %64, label %16
16: ; preds = %10
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %4
%17 = load i8*, i8** %3
%18 = load i8*, i8** %4
%19 = call i32 @strncmp(i8* %17, i8* %18, i32 4)
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
br i1 %21, label %64, label %22
22: ; preds = %16
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %4
%23 = load i8*, i8** %3
%24 = load i8*, i8** %4
%25 = call i32 @strncmp(i8* %23, i8* %24, i32 7)
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
br i1 %27, label %64, label %28
28: ; preds = %22
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %4
%29 = load i8*, i8** %3
%30 = load i8*, i8** %4
%31 = call i32 @strncmp(i8* %29, i8* %30, i32 5)
%32 = icmp ne i32 %31, 0
%33 = xor i1 %32, true
br i1 %33, label %64, label %34
34: ; preds = %28
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8** %4
%35 = load i8*, i8** %3
%36 = load i8*, i8** %4
%37 = call i32 @strncmp(i8* %35, i8* %36, i32 7)
%38 = icmp ne i32 %37, 0
%39 = xor i1 %38, true
br i1 %39, label %64, label %40
40: ; preds = %34
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8** %4
%41 = load i8*, i8** %3
%42 = load i8*, i8** %4
%43 = call i32 @strncmp(i8* %41, i8* %42, i32 5)
%44 = icmp ne i32 %43, 0
%45 = xor i1 %44, true
br i1 %45, label %64, label %46
46: ; preds = %40
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8** %4
%47 = load i8*, i8** %3
%48 = load i8*, i8** %4
%49 = call i32 @strncmp(i8* %47, i8* %48, i32 9)
%50 = icmp ne i32 %49, 0
%51 = xor i1 %50, true
br i1 %51, label %64, label %52
52: ; preds = %46
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8** %4
%53 = load i8*, i8** %3
%54 = load i8*, i8** %4
%55 = call i32 @strncmp(i8* %53, i8* %54, i32 4)
%56 = icmp ne i32 %55, 0
%57 = xor i1 %56, true
br i1 %57, label %64, label %58
58: ; preds = %52
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8** %4
%59 = load i8*, i8** %3
%60 = load i8*, i8** %4
%61 = call i32 @strncmp(i8* %59, i8* %60, i32 5)
%62 = icmp ne i32 %61, 0
%63 = xor i1 %62, true
br i1 %63, label %64, label %66
64: ; preds = %58, %52, %46, %40, %34, %28, %22, %16, %10, %1
%65 = load i8*, i8** %4
store i8* %65, i8** %2
br label %67
66: ; preds = %58
store i8* null, i8** %2
br label %67
67: ; preds = %66, %64
%68 = load i8*, i8** %2
ret i8* %68
}

LLVM IR (-O2):
@.str = [12 x i8] c"application\00"
@.str.1 = [6 x i8] c"audio\00"
@.str.2 = [5 x i8] c"font\00"
@.str.3 = [8 x i8] c"example\00"
@.str.4 = [6 x i8] c"image\00"
@.str.5 = [8 x i8] c"message\00"
@.str.6 = [6 x i8] c"model\00"
@.str.7 = [10 x i8] c"multipart\00"
@.str.8 = [5 x i8] c"text\00"
@.str.9 = [6 x i8] c"video\00"
define i8* @extract_mimemajor(i8* %0) {
%2 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 11)
%3 = icmp eq i32 %2, 0
br i1 %3, label %32, label %4
4: ; preds = %1
%5 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%6 = icmp eq i32 %5, 0
br i1 %6, label %32, label %7
7: ; preds = %4
%8 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%9 = icmp eq i32 %8, 0
br i1 %9, label %32, label %10
10: ; preds = %7
%11 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 7)
%12 = icmp eq i32 %11, 0
br i1 %12, label %32, label %13
13: ; preds = %10
%14 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 5)
%15 = icmp eq i32 %14, 0
br i1 %15, label %32, label %16
16: ; preds = %13
%17 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 7)
%18 = icmp eq i32 %17, 0
br i1 %18, label %32, label %19
19: ; preds = %16
%20 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 5)
%21 = icmp eq i32 %20, 0
br i1 %21, label %32, label %22
22: ; preds = %19
%23 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 9)
%24 = icmp eq i32 %23, 0
br i1 %24, label %32, label %25
25: ; preds = %22
%26 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
%27 = icmp eq i32 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %25
%29 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 5)
%30 = icmp eq i32 %29, 0
%31 = select i1 %30, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* null
br label %32
32: ; preds = %28, %1, %4, %7, %10, %13, %16, %19, %22, %25
%33 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %10 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %13 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), %16 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), %19 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), %22 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), %25 ], [ %31, %28 ]
ret i8* %33
}