#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 */
scalar_t__ AlgMorphMap(char *, int, char *, char *, char *);
int /*<<< orphan*/ StringCpy(char *, char *, int);
int strlen(char *);
void AlgMorphGetEnglishNounRoot(char *infl, char *root) {
  int len;
  len = strlen(infl);
  if (AlgMorphMap(infl, len, "ies", "y", root))
    return;
  if (AlgMorphMap(infl, len, "ss", "ss", root))
    return;
  if (AlgMorphMap(infl, len, "es", "e", root))
    return;
  if (AlgMorphMap(infl, len, "s", "", root))
    return;
  StringCpy(root, infl, 128);
}


x86 assembly (clang, -O0):
<AlgMorphGetEnglishNounRoot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%r8
lea    0xea2(%rip),%rdx
lea    0xe9f(%rip),%rcx
call   1040 <AlgMorphMap@plt>
cmp    $0x0,%rax
je     1179 <AlgMorphGetEnglishNounRoot+0x49>
jmp    120e <AlgMorphGetEnglishNounRoot+0xde>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%r8
lea    0xe7b(%rip),%rcx
mov    %rcx,%rdx
call   1040 <AlgMorphMap@plt>
cmp    $0x0,%rax
je     11a2 <AlgMorphGetEnglishNounRoot+0x72>
jmp    120e <AlgMorphGetEnglishNounRoot+0xde>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%r8
lea    0xe4d(%rip),%rdx
lea    0xe4e(%rip),%rcx
call   1040 <AlgMorphMap@plt>
cmp    $0x0,%rax
je     11cf <AlgMorphGetEnglishNounRoot+0x9f>
jmp    120e <AlgMorphGetEnglishNounRoot+0xde>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%r8
lea    0xe21(%rip),%rdx
lea    0xe22(%rip),%rcx
call   1040 <AlgMorphMap@plt>
cmp    $0x0,%rax
je     11fc <AlgMorphGetEnglishNounRoot+0xcc>
jmp    120e <AlgMorphGetEnglishNounRoot+0xde>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x80,%edx
call   1050 <StringCpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AlgMorphGetEnglishNounRoot>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    0xeb8(%rip),%rdx
lea    0xeb5(%rip),%rcx
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%r8
call   1040 <AlgMorphMap@plt>
test   %rax,%rax
jne    11bd <AlgMorphGetEnglishNounRoot+0x8d>
lea    0xe9e(%rip),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rcx,%rdx
mov    %r14,%r8
call   1040 <AlgMorphMap@plt>
test   %rax,%rax
jne    11bd <AlgMorphGetEnglishNounRoot+0x8d>
lea    0xe7d(%rip),%rdx
lea    0xe7e(%rip),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%r8
call   1040 <AlgMorphMap@plt>
test   %rax,%rax
jne    11bd <AlgMorphGetEnglishNounRoot+0x8d>
lea    0xe5e(%rip),%rdx
lea    0xe5f(%rip),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%r8
call   1040 <AlgMorphMap@plt>
test   %rax,%rax
je     11c2 <AlgMorphGetEnglishNounRoot+0x92>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x80,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <StringCpy@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"ies\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [3 x i8] c"ss\00"
@.str.3 = [3 x i8] c"es\00"
@.str.4 = [2 x i8] c"e\00"
@.str.5 = [2 x i8] c"s\00"
@.str.6 = [1 x i8] zeroinitializer
define void @AlgMorphGetEnglishNounRoot(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i8*, i8** %3
%9 = load i32, i32* %5
%10 = load i8*, i8** %4
%11 = call i64 @AlgMorphMap(i8* %8, i32 %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %2
br label %39
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = load i32, i32* %5
%17 = load i8*, i8** %4
%18 = call i64 @AlgMorphMap(i8* %15, i32 %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
br label %39
21: ; preds = %14
%22 = load i8*, i8** %3
%23 = load i32, i32* %5
%24 = load i8*, i8** %4
%25 = call i64 @AlgMorphMap(i8* %22, i32 %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %21
br label %39
28: ; preds = %21
%29 = load i8*, i8** %3
%30 = load i32, i32* %5
%31 = load i8*, i8** %4
%32 = call i64 @AlgMorphMap(i8* %29, i32 %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %28
br label %39
35: ; preds = %28
%36 = load i8*, i8** %4
%37 = load i8*, i8** %3
%38 = call i32 @StringCpy(i8* %36, i8* %37, i32 128)
br label %39
39: ; preds = %35, %34, %27, %20, %13
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"ies\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [3 x i8] c"ss\00"
@.str.3 = [3 x i8] c"es\00"
@.str.4 = [2 x i8] c"e\00"
@.str.5 = [2 x i8] c"s\00"
@.str.6 = [1 x i8] zeroinitializer
define void @AlgMorphGetEnglishNounRoot(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i64 @AlgMorphMap(i8* %0, i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %2
%7 = tail call i64 @AlgMorphMap(i8* %0, i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = tail call i64 @AlgMorphMap(i8* %0, i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = tail call i64 @AlgMorphMap(i8* %0, i32 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* %1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 @StringCpy(i8* %1, i8* %0, i32 128)
br label %17
17: ; preds = %12, %9, %6, %2, %15
ret void
}