#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 sqrt(double const);
void Mercury(double t, const double X[], double R[]) {
  const double M = 1.9891e30;
  const double m = 0.3301e24;
  const double G = 6.67e-11;
  double r = sqrt(X[0] * X[0] + X[2] * X[2]);
  double F = (m * M * G) / (r * r);
  double Fx = -F * X[0] / r;
  double Fy = -F * X[2] / r;
  R[0] = X[1];
  R[1] = Fx / m;
  R[2] = X[3];
  R[3] = Fy / m;
}


x86 assembly (clang, -O0):
<Mercury>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  0xeeb(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xec6(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movsd  0xe76(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
movsd  0xdea(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x50(%rbp),%xmm0
movsd  0xdbe(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mercury>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
movsd  0x10(%rdi),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     113f <Mercury+0x2f>
sqrtsd %xmm0,%xmm0
jmp    1144 <Mercury+0x34>
call   1030 <sqrt@plt>
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xeac(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  (%rbx),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
mulsd  0x10(%rbx),%xmm2
divsd  %xmm0,%xmm2
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,(%r14)
movsd  0xe89(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%r14)
movsd  0x18(%rbx),%xmm1
movsd  %xmm1,0x10(%r14)
divsd  %xmm0,%xmm2
movsd  %xmm2,0x18(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @Mercury(double %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %1, i64 2
%6 = load double, double* %5
%7 = fmul double %6, %6
%8 = tail call double @llvm.fmuladd.f64(double %4, double %4, double %7)
%9 = tail call double @sqrt(double %8)
%10 = fmul double %9, %9
%11 = fdiv double 0xC8FF6BEF569AC21A, %10
%12 = load double, double* %1
%13 = fmul double %12, %11
%14 = fdiv double %13, %9
%15 = load double, double* %5
%16 = fmul double %11, %15
%17 = fdiv double %16, %9
%18 = getelementptr inbounds double, double* %1, i64 1
%19 = load double, double* %18
store double %19, double* %2
%20 = fdiv double %14, 3.301000e+23
%21 = getelementptr inbounds double, double* %2, i64 1
store double %20, double* %21
%22 = getelementptr inbounds double, double* %1, i64 3
%23 = load double, double* %22
%24 = getelementptr inbounds double, double* %2, i64 2
store double %23, double* %24
%25 = fdiv double %17, 3.301000e+23
%26 = getelementptr inbounds double, double* %2, i64 3
store double %25, double* %26
ret void
}