#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdin;
int strcmpr(char *, char *);
int /*<<< orphan*/ strcncat(char *, char *);
int /*<<< orphan*/ strcopy(char *, char *);
int strlength(char *);
int /*<<< orphan*/ strrevrs(char *);
int /*<<< orphan*/ strtok(char *, char *);
int main() {
  int choice = 0, i = 0;
  char str_first[200], str_second[200];
  printf("This program tests implementations of a few standard library string "
         "functions.\n");
  printf("Please enter 1 to find out the length of a string.\n");
  printf("Please enter 2 to compare two strings.\n");
  printf("Please enter 3 to copy one string into another.\n");
  printf("Please enter 4 to reverse a string.\n");
  printf("Please enter 5 to append two strings.\n");
  scanf("%d", &choice);
  setbuf(stdin, NULL);
  switch (choice) {
  case 1:
    printf("Please enter a string.\n");
    fgets(str_first, 200, stdin);
    strtok(str_first, "\n");
    printf("The string you entered is: %s.\n", str_first);
    printf("The length of the string is %d.\n", strlength(str_first));
    break;
  case 2:
    printf("Please enter two strings.\n");
    fgets(str_first, 200, stdin);
    strtok(str_first, "\n");
    fgets(str_second, 200, stdin);
    strtok(str_second, "\n");
    printf("The first string you entered is: %s.\n", str_first);
    printf("The second string you entered is: %s.\n", str_second);
    printf("%d\n", strcmpr(str_first, str_second));
    break;
  case 3:
    printf("Please enter two strings.\n");
    fgets(str_first, 200, stdin);
    strtok(str_first, "\n");
    fgets(str_second, 200, stdin);
    strtok(str_second, "\n");
    printf("The first string you entered is: %s.\n", str_first);
    printf("The second string you entered is: %s.\n", str_second);
    strcopy(str_first, str_second);
    break;
  case 4:
    printf("Please enter a string.\n");
    fgets(str_first, 200, stdin);
    strtok(str_first, "\n");
    printf("The string you entered is: %s.\n", str_first);
    strrevrs(str_first);
    break;
  case 5:
    printf("Please enter two strings.\n");
    fgets(str_first, 200, stdin);
    strtok(str_first, "\n");
    fgets(str_second, 200, stdin);
    strtok(str_second, "\n");
    printf("The first string you entered is: %s.\n", str_first);
    printf("The second string you entered is: %s.\n", str_second);
    strcncat(str_first, str_second);
    break;
  default:
    printf("Wrong choice!\n");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe4d(%rip),%rdi
xor    %eax,%eax
mov    %eax,-0x1bc(%rbp)
mov    %al,-0x1bd(%rbp)
call   1050 <printf@plt>
mov    -0x1bd(%rbp),%al
lea    0xe7d(%rip),%rdi
call   1050 <printf@plt>
mov    -0x1bd(%rbp),%al
lea    0xe9f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x1bd(%rbp),%al
lea    0xeb5(%rip),%rdi
call   1050 <printf@plt>
mov    -0x1bd(%rbp),%al
lea    0xed4(%rip),%rdi
call   1050 <printf@plt>
mov    -0x1bd(%rbp),%al
lea    0xee7(%rip),%rdi
call   1050 <printf@plt>
lea    0xf02(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x1bc(%rbp),%eax
mov    0x2d97(%rip),%rcx
mov    (%rcx),%edi
mov    %eax,%esi
call   1040 <setbuf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x1b8(%rbp)
sub    $0x4,%eax
ja     1569 <main+0x3c9>
mov    -0x1b8(%rbp),%rax
lea    0xd80(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rdi
mov    0x2d43(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1060 <fgets@plt>
lea    -0xe0(%rbp),%rdi
lea    0xf53(%rip),%rsi
call   10a0 <strtok@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rdi
call   1030 <strlength@plt>
mov    %eax,%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1577 <main+0x3d7>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rdi
mov    0x2cd2(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1060 <fgets@plt>
lea    -0xe0(%rbp),%rdi
lea    0xee2(%rip),%rsi
call   10a0 <strtok@plt>
lea    -0x1b0(%rbp),%rdi
mov    0x2ca5(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1060 <fgets@plt>
lea    -0x1b0(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   10a0 <strtok@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1b0(%rbp),%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rdi
lea    -0x1b0(%rbp),%rsi
call   10b0 <strcmpr@plt>
mov    %eax,%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1577 <main+0x3d7>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rdi
mov    0x2c18(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1060 <fgets@plt>
lea    -0xe0(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   10a0 <strtok@plt>
lea    -0x1b0(%rbp),%rdi
mov    0x2beb(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1060 <fgets@plt>
lea    -0x1b0(%rbp),%rdi
lea    0xdfb(%rip),%rsi
call   10a0 <strtok@plt>
lea    -0xe0(%rbp),%rsi
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1b0(%rbp),%rsi
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rdi
lea    -0x1b0(%rbp),%rsi
call   1080 <strcopy@plt>
jmp    1577 <main+0x3d7>
lea    0xcdb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rdi
mov    0x2b6e(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1060 <fgets@plt>
lea    -0xe0(%rbp),%rdi
lea    0xd7e(%rip),%rsi
call   10a0 <strtok@plt>
lea    -0xe0(%rbp),%rsi
lea    0xcb1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rdi
call   10c0 <strrevrs@plt>
jmp    1577 <main+0x3d7>
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rdi
mov    0x2b0d(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1060 <fgets@plt>
lea    -0xe0(%rbp),%rdi
lea    0xd1d(%rip),%rsi
call   10a0 <strtok@plt>
lea    -0x1b0(%rbp),%rdi
mov    0x2ae0(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1060 <fgets@plt>
lea    -0x1b0(%rbp),%rdi
lea    0xcf0(%rip),%rsi
call   10a0 <strtok@plt>
lea    -0xe0(%rbp),%rsi
lea    0xc7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1b0(%rbp),%rsi
lea    0xc90(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rdi
lea    -0x1b0(%rbp),%rsi
call   1070 <strcncat@plt>
jmp    1577 <main+0x3d7>
lea    0xc95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1b0,%rsp
movl   $0x0,0xc(%rsp)
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
lea    0xf21(%rip),%rdi
call   1030 <puts@plt>
lea    0xf48(%rip),%rdi
call   1030 <puts@plt>
lea    0xf63(%rip),%rdi
call   1030 <puts@plt>
lea    0xf87(%rip),%rdi
call   1030 <puts@plt>
lea    0xf9f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe01(%rip),%rdi
lea    0xc(%rsp),%rsi
call   10a0 <scanf@plt>
mov    0x2dc4(%rip),%rbx
mov    (%rbx),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     129d <main+0xed>
lea    0xdc0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf96(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1070 <fgets@plt>
lea    0xde6(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strtok@plt>
lea    0xd98(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlength@plt>
lea    0xd9f(%rip),%rdi
jmp    1336 <main+0x186>
lea    0xf59(%rip),%rdi
call   1030 <puts@plt>
jmp    1498 <main+0x2e8>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%edx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0xc8,%esi
call   1070 <fgets@plt>
lea    0xd81(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   10b0 <strtok@plt>
mov    (%rbx),%edx
lea    0xe0(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1070 <fgets@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10b0 <strtok@plt>
lea    0xd4f(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd64(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10c0 <strcmpr@plt>
lea    0xd6f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1498 <main+0x2e8>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%edx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0xc8,%esi
call   1070 <fgets@plt>
lea    0xceb(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   10b0 <strtok@plt>
mov    (%rbx),%edx
lea    0xe0(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1070 <fgets@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10b0 <strtok@plt>
lea    0xcb9(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xcce(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <strcopy@plt>
jmp    1498 <main+0x2e8>
lea    0xe15(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1070 <fgets@plt>
lea    0xc65(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strtok@plt>
lea    0xc17(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   10d0 <strrevrs@plt>
jmp    1498 <main+0x2e8>
lea    0xdae(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%edx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0xc8,%esi
call   1070 <fgets@plt>
lea    0xc18(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   10b0 <strtok@plt>
mov    (%rbx),%edx
lea    0xe0(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1070 <fgets@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10b0 <strtok@plt>
lea    0xbe6(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xbfb(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <strcncat@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [80 x i8] c"This program tests implementations of a few standard library string functions.\0A\00"
@.str.1 = [52 x i8] c"Please enter 1 to find out the length of a string.\0A\00"
@.str.2 = [40 x i8] c"Please enter 2 to compare two strings.\0A\00"
@.str.3 = [49 x i8] c"Please enter 3 to copy one string into another.\0A\00"
@.str.4 = [37 x i8] c"Please enter 4 to reverse a string.\0A\00"
@.str.5 = [39 x i8] c"Please enter 5 to append two strings.\0A\00"
@.str.6 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.7 = [24 x i8] c"Please enter a string.\0A\00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [32 x i8] c"The string you entered is: %s.\0A\00"
@.str.10 = [33 x i8] c"The length of the string is %d.\0A\00"
@.str.11 = [27 x i8] c"Please enter two strings.\0A\00"
@.str.12 = [38 x i8] c"The first string you entered is: %s.\0A\00"
@.str.13 = [39 x i8] c"The second string you entered is: %s.\0A\00"
@.str.14 = [4 x i8] c"%d\0A\00"
@.str.15 = [15 x i8] c"Wrong choice!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [200 x i8]
%5 = alloca [200 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%13 = load i32, i32* @stdin
%14 = call i32 @setbuf(i32 %13, i32* null)
%15 = load i32, i32* %2
switch i32 %15, label %97 [
i32 1, label %16
i32 2, label %28
i32 3, label %48
i32 4, label %67
i32 5, label %78
]
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%18 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%19 = load i32, i32* @stdin
%20 = call i32 @fgets(i8* %18, i32 200, i32 %19)
%21 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%22 = call i32 @strtok(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%23 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%26 = call i32 @strlength(i8* %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), i32 %26)
br label %99
28: ; preds = %0
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0))
%30 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%31 = load i32, i32* @stdin
%32 = call i32 @fgets(i8* %30, i32 200, i32 %31)
%33 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%34 = call i32 @strtok(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%35 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%36 = load i32, i32* @stdin
%37 = call i32 @fgets(i8* %35, i32 200, i32 %36)
%38 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%39 = call i32 @strtok(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%40 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i8* %40)
%42 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.13, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%45 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%46 = call i32 @strcmpr(i8* %44, i8* %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 %46)
br label %99
48: ; preds = %0
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0))
%50 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%51 = load i32, i32* @stdin
%52 = call i32 @fgets(i8* %50, i32 200, i32 %51)
%53 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%54 = call i32 @strtok(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%55 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%56 = load i32, i32* @stdin
%57 = call i32 @fgets(i8* %55, i32 200, i32 %56)
%58 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%59 = call i32 @strtok(i8* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%60 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i8* %60)
%62 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.13, i64 0, i64 0), i8* %62)
%64 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%65 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%66 = call i32 @strcopy(i8* %64, i8* %65)
br label %99
67: ; preds = %0
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%69 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%70 = load i32, i32* @stdin
%71 = call i32 @fgets(i8* %69, i32 200, i32 %70)
%72 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%73 = call i32 @strtok(i8* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%74 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i8* %74)
%76 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%77 = call i32 @strrevrs(i8* %76)
br label %99
78: ; preds = %0
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0))
%80 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%81 = load i32, i32* @stdin
%82 = call i32 @fgets(i8* %80, i32 200, i32 %81)
%83 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%84 = call i32 @strtok(i8* %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%85 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%86 = load i32, i32* @stdin
%87 = call i32 @fgets(i8* %85, i32 200, i32 %86)
%88 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%89 = call i32 @strtok(i8* %88, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%90 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i8* %90)
%92 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.13, i64 0, i64 0), i8* %92)
%94 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%95 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%96 = call i32 @strcncat(i8* %94, i8* %95)
br label %99
97: ; preds = %0
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0))
br label %99
99: ; preds = %97, %78, %67, %48, %28, %16
ret i32 0
}

LLVM IR (-O2):
@.str.6 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [32 x i8] c"The string you entered is: %s.\0A\00"
@.str.10 = [33 x i8] c"The length of the string is %d.\0A\00"
@.str.12 = [38 x i8] c"The first string you entered is: %s.\0A\00"
@.str.13 = [39 x i8] c"The second string you entered is: %s.\0A\00"
@.str.14 = [4 x i8] c"%d\0A\00"
@str = [79 x i8] c"This program tests implementations of a few standard library string functions.\00"
@str.16 = [51 x i8] c"Please enter 1 to find out the length of a string.\00"
@str.17 = [39 x i8] c"Please enter 2 to compare two strings.\00"
@str.18 = [48 x i8] c"Please enter 3 to copy one string into another.\00"
@str.19 = [36 x i8] c"Please enter 4 to reverse a string.\00"
@str.20 = [38 x i8] c"Please enter 5 to append two strings.\00"
@str.24 = [26 x i8] c"Please enter two strings.\00"
@str.25 = [23 x i8] c"Please enter a string.\00"
@str.26 = [14 x i8] c"Wrong choice!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [200 x i8]
%3 = alloca [200 x i8]
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.16, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.17, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.18, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.19, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.20, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%14 = load i32, i32* @stdin
%15 = call i32 @setbuf(i32 %14, i32* null)
%16 = load i32, i32* %1
switch i32 %16, label %66 [
i32 1, label %17
i32 2, label %25
i32 3, label %37
i32 4, label %48
i32 5, label %55
]
17: ; preds = %0
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.25, i64 0, i64 0))
%19 = load i32, i32* @stdin
%20 = call i32 @fgets(i8* %5, i32 200, i32 %19)
%21 = call i32 @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i8* %5)
%23 = call i32 @strlength(i8* %5)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), i32 %23)
br label %68
25: ; preds = %0
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.24, i64 0, i64 0))
%27 = load i32, i32* @stdin
%28 = call i32 @fgets(i8* %5, i32 200, i32 %27)
%29 = call i32 @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%30 = load i32, i32* @stdin
%31 = call i32 @fgets(i8* %6, i32 200, i32 %30)
%32 = call i32 @strtok(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i8* %5)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.13, i64 0, i64 0), i8* %6)
%35 = call i32 @strcmpr(i8* %5, i8* %6)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 %35)
br label %68
37: ; preds = %0
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.24, i64 0, i64 0))
%39 = load i32, i32* @stdin
%40 = call i32 @fgets(i8* %5, i32 200, i32 %39)
%41 = call i32 @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%42 = load i32, i32* @stdin
%43 = call i32 @fgets(i8* %6, i32 200, i32 %42)
%44 = call i32 @strtok(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i8* %5)
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.13, i64 0, i64 0), i8* %6)
%47 = call i32 @strcopy(i8* %5, i8* %6)
br label %68
48: ; preds = %0
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.25, i64 0, i64 0))
%50 = load i32, i32* @stdin
%51 = call i32 @fgets(i8* %5, i32 200, i32 %50)
%52 = call i32 @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i8* %5)
%54 = call i32 @strrevrs(i8* %5)
br label %68
55: ; preds = %0
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.24, i64 0, i64 0))
%57 = load i32, i32* @stdin
%58 = call i32 @fgets(i8* %5, i32 200, i32 %57)
%59 = call i32 @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%60 = load i32, i32* @stdin
%61 = call i32 @fgets(i8* %6, i32 200, i32 %60)
%62 = call i32 @strtok(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i8* %5)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.13, i64 0, i64 0), i8* %6)
%65 = call i32 @strcncat(i8* %5, i8* %6)
br label %68
66: ; preds = %0
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.26, i64 0, i64 0))
br label %68
68: ; preds = %66, %55, %48, %37, %25, %17
ret i32 0
}