; 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
declare double @pow(double noundef, double noundef) #0

; Function Attrs: nounwind uwtable
define dso_local double @residual_function_height_contact(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6) #2 {
  %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
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  store double %0, ptr %9, align 8, !tbaa !5
  store double %1, ptr %10, align 8, !tbaa !5
  store double %2, ptr %11, align 8, !tbaa !5
  store double %3, ptr %12, align 8, !tbaa !5
  store double %4, ptr %13, align 8, !tbaa !5
  store double %5, ptr %14, align 8, !tbaa !5
  store double %6, ptr %15, align 8, !tbaa !5
  %16 = load double, ptr %15, align 8, !tbaa !5
  %17 = fneg double %16
  %18 = load double, ptr %9, align 8, !tbaa !5
  %19 = load double, ptr %11, align 8, !tbaa !5
  %20 = load double, ptr %12, align 8, !tbaa !5
  %21 = fneg double %19
  %22 = call double @llvm.fmuladd.f64(double %21, double %20, double %18)
  %23 = fmul double %17, %22
  %24 = load double, ptr %10, align 8, !tbaa !5
  %25 = fcmp olt double %23, %24
  br i1 %25, label %26, label %48

26:                                               ; preds = %7
  %27 = load double, ptr %9, align 8, !tbaa !5
  %28 = load double, ptr %10, align 8, !tbaa !5
  %29 = fdiv double %27, %28
  %30 = call double @pow(double noundef %29, double noundef 2.000000e+00) #3
  %31 = fadd double 1.000000e+00, %30
  %32 = call double @sqrt(double noundef %31) #3
  %33 = fsub double %32, 1.000000e+00
  %34 = load double, ptr %10, align 8, !tbaa !5
  %35 = load double, ptr %11, align 8, !tbaa !5
  %36 = fdiv double %34, %35
  %37 = load double, ptr %9, align 8, !tbaa !5
  %38 = fmul double 5.000000e-01, %37
  %39 = load double, ptr %9, align 8, !tbaa !5
  %40 = load double, ptr %11, align 8, !tbaa !5
  %41 = load double, ptr %13, align 8, !tbaa !5
  %42 = fmul double %40, %41
  %43 = fdiv double %39, %42
  %44 = fmul double %38, %43
  %45 = call double @llvm.fmuladd.f64(double %33, double %36, double %44)
  %46 = load double, ptr %14, align 8, !tbaa !5
  %47 = fsub double %45, %46
  store double %47, ptr %8, align 8
  br label %70

48:                                               ; preds = %7
  %49 = load double, ptr %9, align 8, !tbaa !5
  %50 = load double, ptr %10, align 8, !tbaa !5
  %51 = fdiv double %49, %50
  %52 = call double @pow(double noundef %51, double noundef 2.000000e+00) #3
  %53 = fadd double 1.000000e+00, %52
  %54 = call double @sqrt(double noundef %53) #3
  %55 = fsub double %54, 1.000000e+00
  %56 = load double, ptr %10, align 8, !tbaa !5
  %57 = load double, ptr %11, align 8, !tbaa !5
  %58 = fdiv double %56, %57
  %59 = load double, ptr %9, align 8, !tbaa !5
  %60 = fmul double 5.000000e-01, %59
  %61 = load double, ptr %9, align 8, !tbaa !5
  %62 = load double, ptr %11, align 8, !tbaa !5
  %63 = load double, ptr %13, align 8, !tbaa !5
  %64 = fmul double %62, %63
  %65 = fdiv double %61, %64
  %66 = fmul double %60, %65
  %67 = call double @llvm.fmuladd.f64(double %55, double %58, double %66)
  %68 = load double, ptr %14, align 8, !tbaa !5
  %69 = fsub double %67, %68
  store double %69, ptr %8, align 8
  br label %70

70:                                               ; preds = %48, %26
  %71 = load double, ptr %8, align 8
  ret double %71
}

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_contact(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6) local_unnamed_addr #1 {
  %8 = fdiv double %0, %1
  %square25 = fmul double %8, %8
  %9 = fadd double %square25, 1.000000e+00
  %sqrt = tail call double @llvm.sqrt.f64(double %9)
  %10 = fadd double %sqrt, -1.000000e+00
  %11 = fdiv double %1, %2
  %12 = fmul double %0, 5.000000e-01
  %13 = fmul double %2, %4
  %14 = fdiv double %0, %13
  %15 = fmul double %12, %14
  %16 = tail call double @llvm.fmuladd.f64(double %10, double %11, double %15)
  %.0 = fsub double %16, %5
  ret double %.0
}

; 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,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass