#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 */
int /*<<< orphan*/ ecef2ned_matrix(double const *, double **);
int /*<<< orphan*/ matrix_multiply(int, int, int, double *, double const *,
                                   double *);
int /*<<< orphan*/ matrix_transpose(int, int, double *, double *);
void wgsned2ecef(const double ned[3], const double ref_ecef[3],
                 double ecef[3]) {
  double M[3][3], M_transpose[3][3];
  ecef2ned_matrix(ref_ecef, M);
  matrix_transpose(3, 3, (double *)M, (double *)M_transpose);
  matrix_multiply(3, 3, 1, (double *)M_transpose, ned, ecef);
}


x86 assembly (clang, -O0):
<wgsned2ecef>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1050 <ecef2ned_matrix@plt>
lea    -0x60(%rbp),%rdx
lea    -0xb0(%rbp),%rcx
mov    $0x3,%esi
mov    %esi,%edi
call   1040 <matrix_transpose@plt>
lea    -0xb0(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    -0x18(%rbp),%r9
mov    $0x3,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1030 <matrix_multiply@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wgsned2ecef>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rdx,%r14
mov    %rdi,%r15
lea    0x50(%rsp),%rbx
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1050 <ecef2ned_matrix@plt>
mov    %rsp,%r12
mov    $0x3,%edi
mov    $0x3,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
call   1040 <matrix_transpose@plt>
mov    $0x3,%edi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r12,%rcx
mov    %r15,%r8
mov    %r14,%r9
call   1030 <matrix_multiply@plt>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @wgsned2ecef(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca [3 x [3 x double]]
%8 = alloca [3 x [3 x double]]
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%9 = load double*, double** %5
%10 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 0
%11 = bitcast [3 x double]* %10 to double**
%12 = call i32 @ecef2ned_matrix(double* %9, double** %11)
%13 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %7, i64 0, i64 0
%14 = bitcast [3 x double]* %13 to double*
%15 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 0
%16 = bitcast [3 x double]* %15 to double*
%17 = call i32 @matrix_transpose(i32 3, i32 3, double* %14, double* %16)
%18 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %8, i64 0, i64 0
%19 = bitcast [3 x double]* %18 to double*
%20 = load double*, double** %4
%21 = load double*, double** %6
%22 = call i32 @matrix_multiply(i32 3, i32 3, i32 1, double* %19, double* %20, double* %21)
ret void
}

LLVM IR (-O2):
define void @wgsned2ecef(double* %0, double* %1, double* %2) {
%4 = alloca [3 x [3 x double]]
%5 = alloca [3 x [3 x double]]
%6 = bitcast [3 x [3 x double]]* %4 to i8*
%7 = bitcast [3 x [3 x double]]* %5 to i8*
%8 = bitcast [3 x [3 x double]]* %4 to double**
%9 = call i32 @ecef2ned_matrix(double* %1, double** %8)
%10 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 0, i64 0
%11 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %5, i64 0, i64 0, i64 0
%12 = call i32 @matrix_transpose(i32 3, i32 3, double* %10, double* %11)
%13 = call i32 @matrix_multiply(i32 3, i32 3, i32 1, double* %11, double* %0, double* %2)
ret void
}