void matrix_rotation_x(double cos_c, double sin_c, double R[][3]) {
  R[0][0] = 1;
  R[0][1] = 0;
  R[0][2] = 0;
  R[1][0] = 0;
  R[1][1] = cos_c;
  R[1][2] = -sin_c;
  R[2][0] = 0;
  R[2][1] = sin_c;
  R[2][2] = cos_c;
}


x86 assembly (clang, -O0):
<matrix_rotation_x>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xee2(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x28(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x30(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
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_x>:
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rdi)
xorps  %xmm2,%xmm2
movups %xmm2,0x8(%rdi)
movq   $0x0,0x18(%rdi)
movsd  %xmm0,0x20(%rdi)
movaps 0xed8(%rip),%xmm2
xorps  %xmm1,%xmm2
movlps %xmm2,0x28(%rdi)
movq   $0x0,0x30(%rdi)
movsd  %xmm1,0x38(%rdi)
movsd  %xmm0,0x40(%rdi)
ret

LLVM IR (-O0):
define void @matrix_rotation_x(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 [3 x double]*, [3 x double]** %6
%8 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0
%9 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
store double 1.000000e+00, double* %9
%10 = load [3 x double]*, [3 x double]** %6
%11 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0
%12 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
store double 0.000000e+00, double* %12
%13 = load [3 x double]*, [3 x double]** %6
%14 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0
%15 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 2
store double 0.000000e+00, double* %15
%16 = load [3 x double]*, [3 x double]** %6
%17 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 1
%18 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0, i64 0
store double 0.000000e+00, double* %18
%19 = load double, double* %4
%20 = load [3 x double]*, [3 x double]** %6
%21 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 1
%22 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 1
store double %19, double* %22
%23 = load double, double* %5
%24 = fneg double %23
%25 = load [3 x double]*, [3 x double]** %6
%26 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 1
%27 = getelementptr inbounds [3 x double], [3 x double]* %26, i64 0, i64 2
store double %24, double* %27
%28 = load [3 x double]*, [3 x double]** %6
%29 = getelementptr inbounds [3 x double], [3 x double]* %28, i64 2
%30 = getelementptr inbounds [3 x double], [3 x double]* %29, i64 0, i64 0
store double 0.000000e+00, double* %30
%31 = load double, double* %5
%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 %31, 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_x(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 1.000000e+00, double* %4
%5 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 1
%6 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 1, i64 1
%7 = bitcast double* %5 to i8*
store double %0, double* %6
%8 = fneg double %1
%9 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 1, i64 2
store double %8, double* %9
%10 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 2, i64 0
store double 0.000000e+00, double* %10
%11 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 2, i64 1
store double %1, double* %11
%12 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 2, i64 2
store double %0, double* %12
ret void
}