#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 */
float cosf(float);
float sinf(float);
void mat3_rotate(float *dst, float rad) {
  float a00 = dst[0], a01 = dst[1], a02 = dst[2], a10 = dst[3], a11 = dst[4],
        a12 = dst[5], a20 = dst[6], a21 = dst[7], a22 = dst[8], s = sinf(rad),
        c = cosf(rad);
  dst[0] = c * a00 + s * a10;
  dst[1] = c * a01 + s * a11;
  dst[2] = c * a02 + s * a12;
  dst[3] = c * a10 - s * a00;
  dst[4] = c * a11 - s * a01;
  dst[5] = c * a12 - s * a02;
  dst[6] = a20;
  dst[7] = a21;
  dst[8] = a22;
}


x86 assembly (clang, -O0):
<mat3_rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movss  0x10(%rax),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movss  0x14(%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movss  0x18(%rax),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movss  0x1c(%rax),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
movss  0x20(%rax),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x38(%rbp)
movss  -0x38(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
movss  -0x34(%rbp),%xmm1
mulss  -0x1c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x38(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
movss  -0x34(%rbp),%xmm1
mulss  -0x20(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x38(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
movss  -0x34(%rbp),%xmm1
mulss  -0x24(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
movss  -0x38(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm2
movss  -0x34(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
movss  -0x38(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
movss  -0x34(%rbp),%xmm1
mulss  -0x14(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x10(%rax)
movss  -0x38(%rbp),%xmm0
movss  -0x24(%rbp),%xmm2
movss  -0x34(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x14(%rax)
movss  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x18(%rax)
movss  -0x2c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x1c(%rax)
movss  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x20(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat3_rotate>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movaps %xmm0,%xmm1
movss  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
movups (%rdi),%xmm0
movaps %xmm0,0x20(%rsp)
movsd  0x10(%rdi),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0x18(%rdi),%r14
movss  0x20(%rdi),%xmm0
movss  %xmm0,0xc(%rsp)
movaps %xmm1,%xmm0
call   1030 <sinf@plt>
movaps %xmm0,0x10(%rsp)
movss  0x8(%rsp),%xmm0
call   1040 <cosf@plt>
movaps 0xe8d(%rip),%xmm1
movaps 0x10(%rsp),%xmm5
xorps  %xmm5,%xmm1
unpcklps %xmm5,%xmm1
movaps 0x20(%rsp),%xmm4
movaps %xmm4,%xmm2
movaps 0x30(%rsp),%xmm3
shufps $0x43,%xmm3,%xmm2
shufps $0x78,%xmm2,%xmm2
shufps $0x15,%xmm1,%xmm1
mulps  %xmm2,%xmm1
movaps %xmm0,%xmm2
mulss  %xmm3,%xmm2
shufps $0x55,%xmm3,%xmm3
mulss  %xmm0,%xmm3
shufps $0x0,%xmm0,%xmm0
mulps  %xmm4,%xmm0
addps  %xmm1,%xmm0
movups %xmm0,(%rbx)
movaps %xmm4,%xmm1
movaps %xmm4,%xmm0
shufps $0x55,%xmm4,%xmm0
mulss  %xmm5,%xmm0
subss  %xmm0,%xmm2
movss  %xmm2,0x10(%rbx)
unpckhpd %xmm4,%xmm1
mulss  %xmm5,%xmm1
subss  %xmm1,%xmm3
movss  %xmm3,0x14(%rbx)
mov    %r14,0x18(%rbx)
movss  0xc(%rsp),%xmm0
movss  %xmm0,0x20(%rbx)
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @mat3_rotate(float* nocapture %0, float %1) {
%3 = bitcast float* %0 to <4 x float>*
%4 = load <4 x float>, <4 x float>* %3
%5 = getelementptr inbounds float, float* %0, i64 4
%6 = getelementptr inbounds float, float* %0, i64 5
%7 = bitcast float* %5 to <2 x float>*
%8 = load <2 x float>, <2 x float>* %7
%9 = getelementptr inbounds float, float* %0, i64 6
%10 = load float, float* %9
%11 = getelementptr inbounds float, float* %0, i64 7
%12 = load float, float* %11
%13 = getelementptr inbounds float, float* %0, i64 8
%14 = load float, float* %13
%15 = tail call float @sinf(float %1)
%16 = tail call float @cosf(float %1)
%17 = fneg float %15
%18 = shufflevector <2 x float> %8, <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%19 = shufflevector <4 x float> %4, <4 x float> %18, <4 x i32> <i32 0, i32 4, i32 5, i32 undef>
%20 = shufflevector <4 x float> %19, <4 x float> %4, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
%21 = insertelement <4 x float> poison, float %17, i64 0
%22 = insertelement <4 x float> %21, float %15, i64 1
%23 = shufflevector <4 x float> %22, <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 1, i32 1>
%24 = fmul <4 x float> %20, %23
%25 = shufflevector <4 x float> %24, <4 x float> poison, <4 x i32> <i32 3, i32 1, i32 2, i32 0>
%26 = insertelement <4 x float> poison, float %16, i64 0
%27 = shufflevector <4 x float> %26, <4 x float> poison, <4 x i32> zeroinitializer
%28 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %27, <4 x float> %4, <4 x float> %25)
%29 = bitcast float* %0 to <4 x float>*
store <4 x float> %28, <4 x float>* %29
%30 = extractelement <4 x float> %4, i64 1
%31 = fmul float %30, %17
%32 = extractelement <2 x float> %8, i64 0
%33 = tail call float @llvm.fmuladd.f32(float %16, float %32, float %31)
store float %33, float* %5
%34 = extractelement <4 x float> %4, i64 2
%35 = fmul float %34, %17
%36 = extractelement <2 x float> %8, i64 1
%37 = tail call float @llvm.fmuladd.f32(float %16, float %36, float %35)
store float %37, float* %6
store float %10, float* %9
store float %12, float* %11
store float %14, float* %13
ret void
}