#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 isochrone_gradient(double *pars, double *r, double *grad) {
  double sqrtR2b, fac, denom;
  sqrtR2b = sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2] + pars[2] * pars[2]);
  denom = (sqrtR2b + pars[2] * pars[2]);
  fac = pars[0] * pars[1] / (denom * denom * sqrtR2b);
  grad[0] = fac * r[0];
  grad[1] = fac * r[1];
  grad[2] = fac * r[2];
}


x86 assembly (clang, -O0):
<isochrone_gradient>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isochrone_gradient>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0x10(%rsi),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     115d <isochrone_gradient+0x4d>
sqrtsd %xmm0,%xmm0
jmp    1162 <isochrone_gradient+0x52>
call   1030 <sqrt@plt>
movsd  (%r15),%xmm1
movsd  0x10(%r15),%xmm2
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
mulsd  0x8(%r15),%xmm1
mulsd  %xmm2,%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm2,%xmm1
movsd  (%rbx),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
movsd  0x8(%rbx),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%r14)
mulsd  0x10(%rbx),%xmm1
movsd  %xmm1,0x10(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

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

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