; LLVM IR from Samson-Mano/EM_Propogation_simulation :: EM_Propogation_simulation/src/ImGui (implot)

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

%struct.ImVec2 = type { float, float }
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #0 align 2

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZN6ImPlot14GetLocationPosERK6ImRectRK6ImVec2iS5_(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, i32 noundef %2, ptr noundef nonnull align 4 dereferenceable(8) %3) #3 {
  %5 = alloca %struct.ImVec2, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %struct.ImVec2, align 4
  %11 = alloca %struct.ImVec2, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %5)
  %12 = load i32, ptr %8, align 4, !tbaa !9
  %13 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %12, i32 noundef 4)
  br i1 %13, label %14, label %27

14:                                               ; preds = %4
  %15 = load i32, ptr %8, align 4, !tbaa !9
  %16 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %15, i32 noundef 8)
  br i1 %16, label %27, label %17

17:                                               ; preds = %14
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ImRect, ptr %18, i32 0, i32 0
  %20 = getelementptr inbounds %struct.ImVec2, ptr %19, i32 0, i32 0
  %21 = load float, ptr %20, align 4, !tbaa !11
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.ImVec2, ptr %22, i32 0, i32 0
  %24 = load float, ptr %23, align 4, !tbaa !15
  %25 = fadd float %21, %24
  %26 = getelementptr inbounds %struct.ImVec2, ptr %5, i32 0, i32 0
  store float %25, ptr %26, align 4, !tbaa !15
  br label %59

27:                                               ; preds = %14, %4
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %28, i32 noundef 4)
  br i1 %29, label %47, label %30

30:                                               ; preds = %27
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %31, i32 noundef 8)
  br i1 %32, label %33, label %47

33:                                               ; preds = %30
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ImRect, ptr %34, i32 0, i32 1
  %36 = getelementptr inbounds %struct.ImVec2, ptr %35, i32 0, i32 0
  %37 = load float, ptr %36, align 4, !tbaa !16
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ImVec2, ptr %38, i32 0, i32 0
  %40 = load float, ptr %39, align 4, !tbaa !15
  %41 = fsub float %37, %40
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ImVec2, ptr %42, i32 0, i32 0
  %44 = load float, ptr %43, align 4, !tbaa !15
  %45 = fsub float %41, %44
  %46 = getelementptr inbounds %struct.ImVec2, ptr %5, i32 0, i32 0
  store float %45, ptr %46, align 4, !tbaa !15
  br label %58

47:                                               ; preds = %30, %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = call <2 x float> @_ZNK6ImRect9GetCenterEv(ptr noundef nonnull align 4 dereferenceable(16) %48)
  store <2 x float> %49, ptr %10, align 4
  %50 = getelementptr inbounds %struct.ImVec2, ptr %10, i32 0, i32 0
  %51 = load float, ptr %50, align 4, !tbaa !15
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ImVec2, ptr %52, i32 0, i32 0
  %54 = load float, ptr %53, align 4, !tbaa !15
  %55 = fneg float %54
  %56 = call float @llvm.fmuladd.f32(float %55, float 5.000000e-01, float %51)
  %57 = getelementptr inbounds %struct.ImVec2, ptr %5, i32 0, i32 0
  store float %56, ptr %57, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %58

58:                                               ; preds = %47, %33
  br label %59

59:                                               ; preds = %58, %17
  %60 = load i32, ptr %8, align 4, !tbaa !9
  %61 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %60, i32 noundef 1)
  br i1 %61, label %62, label %75

62:                                               ; preds = %59
  %63 = load i32, ptr %8, align 4, !tbaa !9
  %64 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %63, i32 noundef 2)
  br i1 %64, label %75, label %65

65:                                               ; preds = %62
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.ImRect, ptr %66, i32 0, i32 0
  %68 = getelementptr inbounds %struct.ImVec2, ptr %67, i32 0, i32 1
  %69 = load float, ptr %68, align 4, !tbaa !17
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.ImVec2, ptr %70, i32 0, i32 1
  %72 = load float, ptr %71, align 4, !tbaa !18
  %73 = fadd float %69, %72
  %74 = getelementptr inbounds %struct.ImVec2, ptr %5, i32 0, i32 1
  store float %73, ptr %74, align 4, !tbaa !18
  br label %107

75:                                               ; preds = %62, %59
  %76 = load i32, ptr %8, align 4, !tbaa !9
  %77 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %76, i32 noundef 1)
  br i1 %77, label %95, label %78

78:                                               ; preds = %75
  %79 = load i32, ptr %8, align 4, !tbaa !9
  %80 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %79, i32 noundef 2)
  br i1 %80, label %81, label %95

81:                                               ; preds = %78
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.ImRect, ptr %82, i32 0, i32 1
  %84 = getelementptr inbounds %struct.ImVec2, ptr %83, i32 0, i32 1
  %85 = load float, ptr %84, align 4, !tbaa !19
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.ImVec2, ptr %86, i32 0, i32 1
  %88 = load float, ptr %87, align 4, !tbaa !18
  %89 = fsub float %85, %88
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.ImVec2, ptr %90, i32 0, i32 1
  %92 = load float, ptr %91, align 4, !tbaa !18
  %93 = fsub float %89, %92
  %94 = getelementptr inbounds %struct.ImVec2, ptr %5, i32 0, i32 1
  store float %93, ptr %94, align 4, !tbaa !18
  br label %106

95:                                               ; preds = %78, %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = call <2 x float> @_ZNK6ImRect9GetCenterEv(ptr noundef nonnull align 4 dereferenceable(16) %96)
  store <2 x float> %97, ptr %11, align 4
  %98 = getelementptr inbounds %struct.ImVec2, ptr %11, i32 0, i32 1
  %99 = load float, ptr %98, align 4, !tbaa !18
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.ImVec2, ptr %100, i32 0, i32 1
  %102 = load float, ptr %101, align 4, !tbaa !18
  %103 = fneg float %102
  %104 = call float @llvm.fmuladd.f32(float %103, float 5.000000e-01, float %99)
  %105 = getelementptr inbounds %struct.ImVec2, ptr %5, i32 0, i32 1
  store float %104, ptr %105, align 4, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %106

106:                                              ; preds = %95, %81
  br label %107

107:                                              ; preds = %106, %65
  %108 = getelementptr inbounds %struct.ImVec2, ptr %5, i32 0, i32 0
  %109 = load float, ptr %108, align 4, !tbaa !15
  %110 = fadd float %109, 5.000000e-01
  %111 = fptosi float %110 to i32
  %112 = sitofp i32 %111 to float
  %113 = getelementptr inbounds %struct.ImVec2, ptr %5, i32 0, i32 0
  store float %112, ptr %113, align 4, !tbaa !15
  %114 = getelementptr inbounds %struct.ImVec2, ptr %5, i32 0, i32 1
  %115 = load float, ptr %114, align 4, !tbaa !18
  %116 = fadd float %115, 5.000000e-01
  %117 = fptosi float %116 to i32
  %118 = sitofp i32 %117 to float
  %119 = getelementptr inbounds %struct.ImVec2, ptr %5, i32 0, i32 1
  store float %118, ptr %119, align 4, !tbaa !18
  %120 = load <2 x float>, ptr %5, align 4
  ret <2 x float> %120
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef, i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_ZNK6ImRect9GetCenterEv(ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

attributes #0 = { mustprogress 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { inlinehint mustprogress 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !14, i64 0}
!12 = !{!"_ZTS6ImRect", !13, i64 0, !13, i64 8}
!13 = !{!"_ZTS6ImVec2", !14, i64 0, !14, i64 4}
!14 = !{!"float", !7, i64 0}
!15 = !{!13, !14, i64 0}
!16 = !{!12, !14, i64 8}
!17 = !{!12, !14, i64 4}
!18 = !{!13, !14, i64 4}
!19 = !{!12, !14, i64 12}


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

%struct.ImVec2 = type { float, float }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZN6ImPlot14GetLocationPosERK6ImRectRK6ImVec2iS5_(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(8) %1, i32 noundef %2, ptr nocapture noundef nonnull readonly align 4 dereferenceable(8) %3) local_unnamed_addr #2 {
  %5 = alloca %struct.ImVec2, align 8
  call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %5)
  %6 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %2, i32 noundef 4)
  br i1 %6, label %7, label %13

7:                                                ; preds = %4
  %8 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %2, i32 noundef 8)
  br i1 %8, label %13, label %9

9:                                                ; preds = %7
  %10 = load float, ptr %0, align 4, !tbaa !5
  %11 = load float, ptr %3, align 4, !tbaa !11
  %12 = fadd float %10, %11
  store float %12, ptr %5, align 8, !tbaa !11
  br label %29

13:                                               ; preds = %7, %4
  %14 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %2, i32 noundef 4)
  br i1 %14, label %24, label %15

15:                                               ; preds = %13
  %16 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %2, i32 noundef 8)
  br i1 %16, label %17, label %24

17:                                               ; preds = %15
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = load float, ptr %18, align 4, !tbaa !12
  %20 = load float, ptr %3, align 4, !tbaa !11
  %21 = fsub float %19, %20
  %22 = load float, ptr %1, align 4, !tbaa !11
  %23 = fsub float %21, %22
  store float %23, ptr %5, align 8, !tbaa !11
  br label %29

24:                                               ; preds = %15, %13
  %25 = call <2 x float> @_ZNK6ImRect9GetCenterEv(ptr noundef nonnull align 4 dereferenceable(16) %0)
  %.sroa.01.0.vec.extract = extractelement <2 x float> %25, i64 0
  %26 = load float, ptr %1, align 4, !tbaa !11
  %27 = fneg float %26
  %28 = call float @llvm.fmuladd.f32(float %27, float 5.000000e-01, float %.sroa.01.0.vec.extract)
  store float %28, ptr %5, align 8, !tbaa !11
  br label %29

29:                                               ; preds = %17, %24, %9
  %30 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %2, i32 noundef 1)
  br i1 %30, label %31, label %39

31:                                               ; preds = %29
  %32 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %2, i32 noundef 2)
  br i1 %32, label %39, label %33

33:                                               ; preds = %31
  %34 = getelementptr inbounds i8, ptr %0, i64 4
  %35 = load float, ptr %34, align 4, !tbaa !13
  %36 = getelementptr inbounds i8, ptr %3, i64 4
  %37 = load float, ptr %36, align 4, !tbaa !14
  %38 = fadd float %35, %37
  br label %58

39:                                               ; preds = %31, %29
  %40 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %2, i32 noundef 1)
  br i1 %40, label %52, label %41

41:                                               ; preds = %39
  %42 = call noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef %2, i32 noundef 2)
  br i1 %42, label %43, label %52

43:                                               ; preds = %41
  %44 = getelementptr inbounds i8, ptr %0, i64 12
  %45 = load float, ptr %44, align 4, !tbaa !15
  %46 = getelementptr inbounds i8, ptr %3, i64 4
  %47 = load float, ptr %46, align 4, !tbaa !14
  %48 = fsub float %45, %47
  %49 = getelementptr inbounds i8, ptr %1, i64 4
  %50 = load float, ptr %49, align 4, !tbaa !14
  %51 = fsub float %48, %50
  br label %58

52:                                               ; preds = %41, %39
  %53 = call <2 x float> @_ZNK6ImRect9GetCenterEv(ptr noundef nonnull align 4 dereferenceable(16) %0)
  %.sroa.0.4.vec.extract = extractelement <2 x float> %53, i64 1
  %54 = getelementptr inbounds i8, ptr %1, i64 4
  %55 = load float, ptr %54, align 4, !tbaa !14
  %56 = fneg float %55
  %57 = call float @llvm.fmuladd.f32(float %56, float 5.000000e-01, float %.sroa.0.4.vec.extract)
  br label %58

58:                                               ; preds = %43, %52, %33
  %59 = phi float [ %51, %43 ], [ %57, %52 ], [ %38, %33 ]
  %60 = load float, ptr %5, align 8, !tbaa !11
  %61 = insertelement <2 x float> poison, float %60, i64 0
  %62 = insertelement <2 x float> %61, float %59, i64 1
  %63 = fadd <2 x float> %62, <float 5.000000e-01, float 5.000000e-01>
  %64 = fptosi <2 x float> %63 to <2 x i32>
  %65 = sitofp <2 x i32> %64 to <2 x float>
  store <2 x float> %65, ptr %5, align 8, !tbaa !16
  ret <2 x float> %65
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL9ImHasFlagIi15ImPlotLocation_EbT_T0_(i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_ZNK6ImRect9GetCenterEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress 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 #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { inlinehint mustprogress 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" }

!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, !8, i64 0}
!6 = !{!"_ZTS6ImRect", !7, i64 0, !7, i64 8}
!7 = !{!"_ZTS6ImVec2", !8, i64 0, !8, i64 4}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!7, !8, i64 0}
!12 = !{!6, !8, i64 8}
!13 = !{!6, !8, i64 4}
!14 = !{!7, !8, i64 4}
!15 = !{!6, !8, i64 12}
!16 = !{!8, !8, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass