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

; 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::regex::RegexLexerWalker" = type { %"class.vl::Object", ptr, ptr }
%"class.vl::Object" = type { 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 @_ZNK2vl11collections9ArrayBaseIlE3GetEl(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK2vl5regex16RegexLexerWalker4WalkEwRlS2_RbS3_(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef signext %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 1 dereferenceable(1) %4, ptr noundef nonnull align 1 dereferenceable(1) %5) #1 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %15 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %16 = load ptr, ptr %9, align 8, !tbaa !5
  %17 = load i64, ptr %16, align 8, !tbaa !11
  store i64 %17, ptr %13, align 8, !tbaa !11
  %18 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 -1, ptr %18, align 8, !tbaa !11
  %19 = load ptr, ptr %11, align 8, !tbaa !5
  store i8 0, ptr %19, align 1, !tbaa !13
  %20 = load ptr, ptr %12, align 8, !tbaa !5
  store i8 0, ptr %20, align 1, !tbaa !13
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = load i64, ptr %21, align 8, !tbaa !11
  %23 = icmp eq i64 %22, -1
  br i1 %23, label %24, label %30

24:                                               ; preds = %6
  %25 = getelementptr inbounds %"class.vl::regex::RegexLexerWalker", ptr %15, i32 0, i32 1
  %26 = load ptr, ptr %25, align 8, !tbaa !15
  %27 = call noundef i64 @_ZN2vl14regex_internal15PureInterpretor13GetStartStateEv(ptr noundef nonnull align 8 dereferenceable(8912952) %26)
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 %27, ptr %28, align 8, !tbaa !11
  %29 = load ptr, ptr %12, align 8, !tbaa !5
  store i8 1, ptr %29, align 1, !tbaa !13
  br label %30

30:                                               ; preds = %24, %6
  %31 = getelementptr inbounds %"class.vl::regex::RegexLexerWalker", ptr %15, i32 0, i32 1
  %32 = load ptr, ptr %31, align 8, !tbaa !15
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = load i64, ptr %34, align 8, !tbaa !11
  %36 = call noundef i64 @_ZN2vl14regex_internal15PureInterpretor7TransitEwl(ptr noundef nonnull align 8 dereferenceable(8912952) %32, i32 noundef signext %33, i64 noundef %35)
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 %36, ptr %37, align 8, !tbaa !11
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = load i64, ptr %38, align 8, !tbaa !11
  %40 = icmp eq i64 %39, -1
  br i1 %40, label %41, label %63

41:                                               ; preds = %30
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  store i8 1, ptr %42, align 1, !tbaa !13
  %43 = load i64, ptr %13, align 8, !tbaa !11
  %44 = icmp eq i64 %43, -1
  br i1 %44, label %45, label %47

45:                                               ; preds = %41
  %46 = load ptr, ptr %11, align 8, !tbaa !5
  store i8 1, ptr %46, align 1, !tbaa !13
  store i32 1, ptr %14, align 4
  br label %84

47:                                               ; preds = %41
  %48 = getelementptr inbounds %"class.vl::regex::RegexLexerWalker", ptr %15, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !15
  %50 = load i64, ptr %13, align 8, !tbaa !11
  %51 = call noundef zeroext i1 @_ZN2vl14regex_internal15PureInterpretor12IsFinalStateEl(ptr noundef nonnull align 8 dereferenceable(8912952) %49, i64 noundef %50)
  br i1 %51, label %52, label %61

52:                                               ; preds = %47
  %53 = getelementptr inbounds %"class.vl::regex::RegexLexerWalker", ptr %15, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !15
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = getelementptr inbounds %"class.vl::regex::RegexLexerWalker", ptr %15, i32 0, i32 1
  %57 = load ptr, ptr %56, align 8, !tbaa !15
  %58 = call noundef i64 @_ZN2vl14regex_internal15PureInterpretor13GetStartStateEv(ptr noundef nonnull align 8 dereferenceable(8912952) %57)
  %59 = call noundef i64 @_ZN2vl14regex_internal15PureInterpretor7TransitEwl(ptr noundef nonnull align 8 dereferenceable(8912952) %54, i32 noundef signext %55, i64 noundef %58)
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 %59, ptr %60, align 8, !tbaa !11
  br label %61

61:                                               ; preds = %52, %47
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62, %30
  %64 = getelementptr inbounds %"class.vl::regex::RegexLexerWalker", ptr %15, i32 0, i32 1
  %65 = load ptr, ptr %64, align 8, !tbaa !15
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = load i64, ptr %66, align 8, !tbaa !11
  %68 = call noundef zeroext i1 @_ZN2vl14regex_internal15PureInterpretor12IsFinalStateEl(ptr noundef nonnull align 8 dereferenceable(8912952) %65, i64 noundef %67)
  br i1 %68, label %69, label %78

69:                                               ; preds = %63
  %70 = getelementptr inbounds %"class.vl::regex::RegexLexerWalker", ptr %15, i32 0, i32 2
  %71 = load ptr, ptr %70, align 8, !tbaa !18
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = load i64, ptr %72, align 8, !tbaa !11
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK2vl11collections9ArrayBaseIlE3GetEl(ptr noundef nonnull align 8 dereferenceable(24) %71, i64 noundef %73)
  %75 = load i64, ptr %74, align 8, !tbaa !11
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 %75, ptr %76, align 8, !tbaa !11
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  store i8 1, ptr %77, align 1, !tbaa !13
  store i32 1, ptr %14, align 4
  br label %84

78:                                               ; preds = %63
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = load i64, ptr %79, align 8, !tbaa !11
  %81 = icmp eq i64 %80, -1
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  %83 = zext i1 %81 to i8
  store i8 %83, ptr %82, align 1, !tbaa !13
  store i32 1, ptr %14, align 4
  br label %84

84:                                               ; preds = %78, %69, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN2vl14regex_internal15PureInterpretor7TransitEwl(ptr noundef nonnull align 8 dereferenceable(8912952), i32 noundef signext, i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN2vl14regex_internal15PureInterpretor12IsFinalStateEl(ptr noundef nonnull align 8 dereferenceable(8912952), i64 noundef) #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 = !{!"wchar_t", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!16, !6, i64 8}
!16 = !{!"_ZTSN2vl5regex16RegexLexerWalkerE", !17, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"_ZTSN2vl6ObjectE"}
!18 = !{!16, !6, i64 16}


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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK2vl5regex16RegexLexerWalker4WalkEwRlS2_RbS3_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %0, i32 noundef signext %1, ptr nocapture noundef nonnull align 8 dereferenceable(8) %2, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(8) %3, ptr nocapture noundef nonnull writeonly align 1 dereferenceable(1) %4, ptr nocapture noundef nonnull writeonly align 1 dereferenceable(1) %5) local_unnamed_addr #0 align 2 {
  %7 = load i64, ptr %2, align 8, !tbaa !5
  store i64 -1, ptr %3, align 8, !tbaa !5
  store i8 0, ptr %4, align 1, !tbaa !9
  store i8 0, ptr %5, align 1, !tbaa !9
  %8 = load i64, ptr %2, align 8, !tbaa !5
  %9 = icmp eq i64 %8, -1
  br i1 %9, label %10, label %14

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  %13 = tail call noundef i64 @_ZN2vl14regex_internal15PureInterpretor13GetStartStateEv(ptr noundef nonnull align 8 dereferenceable(8912952) %12)
  store i64 %13, ptr %2, align 8, !tbaa !5
  store i8 1, ptr %5, align 1, !tbaa !9
  br label %14

14:                                               ; preds = %10, %6
  %15 = phi i64 [ %13, %10 ], [ %8, %6 ]
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !11
  %18 = tail call noundef i64 @_ZN2vl14regex_internal15PureInterpretor7TransitEwl(ptr noundef nonnull align 8 dereferenceable(8912952) %17, i32 noundef signext %1, i64 noundef %15)
  store i64 %18, ptr %2, align 8, !tbaa !5
  %19 = icmp eq i64 %18, -1
  br i1 %19, label %20, label %29

20:                                               ; preds = %14
  store i8 1, ptr %5, align 1, !tbaa !9
  %21 = icmp eq i64 %7, -1
  br i1 %21, label %43, label %22

22:                                               ; preds = %20
  %23 = load ptr, ptr %16, align 8, !tbaa !11
  %24 = tail call noundef zeroext i1 @_ZN2vl14regex_internal15PureInterpretor12IsFinalStateEl(ptr noundef nonnull align 8 dereferenceable(8912952) %23, i64 noundef %7)
  br i1 %24, label %25, label %._crit_edge

._crit_edge:                                      ; preds = %22
  %.pre = load i64, ptr %2, align 8, !tbaa !5
  br label %29

25:                                               ; preds = %22
  %26 = load ptr, ptr %16, align 8, !tbaa !11
  %27 = tail call noundef i64 @_ZN2vl14regex_internal15PureInterpretor13GetStartStateEv(ptr noundef nonnull align 8 dereferenceable(8912952) %26)
  %28 = tail call noundef i64 @_ZN2vl14regex_internal15PureInterpretor7TransitEwl(ptr noundef nonnull align 8 dereferenceable(8912952) %26, i32 noundef signext %1, i64 noundef %27)
  store i64 %28, ptr %2, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %._crit_edge, %25, %14
  %30 = phi i64 [ %.pre, %._crit_edge ], [ %28, %25 ], [ %18, %14 ]
  %31 = load ptr, ptr %16, align 8, !tbaa !11
  %32 = tail call noundef zeroext i1 @_ZN2vl14regex_internal15PureInterpretor12IsFinalStateEl(ptr noundef nonnull align 8 dereferenceable(8912952) %31, i64 noundef %30)
  br i1 %32, label %33, label %39

33:                                               ; preds = %29
  %34 = getelementptr inbounds i8, ptr %0, i64 16
  %35 = load ptr, ptr %34, align 8, !tbaa !15
  %36 = load i64, ptr %2, align 8, !tbaa !5
  %37 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK2vl11collections9ArrayBaseIlE3GetEl(ptr noundef nonnull align 8 dereferenceable(24) %35, i64 noundef %36)
  %38 = load i64, ptr %37, align 8, !tbaa !5
  store i64 %38, ptr %3, align 8, !tbaa !5
  br label %43

39:                                               ; preds = %29
  %40 = load i64, ptr %2, align 8, !tbaa !5
  %41 = icmp eq i64 %40, -1
  %42 = zext i1 %41 to i8
  br label %43

43:                                               ; preds = %20, %39, %33
  %.sink = phi i8 [ %42, %39 ], [ 1, %33 ], [ 1, %20 ]
  store i8 %.sink, ptr %4, align 1, !tbaa !9
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN2vl14regex_internal15PureInterpretor7TransitEwl(ptr noundef nonnull align 8 dereferenceable(8912952), i32 noundef signext, i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN2vl14regex_internal15PureInterpretor12IsFinalStateEl(ptr noundef nonnull align 8 dereferenceable(8912952), i64 noundef) 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !14, i64 8}
!12 = !{!"_ZTSN2vl5regex16RegexLexerWalkerE", !13, i64 0, !14, i64 8, !14, i64 16}
!13 = !{!"_ZTSN2vl6ObjectE"}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!12, !14, i64 16}


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