; LLVM IR from vczh/herodb :: Kernel/Source/Vlpp.ll (ZN2vl14regex_internal6IsNameERPKwRNS_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::ObjectString" = type { %"class.vl::Object", ptr, ptr, i64, i64, i64 }
%"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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl12ObjectStringIwEC2EPKwl(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef, i64 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl14regex_internal6IsNameERPKwRNS_12ObjectStringIwEE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(48) %1) #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.vl::ObjectString", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %12, ptr %6, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = load i32, ptr %13, align 4, !tbaa !9
  %15 = icmp sle i32 65, %14
  br i1 %15, label %16, label %20

16:                                               ; preds = %2
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = load i32, ptr %17, align 4, !tbaa !9
  %19 = icmp sle i32 %18, 90
  br i1 %19, label %32, label %20

20:                                               ; preds = %16, %2
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = icmp sle i32 97, %22
  br i1 %23, label %24, label %28

24:                                               ; preds = %20
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %27 = icmp sle i32 %26, 122
  br i1 %27, label %32, label %28

28:                                               ; preds = %24, %20
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = icmp eq i32 %30, 95
  br i1 %31, label %32, label %69

32:                                               ; preds = %28, %24, %16
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds i32, ptr %33, i32 1
  store ptr %34, ptr %6, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %65, %32
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = icmp sle i32 65, %37
  br i1 %38, label %39, label %43

39:                                               ; preds = %35
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = icmp sle i32 %41, 90
  br i1 %42, label %63, label %43

43:                                               ; preds = %39, %35
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = icmp sle i32 97, %45
  br i1 %46, label %47, label %51

47:                                               ; preds = %43
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = icmp sle i32 %49, 122
  br i1 %50, label %63, label %51

51:                                               ; preds = %47, %43
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = icmp sle i32 48, %53
  br i1 %54, label %55, label %59

55:                                               ; preds = %51
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = icmp sle i32 %57, 57
  br i1 %58, label %63, label %59

59:                                               ; preds = %55, %51
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = icmp eq i32 %61, 95
  br label %63

63:                                               ; preds = %59, %55, %47, %39
  %64 = phi i1 [ true, %55 ], [ true, %47 ], [ true, %39 ], [ %62, %59 ]
  br i1 %64, label %65, label %68

65:                                               ; preds = %63
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds i32, ptr %66, i32 1
  store ptr %67, ptr %6, align 8, !tbaa !5
  br label %35, !llvm.loop !11

68:                                               ; preds = %63
  br label %69

69:                                               ; preds = %68, %28
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = load ptr, ptr %70, align 8, !tbaa !5
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = icmp eq ptr %71, %72
  br i1 %73, label %74, label %75

74:                                               ; preds = %69
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %94

75:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 48, ptr %8) #3
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = load ptr, ptr %79, align 8, !tbaa !5
  %81 = ptrtoint ptr %78 to i64
  %82 = ptrtoint ptr %80 to i64
  %83 = sub i64 %81, %82
  %84 = sdiv exact i64 %83, 4
  call void @_ZN2vl12ObjectStringIwEC2EPKwl(ptr noundef nonnull align 8 dereferenceable(48) %8, ptr noundef %77, i64 noundef %84)
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = invoke noundef nonnull align 8 dereferenceable(48) ptr @_ZN2vl12ObjectStringIwEaSEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %85, ptr noundef nonnull align 8 dereferenceable(48) %8)
          to label %87 unwind label %90

87:                                               ; preds = %75
  call void @_ZN2vl12ObjectStringIwED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %8) #3
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %88, ptr %89, align 8, !tbaa !5
  store i1 true, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %94

90:                                               ; preds = %75
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %9, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %10, align 4
  call void @_ZN2vl12ObjectStringIwED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %96

94:                                               ; preds = %87, %74
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %95 = load i1, ptr %3, align 1
  ret i1 %95

96:                                               ; preds = %90
  %97 = load ptr, ptr %9, align 8
  %98 = load i32, ptr %10, align 4
  %99 = insertvalue { ptr, i32 } poison, ptr %97, 0
  %100 = insertvalue { ptr, i32 } %99, i32 %98, 1
  resume { ptr, i32 } %100
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = { 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 = 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"

%"class.vl::ObjectString" = type { %"class.vl::Object", ptr, ptr, i64, i64, i64 }
%"class.vl::Object" = 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 nounwind uwtable
declare dso_local void @_ZN2vl12ObjectStringIwED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl12ObjectStringIwEC2EPKwl(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef, i64 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl14regex_internal6IsNameERPKwRNS_12ObjectStringIwEE(ptr nocapture noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(48) %1) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.vl::ObjectString", align 8
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = load i32, ptr %4, align 4, !tbaa !9
  %6 = add i32 %5, -65
  %or.cond = icmp ult i32 %6, 26
  br i1 %or.cond, label %.critedge.preheader, label %7

7:                                                ; preds = %2
  %8 = add i32 %5, -97
  %or.cond30 = icmp ult i32 %8, 26
  %9 = icmp eq i32 %5, 95
  %or.cond36 = or i1 %9, %or.cond30
  br i1 %or.cond36, label %.critedge.preheader, label %22

.critedge.preheader:                              ; preds = %7, %2
  br label %.critedge

.critedge:                                        ; preds = %.critedge.backedge, %.critedge.preheader
  %.pn = phi ptr [ %4, %.critedge.preheader ], [ %.0, %.critedge.backedge ]
  %.0 = getelementptr inbounds i8, ptr %.pn, i64 4
  %10 = load i32, ptr %.0, align 4, !tbaa !9
  %11 = and i32 %10, -33
  %12 = add i32 %11, -65
  %or.cond38 = icmp ult i32 %12, 26
  br i1 %or.cond38, label %.critedge.backedge, label %13

13:                                               ; preds = %.critedge
  %14 = add i32 %10, -48
  %or.cond33 = icmp ult i32 %14, 10
  %15 = icmp eq i32 %10, 95
  %or.cond37 = or i1 %15, %or.cond33
  br i1 %or.cond37, label %.critedge.backedge, label %16

.critedge.backedge:                               ; preds = %13, %.critedge
  br label %.critedge, !llvm.loop !11

16:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #3
  %17 = ptrtoint ptr %.0 to i64
  %18 = ptrtoint ptr %4 to i64
  %19 = sub i64 %17, %18
  %20 = ashr exact i64 %19, 2
  call void @_ZN2vl12ObjectStringIwEC2EPKwl(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull %4, i64 noundef %20)
  %21 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZN2vl12ObjectStringIwEaSEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(48) %3)
  call void @_ZN2vl12ObjectStringIwED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #3
  store ptr %.0, ptr %0, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %7, %16
  %23 = phi i1 [ true, %16 ], [ false, %7 ]
  ret i1 %23
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass