; 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_dxdv_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 %61

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 = fadd double 1.000000e+00, %34
  %36 = load double, ptr %8, align 8, !tbaa !5
  %37 = load double, ptr %9, align 8, !tbaa !5
  %38 = fdiv double %36, %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 = fadd double %38, %44
  %46 = fdiv double %35, %45
  %47 = load double, ptr %10, align 8, !tbaa !5
  %48 = fdiv double %46, %47
  %49 = load double, ptr %13, align 8, !tbaa !5
  %50 = load double, ptr %12, align 8, !tbaa !5
  %51 = fdiv double %49, %50
  %52 = load double, ptr %11, align 8, !tbaa !5
  %53 = load double, ptr %8, align 8, !tbaa !5
  %54 = load double, ptr %10, align 8, !tbaa !5
  %55 = fdiv double %53, %54
  %56 = fsub double %52, %55
  %57 = call double @llvm.fmuladd.f64(double %51, double %56, double %48)
  %58 = load double, ptr %10, align 8, !tbaa !5
  %59 = fdiv double 1.000000e+00, %58
  %60 = fsub double %57, %59
  store double %60, ptr %7, align 8
  br label %95

61:                                               ; preds = %6
  %62 = load double, ptr %8, align 8, !tbaa !5
  %63 = load double, ptr %9, align 8, !tbaa !5
  %64 = fdiv double %62, %63
  %65 = load double, ptr %8, align 8, !tbaa !5
  %66 = load double, ptr %9, align 8, !tbaa !5
  %67 = fdiv double %65, %66
  %68 = call double @pow(double noundef %67, double noundef 2.000000e+00) #3
  %69 = fadd double 1.000000e+00, %68
  %70 = call double @sqrt(double noundef %69) #3
  %71 = fdiv double %64, %70
  %72 = fadd double 1.000000e+00, %71
  %73 = load double, ptr %8, align 8, !tbaa !5
  %74 = load double, ptr %9, align 8, !tbaa !5
  %75 = fdiv double %73, %74
  %76 = load double, ptr %8, align 8, !tbaa !5
  %77 = load double, ptr %9, align 8, !tbaa !5
  %78 = fdiv double %76, %77
  %79 = call double @pow(double noundef %78, double noundef 2.000000e+00) #3
  %80 = fadd double 1.000000e+00, %79
  %81 = call double @sqrt(double noundef %80) #3
  %82 = fadd double %75, %81
  %83 = fdiv double %72, %82
  %84 = load double, ptr %10, align 8, !tbaa !5
  %85 = fdiv double %83, %84
  %86 = load double, ptr %9, align 8, !tbaa !5
  %87 = load double, ptr %10, align 8, !tbaa !5
  %88 = load double, ptr %12, align 8, !tbaa !5
  %89 = fmul double %87, %88
  %90 = fdiv double %86, %89
  %91 = fadd double %85, %90
  %92 = load double, ptr %10, align 8, !tbaa !5
  %93 = fdiv double 1.000000e+00, %92
  %94 = fsub double %91, %93
  store double %94, ptr %7, align 8
  br label %95

95:                                               ; preds = %61, %24
  %96 = load double, ptr %7, align 8
  ret double %96
}

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_dxdv_contact(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5) local_unnamed_addr #1 {
  %7 = fneg double %5
  %8 = fneg double %2
  %9 = tail call double @llvm.fmuladd.f64(double %8, double %3, double %0)
  %10 = fmul double %9, %7
  %11 = fcmp olt double %10, %1
  %12 = fdiv double %0, %1
  %square36 = fmul double %12, %12
  %13 = fadd double %square36, 1.000000e+00
  %sqrt38 = tail call double @llvm.sqrt.f64(double %13)
  %14 = fdiv double %12, %sqrt38
  %15 = fadd double %14, 1.000000e+00
  %16 = fadd double %12, %sqrt38
  %17 = fdiv double %15, %16
  %18 = fdiv double %17, %2
  br i1 %11, label %19, label %24

19:                                               ; preds = %6
  %20 = fdiv double %5, %4
  %21 = fdiv double %0, %2
  %22 = fsub double %3, %21
  %23 = tail call double @llvm.fmuladd.f64(double %20, double %22, double %18)
  br label %28

24:                                               ; preds = %6
  %25 = fmul double %2, %4
  %26 = fdiv double %1, %25
  %27 = fadd double %26, %18
  br label %28

28:                                               ; preds = %24, %19
  %.sink = phi double [ %27, %24 ], [ %23, %19 ]
  %29 = fdiv double 1.000000e+00, %2
  %30 = fsub double %.sink, %29
  ret double %30
}

; 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,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass