#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*/ countVowelsInStrTD();
int /*<<< orphan*/ countWordsInStrTD();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ myStrCatTD();
int /*<<< orphan*/ myStrCpyTD();
int /*<<< orphan*/ myStrLenTD();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
main(void) {
  int choice;
  while (1) {
    printf("\n******* Operations on Strings ********\n");
    printf("0.Compute the length of a string\n");
    printf("1.Copy a string from Source to Destination\n");
    printf("2.Concatinate a String with the Other\n");
    printf("3.Compute no of Vowels in a String\n");
    printf("4.Compute no of words in String\n");
    printf("5.Exit\n");
    printf("Enter your choice\n");
    scanf("%d", &choice);
    switch (choice) {
    case 0:
      myStrLenTD();
      break;
    case 1:
      myStrCpyTD();
      break;
    case 2:
      myStrCatTD();
      break;
    case 3:
      countVowelsInStrTD();
      break;
    case 4:
      countWordsInStrTD();
      break;
    case 5:
      exit(1);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe82(%rip),%rdi
call   1060 <printf@plt>
lea    0xe9f(%rip),%rdi
call   1060 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1060 <printf@plt>
lea    0xed5(%rip),%rdi
call   1060 <printf@plt>
lea    0xef0(%rip),%rdi
call   1060 <printf@plt>
lea    0xf08(%rip),%rdi
call   1060 <printf@plt>
lea    0xf1d(%rip),%rdi
call   1060 <printf@plt>
lea    0xf19(%rip),%rdi
call   1060 <printf@plt>
lea    0xf20(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x5,%rax
ja     126a <main+0xea>
mov    -0x10(%rbp),%rax
lea    0xde5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1050 <myStrLenTD@plt>
jmp    126a <main+0xea>
mov    $0x0,%al
call   1070 <myStrCpyTD@plt>
jmp    126a <main+0xea>
mov    $0x0,%al
call   1040 <myStrCatTD@plt>
jmp    126a <main+0xea>
mov    $0x0,%al
call   1030 <countVowelsInStrTD@plt>
jmp    126a <main+0xea>
mov    $0x0,%al
call   1080 <countWordsInStrTD@plt>
jmp    126a <main+0xea>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    118f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf46(%rip),%rbp
lea    0xf5f(%rip),%r14
lea    0xf5f(%rip),%r15
lea    0xe71(%rip),%r12
lea    0x4(%rsp),%r13
lea    0xe4d(%rip),%rbx
jmp    11c0 <main+0x40>
xor    %eax,%eax
call   1080 <countWordsInStrTD@plt>
nopl   0x0(%rax)
lea    0xe54(%rip),%rdi
call   1040 <puts@plt>
lea    0xe70(%rip),%rdi
call   1040 <puts@plt>
lea    0xe85(%rip),%rdi
call   1040 <puts@plt>
lea    0xea4(%rip),%rdi
call   1040 <puts@plt>
lea    0xebe(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1090 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x5,%rax
ja     11c0 <main+0x40>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <myStrLenTD@plt>
jmp    11c0 <main+0x40>
xor    %eax,%eax
call   1070 <myStrCpyTD@plt>
jmp    11c0 <main+0x40>
xor    %eax,%eax
call   1050 <myStrCatTD@plt>
jmp    11c0 <main+0x40>
xor    %eax,%eax
call   1030 <countVowelsInStrTD@plt>
jmp    11c0 <main+0x40>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"\0A******* Operations on Strings ********\0A\00"
@.str.1 = [34 x i8] c"0.Compute the length of a string\0A\00"
@.str.2 = [44 x i8] c"1.Copy a string from Source to Destination\0A\00"
@.str.3 = [39 x i8] c"2.Concatinate a String with the Other\0A\00"
@.str.4 = [36 x i8] c"3.Compute no of Vowels in a String\0A\00"
@.str.5 = [33 x i8] c"4.Compute no of words in String\0A\00"
@.str.6 = [8 x i8] c"5.Exit\0A\00"
@.str.7 = [19 x i8] c"Enter your choice\0A\00"
@.str.8 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %26
%4 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
switch i32 %13, label %26 [
i32 0, label %14
i32 1, label %16
i32 2, label %18
i32 3, label %20
i32 4, label %22
i32 5, label %24
]
14: ; preds = %3
%15 = call i32 (...) @myStrLenTD()
br label %26
16: ; preds = %3
%17 = call i32 (...) @myStrCpyTD()
br label %26
18: ; preds = %3
%19 = call i32 (...) @myStrCatTD()
br label %26
20: ; preds = %3
%21 = call i32 (...) @countVowelsInStrTD()
br label %26
22: ; preds = %3
%23 = call i32 (...) @countWordsInStrTD()
br label %26
24: ; preds = %3
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %3, %22, %20, %18, %16, %14
br label %3
}

LLVM IR (-O2):
@.str.8 = [3 x i8] c"%d\00"
@str = [40 x i8] c"\0A******* Operations on Strings ********\00"
@str.9 = [33 x i8] c"0.Compute the length of a string\00"
@str.10 = [43 x i8] c"1.Copy a string from Source to Destination\00"
@str.11 = [38 x i8] c"2.Concatinate a String with the Other\00"
@str.12 = [35 x i8] c"3.Compute no of Vowels in a String\00"
@str.13 = [32 x i8] c"4.Compute no of words in String\00"
@str.14 = [7 x i8] c"5.Exit\00"
@str.15 = [18 x i8] c"Enter your choice\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %14, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.9, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.10, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.11, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.12, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.13, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.14, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.15, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
switch i32 %13, label %14 [
i32 0, label %15
i32 1, label %17
i32 2, label %19
i32 3, label %21
i32 4, label %23
i32 5, label %25
]
14: ; preds = %3, %23, %21, %19, %17, %15
br label %3
15: ; preds = %3
%16 = call i32 (...) @myStrLenTD()
br label %14
17: ; preds = %3
%18 = call i32 (...) @myStrCpyTD()
br label %14
19: ; preds = %3
%20 = call i32 (...) @myStrCatTD()
br label %14
21: ; preds = %3
%22 = call i32 (...) @countVowelsInStrTD()
br label %14
23: ; preds = %3
%24 = call i32 (...) @countWordsInStrTD()
br label %14
25: ; preds = %3
%26 = call i32 @exit(i32 1)
unreachable
}