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


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

x86 assembly (clang, -O2):
<MatrixGetHeading33>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
movsd  %xmm0,(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movaps 0xeb7(%rip),%xmm1
xorps  %xmm0,%xmm1
movlps %xmm1,0x8(%rbx)
movq   $0x0,0x10(%rbx)
movsd  %xmm0,0x18(%rbx)
movsd  (%rbx),%xmm0
movsd  %xmm0,0x20(%rbx)
xorps  %xmm0,%xmm0
movups %xmm0,0x28(%rbx)
movq   $0x0,0x38(%rbx)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x40(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @MatrixGetHeading33(double %0, double* nocapture %1) {
%3 = tail call double @cos(double %0)
store double %3, double* %1
%4 = tail call double @sin(double %0)
%5 = fneg double %4
%6 = getelementptr inbounds double, double* %1, i64 1
store double %5, double* %6
%7 = getelementptr inbounds double, double* %1, i64 2
store double 0.000000e+00, double* %7
%8 = getelementptr inbounds double, double* %1, i64 3
store double %4, double* %8
%9 = load double, double* %1
%10 = getelementptr inbounds double, double* %1, i64 4
store double %9, double* %10
%11 = getelementptr inbounds double, double* %1, i64 5
%12 = getelementptr inbounds double, double* %1, i64 8
%13 = bitcast double* %11 to i8*
store double 1.000000e+00, double* %12
ret void
}