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

; 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_internal::PureResult" = type { i64, i64, i64, i64 }
%"class.vl::regex_internal::RichResult" = type { i64, i64, %"class.vl::collections::List.983" }
%"class.vl::collections::List.983" = type { %"class.vl::collections::ListBase.base.989", %"class.vl::collections::IEnumerable.987" }
%"class.vl::collections::ListBase.base.989" = type <{ %"class.vl::collections::ArrayBase.base.988", i64, i8 }>
%"class.vl::collections::ArrayBase.base.988" = type { %"class.vl::collections::ListStore.986", ptr, i64 }
%"class.vl::collections::ListStore.986" = type { %"class.vl::Object" }
%"class.vl::Object" = type { ptr }
%"class.vl::collections::IEnumerable.987" = type { %"class.vl::Interface" }
%"class.vl::Interface" = type { ptr }
%"class.vl::regex::Regex" = type { %"class.vl::Object", 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48)) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN2vl14regex_internal15RichInterpretor5MatchEPKwS3_RNS0_10RichResultE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(64)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN2vl14regex_internal10RichResultD2Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN2vl14regex_internal15PureInterpretor5MatchEPKwS3_RNS0_10PureResultE(ptr noundef nonnull align 8 dereferenceable(8912952), ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(32)) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK2vl5regex5Regex4TestERKNS_12ObjectStringIwEE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.vl::regex_internal::PureResult", align 8
  %7 = alloca %"class.vl::regex_internal::RichResult", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  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
  %11 = getelementptr inbounds %"class.vl::regex::Regex", ptr %10, i32 0, i32 1
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %22

14:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #5
  %15 = getelementptr inbounds %"class.vl::regex::Regex", ptr %10, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = call noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48) %17)
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = call noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48) %19)
  %21 = call noundef zeroext i1 @_ZN2vl14regex_internal15PureInterpretor5MatchEPKwS3_RNS0_10PureResultE(ptr noundef nonnull align 8 dereferenceable(8912952) %16, ptr noundef %18, ptr noundef %20, ptr noundef nonnull align 8 dereferenceable(32) %6)
  store i1 %21, ptr %3, align 1
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #5
  br label %37

22:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 64, ptr %7) #5
  call void @_ZN2vl14regex_internal10RichResultC2Ev(ptr noundef nonnull align 8 dereferenceable(64) %7)
  %23 = getelementptr inbounds %"class.vl::regex::Regex", ptr %10, i32 0, i32 2
  %24 = load ptr, ptr %23, align 8, !tbaa !12
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = invoke noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48) %25)
          to label %27 unwind label %33

27:                                               ; preds = %22
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = invoke noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48) %28)
          to label %30 unwind label %33

30:                                               ; preds = %27
  %31 = invoke noundef zeroext i1 @_ZN2vl14regex_internal15RichInterpretor5MatchEPKwS3_RNS0_10RichResultE(ptr noundef nonnull align 8 dereferenceable(48) %24, ptr noundef %26, ptr noundef %29, ptr noundef nonnull align 8 dereferenceable(64) %7)
          to label %32 unwind label %33

32:                                               ; preds = %30
  store i1 %31, ptr %3, align 1
  call void @_ZN2vl14regex_internal10RichResultD2Ev(ptr noundef nonnull align 8 dereferenceable(64) %7) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %7) #5
  br label %37

33:                                               ; preds = %30, %27, %22
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %8, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %9, align 4
  call void @_ZN2vl14regex_internal10RichResultD2Ev(ptr noundef nonnull align 8 dereferenceable(64) %7) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %7) #5
  br label %39

37:                                               ; preds = %32, %14
  %38 = load i1, ptr %3, align 1
  ret i1 %38

39:                                               ; preds = %33
  %40 = load ptr, ptr %8, align 8
  %41 = load i32, ptr %9, align 4
  %42 = insertvalue { ptr, i32 } poison, ptr %40, 0
  %43 = insertvalue { ptr, i32 } %42, i32 %41, 1
  resume { ptr, i32 } %43
}

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 = { inlinehint 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 = { inlinehint 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 = { 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 }

!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, !6, i64 8}
!10 = !{!"_ZTSN2vl5regex5RegexE", !11, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!"_ZTSN2vl6ObjectE"}
!12 = !{!10, !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"

%"class.vl::regex_internal::PureResult" = type { i64, i64, i64, i64 }
%"class.vl::regex_internal::RichResult" = type { i64, i64, %"class.vl::collections::List.983" }
%"class.vl::collections::List.983" = type { %"class.vl::collections::ListBase.base.989", %"class.vl::collections::IEnumerable.987" }
%"class.vl::collections::ListBase.base.989" = type <{ %"class.vl::collections::ArrayBase.base.988", i64, i8 }>
%"class.vl::collections::ArrayBase.base.988" = type { %"class.vl::collections::ListStore.986", ptr, i64 }
%"class.vl::collections::ListStore.986" = type { %"class.vl::Object" }
%"class.vl::Object" = type { ptr }
%"class.vl::collections::IEnumerable.987" = type { %"class.vl::Interface" }
%"class.vl::Interface" = type { ptr }

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN2vl14regex_internal10RichResultD2Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN2vl14regex_internal15PureInterpretor5MatchEPKwS3_RNS0_10PureResultE(ptr noundef nonnull align 8 dereferenceable(8912952), ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK2vl5regex5Regex4TestERKNS_12ObjectStringIwEE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(48) %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.vl::regex_internal::PureResult", align 8
  %4 = alloca %"class.vl::regex_internal::RichResult", align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %11, label %7

7:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  %8 = tail call noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
  %9 = tail call noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
  %10 = call noundef zeroext i1 @_ZN2vl14regex_internal15PureInterpretor5MatchEPKwS3_RNS0_10PureResultE(ptr noundef nonnull align 8 dereferenceable(8912952) %6, ptr noundef %8, ptr noundef %9, ptr noundef nonnull align 8 dereferenceable(32) %3)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  br label %22

11:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #5
  call void @_ZN2vl14regex_internal10RichResultC2Ev(ptr noundef nonnull align 8 dereferenceable(64) %4)
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  %14 = invoke noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
          to label %15 unwind label %20

15:                                               ; preds = %11
  %16 = invoke noundef ptr @_ZNK2vl12ObjectStringIwE6BufferEv(ptr noundef nonnull align 8 dereferenceable(48) %1)
          to label %17 unwind label %20

17:                                               ; preds = %15
  %18 = invoke noundef zeroext i1 @_ZN2vl14regex_internal15RichInterpretor5MatchEPKwS3_RNS0_10RichResultE(ptr noundef nonnull align 8 dereferenceable(48) %13, ptr noundef %14, ptr noundef %16, ptr noundef nonnull align 8 dereferenceable(64) %4)
          to label %19 unwind label %20

19:                                               ; preds = %17
  call void @_ZN2vl14regex_internal10RichResultD2Ev(ptr noundef nonnull align 8 dereferenceable(64) %4) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #5
  br label %22

20:                                               ; preds = %17, %15, %11
  %21 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN2vl14regex_internal10RichResultD2Ev(ptr noundef nonnull align 8 dereferenceable(64) %4) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #5
  resume { ptr, i32 } %21

22:                                               ; preds = %19, %7
  %.0 = phi i1 [ %10, %7 ], [ %18, %19 ]
  ret i1 %.0
}

attributes #0 = { mustprogress 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 = { inlinehint 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 = { inlinehint 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 = { 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 }

!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, !8, i64 8}
!6 = !{!"_ZTSN2vl5regex5RegexE", !7, i64 0, !8, i64 8, !8, i64 16}
!7 = !{!"_ZTSN2vl6ObjectE"}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!6, !8, i64 16}


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