#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 */
struct dirent {
  char *d_name;
};

/* Variables and functions */
scalar_t__ isdigit(char);
int dir_filter_dev(const struct dirent *d) {
  const char *n = d->d_name;
  char c;
  while ((c = *n++)) {
    if (isdigit(c))
      continue;
    if (c == '-')
      continue;
    if (c == '.' && n != d->d_name + 1)
      continue;
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<dir_filter_dev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%al
mov    %al,-0x19(%rbp)
cmp    $0x0,%al
je     11a3 <dir_filter_dev+0x93>
movsbl -0x19(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     115b <dir_filter_dev+0x4b>
jmp    1127 <dir_filter_dev+0x17>
movsbl -0x19(%rbp),%eax
cmp    $0x2d,%eax
jne    116d <dir_filter_dev+0x5d>
jmp    1127 <dir_filter_dev+0x17>
movsbl -0x19(%rbp),%eax
cmp    $0x2e,%eax
jne    1197 <dir_filter_dev+0x87>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
add    $0x1,%rcx
cmp    %rcx,%rax
je     1197 <dir_filter_dev+0x87>
jmp    1127 <dir_filter_dev+0x17>
movl   $0x0,-0x4(%rbp)
jmp    11aa <dir_filter_dev+0x9a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dir_filter_dev>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%rbx
mov    (%rbx),%bpl
test   %bpl,%bpl
je     1160 <dir_filter_dev+0x50>
mov    %rdi,%r14
jmp    113d <dir_filter_dev+0x2d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x1(%rbx),%ebp
add    $0x1,%rbx
test   %bpl,%bpl
je     1160 <dir_filter_dev+0x50>
movsbl %bpl,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1130 <dir_filter_dev+0x20>
cmp    $0x2d,%bpl
je     1130 <dir_filter_dev+0x20>
xor    %eax,%eax
cmp    $0x2e,%bpl
jne    1165 <dir_filter_dev+0x55>
cmp    (%r14),%rbx
jne    1130 <dir_filter_dev+0x20>
jmp    1165 <dir_filter_dev+0x55>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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