#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*/ cloneStr(char *, int, char *);
char *nameOnes(char);
int /*<<< orphan*/ strMerge(char *, int, char *, int, char *, int);
void nameTeens(char *tensName, char ones) {
  char teenPrefix[6], teenSufix[5] = "teen";
  switch (ones) {
  case '0':
    cloneStr("ten", 14, tensName);
    return;
  case '1':
    cloneStr("eleven", 14, tensName);
    return;
  case '2':
    cloneStr("twelve", 14, tensName);
    return;
  case '3':
    cloneStr("thir", 5, teenPrefix);
    break;
  case '5':
    cloneStr("fif", 4, teenPrefix);
    break;
  case '8':
    cloneStr("eigh", 5, teenPrefix);
    break;
  default:
    cloneStr(nameOnes(ones), 6, teenPrefix);
    break;
  }
  strMerge(teenPrefix, 6, teenSufix, 5, tensName, 14);
}


x86 assembly (clang, -O0):
<nameTeens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movb   $0x0,-0x10(%rbp)
movl   $0x6e656574,-0x14(%rbp)
movsbl -0x9(%rbp),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x8,%eax
ja     1213 <nameTeens+0xe3>
mov    -0x20(%rbp),%rax
lea    0xe92(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdx
lea    0xea7(%rip),%rdi
mov    $0xe,%esi
call   1050 <cloneStr@plt>
jmp    124e <nameTeens+0x11e>
mov    -0x8(%rbp),%rdx
lea    0xe91(%rip),%rdi
mov    $0xe,%esi
call   1050 <cloneStr@plt>
jmp    124e <nameTeens+0x11e>
mov    -0x8(%rbp),%rdx
lea    0xe7e(%rip),%rdi
mov    $0xe,%esi
call   1050 <cloneStr@plt>
jmp    124e <nameTeens+0x11e>
lea    -0xf(%rbp),%rdx
lea    0xe6b(%rip),%rdi
mov    $0x5,%esi
call   1050 <cloneStr@plt>
jmp    122d <nameTeens+0xfd>
lea    -0xf(%rbp),%rdx
lea    0xe56(%rip),%rdi
mov    $0x4,%esi
call   1050 <cloneStr@plt>
jmp    122d <nameTeens+0xfd>
lea    -0xf(%rbp),%rdx
lea    0xe40(%rip),%rdi
mov    $0x5,%esi
call   1050 <cloneStr@plt>
jmp    122d <nameTeens+0xfd>
movsbl -0x9(%rbp),%edi
call   1040 <nameOnes@plt>
mov    %rax,%rdi
lea    -0xf(%rbp),%rdx
mov    $0x6,%esi
call   1050 <cloneStr@plt>
lea    -0xf(%rbp),%rdi
lea    -0x14(%rbp),%rdx
mov    -0x8(%rbp),%r8
mov    $0x6,%esi
mov    $0x5,%ecx
mov    $0xe,%r9d
call   1030 <strMerge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nameTeens>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movb   $0x0,0xc(%rsp)
movl   $0x6e656574,0x8(%rsp)
6e
lea    -0x30(%rsi),%eax
cmp    $0x8,%eax
ja     1191 <nameTeens+0x61>
lea    0xeac(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec5(%rip),%rdi
jmp    1176 <nameTeens+0x46>
lea    0xec0(%rip),%rdi
jmp    1176 <nameTeens+0x46>
lea    0xebe(%rip),%rdi
mov    $0xe,%esi
mov    %rbx,%rdx
add    $0x10,%rsp
pop    %rbx
jmp    1050 <cloneStr@plt>
lea    0xeac(%rip),%rdi
jmp    11c3 <nameTeens+0x93>
movsbl %sil,%edi
call   1040 <nameOnes@plt>
lea    0x2(%rsp),%rdx
mov    %rax,%rdi
mov    $0x6,%esi
jmp    11cd <nameTeens+0x9d>
lea    0xe90(%rip),%rdi
lea    0x2(%rsp),%rdx
mov    $0x4,%esi
jmp    11cd <nameTeens+0x9d>
lea    0xe81(%rip),%rdi
lea    0x2(%rsp),%rdx
mov    $0x5,%esi
call   1050 <cloneStr@plt>
lea    0x2(%rsp),%rdi
lea    0x8(%rsp),%rdx
mov    $0x6,%esi
mov    $0x5,%ecx
mov    %rbx,%r8
mov    $0xe,%r9d
call   1030 <strMerge@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.nameTeens.teenSufix = [5 x i8] c"teen\00"
@.str = [4 x i8] c"ten\00"
@.str.1 = [7 x i8] c"eleven\00"
@.str.2 = [7 x i8] c"twelve\00"
@.str.3 = [5 x i8] c"thir\00"
@.str.4 = [4 x i8] c"fif\00"
@.str.5 = [5 x i8] c"eigh\00"
define void @nameTeens(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca [6 x i8]
%6 = alloca [5 x i8]
store i8* %0, i8** %3
store i8 %1, i8* %4
%7 = bitcast [5 x i8]* %6 to i8*
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
switch i32 %9, label %28 [
i32 48, label %10
i32 49, label %13
i32 50, label %16
i32 51, label %19
i32 53, label %22
i32 56, label %25
]
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i32 @cloneStr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 14, i8* %11)
br label %38
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = call i32 @cloneStr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 14, i8* %14)
br label %38
16: ; preds = %2
%17 = load i8*, i8** %3
%18 = call i32 @cloneStr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 14, i8* %17)
br label %38
19: ; preds = %2
%20 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%21 = call i32 @cloneStr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 5, i8* %20)
br label %33
22: ; preds = %2
%23 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%24 = call i32 @cloneStr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 4, i8* %23)
br label %33
25: ; preds = %2
%26 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%27 = call i32 @cloneStr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 5, i8* %26)
br label %33
28: ; preds = %2
%29 = load i8, i8* %4
%30 = call i8* @nameOnes(i8 signext %29)
%31 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%32 = call i32 @cloneStr(i8* %30, i32 6, i8* %31)
br label %33
33: ; preds = %28, %25, %22, %19
%34 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%35 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%36 = load i8*, i8** %3
%37 = call i32 @strMerge(i8* %34, i32 6, i8* %35, i32 5, i8* %36, i32 14)
br label %38
38: ; preds = %33, %16, %13, %10
ret void
}

LLVM IR (-O2):
@__const.nameTeens.teenSufix = [5 x i8] c"teen\00"
@.str = [4 x i8] c"ten\00"
@.str.1 = [7 x i8] c"eleven\00"
@.str.2 = [7 x i8] c"twelve\00"
@.str.3 = [5 x i8] c"thir\00"
@.str.4 = [4 x i8] c"fif\00"
@.str.5 = [5 x i8] c"eigh\00"
define void @nameTeens(i8* %0, i8 signext %1) {
%3 = alloca [6 x i8]
%4 = alloca [5 x i8]
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%7 = sext i8 %1 to i32
switch i32 %7, label %20 [
i32 48, label %8
i32 49, label %10
i32 50, label %12
i32 51, label %14
i32 53, label %16
i32 56, label %18
]
8: ; preds = %2
%9 = tail call i32 @cloneStr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 14, i8* %0)
br label %25
10: ; preds = %2
%11 = tail call i32 @cloneStr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 14, i8* %0)
br label %25
12: ; preds = %2
%13 = tail call i32 @cloneStr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 14, i8* %0)
br label %25
14: ; preds = %2
%15 = call i32 @cloneStr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 5, i8* %5)
br label %23
16: ; preds = %2
%17 = call i32 @cloneStr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 4, i8* %5)
br label %23
18: ; preds = %2
%19 = call i32 @cloneStr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 5, i8* %5)
br label %23
20: ; preds = %2
%21 = tail call i8* @nameOnes(i8 signext %1)
%22 = call i32 @cloneStr(i8* %21, i32 6, i8* %5)
br label %23
23: ; preds = %20, %18, %16, %14
%24 = call i32 @strMerge(i8* %5, i32 6, i8* %6, i32 5, i8* %0, i32 14)
br label %25
25: ; preds = %23, %12, %10, %8
ret void
}