#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 dobldobl_homotopy_membership_test(int, int, int, double const, double const,
                                      double *, int *, int *);
int /*<<< orphan*/ dobldobl_read_point(int, double *);
int /*<<< orphan*/ printf(char *, ...);
int read_dobldobl_witness_set(int *, int *, int *);
int /*<<< orphan*/ scanf(char *, char *);
int solcon_write_dobldobl_solutions();
int syscon_write_dobldobl_system();
int dobldobl_membership_test(void) {
  int fail, n, dim, deg, nv;
  char ans;
  printf("\nReading a witness set ...\n");
  fail = read_dobldobl_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_dobldobl_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_dobldobl_solutions();
    }
    scanf("%c", &ans);
  }
  {
    int fail, onsys, onset;
    double tpt[4 * nv];
    const double restol = 1.0e-6;
    const double homtol = 1.0e-10;
    printf("\nReading the coordinates of the test point x ...\n");
    dobldobl_read_point(nv, tpt);
    fail = dobldobl_homotopy_membership_test(1, nv, dim, restol, homtol, tpt,
                                             &onsys, &onset);
  }
  return 0;
}


x86 assembly (clang, -O0):
<dobldobl_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   1090 <read_dobldobl_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
call   1080 <scanf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x79,%eax
jne    1219 <dobldobl_membership_test+0xa9>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <syscon_write_dobldobl_system@plt>
mov    %eax,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x15(%rbp),%rsi
call   1080 <scanf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8c(%rip),%rdi
lea    -0x15(%rbp),%rsi
call   1080 <scanf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x79,%eax
jne    126c <dobldobl_membership_test+0xfc>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <solcon_write_dobldobl_solutions@plt>
mov    %eax,-0x4(%rbp)
lea    0xe57(%rip),%rdi
lea    -0x15(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x14(%rbp),%eax
shl    $0x2,%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  0xd57(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xd52(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x50(%rbp),%rsi
mov    -0x14(%rbp),%edi
call   1060 <dobldobl_read_point@plt>
mov    -0x50(%rbp),%rcx
mov    -0x14(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x1,%edi
movsd  0xd14(%rip),%xmm0
movsd  0xd14(%rip),%xmm1
lea    -0x20(%rbp),%r8
lea    -0x24(%rbp),%r9
call   1070 <dobldobl_homotopy_membership_test@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dobldobl_membership_test>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xf46(%rip),%rdi
call   1040 <puts@plt>
lea    -0x30(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
call   10a0 <read_dobldobl_witness_set@plt>
mov    -0x30(%rbp),%esi
mov    %esi,%r12d
sub    -0x28(%rbp),%r12d
lea    0xe53(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x28(%rbp),%esi
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xe78(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    -0x21(%rbp),%rsi
call   1090 <scanf@plt>
cmpb   $0x79,-0x21(%rbp)
jne    121d <dobldobl_membership_test+0x9d>
lea    0xf2d(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <syscon_write_dobldobl_system@plt>
lea    0xe8a(%rip),%r14
lea    -0x21(%rbp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <scanf@plt>
lea    0xe77(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <scanf@plt>
cmpb   $0x79,-0x21(%rbp)
jne    1265 <dobldobl_membership_test+0xe5>
lea    0xecf(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <solcon_write_dobldobl_solutions@plt>
lea    0xe42(%rip),%rdi
lea    -0x21(%rbp),%rsi
call   1090 <scanf@plt>
mov    %rsp,%r14
lea    0x0(,%r12,4),%eax
mov    %rsp,%rbx
shl    $0x3,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe63(%rip),%rdi
call   1040 <puts@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
call   1070 <dobldobl_read_point@plt>
mov    -0x28(%rbp),%edx
movsd  0xd51(%rip),%xmm0
movsd  0xd51(%rip),%xmm1
lea    -0x38(%rbp),%r8
lea    -0x34(%rbp),%r9
mov    $0x1,%edi
mov    %r12d,%esi
mov    %rbx,%rcx
call   1080 <dobldobl_homotopy_membership_test@plt>
mov    %r14,%rsp
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
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 = [50 x i8] c"\0AReading the coordinates of the test point x ...\0A\00"
define i32 @dobldobl_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 i8*
%11 = alloca i64
%12 = alloca double
%13 = alloca double
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @read_dobldobl_witness_set(i32* %2, i32* %3, i32* %4)
store i32 %15, i32* %1
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = sub nsw i32 %16, %17
store i32 %18, i32* %5
%19 = load i32, i32* %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%27 = load i8, i8* %6
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 121
br i1 %29, label %30, label %33
30: ; preds = %0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%32 = call i32 (...) @syscon_write_dobldobl_system()
store i32 %32, i32* %1
br label %33
33: ; preds = %30, %0
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0))
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%37 = load i8, i8* %6
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 121
br i1 %39, label %40, label %43
40: ; preds = %33
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%42 = call i32 (...) @solcon_write_dobldobl_solutions()
store i32 %42, i32* %1
br label %43
43: ; preds = %40, %33
%44 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%45 = load i32, i32* %5
%46 = mul nsw i32 4, %45
%47 = zext i32 %46 to i64
%48 = call i8* @llvm.stacksave()
store i8* %48, i8** %10
%49 = alloca double, i64 %47
store i64 %47, i64* %11
store double 0x3EB0C6F7A0B5ED8D, double* %12
store double 1.000000e-10, double* %13
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.9, i64 0, i64 0))
%51 = load i32, i32* %5
%52 = call i32 @dobldobl_read_point(i32 %51, double* %49)
%53 = load i32, i32* %5
%54 = load i32, i32* %3
%55 = call i32 @dobldobl_homotopy_membership_test(i32 1, i32 %53, i32 %54, double 0x3EB0C6F7A0B5ED8D, double 1.000000e-10, double* %49, i32* %8, i32* %9)
store i32 %55, i32* %7
%56 = load i8*, i8** %10
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 = [27 x i8] c"\0AReading a witness set ...\00"
@str.10 = [49 x i8] c"\0AReading the coordinates of the test point x ...\00"
@str.11 = [22 x i8] c"\0AThe solutions read :\00"
@str.12 = [19 x i8] c"\0AThe system read :\00"
define i32 @dobldobl_membership_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%11 = call i32 @read_dobldobl_witness_set(i32* %1, i32* %2, i32* %3)
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = sub nsw i32 %12, %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%22 = load i8, i8* %4
%23 = icmp eq i8 %22, 121
br i1 %23, label %24, label %27
24: ; preds = %0
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.12, i64 0, i64 0))
%26 = call i32 (...) @syscon_write_dobldobl_system()
br label %27
27: ; preds = %24, %0
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%31 = load i8, i8* %4
%32 = icmp eq i8 %31, 121
br i1 %32, label %33, label %36
33: ; preds = %27
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.11, i64 0, i64 0))
%35 = call i32 (...) @solcon_write_dobldobl_solutions()
br label %36
36: ; preds = %33, %27
%37 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%38 = bitcast i32* %5 to i8*
%39 = bitcast i32* %6 to i8*
%40 = shl nsw i32 %14, 2
%41 = zext i32 %40 to i64
%42 = call i8* @llvm.stacksave()
%43 = alloca double, i64 %41
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.10, i64 0, i64 0))
%45 = call i32 @dobldobl_read_point(i32 %14, double* %43)
%46 = load i32, i32* %2
%47 = call i32 @dobldobl_homotopy_membership_test(i32 1, i32 %14, i32 %46, double 0x3EB0C6F7A0B5ED8D, double 1.000000e-10, double* %43, i32* %5, i32* %6)
ret i32 0
}