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

; 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.ImPlot::FitterRect" = type { %struct.ImPlotPoint, %struct.ImPlotPoint }
%struct.ImPlotPoint = type { double, double }
%struct.ImVec2 = type { float, float }
%struct.ImPlotItem = type <{ i32, i32, %struct.ImRect, i32, i8, i8, i8, i8 }>
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }

; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6ImPlot7EndItemEv() #1

declare noundef ptr @_ZN6ImPlot15GetPlotDrawListEv() #2

declare void @_ZN6ImPlot16PushPlotClipRectEf(float noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6ImPlot11BeginItemExINS_10FitterRectEEEbPKcRKT_ii(ptr noundef, ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImPlot10FitterRectC2ERK11ImPlotPointS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6ImPlot14GetCurrentItemEv() #3

declare <2 x float> @_ZN6ImPlot12PlotToPixelsEddii(double noundef, double noundef, i32 noundef, i32 noundef) #2

declare void @_ZN6ImPlot15PopPlotClipRectEv() #2

declare noundef i32 @_ZN5ImGui23ColorConvertFloat4ToU32ERK6ImVec4(ptr noundef nonnull align 4 dereferenceable(16)) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6ImPlot9PlotImageEPKcPvRK11ImPlotPointS5_RK6ImVec2S8_RK6ImVec4i(ptr noundef %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(16) %6, i32 noundef %7) #4 {
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"struct.ImPlot::FitterRect", align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca %struct.ImVec2, align 4
  %21 = alloca %struct.ImVec2, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  store i32 %7, ptr %16, align 4, !tbaa !9
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #5
  %23 = load ptr, ptr %11, align 8, !tbaa !5
  %24 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN6ImPlot10FitterRectC2ERK11ImPlotPointS3_(ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(16) %24)
  %25 = call noundef zeroext i1 @_ZN6ImPlot11BeginItemExINS_10FitterRectEEEbPKcRKT_ii(ptr noundef %22, ptr noundef nonnull align 8 dereferenceable(32) %17, i32 noundef 0, i32 noundef -1)
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #5
  br i1 %25, label %26, label %52

26:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %27 = load ptr, ptr %15, align 8, !tbaa !5
  %28 = call noundef i32 @_ZN5ImGui23ColorConvertFloat4ToU32ERK6ImVec4(ptr noundef nonnull align 4 dereferenceable(16) %27)
  store i32 %28, ptr %18, align 4, !tbaa !9
  %29 = load i32, ptr %18, align 4, !tbaa !9
  %30 = call noundef ptr @_ZN6ImPlot14GetCurrentItemEv()
  %31 = getelementptr inbounds %struct.ImPlotItem, ptr %30, i32 0, i32 1
  store i32 %29, ptr %31, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %32 = call noundef ptr @_ZN6ImPlot15GetPlotDrawListEv()
  store ptr %32, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %33 = load ptr, ptr %11, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ImPlotPoint, ptr %33, i32 0, i32 0
  %35 = load double, ptr %34, align 8, !tbaa !17
  %36 = load ptr, ptr %12, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.ImPlotPoint, ptr %36, i32 0, i32 1
  %38 = load double, ptr %37, align 8, !tbaa !20
  %39 = call <2 x float> @_ZN6ImPlot12PlotToPixelsEddii(double noundef %35, double noundef %38, i32 noundef -1, i32 noundef -1)
  store <2 x float> %39, ptr %20, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %40 = load ptr, ptr %12, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.ImPlotPoint, ptr %40, i32 0, i32 0
  %42 = load double, ptr %41, align 8, !tbaa !17
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.ImPlotPoint, ptr %43, i32 0, i32 1
  %45 = load double, ptr %44, align 8, !tbaa !20
  %46 = call <2 x float> @_ZN6ImPlot12PlotToPixelsEddii(double noundef %42, double noundef %45, i32 noundef -1, i32 noundef -1)
  store <2 x float> %46, ptr %21, align 4
  call void @_ZN6ImPlot16PushPlotClipRectEf(float noundef 0.000000e+00)
  %47 = load ptr, ptr %19, align 8, !tbaa !5
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = load ptr, ptr %13, align 8, !tbaa !5
  %50 = load ptr, ptr %14, align 8, !tbaa !5
  %51 = load i32, ptr %18, align 4, !tbaa !9
  call void @_ZN10ImDrawList8AddImageEPvRK6ImVec2S3_S3_S3_j(ptr noundef nonnull align 8 dereferenceable(196) %47, ptr noundef %48, ptr noundef nonnull align 4 dereferenceable(8) %20, ptr noundef nonnull align 4 dereferenceable(8) %21, ptr noundef nonnull align 4 dereferenceable(8) %49, ptr noundef nonnull align 4 dereferenceable(8) %50, i32 noundef %51)
  call void @_ZN6ImPlot15PopPlotClipRectEv()
  call void @_ZN6ImPlot7EndItemEv()
  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 4, ptr %18) #5
  br label %52

52:                                               ; preds = %26, %8
  ret void
}

declare void @_ZN10ImDrawList8AddImageEPvRK6ImVec2S3_S3_S3_j(ptr noundef nonnull align 8 dereferenceable(196), ptr noundef, ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { "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 = { 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 #4 = { 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 #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, !10, i64 4}
!12 = !{!"_ZTS10ImPlotItem", !10, i64 0, !10, i64 4, !13, i64 8, !10, i64 24, !16, i64 28, !16, i64 29, !16, i64 30}
!13 = !{!"_ZTS6ImRect", !14, i64 0, !14, i64 8}
!14 = !{!"_ZTS6ImVec2", !15, i64 0, !15, i64 4}
!15 = !{!"float", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!18, !19, i64 0}
!18 = !{!"_ZTS11ImPlotPoint", !19, i64 0, !19, i64 8}
!19 = !{!"double", !7, i64 0}
!20 = !{!18, !19, i64 8}


; 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.ImPlot::FitterRect" = type { %struct.ImPlotPoint, %struct.ImPlotPoint }
%struct.ImPlotPoint = type { double, double }
%struct.ImVec2 = type { float, float }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6ImPlot7EndItemEv() local_unnamed_addr #1

declare noundef ptr @_ZN6ImPlot15GetPlotDrawListEv() local_unnamed_addr #2

declare void @_ZN6ImPlot16PushPlotClipRectEf(float noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6ImPlot11BeginItemExINS_10FitterRectEEEbPKcRKT_ii(ptr noundef, ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImPlot10FitterRectC2ERK11ImPlotPointS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6ImPlot14GetCurrentItemEv() local_unnamed_addr #3

declare <2 x float> @_ZN6ImPlot12PlotToPixelsEddii(double noundef, double noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare void @_ZN6ImPlot15PopPlotClipRectEv() local_unnamed_addr #2

declare noundef i32 @_ZN5ImGui23ColorConvertFloat4ToU32ERK6ImVec4(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6ImPlot9PlotImageEPKcPvRK11ImPlotPointS5_RK6ImVec2S8_RK6ImVec4i(ptr noundef %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(16) %6, i32 noundef %7) local_unnamed_addr #4 {
  %9 = alloca %"struct.ImPlot::FitterRect", align 8
  %10 = alloca %struct.ImVec2, align 8
  %11 = alloca %struct.ImVec2, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #5
  call void @_ZN6ImPlot10FitterRectC2ERK11ImPlotPointS3_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3)
  %12 = call noundef zeroext i1 @_ZN6ImPlot11BeginItemExINS_10FitterRectEEEbPKcRKT_ii(ptr noundef %0, ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef 0, i32 noundef -1)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #5
  br i1 %12, label %13, label %26

13:                                               ; preds = %8
  %14 = call noundef i32 @_ZN5ImGui23ColorConvertFloat4ToU32ERK6ImVec4(ptr noundef nonnull align 4 dereferenceable(16) %6)
  %15 = call noundef ptr @_ZN6ImPlot14GetCurrentItemEv()
  %16 = getelementptr inbounds i8, ptr %15, i64 4
  store i32 %14, ptr %16, align 4, !tbaa !5
  %17 = call noundef ptr @_ZN6ImPlot15GetPlotDrawListEv()
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  %18 = load double, ptr %2, align 8, !tbaa !14
  %19 = getelementptr inbounds i8, ptr %3, i64 8
  %20 = load double, ptr %19, align 8, !tbaa !17
  %21 = call <2 x float> @_ZN6ImPlot12PlotToPixelsEddii(double noundef %18, double noundef %20, i32 noundef -1, i32 noundef -1)
  store <2 x float> %21, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #5
  %22 = load double, ptr %3, align 8, !tbaa !14
  %23 = getelementptr inbounds i8, ptr %2, i64 8
  %24 = load double, ptr %23, align 8, !tbaa !17
  %25 = call <2 x float> @_ZN6ImPlot12PlotToPixelsEddii(double noundef %22, double noundef %24, i32 noundef -1, i32 noundef -1)
  store <2 x float> %25, ptr %11, align 8
  call void @_ZN6ImPlot16PushPlotClipRectEf(float noundef 0.000000e+00)
  call void @_ZN10ImDrawList8AddImageEPvRK6ImVec2S3_S3_S3_j(ptr noundef nonnull align 8 dereferenceable(196) %17, ptr noundef %1, ptr noundef nonnull align 4 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef %14)
  call void @_ZN6ImPlot15PopPlotClipRectEv()
  call void @_ZN6ImPlot7EndItemEv()
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  br label %26

26:                                               ; preds = %13, %8
  ret void
}

declare void @_ZN10ImDrawList8AddImageEPvRK6ImVec2S3_S3_S3_j(ptr noundef nonnull align 8 dereferenceable(196), ptr noundef, ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { "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 = { 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 #4 = { 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 #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, !7, i64 4}
!6 = !{!"_ZTS10ImPlotItem", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 24, !13, i64 28, !13, i64 29, !13, i64 30}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS6ImRect", !11, i64 0, !11, i64 8}
!11 = !{!"_ZTS6ImVec2", !12, i64 0, !12, i64 4}
!12 = !{!"float", !8, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!15, !16, i64 0}
!15 = !{!"_ZTS11ImPlotPoint", !16, i64 0, !16, i64 8}
!16 = !{!"double", !8, i64 0}
!17 = !{!15, !16, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass