#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*/ connected_list_string();
char getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stroe_in_memory();
int main(void) {
  int again = 1;
  char choise = '\0';
  while (again > 0) {
    printf("\nplease chose how to store the input:\n");
    printf("1. connected list\n");
    printf("2. array in memory\n");
    printf("enter your chose:");
    choise = getchar();
    getchar();
    printf("\nStart to enter your string\n");
    switch (choise) {
    case '1':
      connected_list_string();
      again = 0;
      break;
    case '2':
      stroe_in_memory();
      again = 0;
      break;
    default:
      printf("\nSorry but this option dosn't exist in the menu, please try "
             "again\n\n\n");
      getchar();
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    121b <main+0xdb>
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   1050 <getchar@plt>
mov    %al,%cl
mov    -0x11(%rbp),%al
mov    %cl,-0x9(%rbp)
call   1050 <getchar@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x31,%eax
je     11dd <main+0x9d>
jmp    11cc <main+0x8c>
mov    -0x10(%rbp),%eax
sub    $0x32,%eax
je     11f0 <main+0xb0>
jmp    1203 <main+0xc3>
mov    $0x0,%al
call   1060 <connected_list_string@plt>
movl   $0x0,-0x8(%rbp)
jmp    1216 <main+0xd6>
mov    $0x0,%al
call   1030 <stroe_in_memory@plt>
movl   $0x0,-0x8(%rbp)
jmp    1216 <main+0xd6>
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
jmp    115a <main+0x1a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xed6(%rip),%r15
lea    0xee1(%rip),%r12
lea    0xe90(%rip),%r13
lea    0xee6(%rip),%rbx
lea    0xefb(%rip),%rbp
xchg   %ax,%ax
lea    0xe8b(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
movsbl %r14b,%eax
cmp    $0x32,%eax
je     11dc <main+0x8c>
cmp    $0x31,%eax
je     11e5 <main+0x95>
mov    %rbp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
jmp    1180 <main+0x30>
xor    %eax,%eax
call   1040 <stroe_in_memory@plt>
jmp    11ec <main+0x9c>
xor    %eax,%eax
call   1070 <connected_list_string@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"\0Aplease chose how to store the input:\0A\00"
@.str.1 = [19 x i8] c"1. connected list\0A\00"
@.str.2 = [20 x i8] c"2. array in memory\0A\00"
@.str.3 = [18 x i8] c"enter your chose:\00"
@.str.4 = [29 x i8] c"\0AStart to enter your string\0A\00"
@.str.5 = [69 x i8] c"\0ASorry but this option dosn't exist in the menu, please try again\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
store i32 1, i32* %2
store i8 0, i8* %3
br label %4
4: ; preds = %24, %0
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %25
7: ; preds = %4
%8 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%12 = call signext i8 (...) @getchar()
store i8 %12, i8* %3
%13 = call signext i8 (...) @getchar()
%14 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
switch i32 %16, label %21 [
i32 49, label %17
i32 50, label %19
]
17: ; preds = %7
%18 = call i32 (...) @connected_list_string()
store i32 0, i32* %2
br label %24
19: ; preds = %7
%20 = call i32 (...) @stroe_in_memory()
store i32 0, i32* %2
br label %24
21: ; preds = %7
%22 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.5, i64 0, i64 0))
%23 = call signext i8 (...) @getchar()
br label %24
24: ; preds = %21, %19, %17
br label %4
25: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [18 x i8] c"enter your chose:\00"
@str = [38 x i8] c"\0Aplease chose how to store the input:\00"
@str.6 = [18 x i8] c"1. connected list\00"
@str.7 = [19 x i8] c"2. array in memory\00"
@str.8 = [28 x i8] c"\0AStart to enter your string\00"
@str.9 = [68 x i8] c"\0ASorry but this option dosn't exist in the menu, please try again\0A\0A\00"
define i32 @main() {
br label %1
1: ; preds = %14, %0
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call signext i8 (...) @getchar()
%7 = tail call signext i8 (...) @getchar()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.8, i64 0, i64 0))
%9 = sext i8 %6 to i32
switch i32 %9, label %14 [
i32 49, label %10
i32 50, label %12
]
10: ; preds = %1
%11 = tail call i32 (...) @connected_list_string()
br label %17
12: ; preds = %1
%13 = tail call i32 (...) @stroe_in_memory()
br label %17
14: ; preds = %1
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str.9, i64 0, i64 0))
%16 = tail call signext i8 (...) @getchar()
br label %1
17: ; preds = %12, %10
ret i32 0
}