#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);
double rho_circ(double y1, double y2, double *q) {
  double rsq, d1, d2;
  d1 = y1 - q[0];
  d2 = y2 - q[1];
  rsq = d1 * d1 + d2 * d2;
  if (q[2] == 0.0)
    return (1e38);
  return (sqrt(rsq) / q[2]);
}


x86 assembly (clang, -O0):
<rho_circ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x20(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    119a <rho_circ+0x8a>
jp     119a <rho_circ+0x8a>
movsd  0xe70(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b2 <rho_circ+0xa2>
movsd  -0x28(%rbp),%xmm0
call   1030 <sqrt@plt>
mov    -0x20(%rbp),%rax
divsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rho_circ>:
push   %rbx
movsd  0x10(%rdi),%xmm3
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm3
jne    112c <rho_circ+0x1c>
jp     112c <rho_circ+0x1c>
movsd  0xed6(%rip),%xmm0
pop    %rbx
ret
mov    %rdi,%rbx
subsd  (%rdi),%xmm0
subsd  0x8(%rdi),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm2,%xmm0
jb     1150 <rho_circ+0x40>
sqrtsd %xmm0,%xmm0
jmp    1155 <rho_circ+0x45>
call   1030 <sqrt@plt>
divsd  0x10(%rbx),%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @rho_circ(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
store double %0, double* %5
store double %1, double* %6
store double* %2, double** %7
%11 = load double, double* %5
%12 = load double*, double** %7
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = fsub double %11, %14
store double %15, double* %9
%16 = load double, double* %6
%17 = load double*, double** %7
%18 = getelementptr inbounds double, double* %17, i64 1
%19 = load double, double* %18
%20 = fsub double %16, %19
store double %20, double* %10
%21 = load double, double* %9
%22 = load double, double* %9
%23 = load double, double* %10
%24 = load double, double* %10
%25 = fmul double %23, %24
%26 = call double @llvm.fmuladd.f64(double %21, double %22, double %25)
store double %26, double* %8
%27 = load double*, double** %7
%28 = getelementptr inbounds double, double* %27, i64 2
%29 = load double, double* %28
%30 = fcmp oeq double %29, 0.000000e+00
br i1 %30, label %31, label %32
31: ; preds = %3
store double 0x47D2CED32A16A1B1, double* %4
br label %39
32: ; preds = %3
%33 = load double, double* %8
%34 = call double @sqrt(double %33)
%35 = load double*, double** %7
%36 = getelementptr inbounds double, double* %35, i64 2
%37 = load double, double* %36
%38 = fdiv double %34, %37
store double %38, double* %4
br label %39
39: ; preds = %32, %31
%40 = load double, double* %4
ret double %40
}

LLVM IR (-O2):
define double @rho_circ(double %0, double %1, double* nocapture %2) {
%4 = getelementptr inbounds double, double* %2, i64 2
%5 = load double, double* %4
%6 = fcmp oeq double %5, 0.000000e+00
br i1 %6, label %18, label %7
7: ; preds = %3
%8 = load double, double* %2
%9 = fsub double %0, %8
%10 = getelementptr inbounds double, double* %2, i64 1
%11 = load double, double* %10
%12 = fsub double %1, %11
%13 = fmul double %12, %12
%14 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %13)
%15 = tail call double @sqrt(double %14)
%16 = load double, double* %4
%17 = fdiv double %15, %16
br label %18
18: ; preds = %3, %7
%19 = phi double [ %17, %7 ], [ 0x47D2CED32A16A1B1, %3 ]
ret double %19
}