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

; 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 @jacobian_dzdh_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
  %13 = alloca double, align 8
  store double %0, ptr %8, align 8, !tbaa !5
  store double %1, ptr %9, align 8, !tbaa !5
  store double %2, ptr %10, align 8, !tbaa !5
  store double %3, ptr %11, align 8, !tbaa !5
  store double %4, ptr %12, align 8, !tbaa !5
  store double %5, ptr %13, align 8, !tbaa !5
  %14 = load double, ptr %13, align 8, !tbaa !5
  %15 = fneg double %14
  %16 = load double, ptr %8, align 8, !tbaa !5
  %17 = load double, ptr %10, align 8, !tbaa !5
  %18 = load double, ptr %11, align 8, !tbaa !5
  %19 = fneg double %17
  %20 = call double @llvm.fmuladd.f64(double %19, double %18, double %16)
  %21 = fmul double %15, %20
  %22 = load double, ptr %9, align 8, !tbaa !5
  %23 = fcmp olt double %21, %22
  br i1 %23, label %24, label %49

24:                                               ; preds = %6
  %25 = load double, ptr %8, align 8, !tbaa !5
  %26 = load double, ptr %9, align 8, !tbaa !5
  %27 = fdiv double %25, %26
  %28 = call double @pow(double noundef %27, double noundef 2.000000e+00) #3
  %29 = fadd double 1.000000e+00, %28
  %30 = call double @sqrt(double noundef %29) #3
  %31 = fsub double %30, 1.000000e+00
  %32 = load double, ptr %8, align 8, !tbaa !5
  %33 = load double, ptr %9, align 8, !tbaa !5
  %34 = fdiv double %32, %33
  %35 = load double, ptr %8, align 8, !tbaa !5
  %36 = load double, ptr %9, align 8, !tbaa !5
  %37 = fdiv double %35, %36
  %38 = fmul double %34, %37
  %39 = load double, ptr %8, align 8, !tbaa !5
  %40 = load double, ptr %9, align 8, !tbaa !5
  %41 = fdiv double %39, %40
  %42 = call double @pow(double noundef %41, double noundef 2.000000e+00) #3
  %43 = fadd double 1.000000e+00, %42
  %44 = call double @sqrt(double noundef %43) #3
  %45 = fdiv double %38, %44
  %46 = fsub double %31, %45
  %47 = load double, ptr %10, align 8, !tbaa !5
  %48 = fdiv double %46, %47
  store double %48, ptr %7, align 8
  br label %74

49:                                               ; preds = %6
  %50 = load double, ptr %8, align 8, !tbaa !5
  %51 = load double, ptr %9, align 8, !tbaa !5
  %52 = fdiv double %50, %51
  %53 = call double @pow(double noundef %52, double noundef 2.000000e+00) #3
  %54 = fadd double 1.000000e+00, %53
  %55 = call double @sqrt(double noundef %54) #3
  %56 = fsub double %55, 1.000000e+00
  %57 = load double, ptr %8, align 8, !tbaa !5
  %58 = load double, ptr %9, align 8, !tbaa !5
  %59 = fdiv double %57, %58
  %60 = load double, ptr %8, align 8, !tbaa !5
  %61 = load double, ptr %9, align 8, !tbaa !5
  %62 = fdiv double %60, %61
  %63 = fmul double %59, %62
  %64 = load double, ptr %8, align 8, !tbaa !5
  %65 = load double, ptr %9, align 8, !tbaa !5
  %66 = fdiv double %64, %65
  %67 = call double @pow(double noundef %66, double noundef 2.000000e+00) #3
  %68 = fadd double 1.000000e+00, %67
  %69 = call double @sqrt(double noundef %68) #3
  %70 = fdiv double %63, %69
  %71 = fsub double %56, %70
  %72 = load double, ptr %10, align 8, !tbaa !5
  %73 = fdiv double %71, %72
  store double %73, ptr %7, align 8
  br label %74

74:                                               ; preds = %49, %24
  %75 = load double, ptr %7, align 8
  ret double %75
}

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 nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @jacobian_dzdh_contact(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5) local_unnamed_addr #0 {
  %7 = fdiv double %0, %1
  %square26 = fmul double %7, %7
  %8 = fadd double %square26, 1.000000e+00
  %sqrt28 = tail call double @llvm.sqrt.f64(double %8)
  %9 = fadd double %sqrt28, -1.000000e+00
  %10 = fdiv double %square26, %sqrt28
  %11 = fsub double %9, %10
  %.0 = fdiv double %11, %2
  ret double %.0
}

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

attributes #0 = { 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 #1 = { 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,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass