#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 enubasis(double lat, double lon, double enumat[3][3]) {
  double slt, clt, clo, slo;
  clt = cos(lat);
  slt = sin(lat);
  clo = cos(lon);
  slo = sin(lon);
  enumat[1][0] = -slt * clo;
  enumat[1][1] = -slt * slo;
  enumat[1][2] = clt;
  enumat[0][0] = -slo;
  enumat[0][1] = clo;
  enumat[0][2] = 0.0;
  enumat[2][0] = clt * clo;
  enumat[2][1] = clt * slo;
  enumat[2][2] = slt;
}


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

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

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

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