; 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::ParsingTreeNode" = type { %"class.vl::Object", %"class.vl::reflection::Description.base.597", %"struct.vl::parsing::ParsingTextRange", ptr, %"class.vl::collections::List.598", %"class.vl::reflection::DescriptableObject" }
%"class.vl::Object" = type { ptr }
%"class.vl::reflection::Description.base.597" = type { ptr }
%"struct.vl::parsing::ParsingTextRange" = type { %"struct.vl::parsing::ParsingTextPos", %"struct.vl::parsing::ParsingTextPos", i64 }
%"struct.vl::parsing::ParsingTextPos" = type { i64, i64, i64 }
%"class.vl::collections::List.598" = type { %"class.vl::collections::ListBase.base.604", %"class.vl::collections::IEnumerable.602" }
%"class.vl::collections::ListBase.base.604" = type <{ %"class.vl::collections::ArrayBase.base.603", i64, i8 }>
%"class.vl::collections::ArrayBase.base.603" = type { %"class.vl::collections::ListStore.601", ptr, i64 }
%"class.vl::collections::ListStore.601" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.602" = type { %"class.vl::Interface" }
%"class.vl::Interface" = type { ptr }
%"class.vl::reflection::DescriptableObject" = type { ptr, i64, ptr, i64, ptr, %"class.vl::Ptr.12" }
%"class.vl::Ptr.12" = 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 zeroext i1 @_ZNK2vl7parsing14ParsingTextPosltERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosgtERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN2vl7parsing15ParsingTreeNode11FindSubNodeERKNS0_16ParsingTextRangeE(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef nonnull align 8 dereferenceable(56) %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8
  %13 = getelementptr inbounds %"class.vl::parsing::ParsingTreeNode", ptr %12, i32 0, i32 2
  %14 = getelementptr inbounds %"struct.vl::parsing::ParsingTextRange", ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.vl::parsing::ParsingTextRange", ptr %15, i32 0, i32 0
  %17 = call noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosleERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 8 dereferenceable(24) %16)
  br i1 %17, label %18, label %84

18:                                               ; preds = %2
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.vl::parsing::ParsingTextRange", ptr %19, i32 0, i32 1
  %21 = getelementptr inbounds %"class.vl::parsing::ParsingTreeNode", ptr %12, i32 0, i32 2
  %22 = getelementptr inbounds %"struct.vl::parsing::ParsingTextRange", ptr %21, i32 0, i32 1
  %23 = call noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosleERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 8 dereferenceable(24) %22)
  br i1 %23, label %24, label %84

24:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 0, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %25 = getelementptr inbounds %"class.vl::parsing::ParsingTreeNode", ptr %12, i32 0, i32 4
  %26 = call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_7parsing15ParsingTreeNodeEEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %25)
  %27 = sub nsw i64 %26, 1
  store i64 %27, ptr %7, align 8, !tbaa !9
  br label %28

28:                                               ; preds = %79, %24
  %29 = load i64, ptr %6, align 8, !tbaa !9
  %30 = load i64, ptr %7, align 8, !tbaa !9
  %31 = icmp sle i64 %29, %30
  br i1 %31, label %32, label %80

32:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %33 = load i64, ptr %6, align 8, !tbaa !9
  %34 = load i64, ptr %7, align 8, !tbaa !9
  %35 = add nsw i64 %33, %34
  %36 = sdiv i64 %35, 2
  store i64 %36, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %37 = getelementptr inbounds %"class.vl::parsing::ParsingTreeNode", ptr %12, i32 0, i32 4
  %38 = load i64, ptr %8, align 8, !tbaa !9
  %39 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl11collections4ListINS_3PtrINS_7parsing15ParsingTreeNodeEEEPS4_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %37, i64 noundef %38)
  %40 = call noundef ptr @_ZNK2vl3PtrINS_7parsing15ParsingTreeNodeEE3ObjEv(ptr noundef nonnull align 8 dereferenceable(32) %39)
  store ptr %40, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = getelementptr inbounds %"class.vl::parsing::ParsingTreeNode", ptr %41, i32 0, i32 2
  store ptr %42, ptr %10, align 8, !tbaa !5
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.vl::parsing::ParsingTextRange", ptr %43, i32 0, i32 1
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.vl::parsing::ParsingTextRange", ptr %45, i32 0, i32 0
  %47 = call noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosltERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %44, ptr noundef nonnull align 8 dereferenceable(24) %46)
  br i1 %47, label %48, label %51

48:                                               ; preds = %32
  %49 = load i64, ptr %8, align 8, !tbaa !9
  %50 = sub nsw i64 %49, 1
  store i64 %50, ptr %7, align 8, !tbaa !9
  br label %76

51:                                               ; preds = %32
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.vl::parsing::ParsingTextRange", ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.vl::parsing::ParsingTextRange", ptr %54, i32 0, i32 1
  %56 = call noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosgtERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %53, ptr noundef nonnull align 8 dereferenceable(24) %55)
  br i1 %56, label %57, label %60

57:                                               ; preds = %51
  %58 = load i64, ptr %8, align 8, !tbaa !9
  %59 = add nsw i64 %58, 1
  store i64 %59, ptr %6, align 8, !tbaa !9
  br label %75

60:                                               ; preds = %51
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = getelementptr inbounds %"struct.vl::parsing::ParsingTextRange", ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.vl::parsing::ParsingTextRange", ptr %63, i32 0, i32 0
  %65 = call noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosleERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %62, ptr noundef nonnull align 8 dereferenceable(24) %64)
  br i1 %65, label %66, label %74

66:                                               ; preds = %60
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %"struct.vl::parsing::ParsingTextRange", ptr %67, i32 0, i32 1
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = getelementptr inbounds %"struct.vl::parsing::ParsingTextRange", ptr %69, i32 0, i32 1
  %71 = call noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosleERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef nonnull align 8 dereferenceable(24) %70)
  br i1 %71, label %72, label %74

72:                                               ; preds = %66
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %73, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %77

74:                                               ; preds = %66, %60
  store ptr %12, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %77

75:                                               ; preds = %57
  br label %76

76:                                               ; preds = %75, %48
  store i32 0, ptr %11, align 4
  br label %77

77:                                               ; preds = %76, %74, %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %78 = load i32, ptr %11, align 4
  switch i32 %78, label %81 [
    i32 0, label %79
  ]

79:                                               ; preds = %77
  br label %28, !llvm.loop !11

80:                                               ; preds = %28
  store i32 0, ptr %11, align 4
  br label %81

81:                                               ; preds = %80, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %82 = load i32, ptr %11, align 4
  switch i32 %82, label %87 [
    i32 0, label %83
    i32 1, label %85
  ]

83:                                               ; preds = %81
  br label %84

84:                                               ; preds = %83, %18, %2
  store ptr %12, ptr %3, align 8
  br label %85

85:                                               ; preds = %84, %81
  %86 = load ptr, ptr %3, align 8
  ret ptr %86

87:                                               ; preds = %81
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosleERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK2vl3PtrINS_7parsing15ParsingTreeNodeEE3ObjEv(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 zeroext i1 @_ZNK2vl7parsing14ParsingTextPosltERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN2vl7parsing15ParsingTreeNode11FindSubNodeERKNS0_16ParsingTextRangeE(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef nonnull align 8 dereferenceable(56) %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = tail call noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosleERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %1)
  br i1 %4, label %5, label %.thread34

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %1, i64 24
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  %8 = tail call noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosleERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %7)
  br i1 %8, label %9, label %.thread34

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %0, i64 80
  %11 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_7parsing15ParsingTreeNodeEEEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %10)
  %.not.not39 = icmp slt i64 %11, 1
  br i1 %.not.not39, label %.thread34, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %9
  %12 = add nsw i64 %11, -1
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %31
  %.02441 = phi i64 [ %.226, %31 ], [ 0, %.lr.ph.preheader ]
  %.02740 = phi i64 [ %.229, %31 ], [ %12, %.lr.ph.preheader ]
  %13 = add nuw nsw i64 %.02441, %.02740
  %14 = lshr i64 %13, 1
  %15 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl11collections4ListINS_3PtrINS_7parsing15ParsingTreeNodeEEEPS4_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %10, i64 noundef %14)
  %16 = tail call noundef ptr @_ZNK2vl3PtrINS_7parsing15ParsingTreeNodeEE3ObjEv(ptr noundef nonnull align 8 dereferenceable(32) %15)
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  %18 = tail call noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosltERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %17)
  br i1 %18, label %19, label %21

19:                                               ; preds = %.lr.ph
  %20 = add nsw i64 %14, -1
  br label %31

21:                                               ; preds = %.lr.ph
  %22 = getelementptr inbounds i8, ptr %16, i64 40
  %23 = tail call noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosgtERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %22)
  br i1 %23, label %24, label %26

24:                                               ; preds = %21
  %25 = add nuw nsw i64 %14, 1
  br label %31

26:                                               ; preds = %21
  %27 = tail call noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosleERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %1)
  br i1 %27, label %28, label %30

28:                                               ; preds = %26
  %29 = tail call noundef zeroext i1 @_ZNK2vl7parsing14ParsingTextPosleERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %22)
  br i1 %29, label %.thread34, label %30

30:                                               ; preds = %28, %26
  br label %.thread34

31:                                               ; preds = %19, %24
  %.229 = phi i64 [ %20, %19 ], [ %.02740, %24 ]
  %.226 = phi i64 [ %.02441, %19 ], [ %25, %24 ]
  %.not.not = icmp sgt i64 %.226, %.229
  br i1 %.not.not, label %.thread34, label %.lr.ph, !llvm.loop !5

.thread34:                                        ; preds = %31, %9, %2, %5, %28, %30
  %.3 = phi ptr [ %16, %28 ], [ %0, %30 ], [ %0, %5 ], [ %0, %2 ], [ %0, %9 ], [ %0, %31 ]
  ret ptr %.3
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK2vl11collections9ArrayBaseINS_3PtrINS_7parsing15ParsingTreeNodeEEEE5CountEv(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(32) ptr @_ZN2vl11collections4ListINS_3PtrINS_7parsing15ParsingTreeNodeEEEPS4_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 ptr @_ZNK2vl3PtrINS_7parsing15ParsingTreeNodeEE3ObjEv(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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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