#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*/ nameTeens(char *, char);
scalar_t__ strLen(char *, int);
int /*<<< orphan*/ strMerge(char *, int, char *, int, char *, int);
void nameTens(char *tensName, char tens, char ones) {
  char onesName[6], tensPrefix[6], tensSufix[4] = "ty";
  cloneStr(nameOnes(ones), 6, onesName);
  switch (tens) {
  case '0':
    cloneStr(onesName, 6, tensName);
    return;
  case '1':
    nameTeens(tensName, ones);
    return;
  case '2':
    cloneStr("twen", 5, tensPrefix);
    break;
  case '3':
    cloneStr("thir", 5, tensPrefix);
    break;
  case '5':
    cloneStr("fif", 4, tensPrefix);
    break;
  case '8':
    cloneStr("eigh", 5, tensPrefix);
    break;
  default:
    cloneStr(nameOnes(tens), 6, tensPrefix);
    break;
  }
  if (strLen(onesName, 6) > 0) {
    strMerge(tensSufix, 4, "-", 2, tensSufix, 4);
  }
  strMerge(tensPrefix, 6, tensSufix, 4, tensName, 14);
  strMerge(tensName, 14, onesName, 6, tensName, 14);
}


x86 assembly (clang, -O0):
<nameTens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movl   $0x7974,-0x1c(%rbp)
movsbl -0xa(%rbp),%edi
call   1050 <nameOnes@plt>
mov    %rax,%rdi
mov    $0x6,%esi
lea    -0x10(%rbp),%rdx
call   1070 <cloneStr@plt>
movsbl -0x9(%rbp),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x8,%eax
ja     1243 <nameTens+0xf3>
mov    -0x28(%rbp),%rax
lea    0xe57(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x6,%esi
call   1070 <cloneStr@plt>
jmp    12d7 <nameTens+0x187>
mov    -0x8(%rbp),%rdi
movsbl -0xa(%rbp),%esi
call   1040 <nameTeens@plt>
jmp    12d7 <nameTens+0x187>
lea    -0x16(%rbp),%rdx
lea    0xe42(%rip),%rdi
mov    $0x5,%esi
call   1070 <cloneStr@plt>
jmp    125d <nameTens+0x10d>
lea    -0x16(%rbp),%rdx
lea    0xe2d(%rip),%rdi
mov    $0x5,%esi
call   1070 <cloneStr@plt>
jmp    125d <nameTens+0x10d>
lea    -0x16(%rbp),%rdx
lea    0xe18(%rip),%rdi
mov    $0x4,%esi
call   1070 <cloneStr@plt>
jmp    125d <nameTens+0x10d>
lea    -0x16(%rbp),%rdx
lea    0xe02(%rip),%rdi
mov    $0x5,%esi
call   1070 <cloneStr@plt>
jmp    125d <nameTens+0x10d>
movsbl -0x9(%rbp),%edi
call   1050 <nameOnes@plt>
mov    %rax,%rdi
lea    -0x16(%rbp),%rdx
mov    $0x6,%esi
call   1070 <cloneStr@plt>
lea    -0x10(%rbp),%rdi
mov    $0x6,%esi
call   1060 <strLen@plt>
cmp    $0x0,%rax
jle    1297 <nameTens+0x147>
lea    -0x1c(%rbp),%rdi
lea    -0x1c(%rbp),%r8
mov    $0x4,%r9d
lea    0xdb1(%rip),%rdx
mov    $0x2,%ecx
mov    %r9d,%esi
call   1030 <strMerge@plt>
lea    -0x16(%rbp),%rdi
lea    -0x1c(%rbp),%rdx
mov    -0x8(%rbp),%r8
mov    $0x6,%esi
mov    $0x4,%ecx
mov    $0xe,%r9d
call   1030 <strMerge@plt>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%r8
mov    $0xe,%r9d
mov    $0x6,%ecx
mov    %r9d,%esi
call   1030 <strMerge@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nameTens>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r14
movl   $0x7974,0x14(%rsp)
mov    %edx,%edi
call   1050 <nameOnes@plt>
lea    0x1a(%rsp),%rdx
mov    %rax,%rdi
mov    $0x6,%esi
call   1070 <cloneStr@plt>
lea    -0x30(%rbx),%eax
cmp    $0x8,%eax
ja     11d2 <nameTens+0x82>
lea    0xe71(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1a(%rsp),%rdi
mov    $0x6,%esi
mov    %r14,%rdx
call   1070 <cloneStr@plt>
jmp    128c <nameTens+0x13c>
movsbl %bpl,%esi
mov    %r14,%rdi
call   1040 <nameTeens@plt>
jmp    128c <nameTens+0x13c>
lea    0xe5d(%rip),%rdi
jmp    1203 <nameTens+0xb3>
lea    0xe59(%rip),%rdi
jmp    1203 <nameTens+0xb3>
movsbl %bl,%edi
call   1050 <nameOnes@plt>
lea    0xe(%rsp),%rdx
mov    %rax,%rdi
mov    $0x6,%esi
jmp    120d <nameTens+0xbd>
lea    0xe3e(%rip),%rdi
lea    0xe(%rsp),%rdx
mov    $0x4,%esi
jmp    120d <nameTens+0xbd>
lea    0xe2f(%rip),%rdi
lea    0xe(%rsp),%rdx
mov    $0x5,%esi
call   1070 <cloneStr@plt>
lea    0x1a(%rsp),%rdi
mov    $0x6,%esi
call   1060 <strLen@plt>
test   %rax,%rax
jle    124a <nameTens+0xfa>
lea    0xe0a(%rip),%rdx
lea    0x14(%rsp),%rdi
mov    $0x4,%esi
mov    $0x2,%ecx
mov    %rdi,%r8
mov    $0x4,%r9d
call   1030 <strMerge@plt>
lea    0xe(%rsp),%rdi
lea    0x14(%rsp),%rdx
mov    $0x6,%esi
mov    $0x4,%ecx
mov    %r14,%r8
mov    $0xe,%r9d
call   1030 <strMerge@plt>
lea    0x1a(%rsp),%rdx
mov    %r14,%rdi
mov    $0xe,%esi
mov    $0x6,%ecx
mov    %r14,%r8
mov    $0xe,%r9d
call   1030 <strMerge@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.nameTens.tensSufix = [4 x i8] c"ty\00\00"
@.str = [5 x i8] c"twen\00"
@.str.1 = [5 x i8] c"thir\00"
@.str.2 = [4 x i8] c"fif\00"
@.str.3 = [5 x i8] c"eigh\00"
@.str.4 = [2 x i8] c"-\00"
define void @nameTens(i8* %0, i8 signext %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca [6 x i8]
%8 = alloca [6 x i8]
%9 = alloca [4 x i8]
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = bitcast [4 x i8]* %9 to i8*
%11 = load i8, i8* %6
%12 = call i8* @nameOnes(i8 signext %11)
%13 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%14 = call i32 @cloneStr(i8* %12, i32 6, i8* %13)
%15 = load i8, i8* %5
%16 = sext i8 %15 to i32
switch i32 %16, label %37 [
i32 48, label %17
i32 49, label %21
i32 50, label %25
i32 51, label %28
i32 53, label %31
i32 56, label %34
]
17: ; preds = %3
%18 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%19 = load i8*, i8** %4
%20 = call i32 @cloneStr(i8* %18, i32 6, i8* %19)
br label %59
21: ; preds = %3
%22 = load i8*, i8** %4
%23 = load i8, i8* %6
%24 = call i32 @nameTeens(i8* %22, i8 signext %23)
br label %59
25: ; preds = %3
%26 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%27 = call i32 @cloneStr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 5, i8* %26)
br label %42
28: ; preds = %3
%29 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%30 = call i32 @cloneStr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 5, i8* %29)
br label %42
31: ; preds = %3
%32 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%33 = call i32 @cloneStr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 4, i8* %32)
br label %42
34: ; preds = %3
%35 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%36 = call i32 @cloneStr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 5, i8* %35)
br label %42
37: ; preds = %3
%38 = load i8, i8* %5
%39 = call i8* @nameOnes(i8 signext %38)
%40 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%41 = call i32 @cloneStr(i8* %39, i32 6, i8* %40)
br label %42
42: ; preds = %37, %34, %31, %28, %25
%43 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%44 = call i64 @strLen(i8* %43, i32 6)
%45 = icmp sgt i64 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %42
%47 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%48 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%49 = call i32 @strMerge(i8* %47, i32 4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 2, i8* %48, i32 4)
br label %50
50: ; preds = %46, %42
%51 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%52 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%53 = load i8*, i8** %4
%54 = call i32 @strMerge(i8* %51, i32 6, i8* %52, i32 4, i8* %53, i32 14)
%55 = load i8*, i8** %4
%56 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%57 = load i8*, i8** %4
%58 = call i32 @strMerge(i8* %55, i32 14, i8* %56, i32 6, i8* %57, i32 14)
br label %59
59: ; preds = %50, %21, %17
ret void
}

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