#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_integ(double root, double error, long int inter) {
  int choice;
  int rect = 1;
  int trap = 2;
  int simps = 3;
  int exit = 4;
  do {
    system("clear");
    fprintf(stdout, "Function's Root [interaction = %li ] : %lf", inter, root);
    if (error == 0.) {
      fprintf(stdout, " ± %lf\n", error);
    } else {
      fprintf(stdout, "\n");
    }
    fprintf(stdout, "Select The Method To Use : \n\n");
    fprintf(stdout, "1) Method Of Rectangles\n");
    fprintf(stdout, "2) Method Of Trapezis\n");
    fprintf(stdout, "3) Cavalieri-Simpson's Method (Parabola)\n");
    fprintf(stdout, "4) Exit\n\n");
    fprintf(stdout, "Choice : ");
    scanf("%i", &choice);
  } while (choice != rect && choice != trap && choice != simps &&
           choice != exit);
  return choice;
}


x86 assembly (clang, -O0):
<menu_integ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x2,-0x24(%rbp)
movl   $0x3,-0x28(%rbp)
movl   $0x4,-0x2c(%rbp)
lea    0xe97(%rip),%rdi
call   1030 <system@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
movsd  -0x8(%rbp),%xmm0
lea    0xe7f(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c7 <menu_integ+0x97>
jp     11c7 <menu_integ+0x97>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
movsd  -0x10(%rbp),%xmm0
lea    0xe76(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
jmp    11de <menu_integ+0xae>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
lea    0xe4c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
lea    0xe5b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    0xe57(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x1c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x20(%rbp),%ecx
mov    %al,-0x2d(%rbp)
je     12b7 <menu_integ+0x187>
mov    -0x1c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x24(%rbp),%ecx
mov    %al,-0x2d(%rbp)
je     12b7 <menu_integ+0x187>
mov    -0x1c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x28(%rbp),%ecx
mov    %al,-0x2d(%rbp)
je     12b7 <menu_integ+0x187>
mov    -0x1c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
setne  %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%al
test   $0x1,%al
jne    1162 <menu_integ+0x32>
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_integ>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    0x2e8c(%rip),%r14
lea    0xf5f(%rip),%r15
lea    0xf62(%rip),%r13
lea    0xf65(%rip),%rbp
lea    0x4(%rsp),%r12
jmp    1203 <menu_integ+0xd3>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xed7(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xeaa(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xeb7(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xebf(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
lea    0xec5(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r14),%edi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x3,%ecx
jbe    1259 <menu_integ+0x129>
lea    0xdfe(%rip),%rdi
call   1030 <system@plt>
mov    (%r14),%edi
lea    0xdf5(%rip),%rsi
mov    %rbx,%rdx
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <fprintf@plt>
movsd  0x10(%rsp),%xmm0
ucomisd 0xdc9(%rip),%xmm0
mov    (%r14),%edi
jne    1180 <menu_integ+0x50>
jp     1180 <menu_integ+0x50>
lea    0xdec(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
jmp    118e <menu_integ+0x5e>
add    $0x18,%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 = [43 x i8] c"Function's Root [interaction = %li ] : %lf\00"
@.str.2 = [9 x i8] c" \C2\B1 %lf\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [30 x i8] c"Select The Method To Use : \0A\0A\00"
@.str.5 = [25 x i8] c"1) Method Of Rectangles\0A\00"
@.str.6 = [23 x i8] c"2) Method Of Trapezis\0A\00"
@.str.7 = [42 x i8] c"3) Cavalieri-Simpson's Method (Parabola)\0A\00"
@.str.8 = [10 x i8] c"4) Exit\0A\0A\00"
@.str.9 = [10 x i8] c"Choice : \00"
@.str.10 = [3 x i8] c"%i\00"
define i32 @menu_integ(double %0, double %1, i64 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store double %0, double* %4
store double %1, double* %5
store i64 %2, i64* %6
store i32 1, i32* %8
store i32 2, i32* %9
store i32 3, i32* %10
store i32 4, i32* %11
br label %12
12: ; preds = %57, %3
%13 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stdout
%15 = load i64, i64* %6
%16 = load double, double* %4
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i64 %15, double %16)
%18 = load double, double* %5
%19 = fcmp oeq double %18, 0.000000e+00
br i1 %19, label %20, label %24
20: ; preds = %12
%21 = load i32, i32* @stdout
%22 = load double, double* %5
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %22)
br label %27
24: ; preds = %12
%25 = load i32, i32* @stdout
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %24, %20
%28 = load i32, i32* @stdout
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%30 = load i32, i32* @stdout
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%32 = load i32, i32* @stdout
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%34 = load i32, i32* @stdout
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
%36 = load i32, i32* @stdout
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%38 = load i32, i32* @stdout
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %7)
br label %41
41: ; preds = %27
%42 = load i32, i32* %7
%43 = load i32, i32* %8
%44 = icmp ne i32 %42, %43
br i1 %44, label %45, label %57
45: ; preds = %41
%46 = load i32, i32* %7
%47 = load i32, i32* %9
%48 = icmp ne i32 %46, %47
br i1 %48, label %49, label %57
49: ; preds = %45
%50 = load i32, i32* %7
%51 = load i32, i32* %10
%52 = icmp ne i32 %50, %51
br i1 %52, label %53, label %57
53: ; preds = %49
%54 = load i32, i32* %7
%55 = load i32, i32* %11
%56 = icmp ne i32 %54, %55
br label %57
57: ; preds = %53, %49, %45, %41
%58 = phi i1 [ false, %49 ], [ false, %45 ], [ false, %41 ], [ %56, %53 ]
br i1 %58, label %12, label %59
59: ; preds = %57
%60 = load i32, i32* %7
ret i32 %60
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@stdout = global i32 0
@.str.1 = [43 x i8] c"Function's Root [interaction = %li ] : %lf\00"
@.str.2 = [9 x i8] c" \C2\B1 %lf\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [30 x i8] c"Select The Method To Use : \0A\0A\00"
@.str.5 = [25 x i8] c"1) Method Of Rectangles\0A\00"
@.str.6 = [23 x i8] c"2) Method Of Trapezis\0A\00"
@.str.7 = [42 x i8] c"3) Cavalieri-Simpson's Method (Parabola)\0A\00"
@.str.8 = [10 x i8] c"4) Exit\0A\0A\00"
@.str.9 = [10 x i8] c"Choice : \00"
@.str.10 = [3 x i8] c"%i\00"
define i32 @menu_integ(double %0, double %1, i64 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = fcmp oeq double %1, 0.000000e+00
br label %7
7: ; preds = %16, %3
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @stdout
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i64 %2, double %0)
%11 = load i32, i32* @stdout
br i1 %6, label %12, label %14
12: ; preds = %7
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %1)
br label %16
14: ; preds = %7
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
%17 = load i32, i32* @stdout
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%19 = load i32, i32* @stdout
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%21 = load i32, i32* @stdout
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%23 = load i32, i32* @stdout
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
%25 = load i32, i32* @stdout
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%27 = load i32, i32* @stdout
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %4)
%30 = load i32, i32* %4
%31 = add i32 %30, -1
%32 = icmp ult i32 %31, 4
br i1 %32, label %33, label %7
33: ; preds = %16
ret i32 %30
}