#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*/ printf(char *, ...);
int read_witness_set(int *, int *, int *);
int /*<<< orphan*/ scanf(char *, ...);
int solcon_write_standard_solutions();
int standard_homotopy_membership_test(int, int, int, double const, double const,
                                      double *, int *, int *, int);
int /*<<< orphan*/ standard_read_point(int, double *);
int syscon_write_standard_system();
int standard_membership_test(void) {
  int fail, n, dim, deg, nv;
  char ans;
  printf("\nReading a witness set ...\n");
  fail = read_witness_set(&n, &dim, &deg);
  nv = n - dim;
  if (1 > 0) {
    printf("\nThe ambient dimension : %d.\n", n);
    printf("The dimension of the solution set : %d.\n", dim);
    printf("The degree of the solution set : %d.\n", deg);
    printf("\nDo you want to see the embedded system ? (y/n) ");
    scanf("%c", &ans);
    if (ans == 'y') {
      printf("\nThe system read :\n");
      fail = syscon_write_standard_system();
    }
    scanf("%c", &ans);
    printf("\nDo you want to see the solutions ? (y/n) ");
    scanf("%c", &ans);
    if (ans == 'y') {
      printf("\nThe solutions read :\n");
      fail = solcon_write_standard_solutions();
    }
    scanf("%c", &ans);
  }
  {
    int fail, onsys, onset, nbtasks = 0;
    double tpt[2 * nv];
    const double restol = 1.0e-8;
    const double homtol = 1.0e-6;
    printf("\nGive the number of tasks : ");
    scanf("%d", &nbtasks);
    printf("\nReading the coordinates of the test point x ...\n");
    standard_read_point(nv, tpt);
    fail = standard_homotopy_membership_test(1, nv, dim, restol, homtol, tpt,
                                             &onsys, &onset, nbtasks);
  }
  return 0;
}


x86 assembly (clang, -O0):
<standard_membership_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1050 <read_witness_set@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x79,%eax
jne    121b <standard_membership_test+0xab>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <syscon_write_standard_system@plt>
mov    %eax,-0x4(%rbp)
lea    0xea8(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x79,%eax
jne    1272 <standard_membership_test+0x102>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <solcon_write_standard_solutions@plt>
mov    %eax,-0x4(%rbp)
lea    0xe51(%rip),%rdi
xor    %eax,%eax
lea    -0x15(%rbp),%rsi
call   1080 <scanf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
add    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rdx
shl    $0x3,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
movsd  0xd49(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xd44(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe62(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x50(%rbp),%rsi
mov    -0x14(%rbp),%edi
call   1030 <standard_read_point@plt>
mov    -0x50(%rbp),%rcx
mov    -0x14(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x28(%rbp),%eax
mov    $0x1,%edi
movsd  0xce3(%rip),%xmm0
movsd  0xce3(%rip),%xmm1
lea    -0x20(%rbp),%r8
lea    -0x24(%rbp),%r9
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1090 <standard_homotopy_membership_test@plt>
add    $0x10,%rsp
mov    %eax,-0x1c(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standard_membership_test>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xf68(%rip),%rdi
call   1030 <puts@plt>
lea    -0x2c(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1060 <read_witness_set@plt>
mov    -0x2c(%rbp),%esi
mov    %esi,%r14d
sub    -0x20(%rbp),%r14d
lea    0xe55(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xe7a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0x19(%rbp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
cmpb   $0x79,-0x19(%rbp)
jne    121d <standard_membership_test+0x9d>
lea    0xf4d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <syscon_write_standard_system@plt>
lea    0xe8a(%rip),%r15
lea    -0x19(%rbp),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
lea    0xe75(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
cmpb   $0x79,-0x19(%rbp)
jne    1269 <standard_membership_test+0xe9>
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <solcon_write_standard_solutions@plt>
lea    0xe3e(%rip),%rdi
lea    -0x19(%rbp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    %rsp,%r15
movl   $0x0,-0x24(%rbp)
lea    (%r14,%r14,1),%eax
mov    %rsp,%rbx
shl    $0x3,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe3f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe4e(%rip),%rdi
lea    -0x24(%rbp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
lea    0xe5a(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1040 <standard_read_point@plt>
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%eax
sub    $0x8,%rsp
movsd  0xd21(%rip),%xmm0
movsd  0xd21(%rip),%xmm1
lea    -0x34(%rbp),%r8
lea    -0x30(%rbp),%r9
mov    $0x1,%edi
mov    %r14d,%esi
mov    %rbx,%rcx
push   %rax
call   10a0 <standard_homotopy_membership_test@plt>
add    $0x10,%rsp
mov    %r15,%rsp
xor    %eax,%eax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\0AReading a witness set ...\0A\00"
@.str.1 = [30 x i8] c"\0AThe ambient dimension : %d.\0A\00"
@.str.2 = [41 x i8] c"The dimension of the solution set : %d.\0A\00"
@.str.3 = [38 x i8] c"The degree of the solution set : %d.\0A\00"
@.str.4 = [49 x i8] c"\0ADo you want to see the embedded system ? (y/n) \00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [20 x i8] c"\0AThe system read :\0A\00"
@.str.7 = [43 x i8] c"\0ADo you want to see the solutions ? (y/n) \00"
@.str.8 = [23 x i8] c"\0AThe solutions read :\0A\00"
@.str.9 = [29 x i8] c"\0AGive the number of tasks : \00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [50 x i8] c"\0AReading the coordinates of the test point x ...\0A\00"
define i32 @standard_membership_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
%13 = alloca double
%14 = alloca double
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @read_witness_set(i32* %2, i32* %3, i32* %4)
store i32 %16, i32* %1
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = sub nsw i32 %17, %18
store i32 %19, i32* %5
%20 = load i32, i32* %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %3
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %4
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%28 = load i8, i8* %6
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 121
br i1 %30, label %31, label %34
31: ; preds = %0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%33 = call i32 (...) @syscon_write_standard_system()
store i32 %33, i32* %1
br label %34
34: ; preds = %31, %0
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0))
%37 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%38 = load i8, i8* %6
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 121
br i1 %40, label %41, label %44
41: ; preds = %34
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%43 = call i32 (...) @solcon_write_standard_solutions()
store i32 %43, i32* %1
br label %44
44: ; preds = %41, %34
%45 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6)
store i32 0, i32* %10
%46 = load i32, i32* %5
%47 = mul nsw i32 2, %46
%48 = zext i32 %47 to i64
%49 = call i8* @llvm.stacksave()
store i8* %49, i8** %11
%50 = alloca double, i64 %48
store i64 %48, i64* %12
store double 1.000000e-08, double* %13
store double 0x3EB0C6F7A0B5ED8D, double* %14
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
%52 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %10)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.11, i64 0, i64 0))
%54 = load i32, i32* %5
%55 = call i32 @standard_read_point(i32 %54, double* %50)
%56 = load i32, i32* %5
%57 = load i32, i32* %3
%58 = load i32, i32* %10
%59 = call i32 @standard_homotopy_membership_test(i32 1, i32 %56, i32 %57, double 1.000000e-08, double 0x3EB0C6F7A0B5ED8D, double* %50, i32* %8, i32* %9, i32 %58)
store i32 %59, i32* %7
%60 = load i8*, i8** %11
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [30 x i8] c"\0AThe ambient dimension : %d.\0A\00"
@.str.2 = [41 x i8] c"The dimension of the solution set : %d.\0A\00"
@.str.3 = [38 x i8] c"The degree of the solution set : %d.\0A\00"
@.str.4 = [49 x i8] c"\0ADo you want to see the embedded system ? (y/n) \00"
@.str.5 = [3 x i8] c"%c\00"
@.str.7 = [43 x i8] c"\0ADo you want to see the solutions ? (y/n) \00"
@.str.9 = [29 x i8] c"\0AGive the number of tasks : \00"
@.str.10 = [3 x i8] c"%d\00"
@str = [27 x i8] c"\0AReading a witness set ...\00"
@str.12 = [49 x i8] c"\0AReading the coordinates of the test point x ...\00"
@str.13 = [22 x i8] c"\0AThe solutions read :\00"
@str.14 = [19 x i8] c"\0AThe system read :\00"
define i32 @standard_membership_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %1 to i8*
%9 = bitcast i32* %2 to i8*
%10 = bitcast i32* %3 to i8*
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%12 = call i32 @read_witness_set(i32* %1, i32* %2, i32* %3)
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = sub nsw i32 %13, %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%17 = load i32, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%23 = load i8, i8* %4
%24 = icmp eq i8 %23, 121
br i1 %24, label %25, label %28
25: ; preds = %0
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.14, i64 0, i64 0))
%27 = call i32 (...) @syscon_write_standard_system()
br label %28
28: ; preds = %25, %0
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0))
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%32 = load i8, i8* %4
%33 = icmp eq i8 %32, 121
br i1 %33, label %34, label %37
34: ; preds = %28
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.13, i64 0, i64 0))
%36 = call i32 (...) @solcon_write_standard_solutions()
br label %37
37: ; preds = %34, %28
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%39 = bitcast i32* %5 to i8*
%40 = bitcast i32* %6 to i8*
%41 = bitcast i32* %7 to i8*
store i32 0, i32* %7
%42 = shl nsw i32 %15, 1
%43 = zext i32 %42 to i64
%44 = call i8* @llvm.stacksave()
%45 = alloca double, i64 %43
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %7)
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.12, i64 0, i64 0))
%49 = call i32 @standard_read_point(i32 %15, double* %45)
%50 = load i32, i32* %2
%51 = load i32, i32* %7
%52 = call i32 @standard_homotopy_membership_test(i32 1, i32 %15, i32 %50, double 1.000000e-08, double 0x3EB0C6F7A0B5ED8D, double* %45, i32* %5, i32* %6, i32 %51)
ret i32 0
}