#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 *);
int /*<<< orphan*/ strstr(char *, char *);
int isPartitionName(char *pname) {
  if (!isalpha(*pname))
    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
jne    117d <isPartitionName+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    1212 <isPartitionName+0xc2>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     11e9 <isPartitionName+0x99>
mov    -0x10(%rbp),%rdi
lea    0xe60(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%eax
jne    11e9 <isPartitionName+0x99>
mov    -0x10(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%eax
jne    11e9 <isPartitionName+0x99>
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    1212 <isPartitionName+0xc2>
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   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1060 <isalpha@plt>
test   %eax,%eax
je     11ad <isPartitionName+0x5d>
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     1198 <isPartitionName+0x48>
lea    0xe87(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
test   %eax,%eax
jne    1198 <isPartitionName+0x48>
lea    0xe7c(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strstr@plt>
test   %eax,%eax
je     11b1 <isPartitionName+0x61>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movsbl -0x1(%rax,%rbx,1),%edi
pop    %rbx
jmp    1030 <isdigit@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    %rbx,%rdi
mov    $0x70,%esi
call   1050 <strchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

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

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