#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 M_PI;
double atan(double);
double log(double);
double sqrt(double);
double stone_value(double *pars, double *r) {
  double rr, u_c, u_t, f;
  rr = sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]);
  u_c = rr / pars[2];
  u_t = rr / pars[3];
  f = M_PI * (pars[3] * pars[3] - pars[2] * pars[2]) / (pars[2] + pars[3]);
  return -pars[0] * pars[1] / f *
         (atan(u_t) / u_t - atan(u_c) / u_c +
          0.5 * log((rr * rr + pars[3] * pars[3]) /
                    (rr * rr + pars[2] * pars[2])));
}


x86 assembly (clang, -O0):
<stone_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
divsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
divsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e2d(%rip),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm3
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x8(%rbp),%rax
mulsd  0x10(%rax),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x8(%rbp),%rax
addsd  0x18(%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <atan@plt>
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm3
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x8(%rbp),%rax
mulsd  0x10(%rax),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1040 <log@plt>
movsd  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  0xd13(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stone_value>:
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rbx
movsd  (%rsi),%xmm1
movsd  0x8(%rsi),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rsi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     116a <stone_value+0x3a>
sqrtsd %xmm0,%xmm0
jmp    116f <stone_value+0x3f>
call   1050 <sqrt@plt>
movapd %xmm0,0x30(%rsp)
movupd 0x10(%rbx),%xmm3
unpcklpd %xmm0,%xmm0
divpd  %xmm3,%xmm0
movapd %xmm0,%xmm4
movapd %xmm0,(%rsp)
mov    0x2e56(%rip),%rax
movapd %xmm3,%xmm1
mulsd  %xmm3,%xmm1
movapd %xmm3,%xmm2
unpckhpd %xmm3,%xmm2
addsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm2
subsd  %xmm1,%xmm2
mulsd  (%rax),%xmm2
divsd  %xmm3,%xmm2
movsd  (%rbx),%xmm0
xorpd  0xe3e(%rip),%xmm0
mulsd  0x8(%rbx),%xmm0
divsd  %xmm2,%xmm0
movapd %xmm0,0x20(%rsp)
movapd %xmm4,%xmm0
unpckhpd %xmm4,%xmm0
call   1030 <atan@plt>
movapd %xmm0,0x10(%rsp)
movapd (%rsp),%xmm0
call   1030 <atan@plt>
unpcklpd 0x10(%rsp),%xmm0
divpd  (%rsp),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
movupd 0x10(%rbx),%xmm0
mulpd  %xmm0,%xmm0
movapd 0x30(%rsp),%xmm1
mulsd  %xmm1,%xmm1
unpcklpd %xmm1,%xmm1
addpd  %xmm0,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
divsd  %xmm1,%xmm0
call   1040 <log@plt>
mulsd  0xdd2(%rip),%xmm0
addsd  (%rsp),%xmm0
mulsd  0x20(%rsp),%xmm0
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @stone_value(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%9 = load double*, double** %4
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = load double*, double** %4
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = load double*, double** %4
%19 = getelementptr inbounds double, double* %18, i64 1
%20 = load double, double* %19
%21 = fmul double %17, %20
%22 = call double @llvm.fmuladd.f64(double %11, double %14, double %21)
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 2
%25 = load double, double* %24
%26 = load double*, double** %4
%27 = getelementptr inbounds double, double* %26, i64 2
%28 = load double, double* %27
%29 = call double @llvm.fmuladd.f64(double %25, double %28, double %22)
%30 = call double @sqrt(double %29)
store double %30, double* %5
%31 = load double, double* %5
%32 = load double*, double** %3
%33 = getelementptr inbounds double, double* %32, i64 2
%34 = load double, double* %33
%35 = fdiv double %31, %34
store double %35, double* %6
%36 = load double, double* %5
%37 = load double*, double** %3
%38 = getelementptr inbounds double, double* %37, i64 3
%39 = load double, double* %38
%40 = fdiv double %36, %39
store double %40, double* %7
%41 = load double, double* @M_PI
%42 = load double*, double** %3
%43 = getelementptr inbounds double, double* %42, i64 3
%44 = load double, double* %43
%45 = load double*, double** %3
%46 = getelementptr inbounds double, double* %45, i64 3
%47 = load double, double* %46
%48 = load double*, double** %3
%49 = getelementptr inbounds double, double* %48, i64 2
%50 = load double, double* %49
%51 = load double*, double** %3
%52 = getelementptr inbounds double, double* %51, i64 2
%53 = load double, double* %52
%54 = fmul double %50, %53
%55 = fneg double %54
%56 = call double @llvm.fmuladd.f64(double %44, double %47, double %55)
%57 = fmul double %41, %56
%58 = load double*, double** %3
%59 = getelementptr inbounds double, double* %58, i64 2
%60 = load double, double* %59
%61 = load double*, double** %3
%62 = getelementptr inbounds double, double* %61, i64 3
%63 = load double, double* %62
%64 = fadd double %60, %63
%65 = fdiv double %57, %64
store double %65, double* %8
%66 = load double*, double** %3
%67 = getelementptr inbounds double, double* %66, i64 0
%68 = load double, double* %67
%69 = fneg double %68
%70 = load double*, double** %3
%71 = getelementptr inbounds double, double* %70, i64 1
%72 = load double, double* %71
%73 = fmul double %69, %72
%74 = load double, double* %8
%75 = fdiv double %73, %74
%76 = load double, double* %7
%77 = call double @atan(double %76)
%78 = load double, double* %7
%79 = fdiv double %77, %78
%80 = load double, double* %6
%81 = call double @atan(double %80)
%82 = load double, double* %6
%83 = fdiv double %81, %82
%84 = fsub double %79, %83
%85 = load double, double* %5
%86 = load double, double* %5
%87 = load double*, double** %3
%88 = getelementptr inbounds double, double* %87, i64 3
%89 = load double, double* %88
%90 = load double*, double** %3
%91 = getelementptr inbounds double, double* %90, i64 3
%92 = load double, double* %91
%93 = fmul double %89, %92
%94 = call double @llvm.fmuladd.f64(double %85, double %86, double %93)
%95 = load double, double* %5
%96 = load double, double* %5
%97 = load double*, double** %3
%98 = getelementptr inbounds double, double* %97, i64 2
%99 = load double, double* %98
%100 = load double*, double** %3
%101 = getelementptr inbounds double, double* %100, i64 2
%102 = load double, double* %101
%103 = fmul double %99, %102
%104 = call double @llvm.fmuladd.f64(double %95, double %96, double %103)
%105 = fdiv double %94, %104
%106 = call double @log(double %105)
%107 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %106, double %84)
%108 = fmul double %75, %107
ret double %108
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @stone_value(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = getelementptr inbounds double, double* %1, i64 1
%5 = load double, double* %4
%6 = fmul double %5, %5
%7 = tail call double @llvm.fmuladd.f64(double %3, double %3, double %6)
%8 = getelementptr inbounds double, double* %1, i64 2
%9 = load double, double* %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %7)
%11 = tail call double @sqrt(double %10)
%12 = getelementptr inbounds double, double* %0, i64 2
%13 = bitcast double* %12 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = insertelement <2 x double> poison, double %11, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = fdiv <2 x double> %16, %14
%18 = load double, double* @M_PI
%19 = extractelement <2 x double> %14, i64 0
%20 = fneg double %19
%21 = fmul double %19, %20
%22 = extractelement <2 x double> %14, i64 1
%23 = tail call double @llvm.fmuladd.f64(double %22, double %22, double %21)
%24 = fmul double %18, %23
%25 = fadd double %19, %22
%26 = fdiv double %24, %25
%27 = load double, double* %0
%28 = fneg double %27
%29 = getelementptr inbounds double, double* %0, i64 1
%30 = load double, double* %29
%31 = fmul double %30, %28
%32 = fdiv double %31, %26
%33 = extractelement <2 x double> %17, i64 1
%34 = tail call double @atan(double %33)
%35 = extractelement <2 x double> %17, i64 0
%36 = tail call double @atan(double %35)
%37 = insertelement <2 x double> poison, double %36, i64 0
%38 = insertelement <2 x double> %37, double %34, i64 1
%39 = fdiv <2 x double> %38, %17
%40 = shufflevector <2 x double> %39, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%41 = fsub <2 x double> %40, %39
%42 = extractelement <2 x double> %41, i64 0
%43 = bitcast double* %12 to <2 x double>*
%44 = load <2 x double>, <2 x double>* %43
%45 = fmul <2 x double> %44, %44
%46 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %16, <2 x double> %16, <2 x double> %45)
%47 = extractelement <2 x double> %46, i64 0
%48 = extractelement <2 x double> %46, i64 1
%49 = fdiv double %48, %47
%50 = tail call double @log(double %49)
%51 = tail call double @llvm.fmuladd.f64(double %50, double 5.000000e-01, double %42)
%52 = fmul double %32, %51
ret double %52
}