; LLVM IR from lbowes/falcon-9-simulation :: 3rd_party/imgui/imgui_draw.ll (ZN10ImDrawList16ResetForNewFrameEv)

; 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 { i32, %struct.ImVec4, ptr, i32, i32, ptr, ptr }
%struct.ImVec4 = type { float, float, float, float }
%struct.ImDrawList = type { %struct.ImVector, %struct.ImVector.0, %struct.ImVector.1, i32, ptr, ptr, i32, i32, ptr, ptr, %struct.ImVector.2, %struct.ImVector.3, %struct.ImVector.4, %struct.ImDrawListSplitter }
%struct.ImVector = type { i32, i32, ptr }
%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.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, [12 x %struct.ImVec2], [64 x i8] }
%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: mustprogress uwtable
define dso_local void @_ZN10ImDrawList16ResetForNewFrameEv(ptr noundef nonnull align 8 dereferenceable(168) %0) #1 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 4
  %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 !20
  %12 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 3
  store i32 %11, ptr %12, align 8, !tbaa !25
  %13 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 6
  store i32 0, ptr %13, align 8, !tbaa !26
  %14 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 7
  store i32 0, ptr %14, align 4, !tbaa !27
  %15 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 8
  store ptr null, ptr %15, align 8, !tbaa !28
  %16 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 9
  store ptr null, ptr %16, align 8, !tbaa !29
  %17 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 10
  call void @_ZN8ImVectorI6ImVec4E6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %17, i32 noundef 0)
  %18 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 11
  call void @_ZN8ImVectorIPvE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %18, i32 noundef 0)
  %19 = getelementptr inbounds %struct.ImDrawList, ptr %4, i32 0, i32 12
  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) #4
  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) #4
  ret void
}

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN18ImDrawListSplitter5ClearEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 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)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9ImDrawCmdC2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #1 align 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 = { 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 = { 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, !6, i64 56, !6, i64 64, !12, i64 72, !12, i64 76, !6, i64 80, !6, i64 88, !15, i64 96, !16, i64 112, !17, i64 128, !18, i64 144}
!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 = !{!"_ZTS18ImDrawListSplitter", !12, i64 0, !12, i64 4, !19, i64 8}
!19 = !{!"_ZTS8ImVectorI13ImDrawChannelE", !12, i64 0, !12, i64 4, !6, i64 8}
!20 = !{!21, !12, i64 44}
!21 = !{!"_ZTS20ImDrawListSharedData", !22, i64 0, !6, i64 8, !23, i64 16, !23, i64 20, !23, i64 24, !24, i64 28, !12, i64 44, !7, i64 48, !7, i64 144}
!22 = !{!"_ZTS6ImVec2", !23, i64 0, !23, i64 4}
!23 = !{!"float", !7, i64 0}
!24 = !{!"_ZTS6ImVec4", !23, i64 0, !23, i64 4, !23, i64 8, !23, i64 12}
!25 = !{!10, !12, i64 48}
!26 = !{!10, !12, i64 72}
!27 = !{!10, !12, i64 76}
!28 = !{!10, !6, i64 80}
!29 = !{!10, !6, i64 88}


; 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 { i32, %struct.ImVec4, ptr, 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 uwtable
define dso_local void @_ZN10ImDrawList16ResetForNewFrameEv(ptr noundef nonnull align 8 dereferenceable(168) %0) local_unnamed_addr #1 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 !19
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 %8, ptr %9, align 8, !tbaa !24
  %10 = getelementptr inbounds i8, ptr %0, i64 72
  %11 = getelementptr inbounds i8, ptr %0, i64 96
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %10, i8 0, i64 24, i1 false)
  tail call void @_ZN8ImVectorI6ImVec4E6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %11, i32 noundef 0)
  %12 = getelementptr inbounds i8, ptr %0, i64 112
  tail call void @_ZN8ImVectorIPvE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %12, i32 noundef 0)
  %13 = getelementptr inbounds i8, ptr %0, i64 128
  tail call void @_ZN8ImVectorI6ImVec2E6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %13, i32 noundef 0)
  %14 = getelementptr inbounds i8, ptr %0, i64 144
  tail call void @_ZN18ImDrawListSplitter5ClearEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
  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
  ret void
}

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN18ImDrawListSplitter5ClearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 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 #2 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !11, i64 56, !11, i64 64, !8, i64 72, !8, i64 76, !11, i64 80, !11, i64 88, !14, i64 96, !15, i64 112, !16, i64 128, !17, i64 144}
!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 = !{!"_ZTS18ImDrawListSplitter", !8, i64 0, !8, i64 4, !18, i64 8}
!18 = !{!"_ZTS8ImVectorI13ImDrawChannelE", !8, i64 0, !8, i64 4, !11, i64 8}
!19 = !{!20, !8, i64 44}
!20 = !{!"_ZTS20ImDrawListSharedData", !21, i64 0, !11, i64 8, !22, i64 16, !22, i64 20, !22, i64 24, !23, i64 28, !8, i64 44, !9, i64 48, !9, i64 144}
!21 = !{!"_ZTS6ImVec2", !22, i64 0, !22, i64 4}
!22 = !{!"float", !9, i64 0}
!23 = !{!"_ZTS6ImVec4", !22, i64 0, !22, i64 4, !22, i64 8, !22, i64 12}
!24 = !{!6, !8, i64 48}


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