xrotatemat(mat, rs, rc) float mat[4][4];
float rs, rc;
{
  float mmat[4][4];
  mmat[0][0] = 1.0;
  mmat[0][1] = 0.0;
  mmat[0][2] = 0.0;
  mmat[0][3] = 0.0;
  mmat[1][0] = 0.0;
  mmat[1][1] = rc;
  mmat[1][2] = rs;
  mmat[1][3] = 0.0;
  mmat[2][0] = 0.0;
  mmat[2][1] = -rs;
  mmat[2][2] = rc;
  mmat[2][3] = 0.0;
  mmat[3][0] = 0.0;
  mmat[3][1] = 0.0;
  mmat[3][2] = 0.0;
  mmat[3][3] = 1.0;
  matrixmult(mmat, mat, mat);
}


x86 assembly (clang, -O0):
<xrotatemat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm1,-0x68(%rbp)
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
mov    %rdi,-0x10(%rbp)
movss  %xmm1,-0x14(%rbp)
movss  %xmm0,-0x18(%rbp)
movss  0xebd(%rip),%xmm0
movss  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x5c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x54(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  0xe2b(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1030 <matrixmult@plt>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrotatemat>:
sub    $0x48,%rsp
mov    %rdi,%rdx
cvtsd2ss %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm1
movl   $0x3f800000,(%rsp)
xorps  %xmm2,%xmm2
movups %xmm2,0x4(%rsp)
movss  %xmm1,0x14(%rsp)
movss  %xmm0,0x18(%rsp)
movq   $0x0,0x1c(%rsp)
xorps  0xeb6(%rip),%xmm0
movss  %xmm0,0x24(%rsp)
movss  %xmm1,0x28(%rsp)
movups %xmm2,0x2c(%rsp)
movl   $0x3f800000,0x3c(%rsp)
3f
mov    %rsp,%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1030 <matrixmult@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
define i32 @xrotatemat([4 x float]* %0, double %1, double %2) {
%4 = alloca i32
%5 = alloca [4 x float]*
%6 = alloca float
%7 = alloca float
%8 = alloca [4 x [4 x float]]
%9 = fptrunc double %1 to float
%10 = fptrunc double %2 to float
store [4 x float]* %0, [4 x float]** %5
store float %9, float* %6
store float %10, float* %7
%11 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 0
%12 = getelementptr inbounds [4 x float], [4 x float]* %11, i64 0, i64 0
store float 1.000000e+00, float* %12
%13 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 0
%14 = getelementptr inbounds [4 x float], [4 x float]* %13, i64 0, i64 1
store float 0.000000e+00, float* %14
%15 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 0
%16 = getelementptr inbounds [4 x float], [4 x float]* %15, i64 0, i64 2
store float 0.000000e+00, float* %16
%17 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 0
%18 = getelementptr inbounds [4 x float], [4 x float]* %17, i64 0, i64 3
store float 0.000000e+00, float* %18
%19 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 1
%20 = getelementptr inbounds [4 x float], [4 x float]* %19, i64 0, i64 0
store float 0.000000e+00, float* %20
%21 = load float, float* %7
%22 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 1
%23 = getelementptr inbounds [4 x float], [4 x float]* %22, i64 0, i64 1
store float %21, float* %23
%24 = load float, float* %6
%25 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 1
%26 = getelementptr inbounds [4 x float], [4 x float]* %25, i64 0, i64 2
store float %24, float* %26
%27 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 1
%28 = getelementptr inbounds [4 x float], [4 x float]* %27, i64 0, i64 3
store float 0.000000e+00, float* %28
%29 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 2
%30 = getelementptr inbounds [4 x float], [4 x float]* %29, i64 0, i64 0
store float 0.000000e+00, float* %30
%31 = load float, float* %6
%32 = fneg float %31
%33 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 2
%34 = getelementptr inbounds [4 x float], [4 x float]* %33, i64 0, i64 1
store float %32, float* %34
%35 = load float, float* %7
%36 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 2
%37 = getelementptr inbounds [4 x float], [4 x float]* %36, i64 0, i64 2
store float %35, float* %37
%38 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 2
%39 = getelementptr inbounds [4 x float], [4 x float]* %38, i64 0, i64 3
store float 0.000000e+00, float* %39
%40 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 3
%41 = getelementptr inbounds [4 x float], [4 x float]* %40, i64 0, i64 0
store float 0.000000e+00, float* %41
%42 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 3
%43 = getelementptr inbounds [4 x float], [4 x float]* %42, i64 0, i64 1
store float 0.000000e+00, float* %43
%44 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 3
%45 = getelementptr inbounds [4 x float], [4 x float]* %44, i64 0, i64 2
store float 0.000000e+00, float* %45
%46 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 3
%47 = getelementptr inbounds [4 x float], [4 x float]* %46, i64 0, i64 3
store float 1.000000e+00, float* %47
%48 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %8, i64 0, i64 0
%49 = load [4 x float]*, [4 x float]** %5
%50 = load [4 x float]*, [4 x float]** %5
%51 = call i32 ([4 x float]*, [4 x float]*, [4 x float]*, ...) bitcast (i32 (...)* @matrixmult to i32 ([4 x float]*, [4 x float]*, [4 x float]*, ...)*)([4 x float]* %48, [4 x float]* %49, [4 x float]* %50)
%52 = load i32, i32* %4
ret i32 %52
}

LLVM IR (-O2):
define i32 @xrotatemat([4 x float]* %0, double %1, double %2) {
%4 = alloca [4 x [4 x float]]
%5 = fptrunc double %1 to float
%6 = fptrunc double %2 to float
%7 = bitcast [4 x [4 x float]]* %4 to i8*
%8 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %4, i64 0, i64 0
%9 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %4, i64 0, i64 0, i64 0
store float 1.000000e+00, float* %9
%10 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %4, i64 0, i64 0, i64 1
%11 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %4, i64 0, i64 1, i64 1
%12 = bitcast float* %10 to i8*
store float %6, float* %11
%13 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %4, i64 0, i64 1, i64 2
store float %5, float* %13
%14 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %4, i64 0, i64 1, i64 3
store float 0.000000e+00, float* %14
%15 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %4, i64 0, i64 2, i64 0
store float 0.000000e+00, float* %15
%16 = fneg float %5
%17 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %4, i64 0, i64 2, i64 1
store float %16, float* %17
%18 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %4, i64 0, i64 2, i64 2
store float %6, float* %18
%19 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %4, i64 0, i64 2, i64 3
%20 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %4, i64 0, i64 3, i64 3
%21 = bitcast float* %19 to i8*
store float 1.000000e+00, float* %20
%22 = call i32 ([4 x float]*, [4 x float]*, [4 x float]*, ...) bitcast (i32 (...)* @matrixmult to i32 ([4 x float]*, [4 x float]*, [4 x float]*, ...)*)([4 x float]* %8, [4 x float]* %0, [4 x float]* %0)
ret i32 undef
}