#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*/ getNumber(char const *, int, int, unsigned long *);
int shortNameMatchesSysV(const char *name) {
  const char *p;
  unsigned long ul;
  if (name[0] != '/')
    return -1;
  if (!(((name[1]) >= '0') && ((name[1]) <= '9')))
    return -1;
  for (p = name + 2; *p; p++) {
    if (!(((*p) >= '0') && ((*p) <= '9')))
      break;
  }
  while (*p) {
    if (*p++ != ' ')
      return -1;
  }
  if (!getNumber(name + 1, 10, -1, &ul))
    return -1;
  return ul;
}


x86 assembly (clang, -O0):
<shortNameMatchesSysV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1138 <shortNameMatchesSysV+0x28>
movl   $0xffffffff,-0x4(%rbp)
jmp    122f <shortNameMatchesSysV+0x11f>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x30,%eax
jl     115a <shortNameMatchesSysV+0x4a>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x39,%eax
jle    1166 <shortNameMatchesSysV+0x56>
movl   $0xffffffff,-0x4(%rbp)
jmp    122f <shortNameMatchesSysV+0x11f>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11ba <shortNameMatchesSysV+0xaa>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     119f <shortNameMatchesSysV+0x8f>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jle    11a4 <shortNameMatchesSysV+0x94>
jmp    11ba <shortNameMatchesSysV+0xaa>
jmp    11a9 <shortNameMatchesSysV+0x99>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1172 <shortNameMatchesSysV+0x62>
jmp    11bf <shortNameMatchesSysV+0xaf>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11f8 <shortNameMatchesSysV+0xe8>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
cmp    $0x20,%eax
je     11f3 <shortNameMatchesSysV+0xe3>
movl   $0xffffffff,-0x4(%rbp)
jmp    122f <shortNameMatchesSysV+0x11f>
jmp    11bf <shortNameMatchesSysV+0xaf>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    $0xa,%esi
mov    $0xffffffff,%edx
lea    -0x20(%rbp),%rcx
call   1030 <getNumber@plt>
cmp    $0x0,%eax
jne    1228 <shortNameMatchesSysV+0x118>
movl   $0xffffffff,-0x4(%rbp)
jmp    122f <shortNameMatchesSysV+0x11f>
mov    -0x20(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shortNameMatchesSysV>:
push   %rbx
sub    $0x10,%rsp
mov    $0xffffffff,%ebx
cmpb   $0x2f,(%rdi)
jne    1184 <shortNameMatchesSysV+0x74>
mov    0x1(%rdi),%al
add    $0xd0,%al
cmp    $0x9,%al
ja     1184 <shortNameMatchesSysV+0x74>
lea    0x1(%rdi),%rax
add    $0x2,%rdi
movzbl (%rdi),%ecx
lea    -0x30(%rcx),%edx
add    $0x1,%rdi
cmp    $0xa,%dl
jb     1130 <shortNameMatchesSysV+0x20>
jmp    115c <shortNameMatchesSysV+0x4c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0x20,%cl
jne    1184 <shortNameMatchesSysV+0x74>
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1150 <shortNameMatchesSysV+0x40>
mov    $0xffffffff,%ebx
lea    0x8(%rsp),%rcx
mov    %rax,%rdi
mov    $0xa,%esi
mov    $0xffffffff,%edx
call   1030 <getNumber@plt>
test   %eax,%eax
je     1184 <shortNameMatchesSysV+0x74>
mov    0x8(%rsp),%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @shortNameMatchesSysV(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 47
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 -1, i32* %2
br label %69
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp sge i32 %16, 48
br i1 %17, label %18, label %24
18: ; preds = %12
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 57
br i1 %23, label %25, label %24
24: ; preds = %18, %12
store i32 -1, i32* %2
br label %69
25: ; preds = %18
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 2
store i8* %27, i8** %4
br label %28
28: ; preds = %44, %25
%29 = load i8*, i8** %4
%30 = load i8, i8* %29
%31 = icmp ne i8 %30, 0
br i1 %31, label %32, label %47
32: ; preds = %28
%33 = load i8*, i8** %4
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp sge i32 %35, 48
br i1 %36, label %37, label %42
37: ; preds = %32
%38 = load i8*, i8** %4
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp sle i32 %40, 57
br i1 %41, label %43, label %42
42: ; preds = %37, %32
br label %47
43: ; preds = %37
br label %44
44: ; preds = %43
%45 = load i8*, i8** %4
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %4
br label %28
47: ; preds = %42, %28
br label %48
48: ; preds = %59, %47
%49 = load i8*, i8** %4
%50 = load i8, i8* %49
%51 = icmp ne i8 %50, 0
br i1 %51, label %52, label %60
52: ; preds = %48
%53 = load i8*, i8** %4
%54 = getelementptr inbounds i8, i8* %53, i32 1
store i8* %54, i8** %4
%55 = load i8, i8* %53
%56 = sext i8 %55 to i32
%57 = icmp ne i32 %56, 32
br i1 %57, label %58, label %59
58: ; preds = %52
store i32 -1, i32* %2
br label %69
59: ; preds = %52
br label %48
60: ; preds = %48
%61 = load i8*, i8** %3
%62 = getelementptr inbounds i8, i8* %61, i64 1
%63 = call i32 @getNumber(i8* %62, i32 10, i32 -1, i64* %5)
%64 = icmp ne i32 %63, 0
br i1 %64, label %66, label %65
65: ; preds = %60
store i32 -1, i32* %2
br label %69
66: ; preds = %60
%67 = load i64, i64* %5
%68 = trunc i64 %67 to i32
store i32 %68, i32* %2
br label %69
69: ; preds = %66, %65, %58, %24, %11
%70 = load i32, i32* %2
ret i32 %70
}

LLVM IR (-O2):
define i32 @shortNameMatchesSysV(i8* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 47
br i1 %5, label %6, label %35
6: ; preds = %1
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = add i8 %8, -48
%10 = icmp ult i8 %9, 10
br i1 %10, label %11, label %35
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %0, i64 2
br label %13
13: ; preds = %13, %11
%14 = phi i8* [ %12, %11 ], [ %18, %13 ]
%15 = load i8, i8* %14
%16 = add i8 %15, -48
%17 = icmp ult i8 %16, 10
%18 = getelementptr inbounds i8, i8* %14, i64 1
br i1 %17, label %13, label %19
19: ; preds = %13
%20 = icmp eq i8 %15, 0
br i1 %20, label %29, label %24
21: ; preds = %24
%22 = load i8, i8* %27
%23 = icmp eq i8 %22, 0
br i1 %23, label %29, label %24
24: ; preds = %19, %21
%25 = phi i8* [ %27, %21 ], [ %14, %19 ]
%26 = phi i8 [ %22, %21 ], [ %15, %19 ]
%27 = getelementptr inbounds i8, i8* %25, i64 1
%28 = icmp eq i8 %26, 32
br i1 %28, label %21, label %35
29: ; preds = %21, %19
%30 = call i32 @getNumber(i8* %7, i32 10, i32 -1, i64* %2)
%31 = icmp eq i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = load i64, i64* %2
%34 = trunc i64 %33 to i32
br label %35
35: ; preds = %24, %29, %6, %1, %32
%36 = phi i32 [ %34, %32 ], [ -1, %1 ], [ -1, %6 ], [ -1, %29 ], [ -1, %24 ]
ret i32 %36
}