#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 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 == 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    0xdec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   10f0 <ask_menu_selection@plt>
cmpl   $0x6,-0x18(%rbp)
jne    124e <main+0x5e>
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    1399 <main+0x1a9>
cmpl   $0x7,-0x18(%rbp)
jne    1274 <main+0x84>
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    1399 <main+0x1a9>
cmpl   $0x8,-0x18(%rbp)
jne    129a <main+0xaa>
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    1399 <main+0x1a9>
cmpl   $0x5,-0x18(%rbp)
jge    12bf <main+0xcf>
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    12f5 <main+0x105>
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    1315 <main+0x125>
mov    -0x14(%rbp),%esi
lea    0xd21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    138b <main+0x19b>
mov    $0x0,%al
call   1110 <tune_parameters_and_output@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x4,-0x18(%rbp)
jne    1339 <main+0x149>
mov    -0x1c(%rbp),%edi
call   10b0 <run_cascade@plt>
mov    %eax,-0x14(%rbp)
jmp    1386 <main+0x196>
cmpl   $0x5,-0x18(%rbp)
jge    1356 <main+0x166>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1030 <run_path_trackers@plt>
mov    %eax,-0x14(%rbp)
jmp    1381 <main+0x191>
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    1386 <main+0x196>
jmp    138b <main+0x19b>
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
cmp    $0x8,%edi
je     1248 <main+0x48>
cmp    $0x7,%edi
je     1256 <main+0x56>
cmp    $0x6,%edi
jne    1264 <main+0x64>
xor    %eax,%eax
call   1090 <witness_set_for_hypersurface@plt>
mov    %eax,%ebx
jmp    132d <main+0x12d>
xor    %eax,%eax
call   10f0 <remove_last_slack_variable@plt>
mov    %eax,%ebx
jmp    132d <main+0x12d>
xor    %eax,%eax
call   1110 <collapse_extrinsic_diagonal@plt>
mov    %eax,%ebx
jmp    132d <main+0x12d>
cmp    $0x4,%edi
jg     129b <main+0x9b>
call   1060 <read_file_names@plt>
mov    0x10(%rsp),%edi
call   10e0 <create_the_homotopy@plt>
test   %eax,%eax
jg     12dd <main+0xdd>
xor    %ebx,%ebx
xor    %eax,%eax
call   1120 <tune_parameters_and_output@plt>
mov    0x10(%rsp),%edi
cmp    $0x4,%edi
jne    12f1 <main+0xf1>
mov    0xc(%rsp),%edi
call   10c0 <run_cascade@plt>
jmp    132d <main+0x12d>
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    127b <main+0x7b>
lea    0xd1c(%rip),%rdi
xor    %ebx,%ebx
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    132d <main+0x12d>
jg     12fe <main+0xfe>
mov    0xc(%rsp),%esi
call   1040 <run_path_trackers@plt>
jmp    132b <main+0x12b>
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, 6
br i1 %20, label %21, label %25
21: ; preds = %2
%22 = call i32 (...) @witness_set_for_hypersurface()
store i32 %22, i32* %6
%23 = call i32 (...) @adafinal()
%24 = load i32, i32* %6
store i32 %24, i32* %3
br label %86
25: ; preds = %2
%26 = load i32, i32* %7
%27 = icmp eq i32 %26, 7
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = call i32 (...) @collapse_extrinsic_diagonal()
store i32 %29, i32* %6
%30 = call i32 (...) @adafinal()
%31 = load i32, i32* %6
store i32 %31, i32* %3
br label %86
32: ; preds = %25
%33 = load i32, i32* %7
%34 = icmp eq i32 %33, 8
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = call i32 (...) @remove_last_slack_variable()
store i32 %36, i32* %6
%37 = call i32 (...) @adafinal()
%38 = load i32, i32* %6
store i32 %38, i32* %3
br label %86
39: ; preds = %32
%40 = load i32, i32* %7
%41 = icmp slt i32 %40, 5
br i1 %41, label %42, label %47
42: ; preds = %39
%43 = load i32, i32* %7
%44 = call i32 @read_file_names(i32 %43)
store i32 %44, i32* %6
%45 = load i32, i32* %7
%46 = call i32 @create_the_homotopy(i32 %45)
store i32 %46, i32* %6
br label %52
47: ; preds = %39
%48 = call i32 @read_two_witness_sets(i32* %9, i32* %10, i32* %11, i32* %12, i32* %13, i32* %14, i32* %15)
store i32 %48, i32* %6
%49 = load i32, i32* %11
%50 = load i32, i32* %12
%51 = call i32 @create_the_diagonal_homotopy(i32 %49, i32 %50)
store i32 %51, i32* %6
br label %52
52: ; preds = %47, %42
%53 = load i32, i32* %6
%54 = icmp sgt i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %52
%56 = load i32, i32* %6
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 %56)
br label %84
58: ; preds = %52
%59 = call i32 (...) @tune_parameters_and_output()
store i32 %59, i32* %6
%60 = load i32, i32* %7
%61 = icmp eq i32 %60, 4
br i1 %61, label %62, label %65
62: ; preds = %58
%63 = load i32, i32* %8
%64 = call i32 @run_cascade(i32 %63)
store i32 %64, i32* %6
br label %83
65: ; preds = %58
%66 = load i32, i32* %7
%67 = icmp slt i32 %66, 5
br i1 %67, label %68, label %72
68: ; preds = %65
%69 = load i32, i32* %7
%70 = load i32, i32* %8
%71 = call i32 @run_path_trackers(i32 %69, i32 %70)
store i32 %71, i32* %6
br label %82
72: ; preds = %65
%73 = load i32, i32* %9
%74 = load i32, i32* %10
%75 = load i32, i32* %11
%76 = load i32, i32* %12
%77 = load i32, i32* %13
%78 = load i32, i32* %14
%79 = load i32, i32* %15
%80 = load i32, i32* %8
%81 = call i32 @intersect_two_witness_sets(i32 %73, i32 %74, i32 %75, i32 %76, i32 %77, i32 %78, i32 %79, i32 %80)
store i32 %81, i32* %6
br label %82
82: ; preds = %72, %68
br label %83
83: ; preds = %82, %62
br label %84
84: ; preds = %83, %55
%85 = call i32 (...) @adafinal()
store i32 0, i32* %3
br label %86
86: ; preds = %84, %35, %28, %21
%87 = load i32, i32* %3
ret i32 %87
}

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 %31 [
i32 6, label %25
i32 7, label %27
i32 8, label %29
]
25: ; preds = %2
%26 = call i32 (...) @witness_set_for_hypersurface()
br label %69
27: ; preds = %2
%28 = call i32 (...) @collapse_extrinsic_diagonal()
br label %69
29: ; preds = %2
%30 = call i32 (...) @remove_last_slack_variable()
br label %69
31: ; preds = %2
%32 = icmp slt i32 %24, 5
br i1 %32, label %33, label %37
33: ; preds = %31
%34 = call i32 @read_file_names(i32 %24)
%35 = load i32, i32* %3
%36 = call i32 @create_the_homotopy(i32 %35)
br label %42
37: ; preds = %31
%38 = call i32 @read_two_witness_sets(i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11)
%39 = load i32, i32* %7
%40 = load i32, i32* %8
%41 = call i32 @create_the_diagonal_homotopy(i32 %39, i32 %40)
br label %42
42: ; preds = %37, %33
%43 = phi i32 [ %36, %33 ], [ %41, %37 ]
%44 = icmp sgt i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 %43)
br label %69
47: ; preds = %42
%48 = call i32 (...) @tune_parameters_and_output()
%49 = load i32, i32* %3
%50 = icmp eq i32 %49, 4
br i1 %50, label %51, label %54
51: ; preds = %47
%52 = load i32, i32* %4
%53 = call i32 @run_cascade(i32 %52)
br label %69
54: ; preds = %47
%55 = icmp slt i32 %49, 5
br i1 %55, label %56, label %59
56: ; preds = %54
%57 = load i32, i32* %4
%58 = call i32 @run_path_trackers(i32 %49, i32 %57)
br label %69
59: ; preds = %54
%60 = load i32, i32* %5
%61 = load i32, i32* %6
%62 = load i32, i32* %7
%63 = load i32, i32* %8
%64 = load i32, i32* %9
%65 = load i32, i32* %10
%66 = load i32, i32* %11
%67 = load i32, i32* %4
%68 = call i32 @intersect_two_witness_sets(i32 %60, i32 %61, i32 %62, i32 %63, i32 %64, i32 %65, i32 %66, i32 %67)
br label %69
69: ; preds = %45, %56, %59, %51, %29, %27, %25
%70 = phi i32 [ %26, %25 ], [ %28, %27 ], [ %30, %29 ], [ 0, %51 ], [ 0, %59 ], [ 0, %56 ], [ 0, %45 ]
%71 = call i32 (...) @adafinal()
ret i32 %70
}