#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 initialize_standard_homotopy(int, double, double);
int initialize_standard_solution(int);
int /*<<< orphan*/ printf(char *, ...);
int prompt_for_gamma(double *, double *);
int read_standard_start_system();
int read_target_system_without_solutions();
int /*<<< orphan*/ scanf(char *, int *);
int solcon_number_of_standard_solutions(int *);
int call_initialize_standard_homotopy(int *index) {
  int fail, len, fixed;
  double regamma = 0.0;
  double imgamma = 0.0;
  fail = read_target_system_without_solutions();
  fail = read_standard_start_system();
  fail = copy_start_solutions_to_container();
  fail = solcon_number_of_standard_solutions(&len);
  printf("Number of start solutions : %d\n", len);
  printf("-> give index of solution : ");
  scanf("%d", index);
  printf("Fixed gamma constant ? (1 = yes/0 = no) ");
  scanf("%d", &fixed);
  if (fixed != 1)
    fail = prompt_for_gamma(&regamma, &imgamma);
  fail = initialize_standard_homotopy(fixed, regamma, imgamma);
  fail = initialize_standard_solution(*index);
  return fail;
}


x86 assembly (clang, -O0):
<call_initialize_standard_homotopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   10a0 <read_target_system_without_solutions@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1090 <read_standard_start_system@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1080 <copy_start_solutions_to_container@plt>
mov    %eax,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
call   1060 <solcon_number_of_standard_solutions@plt>
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe3d(%rip),%rdi
call   10b0 <scanf@plt>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe23(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   10b0 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
je     123d <call_initialize_standard_homotopy+0xad>
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <prompt_for_gamma@plt>
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1050 <initialize_standard_homotopy@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1070 <initialize_standard_solution@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_initialize_standard_homotopy>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
xor    %eax,%eax
call   10a0 <read_target_system_without_solutions@plt>
xor    %eax,%eax
call   1090 <read_standard_start_system@plt>
xor    %eax,%eax
call   1080 <copy_start_solutions_to_container@plt>
lea    0x4(%rsp),%rdi
call   1060 <solcon_number_of_standard_solutions@plt>
mov    0x4(%rsp),%esi
lea    0xe2a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe3c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4b(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   10b0 <scanf@plt>
lea    0xe3c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   10b0 <scanf@plt>
cmpl   $0x1,(%rsp)
jne    1229 <call_initialize_standard_homotopy+0x99>
mov    $0x1,%edi
xorps  %xmm1,%xmm1
xorps  %xmm0,%xmm0
jmp    1247 <call_initialize_standard_homotopy+0xb7>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <prompt_for_gamma@plt>
mov    (%rsp),%edi
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1050 <initialize_standard_homotopy@plt>
mov    (%r14),%edi
call   1070 <initialize_standard_solution@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Number of start solutions : %d\0A\00"
@.str.1 = [29 x i8] c"-> give index of solution : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [41 x i8] c"Fixed gamma constant ? (1 = yes/0 = no) \00"
define i32 @call_initialize_standard_homotopy(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
store i32* %0, i32** %2
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
%8 = call i32 (...) @read_target_system_without_solutions()
store i32 %8, i32* %3
%9 = call i32 (...) @read_standard_start_system()
store i32 %9, i32* %3
%10 = call i32 (...) @copy_start_solutions_to_container()
store i32 %10, i32* %3
%11 = call i32 @solcon_number_of_standard_solutions(i32* %4)
store i32 %11, i32* %3
%12 = load i32, i32* %4
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32*, i32** %2
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%19 = load i32, i32* %5
%20 = icmp ne i32 %19, 1
br i1 %20, label %21, label %23
21: ; preds = %1
%22 = call i32 @prompt_for_gamma(double* %6, double* %7)
store i32 %22, i32* %3
br label %23
23: ; preds = %21, %1
%24 = load i32, i32* %5
%25 = load double, double* %6
%26 = load double, double* %7
%27 = call i32 @initialize_standard_homotopy(i32 %24, double %25, double %26)
store i32 %27, i32* %3
%28 = load i32*, i32** %2
%29 = load i32, i32* %28
%30 = call i32 @initialize_standard_solution(i32 %29)
store i32 %30, i32* %3
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [32 x i8] c"Number of start solutions : %d\0A\00"
@.str.1 = [29 x i8] c"-> give index of solution : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [41 x i8] c"Fixed gamma constant ? (1 = yes/0 = no) \00"
define i32 @call_initialize_standard_homotopy(i32* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %4
%9 = bitcast double* %5 to i8*
store double 0.000000e+00, double* %5
%10 = tail call i32 (...) @read_target_system_without_solutions()
%11 = tail call i32 (...) @read_standard_start_system()
%12 = tail call i32 (...) @copy_start_solutions_to_container()
%13 = call i32 @solcon_number_of_standard_solutions(i32* %2)
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %0)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 1
br i1 %21, label %27, label %22
22: ; preds = %1
%23 = call i32 @prompt_for_gamma(double* %4, double* %5)
%24 = load i32, i32* %3
%25 = load double, double* %4
%26 = load double, double* %5
br label %27
27: ; preds = %22, %1
%28 = phi double [ %26, %22 ], [ 0.000000e+00, %1 ]
%29 = phi double [ %25, %22 ], [ 0.000000e+00, %1 ]
%30 = phi i32 [ %24, %22 ], [ 1, %1 ]
%31 = call i32 @initialize_standard_homotopy(i32 %30, double %29, double %28)
%32 = load i32, i32* %0
%33 = call i32 @initialize_standard_solution(i32 %32)
ret i32 %33
}