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

; 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::Transition" = type { %"class.vl::Object", ptr, ptr, %"class.vl::collections::List.386", i32, i32, ptr }
%"class.vl::collections::List.386" = type { %"class.vl::collections::ListBase.base.392", %"class.vl::collections::IEnumerable.390" }
%"class.vl::collections::ListBase.base.392" = type <{ %"class.vl::collections::ArrayBase.base.391", i64, i8 }>
%"class.vl::collections::ArrayBase.base.391" = type { %"class.vl::collections::ListStore.389", ptr, i64 }
%"class.vl::collections::ListStore.389" = type { %"class.vl::Object" }
%"class.vl::collections::IEnumerable.390" = 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 uwtable
declare dso_local noundef zeroext i1 @_ZN2vl7parsing9analyzing10Transition12IsEquivalentEPS2_S3_b(ptr noundef, ptr noundef, i1 noundef zeroext) #1 align 2

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

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

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

17:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  br label %59

18:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %53, %18
  %20 = load i64, ptr %6, align 8, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %"class.vl::parsing::analyzing::State", ptr %21, i32 0, i32 2
  %23 = call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %24 = icmp slt i64 %20, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %19
  store i32 2, ptr %7, align 4
  br label %56

26:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.vl::parsing::analyzing::State", ptr %27, i32 0, i32 2
  %29 = load i64, ptr %6, align 8, !tbaa !9
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing9analyzing10TransitionES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %28, i64 noundef %29)
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  store ptr %31, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %"class.vl::parsing::analyzing::State", ptr %32, i32 0, i32 2
  %34 = load i64, ptr %6, align 8, !tbaa !9
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing9analyzing10TransitionES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %33, i64 noundef %34)
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  store ptr %36, ptr %9, align 8, !tbaa !5
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = call noundef zeroext i1 @_ZN2vl7parsing9analyzing10Transition12IsEquivalentEPS2_S3_b(ptr noundef %37, ptr noundef %38, i1 noundef zeroext false)
  br i1 %39, label %40, label %48

40:                                               ; preds = %26
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %"class.vl::parsing::analyzing::Transition", ptr %41, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !11
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = getelementptr inbounds %"class.vl::parsing::analyzing::Transition", ptr %44, i32 0, i32 1
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  %47 = icmp ne ptr %43, %46
  br i1 %47, label %48, label %49

48:                                               ; preds = %40, %26
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %50

49:                                               ; preds = %40
  store i32 0, ptr %7, align 4
  br label %50

50:                                               ; preds = %49, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %51 = load i32, ptr %7, align 4
  switch i32 %51, label %56 [
    i32 0, label %52
  ]

52:                                               ; preds = %50
  br label %53

53:                                               ; preds = %52
  %54 = load i64, ptr %6, align 8, !tbaa !9
  %55 = add nsw i64 %54, 1
  store i64 %55, ptr %6, align 8, !tbaa !9
  br label %19, !llvm.loop !21

56:                                               ; preds = %50, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %57 = load i32, ptr %7, align 4
  switch i32 %57, label %61 [
    i32 2, label %58
    i32 1, label %59
  ]

58:                                               ; preds = %56
  store i1 true, ptr %3, align 1
  br label %59

59:                                               ; preds = %58, %56, %17
  %60 = load i1, ptr %3, align 1
  ret i1 %60

61:                                               ; preds = %56
  unreachable
}

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 = !{!12, !6, i64 8}
!12 = !{!"_ZTSN2vl7parsing9analyzing10TransitionE", !13, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !19, i64 72, !20, i64 76, !6, i64 80}
!13 = !{!"_ZTSN2vl6ObjectE"}
!14 = !{!"_ZTSN2vl11collections4ListINS_3PtrINS_7parsing9analyzing6ActionEEEPS5_EE", !15, i64 0}
!15 = !{!"_ZTSN2vl11collections8ListBaseINS_3PtrINS_7parsing9analyzing6ActionEEEPS5_EE", !16, i64 0, !10, i64 24, !18, i64 32}
!16 = !{!"_ZTSN2vl11collections9ArrayBaseINS_3PtrINS_7parsing9analyzing6ActionEEEEE", !17, i64 0, !6, i64 8, !10, i64 16}
!17 = !{!"_ZTSN2vl11collections9ListStoreINS_3PtrINS_7parsing9analyzing6ActionEEELb0EEE", !13, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTSN2vl7parsing9analyzing10Transition14TransitionTypeE", !7, i64 0}
!20 = !{!"_ZTSN2vl7parsing9analyzing10Transition18StackOperationTypeE", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"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 @_ZN2vl7parsing9analyzing10Transition12IsEquivalentEPS2_S3_b(ptr noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl7parsing9analyzing23IsMergableBecauseInputsEPNS1_5StateES3_(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 56
  %4 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %5 = getelementptr inbounds i8, ptr %1, i64 56
  %6 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %.not = icmp eq i64 %4, %6
  br i1 %.not, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %2
  %7 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %8 = icmp slt i64 %7, 1
  br i1 %8, label %.loopexit, label %.lr.ph

9:                                                ; preds = %.critedge
  %10 = add nuw nsw i64 %.01519, 1
  %11 = tail call noundef i64 @_ZNK2vl11collections9ArrayBaseIPNS_7parsing9analyzing10TransitionEE5CountEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %.not23 = icmp slt i64 %10, %11
  br i1 %.not23, label %.lr.ph, label %.loopexit, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader, %9
  %.01519 = phi i64 [ %10, %9 ], [ 0, %.preheader ]
  %12 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing9analyzing10TransitionES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %3, i64 noundef %.01519)
  %13 = load ptr, ptr %12, align 8, !tbaa !7
  %14 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2vl11collections4ListIPNS_7parsing9analyzing10TransitionES5_EixEl(ptr noundef nonnull align 8 dereferenceable(33) %5, i64 noundef %.01519)
  %15 = load ptr, ptr %14, align 8, !tbaa !7
  %16 = tail call noundef zeroext i1 @_ZN2vl7parsing9analyzing10Transition12IsEquivalentEPS2_S3_b(ptr noundef %13, ptr noundef %15, i1 noundef zeroext false)
  br i1 %16, label %.critedge, label %.loopexit

.critedge:                                        ; preds = %.lr.ph
  %17 = getelementptr inbounds i8, ptr %13, i64 8
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = getelementptr inbounds i8, ptr %15, i64 8
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  %.not18 = icmp eq ptr %18, %20
  br i1 %.not18, label %9, label %.loopexit

.loopexit:                                        ; preds = %.critedge, %.lr.ph, %9, %.preheader, %2
  %.3 = phi i1 [ false, %2 ], [ true, %.preheader ], [ false, %.critedge ], [ false, %.lr.ph ], [ true, %9 ]
  ret i1 %.3
}

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"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!12, !8, i64 8}
!12 = !{!"_ZTSN2vl7parsing9analyzing10TransitionE", !13, i64 0, !8, i64 8, !8, i64 16, !14, i64 24, !20, i64 72, !21, i64 76, !8, i64 80}
!13 = !{!"_ZTSN2vl6ObjectE"}
!14 = !{!"_ZTSN2vl11collections4ListINS_3PtrINS_7parsing9analyzing6ActionEEEPS5_EE", !15, i64 0}
!15 = !{!"_ZTSN2vl11collections8ListBaseINS_3PtrINS_7parsing9analyzing6ActionEEEPS5_EE", !16, i64 0, !18, i64 24, !19, i64 32}
!16 = !{!"_ZTSN2vl11collections9ArrayBaseINS_3PtrINS_7parsing9analyzing6ActionEEEEE", !17, i64 0, !8, i64 8, !18, i64 16}
!17 = !{!"_ZTSN2vl11collections9ListStoreINS_3PtrINS_7parsing9analyzing6ActionEEELb0EEE", !13, i64 0}
!18 = !{!"long", !9, i64 0}
!19 = !{!"bool", !9, i64 0}
!20 = !{!"_ZTSN2vl7parsing9analyzing10Transition14TransitionTypeE", !9, i64 0}
!21 = !{!"_ZTSN2vl7parsing9analyzing10Transition18StackOperationTypeE", !9, i64 0}


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