#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);
int GenerateCEN(double dCEN[3][3], double dLongitude, double dLatitude) {
  double cLong, cLat, sLong, sLat;
  cLong = cos(dLongitude);
  cLat = cos(dLatitude);
  sLong = sin(dLongitude);
  sLat = sin(dLatitude);
  dCEN[0][0] = -cLong * sLat;
  dCEN[0][1] = -sLong * sLat;
  dCEN[0][2] = cLat;
  dCEN[1][0] = -sLong;
  dCEN[1][1] = cLong;
  dCEN[1][2] = 0.0;
  dCEN[2][0] = -cLong * cLat;
  dCEN[2][1] = -sLong * cLat;
  dCEN[2][2] = -sLat;
  return 0;
}


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

x86 assembly (clang, -O2):
<GenerateCEN>:
push   %rbx
sub    $0x40,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %rdi,%rbx
call   1040 <cos@plt>
movaps %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
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   1030 <sin@plt>
movapd 0x20(%rsp),%xmm5
movapd %xmm5,%xmm1
unpcklpd 0x10(%rsp),%xmm1
movapd 0xe7f(%rip),%xmm2
xorpd  %xmm2,%xmm1
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm1,%xmm3
movupd %xmm3,(%rbx)
movapd 0x30(%rsp),%xmm4
movsd  %xmm4,0x10(%rbx)
pshufd $0xee,%xmm1,%xmm3
movq   %xmm3,0x18(%rbx)
movsd  %xmm5,0x20(%rbx)
movq   $0x0,0x28(%rbx)
unpcklpd %xmm4,%xmm4
mulpd  %xmm1,%xmm4
movupd %xmm4,0x30(%rbx)
xorpd  %xmm2,%xmm0
movlpd %xmm0,0x40(%rbx)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

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

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