#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 get_value_of_continuation_parameter(int, double *);
int /*<<< orphan*/ printf(char *, ...);
int retrieve_continuation_parameters(double *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ set_continuation_parameters(double *);
int set_value_of_continuation_parameter(int, double *);
int /*<<< orphan*/ write_continuation_parameters(double *);
int main(int argc, char *argv[]) {
  int fail, i;
  double v[34], x;
  adainit();
  printf("\nTuning the Continuation parameters in PHCpack...\n");
  printf("\n");
  do {
    fail = retrieve_continuation_parameters(v);
    write_continuation_parameters(v);
    printf("Give index of parameter to change (0 to quit) : ");
    scanf("%d", &i);
    if (i > 0) {
      printf("Give value for parameter %d : ", i);
      scanf("%lf", &x);
      v[i - 1] = x;
      set_continuation_parameters(v);
      {
        char ans = 'y';
        do {
          fail = get_value_of_continuation_parameter(i, &x);
          printf("-> the value for parameter %d : %.3e.\n", i, x);
          printf("-> change value of index ? (y/n) ");
          scanf("%d", &ans);
          scanf("%c", &ans);
          if (ans != 'y')
            break;
          scanf("%c", &ans);
          printf("-> give value for index %d : ", i);
          scanf("%lf", &x);
          fail = set_value_of_continuation_parameter(i, &x);
        } while (ans != 0);
      }
    }
  } while (i > 0);
  adafinal();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1090 <adainit@plt>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x130(%rbp),%rdi
call   10a0 <retrieve_continuation_parameters@plt>
mov    %eax,-0x14(%rbp)
lea    -0x130(%rbp),%rdi
call   1030 <write_continuation_parameters@plt>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe68(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
cmpl   $0x0,-0x18(%rbp)
jle    133d <main+0x1ad>
mov    -0x18(%rbp),%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5d(%rip),%rdi
lea    -0x138(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movsd  -0x138(%rbp),%xmm0
ff
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  %xmm0,-0x130(%rbp,%rax,8)
ff ff
lea    -0x130(%rbp),%rdi
call   1060 <set_continuation_parameters@plt>
movb   $0x79,-0x139(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x138(%rbp),%rsi
call   1050 <get_value_of_continuation_parameter@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%esi
movsd  -0x138(%rbp),%xmm0
ff
lea    0xe03(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdc1(%rip),%rdi
lea    -0x139(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
lea    0xe1b(%rip),%rdi
lea    -0x139(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movsbl -0x139(%rbp),%eax
cmp    $0x79,%eax
je     12db <main+0x14b>
jmp    1338 <main+0x1a8>
lea    0xdf1(%rip),%rdi
lea    -0x139(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
mov    -0x18(%rbp),%esi
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd7e(%rip),%rdi
lea    -0x138(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
mov    -0x18(%rbp),%edi
lea    -0x138(%rbp),%rsi
call   10b0 <set_value_of_continuation_parameter@plt>
mov    %eax,-0x14(%rbp)
movsbl -0x139(%rbp),%eax
cmp    $0x0,%eax
jne    1263 <main+0xd3>
jmp    133d <main+0x1ad>
jmp    1342 <main+0x1b2>
cmpl   $0x0,-0x18(%rbp)
jg     11cc <main+0x3c>
mov    $0x0,%al
call   1070 <adafinal@plt>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
xor    %eax,%eax
call   10b0 <adainit@plt>
lea    0xef2(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0x10(%rsp),%rbp
lea    0xe47(%rip),%rbx
lea    0xe62(%rip),%r12
lea    0x8(%rsp),%r13
lea    0x3(%rsp),%r15
lea    0xe9e(%rip),%r14
jmp    1220 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpl   $0x0,0x4(%rsp)
lea    0x10(%rsp),%rbp
jle    133b <main+0x18b>
mov    %rbp,%rdi
call   10c0 <retrieve_continuation_parameters@plt>
mov    %rbp,%rdi
call   1030 <write_continuation_parameters@plt>
lea    0xdc9(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    133b <main+0x18b>
lea    0xdd4(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
movsd  0x8(%rsp),%xmm0
movslq 0x4(%rsp),%rax
movsd  %xmm0,0x8(%rsp,%rax,8)
mov    %rbp,%rdi
call   1080 <set_continuation_parameters@plt>
movb   $0x79,0x3(%rsp)
lea    0xdbe(%rip),%rbp
nopl   0x0(%rax)
mov    0x4(%rsp),%edi
mov    %r13,%rsi
call   1070 <get_value_of_continuation_parameter@plt>
mov    0x4(%rsp),%esi
movsd  0x8(%rsp),%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xdb7(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
cmpb   $0x79,0x3(%rsp)
jne    1210 <main+0x60>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xd98(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    0x4(%rsp),%edi
mov    %r13,%rsi
call   10d0 <set_value_of_continuation_parameter@plt>
cmpb   $0x0,0x3(%rsp)
jne    12a0 <main+0xf0>
jmp    1210 <main+0x60>
xor    %eax,%eax
call   1090 <adafinal@plt>
xor    %eax,%eax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [51 x i8] c"\0ATuning the Continuation parameters in PHCpack...\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [49 x i8] c"Give index of parameter to change (0 to quit) : \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [31 x i8] c"Give value for parameter %d : \00"
@.str.5 = [4 x i8] c"%lf\00"
@.str.6 = [39 x i8] c"-> the value for parameter %d : %.3e.\0A\00"
@.str.7 = [34 x i8] c"-> change value of index ? (y/n) \00"
@.str.8 = [3 x i8] c"%c\00"
@.str.9 = [30 x i8] c"-> give value for index %d : \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 [34 x double]
%9 = alloca double
%10 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (...) @adainit()
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %60, %2
%15 = getelementptr inbounds [34 x double], [34 x double]* %8, i64 0, i64 0
%16 = call i32 @retrieve_continuation_parameters(double* %15)
store i32 %16, i32* %6
%17 = getelementptr inbounds [34 x double], [34 x double]* %8, i64 0, i64 0
%18 = call i32 @write_continuation_parameters(double* %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %7)
%21 = load i32, i32* %7
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %59
23: ; preds = %14
%24 = load i32, i32* %7
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %24)
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double* %9)
%27 = load double, double* %9
%28 = load i32, i32* %7
%29 = sub nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [34 x double], [34 x double]* %8, i64 0, i64 %30
store double %27, double* %31
%32 = getelementptr inbounds [34 x double], [34 x double]* %8, i64 0, i64 0
%33 = call i32 @set_continuation_parameters(double* %32)
store i8 121, i8* %10
br label %34
34: ; preds = %54, %23
%35 = load i32, i32* %7
%36 = call i32 @get_value_of_continuation_parameter(i32 %35, double* %9)
store i32 %36, i32* %6
%37 = load i32, i32* %7
%38 = load double, double* %9
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i32 %37, double %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%41 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%42 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %10)
%43 = load i8, i8* %10
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %44, 121
br i1 %45, label %46, label %47
46: ; preds = %34
br label %58
47: ; preds = %34
%48 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %10)
%49 = load i32, i32* %7
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i32 %49)
%51 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double* %9)
%52 = load i32, i32* %7
%53 = call i32 @set_value_of_continuation_parameter(i32 %52, double* %9)
store i32 %53, i32* %6
br label %54
54: ; preds = %47
%55 = load i8, i8* %10
%56 = sext i8 %55 to i32
%57 = icmp ne i32 %56, 0
br i1 %57, label %34, label %58
58: ; preds = %54, %46
br label %59
59: ; preds = %58, %14
br label %60
60: ; preds = %59
%61 = load i32, i32* %7
%62 = icmp sgt i32 %61, 0
br i1 %62, label %14, label %63
63: ; preds = %60
%64 = call i32 (...) @adafinal()
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [49 x i8] c"Give index of parameter to change (0 to quit) : \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [31 x i8] c"Give value for parameter %d : \00"
@.str.5 = [4 x i8] c"%lf\00"
@.str.6 = [39 x i8] c"-> the value for parameter %d : %.3e.\0A\00"
@.str.7 = [34 x i8] c"-> change value of index ? (y/n) \00"
@.str.8 = [3 x i8] c"%c\00"
@.str.9 = [30 x i8] c"-> give value for index %d : \00"
@str = [50 x i8] c"\0ATuning the Continuation parameters in PHCpack...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [34 x double]
%5 = alloca double
%6 = alloca i8
%7 = bitcast i32* %3 to i8*
%8 = bitcast [34 x double]* %4 to i8*
%9 = bitcast double* %5 to i8*
%10 = tail call i32 (...) @adainit()
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @putchar(i32 10)
%13 = getelementptr inbounds [34 x double], [34 x double]* %4, i64 0, i64 0
br label %14
14: ; preds = %50, %2
%15 = call i32 @retrieve_continuation_parameters(double* %13)
%16 = call i32 @write_continuation_parameters(double* %13)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%19 = load i32, i32* %3
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %53
21: ; preds = %14
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double* %5)
%24 = load double, double* %5
%25 = load i32, i32* %3
%26 = add nsw i32 %25, -1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [34 x double], [34 x double]* %4, i64 0, i64 %27
store double %24, double* %28
%29 = call i32 @set_continuation_parameters(double* %13)
store i8 121, i8* %6
br label %30
30: ; preds = %41, %21
%31 = load i32, i32* %3
%32 = call i32 @get_value_of_continuation_parameter(i32 %31, double* %5)
%33 = load i32, i32* %3
%34 = load double, double* %5
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i32 %33, double %34)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%37 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %6)
%39 = load i8, i8* %6
%40 = icmp eq i8 %39, 121
br i1 %40, label %41, label %50
41: ; preds = %30
%42 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %6)
%43 = load i32, i32* %3
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i32 %43)
%45 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double* %5)
%46 = load i32, i32* %3
%47 = call i32 @set_value_of_continuation_parameter(i32 %46, double* %5)
%48 = load i8, i8* %6
%49 = icmp eq i8 %48, 0
br i1 %49, label %50, label %30
50: ; preds = %41, %30
%51 = load i32, i32* %3
%52 = icmp sgt i32 %51, 0
br i1 %52, label %14, label %53
53: ; preds = %14, %50
%54 = call i32 (...) @adafinal()
ret i32 0
}