; LLVM IR from sourceryinstitute/MORFEUS-Source :: src/FV/src/mesh_optimize/OptMS (SMfunc2d)

; 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"

@.str.1 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

declare i32 @SMerror(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @SMcomputeInteriorScaledTriJacobians(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #4 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  %23 = alloca double, align 8
  %24 = alloca double, align 8
  %25 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds double, ptr %26, i64 0
  %28 = load double, ptr %27, align 8, !tbaa !9
  store double %28, ptr %19, align 8, !tbaa !9
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds double, ptr %29, i64 1
  %31 = load double, ptr %30, align 8, !tbaa !9
  store double %31, ptr %22, align 8, !tbaa !9
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = getelementptr inbounds double, ptr %32, i64 0
  %34 = load double, ptr %33, align 8, !tbaa !9
  store double %34, ptr %20, align 8, !tbaa !9
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds double, ptr %35, i64 1
  %37 = load double, ptr %36, align 8, !tbaa !9
  store double %37, ptr %23, align 8, !tbaa !9
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = getelementptr inbounds double, ptr %38, i64 0
  %40 = load double, ptr %39, align 8, !tbaa !9
  store double %40, ptr %21, align 8, !tbaa !9
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = getelementptr inbounds double, ptr %41, i64 1
  %43 = load double, ptr %42, align 8, !tbaa !9
  store double %43, ptr %24, align 8, !tbaa !9
  %44 = load double, ptr %20, align 8, !tbaa !9
  %45 = load double, ptr %21, align 8, !tbaa !9
  %46 = fsub double %44, %45
  %47 = load double, ptr %20, align 8, !tbaa !9
  %48 = load double, ptr %21, align 8, !tbaa !9
  %49 = fsub double %47, %48
  %50 = load double, ptr %23, align 8, !tbaa !9
  %51 = load double, ptr %24, align 8, !tbaa !9
  %52 = fsub double %50, %51
  %53 = load double, ptr %23, align 8, !tbaa !9
  %54 = load double, ptr %24, align 8, !tbaa !9
  %55 = fsub double %53, %54
  %56 = fmul double %52, %55
  %57 = call double @llvm.fmuladd.f64(double %46, double %49, double %56)
  %58 = call double @sqrt(double noundef %57) #5
  store double %58, ptr %16, align 8, !tbaa !9
  %59 = load double, ptr %19, align 8, !tbaa !9
  %60 = load double, ptr %21, align 8, !tbaa !9
  %61 = fsub double %59, %60
  %62 = load double, ptr %19, align 8, !tbaa !9
  %63 = load double, ptr %21, align 8, !tbaa !9
  %64 = fsub double %62, %63
  %65 = load double, ptr %22, align 8, !tbaa !9
  %66 = load double, ptr %24, align 8, !tbaa !9
  %67 = fsub double %65, %66
  %68 = load double, ptr %22, align 8, !tbaa !9
  %69 = load double, ptr %24, align 8, !tbaa !9
  %70 = fsub double %68, %69
  %71 = fmul double %67, %70
  %72 = call double @llvm.fmuladd.f64(double %61, double %64, double %71)
  %73 = call double @sqrt(double noundef %72) #5
  store double %73, ptr %17, align 8, !tbaa !9
  %74 = load double, ptr %20, align 8, !tbaa !9
  %75 = load double, ptr %19, align 8, !tbaa !9
  %76 = fsub double %74, %75
  %77 = load double, ptr %20, align 8, !tbaa !9
  %78 = load double, ptr %19, align 8, !tbaa !9
  %79 = fsub double %77, %78
  %80 = load double, ptr %23, align 8, !tbaa !9
  %81 = load double, ptr %22, align 8, !tbaa !9
  %82 = fsub double %80, %81
  %83 = load double, ptr %23, align 8, !tbaa !9
  %84 = load double, ptr %22, align 8, !tbaa !9
  %85 = fsub double %83, %84
  %86 = fmul double %82, %85
  %87 = call double @llvm.fmuladd.f64(double %76, double %79, double %86)
  %88 = call double @sqrt(double noundef %87) #5
  store double %88, ptr %18, align 8, !tbaa !9
  %89 = load double, ptr %17, align 8, !tbaa !9
  %90 = fcmp olt double %89, 1.000000e-15
  br i1 %90, label %91, label %93

91:                                               ; preds = %5
  %92 = call i32 @SMerror(i32 noundef 342, ptr noundef @.str.13, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 57, i32 noundef 0, ptr noundef @.str.3)
  store i32 %92, ptr %6, align 4
  store i32 1, ptr %25, align 4
  br label %131

93:                                               ; preds = %5
  %94 = load double, ptr %18, align 8, !tbaa !9
  %95 = fcmp olt double %94, 1.000000e-15
  br i1 %95, label %96, label %98

96:                                               ; preds = %93
  %97 = call i32 @SMerror(i32 noundef 343, ptr noundef @.str.13, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 57, i32 noundef 0, ptr noundef @.str.3)
  store i32 %97, ptr %6, align 4
  store i32 1, ptr %25, align 4
  br label %131

98:                                               ; preds = %93
  %99 = load double, ptr %20, align 8, !tbaa !9
  %100 = load double, ptr %24, align 8, !tbaa !9
  %101 = load double, ptr %21, align 8, !tbaa !9
  %102 = load double, ptr %23, align 8, !tbaa !9
  %103 = fmul double %101, %102
  %104 = fneg double %103
  %105 = call double @llvm.fmuladd.f64(double %99, double %100, double %104)
  store double %105, ptr %13, align 8, !tbaa !9
  %106 = load double, ptr %23, align 8, !tbaa !9
  %107 = load double, ptr %24, align 8, !tbaa !9
  %108 = fsub double %106, %107
  store double %108, ptr %14, align 8, !tbaa !9
  %109 = load double, ptr %21, align 8, !tbaa !9
  %110 = load double, ptr %20, align 8, !tbaa !9
  %111 = fsub double %109, %110
  store double %111, ptr %15, align 8, !tbaa !9
  %112 = load double, ptr %13, align 8, !tbaa !9
  %113 = load double, ptr %14, align 8, !tbaa !9
  %114 = load double, ptr %19, align 8, !tbaa !9
  %115 = call double @llvm.fmuladd.f64(double %113, double %114, double %112)
  %116 = load double, ptr %15, align 8, !tbaa !9
  %117 = load double, ptr %22, align 8, !tbaa !9
  %118 = call double @llvm.fmuladd.f64(double %116, double %117, double %115)
  %119 = load ptr, ptr %10, align 8, !tbaa !5
  %120 = getelementptr inbounds double, ptr %119, i64 0
  store double %118, ptr %120, align 8, !tbaa !9
  %121 = load ptr, ptr %10, align 8, !tbaa !5
  %122 = getelementptr inbounds double, ptr %121, i64 0
  %123 = load double, ptr %122, align 8, !tbaa !9
  %124 = load double, ptr %17, align 8, !tbaa !9
  %125 = load double, ptr %18, align 8, !tbaa !9
  %126 = fmul double %124, %125
  %127 = fdiv double %123, %126
  %128 = load ptr, ptr %10, align 8, !tbaa !5
  %129 = getelementptr inbounds double, ptr %128, i64 0
  store double %127, ptr %129, align 8, !tbaa !9
  %130 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 1, ptr %130, align 4, !tbaa !11
  store i32 0, ptr %12, align 4, !tbaa !11
  store i32 0, ptr %6, align 4
  store i32 1, ptr %25, align 4
  br label %131

131:                                              ; preds = %98, %96, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %132 = load i32, ptr %6, align 4
  ret i32 %132
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { "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 "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 #4 = { 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 #5 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


; 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"

@.str.1 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [36 x i8], align 1

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

declare i32 @SMerror(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @SMcomputeInteriorScaledTriJacobians(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #2 {
  %6 = load double, ptr %0, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load double, ptr %7, align 8, !tbaa !5
  %9 = load double, ptr %1, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = load double, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %2, i64 8
  %14 = load double, ptr %13, align 8, !tbaa !5
  %15 = fsub double %11, %14
  %16 = fsub double %6, %12
  %17 = fsub double %8, %14
  %18 = fmul double %17, %17
  %19 = tail call double @llvm.fmuladd.f64(double %16, double %16, double %18)
  %sqrt53 = tail call double @llvm.sqrt.f64(double %19)
  %20 = fsub double %9, %6
  %21 = fsub double %11, %8
  %22 = fmul double %21, %21
  %23 = tail call double @llvm.fmuladd.f64(double %20, double %20, double %22)
  %sqrt = tail call double @llvm.sqrt.f64(double %23)
  %24 = fcmp olt double %sqrt53, 1.000000e-15
  br i1 %24, label %25, label %27

25:                                               ; preds = %5
  %26 = tail call i32 @SMerror(i32 noundef 342, ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 57, i32 noundef 0, ptr noundef nonnull @.str.3) #4
  br label %40

27:                                               ; preds = %5
  %28 = fcmp olt double %sqrt, 1.000000e-15
  br i1 %28, label %29, label %31

29:                                               ; preds = %27
  %30 = tail call i32 @SMerror(i32 noundef 343, ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 57, i32 noundef 0, ptr noundef nonnull @.str.3) #4
  br label %40

31:                                               ; preds = %27
  %32 = fneg double %12
  %33 = fmul double %11, %32
  %34 = tail call double @llvm.fmuladd.f64(double %9, double %14, double %33)
  %35 = fsub double %12, %9
  %36 = tail call double @llvm.fmuladd.f64(double %15, double %6, double %34)
  %37 = tail call double @llvm.fmuladd.f64(double %35, double %8, double %36)
  %38 = fmul double %sqrt, %sqrt53
  %39 = fdiv double %37, %38
  store double %39, ptr %3, align 8, !tbaa !5
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %31, %29, %25
  %.0 = phi i32 [ %26, %25 ], [ %30, %29 ], [ 0, %31 ]
  ret i32 %.0
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { "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 = { 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 = { 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)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


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