#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*/ MatrixMulti3Rotate33(double *, double *, double *);
double cos(double);
double sin(double);
void MatrixRotateHeading3(double *a, double theta, double *r) {
  double b[3 * 3];
  b[0] = cos(theta);
  b[1] = -sin(theta);
  b[2] = 0.0;
  b[3] = -b[1];
  b[4] = b[0];
  b[5] = 0.0;
  b[6] = 0.0;
  b[7] = 0.0;
  b[8] = 1.0;
  MatrixMulti3Rotate33(a, b, r);
}


x86 assembly (clang, -O0):
<MatrixRotateHeading3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe33(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <MatrixMulti3Rotate33@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MatrixRotateHeading3>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r14
movsd  %xmm0,(%rsp)
mov    %rdi,%rbx
call   1040 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
movaps 0xe9c(%rip),%xmm1
xorps  %xmm0,%xmm1
movlps %xmm1,0x18(%rsp)
movq   $0x0,0x20(%rsp)
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x38(%rsp)
movq   $0x0,0x48(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x50(%rsp)
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1050 <MatrixMulti3Rotate33@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @MatrixRotateHeading3(double* %0, double %1, double* %2) {
%4 = alloca double*
%5 = alloca double
%6 = alloca double*
%7 = alloca [9 x double]
store double* %0, double** %4
store double %1, double* %5
store double* %2, double** %6
%8 = load double, double* %5
%9 = call double @cos(double %8)
%10 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 0
store double %9, double* %10
%11 = load double, double* %5
%12 = call double @sin(double %11)
%13 = fneg double %12
%14 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 1
store double %13, double* %14
%15 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 2
store double 0.000000e+00, double* %15
%16 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 1
%17 = load double, double* %16
%18 = fneg double %17
%19 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 3
store double %18, double* %19
%20 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 0
%21 = load double, double* %20
%22 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 4
store double %21, double* %22
%23 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 5
store double 0.000000e+00, double* %23
%24 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 6
store double 0.000000e+00, double* %24
%25 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 7
store double 0.000000e+00, double* %25
%26 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 8
store double 1.000000e+00, double* %26
%27 = load double*, double** %4
%28 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 0
%29 = load double*, double** %6
%30 = call i32 @MatrixMulti3Rotate33(double* %27, double* %28, double* %29)
ret void
}

LLVM IR (-O2):
define void @MatrixRotateHeading3(double* %0, double %1, double* %2) {
%4 = alloca [9 x double]
%5 = bitcast [9 x double]* %4 to i8*
%6 = tail call double @cos(double %1)
%7 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 0
store double %6, double* %7
%8 = tail call double @sin(double %1)
%9 = fneg double %8
%10 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 1
store double %9, double* %10
%11 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 2
store double 0.000000e+00, double* %11
%12 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 3
store double %8, double* %12
%13 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 4
store double %6, double* %13
%14 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 5
%15 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 8
%16 = bitcast double* %14 to i8*
store double 1.000000e+00, double* %15
%17 = call i32 @MatrixMulti3Rotate33(double* %0, double* %7, double* %2)
ret void
}