#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 const);
double sin(double const);
extern void xyz2enu(const double *pos, double *E) {
  double sinp = sin(pos[0]), cosp = cos(pos[0]), sinl = sin(pos[1]),
         cosl = cos(pos[1]);
  E[0] = -sinl;
  E[3] = cosl;
  E[6] = 0.0;
  E[1] = -sinp * cosl;
  E[4] = -sinp * sinl;
  E[7] = cosp;
  E[2] = cosp * cosl;
  E[5] = cosp * sinl;
  E[8] = sinp;
}


x86 assembly (clang, -O0):
<xyz2enu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x30(%rax)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x38(%rax)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x40(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xyz2enu>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x20(%rsp)
movsd  (%rbx),%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x10(%rsp)
movsd  0x8(%rbx),%xmm0
call   1030 <sin@plt>
movaps %xmm0,(%rsp)
movsd  0x8(%rbx),%xmm0
call   1040 <cos@plt>
movapd 0xe97(%rip),%xmm1
movapd (%rsp),%xmm4
movapd %xmm4,%xmm2
xorpd  %xmm1,%xmm2
movlpd %xmm2,(%r14)
movsd  %xmm0,0x18(%r14)
movq   $0x0,0x30(%r14)
movapd 0x20(%rsp),%xmm2
xorpd  %xmm2,%xmm1
movapd 0x10(%rsp),%xmm3
movsd  %xmm3,0x38(%r14)
unpcklpd %xmm0,%xmm0
unpcklpd %xmm3,%xmm1
mulpd  %xmm1,%xmm0
movupd %xmm0,0x8(%r14)
movapd %xmm4,%xmm0
unpcklpd %xmm4,%xmm0
mulpd  %xmm1,%xmm0
movupd %xmm0,0x20(%r14)
movsd  %xmm2,0x40(%r14)
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @xyz2enu(double* nocapture %0, double* nocapture writeonly %1) {
%3 = load double, double* %0
%4 = tail call double @sin(double %3)
%5 = load double, double* %0
%6 = tail call double @cos(double %5)
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = tail call double @sin(double %8)
%10 = load double, double* %7
%11 = tail call double @cos(double %10)
%12 = fneg double %9
store double %12, double* %1
%13 = getelementptr inbounds double, double* %1, i64 3
store double %11, double* %13
%14 = getelementptr inbounds double, double* %1, i64 6
store double 0.000000e+00, double* %14
%15 = fneg double %4
%16 = getelementptr inbounds double, double* %1, i64 1
%17 = getelementptr inbounds double, double* %1, i64 4
%18 = getelementptr inbounds double, double* %1, i64 7
store double %6, double* %18
%19 = insertelement <2 x double> poison, double %11, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = insertelement <2 x double> poison, double %15, i64 0
%22 = insertelement <2 x double> %21, double %6, i64 1
%23 = fmul <2 x double> %20, %22
%24 = bitcast double* %16 to <2 x double>*
store <2 x double> %23, <2 x double>* %24
%25 = insertelement <2 x double> poison, double %9, i64 0
%26 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> zeroinitializer
%27 = fmul <2 x double> %26, %22
%28 = bitcast double* %17 to <2 x double>*
store <2 x double> %27, <2 x double>* %28
%29 = getelementptr inbounds double, double* %1, i64 8
store double %4, double* %29
ret void
}