; 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.ImPlotTime = type <{ i64, i32, [4 x i8] }>
%struct.ImPlotContext = type { %struct.ImPool.34, %struct.ImPool.36, ptr, ptr, ptr, ptr, ptr, %struct.ImPlotTicker, %struct.ImPlotAnnotationCollection, %struct.ImPlotTagCollection, i8, [3 x i8], %struct.ImPlotStyle, %struct.ImVector.6, %struct.ImVector.7, %struct.ImPlotColormapData, %struct.ImVector.10, %struct.tm, %struct.ImVector.42, %struct.ImVector.42, %struct.ImVector.10, i32, i32, %struct.ImPlotNextPlotData, %struct.ImPlotNextItemData, %struct.ImPlotInputMap, i8, %struct.ImGuiTextBuffer, ptr, %struct.ImPool.43, ptr, ptr }
%struct.ImPool.34 = type { %struct.ImVector.35, %struct.ImGuiStorage, i32, i32 }
%struct.ImVector.35 = type { i32, i32, ptr }
%struct.ImGuiStorage = type { %struct.ImVector.4 }
%struct.ImVector.4 = type { i32, i32, ptr }
%struct.ImPool.36 = type { %struct.ImVector.37, %struct.ImGuiStorage, i32, i32 }
%struct.ImVector.37 = type { i32, i32, ptr }
%struct.ImPlotTicker = type <{ %struct.ImVector.38, %struct.ImGuiTextBuffer, %struct.ImVec2, %struct.ImVec2, i32, [4 x i8] }>
%struct.ImVector.38 = type { i32, i32, ptr }
%struct.ImVec2 = type { float, float }
%struct.ImPlotAnnotationCollection = type <{ %struct.ImVector.39, %struct.ImGuiTextBuffer, i32, [4 x i8] }>
%struct.ImVector.39 = type { i32, i32, ptr }
%struct.ImPlotTagCollection = type <{ %struct.ImVector.40, %struct.ImGuiTextBuffer, i32, [4 x i8] }>
%struct.ImVector.40 = type { i32, i32, ptr }
%struct.ImPlotStyle = type <{ float, i32, float, float, float, float, float, float, float, float, float, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, [21 x %struct.ImVec4], i32, i8, i8, i8, i8 }>
%struct.ImVec4 = type { float, float, float, float }
%struct.ImVector.6 = type { i32, i32, ptr }
%struct.ImVector.7 = type { i32, i32, ptr }
%struct.ImPlotColormapData = type <{ %struct.ImVector.9, %struct.ImVector.10, %struct.ImVector.10, %struct.ImVector.9, %struct.ImVector.10, %struct.ImVector.10, %struct.ImGuiTextBuffer, %struct.ImVector.10, %struct.ImVector.41, %struct.ImGuiStorage, i32, [4 x i8] }>
%struct.ImVector.9 = type { i32, i32, ptr }
%struct.ImVector.41 = type { i32, i32, ptr }
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, ptr }
%struct.ImVector.42 = type { i32, i32, ptr }
%struct.ImVector.10 = type { i32, i32, ptr }
%struct.ImPlotNextPlotData = type { [6 x i32], [6 x %struct.ImPlotRange], [6 x i8], [6 x i8], [6 x ptr], [6 x ptr] }
%struct.ImPlotRange = type { double, double }
%struct.ImPlotNextItemData = type { [5 x %struct.ImVec4], float, i32, float, float, float, float, float, float, float, i8, i8, i8, i8, i8, i8, i32 }
%struct.ImPlotInputMap = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float }
%struct.ImGuiTextBuffer = type { %struct.ImVector.24 }
%struct.ImVector.24 = type { i32, i32, ptr }
%struct.ImPool.43 = type { %struct.ImVector.44, %struct.ImGuiStorage, i32, i32 }
%struct.ImVector.44 = type { i32, i32, ptr }

@GImPlot = external dso_local global ptr, align 8

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { i64, i32 } @_ZN6ImPlot6MkTimeEP2tm(ptr noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6ImPlot7GetTimeERK10ImPlotTimeP2tm(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local { i64, i32 } @_ZN6ImPlot15CombineDateTimeERK10ImPlotTimeS2_(ptr noundef nonnull align 8 dereferenceable(12) %0, ptr noundef nonnull align 8 dereferenceable(12) %1) #4 {
  %3 = alloca %struct.ImPlotTime, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca { i64, i32 }, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %12 = load ptr, ptr @GImPlot, align 8, !tbaa !5
  store ptr %12, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.ImPlotContext, ptr %13, i32 0, i32 17
  store ptr %14, ptr %7, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.ImPlotContext, ptr %16, i32 0, i32 17
  %18 = call noundef ptr @_ZN6ImPlot7GetTimeERK10ImPlotTimeP2tm(ptr noundef nonnull align 8 dereferenceable(12) %15, ptr noundef %17)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.tm, ptr %19, i32 0, i32 5
  %21 = load i32, ptr %20, align 4, !tbaa !9
  store i32 %21, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.tm, ptr %22, i32 0, i32 4
  %24 = load i32, ptr %23, align 8, !tbaa !14
  store i32 %24, ptr %9, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.tm, ptr %25, i32 0, i32 3
  %27 = load i32, ptr %26, align 4, !tbaa !15
  store i32 %27, ptr %10, align 4, !tbaa !13
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ImPlotContext, ptr %29, i32 0, i32 17
  %31 = call noundef ptr @_ZN6ImPlot7GetTimeERK10ImPlotTimeP2tm(ptr noundef nonnull align 8 dereferenceable(12) %28, ptr noundef %30)
  %32 = load i32, ptr %8, align 4, !tbaa !13
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.tm, ptr %33, i32 0, i32 5
  store i32 %32, ptr %34, align 4, !tbaa !9
  %35 = load i32, ptr %9, align 4, !tbaa !13
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.tm, ptr %36, i32 0, i32 4
  store i32 %35, ptr %37, align 8, !tbaa !14
  %38 = load i32, ptr %10, align 4, !tbaa !13
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.tm, ptr %39, i32 0, i32 3
  store i32 %38, ptr %40, align 4, !tbaa !15
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = call { i64, i32 } @_ZN6ImPlot6MkTimeEP2tm(ptr noundef %41)
  store { i64, i32 } %42, ptr %11, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %3, ptr align 8 %11, i64 12, i1 false)
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.ImPlotTime, ptr %43, i32 0, i32 1
  %45 = load i32, ptr %44, align 8, !tbaa !16
  %46 = getelementptr inbounds %struct.ImPlotTime, ptr %3, i32 0, i32 1
  store i32 %45, ptr %46, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %47 = load { i64, i32 }, ptr %3, align 8
  ret { i64, i32 } %47
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #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" }
attributes #4 = { 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 #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, !11, i64 20}
!10 = !{!"_ZTS2tm", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !12, i64 40, !6, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !11, i64 16}
!15 = !{!10, !11, i64 12}
!16 = !{!17, !11, i64 8}
!17 = !{!"_ZTS10ImPlotTime", !12, i64 0, !11, 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"

@GImPlot = external dso_local local_unnamed_addr global ptr, align 8

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { i64, i32 } @_ZN6ImPlot6MkTimeEP2tm(ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6ImPlot7GetTimeERK10ImPlotTimeP2tm(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local { i64, i32 } @_ZN6ImPlot15CombineDateTimeERK10ImPlotTimeS2_(ptr noundef nonnull align 8 dereferenceable(12) %0, ptr noundef nonnull align 8 dereferenceable(12) %1) local_unnamed_addr #2 {
  %3 = load ptr, ptr @GImPlot, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 992
  %5 = tail call noundef ptr @_ZN6ImPlot7GetTimeERK10ImPlotTimeP2tm(ptr noundef nonnull align 8 dereferenceable(12) %0, ptr noundef nonnull %4)
  %6 = getelementptr inbounds i8, ptr %3, i64 1012
  %7 = load i32, ptr %6, align 4, !tbaa !9
  %8 = getelementptr inbounds i8, ptr %3, i64 1004
  %9 = load <2 x i32>, ptr %8, align 4, !tbaa !13
  %10 = tail call noundef ptr @_ZN6ImPlot7GetTimeERK10ImPlotTimeP2tm(ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef nonnull %4)
  store i32 %7, ptr %6, align 4, !tbaa !9
  store <2 x i32> %9, ptr %8, align 4, !tbaa !13
  %11 = tail call { i64, i32 } @_ZN6ImPlot6MkTimeEP2tm(ptr noundef nonnull %4)
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load i32, ptr %12, align 8, !tbaa !14
  %.fca.1.insert = insertvalue { i64, i32 } %11, i32 %13, 1
  ret { i64, i32 } %.fca.1.insert
}

attributes #0 = { inlinehint 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 #1 = { 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 #2 = { 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" }

!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, !11, i64 20}
!10 = !{!"_ZTS2tm", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !12, i64 40, !6, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!15, !11, i64 8}
!15 = !{!"_ZTS10ImPlotTime", !12, i64 0, !11, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass