#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*/ cmul(double *, double *);
void evaluate(double *rv, double *coef, int n_coef, double *in) {
  double pz[2];
  rv[0] = *coef++;
  rv[1] = 0;
  if (--n_coef > 0) {
    pz[0] = in[0];
    pz[1] = in[1];
    rv[0] += *coef * pz[0];
    rv[1] += *coef * pz[1];
    coef++;
    n_coef--;
    while (n_coef > 0) {
      cmul(pz, in);
      rv[0] += *coef * pz[0];
      rv[1] += *coef * pz[1];
      coef++;
      n_coef--;
    }
  }
}


x86 assembly (clang, -O0):
<evaluate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    124e <evaluate+0x13e>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x30(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x28(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1249 <evaluate+0x139>
lea    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <cmul@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x30(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x28(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11d4 <evaluate+0xc4>
jmp    124e <evaluate+0x13e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluate>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rdi)
movq   $0x0,0x8(%rdi)
cmp    $0x2,%edx
jl     11c0 <evaluate+0xb0>
mov    %rcx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
movupd (%rcx),%xmm1
movapd %xmm1,(%rsp)
movsd  0x8(%rsi),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%rdi)
unpckhpd %xmm1,%xmm1
mulsd  0x8(%rsi),%xmm1
xorpd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rdi)
je     11c0 <evaluate+0xb0>
mov    %edx,%ebp
add    $0x10,%rbx
add    $0xffffffff,%ebp
mov    %rsp,%r12
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <cmul@plt>
movsd  (%rbx),%xmm0
mulsd  (%rsp),%xmm0
addsd  (%r15),%xmm0
movsd  %xmm0,(%r15)
movsd  (%rbx),%xmm0
mulsd  0x8(%rsp),%xmm0
addsd  0x8(%r15),%xmm0
movsd  %xmm0,0x8(%r15)
add    $0x8,%rbx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1180 <evaluate+0x70>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @evaluate(double* %0, double* %1, i32 %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double*
%9 = alloca [2 x double]
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store double* %3, double** %8
%10 = load double*, double** %6
%11 = getelementptr inbounds double, double* %10, i32 1
store double* %11, double** %6
%12 = load double, double* %10
%13 = load double*, double** %5
%14 = getelementptr inbounds double, double* %13, i64 0
store double %12, double* %14
%15 = load double*, double** %5
%16 = getelementptr inbounds double, double* %15, i64 1
store double 0.000000e+00, double* %16
%17 = load i32, i32* %7
%18 = add nsw i32 %17, -1
store i32 %18, i32* %7
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %77
20: ; preds = %4
%21 = load double*, double** %8
%22 = getelementptr inbounds double, double* %21, i64 0
%23 = load double, double* %22
%24 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 0
store double %23, double* %24
%25 = load double*, double** %8
%26 = getelementptr inbounds double, double* %25, i64 1
%27 = load double, double* %26
%28 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 1
store double %27, double* %28
%29 = load double*, double** %6
%30 = load double, double* %29
%31 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 0
%32 = load double, double* %31
%33 = load double*, double** %5
%34 = getelementptr inbounds double, double* %33, i64 0
%35 = load double, double* %34
%36 = call double @llvm.fmuladd.f64(double %30, double %32, double %35)
store double %36, double* %34
%37 = load double*, double** %6
%38 = load double, double* %37
%39 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 1
%40 = load double, double* %39
%41 = load double*, double** %5
%42 = getelementptr inbounds double, double* %41, i64 1
%43 = load double, double* %42
%44 = call double @llvm.fmuladd.f64(double %38, double %40, double %43)
store double %44, double* %42
%45 = load double*, double** %6
%46 = getelementptr inbounds double, double* %45, i32 1
store double* %46, double** %6
%47 = load i32, i32* %7
%48 = add nsw i32 %47, -1
store i32 %48, i32* %7
br label %49
49: ; preds = %52, %20
%50 = load i32, i32* %7
%51 = icmp sgt i32 %50, 0
br i1 %51, label %52, label %76
52: ; preds = %49
%53 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 0
%54 = load double*, double** %8
%55 = call i32 @cmul(double* %53, double* %54)
%56 = load double*, double** %6
%57 = load double, double* %56
%58 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 0
%59 = load double, double* %58
%60 = load double*, double** %5
%61 = getelementptr inbounds double, double* %60, i64 0
%62 = load double, double* %61
%63 = call double @llvm.fmuladd.f64(double %57, double %59, double %62)
store double %63, double* %61
%64 = load double*, double** %6
%65 = load double, double* %64
%66 = getelementptr inbounds [2 x double], [2 x double]* %9, i64 0, i64 1
%67 = load double, double* %66
%68 = load double*, double** %5
%69 = getelementptr inbounds double, double* %68, i64 1
%70 = load double, double* %69
%71 = call double @llvm.fmuladd.f64(double %65, double %67, double %70)
store double %71, double* %69
%72 = load double*, double** %6
%73 = getelementptr inbounds double, double* %72, i32 1
store double* %73, double** %6
%74 = load i32, i32* %7
%75 = add nsw i32 %74, -1
store i32 %75, i32* %7
br label %49
76: ; preds = %49
br label %77
77: ; preds = %76, %4
ret void
}

LLVM IR (-O2):
define void @evaluate(double* nocapture %0, double* nocapture %1, i32 %2, double* %3) {
%5 = alloca <2 x double>
%6 = bitcast <2 x double>* %5 to i8*
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %1
store double %8, double* %0
%9 = getelementptr inbounds double, double* %0, i64 1
store double 0.000000e+00, double* %9
%10 = icmp sgt i32 %2, 1
br i1 %10, label %11, label %41
11: ; preds = %4
%12 = getelementptr inbounds <2 x double>, <2 x double>* %5, i64 0, i64 0
%13 = bitcast double* %3 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = getelementptr inbounds <2 x double>, <2 x double>* %5, i64 0, i64 1
store <2 x double> %14, <2 x double>* %5
%16 = load double, double* %7
%17 = extractelement <2 x double> %14, i64 0
%18 = tail call double @llvm.fmuladd.f64(double %16, double %17, double %8)
store double %18, double* %0
%19 = load double, double* %7
%20 = extractelement <2 x double> %14, i64 1
%21 = tail call double @llvm.fmuladd.f64(double %19, double %20, double 0.000000e+00)
store double %21, double* %9
%22 = icmp eq i32 %2, 2
br i1 %22, label %41, label %23
23: ; preds = %11
%24 = add nsw i32 %2, -2
%25 = getelementptr inbounds double, double* %1, i64 2
br label %26
26: ; preds = %23, %26
%27 = phi double* [ %38, %26 ], [ %25, %23 ]
%28 = phi i32 [ %39, %26 ], [ %24, %23 ]
%29 = call i32 @cmul(double* %12, double* %3)
%30 = load double, double* %27
%31 = load double, double* %12
%32 = load double, double* %0
%33 = call double @llvm.fmuladd.f64(double %30, double %31, double %32)
store double %33, double* %0
%34 = load double, double* %27
%35 = load double, double* %15
%36 = load double, double* %9
%37 = call double @llvm.fmuladd.f64(double %34, double %35, double %36)
store double %37, double* %9
%38 = getelementptr inbounds double, double* %27, i64 1
%39 = add nsw i32 %28, -1
%40 = icmp ugt i32 %28, 1
br i1 %40, label %26, label %41
41: ; preds = %26, %11, %4
ret void
}