#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 log10(double);
double sqrt(double);
double Calc_ML_HuttonBoore(double amplitude, double dist, double depth,
                           double sta_corr, double hb_n, double hb_K,
                           double hb_Ro, double hb_Mo) {
  double hyp_dist, magnitude;
  hyp_dist = sqrt(dist * dist + depth * depth);
  if (hyp_dist < 1.0e-20)
    return (-9.9);
  magnitude = log10(amplitude) + hb_n * log10(hyp_dist / hb_Ro) +
              hb_K * (hyp_dist - hb_Ro) + hb_Mo + sta_corr;
  return (magnitude);
}


x86 assembly (clang, -O0):
<Calc_ML_HuttonBoore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  %xmm6,-0x40(%rbp)
movsd  %xmm7,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  0xe82(%rip),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    119b <Calc_ML_HuttonBoore+0x7b>
movsd  0xe77(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1208 <Calc_ML_HuttonBoore+0xe8>
movsd  -0x10(%rbp),%xmm0
call   1030 <log10@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
call   1030 <log10@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
subsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x48(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Calc_ML_HuttonBoore>:
sub    $0x38,%rsp
movsd  %xmm7,0x28(%rsp)
movsd  %xmm6,0x8(%rsp)
movsd  %xmm5,0x30(%rsp)
movsd  %xmm4,0x18(%rsp)
movsd  %xmm3,0x20(%rsp)
movapd %xmm0,%xmm3
mulsd  %xmm2,%xmm2
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     1162 <Calc_ML_HuttonBoore+0x42>
sqrtsd %xmm1,%xmm1
jmp    1179 <Calc_ML_HuttonBoore+0x59>
movapd %xmm1,%xmm0
movsd  %xmm3,(%rsp)
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm3
movapd %xmm0,%xmm1
movsd  0xe87(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1194 <Calc_ML_HuttonBoore+0x74>
movsd  0xe71(%rip),%xmm0
add    $0x38,%rsp
ret
movapd %xmm3,%xmm0
movsd  %xmm1,(%rsp)
call   1030 <log10@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
call   1030 <log10@plt>
movsd  0x18(%rsp),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
movsd  (%rsp),%xmm2
subsd  0x8(%rsp),%xmm2
movsd  0x30(%rsp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  0x28(%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @Calc_ML_HuttonBoore(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store double %0, double* %10
store double %1, double* %11
store double %2, double* %12
store double %3, double* %13
store double %4, double* %14
store double %5, double* %15
store double %6, double* %16
store double %7, double* %17
%20 = load double, double* %11
%21 = load double, double* %11
%22 = load double, double* %12
%23 = load double, double* %12
%24 = fmul double %22, %23
%25 = call double @llvm.fmuladd.f64(double %20, double %21, double %24)
%26 = call double @sqrt(double %25)
store double %26, double* %18
%27 = load double, double* %18
%28 = fcmp olt double %27, 0x3BC79CA10C924223
br i1 %28, label %29, label %30
29: ; preds = %8
store double -9.900000e+00, double* %9
br label %49
30: ; preds = %8
%31 = load double, double* %10
%32 = call double @log10(double %31)
%33 = load double, double* %14
%34 = load double, double* %18
%35 = load double, double* %16
%36 = fdiv double %34, %35
%37 = call double @log10(double %36)
%38 = call double @llvm.fmuladd.f64(double %33, double %37, double %32)
%39 = load double, double* %15
%40 = load double, double* %18
%41 = load double, double* %16
%42 = fsub double %40, %41
%43 = call double @llvm.fmuladd.f64(double %39, double %42, double %38)
%44 = load double, double* %17
%45 = fadd double %43, %44
%46 = load double, double* %13
%47 = fadd double %45, %46
store double %47, double* %19
%48 = load double, double* %19
store double %48, double* %9
br label %49
49: ; preds = %30, %29
%50 = load double, double* %9
ret double %50
}

LLVM IR (-O2):
define double @Calc_ML_HuttonBoore(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = fmul double %2, %2
%10 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %9)
%11 = tail call double @sqrt(double %10)
%12 = fcmp olt double %11, 0x3BC79CA10C924223
br i1 %12, label %22, label %13
13: ; preds = %8
%14 = tail call double @log10(double %0)
%15 = fdiv double %11, %6
%16 = tail call double @log10(double %15)
%17 = tail call double @llvm.fmuladd.f64(double %4, double %16, double %14)
%18 = fsub double %11, %6
%19 = tail call double @llvm.fmuladd.f64(double %5, double %18, double %17)
%20 = fadd double %19, %7
%21 = fadd double %20, %3
br label %22
22: ; preds = %8, %13
%23 = phi double [ %21, %13 ], [ -9.900000e+00, %8 ]
ret double %23
}