#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);
void Euler(double *x, double *y, double *vx, double *vy, double GM, double dt,
           double *ratio) {
  double dx, dy, dr, dr2, dr3, ax, ay, r, r2, r3;
  int i;
  dx = x[1] - x[0];
  dy = y[1] - y[0];
  dr2 = (dx * dx + dy * dy);
  dr = sqrt(dr2);
  dr3 = dr * dr2;
  for (i = 0; i < 2; i++) {
    r2 = x[i] * x[i] + y[i] * y[i];
    r = sqrt(r2);
    r3 = r2 * r;
    ax = -GM * x[i] / r3 + ratio[i] * dx / dr3;
    ay = -GM * y[i] / r3 + ratio[i] * dy / dr3;
    vx[i] += ax * dt;
    vy[i] += ay * dt;
    x[i] += vx[i] * dt;
    y[i] += vy[i] * dt;
  }
}


x86 assembly (clang, -O0):
<Euler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x8c(%rbp)
cmpl   $0x2,-0x8c(%rbp)
jge    139d <Euler+0x28d>
mov    -0x8(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x80(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
divsd  -0x88(%rbp),%xmm0
ff
mov    -0x38(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  -0x40(%rbp),%xmm1
divsd  -0x60(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x8c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
divsd  -0x88(%rbp),%xmm0
ff
mov    -0x38(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  -0x48(%rbp),%xmm1
divsd  -0x60(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x70(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
mov    -0x20(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x30(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x30(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    11ae <Euler+0x9e>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Euler>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    %r8,%r13
movsd  %xmm1,0x28(%rsp)
movapd %xmm0,%xmm4
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  0x8(%rdi),%xmm2
subsd  (%rdi),%xmm2
movsd  0x8(%rsi),%xmm0
subsd  (%rsi),%xmm0
movsd  %xmm0,0x20(%rsp)
mulsd  %xmm0,%xmm0
movsd  %xmm2,0x18(%rsp)
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm2
jb     1170 <Euler+0x60>
sqrtsd %xmm2,%xmm5
jmp    1199 <Euler+0x89>
movapd %xmm2,%xmm0
movapd %xmm4,0x30(%rsp)
movsd  %xmm2,0x8(%rsp)
call   1030 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
xorpd  %xmm1,%xmm1
movapd 0x30(%rsp),%xmm4
movapd %xmm0,%xmm5
xorpd  0xe5f(%rip),%xmm4
mulsd  %xmm2,%xmm5
movsd  (%rbx),%xmm2
movsd  (%r15),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
ucomisd %xmm1,%xmm2
movapd %xmm4,0x30(%rsp)
movsd  %xmm5,0x8(%rsp)
jb     11d5 <Euler+0xc5>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    11f6 <Euler+0xe6>
movapd %xmm2,%xmm0
movsd  %xmm2,0x10(%rsp)
call   1030 <sqrt@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x8(%rsp),%xmm5
movapd 0x30(%rsp),%xmm4
mulsd  %xmm2,%xmm0
movsd  (%rbx),%xmm1
mulsd  %xmm4,%xmm1
divsd  %xmm0,%xmm1
movsd  0x0(%r13),%xmm2
movsd  0x18(%rsp),%xmm3
mulsd  %xmm2,%xmm3
divsd  %xmm5,%xmm3
addsd  %xmm1,%xmm3
movsd  (%r15),%xmm1
mulsd  %xmm4,%xmm1
divsd  %xmm0,%xmm1
mulsd  0x20(%rsp),%xmm2
divsd  %xmm5,%xmm2
addsd  %xmm1,%xmm2
movsd  0x28(%rsp),%xmm1
mulsd  %xmm1,%xmm3
addsd  (%r12),%xmm3
movsd  %xmm3,(%r12)
mulsd  %xmm1,%xmm2
addsd  (%r14),%xmm2
movsd  %xmm2,(%r14)
movsd  (%r12),%xmm0
mulsd  %xmm1,%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,(%rbx)
movsd  (%r14),%xmm0
mulsd  %xmm1,%xmm0
addsd  (%r15),%xmm0
movsd  %xmm0,(%r15)
movsd  0x8(%rbx),%xmm1
movsd  0x8(%r15),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     12ac <Euler+0x19c>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    12cd <Euler+0x1bd>
movapd %xmm1,%xmm0
movsd  %xmm1,0x10(%rsp)
call   1030 <sqrt@plt>
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm5
movapd 0x30(%rsp),%xmm4
mulsd  %xmm1,%xmm0
movsd  0x8(%rbx),%xmm1
mulsd  %xmm4,%xmm1
divsd  %xmm0,%xmm1
movsd  0x8(%r13),%xmm2
movsd  0x18(%rsp),%xmm3
mulsd  %xmm2,%xmm3
divsd  %xmm5,%xmm3
addsd  %xmm1,%xmm3
mulsd  0x8(%r15),%xmm4
divsd  %xmm0,%xmm4
movsd  0x20(%rsp),%xmm0
mulsd  %xmm2,%xmm0
divsd  %xmm5,%xmm0
addsd  %xmm4,%xmm0
movsd  0x28(%rsp),%xmm1
mulsd  %xmm1,%xmm3
addsd  0x8(%r12),%xmm3
movsd  %xmm3,0x8(%r12)
mulsd  %xmm1,%xmm0
addsd  0x8(%r14),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0x8(%r12),%xmm0
mulsd  %xmm1,%xmm0
addsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x8(%rbx)
mulsd  0x8(%r14),%xmm1
addsd  0x8(%r15),%xmm1
movsd  %xmm1,0x8(%r15)
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @Euler(double* %0, double* %1, double* %2, double* %3, double %4, double %5, double* %6) {
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double
%13 = alloca double
%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 i32
store double* %0, double** %8
store double* %1, double** %9
store double* %2, double** %10
store double* %3, double** %11
store double %4, double* %12
store double %5, double* %13
store double* %6, double** %14
%26 = load double*, double** %8
%27 = getelementptr inbounds double, double* %26, i64 1
%28 = load double, double* %27
%29 = load double*, double** %8
%30 = getelementptr inbounds double, double* %29, i64 0
%31 = load double, double* %30
%32 = fsub double %28, %31
store double %32, double* %15
%33 = load double*, double** %9
%34 = getelementptr inbounds double, double* %33, i64 1
%35 = load double, double* %34
%36 = load double*, double** %9
%37 = getelementptr inbounds double, double* %36, i64 0
%38 = load double, double* %37
%39 = fsub double %35, %38
store double %39, double* %16
%40 = load double, double* %15
%41 = load double, double* %15
%42 = load double, double* %16
%43 = load double, double* %16
%44 = fmul double %42, %43
%45 = call double @llvm.fmuladd.f64(double %40, double %41, double %44)
store double %45, double* %18
%46 = load double, double* %18
%47 = call double @sqrt(double %46)
store double %47, double* %17
%48 = load double, double* %17
%49 = load double, double* %18
%50 = fmul double %48, %49
store double %50, double* %19
store i32 0, i32* %25
br label %51
51: ; preds = %162, %7
%52 = load i32, i32* %25
%53 = icmp slt i32 %52, 2
br i1 %53, label %54, label %165
54: ; preds = %51
%55 = load double*, double** %8
%56 = load i32, i32* %25
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %55, i64 %57
%59 = load double, double* %58
%60 = load double*, double** %8
%61 = load i32, i32* %25
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
%64 = load double, double* %63
%65 = load double*, double** %9
%66 = load i32, i32* %25
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %65, i64 %67
%69 = load double, double* %68
%70 = load double*, double** %9
%71 = load i32, i32* %25
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
%74 = load double, double* %73
%75 = fmul double %69, %74
%76 = call double @llvm.fmuladd.f64(double %59, double %64, double %75)
store double %76, double* %23
%77 = load double, double* %23
%78 = call double @sqrt(double %77)
store double %78, double* %22
%79 = load double, double* %23
%80 = load double, double* %22
%81 = fmul double %79, %80
store double %81, double* %24
%82 = load double, double* %12
%83 = fneg double %82
%84 = load double*, double** %8
%85 = load i32, i32* %25
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
%88 = load double, double* %87
%89 = fmul double %83, %88
%90 = load double, double* %24
%91 = fdiv double %89, %90
%92 = load double*, double** %14
%93 = load i32, i32* %25
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double, double* %92, i64 %94
%96 = load double, double* %95
%97 = load double, double* %15
%98 = fmul double %96, %97
%99 = load double, double* %19
%100 = fdiv double %98, %99
%101 = fadd double %91, %100
store double %101, double* %20
%102 = load double, double* %12
%103 = fneg double %102
%104 = load double*, double** %9
%105 = load i32, i32* %25
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %104, i64 %106
%108 = load double, double* %107
%109 = fmul double %103, %108
%110 = load double, double* %24
%111 = fdiv double %109, %110
%112 = load double*, double** %14
%113 = load i32, i32* %25
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds double, double* %112, i64 %114
%116 = load double, double* %115
%117 = load double, double* %16
%118 = fmul double %116, %117
%119 = load double, double* %19
%120 = fdiv double %118, %119
%121 = fadd double %111, %120
store double %121, double* %21
%122 = load double, double* %20
%123 = load double, double* %13
%124 = load double*, double** %10
%125 = load i32, i32* %25
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds double, double* %124, i64 %126
%128 = load double, double* %127
%129 = call double @llvm.fmuladd.f64(double %122, double %123, double %128)
store double %129, double* %127
%130 = load double, double* %21
%131 = load double, double* %13
%132 = load double*, double** %11
%133 = load i32, i32* %25
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds double, double* %132, i64 %134
%136 = load double, double* %135
%137 = call double @llvm.fmuladd.f64(double %130, double %131, double %136)
store double %137, double* %135
%138 = load double*, double** %10
%139 = load i32, i32* %25
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds double, double* %138, i64 %140
%142 = load double, double* %141
%143 = load double, double* %13
%144 = load double*, double** %8
%145 = load i32, i32* %25
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds double, double* %144, i64 %146
%148 = load double, double* %147
%149 = call double @llvm.fmuladd.f64(double %142, double %143, double %148)
store double %149, double* %147
%150 = load double*, double** %11
%151 = load i32, i32* %25
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds double, double* %150, i64 %152
%154 = load double, double* %153
%155 = load double, double* %13
%156 = load double*, double** %9
%157 = load i32, i32* %25
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds double, double* %156, i64 %158
%160 = load double, double* %159
%161 = call double @llvm.fmuladd.f64(double %154, double %155, double %160)
store double %161, double* %159
br label %162
162: ; preds = %54
%163 = load i32, i32* %25
%164 = add nsw i32 %163, 1
store i32 %164, i32* %25
br label %51
165: ; preds = %51
ret void
}

LLVM IR (-O2):
define void @Euler(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double %4, double %5, double* nocapture %6) {
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = load double, double* %8
%10 = load double, double* %0
%11 = fsub double %9, %10
%12 = getelementptr inbounds double, double* %1, i64 1
%13 = load double, double* %12
%14 = load double, double* %1
%15 = fsub double %13, %14
%16 = fmul double %15, %15
%17 = tail call double @llvm.fmuladd.f64(double %11, double %11, double %16)
%18 = tail call double @sqrt(double %17)
%19 = fmul double %18, %17
%20 = fneg double %4
%21 = load double, double* %0
%22 = load double, double* %1
%23 = fmul double %22, %22
%24 = tail call double @llvm.fmuladd.f64(double %21, double %21, double %23)
%25 = tail call double @sqrt(double %24)
%26 = fmul double %25, %24
%27 = load double, double* %0
%28 = fmul double %27, %20
%29 = fdiv double %28, %26
%30 = load double, double* %6
%31 = fmul double %11, %30
%32 = fdiv double %31, %19
%33 = fadd double %29, %32
%34 = load double, double* %1
%35 = fmul double %34, %20
%36 = fdiv double %35, %26
%37 = fmul double %15, %30
%38 = fdiv double %37, %19
%39 = fadd double %38, %36
%40 = load double, double* %2
%41 = tail call double @llvm.fmuladd.f64(double %33, double %5, double %40)
store double %41, double* %2
%42 = load double, double* %3
%43 = tail call double @llvm.fmuladd.f64(double %39, double %5, double %42)
store double %43, double* %3
%44 = load double, double* %2
%45 = load double, double* %0
%46 = tail call double @llvm.fmuladd.f64(double %44, double %5, double %45)
store double %46, double* %0
%47 = load double, double* %3
%48 = load double, double* %1
%49 = tail call double @llvm.fmuladd.f64(double %47, double %5, double %48)
store double %49, double* %1
%50 = load double, double* %8
%51 = load double, double* %12
%52 = fmul double %51, %51
%53 = tail call double @llvm.fmuladd.f64(double %50, double %50, double %52)
%54 = tail call double @sqrt(double %53)
%55 = fmul double %54, %53
%56 = load double, double* %8
%57 = fmul double %56, %20
%58 = fdiv double %57, %55
%59 = getelementptr inbounds double, double* %6, i64 1
%60 = load double, double* %59
%61 = fmul double %11, %60
%62 = fdiv double %61, %19
%63 = fadd double %58, %62
%64 = load double, double* %12
%65 = fmul double %64, %20
%66 = fdiv double %65, %55
%67 = fmul double %15, %60
%68 = fdiv double %67, %19
%69 = fadd double %68, %66
%70 = getelementptr inbounds double, double* %2, i64 1
%71 = load double, double* %70
%72 = tail call double @llvm.fmuladd.f64(double %63, double %5, double %71)
store double %72, double* %70
%73 = getelementptr inbounds double, double* %3, i64 1
%74 = load double, double* %73
%75 = tail call double @llvm.fmuladd.f64(double %69, double %5, double %74)
store double %75, double* %73
%76 = load double, double* %70
%77 = load double, double* %8
%78 = tail call double @llvm.fmuladd.f64(double %76, double %5, double %77)
store double %78, double* %8
%79 = load double, double* %73
%80 = load double, double* %12
%81 = tail call double @llvm.fmuladd.f64(double %79, double %5, double %80)
store double %81, double* %12
ret void
}