#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*/ assert(int);
int /*<<< orphan*/ lsx_debug(char *, char const *, double, double, double,
                             double, double);
void square_quadratic(char const *name, double const *x, double *y) {
  assert(4 == 4);
  y[0] = x[0] * x[0];
  y[1] = 2 * x[0] * x[1];
  y[2] = 2 * x[0] * x[2] + x[1] * x[1];
  y[3] = 2 * x[1] * x[2];
  y[4] = x[2] * x[2];
  lsx_debug("%s=[%.16g %.16g %.16g %.16g %.16g];", name, y[0], y[1], y[2], y[3],
            y[4]);
}


x86 assembly (clang, -O0):
<square_quadratic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x1,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0xe9e(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0xe7c(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  0xe40(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm3
mov    -0x18(%rbp),%rax
movsd  0x20(%rax),%xmm4
lea    0xddf(%rip),%rdi
call   1030 <lsx_debug@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<square_quadratic>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
mov    $0x1,%edi
call   1040 <assert@plt>
movsd  (%rbx),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,(%r15)
movsd  (%rbx),%xmm1
addsd  %xmm1,%xmm1
mulsd  0x8(%rbx),%xmm1
movsd  %xmm1,0x8(%r15)
movsd  (%rbx),%xmm2
movsd  0x8(%rbx),%xmm3
addsd  %xmm2,%xmm2
mulsd  0x10(%rbx),%xmm2
mulsd  %xmm3,%xmm3
addsd  %xmm3,%xmm2
movsd  %xmm2,0x10(%r15)
movsd  0x8(%rbx),%xmm3
addsd  %xmm3,%xmm3
mulsd  0x10(%rbx),%xmm3
movsd  %xmm3,0x18(%r15)
movsd  0x10(%rbx),%xmm4
mulsd  %xmm4,%xmm4
movsd  %xmm4,0x20(%r15)
lea    0xe5e(%rip),%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <lsx_debug@plt>

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

LLVM IR (-O2):
@.str = [36 x i8] c"%s=[%.16g %.16g %.16g %.16g %.16g];\00"
define void @square_quadratic(i8* %0, double* nocapture %1, double* nocapture %2) {
%4 = tail call i32 @assert(i32 1)
%5 = load double, double* %1
%6 = fmul double %5, %5
store double %6, double* %2
%7 = load double, double* %1
%8 = fmul double %7, 2.000000e+00
%9 = getelementptr inbounds double, double* %1, i64 1
%10 = load double, double* %9
%11 = fmul double %8, %10
%12 = getelementptr inbounds double, double* %2, i64 1
store double %11, double* %12
%13 = load double, double* %1
%14 = fmul double %13, 2.000000e+00
%15 = getelementptr inbounds double, double* %1, i64 2
%16 = load double, double* %15
%17 = load double, double* %9
%18 = fmul double %17, %17
%19 = tail call double @llvm.fmuladd.f64(double %14, double %16, double %18)
%20 = getelementptr inbounds double, double* %2, i64 2
store double %19, double* %20
%21 = load double, double* %9
%22 = fmul double %21, 2.000000e+00
%23 = load double, double* %15
%24 = fmul double %22, %23
%25 = getelementptr inbounds double, double* %2, i64 3
store double %24, double* %25
%26 = load double, double* %15
%27 = fmul double %26, %26
%28 = getelementptr inbounds double, double* %2, i64 4
store double %27, double* %28
%29 = tail call i32 @lsx_debug(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0, double %6, double %11, double %19, double %24, double %27)
ret void
}