#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 /*<<< orphan*/ test_dobldobl_solution_container();
int /*<<< orphan*/ test_incremental_read_and_write();
int /*<<< orphan*/ test_quaddobl_solution_container();
int /*<<< orphan*/ test_standard_solution_container();
int main(void) {
  int option;
  char ch;
  printf("\nMENU to test operations in solutions container :\n");
  printf("  1. test main operations in the container;\n");
  printf("  2. incremental read/write of solutions from/to file;\n");
  printf("  3. test container for double double solutions;\n");
  printf("  4. test container for quad double solutions.\n");
  printf("Type 1, 2, 3, or 4 to make your choice : ");
  scanf("%d", &option);
  scanf("%c", &ch);
  printf("\n");
  adainit();
  if (option == 1)
    test_standard_solution_container();
  else if (option == 2)
    test_incremental_read_and_write();
  else if (option == 3)
    test_dobldobl_solution_container();
  else if (option == 4)
    test_quaddobl_solution_container();
  else
    printf("%d is wrong 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    0xe91(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
lea    0xede(%rip),%rdi
call   1040 <printf@plt>
lea    0xf04(%rip),%rdi
call   1040 <printf@plt>
lea    0xf28(%rip),%rdi
call   1040 <printf@plt>
lea    0xf46(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xf37(%rip),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xf50(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <adainit@plt>
cmpl   $0x1,-0x8(%rbp)
jne    1224 <main+0xa4>
mov    $0x0,%al
call   1090 <test_standard_solution_container@plt>
jmp    1281 <main+0x101>
cmpl   $0x2,-0x8(%rbp)
jne    123a <main+0xba>
mov    $0x0,%al
call   1030 <test_incremental_read_and_write@plt>
jmp    127c <main+0xfc>
cmpl   $0x3,-0x8(%rbp)
jne    1250 <main+0xd0>
mov    $0x0,%al
call   1060 <test_dobldobl_solution_container@plt>
jmp    1277 <main+0xf7>
cmpl   $0x4,-0x8(%rbp)
jne    1266 <main+0xe6>
mov    $0x0,%al
call   10a0 <test_quaddobl_solution_container@plt>
jmp    1272 <main+0xf2>
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
jmp    1277 <main+0xf7>
jmp    127c <main+0xfc>
jmp    1281 <main+0x101>
mov    $0x0,%al
call   1050 <adafinal@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec2(%rip),%rdi
call   1050 <puts@plt>
lea    0xee8(%rip),%rdi
call   1050 <puts@plt>
lea    0xf08(%rip),%rdi
call   1050 <puts@plt>
lea    0xf33(%rip),%rdi
call   1050 <puts@plt>
lea    0xf58(%rip),%rdi
call   1050 <puts@plt>
lea    0xe2c(%rip),%rdi
call   1060 <printf@plt>
lea    0xe4a(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
lea    0xe3a(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
call   10a0 <adainit@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1245 <main+0xa5>
lea    0xdcd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   10b0 <test_standard_solution_container@plt>
jmp    126c <main+0xcc>
lea    0xdf4(%rip),%rdi
call   1060 <printf@plt>
jmp    126c <main+0xcc>
xor    %eax,%eax
call   1030 <test_incremental_read_and_write@plt>
jmp    126c <main+0xcc>
xor    %eax,%eax
call   1080 <test_dobldobl_solution_container@plt>
jmp    126c <main+0xcc>
xor    %eax,%eax
call   10c0 <test_quaddobl_solution_container@plt>
xor    %eax,%eax
call   1070 <adafinal@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"\0AMENU to test operations in solutions container :\0A\00"
@.str.1 = [45 x i8] c" 1. test main operations in the container;\0A\00"
@.str.2 = [56 x i8] c" 2. incremental read/write of solutions from/to file;\0A\00"
@.str.3 = [50 x i8] c" 3. test container for double double solutions;\0A\00"
@.str.4 = [48 x i8] c" 4. test container for quad double solutions.\0A\00"
@.str.5 = [42 x i8] c"Type 1, 2, 3, or 4 to make your choice : \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [3 x i8] c"%c\00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [42 x i8] c"%d is wrong choice. Please try again...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %3)
%12 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 (...) @adainit()
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (...) @test_standard_solution_container()
br label %38
18: ; preds = %0
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 2
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 (...) @test_incremental_read_and_write()
br label %37
23: ; preds = %18
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 3
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 (...) @test_dobldobl_solution_container()
br label %36
28: ; preds = %23
%29 = load i32, i32* %2
%30 = icmp eq i32 %29, 4
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 (...) @test_quaddobl_solution_container()
br label %35
33: ; preds = %28
%34 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0))
br label %35
35: ; preds = %33, %31
br label %36
36: ; preds = %35, %26
br label %37
37: ; preds = %36, %21
br label %38
38: ; preds = %37, %16
%39 = call i32 (...) @adafinal()
ret i32 0
}

LLVM IR (-O2):
@.str.5 = [42 x i8] c"Type 1, 2, 3, or 4 to make your choice : \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [3 x i8] c"%c\00"
@.str.9 = [42 x i8] c"%d is wrong choice. Please try again...\0A\00"
@str = [50 x i8] c"\0AMENU to test operations in solutions container :\00"
@str.10 = [44 x i8] c" 1. test main operations in the container;\00"
@str.11 = [55 x i8] c" 2. incremental read/write of solutions from/to file;\00"
@str.12 = [49 x i8] c" 3. test container for double double solutions;\00"
@str.13 = [47 x i8] c" 4. test container for quad double solutions.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.11, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.12, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.13, i64 0, i64 0))
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %2)
%12 = call i32 @putchar(i32 10)
%13 = call i32 (...) @adainit()
%14 = load i32, i32* %1
switch i32 %14, label %23 [
i32 1, label %15
i32 2, label %17
i32 3, label %19
i32 4, label %21
]
15: ; preds = %0
%16 = call i32 (...) @test_standard_solution_container()
br label %25
17: ; preds = %0
%18 = call i32 (...) @test_incremental_read_and_write()
br label %25
19: ; preds = %0
%20 = call i32 (...) @test_dobldobl_solution_container()
br label %25
21: ; preds = %0
%22 = call i32 (...) @test_quaddobl_solution_container()
br label %25
23: ; preds = %0
%24 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0))
br label %25
25: ; preds = %17, %21, %23, %19, %15
%26 = call i32 (...) @adafinal()
ret i32 0
}