#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__ isdigit(char const);
int /*<<< orphan*/ strncmp(char const *, char *, int);
int cmp_eventlink(const char *dirname, void *priv) {
  (void)priv;
  return (dirname &&
          ((!strncmp(dirname, "event", 5) && isdigit(dirname[5])) ||
           (!strncmp(dirname, "input:event", 11) && isdigit(dirname[11]))));
}


x86 assembly (clang, -O0):
<cmp_eventlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     11c5 <cmp_eventlink+0xa5>
mov    -0x8(%rbp),%rdi
lea    0xebb(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    117d <cmp_eventlink+0x5d>
mov    -0x8(%rbp),%rax
movsbl 0x5(%rax),%edi
call   1040 <isdigit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x12(%rbp)
jne    11bf <cmp_eventlink+0x9f>
mov    -0x8(%rbp),%rdi
lea    0xe78(%rip),%rsi
mov    $0xb,%edx
call   1030 <strncmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x13(%rbp)
jne    11b9 <cmp_eventlink+0x99>
mov    -0x8(%rbp),%rax
movsbl 0xb(%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x13(%rbp)
mov    -0x13(%rbp),%al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_eventlink>:
push   %rbx
xor    %eax,%eax
test   %rdi,%rdi
je     115f <cmp_eventlink+0x3f>
mov    %rdi,%rbx
lea    0xed4(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1161 <cmp_eventlink+0x41>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
mov    $0xb,%edx
call   1030 <strncmp@plt>
mov    %eax,%ecx
mov    $0x0,%eax
test   %ecx,%ecx
je     1179 <cmp_eventlink+0x59>
pop    %rbx
ret
movsbl 0x5(%rbx),%edi
call   1040 <isdigit@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    115f <cmp_eventlink+0x3f>
jmp    1140 <cmp_eventlink+0x20>
movsbl 0xb(%rbx),%edi
call   1040 <isdigit@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"event\00"
@.str.1 = [12 x i8] c"input:event\00"
define i32 @cmp_eventlink(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %32
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = call i32 @strncmp(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%11 = icmp ne i32 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 5
%15 = load i8, i8* %14
%16 = call i64 @isdigit(i8 signext %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %30, label %18
18: ; preds = %12, %8
%19 = load i8*, i8** %3
%20 = call i32 @strncmp(i8* %19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 11)
%21 = icmp ne i32 %20, 0
br i1 %21, label %28, label %22
22: ; preds = %18
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 11
%25 = load i8, i8* %24
%26 = call i64 @isdigit(i8 signext %25)
%27 = icmp ne i64 %26, 0
br label %28
28: ; preds = %22, %18
%29 = phi i1 [ false, %18 ], [ %27, %22 ]
br label %30
30: ; preds = %28, %12
%31 = phi i1 [ true, %12 ], [ %29, %28 ]
br label %32
32: ; preds = %30, %2
%33 = phi i1 [ false, %2 ], [ %31, %30 ]
%34 = zext i1 %33 to i32
ret i32 %34
}

LLVM IR (-O2):
@.str = [6 x i8] c"event\00"
@.str.1 = [12 x i8] c"input:event\00"
define i32 @cmp_eventlink(i8* %0, i8* nocapture readnone %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %21, label %4
4: ; preds = %2
%5 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %0, i64 5
%9 = load i8, i8* %8
%10 = tail call i64 @isdigit(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %7, %4
%13 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 11)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = getelementptr inbounds i8, i8* %0, i64 11
%17 = load i8, i8* %16
%18 = tail call i64 @isdigit(i8 signext %17)
%19 = icmp ne i64 %18, 0
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %7, %15, %12, %2
%22 = phi i32 [ 0, %2 ], [ 1, %7 ], [ 0, %12 ], [ %20, %15 ]
ret i32 %22
}