#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_root(int mode, int conv) {
  int choice;
  int dico = 1;
  int cords = 2;
  int newt = 3;
  int exit = 4;
  do {
    system("clear");
    fprintf(stdout, "Select The Method To Use : \n\n");
    fprintf(stdout, "1) Dicotomic\n");
    fprintf(stdout, "2) Cords");
    if (mode != 3) {
      fprintf(stdout, "  [ Recursive ]");
    }
    if (conv < 5) {
      fprintf(stdout, "  [ NO !!! First Derivate Not Continuous ]");
    }
    fprintf(stdout, " \n");
    fprintf(stdout, "3) Newton  [ Recursive ]");
    if (conv < 7) {
      fprintf(stdout, "  [ NO !!! First Derivative Not Monotone ]");
    }
    fprintf(stdout, " \n");
    fprintf(stdout, "4) Exit\n\n");
    fprintf(stdout, "Choice : ");
    scanf("%i", &choice);
  } while (choice != dico && choice != cords && choice != newt &&
           choice != exit);
  return choice;
}


x86 assembly (clang, -O0):
<menu_root>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
movl   $0x3,-0x18(%rbp)
movl   $0x4,-0x1c(%rbp)
lea    0xe9f(%rip),%rdi
call   1030 <system@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xe99(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
call   1040 <fprintf@plt>
cmpl   $0x3,-0x4(%rbp)
je     11c4 <menu_root+0x94>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
cmpl   $0x5,-0x8(%rbp)
jge    11e3 <menu_root+0xb3>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
lea    0xe73(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
lea    0xe61(%rip),%rsi
call   1040 <fprintf@plt>
cmpl   $0x7,-0x8(%rbp)
jge    122c <menu_root+0xfc>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
lea    0xe5b(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2d98(%rip),%rax
mov    (%rax),%edi
lea    0xe5c(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2d83(%rip),%rax
mov    (%rax),%edi
lea    0xe51(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xe4f(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x10(%rbp),%ecx
mov    %al,-0x1d(%rbp)
je     12ba <menu_root+0x18a>
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x1d(%rbp)
je     12ba <menu_root+0x18a>
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x18(%rbp),%ecx
mov    %al,-0x1d(%rbp)
je     12ba <menu_root+0x18a>
mov    -0xc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    115a <menu_root+0x2a>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_root>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x2e9a(%rip),%r13
lea    0xf19(%rip),%r14
lea    0xf6d(%rip),%r15
lea    0x4(%rsp),%r12
jmp    11a7 <menu_root+0x77>
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
mov    %r14,%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xf36(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xf30(%rip),%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
jbe    1247 <menu_root+0x117>
lea    0xe52(%rip),%rdi
call   1030 <system@plt>
mov    0x0(%r13),%edi
lea    0xe48(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xe56(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xe54(%rip),%rsi
call   1040 <fprintf@plt>
cmp    $0x3,%ebp
je     11f8 <menu_root+0xc8>
mov    0x0(%r13),%edi
lea    0xe7f(%rip),%rsi
call   1040 <fprintf@plt>
cmp    $0x4,%ebx
jg     120d <menu_root+0xdd>
mov    0x0(%r13),%edi
lea    0xe33(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
mov    %r14,%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xe45(%rip),%rsi
call   1040 <fprintf@plt>
cmp    $0x6,%ebx
jg     1160 <menu_root+0x30>
mov    0x0(%r13),%edi
lea    0xe45(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1160 <menu_root+0x30>
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 = [30 x i8] c"Select The Method To Use : \0A\0A\00"
@.str.2 = [14 x i8] c"1) Dicotomic\0A\00"
@.str.3 = [9 x i8] c"2) Cords\00"
@.str.4 = [16 x i8] c" [ Recursive ]\00"
@.str.5 = [43 x i8] c" [ NO !!! First Derivate Not Continuous ]\00"
@.str.6 = [3 x i8] c" \0A\00"
@.str.7 = [25 x i8] c"3) Newton [ Recursive ]\00"
@.str.8 = [43 x i8] c" [ NO !!! First Derivative Not Monotone ]\00"
@.str.9 = [10 x i8] c"4) Exit\0A\0A\00"
@.str.10 = [10 x i8] c"Choice : \00"
@.str.11 = [3 x i8] c"%i\00"
define i32 @menu_root(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1, i32* %6
store i32 2, i32* %7
store i32 3, i32* %8
store i32 4, i32* %9
br label %10
10: ; preds = %63, %2
%11 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @stdout
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* @stdout
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%16 = load i32, i32* @stdout
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32, i32* %3
%19 = icmp ne i32 %18, 3
br i1 %19, label %20, label %23
20: ; preds = %10
%21 = load i32, i32* @stdout
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %23
23: ; preds = %20, %10
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 5
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32, i32* @stdout
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
br label %29
29: ; preds = %26, %23
%30 = load i32, i32* @stdout
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%32 = load i32, i32* @stdout
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%34 = load i32, i32* %4
%35 = icmp slt i32 %34, 7
br i1 %35, label %36, label %39
36: ; preds = %29
%37 = load i32, i32* @stdout
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0))
br label %39
39: ; preds = %36, %29
%40 = load i32, i32* @stdout
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%42 = load i32, i32* @stdout
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%44 = load i32, i32* @stdout
%45 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32* %5)
br label %47
47: ; preds = %39
%48 = load i32, i32* %5
%49 = load i32, i32* %6
%50 = icmp ne i32 %48, %49
br i1 %50, label %51, label %63
51: ; preds = %47
%52 = load i32, i32* %5
%53 = load i32, i32* %7
%54 = icmp ne i32 %52, %53
br i1 %54, label %55, label %63
55: ; preds = %51
%56 = load i32, i32* %5
%57 = load i32, i32* %8
%58 = icmp ne i32 %56, %57
br i1 %58, label %59, label %63
59: ; preds = %55
%60 = load i32, i32* %5
%61 = load i32, i32* %9
%62 = icmp ne i32 %60, %61
br label %63
63: ; preds = %59, %55, %51, %47
%64 = phi i1 [ false, %55 ], [ false, %51 ], [ false, %47 ], [ %62, %59 ]
br i1 %64, label %10, label %65
65: ; preds = %63
%66 = load i32, i32* %5
ret i32 %66
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@stdout = global i32 0
@.str.1 = [30 x i8] c"Select The Method To Use : \0A\0A\00"
@.str.2 = [14 x i8] c"1) Dicotomic\0A\00"
@.str.3 = [9 x i8] c"2) Cords\00"
@.str.4 = [16 x i8] c" [ Recursive ]\00"
@.str.5 = [43 x i8] c" [ NO !!! First Derivate Not Continuous ]\00"
@.str.6 = [3 x i8] c" \0A\00"
@.str.7 = [25 x i8] c"3) Newton [ Recursive ]\00"
@.str.8 = [43 x i8] c" [ NO !!! First Derivative Not Monotone ]\00"
@.str.9 = [10 x i8] c"4) Exit\0A\0A\00"
@.str.10 = [10 x i8] c"Choice : \00"
@.str.11 = [3 x i8] c"%i\00"
define i32 @menu_root(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %0, 3
%6 = icmp slt i32 %1, 5
%7 = icmp slt i32 %1, 7
br label %8
8: ; preds = %31, %2
%9 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @stdout
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @stdout
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* @stdout
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br i1 %5, label %19, label %16
16: ; preds = %8
%17 = load i32, i32* @stdout
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %16, %8
br i1 %6, label %20, label %23
20: ; preds = %19
%21 = load i32, i32* @stdout
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
br label %23
23: ; preds = %20, %19
%24 = load i32, i32* @stdout
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%26 = load i32, i32* @stdout
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br i1 %7, label %28, label %31
28: ; preds = %23
%29 = load i32, i32* @stdout
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0))
br label %31
31: ; preds = %28, %23
%32 = load i32, i32* @stdout
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%34 = load i32, i32* @stdout
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%36 = load i32, i32* @stdout
%37 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32* %3)
%39 = load i32, i32* %3
%40 = add i32 %39, -1
%41 = icmp ult i32 %40, 4
br i1 %41, label %42, label %8
42: ; preds = %31
ret i32 %39
}