#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 */
float cos(float);
float sin(float);
void angtomat(float *r, float ta, float pa, float sa) {
  r[0] = sin(pa) * sin(sa) * sin(ta) + cos(sa) * cos(ta);
  r[1] = sin(pa) * sin(sa) * cos(ta) - cos(sa) * sin(ta);
  r[2] = cos(pa) * sin(sa);
  r[3] = cos(pa) * sin(ta);
  r[4] = cos(pa) * cos(ta);
  r[5] = -sin(pa);
  r[6] = sin(pa) * cos(sa) * sin(ta) - sin(sa) * cos(ta);
  r[7] = sin(pa) * cos(sa) * cos(ta) + sin(sa) * sin(ta);
  r[8] = cos(pa) * cos(sa);
}


x86 assembly (clang, -O0):
<angtomat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x64(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x64(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x58(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x5c(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x60(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cos@plt>
movss  -0x60(%rbp),%xmm1
movss  -0x5c(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x58(%rbp),%xmm0
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x54(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x54(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x4c(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x50(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movss  -0x50(%rbp),%xmm1
movss  -0x4c(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x48(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x44(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x44(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
movss  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x40(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x40(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
movss  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x3c(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x3c(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x10(%rax)
movss  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x14(%rax)
movss  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x38(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x38(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x30(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cos@plt>
movss  -0x34(%rbp),%xmm1
movss  -0x30(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x2c(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x18(%rax)
movss  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movss  -0x24(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x1c(%rbp),%xmm0
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x1c(%rax)
movss  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x20(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<angtomat>:
push   %rbx
sub    $0x20,%rsp
movss  %xmm2,0x10(%rsp)
movss  %xmm1,0x14(%rsp)
movss  %xmm0,0xc(%rsp)
mov    %rdi,%rbx
movaps %xmm1,%xmm0
call   1030 <sin@plt>
movss  %xmm0,0x8(%rsp)
movss  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,0x1c(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0x18(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <cos@plt>
mulss  0x18(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
mulss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,(%rbx)
movss  0x14(%rsp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,0x8(%rsp)
movss  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0x1c(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0x18(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x18(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
mulss  0x8(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x4(%rbx)
movss  0x14(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0x8(%rsp)
movss  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x8(%rbx)
movss  0x14(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0xc(%rbx)
movss  0x14(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <cos@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x10(%rbx)
movss  0x14(%rsp),%xmm0
call   1030 <sin@plt>
xorps  0xd63(%rip),%xmm0
movss  %xmm0,0x14(%rbx)
movss  0x14(%rsp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,0x8(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,0x1c(%rsp)
movss  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,0x18(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <cos@plt>
mulss  0x18(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
mulss  0x8(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x18(%rbx)
movss  0x14(%rsp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,0x8(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0x1c(%rsp)
movss  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,0x18(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x18(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
mulss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x1c(%rbx)
movss  0x14(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,0xc(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulss  0xc(%rsp),%xmm0
movss  %xmm0,0x20(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @angtomat(float* %0, float %1, float %2, float %3) {
%5 = alloca float*
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float* %0, float** %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %7
%10 = call float @sin(float %9)
%11 = load float, float* %8
%12 = call float @sin(float %11)
%13 = fmul float %10, %12
%14 = load float, float* %6
%15 = call float @sin(float %14)
%16 = load float, float* %8
%17 = call float @cos(float %16)
%18 = load float, float* %6
%19 = call float @cos(float %18)
%20 = fmul float %17, %19
%21 = call float @llvm.fmuladd.f32(float %13, float %15, float %20)
%22 = load float*, float** %5
%23 = getelementptr inbounds float, float* %22, i64 0
store float %21, float* %23
%24 = load float, float* %7
%25 = call float @sin(float %24)
%26 = load float, float* %8
%27 = call float @sin(float %26)
%28 = fmul float %25, %27
%29 = load float, float* %6
%30 = call float @cos(float %29)
%31 = load float, float* %8
%32 = call float @cos(float %31)
%33 = load float, float* %6
%34 = call float @sin(float %33)
%35 = fmul float %32, %34
%36 = fneg float %35
%37 = call float @llvm.fmuladd.f32(float %28, float %30, float %36)
%38 = load float*, float** %5
%39 = getelementptr inbounds float, float* %38, i64 1
store float %37, float* %39
%40 = load float, float* %7
%41 = call float @cos(float %40)
%42 = load float, float* %8
%43 = call float @sin(float %42)
%44 = fmul float %41, %43
%45 = load float*, float** %5
%46 = getelementptr inbounds float, float* %45, i64 2
store float %44, float* %46
%47 = load float, float* %7
%48 = call float @cos(float %47)
%49 = load float, float* %6
%50 = call float @sin(float %49)
%51 = fmul float %48, %50
%52 = load float*, float** %5
%53 = getelementptr inbounds float, float* %52, i64 3
store float %51, float* %53
%54 = load float, float* %7
%55 = call float @cos(float %54)
%56 = load float, float* %6
%57 = call float @cos(float %56)
%58 = fmul float %55, %57
%59 = load float*, float** %5
%60 = getelementptr inbounds float, float* %59, i64 4
store float %58, float* %60
%61 = load float, float* %7
%62 = call float @sin(float %61)
%63 = fneg float %62
%64 = load float*, float** %5
%65 = getelementptr inbounds float, float* %64, i64 5
store float %63, float* %65
%66 = load float, float* %7
%67 = call float @sin(float %66)
%68 = load float, float* %8
%69 = call float @cos(float %68)
%70 = fmul float %67, %69
%71 = load float, float* %6
%72 = call float @sin(float %71)
%73 = load float, float* %8
%74 = call float @sin(float %73)
%75 = load float, float* %6
%76 = call float @cos(float %75)
%77 = fmul float %74, %76
%78 = fneg float %77
%79 = call float @llvm.fmuladd.f32(float %70, float %72, float %78)
%80 = load float*, float** %5
%81 = getelementptr inbounds float, float* %80, i64 6
store float %79, float* %81
%82 = load float, float* %7
%83 = call float @sin(float %82)
%84 = load float, float* %8
%85 = call float @cos(float %84)
%86 = fmul float %83, %85
%87 = load float, float* %6
%88 = call float @cos(float %87)
%89 = load float, float* %8
%90 = call float @sin(float %89)
%91 = load float, float* %6
%92 = call float @sin(float %91)
%93 = fmul float %90, %92
%94 = call float @llvm.fmuladd.f32(float %86, float %88, float %93)
%95 = load float*, float** %5
%96 = getelementptr inbounds float, float* %95, i64 7
store float %94, float* %96
%97 = load float, float* %7
%98 = call float @cos(float %97)
%99 = load float, float* %8
%100 = call float @cos(float %99)
%101 = fmul float %98, %100
%102 = load float*, float** %5
%103 = getelementptr inbounds float, float* %102, i64 8
store float %101, float* %103
ret void
}

LLVM IR (-O2):
define void @angtomat(float* nocapture writeonly %0, float %1, float %2, float %3) {
%5 = tail call float @sin(float %2)
%6 = tail call float @sin(float %3)
%7 = fmul float %5, %6
%8 = tail call float @sin(float %1)
%9 = tail call float @cos(float %3)
%10 = tail call float @cos(float %1)
%11 = fmul float %9, %10
%12 = tail call float @llvm.fmuladd.f32(float %7, float %8, float %11)
store float %12, float* %0
%13 = tail call float @sin(float %2)
%14 = tail call float @sin(float %3)
%15 = fmul float %13, %14
%16 = tail call float @cos(float %1)
%17 = tail call float @cos(float %3)
%18 = tail call float @sin(float %1)
%19 = fneg float %17
%20 = fmul float %18, %19
%21 = tail call float @llvm.fmuladd.f32(float %15, float %16, float %20)
%22 = getelementptr inbounds float, float* %0, i64 1
store float %21, float* %22
%23 = tail call float @cos(float %2)
%24 = tail call float @sin(float %3)
%25 = fmul float %23, %24
%26 = getelementptr inbounds float, float* %0, i64 2
store float %25, float* %26
%27 = tail call float @cos(float %2)
%28 = tail call float @sin(float %1)
%29 = fmul float %27, %28
%30 = getelementptr inbounds float, float* %0, i64 3
store float %29, float* %30
%31 = tail call float @cos(float %2)
%32 = tail call float @cos(float %1)
%33 = fmul float %31, %32
%34 = getelementptr inbounds float, float* %0, i64 4
store float %33, float* %34
%35 = tail call float @sin(float %2)
%36 = fneg float %35
%37 = getelementptr inbounds float, float* %0, i64 5
store float %36, float* %37
%38 = tail call float @sin(float %2)
%39 = tail call float @cos(float %3)
%40 = fmul float %38, %39
%41 = tail call float @sin(float %1)
%42 = tail call float @sin(float %3)
%43 = tail call float @cos(float %1)
%44 = fneg float %42
%45 = fmul float %43, %44
%46 = tail call float @llvm.fmuladd.f32(float %40, float %41, float %45)
%47 = getelementptr inbounds float, float* %0, i64 6
store float %46, float* %47
%48 = tail call float @sin(float %2)
%49 = tail call float @cos(float %3)
%50 = fmul float %48, %49
%51 = tail call float @cos(float %1)
%52 = tail call float @sin(float %3)
%53 = tail call float @sin(float %1)
%54 = fmul float %52, %53
%55 = tail call float @llvm.fmuladd.f32(float %50, float %51, float %54)
%56 = getelementptr inbounds float, float* %0, i64 7
store float %55, float* %56
%57 = tail call float @cos(float %2)
%58 = tail call float @cos(float %3)
%59 = fmul float %57, %58
%60 = getelementptr inbounds float, float* %0, i64 8
store float %59, float* %60
ret void
}