#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*/ conversion_demical();
int /*<<< orphan*/ log_num();
int /*<<< orphan*/ multi_arrays();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ simple_acts();
int main(void) {
  char ch;
  printf("Hello!!!\n\n");
  printf("For simple acts like:\n");
  printf("addition    +\n");
  printf("subtraction -\n");
  printf("multiply    *\n");
  printf("division    /\n");
  printf("Press (s)\n");
  printf("===========================\n\n");
  printf("For conversion  decimal\n");
  printf("to binary and hex:\n");
  printf("Press (c)\n");
  printf("===========================\n\n");
  printf("To find log of a number:\n");
  printf("Press (l)\n");
  printf("===========================\n\n");
  printf("To multiply arrays:\n");
  printf("Press (a)\n");
  printf("===========================\n\n");
  scanf("%c", &ch);
  for (;;) {
    if (ch == 's') {
      simple_acts();
    } else if (ch == 'c') {
      conversion_demical();
    } else if (ch == 'l') {
      log_num();
    } else if (ch == 'a') {
      multi_arrays();
    } else
      printf("wrong");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1050 <printf@plt>
lea    0xe89(%rip),%rdi
call   1050 <printf@plt>
lea    0xe94(%rip),%rdi
call   1050 <printf@plt>
lea    0xe97(%rip),%rdi
call   1050 <printf@plt>
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
lea    0xe9d(%rip),%rdi
call   1050 <printf@plt>
lea    0xea0(%rip),%rdi
call   1050 <printf@plt>
lea    0xe9f(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb1(%rip),%rdi
call   1050 <printf@plt>
lea    0xebe(%rip),%rdi
call   1050 <printf@plt>
lea    0xec6(%rip),%rdi
call   1050 <printf@plt>
lea    0xe6f(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb9(%rip),%rdi
call   1050 <printf@plt>
lea    0xec7(%rip),%rdi
call   1050 <printf@plt>
lea    0xe4b(%rip),%rdi
call   1050 <printf@plt>
lea    0xeba(%rip),%rdi
call   1050 <printf@plt>
lea    0xec3(%rip),%rdi
call   1050 <printf@plt>
lea    0xe27(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1080 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x73,%eax
jne    1270 <main+0x110>
mov    $0x0,%al
call   1070 <simple_acts@plt>
jmp    12d6 <main+0x176>
movsbl -0x5(%rbp),%eax
cmp    $0x63,%eax
jne    1289 <main+0x129>
mov    $0x0,%al
call   1030 <conversion_demical@plt>
jmp    12d1 <main+0x171>
movsbl -0x5(%rbp),%eax
cmp    $0x6c,%eax
jne    12a2 <main+0x142>
mov    $0x0,%al
call   1040 <log_num@plt>
jmp    12cc <main+0x16c>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jne    12bb <main+0x15b>
mov    $0x0,%al
call   1060 <multi_arrays@plt>
jmp    12c7 <main+0x167>
lea    0xe45(%rip),%rdi
call   1050 <printf@plt>
jmp    12cc <main+0x16c>
jmp    12d1 <main+0x171>
jmp    12d6 <main+0x176>
jmp    1257 <main+0xf7>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeda(%rip),%rdi
call   1040 <puts@plt>
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
lea    0xee2(%rip),%rdi
call   1040 <puts@plt>
lea    0xee4(%rip),%rdi
call   1040 <puts@plt>
lea    0xee6(%rip),%rdi
call   1040 <puts@plt>
lea    0xee8(%rip),%rdi
call   1040 <puts@plt>
lea    0xeea(%rip),%rdi
call   1040 <puts@plt>
lea    0xf5e(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xed9(%rip),%rdi
call   1040 <puts@plt>
lea    0xee5(%rip),%rdi
call   1040 <puts@plt>
lea    0xeec(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xee2(%rip),%rdi
call   1040 <puts@plt>
lea    0xeef(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xee5(%rip),%rdi
call   1040 <puts@plt>
lea    0xeed(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe02(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1090 <scanf@plt>
lea    0xdf4(%rip),%r14
lea    0xd9e(%rip),%rbx
jmp    1280 <main+0x110>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1070 <multi_arrays@plt>
nopw   0x0(%rax,%rax,1)
movzbl 0x7(%rsp),%eax
add    $0x9f,%al
cmp    $0x12,%al
ja     12a0 <main+0x130>
movzbl %al,%eax
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1030 <conversion_demical@plt>
jmp    1280 <main+0x110>
mov    %r14,%rdi
call   1060 <printf@plt>
jmp    1280 <main+0x110>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <log_num@plt>
jmp    1280 <main+0x110>
nopl   0x0(%rax)
xor    %eax,%eax
call   1080 <simple_acts@plt>
jmp    1280 <main+0x110>

LLVM IR (-O0):
@.str = [11 x i8] c"Hello!!!\0A\0A\00"
@.str.1 = [23 x i8] c"For simple acts like:\0A\00"
@.str.2 = [15 x i8] c"addition +\0A\00"
@.str.3 = [15 x i8] c"subtraction -\0A\00"
@.str.4 = [15 x i8] c"multiply *\0A\00"
@.str.5 = [15 x i8] c"division /\0A\00"
@.str.6 = [11 x i8] c"Press (s)\0A\00"
@.str.7 = [30 x i8] c"===========================\0A\0A\00"
@.str.8 = [25 x i8] c"For conversion decimal\0A\00"
@.str.9 = [20 x i8] c"to binary and hex:\0A\00"
@.str.10 = [11 x i8] c"Press (c)\0A\00"
@.str.11 = [26 x i8] c"To find log of a number:\0A\00"
@.str.12 = [11 x i8] c"Press (l)\0A\00"
@.str.13 = [21 x i8] c"To multiply arrays:\0A\00"
@.str.14 = [11 x i8] c"Press (a)\0A\00"
@.str.15 = [3 x i8] c"%c\00"
@.str.16 = [6 x i8] c"wrong\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0), i8* %2)
br label %22
22: ; preds = %51, %0
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 115
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 (...) @simple_acts()
br label %51
28: ; preds = %22
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 99
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 (...) @conversion_demical()
br label %50
34: ; preds = %28
%35 = load i8, i8* %2
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 108
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 (...) @log_num()
br label %49
40: ; preds = %34
%41 = load i8, i8* %2
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 97
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = call i32 (...) @multi_arrays()
br label %48
46: ; preds = %40
%47 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0))
br label %48
48: ; preds = %46, %44
br label %49
49: ; preds = %48, %38
br label %50
50: ; preds = %49, %32
br label %51
51: ; preds = %50, %26
br label %22
}

LLVM IR (-O2):
@.str.15 = [3 x i8] c"%c\00"
@.str.16 = [6 x i8] c"wrong\00"
@str = [10 x i8] c"Hello!!!\0A\00"
@str.17 = [22 x i8] c"For simple acts like:\00"
@str.18 = [14 x i8] c"addition +\00"
@str.19 = [14 x i8] c"subtraction -\00"
@str.20 = [14 x i8] c"multiply *\00"
@str.21 = [14 x i8] c"division /\00"
@str.22 = [10 x i8] c"Press (s)\00"
@str.24 = [24 x i8] c"For conversion decimal\00"
@str.25 = [19 x i8] c"to binary and hex:\00"
@str.26 = [10 x i8] c"Press (c)\00"
@str.28 = [25 x i8] c"To find log of a number:\00"
@str.29 = [10 x i8] c"Press (l)\00"
@str.31 = [20 x i8] c"To multiply arrays:\00"
@str.32 = [10 x i8] c"Press (a)\00"
@str.33 = [29 x i8] c"===========================\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.17, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.18, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.19, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.20, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.21, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.22, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.33, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.24, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.25, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.26, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.33, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.28, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.29, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.33, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.31, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.32, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.33, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0), i8* %1)
br label %21
21: ; preds = %27, %0
%22 = load i8, i8* %1
switch i8 %22, label %32 [
i8 115, label %23
i8 99, label %25
i8 108, label %28
i8 97, label %30
]
23: ; preds = %21
%24 = call i32 (...) @simple_acts()
br label %27
25: ; preds = %21
%26 = call i32 (...) @conversion_demical()
br label %27
27: ; preds = %25, %30, %32, %28, %23
br label %21
28: ; preds = %21
%29 = call i32 (...) @log_num()
br label %27
30: ; preds = %21
%31 = call i32 (...) @multi_arrays()
br label %27
32: ; preds = %21
%33 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0))
br label %27
}