#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 miyamotonagai_value(double *pars, double *r) {
  double zd;
  zd = (pars[2] + sqrt(r[2] * r[2] + pars[3] * pars[3]));
  return -pars[0] * pars[1] / sqrt(r[0] * r[0] + r[1] * r[1] + zd * zd);
}


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

x86 assembly (clang, -O2):
<miyamotonagai_value>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  0x10(%rdi),%xmm2
movsd  0x18(%rdi),%xmm1
movsd  0x10(%rsi),%xmm0
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
jb     1148 <miyamotonagai_value+0x38>
sqrtsd %xmm0,%xmm0
jmp    115b <miyamotonagai_value+0x4b>
movsd  %xmm2,(%rsp)
call   1030 <sqrt@plt>
xorpd  %xmm3,%xmm3
movsd  (%rsp),%xmm2
movsd  (%rbx),%xmm4
xorpd  0xe99(%rip),%xmm4
addsd  %xmm0,%xmm2
mulsd  0x8(%rbx),%xmm4
movsd  (%r14),%xmm0
movsd  0x8(%r14),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
ucomisd %xmm3,%xmm2
jb     119e <miyamotonagai_value+0x8e>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    11b1 <miyamotonagai_value+0xa1>
movapd %xmm2,%xmm0
movapd %xmm4,(%rsp)
call   1030 <sqrt@plt>
movapd (%rsp),%xmm4
divsd  %xmm0,%xmm4
movapd %xmm4,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @miyamotonagai_value(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 2
%8 = load double, double* %7
%9 = load double*, double** %4
%10 = getelementptr inbounds double, double* %9, i64 2
%11 = load double, double* %10
%12 = load double*, double** %4
%13 = getelementptr inbounds double, double* %12, i64 2
%14 = load double, double* %13
%15 = load double*, double** %3
%16 = getelementptr inbounds double, double* %15, i64 3
%17 = load double, double* %16
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 3
%20 = load double, double* %19
%21 = fmul double %17, %20
%22 = call double @llvm.fmuladd.f64(double %11, double %14, double %21)
%23 = call double @sqrt(double %22)
%24 = fadd double %8, %23
store double %24, double* %5
%25 = load double*, double** %3
%26 = getelementptr inbounds double, double* %25, i64 0
%27 = load double, double* %26
%28 = fneg double %27
%29 = load double*, double** %3
%30 = getelementptr inbounds double, double* %29, i64 1
%31 = load double, double* %30
%32 = fmul double %28, %31
%33 = load double*, double** %4
%34 = getelementptr inbounds double, double* %33, i64 0
%35 = load double, double* %34
%36 = load double*, double** %4
%37 = getelementptr inbounds double, double* %36, i64 0
%38 = load double, double* %37
%39 = load double*, double** %4
%40 = getelementptr inbounds double, double* %39, i64 1
%41 = load double, double* %40
%42 = load double*, double** %4
%43 = getelementptr inbounds double, double* %42, i64 1
%44 = load double, double* %43
%45 = fmul double %41, %44
%46 = call double @llvm.fmuladd.f64(double %35, double %38, double %45)
%47 = load double, double* %5
%48 = load double, double* %5
%49 = call double @llvm.fmuladd.f64(double %47, double %48, double %46)
%50 = call double @sqrt(double %49)
%51 = fdiv double %32, %50
ret double %51
}

LLVM IR (-O2):
define double @miyamotonagai_value(double* nocapture %0, double* nocapture %1) {
%3 = getelementptr inbounds double, double* %0, i64 2
%4 = load double, double* %3
%5 = getelementptr inbounds double, double* %1, i64 2
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %0, i64 3
%8 = load double, double* %7
%9 = fmul double %8, %8
%10 = tail call double @llvm.fmuladd.f64(double %6, double %6, double %9)
%11 = tail call double @sqrt(double %10)
%12 = fadd double %4, %11
%13 = load double, double* %0
%14 = fneg double %13
%15 = getelementptr inbounds double, double* %0, i64 1
%16 = load double, double* %15
%17 = fmul double %16, %14
%18 = load double, double* %1
%19 = getelementptr inbounds double, double* %1, i64 1
%20 = load double, double* %19
%21 = fmul double %20, %20
%22 = tail call double @llvm.fmuladd.f64(double %18, double %18, double %21)
%23 = tail call double @llvm.fmuladd.f64(double %12, double %12, double %22)
%24 = tail call double @sqrt(double %23)
%25 = fdiv double %17, %24
ret double %25
}