#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 quaddobl_multiplicity_structure(int, int, double const, int *, int *);
int solcon_dimension_of_quaddobl_solutions(int *);
int solcon_number_of_quaddobl_solutions(int *);
int solcon_read_quaddobl_solutions();
int syscon_number_of_quaddobl_polynomials(int *);
int syscon_read_quaddobl_system();
void test_quaddobl_multiplicity_structure(int order) {
  const double tol = 1.0e-8;
  int fail, dim, len, mult;
  int hilb[order + 1];
  printf("\nTesting with quaddobl arithmetic ...\n");
  fail = syscon_read_quaddobl_system();
  fail = syscon_number_of_quaddobl_polynomials(&dim);
  printf("The system container has %d polynomials.\n", dim);
  fail = solcon_read_quaddobl_solutions();
  fail = solcon_number_of_quaddobl_solutions(&len);
  printf("The solution container has size %d.\n", len);
  fail = solcon_dimension_of_quaddobl_solutions(&dim);
  printf("The solutions in the container have dimension %d.\n", dim);
  fail = quaddobl_multiplicity_structure(order, 1, tol, &mult, hilb);
  printf("The multiplicity : %d.\n", mult);
  printf("Values of the Hilbert function :");
  int k;
  for (k = 0; k < order + 1; k++)
    printf(" %d", hilb[k]);
  printf("\n");
}


x86 assembly (clang, -O0):
<test_quaddobl_multiplicity_structure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movabs $0x3e45798ee2308c3a,%rax
79 45 3e
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <syscon_read_quaddobl_system@plt>
mov    %eax,-0x14(%rbp)
lea    -0x18(%rbp),%rdi
call   1070 <syscon_number_of_quaddobl_polynomials@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1090 <solcon_read_quaddobl_solutions@plt>
mov    %eax,-0x14(%rbp)
lea    -0x1c(%rbp),%rdi
call   1040 <solcon_number_of_quaddobl_solutions@plt>
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x18(%rbp),%rdi
call   1060 <solcon_dimension_of_quaddobl_solutions@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rcx
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
movsd  0xdc0(%rip),%xmm0
lea    -0x20(%rbp),%rdx
call   1080 <quaddobl_multiplicity_structure@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    12aa <test_quaddobl_multiplicity_structure+0x13a>
mov    -0x40(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1272 <test_quaddobl_multiplicity_structure+0x102>
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_quaddobl_multiplicity_structure>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r14d
mov    %rsp,-0x40(%rbp)
lea    0x1(%r14),%r13d
mov    %rsp,%r12
lea    0xf(,%r13,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0xeff(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <syscon_read_quaddobl_system@plt>
lea    -0x2c(%rbp),%r15
mov    %r15,%rdi
call   1090 <syscon_number_of_quaddobl_polynomials@plt>
mov    -0x2c(%rbp),%esi
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   10b0 <solcon_read_quaddobl_solutions@plt>
lea    -0x34(%rbp),%rdi
call   1060 <solcon_number_of_quaddobl_solutions@plt>
mov    -0x34(%rbp),%esi
lea    0xe27(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r15,%rdi
call   1080 <solcon_dimension_of_quaddobl_solutions@plt>
mov    -0x2c(%rbp),%esi
lea    0xe33(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movsd  0xdcd(%rip),%xmm0
lea    -0x30(%rbp),%rdx
mov    %r14d,%edi
mov    $0x1,%esi
mov    %r12,%rcx
call   10a0 <quaddobl_multiplicity_structure@plt>
mov    -0x30(%rbp),%esi
lea    0xe39(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe43(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
test   %r14d,%r14d
js     1297 <test_quaddobl_multiplicity_structure+0x107>
lea    0xe51(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1280 <test_quaddobl_multiplicity_structure+0xf0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x40(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"\0ATesting with quaddobl arithmetic ...\0A\00"
@.str.1 = [42 x i8] c"The system container has %d polynomials.\0A\00"
@.str.2 = [37 x i8] c"The solution container has size %d.\0A\00"
@.str.3 = [51 x i8] c"The solutions in the container have dimension %d.\0A\00"
@.str.4 = [24 x i8] c"The multiplicity : %d.\0A\00"
@.str.5 = [33 x i8] c"Values of the Hilbert function :\00"
@.str.6 = [4 x i8] c" %d\00"
@.str.7 = [2 x i8] c"\0A\00"
define void @test_quaddobl_multiplicity_structure(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store i32 %0, i32* %2
store double 1.000000e-08, double* %3
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %8
%15 = alloca i32, i64 %13
store i64 %13, i64* %9
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (...) @syscon_read_quaddobl_system()
store i32 %17, i32* %4
%18 = call i32 @syscon_number_of_quaddobl_polynomials(i32* %5)
store i32 %18, i32* %4
%19 = load i32, i32* %5
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = call i32 (...) @solcon_read_quaddobl_solutions()
store i32 %21, i32* %4
%22 = call i32 @solcon_number_of_quaddobl_solutions(i32* %6)
store i32 %22, i32* %4
%23 = load i32, i32* %6
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = call i32 @solcon_dimension_of_quaddobl_solutions(i32* %5)
store i32 %25, i32* %4
%26 = load i32, i32* %5
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %2
%29 = call i32 @quaddobl_multiplicity_structure(i32 %28, i32 1, double 1.000000e-08, i32* %7, i32* %15)
store i32 %29, i32* %4
%30 = load i32, i32* %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %10
br label %33
33: ; preds = %44, %1
%34 = load i32, i32* %10
%35 = load i32, i32* %2
%36 = add nsw i32 %35, 1
%37 = icmp slt i32 %34, %36
br i1 %37, label %38, label %47
38: ; preds = %33
%39 = load i32, i32* %10
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %15, i64 %40
%42 = load i32, i32* %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %38
%45 = load i32, i32* %10
%46 = add nsw i32 %45, 1
store i32 %46, i32* %10
br label %33
47: ; preds = %33
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%49 = load i8*, i8** %8
ret void
}

LLVM IR (-O2):
@.str.1 = [42 x i8] c"The system container has %d polynomials.\0A\00"
@.str.2 = [37 x i8] c"The solution container has size %d.\0A\00"
@.str.3 = [51 x i8] c"The solutions in the container have dimension %d.\0A\00"
@.str.4 = [24 x i8] c"The multiplicity : %d.\0A\00"
@.str.5 = [33 x i8] c"Values of the Hilbert function :\00"
@.str.6 = [4 x i8] c" %d\00"
@str = [38 x i8] c"\0ATesting with quaddobl arithmetic ...\00"
define void @test_quaddobl_multiplicity_structure(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = add i32 %0, 1
%9 = zext i32 %8 to i64
%10 = tail call i8* @llvm.stacksave()
%11 = alloca i32, i64 %9
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 (...) @syscon_read_quaddobl_system()
%14 = call i32 @syscon_number_of_quaddobl_polynomials(i32* %2)
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = call i32 (...) @solcon_read_quaddobl_solutions()
%18 = call i32 @solcon_number_of_quaddobl_solutions(i32* %3)
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = call i32 @solcon_dimension_of_quaddobl_solutions(i32* %2)
%22 = load i32, i32* %2
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = call i32 @quaddobl_multiplicity_structure(i32 %0, i32 1, double 1.000000e-08, i32* %4, i32* %11)
%25 = load i32, i32* %4
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp slt i32 %0, 0
br i1 %28, label %36, label %29
29: ; preds = %1, %29
%30 = phi i64 [ %34, %29 ], [ 0, %1 ]
%31 = getelementptr inbounds i32, i32* %11, i64 %30
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %32)
%34 = add nuw nsw i64 %30, 1
%35 = icmp eq i64 %34, %9
br i1 %35, label %36, label %29
36: ; preds = %29, %1
%37 = call i32 @putchar(i32 10)
ret void
}