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


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

x86 assembly (clang, -O2):
<genYRotMatrix>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
movsd  %xmm0,(%rbx)
movq   $0x0,0x8(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
subsd  %xmm0,%xmm2
xorpd  %xmm0,%xmm0
movhpd 0xe97(%rip),%xmm0
movsd  %xmm2,0x10(%rbx)
movupd %xmm0,0x18(%rbx)
movq   $0x0,0x28(%rbx)
subsd  %xmm2,%xmm1
movsd  %xmm1,0x30(%rbx)
movq   $0x0,0x38(%rbx)
movsd  (%rbx),%xmm0
movsd  %xmm0,0x40(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

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

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