; LLVM IR from l1mey112/yr11-physics-applied :: cimgui/imgui/imgui_draw.ll (ZN10ImDrawList17_ResetForNewFrameEv)

; 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.ImDrawCmd = type { %struct.ImVec4, ptr, i32, i32, i32, ptr, ptr }
%struct.ImVec4 = type { float, float, float, float }
%struct.ImDrawList = type <{ %struct.ImVector.0, %struct.ImVector.1, %struct.ImVector.2, i32, i32, ptr, ptr, ptr, ptr, %struct.ImVector.3, %struct.ImVector.4, %struct.ImVector, %struct.ImDrawCmdHeader, %struct.ImDrawListSplitter, float, [4 x i8] }>
%struct.ImVector.0 = type { i32, i32, ptr }
%struct.ImVector.1 = type { i32, i32, ptr }
%struct.ImVector.2 = type { i32, i32, ptr }
%struct.ImVector.3 = type { i32, i32, ptr }
%struct.ImVector.4 = type { i32, i32, ptr }
%struct.ImVector = type { i32, i32, ptr }
%struct.ImDrawCmdHeader = type <{ %struct.ImVec4, ptr, i32, [4 x i8] }>
%struct.ImDrawListSplitter = type { i32, i32, %struct.ImVector.5 }
%struct.ImVector.5 = type { i32, i32, ptr }
%struct.ImDrawListSharedData = type { %struct.ImVec2, ptr, float, float, float, %struct.ImVec4, i32, %struct.ImVector, [48 x %struct.ImVec2], float, [64 x i8], ptr }
%struct.ImVec2 = type { float, float }

; 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10ImDrawList17_ResetForNewFrameEv(ptr noundef nonnull align 8 dereferenceable(196) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.ImDrawCmd, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  %5 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 0
  call void @_ZN8ImVectorI9ImDrawCmdE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %5, i32 noundef 0)
  %6 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 1
  call void @_ZN8ImVectorItE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef 0)
  %7 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 2
  call void @_ZN8ImVectorI10ImDrawVertE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 0)
  %8 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 5
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds %struct.ImDrawListSharedData, ptr %9, i32 0, i32 6
  %11 = load i32, ptr %10, align 4, !tbaa !23
  %12 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 3
  store i32 %11, ptr %12, align 8, !tbaa !26
  %13 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 12
  call void @llvm.memset.p0.i64(ptr align 8 %13, i8 0, i64 32, i1 false)
  %14 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 4
  store i32 0, ptr %14, align 4, !tbaa !27
  %15 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 7
  store ptr null, ptr %15, align 8, !tbaa !28
  %16 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 8
  store ptr null, ptr %16, align 8, !tbaa !29
  %17 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 9
  call void @_ZN8ImVectorI6ImVec4E6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %17, i32 noundef 0)
  %18 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 10
  call void @_ZN8ImVectorIPvE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %18, i32 noundef 0)
  %19 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 11
  call void @_ZN8ImVectorI6ImVec2E6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %19, i32 noundef 0)
  %20 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 13
  call void @_ZN18ImDrawListSplitter5ClearEv(ptr noundef nonnull align 8 dereferenceable(24) %20)
  %21 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 56, ptr %3) #5
  call void @_ZN9ImDrawCmdC2Ev(ptr noundef nonnull align 8 dereferenceable(56) %3)
  call void @_ZN8ImVectorI9ImDrawCmdE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 8 dereferenceable(56) %3)
  call void @llvm.lifetime.end.p0(i64 56, ptr %3) #5
  %22 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 14
  store float 1.000000e+00, ptr %22, align 8, !tbaa !30
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI9ImDrawCmdE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorItE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI10ImDrawVertE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI6ImVec4E6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorIPvE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI6ImVec2E6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN18ImDrawListSplitter5ClearEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI9ImDrawCmdE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(56)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9ImDrawCmdC2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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" }
attributes #3 = { 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 #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, !6, i64 56}
!10 = !{!"_ZTS10ImDrawList", !11, i64 0, !13, i64 16, !14, i64 32, !12, i64 48, !12, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !15, i64 88, !16, i64 104, !17, i64 120, !18, i64 136, !21, i64 168, !20, i64 192}
!11 = !{!"_ZTS8ImVectorI9ImDrawCmdE", !12, i64 0, !12, i64 4, !6, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTS8ImVectorItE", !12, i64 0, !12, i64 4, !6, i64 8}
!14 = !{!"_ZTS8ImVectorI10ImDrawVertE", !12, i64 0, !12, i64 4, !6, i64 8}
!15 = !{!"_ZTS8ImVectorI6ImVec4E", !12, i64 0, !12, i64 4, !6, i64 8}
!16 = !{!"_ZTS8ImVectorIPvE", !12, i64 0, !12, i64 4, !6, i64 8}
!17 = !{!"_ZTS8ImVectorI6ImVec2E", !12, i64 0, !12, i64 4, !6, i64 8}
!18 = !{!"_ZTS15ImDrawCmdHeader", !19, i64 0, !6, i64 16, !12, i64 24}
!19 = !{!"_ZTS6ImVec4", !20, i64 0, !20, i64 4, !20, i64 8, !20, i64 12}
!20 = !{!"float", !7, i64 0}
!21 = !{!"_ZTS18ImDrawListSplitter", !12, i64 0, !12, i64 4, !22, i64 8}
!22 = !{!"_ZTS8ImVectorI13ImDrawChannelE", !12, i64 0, !12, i64 4, !6, i64 8}
!23 = !{!24, !12, i64 44}
!24 = !{!"_ZTS20ImDrawListSharedData", !25, i64 0, !6, i64 8, !20, i64 16, !20, i64 20, !20, i64 24, !19, i64 28, !12, i64 44, !17, i64 48, !7, i64 64, !20, i64 448, !7, i64 452, !6, i64 520}
!25 = !{!"_ZTS6ImVec2", !20, i64 0, !20, i64 4}
!26 = !{!10, !12, i64 48}
!27 = !{!10, !12, i64 52}
!28 = !{!10, !6, i64 72}
!29 = !{!10, !6, i64 80}
!30 = !{!10, !20, i64 192}


; 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.ImDrawCmd = type { %struct.ImVec4, ptr, i32, i32, i32, ptr, ptr }
%struct.ImVec4 = type { float, float, 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 nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10ImDrawList17_ResetForNewFrameEv(ptr noundef nonnull align 8 dereferenceable(196) %0) local_unnamed_addr #2 align 2 {
  %2 = alloca %struct.ImDrawCmd, align 8
  tail call void @_ZN8ImVectorI9ImDrawCmdE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %0, i32 noundef 0)
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN8ImVectorItE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef 0)
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @_ZN8ImVectorI10ImDrawVertE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %4, i32 noundef 0)
  %5 = getelementptr inbounds i8, ptr %0, i64 56
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 44
  %8 = load i32, ptr %7, align 4, !tbaa !22
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 %8, ptr %9, align 8, !tbaa !25
  %10 = getelementptr inbounds i8, ptr %0, i64 136
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %10, i8 0, i64 32, i1 false)
  %11 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 0, ptr %11, align 4, !tbaa !26
  %12 = getelementptr inbounds i8, ptr %0, i64 72
  %13 = getelementptr inbounds i8, ptr %0, i64 88
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %12, i8 0, i64 16, i1 false)
  tail call void @_ZN8ImVectorI6ImVec4E6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %13, i32 noundef 0)
  %14 = getelementptr inbounds i8, ptr %0, i64 104
  tail call void @_ZN8ImVectorIPvE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %14, i32 noundef 0)
  %15 = getelementptr inbounds i8, ptr %0, i64 120
  tail call void @_ZN8ImVectorI6ImVec2E6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %15, i32 noundef 0)
  %16 = getelementptr inbounds i8, ptr %0, i64 168
  tail call void @_ZN18ImDrawListSplitter5ClearEv(ptr noundef nonnull align 8 dereferenceable(24) %16)
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %2) #5
  call void @_ZN9ImDrawCmdC2Ev(ptr noundef nonnull align 8 dereferenceable(56) %2)
  call void @_ZN8ImVectorI9ImDrawCmdE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(56) %2)
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %2) #5
  %17 = getelementptr inbounds i8, ptr %0, i64 192
  store float 1.000000e+00, ptr %17, align 8, !tbaa !27
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI9ImDrawCmdE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorItE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI10ImDrawVertE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI6ImVec4E6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorIPvE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI6ImVec2E6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN18ImDrawListSplitter5ClearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI9ImDrawCmdE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9ImDrawCmdC2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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" }
attributes #3 = { 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 #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, !11, i64 56}
!6 = !{!"_ZTS10ImDrawList", !7, i64 0, !12, i64 16, !13, i64 32, !8, i64 48, !8, i64 52, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !14, i64 88, !15, i64 104, !16, i64 120, !17, i64 136, !20, i64 168, !19, i64 192}
!7 = !{!"_ZTS8ImVectorI9ImDrawCmdE", !8, i64 0, !8, i64 4, !11, i64 8}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_ZTS8ImVectorItE", !8, i64 0, !8, i64 4, !11, i64 8}
!13 = !{!"_ZTS8ImVectorI10ImDrawVertE", !8, i64 0, !8, i64 4, !11, i64 8}
!14 = !{!"_ZTS8ImVectorI6ImVec4E", !8, i64 0, !8, i64 4, !11, i64 8}
!15 = !{!"_ZTS8ImVectorIPvE", !8, i64 0, !8, i64 4, !11, i64 8}
!16 = !{!"_ZTS8ImVectorI6ImVec2E", !8, i64 0, !8, i64 4, !11, i64 8}
!17 = !{!"_ZTS15ImDrawCmdHeader", !18, i64 0, !11, i64 16, !8, i64 24}
!18 = !{!"_ZTS6ImVec4", !19, i64 0, !19, i64 4, !19, i64 8, !19, i64 12}
!19 = !{!"float", !9, i64 0}
!20 = !{!"_ZTS18ImDrawListSplitter", !8, i64 0, !8, i64 4, !21, i64 8}
!21 = !{!"_ZTS8ImVectorI13ImDrawChannelE", !8, i64 0, !8, i64 4, !11, i64 8}
!22 = !{!23, !8, i64 44}
!23 = !{!"_ZTS20ImDrawListSharedData", !24, i64 0, !11, i64 8, !19, i64 16, !19, i64 20, !19, i64 24, !18, i64 28, !8, i64 44, !16, i64 48, !9, i64 64, !19, i64 448, !9, i64 452, !11, i64 520}
!24 = !{!"_ZTS6ImVec2", !19, i64 0, !19, i64 4}
!25 = !{!6, !8, i64 48}
!26 = !{!6, !8, i64 52}
!27 = !{!6, !19, i64 192}


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