void paxis(theta, phi, vector) double theta, phi, vector[2][4];
{
  double rad;
  rad = atan(1.0) / 45.0;
  theta = theta * rad;
  phi = phi * rad;
  vector[1][1] = cos(theta) * sin(phi);
  vector[1][2] = cos(theta) * cos(phi);
  vector[1][3] = -sin(theta);
}


x86 assembly (clang, -O0):
<paxis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movsd  0xeba(%rip),%xmm0
call   1040 <atan@plt>
movsd  0xea5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  -0x8(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x38(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<paxis>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
movsd  0xeb4(%rip),%xmm0
call   1040 <atan@plt>
movsd  0xeaf(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
call   1050 <cos@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x28(%rbx)
movsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x30(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
xorps  0xe3d(%rip),%xmm0
movlps %xmm0,0x38(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @paxis(double %0, double %1, [4 x double]* nocapture writeonly %2) {
%4 = tail call double @atan(double 1.000000e+00)
%5 = fmul double %0, 0x3F91DF46A2529D39
%6 = fmul double %1, 0x3F91DF46A2529D39
%7 = tail call double @cos(double %5)
%8 = tail call double @sin(double %6)
%9 = fmul double %7, %8
%10 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 1, i64 1
store double %9, double* %10
%11 = tail call double @cos(double %5)
%12 = tail call double @cos(double %6)
%13 = fmul double %11, %12
%14 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 1, i64 2
store double %13, double* %14
%15 = tail call double @sin(double %5)
%16 = fneg double %15
%17 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 1, i64 3
store double %16, double* %17
ret void
}