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

; 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_dxdh_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 %74

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 = fadd double %27, %33
  %35 = call double @log(double noundef %34) #3
  %36 = load double, ptr %10, align 8, !tbaa !5
  %37 = fdiv double %35, %36
  %38 = load double, ptr %8, align 8, !tbaa !5
  %39 = load double, ptr %9, align 8, !tbaa !5
  %40 = fdiv double %38, %39
  %41 = load double, ptr %8, align 8, !tbaa !5
  %42 = load double, ptr %9, align 8, !tbaa !5
  %43 = fdiv double %41, %42
  %44 = load double, ptr %8, align 8, !tbaa !5
  %45 = load double, ptr %9, align 8, !tbaa !5
  %46 = fdiv double %44, %45
  %47 = fmul double %43, %46
  %48 = load double, ptr %8, align 8, !tbaa !5
  %49 = load double, ptr %9, align 8, !tbaa !5
  %50 = fdiv double %48, %49
  %51 = call double @pow(double noundef %50, double noundef 2.000000e+00) #3
  %52 = fadd double 1.000000e+00, %51
  %53 = call double @sqrt(double noundef %52) #3
  %54 = fdiv double %47, %53
  %55 = fadd double %40, %54
  %56 = load double, ptr %8, align 8, !tbaa !5
  %57 = load double, ptr %9, align 8, !tbaa !5
  %58 = fdiv double %56, %57
  %59 = load double, ptr %8, align 8, !tbaa !5
  %60 = load double, ptr %9, align 8, !tbaa !5
  %61 = fdiv double %59, %60
  %62 = call double @pow(double noundef %61, double noundef 2.000000e+00) #3
  %63 = fadd double 1.000000e+00, %62
  %64 = call double @sqrt(double noundef %63) #3
  %65 = fadd double %58, %64
  %66 = fdiv double %55, %65
  %67 = load double, ptr %10, align 8, !tbaa !5
  %68 = fdiv double %66, %67
  %69 = fsub double %37, %68
  %70 = load double, ptr %11, align 8, !tbaa !5
  %71 = load double, ptr %12, align 8, !tbaa !5
  %72 = fdiv double %70, %71
  %73 = fadd double %69, %72
  store double %73, ptr %7, align 8
  br label %138

74:                                               ; preds = %6
  %75 = load double, ptr %8, align 8, !tbaa !5
  %76 = load double, ptr %9, align 8, !tbaa !5
  %77 = fdiv double %75, %76
  %78 = load double, ptr %8, align 8, !tbaa !5
  %79 = load double, ptr %9, align 8, !tbaa !5
  %80 = fdiv double %78, %79
  %81 = call double @pow(double noundef %80, double noundef 2.000000e+00) #3
  %82 = fadd double 1.000000e+00, %81
  %83 = call double @sqrt(double noundef %82) #3
  %84 = fadd double %77, %83
  %85 = call double @log(double noundef %84) #3
  %86 = load double, ptr %10, align 8, !tbaa !5
  %87 = fdiv double %85, %86
  %88 = load double, ptr %8, align 8, !tbaa !5
  %89 = load double, ptr %9, align 8, !tbaa !5
  %90 = fdiv double %88, %89
  %91 = load double, ptr %8, align 8, !tbaa !5
  %92 = load double, ptr %9, align 8, !tbaa !5
  %93 = fdiv double %91, %92
  %94 = load double, ptr %8, align 8, !tbaa !5
  %95 = load double, ptr %9, align 8, !tbaa !5
  %96 = fdiv double %94, %95
  %97 = fmul double %93, %96
  %98 = load double, ptr %8, align 8, !tbaa !5
  %99 = load double, ptr %9, align 8, !tbaa !5
  %100 = fdiv double %98, %99
  %101 = call double @pow(double noundef %100, double noundef 2.000000e+00) #3
  %102 = fadd double 1.000000e+00, %101
  %103 = call double @sqrt(double noundef %102) #3
  %104 = fdiv double %97, %103
  %105 = fadd double %90, %104
  %106 = load double, ptr %8, align 8, !tbaa !5
  %107 = load double, ptr %9, align 8, !tbaa !5
  %108 = fdiv double %106, %107
  %109 = load double, ptr %8, align 8, !tbaa !5
  %110 = load double, ptr %9, align 8, !tbaa !5
  %111 = fdiv double %109, %110
  %112 = call double @pow(double noundef %111, double noundef 2.000000e+00) #3
  %113 = fadd double 1.000000e+00, %112
  %114 = call double @sqrt(double noundef %113) #3
  %115 = fadd double %108, %114
  %116 = fdiv double %105, %115
  %117 = load double, ptr %10, align 8, !tbaa !5
  %118 = fdiv double %116, %117
  %119 = fsub double %87, %118
  %120 = load double, ptr %11, align 8, !tbaa !5
  %121 = load double, ptr %12, align 8, !tbaa !5
  %122 = fdiv double %120, %121
  %123 = fadd double %119, %122
  %124 = load double, ptr %11, align 8, !tbaa !5
  %125 = load double, ptr %8, align 8, !tbaa !5
  %126 = load double, ptr %10, align 8, !tbaa !5
  %127 = fdiv double %125, %126
  %128 = fsub double %124, %127
  %129 = load double, ptr %9, align 8, !tbaa !5
  %130 = load double, ptr %10, align 8, !tbaa !5
  %131 = fdiv double %129, %130
  %132 = load double, ptr %13, align 8, !tbaa !5
  %133 = fdiv double %131, %132
  %134 = fsub double %128, %133
  %135 = load double, ptr %12, align 8, !tbaa !5
  %136 = fdiv double %134, %135
  %137 = fsub double %123, %136
  store double %137, ptr %7, align 8
  br label %138

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

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 nounwind willreturn memory(write)
declare double @log(double noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local double @jacobian_dxdh_contact(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5) local_unnamed_addr #2 {
  %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
  %square56 = fmul double %12, %12
  %13 = fadd double %square56, 1.000000e+00
  %sqrt60 = tail call double @llvm.sqrt.f64(double %13)
  %14 = fadd double %12, %sqrt60
  %15 = tail call double @log(double noundef %14) #4
  %16 = fdiv double %square56, %sqrt60
  %17 = fadd double %12, %16
  %18 = fdiv double %17, %14
  %19 = fdiv double %18, %2
  %20 = insertelement <2 x double> poison, double %3, i64 0
  %21 = insertelement <2 x double> %20, double %15, i64 1
  %22 = insertelement <2 x double> poison, double %4, i64 0
  %23 = insertelement <2 x double> %22, double %2, i64 1
  %24 = fdiv <2 x double> %21, %23
  %25 = extractelement <2 x double> %24, i64 1
  %26 = fsub double %25, %19
  %27 = extractelement <2 x double> %24, i64 0
  %28 = fadd double %27, %26
  br i1 %11, label %42, label %29

29:                                               ; preds = %6
  %30 = fdiv double %1, %2
  %31 = insertelement <2 x double> poison, double %0, i64 0
  %32 = insertelement <2 x double> %31, double %30, i64 1
  %33 = insertelement <2 x double> poison, double %2, i64 0
  %34 = insertelement <2 x double> %33, double %5, i64 1
  %35 = fdiv <2 x double> %32, %34
  %36 = extractelement <2 x double> %35, i64 0
  %37 = fsub double %3, %36
  %38 = extractelement <2 x double> %35, i64 1
  %39 = fsub double %37, %38
  %40 = fdiv double %39, %4
  %41 = fsub double %28, %40
  br label %42

42:                                               ; preds = %6, %29
  %.0 = phi double [ %41, %29 ], [ %28, %6 ]
  ret double %.0
}

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

attributes #0 = { mustprogress nofree nounwind willreturn memory(write) "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(write) 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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)"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass