#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 atan2(double, double);
double cos(double);
double sin(double);
double sqrt(double);
void ecitoecef(double gha, double x, double y, double z, double x_vel,
               double y_vel, double z_vel, double *output_X_pos,
               double *output_Y_pos, double *output_Z_pos, double *output_X_vel,
               double *output_Y_vel, double *output_Z_vel) {
  double angularVelocity, ghaRads, phi, phiVel, radius;
  angularVelocity =
      (366.225 / 365.225) * 2.0 * 3.14159265358979323846 / 86400.0;
  ghaRads = gha * 3.14159265358979323846 / 180.0;
  radius = sqrt(x * x + y * y);
  phi = atan2(y, x);
  phi -= ghaRads;
  *output_X_pos = cos(phi) * radius;
  *output_Y_pos = sin(phi) * radius;
  *output_Z_pos = z;
  radius = sqrt(x_vel * x_vel + y_vel * y_vel);
  phiVel = atan2(y_vel, x_vel);
  phiVel -= ghaRads;
  *output_X_vel = cos(phiVel) * radius + angularVelocity * (*output_Y_pos);
  *output_Y_vel = sin(phiVel) * radius - angularVelocity * (*output_X_pos);
  *output_Z_vel = z_vel;
}


x86 assembly (clang, -O0):
<ecitoecef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
mov    %rdi,-0x40(%rbp)
mov    %rsi,-0x48(%rbp)
mov    %rdx,-0x50(%rbp)
mov    %rcx,-0x58(%rbp)
mov    %r8,-0x60(%rbp)
mov    %r9,-0x68(%rbp)
movsd  0xe82(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xe6d(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe58(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <atan2@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
call   1050 <cos@plt>
mulsd  -0x90(%rbp),%xmm0
ff
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm0
call   1040 <sin@plt>
mulsd  -0x90(%rbp),%xmm0
ff
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1030 <atan2@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x78(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1050 <cos@plt>
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x70(%rbp),%xmm1
mov    -0x48(%rbp),%rax
mulsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x58(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x88(%rbp),%xmm0
ff
call   1040 <sin@plt>
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x70(%rbp),%xmm1
mov    -0x40(%rbp),%rax
mulsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x60(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x68(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ecitoecef>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %rdi,%r13
movsd  %xmm6,0x40(%rsp)
movsd  %xmm5,0x20(%rsp)
movsd  %xmm4,0x28(%rsp)
movsd  %xmm3,0x38(%rsp)
movapd %xmm2,%xmm3
mulsd  0xe7c(%rip),%xmm0
divsd  0xe7c(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm2,%xmm2
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jb     11b2 <ecitoecef+0x72>
sqrtsd %xmm0,%xmm0
jmp    11cf <ecitoecef+0x8f>
movsd  %xmm1,0x18(%rsp)
movsd  %xmm3,0x30(%rsp)
call   1060 <sqrt@plt>
movsd  0x30(%rsp),%xmm3
movsd  0x18(%rsp),%xmm1
movsd  %xmm0,0x8(%rsp)
movapd %xmm3,%xmm0
call   1030 <atan2@plt>
subsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
call   1050 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x0(%r13)
movsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x38(%rsp),%xmm0
movsd  %xmm0,0x0(%rbp)
movsd  0x20(%rsp),%xmm1
mulsd  %xmm1,%xmm1
movsd  0x28(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xde5(%rip),%xmm0
jb     1243 <ecitoecef+0x103>
sqrtsd %xmm0,%xmm0
jmp    1248 <ecitoecef+0x108>
call   1060 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
call   1030 <atan2@plt>
subsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1050 <cos@plt>
movsd  (%rbx),%xmm1
mulsd  0xd94(%rip),%xmm1
mulsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r12)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
movsd  0x0(%r13),%xmm1
mulsd  0xd73(%rip),%xmm1
mulsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
movsd  0x40(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ecitoecef(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double* %7, double* %8, double* %9, double* %10, double* %11, double* %12) {
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
%24 = alloca double*
%25 = alloca double*
%26 = alloca double*
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
store double %0, double* %14
store double %1, double* %15
store double %2, double* %16
store double %3, double* %17
store double %4, double* %18
store double %5, double* %19
store double %6, double* %20
store double* %7, double** %21
store double* %8, double** %22
store double* %9, double** %23
store double* %10, double** %24
store double* %11, double** %25
store double* %12, double** %26
store double 0x3F131DA8202B475A, double* %27
%32 = load double, double* %14
%33 = fmul double %32, 0x400921FB54442D18
%34 = fdiv double %33, 1.800000e+02
store double %34, double* %28
%35 = load double, double* %15
%36 = load double, double* %15
%37 = load double, double* %16
%38 = load double, double* %16
%39 = fmul double %37, %38
%40 = call double @llvm.fmuladd.f64(double %35, double %36, double %39)
%41 = call double @sqrt(double %40)
store double %41, double* %31
%42 = load double, double* %16
%43 = load double, double* %15
%44 = call double @atan2(double %42, double %43)
store double %44, double* %29
%45 = load double, double* %28
%46 = load double, double* %29
%47 = fsub double %46, %45
store double %47, double* %29
%48 = load double, double* %29
%49 = call double @cos(double %48)
%50 = load double, double* %31
%51 = fmul double %49, %50
%52 = load double*, double** %21
store double %51, double* %52
%53 = load double, double* %29
%54 = call double @sin(double %53)
%55 = load double, double* %31
%56 = fmul double %54, %55
%57 = load double*, double** %22
store double %56, double* %57
%58 = load double, double* %17
%59 = load double*, double** %23
store double %58, double* %59
%60 = load double, double* %18
%61 = load double, double* %18
%62 = load double, double* %19
%63 = load double, double* %19
%64 = fmul double %62, %63
%65 = call double @llvm.fmuladd.f64(double %60, double %61, double %64)
%66 = call double @sqrt(double %65)
store double %66, double* %31
%67 = load double, double* %19
%68 = load double, double* %18
%69 = call double @atan2(double %67, double %68)
store double %69, double* %30
%70 = load double, double* %28
%71 = load double, double* %30
%72 = fsub double %71, %70
store double %72, double* %30
%73 = load double, double* %30
%74 = call double @cos(double %73)
%75 = load double, double* %31
%76 = load double, double* %27
%77 = load double*, double** %22
%78 = load double, double* %77
%79 = fmul double %76, %78
%80 = call double @llvm.fmuladd.f64(double %74, double %75, double %79)
%81 = load double*, double** %24
store double %80, double* %81
%82 = load double, double* %30
%83 = call double @sin(double %82)
%84 = load double, double* %31
%85 = load double, double* %27
%86 = load double*, double** %21
%87 = load double, double* %86
%88 = fmul double %85, %87
%89 = fneg double %88
%90 = call double @llvm.fmuladd.f64(double %83, double %84, double %89)
%91 = load double*, double** %25
store double %90, double* %91
%92 = load double, double* %20
%93 = load double*, double** %26
store double %92, double* %93
ret void
}

LLVM IR (-O2):
define void @ecitoecef(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double* nocapture %7, double* nocapture %8, double* nocapture writeonly %9, double* nocapture writeonly %10, double* nocapture writeonly %11, double* nocapture writeonly %12) {
%14 = fmul double %0, 0x400921FB54442D18
%15 = fdiv double %14, 1.800000e+02
%16 = fmul double %2, %2
%17 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %16)
%18 = tail call double @sqrt(double %17)
%19 = tail call double @atan2(double %2, double %1)
%20 = fsub double %19, %15
%21 = tail call double @cos(double %20)
%22 = fmul double %18, %21
store double %22, double* %7
%23 = tail call double @sin(double %20)
%24 = fmul double %18, %23
store double %24, double* %8
store double %3, double* %9
%25 = fmul double %5, %5
%26 = tail call double @llvm.fmuladd.f64(double %4, double %4, double %25)
%27 = tail call double @sqrt(double %26)
%28 = tail call double @atan2(double %5, double %4)
%29 = fsub double %28, %15
%30 = tail call double @cos(double %29)
%31 = load double, double* %8
%32 = fmul double %31, 0x3F131DA8202B475A
%33 = tail call double @llvm.fmuladd.f64(double %30, double %27, double %32)
store double %33, double* %10
%34 = tail call double @sin(double %29)
%35 = load double, double* %7
%36 = fmul double %35, 0xBF131DA8202B475A
%37 = tail call double @llvm.fmuladd.f64(double %34, double %27, double %36)
store double %37, double* %11
store double %6, double* %12
ret void
}