#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*/ die_(int, char *);
int /*<<< orphan*/ isdigit(char const);
scalar_t__ strncmp(char const *, char *, int);
const char *check(const char *p) {
  const char *q;
  if (strncmp(p, "event", 5) != 0)
    die_(182, ("strncmp"));
  for (q = p + 5; *q; q++)
    if (!isdigit(*q))
      die_(186, ("isdigit"));
  return p;
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     116c <check+0x3c>
mov    $0xb6,%edi
lea    0xe9f(%rip),%rsi
call   1050 <die_@plt>
mov    -0x8(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11c1 <check+0x91>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%eax
jne    11ab <check+0x7b>
mov    $0xba,%edi
lea    0xe68(%rip),%rsi
call   1050 <die_@plt>
jmp    11b0 <check+0x80>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1178 <check+0x48>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0xec1(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     115f <check+0x2f>
lea    0xeb1(%rip),%rsi
mov    $0xb6,%edi
call   1050 <die_@plt>
mov    0x5(%r14),%al
test   %al,%al
je     11a6 <check+0x76>
lea    0x6(%r14),%rbx
lea    0xe9c(%rip),%r15
jmp    118b <check+0x5b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11a6 <check+0x76>
movsbl %al,%edi
call   1040 <isdigit@plt>
test   %eax,%eax
jne    1180 <check+0x50>
mov    $0xba,%edi
mov    %r15,%rsi
call   1050 <die_@plt>
jmp    1180 <check+0x50>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

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