; LLVM IR from TheNachoBIT/GeoFenix-Engine :: GeoFenix/ImGUI/imgui_widgets.ll (ZN11ImGuiTabBarC2Ev)

; 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.ImGuiTabBar = type { %struct.ImVector.26, i32, i32, i32, i32, i32, i32, %struct.ImRect, float, float, float, float, float, float, float, float, i32, i32, i8, i8, i8, i8, i16, %struct.ImVec2, %struct.ImGuiTextBuffer }
%struct.ImVector.26 = type { i32, i32, ptr }
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }
%struct.ImVec2 = type { float, float }
%struct.ImGuiTextBuffer = type { %struct.ImVector.22 }
%struct.ImVector.22 = type { i32, i32, ptr }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6ImRectC2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11ImGuiTabBarC2Ev(ptr noundef nonnull align 8 dereferenceable(128) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 0
  call void @_ZN8ImVectorI12ImGuiTabItemEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6)
  %7 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 7
  invoke void @_ZN6ImRectC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %7)
          to label %8 unwind label %34

8:                                                ; preds = %1
  %9 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 23
  invoke void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %10 unwind label %34

10:                                               ; preds = %8
  %11 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 24
  invoke void @_ZN15ImGuiTextBufferC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11)
          to label %12 unwind label %34

12:                                               ; preds = %10
  %13 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 1
  store i32 0, ptr %13, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 4
  store i32 0, ptr %14, align 4, !tbaa !20
  %15 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 3
  store i32 0, ptr %15, align 8, !tbaa !21
  %16 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 2
  store i32 0, ptr %16, align 4, !tbaa !22
  %17 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 6
  store i32 -1, ptr %17, align 4, !tbaa !23
  %18 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 5
  store i32 -1, ptr %18, align 8, !tbaa !24
  %19 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 8
  store float 0.000000e+00, ptr %19, align 8, !tbaa !25
  %20 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 11
  store float 0.000000e+00, ptr %20, align 4, !tbaa !26
  %21 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 10
  store float 0.000000e+00, ptr %21, align 8, !tbaa !27
  %22 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 9
  store float 0.000000e+00, ptr %22, align 4, !tbaa !28
  %23 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 15
  store float 0.000000e+00, ptr %23, align 4, !tbaa !29
  %24 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 14
  store float 0.000000e+00, ptr %24, align 8, !tbaa !30
  %25 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 13
  store float 0.000000e+00, ptr %25, align 4, !tbaa !31
  %26 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 12
  store float 0.000000e+00, ptr %26, align 8, !tbaa !32
  %27 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 16
  store i32 0, ptr %27, align 8, !tbaa !33
  %28 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 17
  store i32 0, ptr %28, align 4, !tbaa !34
  %29 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 18
  store i8 0, ptr %29, align 8, !tbaa !35
  %30 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 19
  store i8 0, ptr %30, align 1, !tbaa !36
  %31 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 21
  store i8 0, ptr %31, align 1, !tbaa !37
  %32 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 20
  store i8 0, ptr %32, align 2, !tbaa !38
  %33 = getelementptr inbounds %struct.ImGuiTabBar, ptr %5, i32 0, i32 22
  store i16 -1, ptr %33, align 4, !tbaa !39
  ret void

34:                                               ; preds = %10, %8, %1
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %3, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %4, align 4
  call void @_ZN8ImVectorI12ImGuiTabItemED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #3
  br label %38

38:                                               ; preds = %34
  %39 = load ptr, ptr %3, align 8
  %40 = load i32, ptr %4, align 4
  %41 = insertvalue { ptr, i32 } poison, ptr %39, 0
  %42 = insertvalue { ptr, i32 } %41, i32 %40, 1
  resume { ptr, i32 } %42
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN8ImVectorI12ImGuiTabItemEC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN8ImVectorI12ImGuiTabItemED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

attributes #0 = { 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 = { 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 = { 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 #3 = { 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, !12, i64 16}
!10 = !{!"_ZTS11ImGuiTabBar", !11, i64 0, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !13, i64 40, !15, i64 56, !15, i64 60, !15, i64 64, !15, i64 68, !15, i64 72, !15, i64 76, !15, i64 80, !15, i64 84, !12, i64 88, !12, i64 92, !7, i64 96, !7, i64 97, !16, i64 98, !16, i64 99, !17, i64 100, !14, i64 104, !18, i64 112}
!11 = !{!"_ZTS8ImVectorI12ImGuiTabItemE", !12, i64 0, !12, i64 4, !6, i64 8}
!12 = !{!"int", !7, i64 0}
!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 = !{!"short", !7, i64 0}
!18 = !{!"_ZTS15ImGuiTextBuffer", !19, i64 0}
!19 = !{!"_ZTS8ImVectorIcE", !12, i64 0, !12, i64 4, !6, i64 8}
!20 = !{!10, !12, i64 28}
!21 = !{!10, !12, i64 24}
!22 = !{!10, !12, i64 20}
!23 = !{!10, !12, i64 36}
!24 = !{!10, !12, i64 32}
!25 = !{!10, !15, i64 56}
!26 = !{!10, !15, i64 68}
!27 = !{!10, !15, i64 64}
!28 = !{!10, !15, i64 60}
!29 = !{!10, !15, i64 84}
!30 = !{!10, !15, i64 80}
!31 = !{!10, !15, i64 76}
!32 = !{!10, !15, i64 72}
!33 = !{!10, !12, i64 88}
!34 = !{!10, !12, i64 92}
!35 = !{!10, !7, i64 96}
!36 = !{!10, !7, i64 97}
!37 = !{!10, !16, i64 99}
!38 = !{!10, !16, i64 98}
!39 = !{!10, !17, i64 100}


; 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"

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6ImRectC2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11ImGuiTabBarC2Ev(ptr noundef nonnull align 8 dereferenceable(128) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN8ImVectorI12ImGuiTabItemEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %2 = getelementptr inbounds i8, ptr %0, i64 40
  invoke void @_ZN6ImRectC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %2)
          to label %3 unwind label %12

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 104
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 112
  invoke void @_ZN15ImGuiTextBufferC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5)
          to label %6 unwind label %12

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = getelementptr inbounds i8, ptr %0, i64 36
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %7, i8 0, i64 16, i1 false)
  store i32 -1, ptr %8, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 -1, ptr %9, align 8, !tbaa !19
  %10 = getelementptr inbounds i8, ptr %0, i64 56
  %11 = getelementptr inbounds i8, ptr %0, i64 100
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(44) %10, i8 0, i64 44, i1 false)
  store i16 -1, ptr %11, align 4, !tbaa !20
  ret void

12:                                               ; preds = %3, %1
  %13 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN8ImVectorI12ImGuiTabItemED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0) #4
  resume { ptr, i32 } %13
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN8ImVectorI12ImGuiTabItemEC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN8ImVectorI12ImGuiTabItemED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

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

attributes #0 = { 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 = { 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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !8, i64 36}
!6 = !{!"_ZTS11ImGuiTabBar", !7, i64 0, !8, i64 16, !8, i64 20, !8, i64 24, !8, i64 28, !8, i64 32, !8, i64 36, !12, i64 40, !14, i64 56, !14, i64 60, !14, i64 64, !14, i64 68, !14, i64 72, !14, i64 76, !14, i64 80, !14, i64 84, !8, i64 88, !8, i64 92, !9, i64 96, !9, i64 97, !15, i64 98, !15, i64 99, !16, i64 100, !13, i64 104, !17, i64 112}
!7 = !{!"_ZTS8ImVectorI12ImGuiTabItemE", !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 = !{!"_ZTS6ImRect", !13, i64 0, !13, i64 8}
!13 = !{!"_ZTS6ImVec2", !14, i64 0, !14, i64 4}
!14 = !{!"float", !9, i64 0}
!15 = !{!"bool", !9, i64 0}
!16 = !{!"short", !9, i64 0}
!17 = !{!"_ZTS15ImGuiTextBuffer", !18, i64 0}
!18 = !{!"_ZTS8ImVectorIcE", !8, i64 0, !8, i64 4, !11, i64 8}
!19 = !{!6, !8, i64 32}
!20 = !{!6, !16, i64 100}


; Effective O3 passes: EarlyCSEPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass