#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*/ isalpha(char);
int isdigit(char);
int /*<<< orphan*/ *strchr(char *, char);
int strlen(char *);
scalar_t__ strstr(char *, char *);
int isPartitionName(char *pname) {
  if (!isalpha(*pname) || strstr(pname, "ram"))
    return 0;
  if (strchr(pname, '/') && !strstr(pname, "iseries") &&
      !strstr(pname, "i2o")) {
    return strchr(pname, 'p') != NULL;
  } else {
    return isdigit(pname[strlen(pname) - 1]);
  }
}


x86 assembly (clang, -O0):
<isPartitionName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%eax
je     118b <isPartitionName+0x3b>
mov    -0x10(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
je     1197 <isPartitionName+0x47>
movl   $0x0,-0x4(%rbp)
jmp    122e <isPartitionName+0xde>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     1205 <isPartitionName+0xb5>
mov    -0x10(%rbp),%rdi
lea    0xe4a(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
jne    1205 <isPartitionName+0xb5>
mov    -0x10(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
jne    1205 <isPartitionName+0xb5>
mov    -0x10(%rbp),%rdi
mov    $0x70,%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    122e <isPartitionName+0xde>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPartitionName>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1060 <isalpha@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     1178 <isPartitionName+0x28>
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
je     1181 <isPartitionName+0x31>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     11bb <isPartitionName+0x6b>
lea    0xe6a(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
jne    11bb <isPartitionName+0x6b>
lea    0xe5e(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
je     11d5 <isPartitionName+0x85>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movsbl -0x1(%rax,%rbx,1),%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <isdigit@plt>
mov    %rbx,%rdi
mov    $0x70,%esi
call   1050 <strchr@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
jmp    1178 <isPartitionName+0x28>

LLVM IR (-O0):
@.str = [4 x i8] c"ram\00"
@.str.1 = [8 x i8] c"iseries\00"
@.str.2 = [4 x i8] c"i2o\00"
define i32 @isPartitionName(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = call i32 @isalpha(i8 signext %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @strstr(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8, %1
store i32 0, i32* %2
br label %39
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = call i32* @strchr(i8* %14, i8 signext 47)
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %30
17: ; preds = %13
%18 = load i8*, i8** %3
%19 = call i64 @strstr(i8* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %30, label %21
21: ; preds = %17
%22 = load i8*, i8** %3
%23 = call i64 @strstr(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %30, label %25
25: ; preds = %21
%26 = load i8*, i8** %3
%27 = call i32* @strchr(i8* %26, i8 signext 112)
%28 = icmp ne i32* %27, null
%29 = zext i1 %28 to i32
store i32 %29, i32* %2
br label %39
30: ; preds = %21, %17, %13
%31 = load i8*, i8** %3
%32 = load i8*, i8** %3
%33 = call i32 @strlen(i8* %32)
%34 = sub nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %31, i64 %35
%37 = load i8, i8* %36
%38 = call i32 @isdigit(i8 signext %37)
store i32 %38, i32* %2
br label %39
39: ; preds = %30, %25, %12
%40 = load i32, i32* %2
ret i32 %40
}

LLVM IR (-O2):
@.str = [4 x i8] c"ram\00"
@.str.1 = [8 x i8] c"iseries\00"
@.str.2 = [4 x i8] c"i2o\00"
define i32 @isPartitionName(i8* %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @isalpha(i8 signext %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %28, label %5
5: ; preds = %1
%6 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %28
8: ; preds = %5
%9 = tail call i32* @strchr(i8* %0, i8 signext 47)
%10 = icmp eq i32* %9, null
br i1 %10, label %21, label %11
11: ; preds = %8
%12 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = tail call i32* @strchr(i8* %0, i8 signext 112)
%19 = icmp ne i32* %18, null
%20 = zext i1 %19 to i32
br label %28
21: ; preds = %14, %11, %8
%22 = tail call i32 @strlen(i8* %0)
%23 = add nsw i32 %22, -1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %0, i64 %24
%26 = load i8, i8* %25
%27 = tail call i32 @isdigit(i8 signext %26)
br label %28
28: ; preds = %1, %5, %21, %17
%29 = phi i32 [ %27, %21 ], [ %20, %17 ], [ 0, %5 ], [ 0, %1 ]
ret i32 %29
}