#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 ZYXEulerAngleToRot(double alpha, double beta, double gamma,
                        double R[3][3]) {
  R[0][0] = cos(alpha) * cos(beta);
  R[0][1] = cos(alpha) * sin(beta) * sin(gamma) - sin(alpha) * cos(gamma);
  R[0][2] = cos(alpha) * sin(beta) * cos(gamma) + sin(alpha) * sin(gamma);
  R[1][0] = sin(alpha) * cos(beta);
  R[1][1] = sin(alpha) * sin(beta) * sin(gamma) + cos(alpha) * cos(gamma);
  R[1][2] = sin(alpha) * sin(beta) * cos(gamma) - cos(alpha) * sin(gamma);
  R[2][0] = -sin(beta);
  R[2][1] = cos(beta) * sin(gamma);
  R[2][2] = cos(beta) * cos(gamma);
  return;
}


x86 assembly (clang, -O0):
<ZYXEulerAngleToRot>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%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,-0xc0(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movsd  -0xa8(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x90(%rbp),%xmm1
ff
movsd  -0x88(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x68(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x38(%rax)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x40(%rax)
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ZYXEulerAngleToRot>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rbx)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x18(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rbx)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
xorps  0xcc1(%rip),%xmm0
movlps %xmm0,0x30(%rbx)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x38(%rbx)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x40(%rbx)
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ZYXEulerAngleToRot(double %0, double %1, double %2, [3 x double]* nocapture writeonly %3) {
%5 = tail call double @cos(double %0)
%6 = tail call double @cos(double %1)
%7 = fmul double %5, %6
%8 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
store double %7, double* %8
%9 = tail call double @cos(double %0)
%10 = tail call double @sin(double %1)
%11 = fmul double %9, %10
%12 = tail call double @sin(double %2)
%13 = tail call double @sin(double %0)
%14 = tail call double @cos(double %2)
%15 = fneg double %13
%16 = fmul double %14, %15
%17 = tail call double @llvm.fmuladd.f64(double %11, double %12, double %16)
%18 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 1
store double %17, double* %18
%19 = tail call double @cos(double %0)
%20 = tail call double @sin(double %1)
%21 = fmul double %19, %20
%22 = tail call double @cos(double %2)
%23 = tail call double @sin(double %0)
%24 = tail call double @sin(double %2)
%25 = fmul double %23, %24
%26 = tail call double @llvm.fmuladd.f64(double %21, double %22, double %25)
%27 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 2
store double %26, double* %27
%28 = tail call double @sin(double %0)
%29 = tail call double @cos(double %1)
%30 = fmul double %28, %29
%31 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 1, i64 0
store double %30, double* %31
%32 = tail call double @sin(double %0)
%33 = tail call double @sin(double %1)
%34 = fmul double %32, %33
%35 = tail call double @sin(double %2)
%36 = tail call double @cos(double %0)
%37 = tail call double @cos(double %2)
%38 = fmul double %36, %37
%39 = tail call double @llvm.fmuladd.f64(double %34, double %35, double %38)
%40 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 1, i64 1
store double %39, double* %40
%41 = tail call double @sin(double %0)
%42 = tail call double @sin(double %1)
%43 = fmul double %41, %42
%44 = tail call double @cos(double %2)
%45 = tail call double @cos(double %0)
%46 = tail call double @sin(double %2)
%47 = fneg double %45
%48 = fmul double %46, %47
%49 = tail call double @llvm.fmuladd.f64(double %43, double %44, double %48)
%50 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 1, i64 2
store double %49, double* %50
%51 = tail call double @sin(double %1)
%52 = fneg double %51
%53 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 2, i64 0
store double %52, double* %53
%54 = tail call double @cos(double %1)
%55 = tail call double @sin(double %2)
%56 = fmul double %54, %55
%57 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 2, i64 1
store double %56, double* %57
%58 = tail call double @cos(double %1)
%59 = tail call double @cos(double %2)
%60 = fmul double %58, %59
%61 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 2, i64 2
store double %60, double* %61
ret void
}