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


x86 assembly (clang, -O0):
<genZRotMatrix>:
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)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
subsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x28(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x30(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x38(%rax)
mov    -0x10(%rbp),%rax
movsd  0xe48(%rip),%xmm0
movsd  %xmm0,0x40(%rax)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @genZRotMatrix(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 double, double* %3
%11 = call double @sin(double %10)
%12 = load [3 x double]*, [3 x double]** %4
%13 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0
%14 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0, i64 1
store double %11, double* %14
%15 = load [3 x double]*, [3 x double]** %4
%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 0.000000e+00, double* %17
%18 = load [3 x double]*, [3 x double]** %4
%19 = getelementptr inbounds [3 x double], [3 x double]* %18, i64 0
%20 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 1
%21 = load double, double* %20
%22 = fsub double 0.000000e+00, %21
%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 0
store double %22, double* %25
%26 = load [3 x double]*, [3 x double]** %4
%27 = getelementptr inbounds [3 x double], [3 x double]* %26, i64 0
%28 = getelementptr inbounds [3 x double], [3 x double]* %27, i64 0, i64 0
%29 = load double, double* %28
%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 1
store double %29, double* %32
%33 = load [3 x double]*, [3 x double]** %4
%34 = getelementptr inbounds [3 x double], [3 x double]* %33, i64 1
%35 = getelementptr inbounds [3 x double], [3 x double]* %34, i64 0, i64 2
store double 0.000000e+00, double* %35
%36 = load [3 x double]*, [3 x double]** %4
%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 0
store double 0.000000e+00, double* %38
%39 = load [3 x double]*, [3 x double]** %4
%40 = getelementptr inbounds [3 x double], [3 x double]* %39, i64 2
%41 = getelementptr inbounds [3 x double], [3 x double]* %40, i64 0, i64 1
store double 0.000000e+00, double* %41
%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 1.000000e+00, double* %44
ret void
}

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