#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 */
double cos(double const);
void modele_inertie(const double q[2], double M[2 * 2]) {
  double c2;
  c2 = cos(q[1]);
  M[0] = 1 * 1 * 5 + 2 * 1 * 1 * 5 * c2 + 1 * 1 * (10 + 5);
  M[1] = 1 * 1 * 5 + 1 * 1 * 5 * c2;
  M[2] = M[1];
  M[3] = 1 * 1 * 5;
}


x86 assembly (clang, -O0):
<modele_inertie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1030 <cos@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xed0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb4(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xeb0(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
movsd  0xe8f(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  0xe60(%rip),%xmm0
movsd  %xmm0,0x18(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modele_inertie>:
push   %rbx
mov    %rsi,%rbx
movsd  0x8(%rdi),%xmm0
call   1030 <cos@plt>
movsd  0xeda(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xed6(%rip),%xmm2
addsd  %xmm2,%xmm1
addsd  0xed2(%rip),%xmm1
movsd  %xmm1,(%rbx)
mulsd  %xmm2,%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rbx)
movsd  %xmm0,0x10(%rbx)
movabs $0x4014000000000000,%rax
mov    %rax,0x18(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @modele_inertie(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 1
%8 = load double, double* %7
%9 = call double @cos(double %8)
store double %9, double* %5
%10 = load double, double* %5
%11 = call double @llvm.fmuladd.f64(double 1.000000e+01, double %10, double 5.000000e+00)
%12 = fadd double %11, 1.500000e+01
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 0
store double %12, double* %14
%15 = load double, double* %5
%16 = call double @llvm.fmuladd.f64(double 5.000000e+00, double %15, double 5.000000e+00)
%17 = load double*, double** %4
%18 = getelementptr inbounds double, double* %17, i64 1
store double %16, double* %18
%19 = load double*, double** %4
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 2
store double %21, double* %23
%24 = load double*, double** %4
%25 = getelementptr inbounds double, double* %24, i64 3
store double 5.000000e+00, double* %25
ret void
}

LLVM IR (-O2):
define void @modele_inertie(double* nocapture %0, double* nocapture writeonly %1) {
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = tail call double @cos(double %4)
%6 = tail call double @llvm.fmuladd.f64(double %5, double 1.000000e+01, double 5.000000e+00)
%7 = fadd double %6, 1.500000e+01
store double %7, double* %1
%8 = tail call double @llvm.fmuladd.f64(double %5, double 5.000000e+00, double 5.000000e+00)
%9 = getelementptr inbounds double, double* %1, i64 1
store double %8, double* %9
%10 = getelementptr inbounds double, double* %1, i64 2
store double %8, double* %10
%11 = getelementptr inbounds double, double* %1, i64 3
store double 5.000000e+00, double* %11
ret void
}