int valid_filename_ext(file)
char *file;
{
  char extbuf[5];
  int res = 0;
  int slen = strlen(file);
  int j;
  int i;
  if (slen < 6)
    return (0);
  if (file[slen - 4] == '.') {
    j = 0;
    for (i = slen - 3; i < slen; i++) {
      extbuf[j++] = file[i];
    }
    extbuf[j] = '\0';
    if ((strcmp(extbuf, "mch") == 0) || (strcmp(extbuf, "ref") == 0) ||
        (strcmp(extbuf, "imp") == 0) || (strcmp(extbuf, "prf") == 0) ||
        (strcmp(extbuf, "bse") == 0) || (strcmp(extbuf, "enm") == 0) ||
        (strcmp(extbuf, "itf") == 0) || (strcmp(extbuf, "ops") == 0) ||
        (strcmp(extbuf, "map") == 0) || (strcmp(extbuf, "doc") == 0))
      res = 1;
  }
  if (!res) {
    if (slen > 11) {
      i = slen - 1;
      while ((file[i] >= '0') && (file[i] <= '9')) {
        i--;
      }
      if ((i > 9) && (file[i] == '.') && (file[i - 1] == 'f') &&
          (file[i - 2] == 'r') && (file[i - 3] == 'p') &&
          (file[i - 4] == '.')) {
        j = 0;
        extbuf[j++] = file[i - 7];
        extbuf[j++] = file[i - 6];
        extbuf[j++] = file[i - 5];
        extbuf[j] = '\0';
        if ((strcmp(extbuf, "mch") == 0) || (strcmp(extbuf, "ref") == 0) ||
            (strcmp(extbuf, "imp") == 0))
          res = 1;
      }
    }
  }
  return (res);
}


x86 assembly (clang, -O0):
<valid_filename_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x6,-0x20(%rbp)
jge    1155 <valid_filename_ext+0x35>
movl   $0x0,-0x4(%rbp)
jmp    148f <valid_filename_ext+0x36f>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
sub    $0x4,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    12c4 <valid_filename_ext+0x1a4>
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11b5 <valid_filename_ext+0x95>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x24(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
cltq
mov    %cl,-0x15(%rbp,%rax,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    117f <valid_filename_ext+0x5f>
movslq -0x24(%rbp),%rax
movb   $0x0,-0x15(%rbp,%rax,1)
lea    -0x15(%rbp),%rdi
lea    0xe37(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <valid_filename_ext+0x198>
lea    -0x15(%rbp),%rdi
lea    0xe22(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <valid_filename_ext+0x198>
lea    -0x15(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <valid_filename_ext+0x198>
lea    -0x15(%rbp),%rdi
lea    0xdf8(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <valid_filename_ext+0x198>
lea    -0x15(%rbp),%rdi
lea    0xde3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <valid_filename_ext+0x198>
lea    -0x15(%rbp),%rdi
lea    0xdce(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <valid_filename_ext+0x198>
lea    -0x15(%rbp),%rdi
lea    0xdb9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <valid_filename_ext+0x198>
lea    -0x15(%rbp),%rdi
lea    0xda4(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <valid_filename_ext+0x198>
lea    -0x15(%rbp),%rdi
lea    0xd8f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     12b8 <valid_filename_ext+0x198>
lea    -0x15(%rbp),%rdi
lea    0xd7a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    12bf <valid_filename_ext+0x19f>
movl   $0x1,-0x1c(%rbp)
jmp    12c4 <valid_filename_ext+0x1a4>
cmpl   $0x0,-0x1c(%rbp)
jne    1489 <valid_filename_ext+0x369>
cmpl   $0xb,-0x20(%rbp)
jle    1484 <valid_filename_ext+0x364>
mov    -0x20(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x29(%rbp)
jl     1310 <valid_filename_ext+0x1f0>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1320 <valid_filename_ext+0x200>
jmp    132e <valid_filename_ext+0x20e>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    12e1 <valid_filename_ext+0x1c1>
cmpl   $0x9,-0x28(%rbp)
jle    147f <valid_filename_ext+0x35f>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    147f <valid_filename_ext+0x35f>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x66,%eax
jne    147f <valid_filename_ext+0x35f>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x72,%eax
jne    147f <valid_filename_ext+0x35f>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x70,%eax
jne    147f <valid_filename_ext+0x35f>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x4,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    147f <valid_filename_ext+0x35f>
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x7,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x24(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
cltq
mov    %cl,-0x15(%rbp,%rax,1)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x6,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x24(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
cltq
mov    %cl,-0x15(%rbp,%rax,1)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
sub    $0x5,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x24(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
cltq
mov    %cl,-0x15(%rbp,%rax,1)
movslq -0x24(%rbp),%rax
movb   $0x0,-0x15(%rbp,%rax,1)
lea    -0x15(%rbp),%rdi
lea    0xbcd(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     1473 <valid_filename_ext+0x353>
lea    -0x15(%rbp),%rdi
lea    0xbb8(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     1473 <valid_filename_ext+0x353>
lea    -0x15(%rbp),%rdi
lea    0xba3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    147a <valid_filename_ext+0x35a>
movl   $0x1,-0x1c(%rbp)
jmp    147f <valid_filename_ext+0x35f>
jmp    1484 <valid_filename_ext+0x364>
jmp    1489 <valid_filename_ext+0x369>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_filename_ext>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x6,%ecx
jl     12d5 <valid_filename_ext+0x1c5>
mov    $0xfffffffc,%r8d
lea    (%rcx,%r8,1),%eax
cmpb   $0x2e,(%rbx,%rax,1)
jne    11fb <valid_filename_ext+0xeb>
lea    -0x3(%rcx),%eax
cltq
mov    0x2(%rbx,%rax,1),%dl
mov    %dl,0xc(%rsp)
movzwl (%rbx,%rax,1),%edx
mov    %dx,0xa(%rsp)
movslq %ecx,%rdx
add    $0x1,%rax
xor    %esi,%esi
cmp    %rdx,%rax
setl   %sil
movb   $0x0,0xb(%rsp,%rsi,2)
mov    $0x1,%eax
cmpl   $0x68636d,0xa(%rsp)
je     12d5 <valid_filename_ext+0x1c5>
cmpl   $0x666572,0xa(%rsp)
je     12d5 <valid_filename_ext+0x1c5>
cmpl   $0x706d69,0xa(%rsp)
je     12d5 <valid_filename_ext+0x1c5>
cmpl   $0x667270,0xa(%rsp)
je     12d5 <valid_filename_ext+0x1c5>
cmpl   $0x657362,0xa(%rsp)
je     12d5 <valid_filename_ext+0x1c5>
cmpl   $0x6d6e65,0xa(%rsp)
je     12d5 <valid_filename_ext+0x1c5>
cmpl   $0x667469,0xa(%rsp)
je     12d5 <valid_filename_ext+0x1c5>
cmpl   $0x73706f,0xa(%rsp)
je     12d5 <valid_filename_ext+0x1c5>
cmpl   $0x70616d,0xa(%rsp)
je     12d5 <valid_filename_ext+0x1c5>
cmpl   $0x636f64,0xa(%rsp)
je     12d5 <valid_filename_ext+0x1c5>
mov    $0x0,%eax
cmp    $0xc,%ecx
jb     12d5 <valid_filename_ext+0x1c5>
movslq %ecx,%rax
add    %rbx,%rax
add    $0xffffffffffffffff,%rax
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rax,%rsi,1),%edi
lea    -0x30(%rdi),%edx
add    $0xffffffffffffffff,%rsi
cmp    $0xa,%dl
jb     1220 <valid_filename_ext+0x110>
lea    (%rcx,%rsi,1),%edx
add    $0x1,%edx
xor    %eax,%eax
cmp    $0xb,%edx
jl     12d5 <valid_filename_ext+0x1c5>
cmp    $0x2e,%dil
jne    12d5 <valid_filename_ext+0x1c5>
lea    (%rcx,%r8,1),%edx
add    %esi,%edx
add    $0x3,%edx
cmpb   $0x66,(%rbx,%rdx,1)
jne    12d5 <valid_filename_ext+0x1c5>
lea    (%rcx,%r8,1),%edx
add    %esi,%edx
add    $0x2,%edx
cmpb   $0x72,(%rbx,%rdx,1)
jne    12d5 <valid_filename_ext+0x1c5>
lea    (%r8,%rcx,1),%edx
add    %esi,%edx
add    $0x1,%edx
cmpb   $0x70,(%rbx,%rdx,1)
jne    12d5 <valid_filename_ext+0x1c5>
lea    (%rcx,%r8,1),%edx
add    %esi,%edx
cmpb   $0x2e,(%rbx,%rdx,1)
jne    12d5 <valid_filename_ext+0x1c5>
add    %ecx,%r8d
lea    (%rsi,%r8,1),%ecx
add    $0xfffffffd,%ecx
mov    (%rbx,%rcx,1),%cl
mov    %cl,0xa(%rsp)
lea    -0x2(%rsi,%r8,1),%ecx
mov    (%rbx,%rcx,1),%cl
mov    %cl,0xb(%rsp)
lea    -0x1(%rsi,%r8,1),%ecx
mov    (%rbx,%rcx,1),%cl
mov    %cl,0xc(%rsp)
movb   $0x0,0xd(%rsp)
cmpl   $0x68636d,0xa(%rsp)
je     12d0 <valid_filename_ext+0x1c0>
cmpl   $0x666572,0xa(%rsp)
je     12d0 <valid_filename_ext+0x1c0>
cmpl   $0x706d69,0xa(%rsp)
jne    12d5 <valid_filename_ext+0x1c5>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"mch\00"
@.str.1 = [4 x i8] c"ref\00"
@.str.2 = [4 x i8] c"imp\00"
@.str.3 = [4 x i8] c"prf\00"
@.str.4 = [4 x i8] c"bse\00"
@.str.5 = [4 x i8] c"enm\00"
@.str.6 = [4 x i8] c"itf\00"
@.str.7 = [4 x i8] c"ops\00"
@.str.8 = [4 x i8] c"map\00"
@.str.9 = [4 x i8] c"doc\00"
define i32 @valid_filename_ext(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [5 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %5
%9 = load i8*, i8** %3
%10 = call i64 @strlen(i8* %9)
%11 = trunc i64 %10 to i32
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 6
br i1 %13, label %14, label %15
14: ; preds = %1
store i32 0, i32* %2
br label %217
15: ; preds = %1
%16 = load i8*, i8** %3
%17 = load i32, i32* %6
%18 = sub nsw i32 %17, 4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %16, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 46
br i1 %23, label %24, label %89
24: ; preds = %15
store i32 0, i32* %7
%25 = load i32, i32* %6
%26 = sub nsw i32 %25, 3
store i32 %26, i32* %8
br label %27
27: ; preds = %41, %24
%28 = load i32, i32* %8
%29 = load i32, i32* %6
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %44
31: ; preds = %27
%32 = load i8*, i8** %3
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
%39 = sext i32 %37 to i64
%40 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 %39
store i8 %36, i8* %40
br label %41
41: ; preds = %31
%42 = load i32, i32* %8
%43 = add nsw i32 %42, 1
store i32 %43, i32* %8
br label %27
44: ; preds = %27
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 %46
store i8 0, i8* %47
%48 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%49 = call i32 @strcmp(i8* %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%50 = icmp eq i32 %49, 0
br i1 %50, label %87, label %51
51: ; preds = %44
%52 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%53 = call i32 @strcmp(i8* %52, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%54 = icmp eq i32 %53, 0
br i1 %54, label %87, label %55
55: ; preds = %51
%56 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%57 = call i32 @strcmp(i8* %56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%58 = icmp eq i32 %57, 0
br i1 %58, label %87, label %59
59: ; preds = %55
%60 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%61 = call i32 @strcmp(i8* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%62 = icmp eq i32 %61, 0
br i1 %62, label %87, label %63
63: ; preds = %59
%64 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%65 = call i32 @strcmp(i8* %64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%66 = icmp eq i32 %65, 0
br i1 %66, label %87, label %67
67: ; preds = %63
%68 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%69 = call i32 @strcmp(i8* %68, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%70 = icmp eq i32 %69, 0
br i1 %70, label %87, label %71
71: ; preds = %67
%72 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%73 = call i32 @strcmp(i8* %72, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%74 = icmp eq i32 %73, 0
br i1 %74, label %87, label %75
75: ; preds = %71
%76 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%77 = call i32 @strcmp(i8* %76, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%78 = icmp eq i32 %77, 0
br i1 %78, label %87, label %79
79: ; preds = %75
%80 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%81 = call i32 @strcmp(i8* %80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%82 = icmp eq i32 %81, 0
br i1 %82, label %87, label %83
83: ; preds = %79
%84 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%85 = call i32 @strcmp(i8* %84, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%86 = icmp eq i32 %85, 0
br i1 %86, label %87, label %88
87: ; preds = %83, %79, %75, %71, %67, %63, %59, %55, %51, %44
store i32 1, i32* %5
br label %88
88: ; preds = %87, %83
br label %89
89: ; preds = %88, %15
%90 = load i32, i32* %5
%91 = icmp ne i32 %90, 0
br i1 %91, label %215, label %92
92: ; preds = %89
%93 = load i32, i32* %6
%94 = icmp sgt i32 %93, 11
br i1 %94, label %95, label %214
95: ; preds = %92
%96 = load i32, i32* %6
%97 = sub nsw i32 %96, 1
store i32 %97, i32* %8
br label %98
98: ; preds = %116, %95
%99 = load i8*, i8** %3
%100 = load i32, i32* %8
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8, i8* %99, i64 %101
%103 = load i8, i8* %102
%104 = sext i8 %103 to i32
%105 = icmp sge i32 %104, 48
br i1 %105, label %106, label %114
106: ; preds = %98
%107 = load i8*, i8** %3
%108 = load i32, i32* %8
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8, i8* %107, i64 %109
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = icmp sle i32 %112, 57
br label %114
114: ; preds = %106, %98
%115 = phi i1 [ false, %98 ], [ %113, %106 ]
br i1 %115, label %116, label %119
116: ; preds = %114
%117 = load i32, i32* %8
%118 = add nsw i32 %117, -1
store i32 %118, i32* %8
br label %98
119: ; preds = %114
%120 = load i32, i32* %8
%121 = icmp sgt i32 %120, 9
br i1 %121, label %122, label %213
122: ; preds = %119
%123 = load i8*, i8** %3
%124 = load i32, i32* %8
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i8, i8* %123, i64 %125
%127 = load i8, i8* %126
%128 = sext i8 %127 to i32
%129 = icmp eq i32 %128, 46
br i1 %129, label %130, label %213
130: ; preds = %122
%131 = load i8*, i8** %3
%132 = load i32, i32* %8
%133 = sub nsw i32 %132, 1
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds i8, i8* %131, i64 %134
%136 = load i8, i8* %135
%137 = sext i8 %136 to i32
%138 = icmp eq i32 %137, 102
br i1 %138, label %139, label %213
139: ; preds = %130
%140 = load i8*, i8** %3
%141 = load i32, i32* %8
%142 = sub nsw i32 %141, 2
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8, i8* %140, i64 %143
%145 = load i8, i8* %144
%146 = sext i8 %145 to i32
%147 = icmp eq i32 %146, 114
br i1 %147, label %148, label %213
148: ; preds = %139
%149 = load i8*, i8** %3
%150 = load i32, i32* %8
%151 = sub nsw i32 %150, 3
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i8, i8* %149, i64 %152
%154 = load i8, i8* %153
%155 = sext i8 %154 to i32
%156 = icmp eq i32 %155, 112
br i1 %156, label %157, label %213
157: ; preds = %148
%158 = load i8*, i8** %3
%159 = load i32, i32* %8
%160 = sub nsw i32 %159, 4
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds i8, i8* %158, i64 %161
%163 = load i8, i8* %162
%164 = sext i8 %163 to i32
%165 = icmp eq i32 %164, 46
br i1 %165, label %166, label %213
166: ; preds = %157
store i32 0, i32* %7
%167 = load i8*, i8** %3
%168 = load i32, i32* %8
%169 = sub nsw i32 %168, 7
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds i8, i8* %167, i64 %170
%172 = load i8, i8* %171
%173 = load i32, i32* %7
%174 = add nsw i32 %173, 1
store i32 %174, i32* %7
%175 = sext i32 %173 to i64
%176 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 %175
store i8 %172, i8* %176
%177 = load i8*, i8** %3
%178 = load i32, i32* %8
%179 = sub nsw i32 %178, 6
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds i8, i8* %177, i64 %180
%182 = load i8, i8* %181
%183 = load i32, i32* %7
%184 = add nsw i32 %183, 1
store i32 %184, i32* %7
%185 = sext i32 %183 to i64
%186 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 %185
store i8 %182, i8* %186
%187 = load i8*, i8** %3
%188 = load i32, i32* %8
%189 = sub nsw i32 %188, 5
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds i8, i8* %187, i64 %190
%192 = load i8, i8* %191
%193 = load i32, i32* %7
%194 = add nsw i32 %193, 1
store i32 %194, i32* %7
%195 = sext i32 %193 to i64
%196 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 %195
store i8 %192, i8* %196
%197 = load i32, i32* %7
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 %198
store i8 0, i8* %199
%200 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%201 = call i32 @strcmp(i8* %200, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%202 = icmp eq i32 %201, 0
br i1 %202, label %211, label %203
203: ; preds = %166
%204 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%205 = call i32 @strcmp(i8* %204, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%206 = icmp eq i32 %205, 0
br i1 %206, label %211, label %207
207: ; preds = %203
%208 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%209 = call i32 @strcmp(i8* %208, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%210 = icmp eq i32 %209, 0
br i1 %210, label %211, label %212
211: ; preds = %207, %203, %166
store i32 1, i32* %5
br label %212
212: ; preds = %211, %207
br label %213
213: ; preds = %212, %157, %148, %139, %130, %122, %119
br label %214
214: ; preds = %213, %92
br label %215
215: ; preds = %214, %89
%216 = load i32, i32* %5
store i32 %216, i32* %2
br label %217
217: ; preds = %215, %14
%218 = load i32, i32* %2
ret i32 %218
}

LLVM IR (-O2):
@.str = [4 x i8] c"mch\00"
@.str.1 = [4 x i8] c"ref\00"
@.str.2 = [4 x i8] c"imp\00"
@.str.3 = [4 x i8] c"prf\00"
@.str.4 = [4 x i8] c"bse\00"
@.str.5 = [4 x i8] c"enm\00"
@.str.6 = [4 x i8] c"itf\00"
@.str.7 = [4 x i8] c"ops\00"
@.str.8 = [4 x i8] c"map\00"
@.str.9 = [4 x i8] c"doc\00"
define i32 @valid_filename_ext(i8* nocapture %0) {
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = trunc i64 %5 to i32
%7 = icmp slt i32 %6, 6
br i1 %7, label %120, label %8
8: ; preds = %1
%9 = add i64 %5, 4294967292
%10 = and i64 %9, 4294967295
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 46
br i1 %13, label %14, label %54
14: ; preds = %8
%15 = shl i64 %5, 32
%16 = add i64 %15, -12884901888
%17 = ashr exact i64 %16, 32
%18 = getelementptr i8, i8* %0, i64 %17
%19 = shl i64 %5, 32
%20 = ashr exact i64 %19, 32
%21 = add nsw i64 %17, 1
%22 = icmp slt i64 %21, %20
%23 = select i1 %22, i64 3, i64 1
%24 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 %23
store i8 0, i8* %24
%25 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 4)
%26 = icmp eq i32 %25, 0
br i1 %26, label %120, label %27
27: ; preds = %14
%28 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 4)
%29 = icmp eq i32 %28, 0
br i1 %29, label %120, label %30
30: ; preds = %27
%31 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 4)
%32 = icmp eq i32 %31, 0
br i1 %32, label %120, label %33
33: ; preds = %30
%34 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 4)
%35 = icmp eq i32 %34, 0
br i1 %35, label %120, label %36
36: ; preds = %33
%37 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64 4)
%38 = icmp eq i32 %37, 0
br i1 %38, label %120, label %39
39: ; preds = %36
%40 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i64 4)
%41 = icmp eq i32 %40, 0
br i1 %41, label %120, label %42
42: ; preds = %39
%43 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 4)
%44 = icmp eq i32 %43, 0
br i1 %44, label %120, label %45
45: ; preds = %42
%46 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64 4)
%47 = icmp eq i32 %46, 0
br i1 %47, label %120, label %48
48: ; preds = %45
%49 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i64 4)
%50 = icmp eq i32 %49, 0
br i1 %50, label %120, label %51
51: ; preds = %48
%52 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i64 4)
%53 = icmp eq i32 %52, 0
br i1 %53, label %120, label %54
54: ; preds = %51, %8
%55 = icmp ugt i32 %6, 11
br i1 %55, label %56, label %120
56: ; preds = %54
%57 = shl i64 %5, 32
%58 = ashr exact i64 %57, 32
br label %59
59: ; preds = %56, %59
%60 = phi i64 [ %58, %56 ], [ %61, %59 ]
%61 = add nsw i64 %60, -1
%62 = getelementptr inbounds i8, i8* %0, i64 %61
%63 = load i8, i8* %62
%64 = add i8 %63, -48
%65 = icmp ult i8 %64, 10
br i1 %65, label %59, label %66
66: ; preds = %59
%67 = trunc i64 %60 to i32
%68 = icmp sgt i32 %67, 10
%69 = icmp eq i8 %63, 46
%70 = select i1 %68, i1 %69, i1 false
br i1 %70, label %71, label %120
71: ; preds = %66
%72 = add i64 %60, 4294967294
%73 = and i64 %72, 4294967295
%74 = getelementptr inbounds i8, i8* %0, i64 %73
%75 = load i8, i8* %74
%76 = icmp eq i8 %75, 102
br i1 %76, label %77, label %120
77: ; preds = %71
%78 = add i64 %60, 4294967293
%79 = and i64 %78, 4294967295
%80 = getelementptr inbounds i8, i8* %0, i64 %79
%81 = load i8, i8* %80
%82 = icmp eq i8 %81, 114
br i1 %82, label %83, label %120
83: ; preds = %77
%84 = add i64 %60, 4294967292
%85 = and i64 %84, 4294967295
%86 = getelementptr inbounds i8, i8* %0, i64 %85
%87 = load i8, i8* %86
%88 = icmp eq i8 %87, 112
br i1 %88, label %89, label %120
89: ; preds = %83
%90 = add i64 %60, 4294967291
%91 = and i64 %90, 4294967295
%92 = getelementptr inbounds i8, i8* %0, i64 %91
%93 = load i8, i8* %92
%94 = icmp eq i8 %93, 46
br i1 %94, label %95, label %120
95: ; preds = %89
%96 = add i64 %60, 4294967288
%97 = and i64 %96, 4294967295
%98 = getelementptr inbounds i8, i8* %0, i64 %97
%99 = load i8, i8* %98
store i8 %99, i8* %4
%100 = add i64 %60, 4294967289
%101 = and i64 %100, 4294967295
%102 = getelementptr inbounds i8, i8* %0, i64 %101
%103 = load i8, i8* %102
%104 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 1
store i8 %103, i8* %104
%105 = add i64 %60, 4294967290
%106 = and i64 %105, 4294967295
%107 = getelementptr inbounds i8, i8* %0, i64 %106
%108 = load i8, i8* %107
%109 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 2
store i8 %108, i8* %109
%110 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 3
store i8 0, i8* %110
%111 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 4)
%112 = icmp eq i32 %111, 0
br i1 %112, label %119, label %113
113: ; preds = %95
%114 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 4)
%115 = icmp eq i32 %114, 0
br i1 %115, label %119, label %116
116: ; preds = %113
%117 = call i32 @bcmp(i8* dereferenceable(4) %4, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 4)
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %120
119: ; preds = %116, %113, %95
br label %120
120: ; preds = %51, %48, %45, %42, %39, %36, %33, %30, %27, %14, %54, %66, %71, %77, %83, %89, %119, %116, %1
%121 = phi i32 [ 0, %1 ], [ 1, %119 ], [ 0, %116 ], [ 0, %89 ], [ 0, %83 ], [ 0, %77 ], [ 0, %71 ], [ 0, %66 ], [ 0, %54 ], [ 1, %14 ], [ 1, %27 ], [ 1, %30 ], [ 1, %33 ], [ 1, %36 ], [ 1, %39 ], [ 1, %42 ], [ 1, %45 ], [ 1, %48 ], [ 1, %51 ]
ret i32 %121
}