; LLVM IR from Razakhel/RaZ :: extern/implot/implot.ll (ZN6ImPlot15CombineDateTimeERK10ImPlotTimeS2_)

; 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.30, %struct.ImPool.32, ptr, ptr, ptr, ptr, ptr, %struct.ImPlotTicker, %struct.ImPlotAnnotationCollection, %struct.ImPlotTagCollection, i8, [3 x i8], %struct.ImPlotStyle, %struct.ImVector.3, %struct.ImVector.4, %struct.ImPlotColormapData, %struct.ImVector.7, %struct.tm, %struct.ImVector.38, %struct.ImVector.38, %struct.ImVector.7, i32, i32, %struct.ImPlotNextPlotData, %struct.ImPlotNextItemData, %struct.ImPlotInputMap, i8, %struct.ImGuiTextBuffer, ptr, %struct.ImPool.39, ptr, ptr }
%struct.ImPool.30 = type { %struct.ImVector.31, %struct.ImGuiStorage, i32, i32 }
%struct.ImVector.31 = type { i32, i32, ptr }
%struct.ImGuiStorage = type { %struct.ImVector.2 }
%struct.ImVector.2 = type { i32, i32, ptr }
%struct.ImPool.32 = type { %struct.ImVector.33, %struct.ImGuiStorage, i32, i32 }
%struct.ImVector.33 = type { i32, i32, ptr }
%struct.ImPlotTicker = type <{ %struct.ImVector.34, %struct.ImGuiTextBuffer, %struct.ImVec2, %struct.ImVec2, i32, [4 x i8] }>
%struct.ImVector.34 = type { i32, i32, ptr }
%struct.ImVec2 = type { float, float }
%struct.ImPlotAnnotationCollection = type <{ %struct.ImVector.35, %struct.ImGuiTextBuffer, i32, [4 x i8] }>
%struct.ImVector.35 = type { i32, i32, ptr }
%struct.ImPlotTagCollection = type <{ %struct.ImVector.36, %struct.ImGuiTextBuffer, i32, [4 x i8] }>
%struct.ImVector.36 = 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.3 = type { i32, i32, ptr }
%struct.ImVector.4 = type { i32, i32, ptr }
%struct.ImPlotColormapData = type <{ %struct.ImVector.6, %struct.ImVector.7, %struct.ImVector.7, %struct.ImVector.6, %struct.ImVector.7, %struct.ImVector.7, %struct.ImGuiTextBuffer, %struct.ImVector.7, %struct.ImVector.37, %struct.ImGuiStorage, i32, [4 x i8] }>
%struct.ImVector.6 = type { i32, i32, ptr }
%struct.ImVector.37 = type { i32, i32, ptr }
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, ptr }
%struct.ImVector.38 = type { i32, i32, ptr }
%struct.ImVector.7 = 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.20 }
%struct.ImVector.20 = type { i32, i32, ptr }
%struct.ImPool.39 = type { %struct.ImVector.40, %struct.ImGuiStorage, i32, i32 }
%struct.ImVector.40 = 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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = 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
  %11 = load ptr, ptr @GImPlot, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.ImPlotContext, ptr %11, i32 0, i32 17
  store ptr %12, ptr %6, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr @GImPlot, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.ImPlotContext, ptr %14, i32 0, i32 17
  %16 = call noundef ptr @_ZN6ImPlot7GetTimeERK10ImPlotTimeP2tm(ptr noundef nonnull align 8 dereferenceable(12) %13, ptr noundef %15)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.tm, ptr %17, i32 0, i32 5
  %19 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %19, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.tm, ptr %20, i32 0, i32 4
  %22 = load i32, ptr %21, align 8, !tbaa !14
  store i32 %22, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.tm, ptr %23, i32 0, i32 3
  %25 = load i32, ptr %24, align 4, !tbaa !15
  store i32 %25, ptr %9, align 4, !tbaa !13
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = load ptr, ptr @GImPlot, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ImPlotContext, ptr %27, i32 0, i32 17
  %29 = call noundef ptr @_ZN6ImPlot7GetTimeERK10ImPlotTimeP2tm(ptr noundef nonnull align 8 dereferenceable(12) %26, ptr noundef %28)
  %30 = load i32, ptr %7, align 4, !tbaa !13
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.tm, ptr %31, i32 0, i32 5
  store i32 %30, ptr %32, align 4, !tbaa !9
  %33 = load i32, ptr %8, align 4, !tbaa !13
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.tm, ptr %34, i32 0, i32 4
  store i32 %33, ptr %35, align 8, !tbaa !14
  %36 = load i32, ptr %9, align 4, !tbaa !13
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.tm, ptr %37, i32 0, i32 3
  store i32 %36, ptr %38, align 4, !tbaa !15
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = call { i64, i32 } @_ZN6ImPlot6MkTimeEP2tm(ptr noundef %39)
  store { i64, i32 } %40, ptr %10, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %3, ptr align 8 %10, i64 12, i1 false)
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.ImPlotTime, ptr %41, i32 0, i32 1
  %43 = load i32, ptr %42, align 8, !tbaa !16
  %44 = getelementptr inbounds %struct.ImPlotTime, ptr %3, i32 0, i32 1
  store i32 %43, ptr %44, align 8, !tbaa !16
  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 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %45 = load { i64, i32 }, ptr %3, align 8
  ret { i64, i32 } %45
}

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 ptr, ptr @GImPlot, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 992
  %11 = load <2 x i32>, ptr %8, align 4, !tbaa !13
  %12 = tail call noundef ptr @_ZN6ImPlot7GetTimeERK10ImPlotTimeP2tm(ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef nonnull %10)
  store i32 %7, ptr %6, align 4, !tbaa !9
  store <2 x i32> %11, ptr %8, align 4, !tbaa !13
  %13 = tail call { i64, i32 } @_ZN6ImPlot6MkTimeEP2tm(ptr noundef nonnull %4)
  %14 = getelementptr inbounds i8, ptr %1, i64 8
  %15 = load i32, ptr %14, align 8, !tbaa !14
  %.fca.1.insert = insertvalue { i64, i32 } %13, i32 %15, 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