#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ funArea();
int /*<<< orphan*/ funHello();
int /*<<< orphan*/ funTempArray(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int iAns;
  int g = 0;
  do {
    system("cls");
    printf("0-exit\n");
    printf("1-hello\n");
    printf("2-area\n");
    printf("3-Temp Array\n");
    printf("enter your choice ");
    scanf("%d", &iAns);
    switch (iAns) {
    case 0:
      exit(0);
    case 1:
      funHello();
      break;
    case 2:
      funArea();
      break;
    case 3:
      printf("please enter count ");
      scanf("%d", &g);
      funTempArray(g);
      break;
    default:
      printf("wrong input, try again \n");
      system("pause");
      break;
    }
  } while (iAns != 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe83(%rip),%rdi
call   1040 <system@plt>
lea    0xe7b(%rip),%rdi
call   1050 <printf@plt>
lea    0xe77(%rip),%rdi
call   1050 <printf@plt>
lea    0xe74(%rip),%rdi
call   1050 <printf@plt>
lea    0xe70(%rip),%rdi
call   1050 <printf@plt>
lea    0xe72(%rip),%rdi
call   1050 <printf@plt>
lea    0xe79(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x3,%rax
ja     124b <main+0xdb>
mov    -0x18(%rbp),%rax
lea    0xe06(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %edi,%edi
call   1080 <exit@plt>
mov    $0x0,%al
call   1060 <funHello@plt>
jmp    1263 <main+0xf3>
mov    $0x0,%al
call   1090 <funArea@plt>
jmp    1263 <main+0xf3>
lea    0xe28(%rip),%rdi
call   1050 <printf@plt>
lea    0xe19(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1030 <funTempArray@plt>
jmp    1263 <main+0xf3>
lea    0xe13(%rip),%rdi
call   1050 <printf@plt>
lea    0xe20(%rip),%rdi
call   1040 <system@plt>
jmp    1268 <main+0xf8>
cmpl   $0x0,-0x8(%rbp)
jne    1186 <main+0x16>
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
movl   $0x0,(%rsp)
lea    0xeba(%rip),%r13
lea    0xeba(%rip),%rbx
lea    0xe6d(%rip),%rbp
lea    0xe79(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xe46(%rip),%r12
jmp    11e3 <main+0x63>
nopl   0x0(%rax)
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6b(%rip),%rdi
call   1050 <system@plt>
cmpl   $0x0,0x4(%rsp)
je     1284 <main+0x104>
lea    0xe26(%rip),%rdi
call   1050 <system@plt>
lea    0xe4e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe49(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%rax
ja     11c0 <main+0x40>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
xor    %eax,%eax
call   1070 <funHello@plt>
jmp    11d8 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   10a0 <funArea@plt>
jmp    11d8 <main+0x58>
nopl   0x0(%rax)
lea    0xdc3(%rip),%rdi
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %rsp,%rsi
call   1080 <scanf@plt>
mov    (%rsp),%edi
call   1040 <funTempArray@plt>
jmp    11d8 <main+0x58>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [8 x i8] c"0-exit\0A\00"
@.str.2 = [9 x i8] c"1-hello\0A\00"
@.str.3 = [8 x i8] c"2-area\0A\00"
@.str.4 = [14 x i8] c"3-Temp Array\0A\00"
@.str.5 = [19 x i8] c"enter your choice \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [20 x i8] c"please enter count \00"
@.str.8 = [25 x i8] c"wrong input, try again \0A\00"
@.str.9 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %28, %0
%5 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
switch i32 %12, label %24 [
i32 0, label %13
i32 1, label %15
i32 2, label %17
i32 3, label %19
]
13: ; preds = %4
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %4
%16 = call i32 (...) @funHello()
br label %27
17: ; preds = %4
%18 = call i32 (...) @funArea()
br label %27
19: ; preds = %4
%20 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%22 = load i32, i32* %3
%23 = call i32 @funTempArray(i32 %22)
br label %27
24: ; preds = %4
%25 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
%26 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %27
27: ; preds = %24, %19, %17, %15
br label %28
28: ; preds = %27
%29 = load i32, i32* %2
%30 = icmp ne i32 %29, 0
br i1 %30, label %4, label %31
31: ; preds = %28
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.5 = [19 x i8] c"enter your choice \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [20 x i8] c"please enter count \00"
@.str.9 = [6 x i8] c"pause\00"
@str = [7 x i8] c"0-exit\00"
@str.10 = [8 x i8] c"1-hello\00"
@str.11 = [7 x i8] c"2-area\00"
@str.12 = [13 x i8] c"3-Temp Array\00"
@str.13 = [24 x i8] c"wrong input, try again \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
br label %5
5: ; preds = %28, %0
%6 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.10, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.11, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.12, i64 0, i64 0))
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 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* %1)
%13 = load i32, i32* %1
switch i32 %13, label %25 [
i32 0, label %14
i32 1, label %16
i32 2, label %18
i32 3, label %20
]
14: ; preds = %5
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %5
%17 = call i32 (...) @funHello()
br label %28
18: ; preds = %5
%19 = call i32 (...) @funArea()
br label %28
20: ; preds = %5
%21 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%23 = load i32, i32* %2
%24 = call i32 @funTempArray(i32 %23)
br label %28
25: ; preds = %5
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.13, i64 0, i64 0))
%27 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %28
28: ; preds = %16, %18, %20, %25
%29 = load i32, i32* %1
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %5
31: ; preds = %28
ret i32 0
}