; 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"

; 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 nounwind uwtable
declare dso_local noundef i64 @_ZNK2vl12ObjectStringIwE6LengthEv(ptr noundef nonnull align 8 dereferenceable(48)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl14regex_internal27IsRegexEscapedLiteralStringERKNS_12ObjectStringIwEE(ptr noundef nonnull align 8 dereferenceable(48) %0) #2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %7

7:                                                ; preds = %33, %1
  %8 = load i64, ptr %4, align 8, !tbaa !9
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = call noundef i64 @_ZNK2vl12ObjectStringIwE6LengthEv(ptr noundef nonnull align 8 dereferenceable(48) %9)
  %11 = icmp slt i64 %8, %10
  br i1 %11, label %13, label %12

12:                                               ; preds = %7
  store i32 2, ptr %5, align 4
  br label %36

13:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = load i64, ptr %4, align 8, !tbaa !9
  %16 = call noundef signext i32 @_ZNK2vl12ObjectStringIwEixEl(ptr noundef nonnull align 8 dereferenceable(48) %14, i64 noundef %15)
  store i32 %16, ptr %6, align 4, !tbaa !11
  %17 = load i32, ptr %6, align 4, !tbaa !11
  %18 = icmp eq i32 %17, 92
  br i1 %18, label %22, label %19

19:                                               ; preds = %13
  %20 = load i32, ptr %6, align 4, !tbaa !11
  %21 = icmp eq i32 %20, 47
  br i1 %21, label %22, label %25

22:                                               ; preds = %19, %13
  %23 = load i64, ptr %4, align 8, !tbaa !9
  %24 = add nsw i64 %23, 1
  store i64 %24, ptr %4, align 8, !tbaa !9
  br label %29

25:                                               ; preds = %19
  %26 = load i32, ptr %6, align 4, !tbaa !11
  switch i32 %26, label %28 [
    i32 92, label %27
    i32 47, label %27
    i32 40, label %27
    i32 41, label %27
    i32 43, label %27
    i32 42, label %27
    i32 63, label %27
    i32 124, label %27
    i32 123, label %27
    i32 125, label %27
    i32 91, label %27
    i32 93, label %27
    i32 60, label %27
    i32 62, label %27
    i32 94, label %27
    i32 36, label %27
    i32 33, label %27
    i32 61, label %27
  ]

27:                                               ; preds = %25, %25, %25, %25, %25, %25, %25, %25, %25, %25, %25, %25, %25, %25, %25, %25, %25, %25
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %30

28:                                               ; preds = %25
  br label %29

29:                                               ; preds = %28, %22
  store i32 0, ptr %5, align 4
  br label %30

30:                                               ; preds = %29, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %31 = load i32, ptr %5, align 4
  switch i32 %31, label %36 [
    i32 0, label %32
  ]

32:                                               ; preds = %30
  br label %33

33:                                               ; preds = %32
  %34 = load i64, ptr %4, align 8, !tbaa !9
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr %4, align 8, !tbaa !9
  br label %7, !llvm.loop !13

36:                                               ; preds = %30, %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %37 = load i32, ptr %5, align 4
  switch i32 %37, label %41 [
    i32 2, label %38
    i32 1, label %39
  ]

38:                                               ; preds = %36
  store i1 true, ptr %2, align 1
  br label %39

39:                                               ; preds = %38, %36
  %40 = load i1, ptr %2, align 1
  ret i1 %40

41:                                               ; preds = %36
  unreachable
}

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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"wchar_t", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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 nounwind uwtable
declare dso_local noundef i64 @_ZNK2vl12ObjectStringIwE6LengthEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN2vl14regex_internal27IsRegexEscapedLiteralStringERKNS_12ObjectStringIwEE(ptr noundef nonnull align 8 dereferenceable(48) %0) local_unnamed_addr #1 {
  %2 = tail call noundef i64 @_ZNK2vl12ObjectStringIwE6LengthEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %3 = icmp slt i64 %2, 1
  br i1 %3, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1, %7
  %.01421 = phi i64 [ %8, %7 ], [ 0, %1 ]
  %4 = tail call noundef signext i32 @_ZNK2vl12ObjectStringIwEixEl(ptr noundef nonnull align 8 dereferenceable(48) %0, i64 noundef %.01421)
  switch i32 %4, label %7 [
    i32 92, label %5
    i32 47, label %5
    i32 33, label %._crit_edge
    i32 61, label %._crit_edge
    i32 40, label %._crit_edge
    i32 41, label %._crit_edge
    i32 43, label %._crit_edge
    i32 42, label %._crit_edge
    i32 63, label %._crit_edge
    i32 124, label %._crit_edge
    i32 123, label %._crit_edge
    i32 125, label %._crit_edge
    i32 91, label %._crit_edge
    i32 93, label %._crit_edge
    i32 60, label %._crit_edge
    i32 62, label %._crit_edge
    i32 94, label %._crit_edge
    i32 36, label %._crit_edge
  ]

5:                                                ; preds = %.lr.ph, %.lr.ph
  %6 = add nsw i64 %.01421, 1
  br label %7

7:                                                ; preds = %.lr.ph, %5
  %.216.ph = phi i64 [ %6, %5 ], [ %.01421, %.lr.ph ]
  %8 = add nsw i64 %.216.ph, 1
  %9 = tail call noundef i64 @_ZNK2vl12ObjectStringIwE6LengthEv(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %.not = icmp slt i64 %8, %9
  br i1 %.not, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %7, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %.lr.ph, %1
  %.lcssa = phi i1 [ true, %1 ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ false, %.lr.ph ], [ true, %7 ]
  ret i1 %.lcssa
}

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

!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,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass