#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 atoi_2(char *);
int /*<<< orphan*/ clean_text(char *);
int getarray_sort(int *, char *);
int /*<<< orphan*/ getline_my(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ reverse_string(char *);
int /*<<< orphan*/ shellsort(int *, int);
void main() {
  char line[100];
  int digit = 0;
  int len = 0;
  int i = 0;
  char choise = 0;
  int sort[100];
  char exit = 0;
  printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
         "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
  printf("Chase please what you want to do:\n");
  printf("Variants :\n");
  printf("1. Convert from char to integer.\n");
  printf("2. Shellsorting.\n");
  printf("3. Reverse string.\n");
  exit = 0;
  while (exit == 0) {
    getline_my(line);
    choise = line[0];
    switch (choise) {
    case '1':
      clean_text(line);
      printf("Input please chars to convert to integer:\n");
      getline_my(line);
      digit = atoi_2(line);
      printf("Getted digit from char = %d;\n", digit);
      exit = 1;
      break;
    case '2':
      len = getarray_sort(sort, line);
      shellsort(sort, len);
      printf("After sorting array seems so:");
      for (i = 0; i < len; ++i) {
        printf("%d,", sort[i]);
      };
      printf("\n");
      exit = 1;
      break;
    case '3':
      printf("Enter please line to reverse:\n");
      clean_text(line);
      getline_my(line);
      reverse_string(line);
      printf("After reverse string seens so:\n%s\n", line);
      exit = 1;
      break;
    default:
      printf("Wrong input, try again.\n");
      break;
    };
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
movb   $0x0,-0x7d(%rbp)
movb   $0x0,-0x211(%rbp)
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x0,-0x211(%rbp)
movsbl -0x211(%rbp),%eax
cmp    $0x0,%eax
jne    137c <main+0x20c>
lea    -0x70(%rbp),%rdi
call   1060 <getline_my@plt>
mov    -0x70(%rbp),%al
mov    %al,-0x7d(%rbp)
movsbl -0x7d(%rbp),%eax
mov    %eax,-0x218(%rbp)
sub    $0x31,%eax
je     1255 <main+0xe5>
jmp    122d <main+0xbd>
mov    -0x218(%rbp),%eax
sub    $0x32,%eax
je     129e <main+0x12e>
jmp    1241 <main+0xd1>
mov    -0x218(%rbp),%eax
sub    $0x33,%eax
je     1322 <main+0x1b2>
jmp    1369 <main+0x1f9>
lea    -0x70(%rbp),%rdi
call   1090 <clean_text@plt>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1060 <getline_my@plt>
lea    -0x70(%rbp),%rdi
call   1050 <atoi_2@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x1,-0x211(%rbp)
jmp    1377 <main+0x207>
lea    -0x210(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1070 <getarray_sort@plt>
mov    %eax,-0x78(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x78(%rbp),%esi
call   1080 <shellsort@plt>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x78(%rbp),%eax
jge    1308 <main+0x198>
movslq -0x7c(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%esi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    12d5 <main+0x165>
lea    0xd23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x1,-0x211(%rbp)
jmp    1377 <main+0x207>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1090 <clean_text@plt>
lea    -0x70(%rbp),%rdi
call   1060 <getline_my@plt>
lea    -0x70(%rbp),%rdi
call   1030 <reverse_string@plt>
lea    -0x70(%rbp),%rsi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x1,-0x211(%rbp)
jmp    1377 <main+0x207>
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f6 <main+0x86>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
lea    0xec0(%rip),%rdi
call   1050 <puts@plt>
lea    0xee7(%rip),%rdi
call   1050 <puts@plt>
lea    0xefd(%rip),%rdi
call   1050 <puts@plt>
lea    0xefc(%rip),%rdi
call   1050 <puts@plt>
lea    0xf11(%rip),%rdi
call   1050 <puts@plt>
lea    0xf16(%rip),%rdi
call   1050 <puts@plt>
mov    %rsp,%rbx
lea    0xf62(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1080 <getline_my@plt>
movsbl (%rsp),%eax
cmp    $0x33,%eax
je     1219 <main+0x89>
cmp    $0x32,%eax
je     1256 <main+0xc6>
cmp    $0x31,%eax
je     12b3 <main+0x123>
mov    %r14,%rdi
call   1050 <puts@plt>
jmp    11f0 <main+0x60>
lea    0xee8(%rip),%rdi
call   1050 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   10b0 <clean_text@plt>
mov    %rbx,%rdi
call   1080 <getline_my@plt>
mov    %rbx,%rdi
call   1040 <reverse_string@plt>
lea    0xdf9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    12ea <main+0x15a>
lea    0x70(%rsp),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1090 <getarray_sort@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
call   10a0 <shellsort@plt>
lea    0xda5(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
test   %ebx,%ebx
jle    12a7 <main+0x117>
mov    %ebx,%r15d
lea    0xdae(%rip),%r14
xor    %ebx,%ebx
mov    0x70(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1290 <main+0x100>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    12ea <main+0x15a>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   10b0 <clean_text@plt>
lea    0xe61(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1080 <getline_my@plt>
mov    %rbx,%rdi
call   1070 <atoi_2@plt>
lea    0xd1f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [52 x i8] c"\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\00"
@.str.1 = [35 x i8] c"Chase please what you want to do:\0A\00"
@.str.2 = [12 x i8] c"Variants :\0A\00"
@.str.3 = [34 x i8] c"1. Convert from char to integer.\0A\00"
@.str.4 = [18 x i8] c"2. Shellsorting.\0A\00"
@.str.5 = [20 x i8] c"3. Reverse string.\0A\00"
@.str.6 = [43 x i8] c"Input please chars to convert to integer:\0A\00"
@.str.7 = [30 x i8] c"Getted digit from char = %d;\0A\00"
@.str.8 = [30 x i8] c"After sorting array seems so:\00"
@.str.9 = [4 x i8] c"%d,\00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [31 x i8] c"Enter please line to reverse:\0A\00"
@.str.12 = [35 x i8] c"After reverse string seens so:\0A%s\0A\00"
@.str.13 = [25 x i8] c"Wrong input, try again.\0A\00"
define void @main() {
%1 = alloca [100 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca [100 x i32]
%7 = alloca i8
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i8 0, i8* %5
store i8 0, i8* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
store i8 0, i8* %7
br label %14
14: ; preds = %70, %0
%15 = load i8, i8* %7
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %71
18: ; preds = %14
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%20 = call i32 @getline_my(i8* %19)
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%22 = load i8, i8* %21
store i8 %22, i8* %5
%23 = load i8, i8* %5
%24 = sext i8 %23 to i32
switch i32 %24, label %68 [
i32 49, label %25
i32 50, label %35
i32 51, label %58
]
25: ; preds = %18
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%27 = call i32 @clean_text(i8* %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0))
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%30 = call i32 @getline_my(i8* %29)
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%32 = call i32 @atoi_2(i8* %31)
store i32 %32, i32* %2
%33 = load i32, i32* %2
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i32 %33)
store i8 1, i8* %7
br label %70
35: ; preds = %18
%36 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 0
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%38 = call i32 @getarray_sort(i32* %36, i8* %37)
store i32 %38, i32* %3
%39 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 0
%40 = load i32, i32* %3
%41 = call i32 @shellsort(i32* %39, i32 %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %4
br label %43
43: ; preds = %53, %35
%44 = load i32, i32* %4
%45 = load i32, i32* %3
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %56
47: ; preds = %43
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %47
%54 = load i32, i32* %4
%55 = add nsw i32 %54, 1
store i32 %55, i32* %4
br label %43
56: ; preds = %43
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i8 1, i8* %7
br label %70
58: ; preds = %18
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%61 = call i32 @clean_text(i8* %60)
%62 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%63 = call i32 @getline_my(i8* %62)
%64 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%65 = call i32 @reverse_string(i8* %64)
%66 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i8* %66)
store i8 1, i8* %7
br label %70
68: ; preds = %18
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0))
br label %70
70: ; preds = %68, %58, %56, %25
br label %14
71: ; preds = %14
ret void
}

LLVM IR (-O2):
@.str.7 = [30 x i8] c"Getted digit from char = %d;\0A\00"
@.str.8 = [30 x i8] c"After sorting array seems so:\00"
@.str.9 = [4 x i8] c"%d,\00"
@.str.12 = [35 x i8] c"After reverse string seens so:\0A%s\0A\00"
@str = [51 x i8] c"\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\00"
@str.14 = [34 x i8] c"Chase please what you want to do:\00"
@str.15 = [11 x i8] c"Variants :\00"
@str.16 = [33 x i8] c"1. Convert from char to integer.\00"
@str.17 = [17 x i8] c"2. Shellsorting.\00"
@str.18 = [19 x i8] c"3. Reverse string.\00"
@str.19 = [30 x i8] c"Enter please line to reverse:\00"
@str.20 = [42 x i8] c"Input please chars to convert to integer:\00"
@str.21 = [24 x i8] c"Wrong input, try again.\00"
define void @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i32]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = bitcast [100 x i32]* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.14, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.15, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.16, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.17, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.18, i64 0, i64 0))
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
br label %12
12: ; preds = %44, %0
%13 = call i32 @getline_my(i8* %3)
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
switch i32 %15, label %44 [
i32 49, label %16
i32 50, label %22
i32 51, label %38
]
16: ; preds = %12
%17 = call i32 @clean_text(i8* %3)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.20, i64 0, i64 0))
%19 = call i32 @getline_my(i8* %3)
%20 = call i32 @atoi_2(i8* %3)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i32 %20)
br label %46
22: ; preds = %12
%23 = call i32 @getarray_sort(i32* %11, i8* %3)
%24 = call i32 @shellsort(i32* %11, i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
%26 = icmp sgt i32 %23, 0
br i1 %26, label %27, label %36
27: ; preds = %22
%28 = zext i32 %23 to i64
br label %29
29: ; preds = %27, %29
%30 = phi i64 [ 0, %27 ], [ %34, %29 ]
%31 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %32)
%34 = add nuw nsw i64 %30, 1
%35 = icmp eq i64 %34, %28
br i1 %35, label %36, label %29
36: ; preds = %29, %22
%37 = call i32 @putchar(i32 10)
br label %46
38: ; preds = %12
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.19, i64 0, i64 0))
%40 = call i32 @clean_text(i8* %3)
%41 = call i32 @getline_my(i8* %3)
%42 = call i32 @reverse_string(i8* %3)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i8* %3)
br label %46
44: ; preds = %12
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.21, i64 0, i64 0))
br label %12
46: ; preds = %38, %36, %16
ret void
}