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

; 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 }
%"struct.vl::parsing::tabling::ParsingState::StateGroup" = type { %"class.vl::collections::List.116", i64, i64, %"class.vl::collections::List.626", ptr, ptr }
%"class.vl::collections::List.116" = type { %"class.vl::collections::ListBase.base.122", %"class.vl::collections::IEnumerable.120" }
%"class.vl::collections::ListBase.base.122" = type <{ %"class.vl::collections::ArrayBase.base.121", i64, i8 }>
%"class.vl::collections::ArrayBase.base.121" = type { %"class.vl::collections::ListStore.119", ptr, i64 }
%"class.vl::collections::ListStore.119" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.120" = type { %"class.vl::Interface" }
%"class.vl::collections::List.626" = type { %"class.vl::collections::ListBase.base.632", %"class.vl::collections::IEnumerable.630" }
%"class.vl::collections::ListBase.base.632" = type <{ %"class.vl::collections::ArrayBase.base.631", i64, i8 }>
%"class.vl::collections::ArrayBase.base.631" = type { %"class.vl::collections::ListStore.629", ptr, i64 }
%"class.vl::collections::ListStore.629" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.630" = type { %"class.vl::Interface" }
%"struct.vl::parsing::tabling::ParsingState::Future" = type { i64, i64, %"class.vl::collections::List.116", ptr, i64, ptr, ptr, ptr }

; 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(...)

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #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
define dso_local noundef ptr @_ZN2vl7parsing7tabling12ParsingState23ExploreCreateRootFutureEv(ptr noundef nonnull align 8 dereferenceable(256) %0) #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %7 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 104) #6
  invoke void @_ZN2vl7parsing7tabling12ParsingState6FutureC2Ev(ptr noundef nonnull align 8 dereferenceable(104) %7)
          to label %8 unwind label %16

8:                                                ; preds = %1
  store ptr %7, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %"class.vl::parsing::tabling::ParsingState", ptr %6, i32 0, i32 7
  %10 = call noundef ptr @_ZNK2vl3PtrINS_7parsing7tabling12ParsingState10StateGroupEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %11 = getelementptr inbounds %"struct.vl::parsing::tabling::ParsingState::StateGroup", ptr %10, i32 0, i32 1
  %12 = load i64, ptr %11, align 8, !tbaa !9
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.vl::parsing::tabling::ParsingState::Future", ptr %13, i32 0, i32 0
  store i64 %12, ptr %14, align 8, !tbaa !22
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret ptr %15

16:                                               ; preds = %1
  %17 = landingpad { ptr, i32 }
          cleanup
  %18 = extractvalue { ptr, i32 } %17, 0
  store ptr %18, ptr %4, align 8
  %19 = extractvalue { ptr, i32 } %17, 1
  store i32 %19, ptr %5, align 4
  call void @_ZdlPvm(ptr noundef %7, i64 noundef 104) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %20

20:                                               ; preds = %16
  %21 = load ptr, ptr %4, align 8
  %22 = load i32, ptr %5, align 4
  %23 = insertvalue { ptr, i32 } poison, ptr %21, 0
  %24 = insertvalue { ptr, i32 } %23, i32 %22, 1
  resume { ptr, i32 } %24
}

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

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 = { builtin allocsize(0) }
attributes #7 = { 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, !16, i64 48}
!10 = !{!"_ZTSN2vl7parsing7tabling12ParsingState10StateGroupE", !11, i64 0, !16, i64 48, !16, i64 56, !18, i64 64, !6, i64 112, !6, i64 120}
!11 = !{!"_ZTSN2vl11collections4ListIllEE", !12, i64 0}
!12 = !{!"_ZTSN2vl11collections8ListBaseIllEE", !13, i64 0, !16, i64 24, !17, i64 32}
!13 = !{!"_ZTSN2vl11collections9ArrayBaseIlEE", !14, i64 0, !6, i64 8, !16, i64 16}
!14 = !{!"_ZTSN2vl11collections9ListStoreIlLb1EEE", !15, i64 0}
!15 = !{!"_ZTSN2vl6ObjectE"}
!16 = !{!"long", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTSN2vl11collections4ListIPNS_5regex10RegexTokenES4_EE", !19, i64 0}
!19 = !{!"_ZTSN2vl11collections8ListBaseIPNS_5regex10RegexTokenES4_EE", !20, i64 0, !16, i64 24, !17, i64 32}
!20 = !{!"_ZTSN2vl11collections9ArrayBaseIPNS_5regex10RegexTokenEEE", !21, i64 0, !6, i64 8, !16, i64 16}
!21 = !{!"_ZTSN2vl11collections9ListStoreIPNS_5regex10RegexTokenELb1EEE", !15, i64 0}
!22 = !{!23, !16, i64 0}
!23 = !{!"_ZTSN2vl7parsing7tabling12ParsingState6FutureE", !16, i64 0, !16, i64 8, !11, i64 16, !6, i64 64, !16, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}


; 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: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull ptr @_ZN2vl7parsing7tabling12ParsingState23ExploreCreateRootFutureEv(ptr noundef nonnull align 8 dereferenceable(256) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = tail call noalias noundef nonnull dereferenceable(104) ptr @_Znwm(i64 noundef 104) #4
  invoke void @_ZN2vl7parsing7tabling12ParsingState6FutureC2Ev(ptr noundef nonnull align 8 dereferenceable(104) %2)
          to label %3 unwind label %8

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 224
  %5 = tail call noundef ptr @_ZNK2vl3PtrINS_7parsing7tabling12ParsingState10StateGroupEEptEv(ptr noundef nonnull align 8 dereferenceable(32) %4)
  %6 = getelementptr inbounds i8, ptr %5, i64 48
  %7 = load i64, ptr %6, align 8, !tbaa !5
  store i64 %7, ptr %2, align 8, !tbaa !21
  ret ptr %2

8:                                                ; preds = %1
  %9 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %2, i64 noundef 104) #5
  resume { ptr, i32 } %9
}

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

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 = { 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 #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 = { 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 #4 = { builtin allocsize(0) }
attributes #5 = { 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, !15, i64 48}
!6 = !{!"_ZTSN2vl7parsing7tabling12ParsingState10StateGroupE", !7, i64 0, !15, i64 48, !15, i64 56, !17, i64 64, !12, i64 112, !12, i64 120}
!7 = !{!"_ZTSN2vl11collections4ListIllEE", !8, i64 0}
!8 = !{!"_ZTSN2vl11collections8ListBaseIllEE", !9, i64 0, !15, i64 24, !16, i64 32}
!9 = !{!"_ZTSN2vl11collections9ArrayBaseIlEE", !10, i64 0, !12, i64 8, !15, i64 16}
!10 = !{!"_ZTSN2vl11collections9ListStoreIlLb1EEE", !11, i64 0}
!11 = !{!"_ZTSN2vl6ObjectE"}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"long", !13, i64 0}
!16 = !{!"bool", !13, i64 0}
!17 = !{!"_ZTSN2vl11collections4ListIPNS_5regex10RegexTokenES4_EE", !18, i64 0}
!18 = !{!"_ZTSN2vl11collections8ListBaseIPNS_5regex10RegexTokenES4_EE", !19, i64 0, !15, i64 24, !16, i64 32}
!19 = !{!"_ZTSN2vl11collections9ArrayBaseIPNS_5regex10RegexTokenEEE", !20, i64 0, !12, i64 8, !15, i64 16}
!20 = !{!"_ZTSN2vl11collections9ListStoreIPNS_5regex10RegexTokenELb1EEE", !11, i64 0}
!21 = !{!22, !15, i64 0}
!22 = !{!"_ZTSN2vl7parsing7tabling12ParsingState6FutureE", !15, i64 0, !15, i64 8, !7, i64 16, !12, i64 64, !15, i64 72, !12, i64 80, !12, i64 88, !12, i64 96}


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