#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);
int valid_mh_filename_p(const char *x) {
  const char *p;
  if (!*x)
    return 0;
  p = x;
  while (*p) {
    if (!isdigit(*p)) {
      if ((p[0] == '.') && (p[1] == 0))
        return 1;
      else
        return 0;
    }
    p++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<valid_mh_filename_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1135 <valid_mh_filename_p+0x25>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <valid_mh_filename_p+0xa0>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11a9 <valid_mh_filename_p+0x99>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1198 <valid_mh_filename_p+0x88>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    118c <valid_mh_filename_p+0x7c>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    118c <valid_mh_filename_p+0x7c>
movl   $0x1,-0x4(%rbp)
jmp    11b0 <valid_mh_filename_p+0xa0>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <valid_mh_filename_p+0xa0>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    113d <valid_mh_filename_p+0x2d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_mh_filename_p>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
xor    %ebp,%ebp
test   %al,%al
je     1159 <valid_mh_filename_p+0x49>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     114e <valid_mh_filename_p+0x3e>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <valid_mh_filename_p+0x20>
mov    $0x1,%ebp
jmp    1159 <valid_mh_filename_p+0x49>
cmpb   $0x2e,-0x1(%rbx)
jne    1159 <valid_mh_filename_p+0x49>
cmpb   $0x0,(%rbx)
je     1147 <valid_mh_filename_p+0x37>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @valid_mh_filename_p(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %1
store i32 0, i32* %2
br label %38
9: ; preds = %1
%10 = load i8*, i8** %3
store i8* %10, i8** %4
br label %11
11: ; preds = %34, %9
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %37
15: ; preds = %11
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = call i32 @isdigit(i8 signext %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %34, label %20
20: ; preds = %15
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 46
br i1 %25, label %26, label %33
26: ; preds = %20
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i64 1
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %26
store i32 1, i32* %2
br label %38
33: ; preds = %26, %20
store i32 0, i32* %2
br label %38
34: ; preds = %15
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %4
br label %11
37: ; preds = %11
store i32 1, i32* %2
br label %38
38: ; preds = %37, %33, %32, %8
%39 = load i32, i32* %2
ret i32 %39
}

LLVM IR (-O2):
define i32 @valid_mh_filename_p(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %21, label %4
4: ; preds = %1, %17
%5 = phi i8* [ %18, %17 ], [ %0, %1 ]
%6 = phi i8 [ %19, %17 ], [ %2, %1 ]
%7 = tail call i32 @isdigit(i8 signext %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %4
%10 = load i8, i8* %5
%11 = icmp eq i8 %10, 46
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = getelementptr inbounds i8, i8* %5, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %12, %9
br label %21
17: ; preds = %4
%18 = getelementptr inbounds i8, i8* %5, i64 1
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %4
21: ; preds = %17, %12, %1, %16
%22 = phi i32 [ 0, %16 ], [ 0, %1 ], [ 1, %12 ], [ 1, %17 ]
ret i32 %22
}