#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*/ adafinal();
int /*<<< orphan*/ adainit();
int /*<<< orphan*/ dobldobl_test();
int /*<<< orphan*/ multprec_test();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quaddobl_test();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ standard_test();
int main(void) {
  int choice;
  printf("\nMENU for testing univariate root finding :\n");
  printf("  0. in standard double precision;\n");
  printf("  1. in double double precision;\n");
  printf("  2. in quad double precision.\n");
  printf("  3. in arbitrary multiprecision.\n");
  printf("Type 0, 1, 2, or 3 to select the precision : ");
  scanf("%d", &choice);
  adainit();
  if (choice == 0)
    standard_test();
  else if (choice == 1)
    dobldobl_test();
  else if (choice == 2)
    quaddobl_test();
  else if (choice == 3)
    multprec_test();
  else
    printf("invalid choice, please try again...\n");
  adafinal();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
call   1040 <printf@plt>
lea    0xee4(%rip),%rdi
call   1040 <printf@plt>
lea    0xf06(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
mov    $0x0,%al
call   1090 <adainit@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1204 <main+0x84>
mov    $0x0,%al
call   1050 <standard_test@plt>
jmp    1261 <main+0xe1>
cmpl   $0x1,-0x8(%rbp)
jne    121a <main+0x9a>
mov    $0x0,%al
call   1070 <dobldobl_test@plt>
jmp    125c <main+0xdc>
cmpl   $0x2,-0x8(%rbp)
jne    1230 <main+0xb0>
mov    $0x0,%al
call   1030 <quaddobl_test@plt>
jmp    1257 <main+0xd7>
cmpl   $0x3,-0x8(%rbp)
jne    1246 <main+0xc6>
mov    $0x0,%al
call   10a0 <multprec_test@plt>
jmp    1252 <main+0xd2>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
jmp    1257 <main+0xd7>
jmp    125c <main+0xdc>
jmp    1261 <main+0xe1>
mov    $0x0,%al
call   1060 <adafinal@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
lea    0xef5(%rip),%rdi
call   1030 <puts@plt>
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3c(%rip),%rdi
call   1050 <printf@plt>
lea    0xe5e(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1090 <scanf@plt>
xor    %eax,%eax
call   10a0 <adainit@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%rax
ja     1214 <main+0x84>
lea    0xdfe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <standard_test@plt>
jmp    123b <main+0xab>
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
jmp    123b <main+0xab>
xor    %eax,%eax
call   1080 <dobldobl_test@plt>
jmp    123b <main+0xab>
xor    %eax,%eax
call   1040 <quaddobl_test@plt>
jmp    123b <main+0xab>
xor    %eax,%eax
call   10b0 <multprec_test@plt>
xor    %eax,%eax
call   1070 <adafinal@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"\0AMENU for testing univariate root finding :\0A\00"
@.str.1 = [36 x i8] c" 0. in standard double precision;\0A\00"
@.str.2 = [34 x i8] c" 1. in double double precision;\0A\00"
@.str.3 = [32 x i8] c" 2. in quad double precision.\0A\00"
@.str.4 = [35 x i8] c" 3. in arbitrary multiprecision.\0A\00"
@.str.5 = [46 x i8] c"Type 0, 1, 2, or 3 to select the precision : \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [37 x i8] c"invalid choice, please try again...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%10 = call i32 (...) @adainit()
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 (...) @standard_test()
br label %35
15: ; preds = %0
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (...) @dobldobl_test()
br label %34
20: ; preds = %15
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (...) @quaddobl_test()
br label %33
25: ; preds = %20
%26 = load i32, i32* %2
%27 = icmp eq i32 %26, 3
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (...) @multprec_test()
br label %32
30: ; preds = %25
%31 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
br label %33
33: ; preds = %32, %23
br label %34
34: ; preds = %33, %18
br label %35
35: ; preds = %34, %13
%36 = call i32 (...) @adafinal()
ret i32 0
}

LLVM IR (-O2):
@.str.5 = [46 x i8] c"Type 0, 1, 2, or 3 to select the precision : \00"
@.str.6 = [3 x i8] c"%d\00"
@str = [44 x i8] c"\0AMENU for testing univariate root finding :\00"
@str.8 = [35 x i8] c" 0. in standard double precision;\00"
@str.9 = [33 x i8] c" 1. in double double precision;\00"
@str.10 = [31 x i8] c" 2. in quad double precision.\00"
@str.11 = [34 x i8] c" 3. in arbitrary multiprecision.\00"
@str.12 = [36 x i8] c"invalid choice, please try again...\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.8, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.10, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.11, i64 0, i64 0))
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%10 = call i32 (...) @adainit()
%11 = load i32, i32* %1
switch i32 %11, label %20 [
i32 0, label %12
i32 1, label %14
i32 2, label %16
i32 3, label %18
]
12: ; preds = %0
%13 = call i32 (...) @standard_test()
br label %22
14: ; preds = %0
%15 = call i32 (...) @dobldobl_test()
br label %22
16: ; preds = %0
%17 = call i32 (...) @quaddobl_test()
br label %22
18: ; preds = %0
%19 = call i32 (...) @multprec_test()
br label %22
20: ; preds = %0
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.12, i64 0, i64 0))
br label %22
22: ; preds = %14, %18, %20, %16, %12
%23 = call i32 (...) @adafinal()
ret i32 0
}