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

%"struct.vl::parsing::tabling::ParsingAutoRecoverParser::RecoverFuture" = type { ptr, i64, i64, i64, i64 }
%"class.vl::parsing::tabling::ParsingAutoRecoverParser" = type { %"class.vl::parsing::tabling::ParsingStrictParser", i64, %"class.vl::collections::List.150", i64 }
%"class.vl::parsing::tabling::ParsingStrictParser" = type { %"class.vl::parsing::tabling::ParsingGeneralParser" }
%"class.vl::parsing::tabling::ParsingGeneralParser" = type { %"class.vl::Object", %"class.vl::Ptr.61" }
%"class.vl::Object" = type { ptr }
%"class.vl::Ptr.61" = type { ptr, ptr, ptr, ptr }
%"class.vl::collections::List.150" = type { %"class.vl::collections::ListBase.base.156", %"class.vl::collections::IEnumerable.154" }
%"class.vl::collections::ListBase.base.156" = type <{ %"class.vl::collections::ArrayBase.base.155", i64, i8 }>
%"class.vl::collections::ArrayBase.base.155" = type { %"class.vl::collections::ListStore.153", ptr, i64 }
%"class.vl::collections::ListStore.153" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.154" = type { %"class.vl::Interface" }
%"class.vl::Interface" = type { ptr }

@.str.104 = external hidden unnamed_addr constant [81 x i32], align 4
@_ZTIN2vl5ErrorE = external dso_local constant { ptr, ptr }, align 8

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare i32 @__gxx_personality_v0(...)

declare ptr @__cxa_allocate_exception(i64)

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN2vl7parsing7tabling24ParsingAutoRecoverParser16GetRecoverFutureEl(ptr noundef nonnull align 8 dereferenceable(104), i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN2vl7parsing7tabling24ParsingAutoRecoverParser19CreateRecoverFutureEll(ptr noundef nonnull align 8 dereferenceable(104) %0, i64 noundef %1, i64 noundef %2) #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"struct.vl::parsing::tabling::ParsingAutoRecoverParser::RecoverFuture", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store i64 %2, ptr %6, align 8, !tbaa !9
  %11 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr null, ptr %7, align 8, !tbaa !5
  %12 = load i64, ptr %5, align 8, !tbaa !9
  %13 = getelementptr inbounds %"class.vl::parsing::tabling::ParsingAutoRecoverParser", ptr %11, i32 0, i32 2
  %14 = call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_7parsing7tabling24ParsingAutoRecoverParser13RecoverFutureEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %13)
  %15 = icmp sge i64 %12, %14
  br i1 %15, label %16, label %41

16:                                               ; preds = %3
  br label %17

17:                                               ; preds = %16
  %18 = load i64, ptr %5, align 8, !tbaa !9
  %19 = getelementptr inbounds %"class.vl::parsing::tabling::ParsingAutoRecoverParser", ptr %11, i32 0, i32 2
  %20 = call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_7parsing7tabling24ParsingAutoRecoverParser13RecoverFutureEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %19)
  %21 = icmp eq i64 %18, %20
  br i1 %21, label %29, label %22

22:                                               ; preds = %17
  %23 = call ptr @__cxa_allocate_exception(i64 8) #5
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef @.str.104)
          to label %24 unwind label %25

24:                                               ; preds = %22
  call void @__cxa_throw(ptr %23, ptr @_ZTIN2vl5ErrorE, ptr null) #6
  unreachable

25:                                               ; preds = %22
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %8, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %9, align 4
  call void @__cxa_free_exception(ptr %23) #5
  br label %51

29:                                               ; preds = %17
  br label %30

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 40, ptr %10) #5
  call void @_ZN2vl7parsing7tabling24ParsingAutoRecoverParser13RecoverFutureC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %10)
  %32 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 104) #7
  invoke void @_ZN2vl7parsing7tabling12ParsingState6FutureC2Ev(ptr noundef nonnull align 8 dereferenceable(104) %32)
          to label %33 unwind label %37

33:                                               ; preds = %31
  %34 = getelementptr inbounds %"struct.vl::parsing::tabling::ParsingAutoRecoverParser::RecoverFuture", ptr %10, i32 0, i32 0
  store ptr %32, ptr %34, align 8, !tbaa !11
  %35 = getelementptr inbounds %"class.vl::parsing::tabling::ParsingAutoRecoverParser", ptr %11, i32 0, i32 2
  %36 = call noundef i64 @_ZN2vl11collections4ListINS_7parsing7tabling24ParsingAutoRecoverParser13RecoverFutureES5_E3AddERKS5_(ptr noundef nonnull align 8 dereferenceable(33) %35, ptr noundef nonnull align 8 dereferenceable(40) %10)
  store i64 %36, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 40, ptr %10) #5
  br label %41

37:                                               ; preds = %31
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %8, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %9, align 4
  call void @_ZdlPvm(ptr noundef %32, i64 noundef 104) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr %10) #5
  br label %51

41:                                               ; preds = %33, %3
  %42 = load i64, ptr %5, align 8, !tbaa !9
  %43 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN2vl7parsing7tabling24ParsingAutoRecoverParser16GetRecoverFutureEl(ptr noundef nonnull align 8 dereferenceable(104) %11, i64 noundef %42)
  store ptr %43, ptr %7, align 8, !tbaa !5
  %44 = load i64, ptr %5, align 8, !tbaa !9
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.vl::parsing::tabling::ParsingAutoRecoverParser::RecoverFuture", ptr %45, i32 0, i32 2
  store i64 %44, ptr %46, align 8, !tbaa !13
  %47 = load i64, ptr %6, align 8, !tbaa !9
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.vl::parsing::tabling::ParsingAutoRecoverParser::RecoverFuture", ptr %48, i32 0, i32 3
  store i64 %47, ptr %49, align 8, !tbaa !14
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret ptr %50

51:                                               ; preds = %37, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %52

52:                                               ; preds = %51
  %53 = load ptr, ptr %8, align 8
  %54 = load i32, ptr %9, align 4
  %55 = insertvalue { ptr, i32 } poison, ptr %53, 0
  %56 = insertvalue { ptr, i32 } %55, i32 %54, 1
  resume { ptr, i32 } %56
}

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

declare void @__cxa_free_exception(ptr)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl7parsing7tabling12ParsingState6FutureC2Ev(ptr noundef nonnull align 8 dereferenceable(104)) unnamed_addr #3 align 2

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

declare void @_ZN2vl5ErrorC1EPKw(ptr, ptr)

attributes #0 = { nobuiltin nounwind "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nobuiltin allocsize(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 = { 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { noreturn }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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 0}
!12 = !{!"_ZTSN2vl7parsing7tabling24ParsingAutoRecoverParser13RecoverFutureE", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!13 = !{!12, !10, i64 16}
!14 = !{!12, !10, i64 24}


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

%"struct.vl::parsing::tabling::ParsingAutoRecoverParser::RecoverFuture" = type { ptr, i64, i64, i64, i64 }

@.str.104 = external hidden unnamed_addr constant [81 x i32], align 4
@_ZTIN2vl5ErrorE = external dso_local constant { ptr, ptr }, align 8

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare i32 @__gxx_personality_v0(...)

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN2vl7parsing7tabling24ParsingAutoRecoverParser16GetRecoverFutureEl(ptr noundef nonnull align 8 dereferenceable(104), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN2vl7parsing7tabling24ParsingAutoRecoverParser19CreateRecoverFutureEll(ptr noundef nonnull align 8 dereferenceable(104) %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"struct.vl::parsing::tabling::ParsingAutoRecoverParser::RecoverFuture", align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  %6 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_7parsing7tabling24ParsingAutoRecoverParser13RecoverFutureEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %.not = icmp sgt i64 %6, %1
  br i1 %.not, label %21, label %7

7:                                                ; preds = %3
  %8 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_7parsing7tabling24ParsingAutoRecoverParser13RecoverFutureEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %9 = icmp eq i64 %8, %1
  br i1 %9, label %15, label %10

10:                                               ; preds = %7
  %11 = tail call ptr @__cxa_allocate_exception(i64 8) #5
  invoke void @_ZN2vl5ErrorC1EPKw(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull @.str.104)
          to label %12 unwind label %13

12:                                               ; preds = %10
  tail call void @__cxa_throw(ptr %11, ptr nonnull @_ZTIN2vl5ErrorE, ptr null) #6
  unreachable

13:                                               ; preds = %10
  %14 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %11) #5
  br label %25

15:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #5
  call void @_ZN2vl7parsing7tabling24ParsingAutoRecoverParser13RecoverFutureC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4)
  %16 = call noalias noundef nonnull dereferenceable(104) ptr @_Znwm(i64 noundef 104) #7
  invoke void @_ZN2vl7parsing7tabling12ParsingState6FutureC2Ev(ptr noundef nonnull align 8 dereferenceable(104) %16)
          to label %17 unwind label %19

17:                                               ; preds = %15
  store ptr %16, ptr %4, align 8, !tbaa !5
  %18 = call noundef i64 @_ZN2vl11collections4ListINS_7parsing7tabling24ParsingAutoRecoverParser13RecoverFutureES5_E3AddERKS5_(ptr noundef nonnull align 8 dereferenceable(33) %5, ptr noundef nonnull align 8 dereferenceable(40) %4)
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #5
  br label %21

19:                                               ; preds = %15
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %16, i64 noundef 104) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #5
  br label %25

21:                                               ; preds = %17, %3
  %.011 = phi i64 [ %18, %17 ], [ %1, %3 ]
  %22 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN2vl7parsing7tabling24ParsingAutoRecoverParser16GetRecoverFutureEl(ptr noundef nonnull align 8 dereferenceable(104) %0, i64 noundef %.011)
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  store i64 %.011, ptr %23, align 8, !tbaa !11
  %24 = getelementptr inbounds i8, ptr %22, i64 24
  store i64 %2, ptr %24, align 8, !tbaa !12
  ret ptr %22

25:                                               ; preds = %19, %13
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %14, %13 ]
  resume { ptr, i32 } %.pn
}

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

declare void @__cxa_free_exception(ptr) local_unnamed_addr

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl7parsing7tabling12ParsingState6FutureC2Ev(ptr noundef nonnull align 8 dereferenceable(104)) unnamed_addr #3 align 2

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

declare void @_ZN2vl5ErrorC1EPKw(ptr, ptr) local_unnamed_addr

attributes #0 = { nobuiltin nounwind "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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nobuiltin allocsize(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 = { 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { noreturn }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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, !7, i64 0}
!6 = !{!"_ZTSN2vl7parsing7tabling24ParsingAutoRecoverParser13RecoverFutureE", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!6, !10, i64 24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass