#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);
void compute_enu(double latitude, double longitude, double e[3], double n[3],
                 double u[3]) {
  const double lambda = longitude * 3.14159265358979323846 / 180.;
  const double phi = latitude * 3.14159265358979323846 / 180.;
  const double sl = sin(lambda);
  const double cl = cos(lambda);
  const double sp = sin(phi);
  const double cp = cos(phi);
  e[0] = -sl;
  e[1] = cl;
  e[2] = 0.;
  n[0] = -cl * sp;
  n[1] = -sl * sp;
  n[2] = cp;
  u[0] = cl * cp;
  u[1] = sl * cp;
  u[2] = sp;
}


x86 assembly (clang, -O0):
<compute_enu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movsd  0xec2(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xead(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xea4(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe8f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x58(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x50(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_enu>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movapd %xmm1,%xmm3
movsd  0xec2(%rip),%xmm2
mulsd  %xmm2,%xmm3
movsd  0xebe(%rip),%xmm1
divsd  %xmm1,%xmm3
movsd  %xmm3,0x10(%rsp)
mulsd  %xmm2,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movapd %xmm3,%xmm0
call   1030 <sin@plt>
movapd %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movdqa 0x20(%rsp),%xmm4
movdqa %xmm4,%xmm1
punpcklqdq 0x30(%rsp),%xmm1
movdqa 0xe5c(%rip),%xmm2
pxor   %xmm1,%xmm2
pshufd $0xee,%xmm2,%xmm3
movq   %xmm3,(%rbx)
movq   %xmm4,0x8(%rbx)
movq   $0x0,0x10(%rbx)
movapd 0x10(%rsp),%xmm4
movapd %xmm4,%xmm3
unpcklpd %xmm4,%xmm3
mulpd  %xmm2,%xmm3
movupd %xmm3,(%r15)
movsd  %xmm0,0x10(%r15)
unpcklpd %xmm0,%xmm0
mulpd  %xmm1,%xmm0
movupd %xmm0,(%r14)
movsd  %xmm4,0x10(%r14)
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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