#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 _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int scan_input_planes(int, int, char *, double *);
int Pieri_polynomial_system(int m, int p, int q, int nc, char *A, int is_real) {
  int i, fail;
  int n = m * p + q * (m + p);
  int mdim = m * (m + p);
  int rdim = n * mdim;
  int tdim = 2 * rdim;
  int mpq[3];
  int *b;
  double rcf[rdim];
  double cff[tdim];
  if (is_real == 1) {
    fail = scan_input_planes(n, mdim, A, rcf);
    for (i = 0; i < rdim; i++) {
      cff[2 * i] = rcf[i];
      cff[2 * i + 1] = 0.0;
    }
  } else
    fail = scan_input_planes(n, 2 * mdim, A, cff);
  mpq[0] = m;
  mpq[1] = p;
  mpq[2] = q;
  fail = _ada_use_c2phc4c(227, mpq, b, cff, 0);
  return fail;
}


x86 assembly (clang, -O0):
<Pieri_polynomial_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%esi
mov    %edx,%eax
imul   %esi,%eax
mov    -0xc(%rbp),%ecx
add    %esi,%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
mov    %eax,%ecx
add    %edx,%ecx
imul   %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x2c(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
add    %eax,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x50(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
mov    -0x34(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x60(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    1238 <Pieri_polynomial_system+0x118>
mov    -0x70(%rbp),%rcx
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <scan_input_planes@plt>
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1233 <Pieri_polynomial_system+0x113>
mov    -0x68(%rbp),%rax
mov    -0x70(%rbp),%rcx
movslq -0x20(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11e6 <Pieri_polynomial_system+0xc6>
jmp    1251 <Pieri_polynomial_system+0x131>
mov    -0x68(%rbp),%rcx
mov    -0x28(%rbp),%edi
mov    -0x2c(%rbp),%esi
shl    $0x1,%esi
mov    -0x18(%rbp),%rdx
call   1030 <scan_input_planes@plt>
mov    %eax,-0x24(%rbp)
mov    -0x68(%rbp),%rcx
mov    -0x4(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x38(%rbp)
lea    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    $0xe3,%edi
xor    %r8d,%r8d
call   1040 <_ada_use_c2phc4c@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x50(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pieri_polynomial_system>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r15d
mov    %edi,%r12d
mov    %rsp,-0x40(%rbp)
mov    %esi,%eax
imul   %edi,%eax
lea    (%r15,%r12,1),%esi
mov    %esi,%edi
mov    %edx,-0x2c(%rbp)
imul   %edx,%edi
add    %eax,%edi
imul   %r12d,%esi
mov    %edi,%r14d
imul   %esi,%r14d
lea    (%r14,%r14,1),%eax
lea    0xf(,%r14,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rbx
sub    %rcx,%rbx
mov    %rbx,%rsp
shl    $0x3,%rax
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
cmp    $0x1,%r9d
jne    11a6 <Pieri_polynomial_system+0x86>
mov    %r8,%rdx
mov    %rbx,%rcx
call   1030 <scan_input_planes@plt>
test   %r14d,%r14d
jle    12de <Pieri_polynomial_system+0x1be>
cmp    $0x4,%r14d
jae    11b8 <Pieri_polynomial_system+0x98>
xor    %eax,%eax
jmp    12ac <Pieri_polynomial_system+0x18c>
add    %esi,%esi
mov    %r8,%rdx
mov    %r13,%rcx
call   1030 <scan_input_planes@plt>
jmp    12de <Pieri_polynomial_system+0x1be>
mov    %r14d,%eax
and    $0xfffffffc,%eax
lea    -0x4(%rax),%rcx
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rcx,%rcx
je     1313 <Pieri_polynomial_system+0x1f3>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
lea    0x60(%r13),%rdi
xor    %ecx,%ecx
pxor   %xmm0,%xmm0
nopw   0x0(%rax,%rax,1)
movdqa (%rbx,%rcx,8),%xmm1
movdqa 0x10(%rbx,%rcx,8),%xmm2
movq   %xmm1,%xmm3
punpckhqdq %xmm0,%xmm1
movdqa %xmm1,-0x50(%rdi)
movdqa %xmm3,-0x60(%rdi)
movq   %xmm2,%xmm1
punpckhqdq %xmm0,%xmm2
movdqa %xmm2,-0x30(%rdi)
movdqa %xmm1,-0x40(%rdi)
movdqa 0x20(%rbx,%rcx,8),%xmm1
movdqa 0x30(%rbx,%rcx,8),%xmm2
movq   %xmm1,%xmm3
punpckhqdq %xmm0,%xmm1
movdqa %xmm1,-0x10(%rdi)
movdqa %xmm3,-0x20(%rdi)
movq   %xmm2,%xmm1
punpckhqdq %xmm0,%xmm2
movdqa %xmm2,0x10(%rdi)
movdqa %xmm1,(%rdi)
add    $0x8,%rcx
sub    $0xffffffffffffff80,%rdi
add    $0xfffffffffffffffe,%rsi
jne    11f0 <Pieri_polynomial_system+0xd0>
test   $0x1,%dl
je     12a7 <Pieri_polynomial_system+0x187>
movdqa (%rbx,%rcx,8),%xmm0
movdqa 0x10(%rbx,%rcx,8),%xmm1
shl    $0x4,%rcx
mov    %rcx,%rdx
or     $0x28,%rdx
movq   %xmm0,%xmm2
pxor   %xmm3,%xmm3
punpckhqdq %xmm3,%xmm0
movdqa %xmm0,0x10(%r13,%rcx,1)
movdqa %xmm2,0x0(%r13,%rcx,1)
movq   %xmm1,%xmm0
punpckhqdq %xmm3,%xmm1
movdqa %xmm1,0x8(%r13,%rdx,1)
movdqa %xmm0,-0x8(%r13,%rdx,1)
cmp    %r14,%rax
je     12de <Pieri_polynomial_system+0x1be>
mov    %rax,%rcx
shl    $0x4,%rcx
add    %r13,%rcx
add    $0x8,%rcx
nopw   0x0(%rax,%rax,1)
movq   (%rbx,%rax,8),%xmm0
movq   %xmm0,-0x8(%rcx)
movq   $0x0,(%rcx)
add    $0x1,%rax
add    $0x10,%rcx
cmp    %rax,%r14
jne    12c0 <Pieri_polynomial_system+0x1a0>
mov    %r12d,-0x38(%rbp)
mov    %r15d,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
lea    -0x38(%rbp),%rsi
mov    $0xe3,%edi
mov    %r13,%rcx
xor    %r8d,%r8d
call   1040 <_ada_use_c2phc4c@plt>
mov    -0x40(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ecx,%ecx
test   $0x1,%dl
jne    1261 <Pieri_polynomial_system+0x141>
jmp    12a7 <Pieri_polynomial_system+0x187>

LLVM IR (-O0):
define i32 @Pieri_polynomial_system(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca [3 x i32]
%20 = alloca i32*
%21 = alloca i8*
%22 = alloca i64
%23 = alloca i64
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32 %5, i32* %12
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = mul nsw i32 %24, %25
%27 = load i32, i32* %9
%28 = load i32, i32* %7
%29 = load i32, i32* %8
%30 = add nsw i32 %28, %29
%31 = mul nsw i32 %27, %30
%32 = add nsw i32 %26, %31
store i32 %32, i32* %15
%33 = load i32, i32* %7
%34 = load i32, i32* %7
%35 = load i32, i32* %8
%36 = add nsw i32 %34, %35
%37 = mul nsw i32 %33, %36
store i32 %37, i32* %16
%38 = load i32, i32* %15
%39 = load i32, i32* %16
%40 = mul nsw i32 %38, %39
store i32 %40, i32* %17
%41 = load i32, i32* %17
%42 = mul nsw i32 2, %41
store i32 %42, i32* %18
%43 = load i32, i32* %17
%44 = zext i32 %43 to i64
%45 = call i8* @llvm.stacksave()
store i8* %45, i8** %21
%46 = alloca double, i64 %44
store i64 %44, i64* %22
%47 = load i32, i32* %18
%48 = zext i32 %47 to i64
%49 = alloca double, i64 %48
store i64 %48, i64* %23
%50 = load i32, i32* %12
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %79
52: ; preds = %6
%53 = load i32, i32* %15
%54 = load i32, i32* %16
%55 = load i8*, i8** %11
%56 = call i32 @scan_input_planes(i32 %53, i32 %54, i8* %55, double* %46)
store i32 %56, i32* %14
store i32 0, i32* %13
br label %57
57: ; preds = %75, %52
%58 = load i32, i32* %13
%59 = load i32, i32* %17
%60 = icmp slt i32 %58, %59
br i1 %60, label %61, label %78
61: ; preds = %57
%62 = load i32, i32* %13
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %46, i64 %63
%65 = load double, double* %64
%66 = load i32, i32* %13
%67 = mul nsw i32 2, %66
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %49, i64 %68
store double %65, double* %69
%70 = load i32, i32* %13
%71 = mul nsw i32 2, %70
%72 = add nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %49, i64 %73
store double 0.000000e+00, double* %74
br label %75
75: ; preds = %61
%76 = load i32, i32* %13
%77 = add nsw i32 %76, 1
store i32 %77, i32* %13
br label %57
78: ; preds = %57
br label %85
79: ; preds = %6
%80 = load i32, i32* %15
%81 = load i32, i32* %16
%82 = mul nsw i32 2, %81
%83 = load i8*, i8** %11
%84 = call i32 @scan_input_planes(i32 %80, i32 %82, i8* %83, double* %49)
store i32 %84, i32* %14
br label %85
85: ; preds = %79, %78
%86 = load i32, i32* %7
%87 = getelementptr inbounds [3 x i32], [3 x i32]* %19, i64 0, i64 0
store i32 %86, i32* %87
%88 = load i32, i32* %8
%89 = getelementptr inbounds [3 x i32], [3 x i32]* %19, i64 0, i64 1
store i32 %88, i32* %89
%90 = load i32, i32* %9
%91 = getelementptr inbounds [3 x i32], [3 x i32]* %19, i64 0, i64 2
store i32 %90, i32* %91
%92 = getelementptr inbounds [3 x i32], [3 x i32]* %19, i64 0, i64 0
%93 = load i32*, i32** %20
%94 = call i32 @_ada_use_c2phc4c(i32 227, i32* %92, i32* %93, double* %49, i32 0)
store i32 %94, i32* %14
%95 = load i32, i32* %14
%96 = load i8*, i8** %21
ret i32 %95
}

LLVM IR (-O2):
define i32 @Pieri_polynomial_system(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca [3 x i32]
%8 = mul nsw i32 %1, %0
%9 = add nsw i32 %1, %0
%10 = mul nsw i32 %9, %2
%11 = add nsw i32 %10, %8
%12 = mul nsw i32 %9, %0
%13 = mul i32 %11, %12
%14 = shl nsw i32 %13, 1
%15 = bitcast [3 x i32]* %7 to i8*
%16 = zext i32 %13 to i64
%17 = tail call i8* @llvm.stacksave()
%18 = alloca double, i64 %16
%19 = zext i32 %14 to i64
%20 = alloca double, i64 %19
%21 = icmp eq i32 %5, 1
br i1 %21, label %22, label %115
22: ; preds = %6
%23 = call i32 @scan_input_planes(i32 %11, i32 %12, i8* %4, double* %18)
%24 = icmp sgt i32 %13, 0
br i1 %24, label %25, label %118
25: ; preds = %22
%26 = icmp ult i32 %13, 4
br i1 %26, label %103, label %27
27: ; preds = %25
%28 = and i64 %16, 4294967292
%29 = add nsw i64 %28, -4
%30 = lshr exact i64 %29, 2
%31 = add nuw nsw i64 %30, 1
%32 = and i64 %31, 1
%33 = icmp eq i64 %29, 0
br i1 %33, label %79, label %34
34: ; preds = %27
%35 = and i64 %31, 9223372036854775806
%36 = getelementptr inbounds double, double* %20, i64 -1
%37 = getelementptr inbounds double, double* %20, i64 -1
%38 = getelementptr inbounds double, double* %20, i64 -1
%39 = getelementptr inbounds double, double* %20, i64 -1
br label %40
40: ; preds = %40, %34
%41 = phi i64 [ 0, %34 ], [ %76, %40 ]
%42 = phi i64 [ 0, %34 ], [ %77, %40 ]
%43 = getelementptr inbounds double, double* %18, i64 %41
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = getelementptr inbounds double, double* %43, i64 2
%47 = bitcast double* %46 to <2 x double>*
%48 = load <2 x double>, <2 x double>* %47
%49 = shl nuw nsw i64 %41, 1
%50 = shl i64 %41, 1
%51 = or i64 %49, 1
%52 = or i64 %50, 5
%53 = getelementptr inbounds double, double* %36, i64 %51
%54 = bitcast double* %53 to <4 x double>*
%55 = getelementptr inbounds double, double* %37, i64 %52
%56 = bitcast double* %55 to <4 x double>*
%57 = shufflevector <2 x double> %45, <2 x double> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x double> %57, <4 x double>* %54
%58 = shufflevector <2 x double> %48, <2 x double> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x double> %58, <4 x double>* %56
%59 = or i64 %41, 4
%60 = getelementptr inbounds double, double* %18, i64 %59
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = getelementptr inbounds double, double* %60, i64 2
%64 = bitcast double* %63 to <2 x double>*
%65 = load <2 x double>, <2 x double>* %64
%66 = shl nuw nsw i64 %59, 1
%67 = shl i64 %59, 1
%68 = or i64 %66, 1
%69 = or i64 %67, 5
%70 = getelementptr inbounds double, double* %38, i64 %68
%71 = bitcast double* %70 to <4 x double>*
%72 = getelementptr inbounds double, double* %39, i64 %69
%73 = bitcast double* %72 to <4 x double>*
%74 = shufflevector <2 x double> %62, <2 x double> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x double> %74, <4 x double>* %71
%75 = shufflevector <2 x double> %65, <2 x double> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x double> %75, <4 x double>* %73
%76 = add nuw i64 %41, 8
%77 = add i64 %42, 2
%78 = icmp eq i64 %77, %35
br i1 %78, label %79, label %40
79: ; preds = %40, %27
%80 = phi i64 [ 0, %27 ], [ %76, %40 ]
%81 = icmp eq i64 %32, 0
br i1 %81, label %101, label %82
82: ; preds = %79
%83 = getelementptr inbounds double, double* %18, i64 %80
%84 = bitcast double* %83 to <2 x double>*
%85 = load <2 x double>, <2 x double>* %84
%86 = getelementptr inbounds double, double* %83, i64 2
%87 = bitcast double* %86 to <2 x double>*
%88 = load <2 x double>, <2 x double>* %87
%89 = shl nuw nsw i64 %80, 1
%90 = shl i64 %80, 1
%91 = or i64 %89, 1
%92 = or i64 %90, 5
%93 = getelementptr inbounds double, double* %20, i64 -1
%94 = getelementptr inbounds double, double* %20, i64 -1
%95 = getelementptr inbounds double, double* %93, i64 %91
%96 = bitcast double* %95 to <4 x double>*
%97 = getelementptr inbounds double, double* %94, i64 %92
%98 = bitcast double* %97 to <4 x double>*
%99 = shufflevector <2 x double> %85, <2 x double> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x double> %99, <4 x double>* %96
%100 = shufflevector <2 x double> %88, <2 x double> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x double> %100, <4 x double>* %98
br label %101
101: ; preds = %79, %82
%102 = icmp eq i64 %28, %16
br i1 %102, label %118, label %103
103: ; preds = %25, %101
%104 = phi i64 [ 0, %25 ], [ %28, %101 ]
br label %105
105: ; preds = %103, %105
%106 = phi i64 [ %113, %105 ], [ %104, %103 ]
%107 = getelementptr inbounds double, double* %18, i64 %106
%108 = load double, double* %107
%109 = shl nuw nsw i64 %106, 1
%110 = getelementptr inbounds double, double* %20, i64 %109
store double %108, double* %110
%111 = or i64 %109, 1
%112 = getelementptr inbounds double, double* %20, i64 %111
store double 0.000000e+00, double* %112
%113 = add nuw nsw i64 %106, 1
%114 = icmp eq i64 %113, %16
br i1 %114, label %118, label %105
115: ; preds = %6
%116 = shl nsw i32 %12, 1
%117 = call i32 @scan_input_planes(i32 %11, i32 %116, i8* %4, double* %20)
br label %118
118: ; preds = %105, %101, %22, %115
%119 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
store i32 %0, i32* %119
%120 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
store i32 %1, i32* %120
%121 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 2
store i32 %2, i32* %121
%122 = call i32 @_ada_use_c2phc4c(i32 227, i32* %119, i32* undef, double* %20, i32 0)
ret i32 %122
}