#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 pow(double, int);
double sqrt(double);
double Calc_MD_FMAG(double coda_dur, double dist, double depth, double sta_corr,
                    double fmag_c1, double fmag_c2, double fmag_c3,
                    double fmag_c4, double fmag_c5) {
  double hyp_dist, magnitude;
  hyp_dist = sqrt(dist * dist + depth * depth);
  if (coda_dur * sta_corr < 1.0e-20)
    return (-9.9);
  magnitude = fmag_c1 + fmag_c2 * log10(coda_dur * sta_corr) + fmag_c3 * dist +
              fmag_c4 * depth + fmag_c5 * pow(log10(coda_dur * sta_corr), 2);
  return (magnitude);
}


x86 assembly (clang, -O0):
<Calc_MD_FMAG>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  0x10(%rbp),%xmm8
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   1050 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  0xe5f(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11bd <Calc_MD_FMAG+0x8d>
movsd  0xe55(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1265 <Calc_MD_FMAG+0x135>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1040 <log10@plt>
movsd  -0x78(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1040 <log10@plt>
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Calc_MD_FMAG>:
sub    $0x38,%rsp
mulsd  %xmm3,%xmm0
movsd  0xed0(%rip),%xmm3
ucomisd %xmm0,%xmm3
jbe    1143 <Calc_MD_FMAG+0x23>
movsd  0xeca(%rip),%xmm0
add    $0x38,%rsp
ret
movsd  %xmm7,(%rsp)
movsd  %xmm0,0x30(%rsp)
movsd  %xmm6,0x20(%rsp)
movsd  %xmm2,0x28(%rsp)
movsd  %xmm4,0x10(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm5,0x8(%rsp)
call   1040 <log10@plt>
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
addsd  %xmm1,%xmm0
movsd  (%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x30(%rsp),%xmm0
call   1040 <log10@plt>
mov    $0x2,%edi
call   1030 <pow@plt>
mulsd  0x40(%rsp),%xmm0
addsd  (%rsp),%xmm0
add    $0x38,%rsp
ret

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

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