#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);
double sin(double);
void ltr_int_euler_to_matrix(double pitch, double yaw, double roll,
                             double matrix[3][3]) {
  double cp = cos(pitch);
  double sp = sin(pitch);
  double cy = cos(yaw);
  double sy = sin(yaw);
  double cr = cos(roll);
  double sr = sin(roll);
  matrix[0][0] = cr * cy;
  matrix[0][1] = -sr * cy;
  matrix[0][2] = sy;
  matrix[1][0] = cr * sy * sp + sr * cp;
  matrix[1][1] = -sr * sy * sp + cr * cp;
  matrix[1][2] = -cy * sp;
  matrix[2][0] = -cr * sy * cp + sr * sp;
  matrix[2][1] = sr * sy * cp + cr * sp;
  matrix[2][2] = cy * cp;
}


x86 assembly (clang, -O0):
<ltr_int_euler_to_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x38(%rax)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x40(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltr_int_euler_to_matrix>:
push   %rbx
sub    $0x60,%rsp
mov    %rdi,%rbx
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x20(%rsp)
call   1040 <cos@plt>
movaps %xmm0,0x50(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x40(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movapd 0xe68(%rip),%xmm8
movapd 0x30(%rsp),%xmm1
movapd %xmm1,%xmm2
movapd %xmm0,%xmm3
unpcklpd %xmm1,%xmm3
xorpd  %xmm8,%xmm1
unpcklpd %xmm0,%xmm1
movapd %xmm1,%xmm6
xorpd  %xmm8,%xmm0
movapd 0x40(%rsp),%xmm7
movapd %xmm7,%xmm4
unpcklpd %xmm7,%xmm4
unpcklpd %xmm0,%xmm2
mulpd  %xmm2,%xmm4
movupd %xmm4,(%rbx)
movapd 0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rbx)
unpcklpd %xmm0,%xmm0
mulpd  %xmm0,%xmm2
movapd %xmm0,%xmm1
movapd 0x50(%rsp),%xmm5
movapd %xmm5,%xmm0
unpcklpd %xmm5,%xmm0
movapd %xmm6,%xmm4
mulpd  %xmm1,%xmm4
mulpd  %xmm0,%xmm4
movapd %xmm4,%xmm1
mulpd  %xmm3,%xmm0
movapd 0x20(%rsp),%xmm6
movapd %xmm6,%xmm4
unpcklpd %xmm6,%xmm4
mulpd  %xmm4,%xmm2
addpd  %xmm0,%xmm2
movupd %xmm2,0x18(%rbx)
movapd %xmm7,%xmm0
mulsd  %xmm7,%xmm5
xorpd  %xmm8,%xmm0
mulsd  %xmm6,%xmm0
movsd  %xmm0,0x28(%rbx)
mulpd  %xmm3,%xmm4
addpd  %xmm4,%xmm1
movupd %xmm1,0x30(%rbx)
movsd  %xmm5,0x40(%rbx)
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @ltr_int_euler_to_matrix(double %0, double %1, double %2, [3 x double]* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca [3 x double]*
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store [3 x double]* %3, [3 x double]** %8
%15 = load double, double* %5
%16 = call double @cos(double %15)
store double %16, double* %9
%17 = load double, double* %5
%18 = call double @sin(double %17)
store double %18, double* %10
%19 = load double, double* %6
%20 = call double @cos(double %19)
store double %20, double* %11
%21 = load double, double* %6
%22 = call double @sin(double %21)
store double %22, double* %12
%23 = load double, double* %7
%24 = call double @cos(double %23)
store double %24, double* %13
%25 = load double, double* %7
%26 = call double @sin(double %25)
store double %26, double* %14
%27 = load double, double* %13
%28 = load double, double* %11
%29 = fmul double %27, %28
%30 = load [3 x double]*, [3 x double]** %8
%31 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0
%32 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 0, i64 0
store double %29, double* %32
%33 = load double, double* %14
%34 = fneg double %33
%35 = load double, double* %11
%36 = fmul double %34, %35
%37 = load [3 x double]*, [3 x double]** %8
%38 = getelementptr inbounds [3 x double], [3 x double]* %37, i64 0
%39 = getelementptr inbounds [3 x double], [3 x double]* %38, i64 0, i64 1
store double %36, double* %39
%40 = load double, double* %12
%41 = load [3 x double]*, [3 x double]** %8
%42 = getelementptr inbounds [3 x double], [3 x double]* %41, i64 0
%43 = getelementptr inbounds [3 x double], [3 x double]* %42, i64 0, i64 2
store double %40, double* %43
%44 = load double, double* %13
%45 = load double, double* %12
%46 = fmul double %44, %45
%47 = load double, double* %10
%48 = load double, double* %14
%49 = load double, double* %9
%50 = fmul double %48, %49
%51 = call double @llvm.fmuladd.f64(double %46, double %47, double %50)
%52 = load [3 x double]*, [3 x double]** %8
%53 = getelementptr inbounds [3 x double], [3 x double]* %52, i64 1
%54 = getelementptr inbounds [3 x double], [3 x double]* %53, i64 0, i64 0
store double %51, double* %54
%55 = load double, double* %14
%56 = fneg double %55
%57 = load double, double* %12
%58 = fmul double %56, %57
%59 = load double, double* %10
%60 = load double, double* %13
%61 = load double, double* %9
%62 = fmul double %60, %61
%63 = call double @llvm.fmuladd.f64(double %58, double %59, double %62)
%64 = load [3 x double]*, [3 x double]** %8
%65 = getelementptr inbounds [3 x double], [3 x double]* %64, i64 1
%66 = getelementptr inbounds [3 x double], [3 x double]* %65, i64 0, i64 1
store double %63, double* %66
%67 = load double, double* %11
%68 = fneg double %67
%69 = load double, double* %10
%70 = fmul double %68, %69
%71 = load [3 x double]*, [3 x double]** %8
%72 = getelementptr inbounds [3 x double], [3 x double]* %71, i64 1
%73 = getelementptr inbounds [3 x double], [3 x double]* %72, i64 0, i64 2
store double %70, double* %73
%74 = load double, double* %13
%75 = fneg double %74
%76 = load double, double* %12
%77 = fmul double %75, %76
%78 = load double, double* %9
%79 = load double, double* %14
%80 = load double, double* %10
%81 = fmul double %79, %80
%82 = call double @llvm.fmuladd.f64(double %77, double %78, double %81)
%83 = load [3 x double]*, [3 x double]** %8
%84 = getelementptr inbounds [3 x double], [3 x double]* %83, i64 2
%85 = getelementptr inbounds [3 x double], [3 x double]* %84, i64 0, i64 0
store double %82, double* %85
%86 = load double, double* %14
%87 = load double, double* %12
%88 = fmul double %86, %87
%89 = load double, double* %9
%90 = load double, double* %13
%91 = load double, double* %10
%92 = fmul double %90, %91
%93 = call double @llvm.fmuladd.f64(double %88, double %89, double %92)
%94 = load [3 x double]*, [3 x double]** %8
%95 = getelementptr inbounds [3 x double], [3 x double]* %94, i64 2
%96 = getelementptr inbounds [3 x double], [3 x double]* %95, i64 0, i64 1
store double %93, double* %96
%97 = load double, double* %11
%98 = load double, double* %9
%99 = fmul double %97, %98
%100 = load [3 x double]*, [3 x double]** %8
%101 = getelementptr inbounds [3 x double], [3 x double]* %100, i64 2
%102 = getelementptr inbounds [3 x double], [3 x double]* %101, i64 0, i64 2
store double %99, double* %102
ret void
}

LLVM IR (-O2):
define void @ltr_int_euler_to_matrix(double %0, double %1, double %2, [3 x double]* nocapture writeonly %3) {
%5 = tail call double @cos(double %0)
%6 = tail call double @sin(double %0)
%7 = tail call double @cos(double %1)
%8 = tail call double @sin(double %1)
%9 = tail call double @cos(double %2)
%10 = tail call double @sin(double %2)
%11 = fneg double %10
%12 = insertelement <2 x double> poison, double %7, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = insertelement <2 x double> poison, double %9, i64 0
%15 = insertelement <2 x double> %14, double %11, i64 1
%16 = fmul <2 x double> %13, %15
%17 = bitcast [3 x double]* %3 to <2 x double>*
store <2 x double> %16, <2 x double>* %17
%18 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 2
store double %8, double* %18
%19 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 1, i64 0
%20 = insertelement <2 x double> poison, double %8, i64 0
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
%22 = fmul <2 x double> %21, %15
%23 = insertelement <2 x double> poison, double %5, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = insertelement <2 x double> poison, double %10, i64 0
%26 = insertelement <2 x double> %25, double %9, i64 1
%27 = fmul <2 x double> %24, %26
%28 = insertelement <2 x double> poison, double %6, i64 0
%29 = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> zeroinitializer
%30 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %29, <2 x double> %27)
%31 = bitcast double* %19 to <2 x double>*
store <2 x double> %30, <2 x double>* %31
%32 = fneg double %7
%33 = fmul double %6, %32
%34 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 1, i64 2
store double %33, double* %34
%35 = fneg double %9
%36 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 2, i64 0
%37 = insertelement <2 x double> poison, double %35, i64 0
%38 = insertelement <2 x double> %37, double %10, i64 1
%39 = fmul <2 x double> %21, %38
%40 = fmul <2 x double> %29, %26
%41 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %24, <2 x double> %40)
%42 = bitcast double* %36 to <2 x double>*
store <2 x double> %41, <2 x double>* %42
%43 = fmul double %5, %7
%44 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 2, i64 2
store double %43, double* %44
ret void
}