#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*/ ask_menu_selection(int *, int *);
int collapse_extrinsic_diagonal();
int create_the_diagonal_homotopy(int, int);
int create_the_homotopy(int);
int intersect_two_witness_sets(int, int, int, int, int, int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int read_file_names(int);
int read_two_witness_sets(int *, int *, int *, int *, int *, int *, int *);
int remove_last_slack_variable();
int run_cascade(int);
int run_path_trackers(int, int);
int test_crude_trackers(int);
int tune_parameters_and_output();
int witness_set_for_hypersurface();
int main(int argc, char *argv[]) {
  int fail, kind, monitor, n1, n2, a, b, d1, d2, cd;
  adainit();
  printf("\nCalling the path trackers in PHCpack...\n");
  ask_menu_selection(&kind, &monitor);
  if (kind == 9) {
    fail = test_crude_trackers(monitor);
    adafinal();
    return fail;
  }
  if (kind == 6) {
    fail = witness_set_for_hypersurface();
    adafinal();
    return fail;
  }
  if (kind == 7) {
    fail = collapse_extrinsic_diagonal();
    adafinal();
    return fail;
  }
  if (kind == 8) {
    fail = remove_last_slack_variable();
    adafinal();
    return fail;
  }
  if (kind < 5) {
    fail = read_file_names(kind);
    fail = create_the_homotopy(kind);
  } else {
    fail = read_two_witness_sets(&n1, &n2, &a, &b, &d1, &d2, &cd);
    fail = create_the_diagonal_homotopy(a, b);
  }
  if (fail > 0)
    printf("creation of homotopy fail = %d, no path tracking ...\n", fail);
  else {
    fail = tune_parameters_and_output();
    if (kind == 4)
      fail = run_cascade(monitor);
    else if (kind < 5)
      fail = run_path_trackers(kind, monitor);
    else
      fail = intersect_two_witness_sets(n1, n2, a, b, d1, d2, cd, monitor);
  }
  adafinal();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10c0 <adainit@plt>
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   10f0 <ask_menu_selection@plt>
cmpl   $0x9,-0x18(%rbp)
jne    125f <main+0x5f>
mov    -0x1c(%rbp),%edi
call   1110 <test_crude_trackers@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1070 <adafinal@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13d0 <main+0x1d0>
cmpl   $0x6,-0x18(%rbp)
jne    1285 <main+0x85>
mov    $0x0,%al
call   1080 <witness_set_for_hypersurface@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1070 <adafinal@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13d0 <main+0x1d0>
cmpl   $0x7,-0x18(%rbp)
jne    12ab <main+0xab>
mov    $0x0,%al
call   1100 <collapse_extrinsic_diagonal@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1070 <adafinal@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13d0 <main+0x1d0>
cmpl   $0x8,-0x18(%rbp)
jne    12d1 <main+0xd1>
mov    $0x0,%al
call   10e0 <remove_last_slack_variable@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1070 <adafinal@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13d0 <main+0x1d0>
cmpl   $0x5,-0x18(%rbp)
jge    12f6 <main+0xf6>
mov    -0x18(%rbp),%edi
call   1050 <read_file_names@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%edi
call   10d0 <create_the_homotopy@plt>
mov    %eax,-0x14(%rbp)
jmp    132c <main+0x12c>
lea    -0x20(%rbp),%rdi
lea    -0x24(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
lea    -0x30(%rbp),%r8
lea    -0x34(%rbp),%r9
lea    -0x38(%rbp),%rax
mov    %rax,(%rsp)
call   10a0 <read_two_witness_sets@plt>
mov    %eax,-0x14(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
call   1090 <create_the_diagonal_homotopy@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    134c <main+0x14c>
mov    -0x14(%rbp),%esi
lea    0xcea(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13c2 <main+0x1c2>
mov    $0x0,%al
call   1120 <tune_parameters_and_output@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x4,-0x18(%rbp)
jne    1370 <main+0x170>
mov    -0x1c(%rbp),%edi
call   10b0 <run_cascade@plt>
mov    %eax,-0x14(%rbp)
jmp    13bd <main+0x1bd>
cmpl   $0x5,-0x18(%rbp)
jge    138d <main+0x18d>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1030 <run_path_trackers@plt>
mov    %eax,-0x14(%rbp)
jmp    13b8 <main+0x1b8>
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    -0x34(%rbp),%r9d
mov    -0x38(%rbp),%r10d
mov    -0x1c(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1060 <intersect_two_witness_sets@plt>
mov    %eax,-0x14(%rbp)
jmp    13bd <main+0x1bd>
jmp    13c2 <main+0x1c2>
mov    $0x0,%al
call   1070 <adafinal@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xor    %eax,%eax
call   10d0 <adainit@plt>
lea    0xe23(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1100 <ask_menu_selection@plt>
mov    0x10(%rsp),%edi
lea    -0x6(%rdi),%eax
cmp    $0x3,%eax
ja     1261 <main+0x51>
lea    0xdb6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1090 <witness_set_for_hypersurface@plt>
mov    %eax,%ebx
jmp    1362 <main+0x152>
cmp    $0x4,%edi
jg     12cc <main+0xbc>
call   1060 <read_file_names@plt>
mov    0x10(%rsp),%edi
call   10e0 <create_the_homotopy@plt>
test   %eax,%eax
jg     1312 <main+0x102>
xor    %ebx,%ebx
xor    %eax,%eax
call   1130 <tune_parameters_and_output@plt>
mov    0x10(%rsp),%edi
cmp    $0x4,%edi
jne    1326 <main+0x116>
mov    0xc(%rsp),%edi
call   10c0 <run_cascade@plt>
jmp    1362 <main+0x152>
xor    %eax,%eax
call   1110 <collapse_extrinsic_diagonal@plt>
mov    %eax,%ebx
jmp    1362 <main+0x152>
xor    %eax,%eax
call   10f0 <remove_last_slack_variable@plt>
mov    %eax,%ebx
jmp    1362 <main+0x152>
mov    0xc(%rsp),%edi
call   1120 <test_crude_trackers@plt>
mov    %eax,%ebx
jmp    1362 <main+0x152>
sub    $0x8,%rsp
lea    0x24(%rsp),%rax
lea    0x34(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x1c(%rsp),%rcx
lea    0x2c(%rsp),%r8
lea    0x28(%rsp),%r9
push   %rax
call   10b0 <read_two_witness_sets@plt>
add    $0x10,%rsp
mov    0x18(%rsp),%edi
mov    0x14(%rsp),%esi
call   10a0 <create_the_diagonal_homotopy@plt>
test   %eax,%eax
jle    127c <main+0x6c>
lea    0xcf7(%rip),%rdi
xor    %ebx,%ebx
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1362 <main+0x152>
jg     1333 <main+0x123>
mov    0xc(%rsp),%esi
call   1040 <run_path_trackers@plt>
jmp    1360 <main+0x150>
mov    0x2c(%rsp),%edi
mov    0x28(%rsp),%esi
mov    0x18(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    0x24(%rsp),%r8d
mov    0x20(%rsp),%r9d
mov    0x1c(%rsp),%eax
mov    0xc(%rsp),%ebx
push   %rbx
push   %rax
call   1070 <intersect_two_witness_sets@plt>
add    $0x10,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <adafinal@plt>
mov    %ebx,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"\0ACalling the path trackers in PHCpack...\0A\00"
@.str.1 = [54 x i8] c"creation of homotopy fail = %d, no path tracking ...\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = call i32 (...) @adainit()
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @ask_menu_selection(i32* %7, i32* %8)
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 9
br i1 %20, label %21, label %26
21: ; preds = %2
%22 = load i32, i32* %8
%23 = call i32 @test_crude_trackers(i32 %22)
store i32 %23, i32* %6
%24 = call i32 (...) @adafinal()
%25 = load i32, i32* %6
store i32 %25, i32* %3
br label %94
26: ; preds = %2
%27 = load i32, i32* %7
%28 = icmp eq i32 %27, 6
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = call i32 (...) @witness_set_for_hypersurface()
store i32 %30, i32* %6
%31 = call i32 (...) @adafinal()
%32 = load i32, i32* %6
store i32 %32, i32* %3
br label %94
33: ; preds = %26
%34 = load i32, i32* %7
%35 = icmp eq i32 %34, 7
br i1 %35, label %36, label %40
36: ; preds = %33
%37 = call i32 (...) @collapse_extrinsic_diagonal()
store i32 %37, i32* %6
%38 = call i32 (...) @adafinal()
%39 = load i32, i32* %6
store i32 %39, i32* %3
br label %94
40: ; preds = %33
%41 = load i32, i32* %7
%42 = icmp eq i32 %41, 8
br i1 %42, label %43, label %47
43: ; preds = %40
%44 = call i32 (...) @remove_last_slack_variable()
store i32 %44, i32* %6
%45 = call i32 (...) @adafinal()
%46 = load i32, i32* %6
store i32 %46, i32* %3
br label %94
47: ; preds = %40
%48 = load i32, i32* %7
%49 = icmp slt i32 %48, 5
br i1 %49, label %50, label %55
50: ; preds = %47
%51 = load i32, i32* %7
%52 = call i32 @read_file_names(i32 %51)
store i32 %52, i32* %6
%53 = load i32, i32* %7
%54 = call i32 @create_the_homotopy(i32 %53)
store i32 %54, i32* %6
br label %60
55: ; preds = %47
%56 = call i32 @read_two_witness_sets(i32* %9, i32* %10, i32* %11, i32* %12, i32* %13, i32* %14, i32* %15)
store i32 %56, i32* %6
%57 = load i32, i32* %11
%58 = load i32, i32* %12
%59 = call i32 @create_the_diagonal_homotopy(i32 %57, i32 %58)
store i32 %59, i32* %6
br label %60
60: ; preds = %55, %50
%61 = load i32, i32* %6
%62 = icmp sgt i32 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %60
%64 = load i32, i32* %6
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 %64)
br label %92
66: ; preds = %60
%67 = call i32 (...) @tune_parameters_and_output()
store i32 %67, i32* %6
%68 = load i32, i32* %7
%69 = icmp eq i32 %68, 4
br i1 %69, label %70, label %73
70: ; preds = %66
%71 = load i32, i32* %8
%72 = call i32 @run_cascade(i32 %71)
store i32 %72, i32* %6
br label %91
73: ; preds = %66
%74 = load i32, i32* %7
%75 = icmp slt i32 %74, 5
br i1 %75, label %76, label %80
76: ; preds = %73
%77 = load i32, i32* %7
%78 = load i32, i32* %8
%79 = call i32 @run_path_trackers(i32 %77, i32 %78)
store i32 %79, i32* %6
br label %90
80: ; preds = %73
%81 = load i32, i32* %9
%82 = load i32, i32* %10
%83 = load i32, i32* %11
%84 = load i32, i32* %12
%85 = load i32, i32* %13
%86 = load i32, i32* %14
%87 = load i32, i32* %15
%88 = load i32, i32* %8
%89 = call i32 @intersect_two_witness_sets(i32 %81, i32 %82, i32 %83, i32 %84, i32 %85, i32 %86, i32 %87, i32 %88)
store i32 %89, i32* %6
br label %90
90: ; preds = %80, %76
br label %91
91: ; preds = %90, %70
br label %92
92: ; preds = %91, %63
%93 = call i32 (...) @adafinal()
store i32 0, i32* %3
br label %94
94: ; preds = %92, %43, %36, %29, %21
%95 = load i32, i32* %3
ret i32 %95
}

LLVM IR (-O2):
@.str.1 = [54 x i8] c"creation of homotopy fail = %d, no path tracking ...\0A\00"
@str = [41 x i8] c"\0ACalling the path trackers in PHCpack...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = bitcast i32* %3 to i8*
%13 = bitcast i32* %4 to i8*
%14 = bitcast i32* %5 to i8*
%15 = bitcast i32* %6 to i8*
%16 = bitcast i32* %7 to i8*
%17 = bitcast i32* %8 to i8*
%18 = bitcast i32* %9 to i8*
%19 = bitcast i32* %10 to i8*
%20 = bitcast i32* %11 to i8*
%21 = tail call i32 (...) @adainit()
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%23 = call i32 @ask_menu_selection(i32* %3, i32* %4)
%24 = load i32, i32* %3
switch i32 %24, label %34 [
i32 9, label %25
i32 6, label %28
i32 7, label %30
i32 8, label %32
]
25: ; preds = %2
%26 = load i32, i32* %4
%27 = call i32 @test_crude_trackers(i32 %26)
br label %72
28: ; preds = %2
%29 = call i32 (...) @witness_set_for_hypersurface()
br label %72
30: ; preds = %2
%31 = call i32 (...) @collapse_extrinsic_diagonal()
br label %72
32: ; preds = %2
%33 = call i32 (...) @remove_last_slack_variable()
br label %72
34: ; preds = %2
%35 = icmp slt i32 %24, 5
br i1 %35, label %36, label %40
36: ; preds = %34
%37 = call i32 @read_file_names(i32 %24)
%38 = load i32, i32* %3
%39 = call i32 @create_the_homotopy(i32 %38)
br label %45
40: ; preds = %34
%41 = call i32 @read_two_witness_sets(i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11)
%42 = load i32, i32* %7
%43 = load i32, i32* %8
%44 = call i32 @create_the_diagonal_homotopy(i32 %42, i32 %43)
br label %45
45: ; preds = %40, %36
%46 = phi i32 [ %39, %36 ], [ %44, %40 ]
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 %46)
br label %72
50: ; preds = %45
%51 = call i32 (...) @tune_parameters_and_output()
%52 = load i32, i32* %3
%53 = icmp eq i32 %52, 4
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = load i32, i32* %4
%56 = call i32 @run_cascade(i32 %55)
br label %72
57: ; preds = %50
%58 = icmp slt i32 %52, 5
br i1 %58, label %59, label %62
59: ; preds = %57
%60 = load i32, i32* %4
%61 = call i32 @run_path_trackers(i32 %52, i32 %60)
br label %72
62: ; preds = %57
%63 = load i32, i32* %5
%64 = load i32, i32* %6
%65 = load i32, i32* %7
%66 = load i32, i32* %8
%67 = load i32, i32* %9
%68 = load i32, i32* %10
%69 = load i32, i32* %11
%70 = load i32, i32* %4
%71 = call i32 @intersect_two_witness_sets(i32 %63, i32 %64, i32 %65, i32 %66, i32 %67, i32 %68, i32 %69, i32 %70)
br label %72
72: ; preds = %48, %59, %62, %54, %32, %30, %28, %25
%73 = phi i32 [ %27, %25 ], [ %29, %28 ], [ %31, %30 ], [ %33, %32 ], [ 0, %54 ], [ 0, %62 ], [ 0, %59 ], [ 0, %48 ]
%74 = call i32 (...) @adafinal()
ret i32 %73
}