#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 kick_NK(double *r, double *v, double dt, double GM, double B2) {
  int d;
  double r_recip2, r_recip, apre;
  r_recip2 = 1.0 / (r[0] * r[0] + r[1] * r[1] + r[2] * r[2]);
  r_recip = sqrt(r_recip2);
  apre = -GM * r_recip2 * r_recip - 2 * B2 * r_recip2 * r_recip2;
  for (d = 0; d < 3; d++) {
    v[d] += apre * r[d] * dt;
  }
}


x86 assembly (clang, -O0):
<kick_NK>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe8d(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  0xe3f(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    1244 <kick_NK+0x134>
movsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  -0x18(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11fb <kick_NK+0xeb>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kick_NK>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movapd %xmm0,%xmm3
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm4
mulsd  %xmm4,%xmm4
mulsd  %xmm0,%xmm0
addsd  %xmm4,%xmm0
movsd  0x10(%rdi),%xmm4
mulsd  %xmm4,%xmm4
addsd  %xmm0,%xmm4
movsd  0xeb5(%rip),%xmm5
divsd  %xmm4,%xmm5
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm5
jb     1162 <kick_NK+0x52>
xorps  %xmm0,%xmm0
sqrtsd %xmm5,%xmm0
jmp    119b <kick_NK+0x8b>
movapd %xmm5,%xmm0
movsd  %xmm2,0x20(%rsp)
movsd  %xmm3,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm5,0x8(%rsp)
call   1030 <sqrt@plt>
movsd  0x8(%rsp),%xmm5
movsd  0x10(%rsp),%xmm1
movsd  0x18(%rsp),%xmm3
movsd  0x20(%rsp),%xmm2
mulsd  %xmm5,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0xe5d(%rip),%xmm2
mulsd  %xmm5,%xmm2
mulsd  %xmm5,%xmm2
subsd  %xmm1,%xmm2
movsd  (%rbx),%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm3,%xmm0
addsd  (%r14),%xmm0
movsd  %xmm0,(%r14)
movsd  0x8(%rbx),%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm3,%xmm0
addsd  0x8(%r14),%xmm0
movsd  %xmm0,0x8(%r14)
mulsd  0x10(%rbx),%xmm2
mulsd  %xmm3,%xmm2
addsd  0x10(%r14),%xmm2
movsd  %xmm2,0x10(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @kick_NK(double* %0, double* %1, double %2, double %3, double %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%15 = load double*, double** %6
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
%18 = load double*, double** %6
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
%21 = load double*, double** %6
%22 = getelementptr inbounds double, double* %21, i64 1
%23 = load double, double* %22
%24 = load double*, double** %6
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = fmul double %23, %26
%28 = call double @llvm.fmuladd.f64(double %17, double %20, double %27)
%29 = load double*, double** %6
%30 = getelementptr inbounds double, double* %29, i64 2
%31 = load double, double* %30
%32 = load double*, double** %6
%33 = getelementptr inbounds double, double* %32, i64 2
%34 = load double, double* %33
%35 = call double @llvm.fmuladd.f64(double %31, double %34, double %28)
%36 = fdiv double 1.000000e+00, %35
store double %36, double* %12
%37 = load double, double* %12
%38 = call double @sqrt(double %37)
store double %38, double* %13
%39 = load double, double* %9
%40 = fneg double %39
%41 = load double, double* %12
%42 = fmul double %40, %41
%43 = load double, double* %13
%44 = load double, double* %10
%45 = fmul double 2.000000e+00, %44
%46 = load double, double* %12
%47 = fmul double %45, %46
%48 = load double, double* %12
%49 = fmul double %47, %48
%50 = fneg double %49
%51 = call double @llvm.fmuladd.f64(double %42, double %43, double %50)
store double %51, double* %14
store i32 0, i32* %11
br label %52
52: ; preds = %70, %5
%53 = load i32, i32* %11
%54 = icmp slt i32 %53, 3
br i1 %54, label %55, label %73
55: ; preds = %52
%56 = load double, double* %14
%57 = load double*, double** %6
%58 = load i32, i32* %11
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %57, i64 %59
%61 = load double, double* %60
%62 = fmul double %56, %61
%63 = load double, double* %8
%64 = load double*, double** %7
%65 = load i32, i32* %11
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
%68 = load double, double* %67
%69 = call double @llvm.fmuladd.f64(double %62, double %63, double %68)
store double %69, double* %67
br label %70
70: ; preds = %55
%71 = load i32, i32* %11
%72 = add nsw i32 %71, 1
store i32 %72, i32* %11
br label %52
73: ; preds = %52
ret void
}

LLVM IR (-O2):
define void @kick_NK(double* nocapture %0, double* nocapture %1, double %2, double %3, double %4) {
%6 = load double, double* %0
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = fmul double %8, %8
%10 = tail call double @llvm.fmuladd.f64(double %6, double %6, double %9)
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = load double, double* %11
%13 = tail call double @llvm.fmuladd.f64(double %12, double %12, double %10)
%14 = fdiv double 1.000000e+00, %13
%15 = tail call double @sqrt(double %14)
%16 = fneg double %3
%17 = fmul double %14, %16
%18 = fmul double %4, -2.000000e+00
%19 = fmul double %18, %14
%20 = fmul double %14, %19
%21 = tail call double @llvm.fmuladd.f64(double %17, double %15, double %20)
%22 = load double, double* %0
%23 = fmul double %21, %22
%24 = load double, double* %1
%25 = tail call double @llvm.fmuladd.f64(double %23, double %2, double %24)
store double %25, double* %1
%26 = load double, double* %7
%27 = fmul double %21, %26
%28 = getelementptr inbounds double, double* %1, i64 1
%29 = load double, double* %28
%30 = tail call double @llvm.fmuladd.f64(double %27, double %2, double %29)
store double %30, double* %28
%31 = load double, double* %11
%32 = fmul double %21, %31
%33 = getelementptr inbounds double, double* %1, i64 2
%34 = load double, double* %33
%35 = tail call double @llvm.fmuladd.f64(double %32, double %2, double %34)
store double %35, double* %33
ret void
}