#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 assign_labels(int, int, int /*<<< orphan*/);
int define_output_file();
int /*<<< orphan*/ printf(char *, ...);
int read_standard_Laurent_witness_set(int *, int *, int *);
int read_witness_set(int *, int *, int *);
int /*<<< orphan*/ scanf(char *, ...);
int set_standard_state_to_silent();
int standard_monodromy_breakup(int, int, int, int, int);
int syscon_write_standard_Laurent_system();
int syscon_write_standard_system();
int standard_test(int islaurent) {
  int fail, n, dim, deg, nbloops, kind;
  char ans;
  printf("\nReading a witness set ...\n");
  if (islaurent == 1)
    fail = read_standard_Laurent_witness_set(&n, &dim, &deg);
  else
    fail = read_witness_set(&n, &dim, &deg);
  printf("\nMENU for the kind of output :\n");
  printf("  0. remain silent with no intermediate output;\n");
  printf("  1. all intermediate output goes to screen;\n");
  printf("  2. give a file name for all intermediate output.\n");
  printf("Type 0, 1, or 2 to make a choice : ");
  scanf("%d", &kind);
  scanf("%c", &ans);
  if (kind == 0)
    fail = set_standard_state_to_silent();
  if (kind == 2)
    fail = define_output_file();
  if (1 > 0) {
    printf("\nThe ambient dimension : %d.\n", n);
    printf("The dimension of the solution set : %d.\n", dim);
    printf("The degree of the solution set : %d.\n", deg);
    printf("\nDo you wish to see the embedded system ? (y/n) ");
    scanf("%c", &ans);
    if (ans == 'y') {
      printf("\nThe system read :\n");
      if (islaurent == 1)
        fail = syscon_write_standard_Laurent_system();
      else
        fail = syscon_write_standard_system();
    }
  }
  fail = assign_labels(n, deg, 0);
  printf("\nGive the maximum number of loops : ");
  scanf("%d", &nbloops);
  fail = standard_monodromy_breakup(islaurent, nbloops, n, dim, deg);
  if (kind == 2)
    printf("See the output file for results.\n");
  return 0;
}


x86 assembly (clang, -O0):
<standard_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    11dc <standard_test+0x3c>
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   10c0 <read_standard_Laurent_witness_set@plt>
mov    %eax,-0x8(%rbp)
jmp    11f0 <standard_test+0x50>
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <read_witness_set@plt>
mov    %eax,-0x8(%rbp)
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xea7(%rip),%rdi
lea    -0x1d(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    126e <standard_test+0xce>
mov    $0x0,%al
call   1080 <set_standard_state_to_silent@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jne    1282 <standard_test+0xe2>
mov    $0x0,%al
call   1040 <define_output_file@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2c(%rip),%rdi
lea    -0x1d(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movsbl -0x1d(%rbp),%eax
cmp    $0x79,%eax
jne    1318 <standard_test+0x178>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    1309 <standard_test+0x169>
mov    $0x0,%al
call   10a0 <syscon_write_standard_Laurent_system@plt>
mov    %eax,-0x8(%rbp)
jmp    1313 <standard_test+0x173>
mov    $0x0,%al
call   1060 <syscon_write_standard_system@plt>
mov    %eax,-0x8(%rbp)
jmp    1318 <standard_test+0x178>
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
xor    %edx,%edx
call   10b0 <assign_labels@plt>
mov    %eax,-0x8(%rbp)
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdb6(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1090 <standard_monodromy_breakup@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jne    1378 <standard_test+0x1d8>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standard_test>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebx
lea    0xf2f(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0xc(%rsp),%rdx
cmp    $0x1,%ebx
jne    11de <standard_test+0x2e>
call   10d0 <read_standard_Laurent_witness_set@plt>
jmp    11e3 <standard_test+0x33>
call   1060 <read_witness_set@plt>
lea    0xf1e(%rip),%rdi
call   1030 <puts@plt>
lea    0xf31(%rip),%rdi
call   1030 <puts@plt>
lea    0xf55(%rip),%rdi
call   1030 <puts@plt>
lea    0xf76(%rip),%rdi
call   1030 <puts@plt>
lea    0xde6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdfc(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xdec(%rip),%rdi
lea    0xb(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    0x14(%rsp),%eax
test   %eax,%eax
je     12d7 <standard_test+0x127>
cmp    $0x2,%eax
jne    125f <standard_test+0xaf>
xor    %eax,%eax
call   1050 <define_output_file@plt>
mov    0x10(%rsp),%esi
lea    0xdc0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
lea    0xdcc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xde3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdfb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd7d(%rip),%rdi
lea    0xb(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
cmpb   $0x79,0xb(%rsp)
jne    12f5 <standard_test+0x145>
lea    0xf14(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
cmp    $0x1,%ebx
jne    12f0 <standard_test+0x140>
call   10b0 <syscon_write_standard_Laurent_system@plt>
jmp    12f5 <standard_test+0x145>
xor    %eax,%eax
call   1090 <set_standard_state_to_silent@plt>
mov    0x14(%rsp),%eax
cmp    $0x2,%eax
je     1258 <standard_test+0xa8>
jmp    125f <standard_test+0xaf>
call   1070 <syscon_write_standard_system@plt>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
xor    %edx,%edx
call   10c0 <assign_labels@plt>
lea    0xdbd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd0b(%rip),%rdi
lea    0x1c(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    0x1c(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0x18(%rsp),%ecx
mov    0xc(%rsp),%r8d
mov    %ebx,%edi
call   10a0 <standard_monodromy_breakup@plt>
cmpl   $0x2,0x14(%rsp)
jne    1350 <standard_test+0x1a0>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\0AReading a witness set ...\0A\00"
@.str.1 = [32 x i8] c"\0AMENU for the kind of output :\0A\00"
@.str.2 = [49 x i8] c" 0. remain silent with no intermediate output;\0A\00"
@.str.3 = [46 x i8] c" 1. all intermediate output goes to screen;\0A\00"
@.str.4 = [52 x i8] c" 2. give a file name for all intermediate output.\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 = [30 x i8] c"\0AThe ambient dimension : %d.\0A\00"
@.str.9 = [41 x i8] c"The dimension of the solution set : %d.\0A\00"
@.str.10 = [38 x i8] c"The degree of the solution set : %d.\0A\00"
@.str.11 = [49 x i8] c"\0ADo you wish to see the embedded system ? (y/n) \00"
@.str.12 = [20 x i8] c"\0AThe system read :\0A\00"
@.str.13 = [37 x i8] c"\0AGive the maximum number of loops : \00"
@.str.14 = [34 x i8] c"See the output file for results.\0A\00"
define i32 @standard_test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i32 %0, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %1
%14 = call i32 @read_standard_Laurent_witness_set(i32* %4, i32* %5, i32* %6)
store i32 %14, i32* %3
br label %17
15: ; preds = %1
%16 = call i32 @read_witness_set(i32* %4, i32* %5, i32* %6)
store i32 %16, i32* %3
br label %17
17: ; preds = %15, %13
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %8)
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %9)
%25 = load i32, i32* %8
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %17
%28 = call i32 (...) @set_standard_state_to_silent()
store i32 %28, i32* %3
br label %29
29: ; preds = %27, %17
%30 = load i32, i32* %8
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (...) @define_output_file()
store i32 %33, i32* %3
br label %34
34: ; preds = %32, %29
%35 = load i32, i32* %4
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %5
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %6
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i32 %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0))
%42 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %9)
%43 = load i8, i8* %9
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 121
br i1 %45, label %46, label %55
46: ; preds = %34
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%48 = load i32, i32* %2
%49 = icmp eq i32 %48, 1
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 (...) @syscon_write_standard_Laurent_system()
store i32 %51, i32* %3
br label %54
52: ; preds = %46
%53 = call i32 (...) @syscon_write_standard_system()
store i32 %53, i32* %3
br label %54
54: ; preds = %52, %50
br label %55
55: ; preds = %54, %34
%56 = load i32, i32* %4
%57 = load i32, i32* %6
%58 = call i32 @assign_labels(i32 %56, i32 %57, i32 0)
store i32 %58, i32* %3
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0))
%60 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %7)
%61 = load i32, i32* %2
%62 = load i32, i32* %7
%63 = load i32, i32* %4
%64 = load i32, i32* %5
%65 = load i32, i32* %6
%66 = call i32 @standard_monodromy_breakup(i32 %61, i32 %62, i32 %63, i32 %64, i32 %65)
store i32 %66, i32* %3
%67 = load i32, i32* %8
%68 = icmp eq i32 %67, 2
br i1 %68, label %69, label %71
69: ; preds = %55
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.14, i64 0, i64 0))
br label %71
71: ; preds = %69, %55
ret i32 0
}

LLVM IR (-O2):
@.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 = [30 x i8] c"\0AThe ambient dimension : %d.\0A\00"
@.str.9 = [41 x i8] c"The dimension of the solution set : %d.\0A\00"
@.str.10 = [38 x i8] c"The degree of the solution set : %d.\0A\00"
@.str.11 = [49 x i8] c"\0ADo you wish to see the embedded system ? (y/n) \00"
@.str.13 = [37 x i8] c"\0AGive the maximum number of loops : \00"
@str = [27 x i8] c"\0AReading a witness set ...\00"
@str.15 = [31 x i8] c"\0AMENU for the kind of output :\00"
@str.16 = [48 x i8] c" 0. remain silent with no intermediate output;\00"
@str.17 = [45 x i8] c" 1. all intermediate output goes to screen;\00"
@str.18 = [51 x i8] c" 2. give a file name for all intermediate output.\00"
@str.19 = [33 x i8] c"See the output file for results.\00"
@str.20 = [19 x i8] c"\0AThe system read :\00"
define i32 @standard_test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%14 = icmp eq i32 %0, 1
br i1 %14, label %15, label %17
15: ; preds = %1
%16 = call i32 @read_standard_Laurent_witness_set(i32* %2, i32* %3, i32* %4)
br label %19
17: ; preds = %1
%18 = call i32 @read_witness_set(i32* %2, i32* %3, i32* %4)
br label %19
19: ; preds = %17, %15
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.15, i64 0, i64 0))
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.16, i64 0, i64 0))
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.17, i64 0, i64 0))
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.18, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %6)
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %7)
%27 = load i32, i32* %6
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %19
%30 = call i32 (...) @set_standard_state_to_silent()
%31 = load i32, i32* %6
br label %32
32: ; preds = %29, %19
%33 = phi i32 [ %31, %29 ], [ %27, %19 ]
%34 = icmp eq i32 %33, 2
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 (...) @define_output_file()
br label %37
37: ; preds = %35, %32
%38 = load i32, i32* %2
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %3
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %4
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0))
%45 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %7)
%46 = load i8, i8* %7
%47 = icmp eq i8 %46, 121
br i1 %47, label %48, label %54
48: ; preds = %37
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.20, i64 0, i64 0))
br i1 %14, label %50, label %52
50: ; preds = %48
%51 = call i32 (...) @syscon_write_standard_Laurent_system()
br label %54
52: ; preds = %48
%53 = call i32 (...) @syscon_write_standard_system()
br label %54
54: ; preds = %50, %52, %37
%55 = load i32, i32* %2
%56 = load i32, i32* %4
%57 = call i32 @assign_labels(i32 %55, i32 %56, i32 0)
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0))
%59 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %5)
%60 = load i32, i32* %5
%61 = load i32, i32* %2
%62 = load i32, i32* %3
%63 = load i32, i32* %4
%64 = call i32 @standard_monodromy_breakup(i32 %0, i32 %60, i32 %61, i32 %62, i32 %63)
%65 = load i32, i32* %6
%66 = icmp eq i32 %65, 2
br i1 %66, label %67, label %69
67: ; preds = %54
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.19, i64 0, i64 0))
br label %69
69: ; preds = %67, %54
ret i32 0
}