#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ system(char *);
int menu_function(void) {
  int choice;
  int poly = 1;
  int exp = 2;
  int sincos = 3;
  int exit = 4;
  do {
    system("clear");
    fprintf(stdout, "Select The Type Of FUnction : \n\n");
    fprintf(stdout, "1) Polynomial \n");
    fprintf(stdout, "2) a*e^x + b*x^n \n");
    fprintf(stdout, "3) A*sin(lx+t) + B*cos(mx+p) \n");
    fprintf(stdout, "4) Exit \n\n");
    fprintf(stdout, "Choice : ");
    scanf("%i", &choice);
  } while (choice != poly && choice != exp && choice != sincos &&
           choice != exit);
  return choice;
}


x86 assembly (clang, -O0):
<menu_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
lea    0xea5(%rip),%rdi
call   1030 <system@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe96(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
lea    0xea2(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xe99(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x15(%rbp)
je     122d <menu_function+0xfd>
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x15(%rbp)
je     122d <menu_function+0xfd>
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
cmp    -0x10(%rbp),%ecx
mov    %al,-0x15(%rbp)
je     122d <menu_function+0xfd>
mov    -0x4(%rbp),%eax
cmp    -0x14(%rbp),%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1154 <menu_function+0x24>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_function>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e9e(%rip),%r13
lea    0xf01(%rip),%rbx
lea    0xf19(%rip),%rbp
lea    0xf1d(%rip),%r14
lea    0xf20(%rip),%r15
lea    0x4(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe89(%rip),%rdi
call   1030 <system@plt>
mov    0x0(%r13),%edi
lea    0xe7f(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xe90(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xe90(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
mov    %rbx,%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
mov    %rbp,%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
mov    %r14,%rsi
call   1040 <fprintf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x3,%ecx
ja     1170 <menu_function+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@stdout = global i32 0
@.str.1 = [33 x i8] c"Select The Type Of FUnction : \0A\0A\00"
@.str.2 = [16 x i8] c"1) Polynomial \0A\00"
@.str.3 = [19 x i8] c"2) a*e^x + b*x^n \0A\00"
@.str.4 = [31 x i8] c"3) A*sin(lx+t) + B*cos(mx+p) \0A\00"
@.str.5 = [11 x i8] c"4) Exit \0A\0A\00"
@.str.6 = [10 x i8] c"Choice : \00"
@.str.7 = [3 x i8] c"%i\00"
define i32 @menu_function() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 1, i32* %2
store i32 2, i32* %3
store i32 3, i32* %4
store i32 4, i32* %5
br label %6
6: ; preds = %37, %0
%7 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stdout
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @stdout
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* @stdout
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%14 = load i32, i32* @stdout
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%16 = load i32, i32* @stdout
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%18 = load i32, i32* @stdout
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %1)
br label %21
21: ; preds = %6
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = icmp ne i32 %22, %23
br i1 %24, label %25, label %37
25: ; preds = %21
%26 = load i32, i32* %1
%27 = load i32, i32* %3
%28 = icmp ne i32 %26, %27
br i1 %28, label %29, label %37
29: ; preds = %25
%30 = load i32, i32* %1
%31 = load i32, i32* %4
%32 = icmp ne i32 %30, %31
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load i32, i32* %1
%35 = load i32, i32* %5
%36 = icmp ne i32 %34, %35
br label %37
37: ; preds = %33, %29, %25, %21
%38 = phi i1 [ false, %29 ], [ false, %25 ], [ false, %21 ], [ %36, %33 ]
br i1 %38, label %6, label %39
39: ; preds = %37
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@stdout = global i32 0
@.str.1 = [33 x i8] c"Select The Type Of FUnction : \0A\0A\00"
@.str.2 = [16 x i8] c"1) Polynomial \0A\00"
@.str.3 = [19 x i8] c"2) a*e^x + b*x^n \0A\00"
@.str.4 = [31 x i8] c"3) A*sin(lx+t) + B*cos(mx+p) \0A\00"
@.str.5 = [11 x i8] c"4) Exit \0A\0A\00"
@.str.6 = [10 x i8] c"Choice : \00"
@.str.7 = [3 x i8] c"%i\00"
define i32 @menu_function() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stdout
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @stdout
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* @stdout
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%11 = load i32, i32* @stdout
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%13 = load i32, i32* @stdout
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%15 = load i32, i32* @stdout
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%18 = load i32, i32* %1
%19 = add i32 %18, -1
%20 = icmp ult i32 %19, 4
br i1 %20, label %21, label %3
21: ; preds = %3
ret i32 %18
}