void matrix_rotation_y(double cos_b, double sin_b, double R[][3]) {
  R[0][0] = cos_b;
  R[0][1] = 0;
  R[0][2] = sin_b;
  R[1][0] = 0;
  R[1][1] = 1;
  R[1][2] = 0;
  R[2][0] = -sin_b;
  R[2][1] = 0;
  R[2][2] = cos_b;
}


x86 assembly (clang, -O0):
<matrix_rotation_y>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x18(%rbp),%rax
movsd  0xeaf(%rip),%xmm0
movsd  %xmm0,0x20(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x28(%rax)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x30(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x38(%rax)
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x40(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix_rotation_y>:
movsd  %xmm0,(%rdi)
movq   $0x0,0x8(%rdi)
xorps  %xmm2,%xmm2
movhps 0xeea(%rip),%xmm2
movsd  %xmm1,0x10(%rdi)
movups %xmm2,0x18(%rdi)
xorps  0xeea(%rip),%xmm1
movq   $0x0,0x28(%rdi)
movlps %xmm1,0x30(%rdi)
movq   $0x0,0x38(%rdi)
movsd  %xmm0,0x40(%rdi)
ret

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

LLVM IR (-O2):
define void @matrix_rotation_y(double %0, double %1, [3 x double]* nocapture writeonly %2) {
%4 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
store double %0, double* %4
%5 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 1
store double 0.000000e+00, double* %5
%6 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 2
store double %1, double* %6
%7 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 1, i64 0
%8 = bitcast double* %7 to <2 x double>*
store <2 x double> <double 0.000000e+00, double 1.000000e+00>, <2 x double>* %8
%9 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 1, i64 2
store double 0.000000e+00, double* %9
%10 = fneg double %1
%11 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 2, i64 0
store double %10, double* %11
%12 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 2, i64 1
store double 0.000000e+00, double* %12
%13 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 2, i64 2
store double %0, double* %13
ret void
}