; LLVM IR from OpenFAST/openfast :: modules/map/src (residual)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind
declare double @sqrt(double noundef) #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: nounwind uwtable
define dso_local double @residual_function_height_no_contact(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5) #2 {
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  store double %0, ptr %7, align 8, !tbaa !5
  store double %1, ptr %8, align 8, !tbaa !5
  store double %2, ptr %9, align 8, !tbaa !5
  store double %3, ptr %10, align 8, !tbaa !5
  store double %4, ptr %11, align 8, !tbaa !5
  store double %5, ptr %12, align 8, !tbaa !5
  %13 = load double, ptr %8, align 8, !tbaa !5
  %14 = load double, ptr %9, align 8, !tbaa !5
  %15 = fdiv double %13, %14
  %16 = load double, ptr %7, align 8, !tbaa !5
  %17 = load double, ptr %8, align 8, !tbaa !5
  %18 = fdiv double %16, %17
  %19 = call double @pow(double noundef %18, double noundef 2.000000e+00) #3
  %20 = fadd double 1.000000e+00, %19
  %21 = call double @sqrt(double noundef %20) #3
  %22 = load double, ptr %8, align 8, !tbaa !5
  %23 = load double, ptr %9, align 8, !tbaa !5
  %24 = fdiv double %22, %23
  %25 = load double, ptr %7, align 8, !tbaa !5
  %26 = load double, ptr %9, align 8, !tbaa !5
  %27 = load double, ptr %10, align 8, !tbaa !5
  %28 = fneg double %26
  %29 = call double @llvm.fmuladd.f64(double %28, double %27, double %25)
  %30 = load double, ptr %8, align 8, !tbaa !5
  %31 = fdiv double %29, %30
  %32 = call double @pow(double noundef %31, double noundef 2.000000e+00) #3
  %33 = fadd double 1.000000e+00, %32
  %34 = call double @sqrt(double noundef %33) #3
  %35 = fmul double %24, %34
  %36 = fneg double %35
  %37 = call double @llvm.fmuladd.f64(double %15, double %21, double %36)
  %38 = load double, ptr %11, align 8, !tbaa !5
  %39 = fdiv double 1.000000e+00, %38
  %40 = load double, ptr %7, align 8, !tbaa !5
  %41 = load double, ptr %10, align 8, !tbaa !5
  %42 = load double, ptr %9, align 8, !tbaa !5
  %43 = load double, ptr %10, align 8, !tbaa !5
  %44 = fmul double %42, %43
  %45 = load double, ptr %10, align 8, !tbaa !5
  %46 = fmul double %44, %45
  %47 = fdiv double %46, 2.000000e+00
  %48 = fneg double %47
  %49 = call double @llvm.fmuladd.f64(double %40, double %41, double %48)
  %50 = call double @llvm.fmuladd.f64(double %39, double %49, double %37)
  %51 = load double, ptr %12, align 8, !tbaa !5
  %52 = fsub double %50, %51
  ret double %52
}

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #0

attributes #0 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @residual_function_height_no_contact(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5) local_unnamed_addr #1 {
  %7 = fdiv double %1, %2
  %8 = fdiv double %0, %1
  %square = fmul double %8, %8
  %9 = fadd double %square, 1.000000e+00
  %sqrt18 = tail call double @llvm.sqrt.f64(double %9)
  %10 = fneg double %2
  %11 = tail call double @llvm.fmuladd.f64(double %10, double %3, double %0)
  %12 = fdiv double %11, %1
  %square17 = fmul double %12, %12
  %13 = fadd double %square17, 1.000000e+00
  %sqrt = tail call double @llvm.sqrt.f64(double %13)
  %14 = fneg double %7
  %15 = fmul double %sqrt, %14
  %16 = tail call double @llvm.fmuladd.f64(double %7, double %sqrt18, double %15)
  %17 = fdiv double 1.000000e+00, %4
  %18 = fmul double %2, %3
  %19 = fmul double %18, %3
  %20 = fmul double %19, -5.000000e-01
  %21 = tail call double @llvm.fmuladd.f64(double %0, double %3, double %20)
  %22 = tail call double @llvm.fmuladd.f64(double %17, double %21, double %16)
  %23 = fsub double %22, %5
  ret double %23
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass