; LLVM IR from vczh/herodb :: Kernel/Source/Vlpp.ll (ZN2vl7parsing9analyzing9Automaton11DeleteStateEPNS1_5StateE)

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

%"class.vl::parsing::analyzing::State" = type { %"class.vl::Object", %"class.vl::collections::List.395", %"class.vl::collections::List.395", i8, ptr, ptr, ptr, ptr, i32, %"class.vl::ObjectString", %"class.vl::ObjectString" }
%"class.vl::Object" = type { ptr }
%"class.vl::collections::List.395" = type { %"class.vl::collections::ListBase.base.401", %"class.vl::collections::IEnumerable.399" }
%"class.vl::collections::ListBase.base.401" = type <{ %"class.vl::collections::ArrayBase.base.400", i64, i8 }>
%"class.vl::collections::ArrayBase.base.400" = type { %"class.vl::collections::ListStore.398", ptr, i64 }
%"class.vl::collections::ListStore.398" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.399" = type { %"class.vl::Interface" }
%"class.vl::Interface" = type { ptr }
%"class.vl::ObjectString" = type { %"class.vl::Object", ptr, ptr, i64, i64, i64 }
%"class.vl::parsing::analyzing::Automaton" = type { %"class.vl::Object", ptr, %"class.vl::collections::List.411", %"class.vl::collections::List.419", %"class.vl::collections::Dictionary.427" }
%"class.vl::collections::List.411" = type { %"class.vl::collections::ListBase.base.417", %"class.vl::collections::IEnumerable.415" }
%"class.vl::collections::ListBase.base.417" = type <{ %"class.vl::collections::ArrayBase.base.416", i64, i8 }>
%"class.vl::collections::ArrayBase.base.416" = type { %"class.vl::collections::ListStore.414", ptr, i64 }
%"class.vl::collections::ListStore.414" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.415" = type { %"class.vl::Interface" }
%"class.vl::collections::List.419" = type { %"class.vl::collections::ListBase.base.425", %"class.vl::collections::IEnumerable.423" }
%"class.vl::collections::ListBase.base.425" = type <{ %"class.vl::collections::ArrayBase.base.424", i64, i8 }>
%"class.vl::collections::ArrayBase.base.424" = type { %"class.vl::collections::ListStore.422", ptr, i64 }
%"class.vl::collections::ListStore.422" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.423" = type { %"class.vl::Interface" }
%"class.vl::collections::Dictionary.427" = type { %"class.vl::Object", %"class.vl::collections::SortedList.428", %"class.vl::collections::List.436", %"class.vl::collections::IEnumerable.444" }
%"class.vl::collections::SortedList.428" = type { %"class.vl::collections::ListBase.base.434", %"class.vl::collections::IEnumerable.432" }
%"class.vl::collections::ListBase.base.434" = type <{ %"class.vl::collections::ArrayBase.base.433", i64, i8 }>
%"class.vl::collections::ArrayBase.base.433" = type { %"class.vl::collections::ListStore.431", ptr, i64 }
%"class.vl::collections::ListStore.431" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.432" = type { %"class.vl::Interface" }
%"class.vl::collections::List.436" = type { %"class.vl::collections::ListBase.base.442", %"class.vl::collections::IEnumerable.440" }
%"class.vl::collections::ListBase.base.442" = type <{ %"class.vl::collections::ArrayBase.base.441", i64, i8 }>
%"class.vl::collections::ArrayBase.base.441" = type { %"class.vl::collections::ListStore.439", ptr, i64 }
%"class.vl::collections::ListStore.439" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.440" = type { %"class.vl::Interface" }
%"class.vl::collections::IEnumerable.444" = type { %"class.vl::Interface" }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl7parsing9analyzing9Automaton16DeleteTransitionEPNS1_10TransitionE(ptr noundef nonnull align 8 dereferenceable(224), ptr noundef) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl7parsing9analyzing9Automaton11DeleteStateEPNS1_5StateE(ptr noundef nonnull align 8 dereferenceable(224) %0, ptr noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  br label %6

6:                                                ; preds = %11, %2
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds %"class.vl::parsing::analyzing::State", ptr %7, i32 0, i32 2
  %9 = call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %10 = icmp ne i64 %9, 0
  br i1 %10, label %11, label %16

11:                                               ; preds = %6
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %"class.vl::parsing::analyzing::State", ptr %12, i32 0, i32 2
  %14 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing9analyzing10TransitionES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %13, i64 noundef 0)
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN2vl7parsing9analyzing9Automaton16DeleteTransitionEPNS1_10TransitionE(ptr noundef nonnull align 8 dereferenceable(224) %5, ptr noundef %15)
  br label %6, !llvm.loop !9

16:                                               ; preds = %6
  br label %17

17:                                               ; preds = %22, %16
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %"class.vl::parsing::analyzing::State", ptr %18, i32 0, i32 1
  %20 = call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %19)
  %21 = icmp ne i64 %20, 0
  br i1 %21, label %22, label %27

22:                                               ; preds = %17
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.vl::parsing::analyzing::State", ptr %23, i32 0, i32 1
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing9analyzing10TransitionES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %24, i64 noundef 0)
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  call void @_ZN2vl7parsing9analyzing9Automaton16DeleteTransitionEPNS1_10TransitionE(ptr noundef nonnull align 8 dereferenceable(224) %5, ptr noundef %26)
  br label %17, !llvm.loop !11

27:                                               ; preds = %17
  %28 = getelementptr inbounds %"class.vl::parsing::analyzing::Automaton", ptr %5, i32 0, i32 3
  %29 = call noundef zeroext i1 @_ZN2vl11collections4ListINS_3PtrINS_7parsing9analyzing5StateEEEPS5_E6RemoveERKS7_(ptr noundef nonnull align 8 dereferenceable(33) %28, ptr noundef nonnull align 8 dereferenceable(8) %4)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing9analyzing10TransitionES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33), i64 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2vl11collections4ListINS_3PtrINS_7parsing9analyzing5StateEEEPS5_E6RemoveERKS7_(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef nonnull align 8 dereferenceable(8)) #0 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" }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; 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 @_ZN2vl7parsing9analyzing9Automaton16DeleteTransitionEPNS1_10TransitionE(ptr noundef nonnull align 8 dereferenceable(224), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl7parsing9analyzing9Automaton11DeleteStateEPNS1_5StateE(ptr noundef nonnull align 8 dereferenceable(224) %0, ptr noundef %1) local_unnamed_addr #0 align 2 {
  %3 = alloca ptr, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 56
  %5 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %.not2 = icmp eq i64 %5, 0
  br i1 %.not2, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %2
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  %.not13 = icmp eq i64 %7, 0
  br i1 %.not13, label %._crit_edge, label %.lr.ph4

.lr.ph:                                           ; preds = %2, %.lr.ph
  %8 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing9analyzing10TransitionES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %4, i64 noundef 0)
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  tail call void @_ZN2vl7parsing9analyzing9Automaton16DeleteTransitionEPNS1_10TransitionE(ptr noundef nonnull align 8 dereferenceable(224) %0, ptr noundef %9)
  %10 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %.not = icmp eq i64 %10, 0
  br i1 %.not, label %.preheader, label %.lr.ph, !llvm.loop !9

.lr.ph4:                                          ; preds = %.preheader, %.lr.ph4
  %11 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing9analyzing10TransitionES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %6, i64 noundef 0)
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  tail call void @_ZN2vl7parsing9analyzing9Automaton16DeleteTransitionEPNS1_10TransitionE(ptr noundef nonnull align 8 dereferenceable(224) %0, ptr noundef %12)
  %13 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  %.not1 = icmp eq i64 %13, 0
  br i1 %.not1, label %._crit_edge, label %.lr.ph4, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph4, %.preheader
  %14 = getelementptr inbounds i8, ptr %0, i64 64
  %15 = call noundef zeroext i1 @_ZN2vl11collections4ListINS_3PtrINS_7parsing9analyzing5StateEEEPS5_E6RemoveERKS7_(ptr noundef nonnull align 8 dereferenceable(33) %14, ptr noundef nonnull align 8 dereferenceable(8) %3)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing9analyzing10TransitionES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2vl11collections4ListINS_3PtrINS_7parsing9analyzing5StateEEEPS5_E6RemoveERKS7_(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 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" }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: GVNPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass