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

; 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::RuleInfo" = type <{ %"class.vl::Object", ptr, ptr, ptr, %"class.vl::collections::List.403", i32, [4 x i8] }>
%"class.vl::collections::List.403" = type { %"class.vl::collections::ListBase.base.409", %"class.vl::collections::IEnumerable.407" }
%"class.vl::collections::ListBase.base.409" = type <{ %"class.vl::collections::ArrayBase.base.408", i64, i8 }>
%"class.vl::collections::ArrayBase.base.408" = type { %"class.vl::collections::ListStore.406", ptr, i64 }
%"class.vl::collections::ListStore.406" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.407" = type { %"class.vl::Interface" }

; 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 nounwind uwtable
declare dso_local noundef ptr @_ZNK2vl3PtrINS_7parsing9analyzing8RuleInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

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

; 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 nounwind uwtable
declare dso_local noundef ptr @_ZNK2vl3PtrINS_7parsing9analyzing9AutomatonEEptEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing5StateEE5CountEv(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_7parsing9analyzing5StateES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl7parsing9analyzing23DeleteUnnecessaryStatesENS_3PtrINS1_9AutomatonEEENS2_INS1_8RuleInfoEEERNS_11collections4ListIPNS1_5StateESA_EE(ptr noundef %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(33) %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %57, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store i64 0, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing5StateEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  %14 = sub nsw i64 %13, 1
  store i64 %14, ptr %8, align 8, !tbaa !9
  br label %15

15:                                               ; preds = %47, %11
  %16 = load i64, ptr %8, align 8, !tbaa !9
  %17 = icmp sge i64 %16, 0
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %50

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = load i64, ptr %8, align 8, !tbaa !9
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing9analyzing5StateES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %20, i64 noundef %21)
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  store ptr %23, ptr %9, align 8, !tbaa !5
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = getelementptr inbounds %"class.vl::parsing::analyzing::State", ptr %24, i32 0, i32 1
  %26 = call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %25)
  %27 = icmp eq i64 %26, 0
  br i1 %27, label %28, label %46

28:                                               ; preds = %19
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = call noundef ptr @_ZNK2vl3PtrINS_7parsing9analyzing8RuleInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %31 = getelementptr inbounds %"class.vl::parsing::analyzing::RuleInfo", ptr %30, i32 0, i32 2
  %32 = load ptr, ptr %31, align 8, !tbaa !11
  %33 = icmp ne ptr %29, %32
  br i1 %33, label %34, label %45

34:                                               ; preds = %28
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = getelementptr inbounds %"class.vl::parsing::analyzing::State", ptr %35, i32 0, i32 3
  %37 = load i8, ptr %36, align 8, !tbaa !20, !range !28, !noundef !29
  %38 = trunc i8 %37 to i1
  br i1 %38, label %45, label %39

39:                                               ; preds = %34
  %40 = call noundef ptr @_ZNK2vl3PtrINS_7parsing9analyzing9AutomatonEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN2vl7parsing9analyzing9Automaton11DeleteStateEPNS1_5StateE(ptr noundef nonnull align 8 dereferenceable(224) %40, ptr noundef %41)
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = load i64, ptr %8, align 8, !tbaa !9
  %44 = call noundef zeroext i1 @_ZN2vl11collections8ListBaseIPNS_7parsing9analyzing5StateES5_E8RemoveAtEl(ptr noundef nonnull align 8 dereferenceable(33) %42, i64 noundef %43)
  br label %45

45:                                               ; preds = %39, %34, %28
  br label %46

46:                                               ; preds = %45, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %47

47:                                               ; preds = %46
  %48 = load i64, ptr %8, align 8, !tbaa !9
  %49 = add nsw i64 %48, -1
  store i64 %49, ptr %8, align 8, !tbaa !9
  br label %15, !llvm.loop !30

50:                                               ; preds = %18
  %51 = load i64, ptr %7, align 8, !tbaa !9
  %52 = icmp eq i64 %51, 0
  br i1 %52, label %53, label %54

53:                                               ; preds = %50
  store i32 3, ptr %10, align 4
  br label %55

54:                                               ; preds = %50
  store i32 0, ptr %10, align 4
  br label %55

55:                                               ; preds = %54, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %56 = load i32, ptr %10, align 4
  switch i32 %56, label %59 [
    i32 0, label %57
    i32 3, label %58
  ]

57:                                               ; preds = %55
  br label %11, !llvm.loop !32

58:                                               ; preds = %55
  ret void

59:                                               ; preds = %55
  unreachable
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"_ZTSN2vl7parsing9analyzing8RuleInfoE", !13, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !14, i64 32, !19, i64 80}
!13 = !{!"_ZTSN2vl6ObjectE"}
!14 = !{!"_ZTSN2vl11collections4ListIPNS_7parsing9analyzing5StateES5_EE", !15, i64 0}
!15 = !{!"_ZTSN2vl11collections8ListBaseIPNS_7parsing9analyzing5StateES5_EE", !16, i64 0, !10, i64 24, !18, i64 32}
!16 = !{!"_ZTSN2vl11collections9ArrayBaseIPNS_7parsing9analyzing5StateEEE", !17, i64 0, !6, i64 8, !10, i64 16}
!17 = !{!"_ZTSN2vl11collections9ListStoreIPNS_7parsing9analyzing5StateELb1EEE", !13, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!21, !18, i64 104}
!21 = !{!"_ZTSN2vl7parsing9analyzing5StateE", !13, i64 0, !22, i64 8, !22, i64 56, !18, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !26, i64 144, !27, i64 152, !27, i64 200}
!22 = !{!"_ZTSN2vl11collections4ListIPNS_7parsing9analyzing10TransitionES5_EE", !23, i64 0}
!23 = !{!"_ZTSN2vl11collections8ListBaseIPNS_7parsing9analyzing10TransitionES5_EE", !24, i64 0, !10, i64 24, !18, i64 32}
!24 = !{!"_ZTSN2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEEE", !25, i64 0, !6, i64 8, !10, i64 16}
!25 = !{!"_ZTSN2vl11collections9ListStoreIPNS_7parsing9analyzing10TransitionELb1EEE", !13, i64 0}
!26 = !{!"_ZTSN2vl7parsing9analyzing5State13StatePositionE", !7, i64 0}
!27 = !{!"_ZTSN2vl12ObjectStringIwEE", !13, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = distinct !{!32, !31}


; 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 nounwind uwtable
declare dso_local noundef ptr @_ZNK2vl3PtrINS_7parsing9analyzing8RuleInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK2vl3PtrINS_7parsing9analyzing9AutomatonEEptEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl7parsing9analyzing23DeleteUnnecessaryStatesENS_3PtrINS1_9AutomatonEEENS2_INS1_8RuleInfoEEERNS_11collections4ListIPNS1_5StateESA_EE(ptr noundef %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(33) %2) local_unnamed_addr #1 {
  %4 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing5StateEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %5 = icmp sgt i64 %4, 0
  br i1 %5, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3, %22
  %.01215.in = phi i64 [ %.01215, %22 ], [ %4, %3 ]
  %.01215 = add nsw i64 %.01215.in, -1
  %6 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing9analyzing5StateES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %2, i64 noundef %.01215)
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 8
  %9 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %10 = icmp eq i64 %9, 0
  br i1 %10, label %11, label %22

11:                                               ; preds = %.lr.ph
  %12 = tail call noundef ptr @_ZNK2vl3PtrINS_7parsing9analyzing8RuleInfoEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %.not = icmp eq ptr %7, %14
  br i1 %.not, label %22, label %15

15:                                               ; preds = %11
  %16 = getelementptr inbounds i8, ptr %7, i64 104
  %17 = load i8, ptr %16, align 8, !tbaa !19, !range !27, !noundef !28
  %18 = trunc nuw i8 %17 to i1
  br i1 %18, label %22, label %19

19:                                               ; preds = %15
  %20 = tail call noundef ptr @_ZNK2vl3PtrINS_7parsing9analyzing9AutomatonEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  tail call void @_ZN2vl7parsing9analyzing9Automaton11DeleteStateEPNS1_5StateE(ptr noundef nonnull align 8 dereferenceable(224) %20, ptr noundef nonnull %7)
  %21 = tail call noundef zeroext i1 @_ZN2vl11collections8ListBaseIPNS_7parsing9analyzing5StateES5_E8RemoveAtEl(ptr noundef nonnull align 8 dereferenceable(33) %2, i64 noundef %.01215)
  br label %22

22:                                               ; preds = %11, %15, %19, %.lr.ph
  %23 = icmp ugt i64 %.01215.in, 1
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !29

._crit_edge:                                      ; preds = %22, %3
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2vl11collections8ListBaseIPNS_7parsing9analyzing5StateES5_E8RemoveAtEl(ptr noundef nonnull align 8 dereferenceable(33), i64 noundef) local_unnamed_addr #1 align 2

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

!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 16}
!10 = !{!"_ZTSN2vl7parsing9analyzing8RuleInfoE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !18, i64 80}
!11 = !{!"_ZTSN2vl6ObjectE"}
!12 = !{!"_ZTSN2vl11collections4ListIPNS_7parsing9analyzing5StateES5_EE", !13, i64 0}
!13 = !{!"_ZTSN2vl11collections8ListBaseIPNS_7parsing9analyzing5StateES5_EE", !14, i64 0, !16, i64 24, !17, i64 32}
!14 = !{!"_ZTSN2vl11collections9ArrayBaseIPNS_7parsing9analyzing5StateEEE", !15, i64 0, !6, i64 8, !16, i64 16}
!15 = !{!"_ZTSN2vl11collections9ListStoreIPNS_7parsing9analyzing5StateELb1EEE", !11, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = !{!20, !17, i64 104}
!20 = !{!"_ZTSN2vl7parsing9analyzing5StateE", !11, i64 0, !21, i64 8, !21, i64 56, !17, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !25, i64 144, !26, i64 152, !26, i64 200}
!21 = !{!"_ZTSN2vl11collections4ListIPNS_7parsing9analyzing10TransitionES5_EE", !22, i64 0}
!22 = !{!"_ZTSN2vl11collections8ListBaseIPNS_7parsing9analyzing10TransitionES5_EE", !23, i64 0, !16, i64 24, !17, i64 32}
!23 = !{!"_ZTSN2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEEE", !24, i64 0, !6, i64 8, !16, i64 16}
!24 = !{!"_ZTSN2vl11collections9ListStoreIPNS_7parsing9analyzing10TransitionELb1EEE", !11, i64 0}
!25 = !{!"_ZTSN2vl7parsing9analyzing5State13StatePositionE", !7, i64 0}
!26 = !{!"_ZTSN2vl12ObjectStringIwEE", !11, i64 0, !6, i64 8, !6, i64 16, !16, i64 24, !16, i64 32, !16, i64 40}
!27 = !{i8 0, i8 2}
!28 = !{}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass