#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 */
scalar_t__ strncmp(char const *, char *, int);
char extract_prefix(const char *path) {
  int off = (*path == 'l' || *path == 'g' || *path == 'd') ? 1 : 0;
  if (strncmp(path + off, "f.", 2) == 0)
    return 'f';
  if (strncmp(path + off, "v.", 2) == 0)
    return 'v';
  if (strncmp(path + off, "w.", 2) == 0)
    return 'w';
  if (strncmp(path + off, "fld.", 4) == 0)
    return 'f';
  if (strncmp(path + off, "var.", 4) == 0)
    return 'v';
  if (strncmp(path + off, "field.", 4) == 0)
    return 'f';
  if (strncmp(path + off, "variable.", 9) == 0)
    return 'v';
  return 0;
}


x86 assembly (clang, -O0):
<extract_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x6c,%ecx
mov    %al,-0x15(%rbp)
je     1156 <extract_prefix+0x46>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x67,%ecx
mov    %al,-0x15(%rbp)
je     1156 <extract_prefix+0x46>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x64,%eax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xe85(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1198 <extract_prefix+0x88>
movb   $0x66,-0x1(%rbp)
jmp    12b6 <extract_prefix+0x1a6>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xe59(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11c7 <extract_prefix+0xb7>
movb   $0x76,-0x1(%rbp)
jmp    12b6 <extract_prefix+0x1a6>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xe2d(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11f6 <extract_prefix+0xe6>
movb   $0x77,-0x1(%rbp)
jmp    12b6 <extract_prefix+0x1a6>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xe01(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1225 <extract_prefix+0x115>
movb   $0x66,-0x1(%rbp)
jmp    12b6 <extract_prefix+0x1a6>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xdd7(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1254 <extract_prefix+0x144>
movb   $0x76,-0x1(%rbp)
jmp    12b6 <extract_prefix+0x1a6>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xdad(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1283 <extract_prefix+0x173>
movb   $0x66,-0x1(%rbp)
jmp    12b6 <extract_prefix+0x1a6>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xd85(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    12b2 <extract_prefix+0x1a2>
movb   $0x76,-0x1(%rbp)
jmp    12b6 <extract_prefix+0x1a6>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_prefix>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%cl
mov    $0x1,%eax
cmp    $0x67,%cl
je     112f <extract_prefix+0x1f>
cmp    $0x6c,%cl
je     112f <extract_prefix+0x1f>
xor    %eax,%eax
cmp    $0x64,%cl
sete   %al
add    %rax,%rbx
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f9 <extract_prefix+0xe9>
lea    0xead(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
mov    $0x76,%bpl
test   %rax,%rax
je     1201 <extract_prefix+0xf1>
lea    0xe90(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11fe <extract_prefix+0xee>
lea    0xe7a(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f9 <extract_prefix+0xe9>
lea    0xe66(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1201 <extract_prefix+0xf1>
lea    0xe52(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
mov    $0x66,%bpl
test   %rax,%rax
je     1201 <extract_prefix+0xf1>
lea    0xe3d(%rip),%rsi
mov    %rbx,%rdi
mov    $0x9,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
mov    $0x76,%ebp
cmovne %ecx,%ebp
jmp    1201 <extract_prefix+0xf1>
mov    $0x66,%bpl
jmp    1201 <extract_prefix+0xf1>
mov    $0x77,%bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"f.\00"
@.str.1 = [3 x i8] c"v.\00"
@.str.2 = [3 x i8] c"w.\00"
@.str.3 = [5 x i8] c"fld.\00"
@.str.4 = [5 x i8] c"var.\00"
@.str.5 = [7 x i8] c"field.\00"
@.str.6 = [10 x i8] c"variable.\00"
define signext i8 @extract_prefix(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 108
br i1 %8, label %19, label %9
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 103
br i1 %13, label %19, label %14
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 100
br label %19
19: ; preds = %14, %9, %1
%20 = phi i1 [ true, %9 ], [ true, %1 ], [ %18, %14 ]
%21 = zext i1 %20 to i64
%22 = select i1 %20, i32 1, i32 0
store i32 %22, i32* %4
%23 = load i8*, i8** %3
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = call i64 @strncmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %19
store i8 102, i8* %2
br label %79
30: ; preds = %19
%31 = load i8*, i8** %3
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = call i64 @strncmp(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %30
store i8 118, i8* %2
br label %79
38: ; preds = %30
%39 = load i8*, i8** %3
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
%43 = call i64 @strncmp(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %38
store i8 119, i8* %2
br label %79
46: ; preds = %38
%47 = load i8*, i8** %3
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %47, i64 %49
%51 = call i64 @strncmp(i8* %50, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %46
store i8 102, i8* %2
br label %79
54: ; preds = %46
%55 = load i8*, i8** %3
%56 = load i32, i32* %4
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = call i64 @strncmp(i8* %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %62
61: ; preds = %54
store i8 118, i8* %2
br label %79
62: ; preds = %54
%63 = load i8*, i8** %3
%64 = load i32, i32* %4
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %63, i64 %65
%67 = call i64 @strncmp(i8* %66, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 4)
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %70
69: ; preds = %62
store i8 102, i8* %2
br label %79
70: ; preds = %62
%71 = load i8*, i8** %3
%72 = load i32, i32* %4
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %71, i64 %73
%75 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 9)
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %78
77: ; preds = %70
store i8 118, i8* %2
br label %79
78: ; preds = %70
store i8 0, i8* %2
br label %79
79: ; preds = %78, %77, %69, %61, %53, %45, %37, %29
%80 = load i8, i8* %2
ret i8 %80
}

LLVM IR (-O2):
@.str = [3 x i8] c"f.\00"
@.str.1 = [3 x i8] c"v.\00"
@.str.2 = [3 x i8] c"w.\00"
@.str.3 = [5 x i8] c"fld.\00"
@.str.4 = [5 x i8] c"var.\00"
@.str.5 = [7 x i8] c"field.\00"
@.str.6 = [10 x i8] c"variable.\00"
define signext i8 @extract_prefix(i8* %0) {
%2 = load i8, i8* %0
switch i8 %2, label %3 [
i8 108, label %6
i8 103, label %6
]
3: ; preds = %1
%4 = icmp eq i8 %2, 100
%5 = zext i1 %4 to i64
br label %6
6: ; preds = %1, %1, %3
%7 = phi i64 [ 1, %1 ], [ %5, %3 ], [ 1, %1 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = tail call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%10 = icmp eq i64 %9, 0
br i1 %10, label %30, label %11
11: ; preds = %6
%12 = tail call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %30, label %14
14: ; preds = %11
%15 = tail call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%16 = icmp eq i64 %15, 0
br i1 %16, label %30, label %17
17: ; preds = %14
%18 = tail call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%19 = icmp eq i64 %18, 0
br i1 %19, label %30, label %20
20: ; preds = %17
%21 = tail call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%22 = icmp eq i64 %21, 0
br i1 %22, label %30, label %23
23: ; preds = %20
%24 = tail call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 4)
%25 = icmp eq i64 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = tail call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 9)
%28 = icmp eq i64 %27, 0
%29 = select i1 %28, i8 118, i8 0
br label %30
30: ; preds = %26, %23, %20, %17, %14, %11, %6
%31 = phi i8 [ 102, %6 ], [ 118, %11 ], [ 119, %14 ], [ 102, %17 ], [ 118, %20 ], [ 102, %23 ], [ %29, %26 ]
ret i8 %31
}