; 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::tabling::ParsingState" = type { %"class.vl::Object", %"class.vl::ObjectString", %"class.vl::Ptr.61", %"class.vl::collections::List.47", %"class.vl::Ptr.62", %"class.vl::ObjectString", i64, %"class.vl::Ptr.63" }
%"class.vl::Object" = type { ptr }
%"class.vl::Ptr.61" = type { ptr, ptr, ptr, ptr }
%"class.vl::collections::List.47" = type { %"class.vl::collections::ListBase.base.53", %"class.vl::collections::IEnumerable.51" }
%"class.vl::collections::ListBase.base.53" = type <{ %"class.vl::collections::ArrayBase.base.52", i64, i8 }>
%"class.vl::collections::ArrayBase.base.52" = type { %"class.vl::collections::ListStore.50", ptr, i64 }
%"class.vl::collections::ListStore.50" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.51" = type { %"class.vl::Interface" }
%"class.vl::Interface" = type { ptr }
%"class.vl::Ptr.62" = type { ptr, ptr, ptr, ptr }
%"class.vl::ObjectString" = type { %"class.vl::Object", ptr, ptr, i64, i64, i64 }
%"class.vl::Ptr.63" = type { ptr, ptr, ptr, ptr }

; 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
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing7tabling12ParsingState6FutureES6_EixEl(ptr noundef nonnull align 8 dereferenceable(33), i64 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl7parsing7tabling12ParsingState19ExploreNormalReduceERNS_11collections4ListIPNS2_6FutureES6_EEllS8_(ptr noundef nonnull align 8 dereferenceable(256) %0, ptr noundef nonnull align 8 dereferenceable(33) %1, i64 noundef %2, i64 noundef %3, ptr noundef nonnull align 8 dereferenceable(33) %4) #1 align 2 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i64 %2, ptr %9, align 8, !tbaa !9
  store i64 %3, ptr %10, align 8, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  %15 = load ptr, ptr %7, align 8
  %16 = getelementptr inbounds %"class.vl::parsing::tabling::ParsingState", ptr %15, i32 0, i32 4
  %17 = call noundef ptr @_ZNK2vl3PtrINS_7parsing7tabling18ParsingTokenWalkerEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %16)
  %18 = call noundef i64 @_ZNK2vl7parsing7tabling18ParsingTokenWalker18GetTableTokenIndexEv(ptr noundef nonnull align 8 dereferenceable(104) %17)
  %19 = icmp eq i64 %18, -1
  br i1 %19, label %20, label %21

20:                                               ; preds = %5
  store i1 false, ptr %6, align 1
  br label %47

21:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %22 = load ptr, ptr %11, align 8, !tbaa !5
  %23 = call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing7tabling12ParsingState6FutureEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  store i64 %23, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  store i64 0, ptr %13, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %39, %21
  %25 = load i64, ptr %13, align 8, !tbaa !9
  %26 = load i64, ptr %10, align 8, !tbaa !9
  %27 = icmp slt i64 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  br label %42

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = load i64, ptr %9, align 8, !tbaa !9
  %32 = load i64, ptr %13, align 8, !tbaa !9
  %33 = add nsw i64 %31, %32
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing7tabling12ParsingState6FutureES6_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %30, i64 noundef %33)
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  store ptr %35, ptr %14, align 8, !tbaa !5
  %36 = load ptr, ptr %14, align 8, !tbaa !5
  %37 = load ptr, ptr %11, align 8, !tbaa !5
  %38 = call noundef zeroext i1 @_ZN2vl7parsing7tabling12ParsingState7ExploreElPNS2_6FutureERNS_11collections4ListIS4_S4_EE(ptr noundef nonnull align 8 dereferenceable(256) %15, i64 noundef 2, ptr noundef %36, ptr noundef nonnull align 8 dereferenceable(33) %37)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  br label %39

39:                                               ; preds = %29
  %40 = load i64, ptr %13, align 8, !tbaa !9
  %41 = add nsw i64 %40, 1
  store i64 %41, ptr %13, align 8, !tbaa !9
  br label %24, !llvm.loop !11

42:                                               ; preds = %28
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  %44 = call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing7tabling12ParsingState6FutureEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %43)
  %45 = load i64, ptr %12, align 8, !tbaa !9
  %46 = icmp sgt i64 %44, %45
  store i1 %46, ptr %6, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %47

47:                                               ; preds = %42, %20
  %48 = load i1, ptr %6, align 1
  ret i1 %48
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK2vl3PtrINS_7parsing7tabling18ParsingTokenWalkerEEptEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 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 = { 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl7parsing7tabling12ParsingState19ExploreNormalReduceERNS_11collections4ListIPNS2_6FutureES6_EEllS8_(ptr noundef nonnull align 8 dereferenceable(256) %0, ptr noundef nonnull align 8 dereferenceable(33) %1, i64 noundef %2, i64 noundef %3, ptr noundef nonnull align 8 dereferenceable(33) %4) local_unnamed_addr #0 align 2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 136
  %7 = tail call noundef ptr @_ZNK2vl3PtrINS_7parsing7tabling18ParsingTokenWalkerEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %6)
  %8 = tail call noundef i64 @_ZNK2vl7parsing7tabling18ParsingTokenWalker18GetTableTokenIndexEv(ptr noundef nonnull align 8 dereferenceable(104) %7)
  %9 = icmp eq i64 %8, -1
  br i1 %9, label %20, label %10

10:                                               ; preds = %5
  %11 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing7tabling12ParsingState6FutureEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %12 = icmp sgt i64 %3, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %10
  %13 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing7tabling12ParsingState6FutureEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %14 = icmp sgt i64 %13, %11
  br label %20

.lr.ph:                                           ; preds = %10, %.lr.ph
  %.01213 = phi i64 [ %19, %.lr.ph ], [ 0, %10 ]
  %15 = add nsw i64 %.01213, %2
  %16 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing7tabling12ParsingState6FutureES6_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %1, i64 noundef %15)
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = tail call noundef zeroext i1 @_ZN2vl7parsing7tabling12ParsingState7ExploreElPNS2_6FutureERNS_11collections4ListIS4_S4_EE(ptr noundef nonnull align 8 dereferenceable(256) %0, i64 noundef 2, ptr noundef %17, ptr noundef nonnull align 8 dereferenceable(33) %4)
  %19 = add nuw nsw i64 %.01213, 1
  %exitcond.not = icmp eq i64 %19, %3
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

20:                                               ; preds = %5, %._crit_edge
  %.0 = phi i1 [ %14, %._crit_edge ], [ false, %5 ]
  ret i1 %.0
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK2vl3PtrINS_7parsing7tabling18ParsingTokenWalkerEEptEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 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"}


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