#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ show_random_system();
int /*<<< orphan*/ test_dobldobl_container();
int /*<<< orphan*/ test_multprec_container();
int /*<<< orphan*/ test_quaddobl_container();
int /*<<< orphan*/ test_standard_container();
int main(void) {
  int choice;
  printf("\nMENU for testing the systems containers :\n");
  printf("  0. show a random polynomial system;\n");
  printf("  1. test with standard double coefficients;\n");
  printf("  2. test with double double coefficients;\n");
  printf("  3. test with quad double coefficients;\n");
  printf("  4. test with multiprecision coefficients.\n");
  printf("Type 1, 2, 3, or 4 to select the precision : ");
  scanf("%d", &choice);
  adainit();
  if (choice == 0)
    show_random_system();
  else if (choice == 1)
    test_standard_container();
  else if (choice == 2)
    test_dobldobl_container();
  else if (choice == 3)
    test_quaddobl_container();
  else if (choice == 4)
    test_multprec_container();
  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    0xe5a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
call   1040 <printf@plt>
lea    0xef5(%rip),%rdi
call   1040 <printf@plt>
lea    0xf16(%rip),%rdi
call   1040 <printf@plt>
lea    0xf38(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    $0x0,%al
call   1080 <adainit@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1220 <main+0x90>
mov    $0x0,%al
call   1090 <show_random_system@plt>
jmp    1298 <main+0x108>
cmpl   $0x1,-0x8(%rbp)
jne    1236 <main+0xa6>
mov    $0x0,%al
call   10b0 <test_standard_container@plt>
jmp    1293 <main+0x103>
cmpl   $0x2,-0x8(%rbp)
jne    124c <main+0xbc>
mov    $0x0,%al
call   10a0 <test_dobldobl_container@plt>
jmp    128e <main+0xfe>
cmpl   $0x3,-0x8(%rbp)
jne    1262 <main+0xd2>
mov    $0x0,%al
call   1030 <test_quaddobl_container@plt>
jmp    1289 <main+0xf9>
cmpl   $0x4,-0x8(%rbp)
jne    1278 <main+0xe8>
mov    $0x0,%al
call   1060 <test_multprec_container@plt>
jmp    1284 <main+0xf4>
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
jmp    1289 <main+0xf9>
jmp    128e <main+0xfe>
jmp    1293 <main+0x103>
jmp    1298 <main+0x108>
mov    $0x0,%al
call   1050 <adafinal@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
lea    0xf16(%rip),%rdi
call   1030 <puts@plt>
lea    0xf33(%rip),%rdi
call   1030 <puts@plt>
lea    0xe24(%rip),%rdi
call   1050 <printf@plt>
lea    0xe46(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
xor    %eax,%eax
call   1090 <adainit@plt>
mov    0x4(%rsp),%eax
cmp    $0x4,%rax
ja     1230 <main+0x90>
lea    0xde2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   10a0 <show_random_system@plt>
jmp    1260 <main+0xc0>
lea    0xf0c(%rip),%rdi
call   1030 <puts@plt>
jmp    1260 <main+0xc0>
xor    %eax,%eax
call   10c0 <test_standard_container@plt>
jmp    1260 <main+0xc0>
xor    %eax,%eax
call   10b0 <test_dobldobl_container@plt>
jmp    1260 <main+0xc0>
xor    %eax,%eax
call   1040 <test_quaddobl_container@plt>
jmp    1260 <main+0xc0>
xor    %eax,%eax
call   1070 <test_multprec_container@plt>
xor    %eax,%eax
call   1060 <adafinal@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"\0AMENU for testing the systems containers :\0A\00"
@.str.1 = [39 x i8] c" 0. show a random polynomial system;\0A\00"
@.str.2 = [46 x i8] c" 1. test with standard double coefficients;\0A\00"
@.str.3 = [44 x i8] c" 2. test with double double coefficients;\0A\00"
@.str.4 = [42 x i8] c" 3. test with quad double coefficients;\0A\00"
@.str.5 = [45 x i8] c" 4. test with multiprecision coefficients.\0A\00"
@.str.6 = [46 x i8] c"Type 1, 2, 3, or 4 to select the precision : \00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [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 ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %2)
%11 = call i32 (...) @adainit()
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 (...) @show_random_system()
br label %42
16: ; preds = %0
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (...) @test_standard_container()
br label %41
21: ; preds = %16
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (...) @test_dobldobl_container()
br label %40
26: ; preds = %21
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 3
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (...) @test_quaddobl_container()
br label %39
31: ; preds = %26
%32 = load i32, i32* %2
%33 = icmp eq i32 %32, 4
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 (...) @test_multprec_container()
br label %38
36: ; preds = %31
%37 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0))
br label %38
38: ; preds = %36, %34
br label %39
39: ; preds = %38, %29
br label %40
40: ; preds = %39, %24
br label %41
41: ; preds = %40, %19
br label %42
42: ; preds = %41, %14
%43 = call i32 (...) @adafinal()
ret i32 0
}

LLVM IR (-O2):
@.str.6 = [46 x i8] c"Type 1, 2, 3, or 4 to select the precision : \00"
@.str.7 = [3 x i8] c"%d\00"
@str = [43 x i8] c"\0AMENU for testing the systems containers :\00"
@str.9 = [38 x i8] c" 0. show a random polynomial system;\00"
@str.10 = [45 x i8] c" 1. test with standard double coefficients;\00"
@str.11 = [43 x i8] c" 2. test with double double coefficients;\00"
@str.12 = [41 x i8] c" 3. test with quad double coefficients;\00"
@str.13 = [44 x i8] c" 4. test with multiprecision coefficients.\00"
@str.14 = [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 ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.9, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.11, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.12, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.13, i64 0, i64 0))
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%11 = call i32 (...) @adainit()
%12 = load i32, i32* %1
switch i32 %12, label %23 [
i32 0, label %13
i32 1, label %15
i32 2, label %17
i32 3, label %19
i32 4, label %21
]
13: ; preds = %0
%14 = call i32 (...) @show_random_system()
br label %25
15: ; preds = %0
%16 = call i32 (...) @test_standard_container()
br label %25
17: ; preds = %0
%18 = call i32 (...) @test_dobldobl_container()
br label %25
19: ; preds = %0
%20 = call i32 (...) @test_quaddobl_container()
br label %25
21: ; preds = %0
%22 = call i32 (...) @test_multprec_container()
br label %25
23: ; preds = %0
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.14, i64 0, i64 0))
br label %25
25: ; preds = %15, %19, %23, %21, %17, %13
%26 = call i32 (...) @adafinal()
ret i32 0
}