#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 dobldobl_test();
int /*<<< orphan*/ printf(char *, ...);
int quaddobl_test();
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ srand(int);
int standard_test();
int time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  char ans;
  int precision, fail;
  int seed = time(NULL);
  adainit();
  srand(seed);
  printf("Seed for the random number generators : %d.\n", seed);
  printf("\nMENU for the working precision :\n");
  printf("  0. standard double precision;\n");
  printf("  1. double double precision;\n");
  printf("  2. quad double precision.\n");
  printf("Type 0, 1, or 2 to make a choice : ");
  scanf("%d", &precision);
  scanf("%c", &ans);
  if (precision == 0)
    fail = standard_test();
  else if (precision == 1)
    fail = dobldobl_test();
  else if (precision == 2)
    fail = quaddobl_test();
  else
    printf("Selected precision level is not supported.\n");
  adafinal();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   10b0 <adainit@plt>
mov    -0x20(%rbp),%edi
call   1060 <srand@plt>
mov    -0x20(%rbp),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
lea    0xea3(%rip),%rdi
lea    -0x11(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    1255 <main+0xc5>
mov    $0x0,%al
call   1050 <standard_test@plt>
mov    %eax,-0x1c(%rbp)
jmp    129f <main+0x10f>
cmpl   $0x1,-0x18(%rbp)
jne    126e <main+0xde>
mov    $0x0,%al
call   1090 <dobldobl_test@plt>
mov    %eax,-0x1c(%rbp)
jmp    129a <main+0x10a>
cmpl   $0x2,-0x18(%rbp)
jne    1287 <main+0xf7>
mov    $0x0,%al
call   1030 <quaddobl_test@plt>
mov    %eax,-0x1c(%rbp)
jmp    1295 <main+0x105>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    129a <main+0x10a>
jmp    129f <main+0x10f>
mov    $0x0,%al
call   1070 <adafinal@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   10c0 <adainit@plt>
mov    %ebx,%edi
call   1070 <srand@plt>
lea    0xe3d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
lea    0xe2a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe40(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
lea    0xe30(%rip),%rdi
lea    0xb(%rsp),%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x2,%eax
je     124b <main+0xab>
cmp    $0x1,%eax
je     1254 <main+0xb4>
test   %eax,%eax
jne    125d <main+0xbd>
xor    %eax,%eax
call   1060 <standard_test@plt>
jmp    1269 <main+0xc9>
xor    %eax,%eax
call   1040 <quaddobl_test@plt>
jmp    1269 <main+0xc9>
xor    %eax,%eax
call   10a0 <dobldobl_test@plt>
jmp    1269 <main+0xc9>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <adafinal@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Seed for the random number generators : %d.\0A\00"
@.str.1 = [35 x i8] c"\0AMENU for the working precision :\0A\00"
@.str.2 = [33 x i8] c" 0. standard double precision;\0A\00"
@.str.3 = [31 x i8] c" 1. double double precision;\0A\00"
@.str.4 = [29 x i8] c" 2. quad double precision.\0A\00"
@.str.5 = [36 x i8] c"Type 0, 1, or 2 to make a choice : \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [3 x i8] c"%c\00"
@.str.8 = [44 x i8] c"Selected precision level is not supported.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 @time(i32* null)
store i32 %10, i32* %9
%11 = call i32 (...) @adainit()
%12 = load i32, i32* %9
%13 = call i32 @srand(i32 %12)
%14 = load i32, i32* %9
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %7)
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %6)
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %2
%26 = call i32 (...) @standard_test()
store i32 %26, i32* %8
br label %41
27: ; preds = %2
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 (...) @dobldobl_test()
store i32 %31, i32* %8
br label %40
32: ; preds = %27
%33 = load i32, i32* %7
%34 = icmp eq i32 %33, 2
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 (...) @quaddobl_test()
store i32 %36, i32* %8
br label %39
37: ; preds = %32
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
br label %39
39: ; preds = %37, %35
br label %40
40: ; preds = %39, %30
br label %41
41: ; preds = %40, %25
%42 = call i32 (...) @adafinal()
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"Seed for the random number generators : %d.\0A\00"
@.str.5 = [36 x i8] c"Type 0, 1, or 2 to make a choice : \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [3 x i8] c"%c\00"
@str = [34 x i8] c"\0AMENU for the working precision :\00"
@str.9 = [32 x i8] c" 0. standard double precision;\00"
@str.10 = [30 x i8] c" 1. double double precision;\00"
@str.11 = [28 x i8] c" 2. quad double precision.\00"
@str.12 = [43 x i8] c"Selected precision level is not supported.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = tail call i32 @time(i32* null)
%7 = tail call i32 (...) @adainit()
%8 = tail call i32 @srand(i32 %6)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %6)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.10, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.11, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %4)
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %3)
%17 = load i32, i32* %4
switch i32 %17, label %24 [
i32 0, label %18
i32 1, label %20
i32 2, label %22
]
18: ; preds = %2
%19 = call i32 (...) @standard_test()
br label %26
20: ; preds = %2
%21 = call i32 (...) @dobldobl_test()
br label %26
22: ; preds = %2
%23 = call i32 (...) @quaddobl_test()
br label %26
24: ; preds = %2
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.12, i64 0, i64 0))
br label %26
26: ; preds = %20, %24, %22, %18
%27 = call i32 (...) @adafinal()
ret i32 0
}