; 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_no_contact(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4) #2 {
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  store double %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !5
  store double %2, ptr %8, align 8, !tbaa !5
  store double %3, ptr %9, align 8, !tbaa !5
  store double %4, ptr %10, align 8, !tbaa !5
  %11 = load double, ptr %6, align 8, !tbaa !5
  %12 = load double, ptr %7, align 8, !tbaa !5
  %13 = fdiv double %11, %12
  %14 = call double @pow(double noundef %13, double noundef 2.000000e+00) #3
  %15 = fadd double 1.000000e+00, %14
  %16 = call double @sqrt(double noundef %15) #3
  %17 = load double, ptr %6, align 8, !tbaa !5
  %18 = load double, ptr %8, align 8, !tbaa !5
  %19 = load double, ptr %9, align 8, !tbaa !5
  %20 = fneg double %18
  %21 = call double @llvm.fmuladd.f64(double %20, double %19, double %17)
  %22 = load double, ptr %7, align 8, !tbaa !5
  %23 = fdiv double %21, %22
  %24 = call double @pow(double noundef %23, double noundef 2.000000e+00) #3
  %25 = fadd double 1.000000e+00, %24
  %26 = call double @sqrt(double noundef %25) #3
  %27 = fsub double %16, %26
  %28 = load double, ptr %8, align 8, !tbaa !5
  %29 = fdiv double %27, %28
  %30 = load double, ptr %6, align 8, !tbaa !5
  %31 = load double, ptr %7, align 8, !tbaa !5
  %32 = fdiv double %30, %31
  %33 = call double @pow(double noundef %32, double noundef 2.000000e+00) #3
  %34 = load double, ptr %6, align 8, !tbaa !5
  %35 = load double, ptr %7, align 8, !tbaa !5
  %36 = fdiv double %34, %35
  %37 = call double @pow(double noundef %36, double noundef 2.000000e+00) #3
  %38 = fadd double 1.000000e+00, %37
  %39 = call double @sqrt(double noundef %38) #3
  %40 = fdiv double %33, %39
  %41 = load double, ptr %6, align 8, !tbaa !5
  %42 = load double, ptr %8, align 8, !tbaa !5
  %43 = load double, ptr %9, align 8, !tbaa !5
  %44 = fneg double %42
  %45 = call double @llvm.fmuladd.f64(double %44, double %43, double %41)
  %46 = load double, ptr %7, align 8, !tbaa !5
  %47 = fdiv double %45, %46
  %48 = call double @pow(double noundef %47, double noundef 2.000000e+00) #3
  %49 = load double, ptr %6, align 8, !tbaa !5
  %50 = load double, ptr %8, align 8, !tbaa !5
  %51 = load double, ptr %9, align 8, !tbaa !5
  %52 = fneg double %50
  %53 = call double @llvm.fmuladd.f64(double %52, double %51, double %49)
  %54 = load double, ptr %7, align 8, !tbaa !5
  %55 = fdiv double %53, %54
  %56 = call double @pow(double noundef %55, double noundef 2.000000e+00) #3
  %57 = fadd double 1.000000e+00, %56
  %58 = call double @sqrt(double noundef %57) #3
  %59 = fdiv double %48, %58
  %60 = fsub double %40, %59
  %61 = load double, ptr %8, align 8, !tbaa !5
  %62 = fdiv double %60, %61
  %63 = fsub double %29, %62
  ret double %63
}

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 @jacobian_dzdh_no_contact(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4) local_unnamed_addr #1 {
  %6 = fdiv double %0, %1
  %square = fmul double %6, %6
  %7 = fadd double %square, 1.000000e+00
  %sqrt27 = tail call double @llvm.sqrt.f64(double %7)
  %8 = fneg double %2
  %9 = tail call double @llvm.fmuladd.f64(double %8, double %3, double %0)
  %10 = fdiv double %9, %1
  %square20 = fmul double %10, %10
  %11 = fadd double %square20, 1.000000e+00
  %sqrt26 = tail call double @llvm.sqrt.f64(double %11)
  %12 = fdiv double %square, %sqrt27
  %13 = fdiv double %square20, %sqrt26
  %14 = insertelement <2 x double> poison, double %sqrt27, i64 0
  %15 = insertelement <2 x double> %14, double %12, i64 1
  %16 = insertelement <2 x double> poison, double %sqrt26, i64 0
  %17 = insertelement <2 x double> %16, double %13, i64 1
  %18 = fsub <2 x double> %15, %17
  %19 = insertelement <2 x double> poison, double %2, i64 0
  %20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
  %21 = fdiv <2 x double> %18, %20
  %shift = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %22 = fsub <2 x double> %21, %shift
  %23 = extractelement <2 x double> %22, i64 0
  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,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass,VectorCombinePass