#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_deflate();
int /*<<< orphan*/ test_dobldobl_Newton_Laurent_step();
int /*<<< orphan*/ test_dobldobl_Newton_step();
int /*<<< orphan*/ test_multprec_Newton_Laurent_step();
int /*<<< orphan*/ test_multprec_Newton_step();
int /*<<< orphan*/ test_quaddobl_Newton_Laurent_step();
int /*<<< orphan*/ test_quaddobl_Newton_step();
int /*<<< orphan*/ test_standard_Newton_Laurent_step();
int /*<<< orphan*/ test_standard_Newton_step();
int /*<<< orphan*/ test_validate();
int /*<<< orphan*/ test_varbprec_Newton_Laurent_step();
int main(int argc, char *argv[]) {
  int choice;
  char ch;
  adainit();
  printf("\nMENU to run Newton's method : \n");
  printf("  0. test plain validation on a start system;\n");
  printf("  1. run Newton step with standard double arithmetic;\n");
  printf("  2. run Newton step with double double arithmetic;\n");
  printf("  3. run Newton step with quad double arithmetic;\n");
  printf("  4. run Newton step with multiprecision arithmetic;\n");
  printf("  5. standard double precision deflation with defaults;\n");
  printf("  6. standard double Newton step on Laurent system;\n");
  printf("  7.   double double Newton step on Laurent system;\n");
  printf("  8.     quad double Newton step on Laurent system;\n");
  printf("  9.  multiprecision Newton step on Laurent system;\n");
  printf(" 10. variable precision Newton step on Laurent system.\n");
  printf("Type 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, or 10 to select : ");
  scanf("%d", &choice);
  scanf("%c", &ch);
  if (choice == 0)
    test_validate();
  else if (choice == 1)
    test_standard_Newton_step();
  else if (choice == 2)
    test_dobldobl_Newton_step();
  else if (choice == 3)
    test_quaddobl_Newton_step();
  else if (choice == 4)
    test_multprec_Newton_step();
  else if (choice == 5)
    test_deflate();
  else if (choice == 6)
    test_standard_Newton_Laurent_step();
  else if (choice == 7)
    test_dobldobl_Newton_Laurent_step();
  else if (choice == 8)
    test_quaddobl_Newton_Laurent_step();
  else if (choice == 9)
    test_multprec_Newton_Laurent_step();
  else if (choice == 10)
    test_varbprec_Newton_Laurent_step();
  else
    printf("invalid selection, 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   1110 <adainit@plt>
lea    0xdec(%rip),%rdi
call   1050 <printf@plt>
lea    0xe01(%rip),%rdi
call   1050 <printf@plt>
lea    0xe24(%rip),%rdi
call   1050 <printf@plt>
lea    0xe4f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe78(%rip),%rdi
call   1050 <printf@plt>
lea    0xe9f(%rip),%rdi
call   1050 <printf@plt>
lea    0xec9(%rip),%rdi
call   1050 <printf@plt>
lea    0xef6(%rip),%rdi
call   1050 <printf@plt>
lea    0xf1f(%rip),%rdi
call   1050 <printf@plt>
lea    0xf48(%rip),%rdi
call   1050 <printf@plt>
lea    0xf71(%rip),%rdi
call   1050 <printf@plt>
lea    0xf9a(%rip),%rdi
call   1050 <printf@plt>
lea    0xfc6(%rip),%rdi
call   1050 <printf@plt>
lea    0xff0(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1100 <scanf@plt>
lea    0xfe1(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1100 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
jne    12e3 <main+0xf3>
mov    $0x0,%al
call   10d0 <test_validate@plt>
jmp    13fd <main+0x20d>
cmpl   $0x1,-0x14(%rbp)
jne    12f9 <main+0x109>
mov    $0x0,%al
call   1030 <test_standard_Newton_step@plt>
jmp    13f8 <main+0x208>
cmpl   $0x2,-0x14(%rbp)
jne    130f <main+0x11f>
mov    $0x0,%al
call   1040 <test_dobldobl_Newton_step@plt>
jmp    13f3 <main+0x203>
cmpl   $0x3,-0x14(%rbp)
jne    1325 <main+0x135>
mov    $0x0,%al
call   1080 <test_quaddobl_Newton_step@plt>
jmp    13ee <main+0x1fe>
cmpl   $0x4,-0x14(%rbp)
jne    133b <main+0x14b>
mov    $0x0,%al
call   10e0 <test_multprec_Newton_step@plt>
jmp    13e9 <main+0x1f9>
cmpl   $0x5,-0x14(%rbp)
jne    1351 <main+0x161>
mov    $0x0,%al
call   10c0 <test_deflate@plt>
jmp    13e4 <main+0x1f4>
cmpl   $0x6,-0x14(%rbp)
jne    1367 <main+0x177>
mov    $0x0,%al
call   1070 <test_standard_Newton_Laurent_step@plt>
jmp    13df <main+0x1ef>
cmpl   $0x7,-0x14(%rbp)
jne    137d <main+0x18d>
mov    $0x0,%al
call   1090 <test_dobldobl_Newton_Laurent_step@plt>
jmp    13da <main+0x1ea>
cmpl   $0x8,-0x14(%rbp)
jne    1393 <main+0x1a3>
mov    $0x0,%al
call   1060 <test_quaddobl_Newton_Laurent_step@plt>
jmp    13d5 <main+0x1e5>
cmpl   $0x9,-0x14(%rbp)
jne    13a9 <main+0x1b9>
mov    $0x0,%al
call   10b0 <test_multprec_Newton_Laurent_step@plt>
jmp    13d0 <main+0x1e0>
cmpl   $0xa,-0x14(%rbp)
jne    13bf <main+0x1cf>
mov    $0x0,%al
call   10f0 <test_varbprec_Newton_Laurent_step@plt>
jmp    13cb <main+0x1db>
lea    0xee0(%rip),%rdi
call   1050 <printf@plt>
jmp    13d0 <main+0x1e0>
jmp    13d5 <main+0x1e5>
jmp    13da <main+0x1ea>
jmp    13df <main+0x1ef>
jmp    13e4 <main+0x1f4>
jmp    13e9 <main+0x1f9>
jmp    13ee <main+0x1fe>
jmp    13f3 <main+0x203>
jmp    13f8 <main+0x208>
jmp    13fd <main+0x20d>
mov    $0x0,%al
call   10a0 <adafinal@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1120 <adainit@plt>
lea    0xe59(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8f(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb9(%rip),%rdi
call   1040 <puts@plt>
lea    0xee1(%rip),%rdi
call   1040 <puts@plt>
lea    0xf07(%rip),%rdi
call   1040 <puts@plt>
lea    0xf30(%rip),%rdi
call   1040 <puts@plt>
lea    0xf5c(%rip),%rdi
call   1040 <puts@plt>
lea    0xf84(%rip),%rdi
call   1040 <puts@plt>
lea    0xfac(%rip),%rdi
call   1040 <puts@plt>
lea    0xfd4(%rip),%rdi
call   1040 <puts@plt>
lea    0xffc(%rip),%rdi
call   1040 <puts@plt>
lea    0xd8d(%rip),%rdi
call   1060 <printf@plt>
lea    0xdb7(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1110 <scanf@plt>
lea    0xda7(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1110 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0xa,%rax
ja     12ed <main+0xed>
lea    0xd25(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   10e0 <test_validate@plt>
jmp    1353 <main+0x153>
lea    0xfd2(%rip),%rdi
call   1040 <puts@plt>
jmp    1353 <main+0x153>
xor    %eax,%eax
call   1030 <test_standard_Newton_step@plt>
jmp    1353 <main+0x153>
xor    %eax,%eax
call   1050 <test_dobldobl_Newton_step@plt>
jmp    1353 <main+0x153>
xor    %eax,%eax
call   1090 <test_quaddobl_Newton_step@plt>
jmp    1353 <main+0x153>
xor    %eax,%eax
call   10f0 <test_multprec_Newton_step@plt>
jmp    1353 <main+0x153>
xor    %eax,%eax
call   10d0 <test_deflate@plt>
jmp    1353 <main+0x153>
xor    %eax,%eax
call   1080 <test_standard_Newton_Laurent_step@plt>
jmp    1353 <main+0x153>
xor    %eax,%eax
call   10a0 <test_dobldobl_Newton_Laurent_step@plt>
jmp    1353 <main+0x153>
xor    %eax,%eax
call   1070 <test_quaddobl_Newton_Laurent_step@plt>
jmp    1353 <main+0x153>
xor    %eax,%eax
call   10c0 <test_multprec_Newton_Laurent_step@plt>
jmp    1353 <main+0x153>
xor    %eax,%eax
call   1100 <test_varbprec_Newton_Laurent_step@plt>
xor    %eax,%eax
call   10b0 <adafinal@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"\0AMENU to run Newton's method : \0A\00"
@.str.1 = [47 x i8] c" 0. test plain validation on a start system;\0A\00"
@.str.2 = [55 x i8] c" 1. run Newton step with standard double arithmetic;\0A\00"
@.str.3 = [53 x i8] c" 2. run Newton step with double double arithmetic;\0A\00"
@.str.4 = [51 x i8] c" 3. run Newton step with quad double arithmetic;\0A\00"
@.str.5 = [54 x i8] c" 4. run Newton step with multiprecision arithmetic;\0A\00"
@.str.6 = [57 x i8] c" 5. standard double precision deflation with defaults;\0A\00"
@.str.7 = [53 x i8] c" 6. standard double Newton step on Laurent system;\0A\00"
@.str.8 = [53 x i8] c" 7. double double Newton step on Laurent system;\0A\00"
@.str.9 = [53 x i8] c" 8. quad double Newton step on Laurent system;\0A\00"
@.str.10 = [53 x i8] c" 9. multiprecision Newton step on Laurent system;\0A\00"
@.str.11 = [56 x i8] c" 10. variable precision Newton step on Laurent system.\0A\00"
@.str.12 = [54 x i8] c"Type 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, or 10 to select : \00"
@.str.13 = [3 x i8] c"%d\00"
@.str.14 = [3 x i8] c"%c\00"
@.str.15 = [37 x i8] c"invalid selection, 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 i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @adainit()
%9 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.8, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.9, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.12, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %6)
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i8* %7)
%24 = load i32, i32* %6
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %2
%27 = call i32 (...) @test_validate()
br label %90
28: ; preds = %2
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 (...) @test_standard_Newton_step()
br label %89
33: ; preds = %28
%34 = load i32, i32* %6
%35 = icmp eq i32 %34, 2
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 (...) @test_dobldobl_Newton_step()
br label %88
38: ; preds = %33
%39 = load i32, i32* %6
%40 = icmp eq i32 %39, 3
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 (...) @test_quaddobl_Newton_step()
br label %87
43: ; preds = %38
%44 = load i32, i32* %6
%45 = icmp eq i32 %44, 4
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 (...) @test_multprec_Newton_step()
br label %86
48: ; preds = %43
%49 = load i32, i32* %6
%50 = icmp eq i32 %49, 5
br i1 %50, label %51, label %53
51: ; preds = %48
%52 = call i32 (...) @test_deflate()
br label %85
53: ; preds = %48
%54 = load i32, i32* %6
%55 = icmp eq i32 %54, 6
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = call i32 (...) @test_standard_Newton_Laurent_step()
br label %84
58: ; preds = %53
%59 = load i32, i32* %6
%60 = icmp eq i32 %59, 7
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = call i32 (...) @test_dobldobl_Newton_Laurent_step()
br label %83
63: ; preds = %58
%64 = load i32, i32* %6
%65 = icmp eq i32 %64, 8
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = call i32 (...) @test_quaddobl_Newton_Laurent_step()
br label %82
68: ; preds = %63
%69 = load i32, i32* %6
%70 = icmp eq i32 %69, 9
br i1 %70, label %71, label %73
71: ; preds = %68
%72 = call i32 (...) @test_multprec_Newton_Laurent_step()
br label %81
73: ; preds = %68
%74 = load i32, i32* %6
%75 = icmp eq i32 %74, 10
br i1 %75, label %76, label %78
76: ; preds = %73
%77 = call i32 (...) @test_varbprec_Newton_Laurent_step()
br label %80
78: ; preds = %73
%79 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.15, i64 0, i64 0))
br label %80
80: ; preds = %78, %76
br label %81
81: ; preds = %80, %71
br label %82
82: ; preds = %81, %66
br label %83
83: ; preds = %82, %61
br label %84
84: ; preds = %83, %56
br label %85
85: ; preds = %84, %51
br label %86
86: ; preds = %85, %46
br label %87
87: ; preds = %86, %41
br label %88
88: ; preds = %87, %36
br label %89
89: ; preds = %88, %31
br label %90
90: ; preds = %89, %26
%91 = call i32 (...) @adafinal()
ret i32 0
}

LLVM IR (-O2):
@.str.12 = [54 x i8] c"Type 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, or 10 to select : \00"
@.str.13 = [3 x i8] c"%d\00"
@.str.14 = [3 x i8] c"%c\00"
@str = [32 x i8] c"\0AMENU to run Newton's method : \00"
@str.16 = [46 x i8] c" 0. test plain validation on a start system;\00"
@str.17 = [54 x i8] c" 1. run Newton step with standard double arithmetic;\00"
@str.18 = [52 x i8] c" 2. run Newton step with double double arithmetic;\00"
@str.19 = [50 x i8] c" 3. run Newton step with quad double arithmetic;\00"
@str.20 = [53 x i8] c" 4. run Newton step with multiprecision arithmetic;\00"
@str.21 = [56 x i8] c" 5. standard double precision deflation with defaults;\00"
@str.22 = [52 x i8] c" 6. standard double Newton step on Laurent system;\00"
@str.23 = [52 x i8] c" 7. double double Newton step on Laurent system;\00"
@str.24 = [52 x i8] c" 8. quad double Newton step on Laurent system;\00"
@str.25 = [52 x i8] c" 9. multiprecision Newton step on Laurent system;\00"
@str.26 = [55 x i8] c" 10. variable precision Newton step on Laurent system.\00"
@str.27 = [36 x i8] c"invalid selection, 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 ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.16, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.17, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.18, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.19, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.20, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.21, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.22, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.23, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.24, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.25, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.26, i64 0, i64 0))
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.12, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %3)
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i8* %4)
%22 = load i32, i32* %3
switch i32 %22, label %45 [
i32 0, label %23
i32 1, label %25
i32 2, label %27
i32 3, label %29
i32 4, label %31
i32 5, label %33
i32 6, label %35
i32 7, label %37
i32 8, label %39
i32 9, label %41
i32 10, label %43
]
23: ; preds = %2
%24 = call i32 (...) @test_validate()
br label %47
25: ; preds = %2
%26 = call i32 (...) @test_standard_Newton_step()
br label %47
27: ; preds = %2
%28 = call i32 (...) @test_dobldobl_Newton_step()
br label %47
29: ; preds = %2
%30 = call i32 (...) @test_quaddobl_Newton_step()
br label %47
31: ; preds = %2
%32 = call i32 (...) @test_multprec_Newton_step()
br label %47
33: ; preds = %2
%34 = call i32 (...) @test_deflate()
br label %47
35: ; preds = %2
%36 = call i32 (...) @test_standard_Newton_Laurent_step()
br label %47
37: ; preds = %2
%38 = call i32 (...) @test_dobldobl_Newton_Laurent_step()
br label %47
39: ; preds = %2
%40 = call i32 (...) @test_quaddobl_Newton_Laurent_step()
br label %47
41: ; preds = %2
%42 = call i32 (...) @test_multprec_Newton_Laurent_step()
br label %47
43: ; preds = %2
%44 = call i32 (...) @test_varbprec_Newton_Laurent_step()
br label %47
45: ; preds = %2
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.27, i64 0, i64 0))
br label %47
47: ; preds = %25, %29, %33, %37, %41, %45, %43, %39, %35, %31, %27, %23
%48 = call i32 (...) @adafinal()
ret i32 0
}