#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 run_dobldobl_continuation();
int run_multprec_continuation();
int run_quaddobl_continuation();
int run_standard_continuation();
int /*<<< orphan*/ scanf(char *, ...);
int main(int argc, char *argv[]) {
  int fail, choice;
  char ch;
  adainit();
  printf("\nMENU for running increment-and-fix continuation :\n");
  printf("  1. run in standard double arithmetic;\n");
  printf("  2. run in double double arithmetic;\n");
  printf("  3. run in quad double arithmetic.\n");
  printf("  4. run in multiprecision arithmetic.\n");
  printf("Type 1, 2, 3, or 4 to select precision : ");
  scanf("%d", &choice);
  scanf("%c", &ch);
  if (choice == 1)
    fail = run_standard_continuation();
  else if (choice == 2)
    fail = run_dobldobl_continuation();
  else if (choice == 3)
    fail = run_quaddobl_continuation();
  else if (choice == 4)
    fail = run_multprec_continuation();
  else
    printf("Invalid choice, please try again.\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)
mov    $0x0,%al
call   1090 <adainit@plt>
lea    0xe5c(%rip),%rdi
call   1050 <printf@plt>
lea    0xe84(%rip),%rdi
call   1050 <printf@plt>
lea    0xea1(%rip),%rdi
call   1050 <printf@plt>
lea    0xebc(%rip),%rdi
call   1050 <printf@plt>
lea    0xed5(%rip),%rdi
call   1050 <printf@plt>
lea    0xef1(%rip),%rdi
call   1050 <printf@plt>
lea    0xf0f(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
lea    0xf00(%rip),%rdi
lea    -0x19(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
cmpl   $0x1,-0x18(%rbp)
jne    1222 <main+0xa2>
mov    $0x0,%al
call   1040 <run_standard_continuation@plt>
mov    %eax,-0x14(%rbp)
jmp    1288 <main+0x108>
cmpl   $0x2,-0x18(%rbp)
jne    123b <main+0xbb>
mov    $0x0,%al
call   1030 <run_dobldobl_continuation@plt>
mov    %eax,-0x14(%rbp)
jmp    1283 <main+0x103>
cmpl   $0x3,-0x18(%rbp)
jne    1254 <main+0xd4>
mov    $0x0,%al
call   1070 <run_quaddobl_continuation@plt>
mov    %eax,-0x14(%rbp)
jmp    127e <main+0xfe>
cmpl   $0x4,-0x18(%rbp)
jne    126d <main+0xed>
mov    $0x0,%al
call   10a0 <run_multprec_continuation@plt>
mov    %eax,-0x14(%rbp)
jmp    1279 <main+0xf9>
lea    0xe8d(%rip),%rdi
call   1050 <printf@plt>
jmp    127e <main+0xfe>
jmp    1283 <main+0x103>
jmp    1288 <main+0x108>
mov    $0x0,%al
call   1060 <adafinal@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   10a0 <adainit@plt>
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
lea    0xee4(%rip),%rdi
call   1040 <puts@plt>
lea    0xefe(%rip),%rdi
call   1040 <puts@plt>
lea    0xf16(%rip),%rdi
call   1040 <puts@plt>
lea    0xe35(%rip),%rdi
call   1060 <printf@plt>
lea    0xe53(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
lea    0xe43(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     122b <main+0x9b>
lea    0xde7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1050 <run_standard_continuation@plt>
jmp    1252 <main+0xc2>
lea    0xeda(%rip),%rdi
call   1040 <puts@plt>
jmp    1252 <main+0xc2>
xor    %eax,%eax
call   1030 <run_dobldobl_continuation@plt>
jmp    1252 <main+0xc2>
xor    %eax,%eax
call   1080 <run_quaddobl_continuation@plt>
jmp    1252 <main+0xc2>
xor    %eax,%eax
call   10b0 <run_multprec_continuation@plt>
xor    %eax,%eax
call   1070 <adafinal@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [52 x i8] c"\0AMENU for running increment-and-fix continuation :\0A\00"
@.str.1 = [41 x i8] c" 1. run in standard double arithmetic;\0A\00"
@.str.2 = [39 x i8] c" 2. run in double double arithmetic;\0A\00"
@.str.3 = [37 x i8] c" 3. run in quad double arithmetic.\0A\00"
@.str.4 = [40 x i8] c" 4. run in multiprecision arithmetic.\0A\00"
@.str.5 = [42 x i8] c"Type 1, 2, 3, or 4 to select precision : \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [3 x i8] c"%c\00"
@.str.8 = [35 x i8] c"Invalid choice, please try again.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (...) @adainit()
%10 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %7)
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %8)
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (...) @run_standard_continuation()
store i32 %21, i32* %6
br label %42
22: ; preds = %2
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 2
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 (...) @run_dobldobl_continuation()
store i32 %26, i32* %6
br label %41
27: ; preds = %22
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, 3
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 (...) @run_quaddobl_continuation()
store i32 %31, i32* %6
br label %40
32: ; preds = %27
%33 = load i32, i32* %7
%34 = icmp eq i32 %33, 4
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 (...) @run_multprec_continuation()
store i32 %36, i32* %6
br label %39
37: ; preds = %32
%38 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 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
br label %42
42: ; preds = %41, %20
%43 = call i32 (...) @adafinal()
ret i32 0
}

LLVM IR (-O2):
@.str.5 = [42 x i8] c"Type 1, 2, 3, or 4 to select precision : \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [3 x i8] c"%c\00"
@str = [51 x i8] c"\0AMENU for running increment-and-fix continuation :\00"
@str.9 = [40 x i8] c" 1. run in standard double arithmetic;\00"
@str.10 = [38 x i8] c" 2. run in double double arithmetic;\00"
@str.11 = [36 x i8] c" 3. run in quad double arithmetic.\00"
@str.12 = [39 x i8] c" 4. run in multiprecision arithmetic.\00"
@str.13 = [34 x i8] c"Invalid choice, please try again.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i8
%5 = bitcast i32* %3 to i8*
%6 = tail call i32 (...) @adainit()
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.9, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.10, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.11, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.12, i64 0, i64 0))
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %4)
%15 = load i32, i32* %3
switch i32 %15, label %24 [
i32 1, label %16
i32 2, label %18
i32 3, label %20
i32 4, label %22
]
16: ; preds = %2
%17 = call i32 (...) @run_standard_continuation()
br label %26
18: ; preds = %2
%19 = call i32 (...) @run_dobldobl_continuation()
br label %26
20: ; preds = %2
%21 = call i32 (...) @run_quaddobl_continuation()
br label %26
22: ; preds = %2
%23 = call i32 (...) @run_multprec_continuation()
br label %26
24: ; preds = %2
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.13, i64 0, i64 0))
br label %26
26: ; preds = %18, %22, %24, %20, %16
%27 = call i32 (...) @adafinal()
ret i32 0
}