#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 genXRotMatrix(double theta, double m[3][3]) {
  m[0][0] = 1.0;
  m[0][1] = 0.;
  m[0][2] = 0.;
  m[1][0] = 0.;
  m[1][1] = cos(theta);
  m[1][2] = sin(theta);
  m[2][0] = 0.;
  m[2][1] = 0. - m[1][2];
  m[2][2] = m[1][1];
}


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

x86 assembly (clang, -O2):
<genXRotMatrix>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rdi)
xorpd  %xmm1,%xmm1
movupd %xmm1,0x8(%rdi)
movq   $0x0,0x18(%rdi)
call   1040 <cos@plt>
movsd  %xmm0,0x20(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x28(%rbx)
movq   $0x0,0x30(%rbx)
xorpd  %xmm1,%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x38(%rbx)
movsd  0x20(%rbx),%xmm0
movsd  %xmm0,0x40(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @genXRotMatrix(double %0, [3 x double]* %1) {
%3 = alloca double
%4 = alloca [3 x double]*
store double %0, double* %3
store [3 x double]* %1, [3 x double]** %4
%5 = load [3 x double]*, [3 x double]** %4
%6 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0
%7 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
store double 1.000000e+00, double* %7
%8 = load [3 x double]*, [3 x double]** %4
%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 1
store double 0.000000e+00, double* %10
%11 = load [3 x double]*, [3 x double]** %4
%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 2
store double 0.000000e+00, double* %13
%14 = load [3 x double]*, [3 x double]** %4
%15 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 1
%16 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 0
store double 0.000000e+00, double* %16
%17 = load double, double* %3
%18 = call double @cos(double %17)
%19 = load [3 x double]*, [3 x double]** %4
%20 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 1
%21 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 1
store double %18, double* %21
%22 = load double, double* %3
%23 = call double @sin(double %22)
%24 = load [3 x double]*, [3 x double]** %4
%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 %23, double* %26
%27 = load [3 x double]*, [3 x double]** %4
%28 = getelementptr inbounds [3 x double], [3 x double]* %27, i64 2
%29 = getelementptr inbounds [3 x double], [3 x double]* %28, i64 0, i64 0
store double 0.000000e+00, double* %29
%30 = load [3 x double]*, [3 x double]** %4
%31 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 1
%32 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 0, i64 2
%33 = load double, double* %32
%34 = fsub double 0.000000e+00, %33
%35 = load [3 x double]*, [3 x double]** %4
%36 = getelementptr inbounds [3 x double], [3 x double]* %35, i64 2
%37 = getelementptr inbounds [3 x double], [3 x double]* %36, i64 0, i64 1
store double %34, double* %37
%38 = load [3 x double]*, [3 x double]** %4
%39 = getelementptr inbounds [3 x double], [3 x double]* %38, i64 1
%40 = getelementptr inbounds [3 x double], [3 x double]* %39, i64 0, i64 1
%41 = load double, double* %40
%42 = load [3 x double]*, [3 x double]** %4
%43 = getelementptr inbounds [3 x double], [3 x double]* %42, i64 2
%44 = getelementptr inbounds [3 x double], [3 x double]* %43, i64 0, i64 2
store double %41, double* %44
ret void
}

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