#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*/ isdigit(char const);
scalar_t__ strcmp(char const *, char *);
int wmqfile_iswmqfile(const char *filename) {
  int i;
  for (i = 0; i < 8; i++)
    if (!isdigit(filename[i]))
      return 0;
  if (filename[i] == '-') {
    i++;
    if (!isdigit(filename[i]))
      return 0;
    for (i++; i < 12; i++)
      if (!isdigit(filename[i]))
        break;
  }
  if (strcmp(filename + i, ".wmq"))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<wmqfile_iswmqfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    1176 <wmqfile_iswmqfile+0x56>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1163 <wmqfile_iswmqfile+0x43>
movl   $0x0,-0x4(%rbp)
jmp    1238 <wmqfile_iswmqfile+0x118>
jmp    1168 <wmqfile_iswmqfile+0x48>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <wmqfile_iswmqfile+0x13>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
jne    1204 <wmqfile_iswmqfile+0xe4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    11ba <wmqfile_iswmqfile+0x9a>
movl   $0x0,-0x4(%rbp)
jmp    1238 <wmqfile_iswmqfile+0x118>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xc,-0x14(%rbp)
jge    11ff <wmqfile_iswmqfile+0xdf>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    11ec <wmqfile_iswmqfile+0xcc>
jmp    11ff <wmqfile_iswmqfile+0xdf>
jmp    11f1 <wmqfile_iswmqfile+0xd1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c3 <wmqfile_iswmqfile+0xa3>
jmp    1204 <wmqfile_iswmqfile+0xe4>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xdea(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1231 <wmqfile_iswmqfile+0x111>
movl   $0x0,-0x4(%rbp)
jmp    1238 <wmqfile_iswmqfile+0x118>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wmqfile_iswmqfile>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <isdigit@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     11ff <wmqfile_iswmqfile+0xdf>
movsbl 0x1(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     11ff <wmqfile_iswmqfile+0xdf>
movsbl 0x2(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     11ff <wmqfile_iswmqfile+0xdf>
movsbl 0x3(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     11ff <wmqfile_iswmqfile+0xdf>
movsbl 0x4(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     11ff <wmqfile_iswmqfile+0xdf>
movsbl 0x5(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     11ff <wmqfile_iswmqfile+0xdf>
movsbl 0x6(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     11ff <wmqfile_iswmqfile+0xdf>
movsbl 0x7(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     11ff <wmqfile_iswmqfile+0xdf>
mov    $0x8,%eax
cmpb   $0x2d,0x8(%rbx)
jne    11e4 <wmqfile_iswmqfile+0xc4>
movsbl 0x9(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     11ff <wmqfile_iswmqfile+0xdf>
movsbl 0xa(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     11df <wmqfile_iswmqfile+0xbf>
movsbl 0xb(%rbx),%edi
call   1030 <isdigit@plt>
cmp    $0x1,%eax
mov    $0xc,%eax
sbb    $0x0,%rax
jmp    11e4 <wmqfile_iswmqfile+0xc4>
mov    $0xa,%eax
add    %rax,%rbx
lea    0xe12(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c".wmq\00"
define i32 @wmqfile_iswmqfile(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %18, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = call i32 @isdigit(i8 signext %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %8
store i32 0, i32* %2
br label %69
17: ; preds = %8
br label %18
18: ; preds = %17
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %5
21: ; preds = %5
%22 = load i8*, i8** %3
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 45
br i1 %28, label %29, label %60
29: ; preds = %21
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
%32 = load i8*, i8** %3
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = call i32 @isdigit(i8 signext %36)
%38 = icmp ne i32 %37, 0
br i1 %38, label %40, label %39
39: ; preds = %29
store i32 0, i32* %2
br label %69
40: ; preds = %29
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %43
43: ; preds = %56, %40
%44 = load i32, i32* %4
%45 = icmp slt i32 %44, 12
br i1 %45, label %46, label %59
46: ; preds = %43
%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 = load i8, i8* %50
%52 = call i32 @isdigit(i8 signext %51)
%53 = icmp ne i32 %52, 0
br i1 %53, label %55, label %54
54: ; preds = %46
br label %59
55: ; preds = %46
br label %56
56: ; preds = %55
%57 = load i32, i32* %4
%58 = add nsw i32 %57, 1
store i32 %58, i32* %4
br label %43
59: ; preds = %54, %43
br label %60
60: ; preds = %59, %21
%61 = load i8*, i8** %3
%62 = load i32, i32* %4
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %61, i64 %63
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%66 = icmp ne i64 %65, 0
br i1 %66, label %67, label %68
67: ; preds = %60
store i32 0, i32* %2
br label %69
68: ; preds = %60
store i32 1, i32* %2
br label %69
69: ; preds = %68, %67, %39, %16
%70 = load i32, i32* %2
ret i32 %70
}

LLVM IR (-O2):
@.str = [5 x i8] c".wmq\00"
define i32 @wmqfile_iswmqfile(i8* %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @isdigit(i8 signext %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %66, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = tail call i32 @isdigit(i8 signext %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %66, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = tail call i32 @isdigit(i8 signext %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %66, label %15
15: ; preds = %10
%16 = getelementptr inbounds i8, i8* %0, i64 3
%17 = load i8, i8* %16
%18 = tail call i32 @isdigit(i8 signext %17)
%19 = icmp eq i32 %18, 0
br i1 %19, label %66, label %20
20: ; preds = %15
%21 = getelementptr inbounds i8, i8* %0, i64 4
%22 = load i8, i8* %21
%23 = tail call i32 @isdigit(i8 signext %22)
%24 = icmp eq i32 %23, 0
br i1 %24, label %66, label %25
25: ; preds = %20
%26 = getelementptr inbounds i8, i8* %0, i64 5
%27 = load i8, i8* %26
%28 = tail call i32 @isdigit(i8 signext %27)
%29 = icmp eq i32 %28, 0
br i1 %29, label %66, label %30
30: ; preds = %25
%31 = getelementptr inbounds i8, i8* %0, i64 6
%32 = load i8, i8* %31
%33 = tail call i32 @isdigit(i8 signext %32)
%34 = icmp eq i32 %33, 0
br i1 %34, label %66, label %35
35: ; preds = %30
%36 = getelementptr inbounds i8, i8* %0, i64 7
%37 = load i8, i8* %36
%38 = tail call i32 @isdigit(i8 signext %37)
%39 = icmp eq i32 %38, 0
br i1 %39, label %66, label %40
40: ; preds = %35
%41 = getelementptr inbounds i8, i8* %0, i64 8
%42 = load i8, i8* %41
%43 = icmp eq i8 %42, 45
br i1 %43, label %44, label %60
44: ; preds = %40
%45 = getelementptr inbounds i8, i8* %0, i64 9
%46 = load i8, i8* %45
%47 = tail call i32 @isdigit(i8 signext %46)
%48 = icmp eq i32 %47, 0
br i1 %48, label %66, label %49
49: ; preds = %44
%50 = getelementptr inbounds i8, i8* %0, i64 10
%51 = load i8, i8* %50
%52 = tail call i32 @isdigit(i8 signext %51)
%53 = icmp eq i32 %52, 0
br i1 %53, label %60, label %54
54: ; preds = %49
%55 = getelementptr inbounds i8, i8* %0, i64 11
%56 = load i8, i8* %55
%57 = tail call i32 @isdigit(i8 signext %56)
%58 = icmp eq i32 %57, 0
%59 = select i1 %58, i64 11, i64 12
br label %60
60: ; preds = %54, %49, %40
%61 = phi i64 [ 8, %40 ], [ 10, %49 ], [ %59, %54 ]
%62 = getelementptr inbounds i8, i8* %0, i64 %61
%63 = tail call i64 @strcmp(i8* %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
%65 = zext i1 %64 to i32
br label %66
66: ; preds = %1, %5, %10, %15, %20, %25, %30, %35, %60, %44
%67 = phi i32 [ 0, %44 ], [ %65, %60 ], [ 0, %35 ], [ 0, %30 ], [ 0, %25 ], [ 0, %20 ], [ 0, %15 ], [ 0, %10 ], [ 0, %5 ], [ 0, %1 ]
ret i32 %67
}