; 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_dzdv_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 %43

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 = load double, ptr %8, align 8, !tbaa !5
  %29 = load double, ptr %9, align 8, !tbaa !5
  %30 = fdiv double %28, %29
  %31 = call double @pow(double noundef %30, double noundef 2.000000e+00) #3
  %32 = fadd double 1.000000e+00, %31
  %33 = call double @sqrt(double noundef %32) #3
  %34 = fdiv double %27, %33
  %35 = load double, ptr %10, align 8, !tbaa !5
  %36 = fdiv double %34, %35
  %37 = load double, ptr %8, align 8, !tbaa !5
  %38 = load double, ptr %10, align 8, !tbaa !5
  %39 = load double, ptr %12, align 8, !tbaa !5
  %40 = fmul double %38, %39
  %41 = fdiv double %37, %40
  %42 = fadd double %36, %41
  store double %42, ptr %7, align 8
  br label %62

43:                                               ; preds = %6
  %44 = load double, ptr %8, align 8, !tbaa !5
  %45 = load double, ptr %9, align 8, !tbaa !5
  %46 = fdiv double %44, %45
  %47 = load double, ptr %8, align 8, !tbaa !5
  %48 = load double, ptr %9, align 8, !tbaa !5
  %49 = fdiv double %47, %48
  %50 = call double @pow(double noundef %49, double noundef 2.000000e+00) #3
  %51 = fadd double 1.000000e+00, %50
  %52 = call double @sqrt(double noundef %51) #3
  %53 = fdiv double %46, %52
  %54 = load double, ptr %10, align 8, !tbaa !5
  %55 = fdiv double %53, %54
  %56 = load double, ptr %8, align 8, !tbaa !5
  %57 = load double, ptr %10, align 8, !tbaa !5
  %58 = load double, ptr %12, align 8, !tbaa !5
  %59 = fmul double %57, %58
  %60 = fdiv double %56, %59
  %61 = fadd double %55, %60
  store double %61, ptr %7, align 8
  br label %62

62:                                               ; preds = %43, %24
  %63 = load double, ptr %7, align 8
  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 nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @jacobian_dzdv_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
  %square23 = fmul double %7, %7
  %8 = fadd double %square23, 1.000000e+00
  %sqrt = tail call double @llvm.sqrt.f64(double %8)
  %9 = fdiv double %7, %sqrt
  %10 = fmul double %2, %4
  %11 = insertelement <2 x double> poison, double %0, i64 0
  %12 = insertelement <2 x double> %11, double %9, i64 1
  %13 = insertelement <2 x double> poison, double %10, i64 0
  %14 = insertelement <2 x double> %13, double %2, i64 1
  %15 = fdiv <2 x double> %12, %14
  %shift = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %16 = fadd <2 x double> %15, %shift
  %17 = extractelement <2 x double> %16, i64 0
  ret double %17
}

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