#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 pack_coefficients(int const, double *, int *, char *);
int scan_real_interpolation_points(int const, char *, double *);
int real_osculating_planes(int m, int p, int q, int *nc, char *s,
                           char *planes) {
  int i, fail;
  const int n = m * p + q * (m + p);
  const int d = m + p;
  const int e = n * m * d;
  double cffpts[n];
  double coeffs[e];
  int mpq[3];
  int *b;
  mpq[0] = m;
  mpq[1] = p;
  mpq[2] = q;
  fail = scan_real_interpolation_points(n, s, cffpts);
  for (i = 0; i < n; i++)
    coeffs[i] = cffpts[i];
  fail = _ada_use_c2phc4c(226, mpq, b, coeffs, 0);
  fail = pack_coefficients(e, coeffs, nc, planes);
  return fail;
}


x86 assembly (clang, -O0):
<real_osculating_planes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%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,-0x34(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x4(%rbp),%ecx
imul   %ecx,%eax
mov    -0x38(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x48(%rbp)
lea    0xf(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x80(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x50(%rbp)
mov    -0x3c(%rbp),%eax
lea    0xf(,%rax,8),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rcx
sub    %rsi,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <scan_real_interpolation_points@plt>
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1228 <real_osculating_planes+0xf8>
mov    -0x78(%rbp),%rax
mov    -0x80(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11f4 <real_osculating_planes+0xc4>
mov    -0x78(%rbp),%rcx
lea    -0x64(%rbp),%rsi
mov    -0x70(%rbp),%rdx
mov    $0xe2,%edi
xor    %r8d,%r8d
call   1050 <_ada_use_c2phc4c@plt>
mov    -0x78(%rbp),%rsi
mov    %eax,-0x30(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <pack_coefficients@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x48(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<real_osculating_planes>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,-0x40(%rbp)
mov    %rcx,%r15
mov    %esi,%eax
imul   %edi,%eax
lea    (%rsi,%rdi,1),%r12d
mov    %r12d,%ebx
imul   %edx,%ebx
add    %eax,%ebx
imul   %edi,%r12d
imul   %ebx,%r12d
lea    0xf(,%rbx,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r14
sub    %rax,%r14
mov    %r14,%rsp
lea    0xf(,%r12,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
mov    %edi,-0x34(%rbp)
mov    %esi,-0x30(%rbp)
mov    %edx,-0x2c(%rbp)
mov    %ebx,%edi
mov    %r8,%rsi
mov    %r14,%rdx
call   1040 <scan_real_interpolation_points@plt>
test   %ebx,%ebx
jle    11cb <real_osculating_planes+0x8b>
add    $0xffffffff,%ebx
lea    0x8(,%rbx,8),%rdx
mov    %r13,%rdi
mov    %r14,%rsi
call   1030 <memcpy@plt>
lea    -0x34(%rbp),%rsi
mov    $0xe2,%edi
mov    %r13,%rcx
xor    %r8d,%r8d
call   1060 <_ada_use_c2phc4c@plt>
mov    %r12d,%edi
mov    %r13,%rsi
mov    %r15,%rdx
mov    -0x40(%rbp),%rcx
call   1050 <pack_coefficients@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @real_osculating_planes(i32 %0, i32 %1, i32 %2, i32* %3, i8* %4, i8* %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 i32 %10, %8
%12 = mul i32 %9, %0
%13 = mul i32 %12, %11
%14 = zext i32 %11 to i64
%15 = alloca double, i64 %14
%16 = zext i32 %13 to i64
%17 = alloca double, i64 %16
%18 = bitcast [3 x i32]* %7 to i8*
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
store i32 %0, i32* %19
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
store i32 %1, i32* %20
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 2
store i32 %2, i32* %21
%22 = call i32 @scan_real_interpolation_points(i32 %11, i8* %4, double* %15)
%23 = icmp sgt i32 %11, 0
br i1 %23, label %24, label %31
24: ; preds = %6
%25 = bitcast double* %17 to i8*
%26 = bitcast double* %15 to i8*
%27 = add nsw i32 %11, -1
%28 = zext i32 %27 to i64
%29 = shl nuw nsw i64 %28, 3
%30 = add nuw nsw i64 %29, 8
br label %31
31: ; preds = %24, %6
%32 = call i32 @_ada_use_c2phc4c(i32 226, i32* %19, i32* undef, double* %17, i32 0)
%33 = call i32 @pack_coefficients(i32 %13, double* %17, i32* %3, i8* %5)
ret i32 %33
}