#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 copy_start_solutions_to_container();
int copy_target_solutions_to_container();
char getchar();
int padcon_standard_initialize_homotopy(int, int);
int padcon_standard_initialize_parameter_homotopy(int, int);
int /*<<< orphan*/ printf(char *, ...);
int prompt_for_artificial();
int prompt_for_parameter();
int read_standard_start_system();
int read_standard_target_system();
int /*<<< orphan*/ scanf(char *, char *);
int solcon_dimension_of_standard_solutions(int *);
int solcon_number_of_standard_solutions(int *);
int solcon_standard_drop_coordinate_by_index(int);
int solcon_standard_set_continuation_parameter();
int /*<<< orphan*/ standard_next_loop(int);
void standard_next_step(int homo) {
  int fail, length, index, strlensol, dim, arthom;
  int idx = 0;
  char contstep, nlsb;
  arthom = prompt_for_artificial();
  if (arthom == 1) {
    fail = read_standard_target_system();
    fail = read_standard_start_system();
    fail = copy_start_solutions_to_container();
  } else {
    fail = read_standard_target_system();
    fail = copy_target_solutions_to_container();
    idx = prompt_for_parameter();
    fail = solcon_standard_drop_coordinate_by_index(idx);
    fail = solcon_standard_set_continuation_parameter();
  }
  fail = solcon_number_of_standard_solutions(&length);
  fail = solcon_dimension_of_standard_solutions(&dim);
  printf("Read %d start solutions in dimension %d.\n", length, dim);
  if (idx == 0)
    fail = padcon_standard_initialize_homotopy(1, homo);
  else
    fail = padcon_standard_initialize_parameter_homotopy(idx, 1);
  for (index = 1; index <= length; index++) {
    printf("\nTracking path %d ...\n", index);
    standard_next_loop(index);
    if (index == length)
      break;
    printf("Continue with the next solution ? (y/n) ");
    contstep = getchar();
    scanf("%c", &nlsb);
    if (contstep != 'y')
      break;
  }
}


x86 assembly (clang, -O0):
<standard_next_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x20(%rbp)
mov    $0x0,%al
call   1060 <prompt_for_artificial@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    1249 <standard_next_step+0x49>
mov    $0x0,%al
call   1040 <read_standard_target_system@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   10c0 <read_standard_start_system@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   10b0 <copy_start_solutions_to_container@plt>
mov    %eax,-0x8(%rbp)
jmp    127c <standard_next_step+0x7c>
mov    $0x0,%al
call   1040 <read_standard_target_system@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <copy_target_solutions_to_container@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   10f0 <prompt_for_parameter@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
call   10e0 <solcon_standard_drop_coordinate_by_index@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1110 <solcon_standard_set_continuation_parameter@plt>
mov    %eax,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   10a0 <solcon_number_of_standard_solutions@plt>
mov    %eax,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
call   10d0 <solcon_dimension_of_standard_solutions@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x0,-0x20(%rbp)
jne    12c7 <standard_next_step+0xc7>
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1080 <padcon_standard_initialize_homotopy@plt>
mov    %eax,-0x8(%rbp)
jmp    12d7 <standard_next_step+0xd7>
mov    -0x20(%rbp),%edi
mov    $0x1,%esi
call   1120 <padcon_standard_initialize_parameter_homotopy@plt>
mov    %eax,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1361 <standard_next_step+0x161>
mov    -0x10(%rbp),%esi
lea    0xd36(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%edi
call   1030 <standard_next_loop@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1314 <standard_next_step+0x114>
jmp    1361 <standard_next_step+0x161>
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
mov    %al,-0x21(%rbp)
lea    0xd37(%rip),%rdi
lea    -0x22(%rbp),%rsi
call   1100 <scanf@plt>
movsbl -0x21(%rbp),%eax
cmp    $0x79,%eax
je     134e <standard_next_step+0x14e>
jmp    1361 <standard_next_step+0x161>
jmp    1353 <standard_next_step+0x153>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    12de <standard_next_step+0xde>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standard_next_step>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r14d
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <prompt_for_artificial@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <read_standard_target_system@plt>
xor    %eax,%eax
cmp    $0x1,%ebx
jne    1238 <standard_next_step+0x38>
call   10c0 <read_standard_start_system@plt>
xor    %eax,%eax
call   10b0 <copy_start_solutions_to_container@plt>
jmp    1254 <standard_next_step+0x54>
call   1050 <copy_target_solutions_to_container@plt>
xor    %eax,%eax
call   10f0 <prompt_for_parameter@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   10e0 <solcon_standard_drop_coordinate_by_index@plt>
xor    %eax,%eax
call   1110 <solcon_standard_set_continuation_parameter@plt>
lea    0xc(%rsp),%rdi
call   10a0 <solcon_number_of_standard_solutions@plt>
lea    0x14(%rsp),%rdi
call   10d0 <solcon_dimension_of_standard_solutions@plt>
mov    0xc(%rsp),%esi
mov    0x14(%rsp),%edx
lea    0xd89(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
test   %ebp,%ebp
je     1297 <standard_next_step+0x97>
mov    %ebp,%edi
mov    $0x1,%esi
call   1120 <padcon_standard_initialize_parameter_homotopy@plt>
cmpl   $0x0,0xc(%rsp)
jg     12ab <standard_next_step+0xab>
jmp    1315 <standard_next_step+0x115>
mov    $0x1,%edi
mov    %r14d,%esi
call   1080 <padcon_standard_initialize_homotopy@plt>
cmpl   $0x0,0xc(%rsp)
jle    1315 <standard_next_step+0x115>
lea    0xd78(%rip),%r15
lea    0xd88(%rip),%r14
lea    0xdaa(%rip),%r12
lea    0x13(%rsp),%r13
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%edi
call   1030 <standard_next_loop@plt>
cmp    0xc(%rsp),%ebp
je     1315 <standard_next_step+0x115>
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
mov    %eax,%ebx
mov    %r12,%rdi
mov    %r13,%rsi
call   1100 <scanf@plt>
cmp    $0x79,%bl
jne    1315 <standard_next_step+0x115>
cmp    0xc(%rsp),%ebp
jl     12d0 <standard_next_step+0xd0>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Read %d start solutions in dimension %d.\0A\00"
@.str.1 = [23 x i8] c"\0ATracking path %d ...\0A\00"
@.str.2 = [41 x i8] c"Continue with the next solution ? (y/n) \00"
@.str.3 = [3 x i8] c"%c\00"
define void @standard_next_step(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 i32
%10 = alloca i8
%11 = alloca i8
store i32 %0, i32* %2
store i32 0, i32* %9
%12 = call i32 (...) @prompt_for_artificial()
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %19
15: ; preds = %1
%16 = call i32 (...) @read_standard_target_system()
store i32 %16, i32* %3
%17 = call i32 (...) @read_standard_start_system()
store i32 %17, i32* %3
%18 = call i32 (...) @copy_start_solutions_to_container()
store i32 %18, i32* %3
br label %26
19: ; preds = %1
%20 = call i32 (...) @read_standard_target_system()
store i32 %20, i32* %3
%21 = call i32 (...) @copy_target_solutions_to_container()
store i32 %21, i32* %3
%22 = call i32 (...) @prompt_for_parameter()
store i32 %22, i32* %9
%23 = load i32, i32* %9
%24 = call i32 @solcon_standard_drop_coordinate_by_index(i32 %23)
store i32 %24, i32* %3
%25 = call i32 (...) @solcon_standard_set_continuation_parameter()
store i32 %25, i32* %3
br label %26
26: ; preds = %19, %15
%27 = call i32 @solcon_number_of_standard_solutions(i32* %4)
store i32 %27, i32* %3
%28 = call i32 @solcon_dimension_of_standard_solutions(i32* %7)
store i32 %28, i32* %3
%29 = load i32, i32* %4
%30 = load i32, i32* %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %30)
%32 = load i32, i32* %9
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %26
%35 = load i32, i32* %2
%36 = call i32 @padcon_standard_initialize_homotopy(i32 1, i32 %35)
store i32 %36, i32* %3
br label %40
37: ; preds = %26
%38 = load i32, i32* %9
%39 = call i32 @padcon_standard_initialize_parameter_homotopy(i32 %38, i32 1)
store i32 %39, i32* %3
br label %40
40: ; preds = %37, %34
store i32 1, i32* %5
br label %41
41: ; preds = %63, %40
%42 = load i32, i32* %5
%43 = load i32, i32* %4
%44 = icmp sle i32 %42, %43
br i1 %44, label %45, label %66
45: ; preds = %41
%46 = load i32, i32* %5
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %5
%49 = call i32 @standard_next_loop(i32 %48)
%50 = load i32, i32* %5
%51 = load i32, i32* %4
%52 = icmp eq i32 %50, %51
br i1 %52, label %53, label %54
53: ; preds = %45
br label %66
54: ; preds = %45
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%56 = call signext i8 (...) @getchar()
store i8 %56, i8* %10
%57 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %11)
%58 = load i8, i8* %10
%59 = sext i8 %58 to i32
%60 = icmp ne i32 %59, 121
br i1 %60, label %61, label %62
61: ; preds = %54
br label %66
62: ; preds = %54
br label %63
63: ; preds = %62
%64 = load i32, i32* %5
%65 = add nsw i32 %64, 1
store i32 %65, i32* %5
br label %41
66: ; preds = %61, %53, %41
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"Read %d start solutions in dimension %d.\0A\00"
@.str.1 = [23 x i8] c"\0ATracking path %d ...\0A\00"
@.str.2 = [41 x i8] c"Continue with the next solution ? (y/n) \00"
@.str.3 = [3 x i8] c"%c\00"
define void @standard_next_step(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (...) @prompt_for_artificial()
%8 = icmp eq i32 %7, 1
%9 = tail call i32 (...) @read_standard_target_system()
br i1 %8, label %10, label %13
10: ; preds = %1
%11 = tail call i32 (...) @read_standard_start_system()
%12 = tail call i32 (...) @copy_start_solutions_to_container()
br label %18
13: ; preds = %1
%14 = tail call i32 (...) @copy_target_solutions_to_container()
%15 = tail call i32 (...) @prompt_for_parameter()
%16 = tail call i32 @solcon_standard_drop_coordinate_by_index(i32 %15)
%17 = tail call i32 (...) @solcon_standard_set_continuation_parameter()
br label %18
18: ; preds = %13, %10
%19 = phi i32 [ 0, %10 ], [ %15, %13 ]
%20 = call i32 @solcon_number_of_standard_solutions(i32* %2)
%21 = call i32 @solcon_dimension_of_standard_solutions(i32* %3)
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %23)
%25 = icmp eq i32 %19, 0
br i1 %25, label %26, label %28
26: ; preds = %18
%27 = call i32 @padcon_standard_initialize_homotopy(i32 1, i32 %0)
br label %30
28: ; preds = %18
%29 = call i32 @padcon_standard_initialize_parameter_homotopy(i32 %19, i32 1)
br label %30
30: ; preds = %28, %26
%31 = load i32, i32* %2
%32 = icmp slt i32 %31, 1
br i1 %32, label %48, label %37
33: ; preds = %43
%34 = add nuw nsw i32 %38, 1
%35 = load i32, i32* %2
%36 = icmp slt i32 %38, %35
br i1 %36, label %37, label %48
37: ; preds = %30, %33
%38 = phi i32 [ %34, %33 ], [ 1, %30 ]
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = call i32 @standard_next_loop(i32 %38)
%41 = load i32, i32* %2
%42 = icmp eq i32 %38, %41
br i1 %42, label %48, label %43
43: ; preds = %37
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%45 = call signext i8 (...) @getchar()
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%47 = icmp eq i8 %45, 121
br i1 %47, label %33, label %48
48: ; preds = %33, %37, %43, %30
ret void
}