; LLVM IR from DarrenSweeney/3D-Physics-Engine :: Physics Engine/Imgui/imgui.ll (ZN11ImGuiWindow19FocusItemUnregisterEv)

; 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.ImGuiWindow = type { ptr, i32, i32, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, float, float, i8, i8, i8, i8, i8, i32, i8, i32, i32, i32, %struct.ImGuiDrawContext, %class.ImVector.11, %class.ImVector.12, %struct.ImGuiAabb, i32, float, %struct.ImGuiStorage, float, ptr, ptr, i32, i32, i32, i32, i32, i32 }
%struct.ImVec2 = type { float, float }
%struct.ImGuiDrawContext = type { %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, float, float, float, i32, i32, %struct.ImGuiAabb, i8, %class.ImVector.1, %class.ImVector.9, %class.ImVector.10, %class.ImVector.10, i32, ptr, float, float, i32, i32, %struct.ImVec2, float, float, i8, i32, %class.ImVector.10 }
%class.ImVector.1 = type { i64, i64, ptr }
%class.ImVector.9 = type { i64, i64, ptr }
%class.ImVector.10 = type { i64, i64, ptr }
%class.ImVector.11 = type { i64, i64, ptr }
%class.ImVector.12 = type { i64, i64, ptr }
%struct.ImGuiAabb = type { %struct.ImVec2, %struct.ImVec2 }
%struct.ImGuiStorage = type { %class.ImVector.6 }
%class.ImVector.6 = type { i64, i64, ptr }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN11ImGuiWindow19FocusItemUnregisterEv(ptr noundef nonnull align 8 dereferenceable(480) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %struct.ImGuiWindow, ptr %3, i32 0, i32 30
  %5 = load i32, ptr %4, align 8, !tbaa !9
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr %4, align 8, !tbaa !9
  %7 = getelementptr inbounds %struct.ImGuiWindow, ptr %3, i32 0, i32 31
  %8 = load i32, ptr %7, align 4, !tbaa !25
  %9 = add nsw i32 %8, -1
  store i32 %9, ptr %7, align 4, !tbaa !25
  ret void
}

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

!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 456}
!10 = !{!"_ZTS11ImGuiWindow", !6, i64 0, !11, i64 8, !11, i64 12, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !13, i64 56, !13, i64 60, !14, i64 64, !14, i64 65, !14, i64 66, !14, i64 67, !14, i64 68, !11, i64 72, !14, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !15, i64 96, !21, i64 336, !22, i64 360, !16, i64 384, !11, i64 400, !13, i64 404, !23, i64 408, !13, i64 432, !6, i64 440, !6, i64 448, !11, i64 456, !11, i64 460, !11, i64 464, !11, i64 468, !11, i64 472, !11, i64 476}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTS6ImVec2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTS16ImGuiDrawContext", !12, i64 0, !12, i64 8, !12, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !11, i64 36, !11, i64 40, !16, i64 44, !14, i64 60, !17, i64 64, !19, i64 88, !20, i64 112, !20, i64 136, !11, i64 160, !6, i64 168, !13, i64 176, !13, i64 180, !11, i64 184, !11, i64 188, !12, i64 192, !13, i64 200, !13, i64 204, !14, i64 208, !11, i64 212, !20, i64 216}
!16 = !{!"_ZTS9ImGuiAabb", !12, i64 0, !12, i64 8}
!17 = !{!"_ZTS8ImVectorIP11ImGuiWindowE", !18, i64 0, !18, i64 8, !6, i64 16}
!18 = !{!"long", !7, i64 0}
!19 = !{!"_ZTS8ImVectorIbE", !18, i64 0, !18, i64 8, !6, i64 16}
!20 = !{!"_ZTS8ImVectorIfE", !18, i64 0, !18, i64 8, !6, i64 16}
!21 = !{!"_ZTS8ImVectorIjE", !18, i64 0, !18, i64 8, !6, i64 16}
!22 = !{!"_ZTS8ImVectorI6ImVec4E", !18, i64 0, !18, i64 8, !6, i64 16}
!23 = !{!"_ZTS12ImGuiStorage", !24, i64 0}
!24 = !{!"_ZTS8ImVectorIN12ImGuiStorage4PairEE", !18, i64 0, !18, i64 8, !6, i64 16}
!25 = !{!10, !11, i64 460}


; 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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_ZN11ImGuiWindow19FocusItemUnregisterEv(ptr nocapture noundef nonnull align 8 dereferenceable(480) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 456
  %3 = load <2 x i32>, ptr %2, align 8, !tbaa !5
  %4 = add nsw <2 x i32> %3, <i32 -1, i32 -1>
  store <2 x i32> %4, ptr %2, align 8, !tbaa !5
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass