; 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.14 = external hidden unnamed_addr constant [25 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 @SMcomputeAreaLengthRatio(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 double, align 8
  %26 = alloca double, align 8
  %27 = alloca double, align 8
  %28 = alloca double, align 8
  %29 = alloca double, align 8
  %30 = alloca double, align 8
  %31 = 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #5
  %32 = load ptr, ptr %7, 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 %25, align 8, !tbaa !9
  %35 = load ptr, ptr %7, 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 %28, align 8, !tbaa !9
  %38 = load ptr, ptr %8, 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 %26, align 8, !tbaa !9
  %41 = load ptr, ptr %8, 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 %29, align 8, !tbaa !9
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = getelementptr inbounds double, ptr %44, i64 0
  %46 = load double, ptr %45, align 8, !tbaa !9
  store double %46, ptr %27, align 8, !tbaa !9
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = getelementptr inbounds double, ptr %47, i64 1
  %49 = load double, ptr %48, align 8, !tbaa !9
  store double %49, ptr %30, align 8, !tbaa !9
  %50 = load double, ptr %26, align 8, !tbaa !9
  %51 = load double, ptr %27, align 8, !tbaa !9
  %52 = fsub double %50, %51
  store double %52, ptr %19, align 8, !tbaa !9
  %53 = load double, ptr %29, align 8, !tbaa !9
  %54 = load double, ptr %30, align 8, !tbaa !9
  %55 = fsub double %53, %54
  store double %55, ptr %22, align 8, !tbaa !9
  %56 = load double, ptr %25, align 8, !tbaa !9
  %57 = load double, ptr %27, align 8, !tbaa !9
  %58 = fsub double %56, %57
  store double %58, ptr %20, align 8, !tbaa !9
  %59 = load double, ptr %28, align 8, !tbaa !9
  %60 = load double, ptr %30, align 8, !tbaa !9
  %61 = fsub double %59, %60
  store double %61, ptr %23, align 8, !tbaa !9
  %62 = load double, ptr %25, align 8, !tbaa !9
  %63 = load double, ptr %26, align 8, !tbaa !9
  %64 = fsub double %62, %63
  store double %64, ptr %21, align 8, !tbaa !9
  %65 = load double, ptr %28, align 8, !tbaa !9
  %66 = load double, ptr %29, align 8, !tbaa !9
  %67 = fsub double %65, %66
  store double %67, ptr %24, align 8, !tbaa !9
  %68 = load double, ptr %19, align 8, !tbaa !9
  %69 = load double, ptr %19, align 8, !tbaa !9
  %70 = load double, ptr %22, align 8, !tbaa !9
  %71 = load double, ptr %22, align 8, !tbaa !9
  %72 = fmul double %70, %71
  %73 = call double @llvm.fmuladd.f64(double %68, double %69, double %72)
  store double %73, ptr %16, align 8, !tbaa !9
  %74 = load double, ptr %20, align 8, !tbaa !9
  %75 = load double, ptr %20, align 8, !tbaa !9
  %76 = load double, ptr %23, align 8, !tbaa !9
  %77 = load double, ptr %23, align 8, !tbaa !9
  %78 = fmul double %76, %77
  %79 = call double @llvm.fmuladd.f64(double %74, double %75, double %78)
  store double %79, ptr %17, align 8, !tbaa !9
  %80 = load double, ptr %21, align 8, !tbaa !9
  %81 = load double, ptr %21, align 8, !tbaa !9
  %82 = load double, ptr %24, align 8, !tbaa !9
  %83 = load double, ptr %24, align 8, !tbaa !9
  %84 = fmul double %82, %83
  %85 = call double @llvm.fmuladd.f64(double %80, double %81, double %84)
  store double %85, ptr %18, align 8, !tbaa !9
  %86 = load double, ptr %16, align 8, !tbaa !9
  %87 = load double, ptr %17, align 8, !tbaa !9
  %88 = fadd double %86, %87
  %89 = load double, ptr %18, align 8, !tbaa !9
  %90 = fadd double %88, %89
  %91 = fcmp olt double %90, 1.000000e-15
  br i1 %91, label %92, label %94

92:                                               ; preds = %5
  %93 = call i32 @SMerror(i32 noundef 382, ptr noundef @.str.14, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 57, i32 noundef 0, ptr noundef @.str.3)
  store i32 %93, ptr %6, align 4
  store i32 1, ptr %31, align 4
  br label %133

94:                                               ; preds = %5
  %95 = load double, ptr %26, align 8, !tbaa !9
  %96 = load double, ptr %30, align 8, !tbaa !9
  %97 = load double, ptr %27, align 8, !tbaa !9
  %98 = load double, ptr %29, align 8, !tbaa !9
  %99 = fmul double %97, %98
  %100 = fneg double %99
  %101 = call double @llvm.fmuladd.f64(double %95, double %96, double %100)
  store double %101, ptr %13, align 8, !tbaa !9
  %102 = load double, ptr %29, align 8, !tbaa !9
  %103 = load double, ptr %30, align 8, !tbaa !9
  %104 = fsub double %102, %103
  store double %104, ptr %14, align 8, !tbaa !9
  %105 = load double, ptr %27, align 8, !tbaa !9
  %106 = load double, ptr %26, align 8, !tbaa !9
  %107 = fsub double %105, %106
  store double %107, ptr %15, align 8, !tbaa !9
  %108 = load double, ptr %13, align 8, !tbaa !9
  %109 = load double, ptr %14, align 8, !tbaa !9
  %110 = load double, ptr %25, align 8, !tbaa !9
  %111 = call double @llvm.fmuladd.f64(double %109, double %110, double %108)
  %112 = load double, ptr %15, align 8, !tbaa !9
  %113 = load double, ptr %28, align 8, !tbaa !9
  %114 = call double @llvm.fmuladd.f64(double %112, double %113, double %111)
  %115 = fmul double 5.000000e-01, %114
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = getelementptr inbounds double, ptr %116, i64 0
  store double %115, ptr %117, align 8, !tbaa !9
  %118 = call double @sqrt(double noundef 3.000000e+00) #5
  %119 = fdiv double 1.200000e+01, %118
  %120 = load ptr, ptr %10, align 8, !tbaa !5
  %121 = getelementptr inbounds double, ptr %120, i64 0
  %122 = load double, ptr %121, align 8, !tbaa !9
  %123 = fmul double %119, %122
  %124 = load double, ptr %16, align 8, !tbaa !9
  %125 = load double, ptr %17, align 8, !tbaa !9
  %126 = fadd double %124, %125
  %127 = load double, ptr %18, align 8, !tbaa !9
  %128 = fadd double %126, %127
  %129 = fdiv double %123, %128
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  %131 = getelementptr inbounds double, ptr %130, i64 0
  store double %129, ptr %131, align 8, !tbaa !9
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 1, ptr %132, align 4, !tbaa !11
  store i32 0, ptr %12, align 4, !tbaa !11
  store i32 0, ptr %6, align 4
  store i32 1, ptr %31, align 4
  br label %133

133:                                              ; preds = %94, %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #5
  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
  %134 = load i32, ptr %6, align 4
  ret i32 %134
}

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.14 = external hidden unnamed_addr constant [25 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 @SMcomputeAreaLengthRatio(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 %6, %9
  %16 = fsub double %8, %11
  %17 = insertelement <2 x double> poison, double %9, i64 0
  %18 = insertelement <2 x double> %17, double %6, i64 1
  %19 = insertelement <2 x double> poison, double %12, i64 0
  %20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
  %21 = fsub <2 x double> %18, %20
  %22 = insertelement <2 x double> poison, double %11, i64 0
  %23 = insertelement <2 x double> %22, double %8, i64 1
  %24 = insertelement <2 x double> poison, double %14, i64 0
  %25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> zeroinitializer
  %26 = fsub <2 x double> %23, %25
  %27 = fmul <2 x double> %26, %26
  %28 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> %21, <2 x double> %27)
  %29 = fmul double %16, %16
  %30 = tail call double @llvm.fmuladd.f64(double %15, double %15, double %29)
  %shift = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %31 = fadd <2 x double> %28, %shift
  %32 = extractelement <2 x double> %31, i64 0
  %33 = fadd double %30, %32
  %34 = fcmp olt double %33, 1.000000e-15
  br i1 %34, label %35, label %37

35:                                               ; preds = %5
  %36 = tail call i32 @SMerror(i32 noundef 382, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 57, i32 noundef 0, ptr noundef nonnull @.str.3) #4
  br label %48

37:                                               ; preds = %5
  %38 = fneg double %12
  %39 = fmul double %11, %38
  %40 = tail call double @llvm.fmuladd.f64(double %9, double %14, double %39)
  %41 = fsub double %12, %9
  %42 = extractelement <2 x double> %26, i64 0
  %43 = tail call double @llvm.fmuladd.f64(double %42, double %6, double %40)
  %44 = tail call double @llvm.fmuladd.f64(double %41, double %8, double %43)
  %45 = fmul double %44, 5.000000e-01
  %46 = fmul double %45, 0x401BB67AE8584CAB
  %47 = fdiv double %46, %33
  store double %47, ptr %3, align 8, !tbaa !5
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %37, %35
  %.0 = phi i32 [ %36, %35 ], [ 0, %37 ]
  ret i32 %.0
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x 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: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass,VectorCombinePass