#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*/ Suffix(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *Pluralise(char *string) {
  register int length;
  static char area[1024];
  length = strlen(string);
  strcpy(area, string);
  if (!Suffix(string, "ch") || !Suffix(string, "ex") || !Suffix(string, "ix") ||
      !Suffix(string, "sh") || !Suffix(string, "ss")) {
    strcat(area, "es");
  } else if (length > 2 && string[length - 1] == 'y') {
    if (strchr("aeiou", string[length - 2])) {
      strcat(area, "s");
    } else {
      strcpy(area + length - 1, "ies");
    }
  } else if (string[length - 1] == 's') {
    strcat(area, "es");
  } else {
    strcat(area, "s");
  }
  return (area);
}


x86 assembly (clang, -O0):
<Pluralise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0x2eed(%rip),%rdi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1060 <Suffix@plt>
cmp    $0x0,%eax
je     11f5 <Pluralise+0xa5>
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1060 <Suffix@plt>
cmp    $0x0,%eax
je     11f5 <Pluralise+0xa5>
mov    -0x8(%rbp),%rdi
lea    0xe51(%rip),%rsi
call   1060 <Suffix@plt>
cmp    $0x0,%eax
je     11f5 <Pluralise+0xa5>
mov    -0x8(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   1060 <Suffix@plt>
cmp    $0x0,%eax
je     11f5 <Pluralise+0xa5>
mov    -0x8(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   1060 <Suffix@plt>
cmp    $0x0,%eax
jne    120d <Pluralise+0xbd>
lea    0x2e64(%rip),%rdi
lea    0xe13(%rip),%rsi
call   1070 <strcat@plt>
jmp    12e2 <Pluralise+0x192>
cmpl   $0x2,-0xc(%rbp)
jle    1293 <Pluralise+0x143>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x79,%eax
jne    1293 <Pluralise+0x143>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
lea    0xdca(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     1270 <Pluralise+0x120>
lea    0x2e01(%rip),%rdi
lea    0xdb1(%rip),%rsi
call   1070 <strcat@plt>
jmp    128e <Pluralise+0x13e>
movslq -0xc(%rbp),%rax
lea    0x2de5(%rip),%rdi
add    %rax,%rdi
add    $0xffffffffffffffff,%rdi
lea    0xd8c(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12dd <Pluralise+0x18d>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x73,%eax
jne    12c5 <Pluralise+0x175>
lea    0x2dac(%rip),%rdi
lea    0xd5b(%rip),%rsi
call   1070 <strcat@plt>
jmp    12d8 <Pluralise+0x188>
lea    0x2d94(%rip),%rdi
lea    0xd44(%rip),%rsi
call   1070 <strcat@plt>
jmp    12dd <Pluralise+0x18d>
jmp    12e2 <Pluralise+0x192>
lea    0x2d77(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pluralise>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%r15d
lea    0x2ef9(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe87(%rip),%rsi
mov    %rbx,%rdi
call   1060 <Suffix@plt>
test   %eax,%eax
je     1225 <Pluralise+0xd5>
lea    0xe73(%rip),%rsi
mov    %rbx,%rdi
call   1060 <Suffix@plt>
test   %eax,%eax
je     1225 <Pluralise+0xd5>
lea    0xe5f(%rip),%rsi
mov    %rbx,%rdi
call   1060 <Suffix@plt>
test   %eax,%eax
je     1225 <Pluralise+0xd5>
lea    0xe4f(%rip),%rsi
mov    %rbx,%rdi
call   1060 <Suffix@plt>
test   %eax,%eax
je     1225 <Pluralise+0xd5>
lea    0xe3f(%rip),%rsi
mov    %rbx,%rdi
call   1060 <Suffix@plt>
test   %eax,%eax
je     1225 <Pluralise+0xd5>
movslq %r15d,%rcx
lea    -0x1(%rcx),%rax
cmp    $0x3,%ecx
jl     121f <Pluralise+0xcf>
mov    %eax,%ecx
cmpb   $0x79,(%rbx,%rcx,1)
jne    121f <Pluralise+0xcf>
lea    -0x2(%r15),%eax
movsbl (%rbx,%rax,1),%esi
lea    0xe13(%rip),%rdi
call   1050 <strchr@plt>
test   %rax,%rax
jne    1245 <Pluralise+0xf5>
mov    %r15d,%eax
lea    (%rax,%r14,1),%rdi
add    $0xffffffffffffffff,%rdi
lea    0xdfd(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1238 <Pluralise+0xe8>
cmpb   $0x73,(%rbx,%rax,1)
jne    1245 <Pluralise+0xf5>
lea    0x2e34(%rip),%rdi
lea    0xde3(%rip),%rsi
call   1070 <strcat@plt>
lea    0x2e21(%rip),%rax
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0x2e14(%rip),%rdi
lea    0xdc4(%rip),%rsi
jmp    1233 <Pluralise+0xe3>

LLVM IR (-O0):
@Pluralise.area = internal global [1024 x i8] zeroinitializer
@.str = [3 x i8] c"ch\00"
@.str.1 = [3 x i8] c"ex\00"
@.str.2 = [3 x i8] c"ix\00"
@.str.3 = [3 x i8] c"sh\00"
@.str.4 = [3 x i8] c"ss\00"
@.str.5 = [3 x i8] c"es\00"
@.str.6 = [6 x i8] c"aeiou\00"
@.str.7 = [2 x i8] c"s\00"
@.str.8 = [4 x i8] c"ies\00"
define i8* @Pluralise(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %2
%9 = call i32 @Suffix(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %27
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = call i32 @Suffix(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %11
%16 = load i8*, i8** %2
%17 = call i32 @Suffix(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = load i8*, i8** %2
%21 = call i32 @Suffix(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i8*, i8** %2
%25 = call i32 @Suffix(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%26 = icmp ne i32 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %23, %19, %15, %11, %1
%28 = call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %74
29: ; preds = %23
%30 = load i32, i32* %3
%31 = icmp sgt i32 %30, 2
br i1 %31, label %32, label %59
32: ; preds = %29
%33 = load i8*, i8** %2
%34 = load i32, i32* %3
%35 = sub nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %33, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 121
br i1 %40, label %41, label %59
41: ; preds = %32
%42 = load i8*, i8** %2
%43 = load i32, i32* %3
%44 = sub nsw i32 %43, 2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %42, i64 %45
%47 = load i8, i8* %46
%48 = call i64 @strchr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8 signext %47)
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %41
%51 = call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %58
52: ; preds = %41
%53 = load i32, i32* %3
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0), i64 %54
%56 = getelementptr inbounds i8, i8* %55, i64 -1
%57 = call i32 @strcpy(i8* %56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %58
58: ; preds = %52, %50
br label %73
59: ; preds = %32, %29
%60 = load i8*, i8** %2
%61 = load i32, i32* %3
%62 = sub nsw i32 %61, 1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %60, i64 %63
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 115
br i1 %67, label %68, label %70
68: ; preds = %59
%69 = call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %72
70: ; preds = %59
%71 = call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %72
72: ; preds = %70, %68
br label %73
73: ; preds = %72, %58
br label %74
74: ; preds = %73, %27
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0)
}

LLVM IR (-O2):
@Pluralise.area = internal global [1024 x i8] zeroinitializer
@.str = [3 x i8] c"ch\00"
@.str.1 = [3 x i8] c"ex\00"
@.str.2 = [3 x i8] c"ix\00"
@.str.3 = [3 x i8] c"sh\00"
@.str.4 = [3 x i8] c"ss\00"
@.str.5 = [3 x i8] c"es\00"
@.str.6 = [6 x i8] c"aeiou\00"
@.str.7 = [2 x i8] c"s\00"
@.str.8 = [4 x i8] c"ies\00"
define i8* @Pluralise(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0), i8* %0)
%4 = tail call i32 @Suffix(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %18, label %6
6: ; preds = %1
%7 = tail call i32 @Suffix(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %6
%10 = tail call i32 @Suffix(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %9
%13 = tail call i32 @Suffix(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = tail call i32 @Suffix(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15, %12, %9, %6, %1
%19 = tail call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %51
20: ; preds = %15
%21 = icmp sgt i32 %2, 2
%22 = add nsw i32 %2, -1
br i1 %21, label %23, label %42
23: ; preds = %20
%24 = zext i32 %22 to i64
%25 = getelementptr inbounds i8, i8* %0, i64 %24
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 121
br i1 %27, label %28, label %42
28: ; preds = %23
%29 = add nsw i32 %2, -2
%30 = zext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %0, i64 %30
%32 = load i8, i8* %31
%33 = tail call i64 @strchr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8 signext %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %28
%36 = tail call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %51
37: ; preds = %28
%38 = zext i32 %2 to i64
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 %38
%40 = getelementptr inbounds i8, i8* %39, i64 -1
%41 = tail call i32 @strcpy(i8* %40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %51
42: ; preds = %20, %23
%43 = sext i32 %22 to i64
%44 = getelementptr inbounds i8, i8* %0, i64 %43
%45 = load i8, i8* %44
%46 = icmp eq i8 %45, 115
br i1 %46, label %47, label %49
47: ; preds = %42
%48 = tail call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %51
49: ; preds = %42
%50 = tail call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %51
51: ; preds = %37, %35, %49, %47, %18
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @Pluralise.area, i64 0, i64 0)
}