#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_c2phc(int, int *, int *, double *);
int scan_complex_interpolation_points(int, char *, double *);
int scan_input_planes(int, int, char *, double *);
int run_Pieri_homotopies(int m, int p, int q, int nc, int *r, char *A,
                         char *pts) {
  int i, fail;
  int n = m * p + q * (m + p);
  int mdim = 2 * m * (m + p);
  int tdim = n * mdim;
  int mpq[3];
  double cff[tdim + 2 * n];
  double cffpts[2 * n];
  int cnt = 0;
  fail = scan_input_planes(n, mdim, A, cff);
  if (q > 0) {
    fail = scan_complex_interpolation_points(n, pts, cffpts);
    for (i = 0; i < 2 * n; i++)
      cff[tdim + i] = cffpts[i];
  }
  mpq[0] = m;
  mpq[1] = p;
  mpq[2] = q;
  fail = _ada_use_c2phc(225, mpq, r, cff);
  return fail;
}


x86 assembly (clang, -O0):
<run_Pieri_homotopies>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%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,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
mov    %eax,%ecx
add    %edx,%ecx
imul   %ecx,%eax
add    %eax,%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x30(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edx
mov    -0x2c(%rbp),%eax
mov    %eax,%ecx
mov    %edx,%eax
lea    (%rax,%rcx,2),%eax
mov    %rsp,%rcx
mov    %rcx,-0x48(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x50(%rbp)
mov    -0x2c(%rbp),%eax
add    %eax,%eax
mov    %rax,%rsi
shl    $0x3,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x68(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <scan_input_planes@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1254 <run_Pieri_homotopies+0x124>
mov    -0x68(%rbp),%rdx
mov    -0x2c(%rbp),%edi
mov    0x10(%rbp),%rsi
call   1050 <scan_complex_interpolation_points@plt>
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x2c(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    124f <run_Pieri_homotopies+0x11f>
mov    -0x70(%rbp),%rax
mov    -0x68(%rbp),%rcx
movslq -0x24(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
mov    -0x34(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1211 <run_Pieri_homotopies+0xe1>
jmp    1254 <run_Pieri_homotopies+0x124>
mov    -0x70(%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    -0x18(%rbp),%rdx
mov    $0xe1,%edi
call   1040 <_ada_use_c2phc@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x48(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_Pieri_homotopies>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8,-0x60(%rbp)
mov    %edx,%r13d
mov    %rsp,-0x48(%rbp)
mov    %esi,%eax
imul   %edi,%eax
mov    %rsi,-0x58(%rbp)
lea    (%rsi,%rdi,1),%r15d
mov    %rdi,-0x50(%rbp)
mov    %edi,%esi
imul   %r15d,%esi
imul   %edx,%r15d
add    %eax,%r15d
add    %esi,%esi
mov    %r15d,%r12d
imul   %esi,%r12d
lea    (%r15,%r15,1),%ecx
lea    (%r12,%r15,2),%eax
shl    $0x3,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rcx,-0x40(%rbp)
lea    0x0(,%rcx,8),%rax
mov    %rsp,%r14
sub    %rax,%r14
mov    %r14,%rsp
mov    %r15d,%edi
mov    %r9,%rdx
mov    %rbx,%rcx
call   1040 <scan_input_planes@plt>
mov    %r13d,-0x2c(%rbp)
test   %r13d,%r13d
jle    11fa <run_Pieri_homotopies+0xba>
mov    0x10(%rbp),%rsi
mov    %r15d,%edi
mov    %r14,%rdx
call   1060 <scan_complex_interpolation_points@plt>
test   %r15d,%r15d
jle    11fa <run_Pieri_homotopies+0xba>
movslq %r12d,%rax
lea    (%rbx,%rax,8),%rdi
mov    -0x40(%rbp),%rax
cmp    $0x2,%eax
mov    $0x1,%edx
cmovge %eax,%edx
shl    $0x3,%rdx
mov    %r14,%rsi
call   1030 <memcpy@plt>
mov    -0x50(%rbp),%rax
mov    %eax,-0x38(%rbp)
mov    -0x58(%rbp),%rax
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
lea    -0x38(%rbp),%rsi
mov    $0xe1,%edi
mov    -0x60(%rbp),%rdx
mov    %rbx,%rcx
call   1050 <_ada_use_c2phc@plt>
mov    -0x48(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @run_Pieri_homotopies(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i8* %5, i8* %6) {
%8 = alloca [3 x i32]
%9 = mul nsw i32 %1, %0
%10 = add nsw i32 %1, %0
%11 = mul nsw i32 %10, %2
%12 = add nsw i32 %11, %9
%13 = shl nsw i32 %0, 1
%14 = mul nsw i32 %10, %13
%15 = mul i32 %12, %14
%16 = bitcast [3 x i32]* %8 to i8*
%17 = shl i32 %12, 1
%18 = add nsw i32 %15, %17
%19 = zext i32 %18 to i64
%20 = tail call i8* @llvm.stacksave()
%21 = alloca double, i64 %19
%22 = zext i32 %17 to i64
%23 = alloca double, i64 %22
%24 = bitcast double* %23 to i8*
%25 = call i32 @scan_input_planes(i32 %12, i32 %14, i8* %5, double* %21)
%26 = icmp sgt i32 %2, 0
br i1 %26, label %27, label %37
27: ; preds = %7
%28 = call i32 @scan_complex_interpolation_points(i32 %12, i8* %6, double* %23)
%29 = icmp sgt i32 %12, 0
br i1 %29, label %30, label %37
30: ; preds = %27
%31 = sext i32 %15 to i64
%32 = getelementptr double, double* %21, i64 %31
%33 = bitcast double* %32 to i8*
%34 = call i32 @llvm.smax.i32(i32 %17, i32 1)
%35 = zext i32 %34 to i64
%36 = shl nuw nsw i64 %35, 3
br label %37
37: ; preds = %30, %27, %7
%38 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
store i32 %0, i32* %38
%39 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 1
store i32 %1, i32* %39
%40 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 2
store i32 %2, i32* %40
%41 = call i32 @_ada_use_c2phc(i32 225, i32* %38, i32* %4, double* %21)
ret i32 %41
}