#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_quaddobl_start_solutions_to_container();
int copy_quaddobl_target_solutions_to_container();
char getchar();
int padcon_quaddobl_initialize_homotopy(int, int);
int padcon_quaddobl_initialize_parameter_homotopy(int, int);
int /*<<< orphan*/ printf(char *, ...);
int prompt_for_artificial();
int prompt_for_parameter();
int /*<<< orphan*/ quaddobl_next_loop(int);
int read_quaddobl_start_system();
int read_quaddobl_target_system();
int /*<<< orphan*/ scanf(char *, char *);
int solcon_dimension_of_quaddobl_solutions(int *);
int solcon_number_of_quaddobl_solutions(int *);
int solcon_quaddobl_drop_coordinate_by_index(int);
int solcon_quaddobl_set_continuation_parameter();
void quaddobl_next_step(int homo) {
  int fail, length, index, failed, strlensol, dim, arthom;
  int idx = 0;
  char contstep, nlsb;
  double frp, re_pole, im_pole, tval, step;
  arthom = prompt_for_artificial();
  if (arthom == 1) {
    fail = read_quaddobl_target_system();
    fail = read_quaddobl_start_system();
    fail = copy_quaddobl_start_solutions_to_container();
  } else {
    fail = read_quaddobl_target_system();
    fail = copy_quaddobl_target_solutions_to_container();
    idx = prompt_for_parameter();
    fail = solcon_quaddobl_drop_coordinate_by_index(idx);
    fail = solcon_quaddobl_set_continuation_parameter();
  }
  fail = solcon_number_of_quaddobl_solutions(&length);
  fail = solcon_dimension_of_quaddobl_solutions(&dim);
  printf("Read %d start solutions of dimension %d.\n", length, dim);
  if (idx == 0)
    fail = padcon_quaddobl_initialize_homotopy(1, homo);
  else
    fail = padcon_quaddobl_initialize_parameter_homotopy(idx, 1);
  for (index = 1; index <= length; index++) {
    printf("\nTracking path %d ...\n", index);
    quaddobl_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):
<quaddobl_next_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
mov    $0x0,%al
call   1040 <prompt_for_artificial@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x1,-0x20(%rbp)
jne    1249 <quaddobl_next_step+0x49>
mov    $0x0,%al
call   1060 <read_quaddobl_target_system@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <read_quaddobl_start_system@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   10f0 <copy_quaddobl_start_solutions_to_container@plt>
mov    %eax,-0x8(%rbp)
jmp    127c <quaddobl_next_step+0x7c>
mov    $0x0,%al
call   1060 <read_quaddobl_target_system@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1120 <copy_quaddobl_target_solutions_to_container@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1100 <prompt_for_parameter@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
call   10c0 <solcon_quaddobl_drop_coordinate_by_index@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   10d0 <solcon_quaddobl_set_continuation_parameter@plt>
mov    %eax,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1070 <solcon_number_of_quaddobl_solutions@plt>
mov    %eax,-0x8(%rbp)
lea    -0x1c(%rbp),%rdi
call   10b0 <solcon_dimension_of_quaddobl_solutions@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
cmpl   $0x0,-0x24(%rbp)
jne    12c7 <quaddobl_next_step+0xc7>
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1090 <padcon_quaddobl_initialize_homotopy@plt>
mov    %eax,-0x8(%rbp)
jmp    12d7 <quaddobl_next_step+0xd7>
mov    -0x24(%rbp),%edi
mov    $0x1,%esi
call   1050 <padcon_quaddobl_initialize_parameter_homotopy@plt>
mov    %eax,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1361 <quaddobl_next_step+0x161>
mov    -0x10(%rbp),%esi
lea    0xd36(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x10(%rbp),%edi
call   10e0 <quaddobl_next_loop@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1314 <quaddobl_next_step+0x114>
jmp    1361 <quaddobl_next_step+0x161>
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x0,%al
call   10a0 <getchar@plt>
mov    %al,-0x25(%rbp)
lea    0xd37(%rip),%rdi
lea    -0x26(%rbp),%rsi
call   1110 <scanf@plt>
movsbl -0x25(%rbp),%eax
cmp    $0x79,%eax
je     134e <quaddobl_next_step+0x14e>
jmp    1361 <quaddobl_next_step+0x161>
jmp    1353 <quaddobl_next_step+0x153>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    12de <quaddobl_next_step+0xde>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quaddobl_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   1040 <prompt_for_artificial@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <read_quaddobl_target_system@plt>
xor    %eax,%eax
cmp    $0x1,%ebx
jne    1238 <quaddobl_next_step+0x38>
call   1030 <read_quaddobl_start_system@plt>
xor    %eax,%eax
call   10f0 <copy_quaddobl_start_solutions_to_container@plt>
jmp    1254 <quaddobl_next_step+0x54>
call   1120 <copy_quaddobl_target_solutions_to_container@plt>
xor    %eax,%eax
call   1100 <prompt_for_parameter@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   10c0 <solcon_quaddobl_drop_coordinate_by_index@plt>
xor    %eax,%eax
call   10d0 <solcon_quaddobl_set_continuation_parameter@plt>
lea    0xc(%rsp),%rdi
call   1070 <solcon_number_of_quaddobl_solutions@plt>
lea    0x14(%rsp),%rdi
call   10b0 <solcon_dimension_of_quaddobl_solutions@plt>
mov    0xc(%rsp),%esi
mov    0x14(%rsp),%edx
lea    0xd89(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
test   %ebp,%ebp
je     1297 <quaddobl_next_step+0x97>
mov    %ebp,%edi
mov    $0x1,%esi
call   1050 <padcon_quaddobl_initialize_parameter_homotopy@plt>
cmpl   $0x0,0xc(%rsp)
jg     12ab <quaddobl_next_step+0xab>
jmp    1315 <quaddobl_next_step+0x115>
mov    $0x1,%edi
mov    %r14d,%esi
call   1090 <padcon_quaddobl_initialize_homotopy@plt>
cmpl   $0x0,0xc(%rsp)
jle    1315 <quaddobl_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   1080 <printf@plt>
mov    %ebp,%edi
call   10e0 <quaddobl_next_loop@plt>
cmp    0xc(%rsp),%ebp
je     1315 <quaddobl_next_step+0x115>
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
call   10a0 <getchar@plt>
mov    %eax,%ebx
mov    %r12,%rdi
mov    %r13,%rsi
call   1110 <scanf@plt>
cmp    $0x79,%bl
jne    1315 <quaddobl_next_step+0x115>
cmp    0xc(%rsp),%ebp
jl     12d0 <quaddobl_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 of 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 @quaddobl_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 i32
%11 = alloca i8
%12 = alloca i8
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store i32 %0, i32* %2
store i32 0, i32* %10
%18 = call i32 (...) @prompt_for_artificial()
store i32 %18, i32* %9
%19 = load i32, i32* %9
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %25
21: ; preds = %1
%22 = call i32 (...) @read_quaddobl_target_system()
store i32 %22, i32* %3
%23 = call i32 (...) @read_quaddobl_start_system()
store i32 %23, i32* %3
%24 = call i32 (...) @copy_quaddobl_start_solutions_to_container()
store i32 %24, i32* %3
br label %32
25: ; preds = %1
%26 = call i32 (...) @read_quaddobl_target_system()
store i32 %26, i32* %3
%27 = call i32 (...) @copy_quaddobl_target_solutions_to_container()
store i32 %27, i32* %3
%28 = call i32 (...) @prompt_for_parameter()
store i32 %28, i32* %10
%29 = load i32, i32* %10
%30 = call i32 @solcon_quaddobl_drop_coordinate_by_index(i32 %29)
store i32 %30, i32* %3
%31 = call i32 (...) @solcon_quaddobl_set_continuation_parameter()
store i32 %31, i32* %3
br label %32
32: ; preds = %25, %21
%33 = call i32 @solcon_number_of_quaddobl_solutions(i32* %4)
store i32 %33, i32* %3
%34 = call i32 @solcon_dimension_of_quaddobl_solutions(i32* %8)
store i32 %34, i32* %3
%35 = load i32, i32* %4
%36 = load i32, i32* %8
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %35, i32 %36)
%38 = load i32, i32* %10
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %32
%41 = load i32, i32* %2
%42 = call i32 @padcon_quaddobl_initialize_homotopy(i32 1, i32 %41)
store i32 %42, i32* %3
br label %46
43: ; preds = %32
%44 = load i32, i32* %10
%45 = call i32 @padcon_quaddobl_initialize_parameter_homotopy(i32 %44, i32 1)
store i32 %45, i32* %3
br label %46
46: ; preds = %43, %40
store i32 1, i32* %5
br label %47
47: ; preds = %69, %46
%48 = load i32, i32* %5
%49 = load i32, i32* %4
%50 = icmp sle i32 %48, %49
br i1 %50, label %51, label %72
51: ; preds = %47
%52 = load i32, i32* %5
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %5
%55 = call i32 @quaddobl_next_loop(i32 %54)
%56 = load i32, i32* %5
%57 = load i32, i32* %4
%58 = icmp eq i32 %56, %57
br i1 %58, label %59, label %60
59: ; preds = %51
br label %72
60: ; preds = %51
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%62 = call signext i8 (...) @getchar()
store i8 %62, i8* %11
%63 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%64 = load i8, i8* %11
%65 = sext i8 %64 to i32
%66 = icmp ne i32 %65, 121
br i1 %66, label %67, label %68
67: ; preds = %60
br label %72
68: ; preds = %60
br label %69
69: ; preds = %68
%70 = load i32, i32* %5
%71 = add nsw i32 %70, 1
store i32 %71, i32* %5
br label %47
72: ; preds = %67, %59, %47
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"Read %d start solutions of 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 @quaddobl_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_quaddobl_target_system()
br i1 %8, label %10, label %13
10: ; preds = %1
%11 = tail call i32 (...) @read_quaddobl_start_system()
%12 = tail call i32 (...) @copy_quaddobl_start_solutions_to_container()
br label %18
13: ; preds = %1
%14 = tail call i32 (...) @copy_quaddobl_target_solutions_to_container()
%15 = tail call i32 (...) @prompt_for_parameter()
%16 = tail call i32 @solcon_quaddobl_drop_coordinate_by_index(i32 %15)
%17 = tail call i32 (...) @solcon_quaddobl_set_continuation_parameter()
br label %18
18: ; preds = %13, %10
%19 = phi i32 [ 0, %10 ], [ %15, %13 ]
%20 = call i32 @solcon_number_of_quaddobl_solutions(i32* %2)
%21 = call i32 @solcon_dimension_of_quaddobl_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_quaddobl_initialize_homotopy(i32 1, i32 %0)
br label %30
28: ; preds = %18
%29 = call i32 @padcon_quaddobl_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 @quaddobl_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
}