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

; 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::PureInterpretor" = type { %"class.vl::Object", [1114112 x i64], ptr, ptr, ptr, i64, i64, i64 }
%"class.vl::Object" = type { ptr }

@_ZTVN2vl14regex_internal15PureInterpretorE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

; 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
define dso_local void @_ZN2vl14regex_internal15PureInterpretorD2Ev(ptr noundef nonnull align 8 dereferenceable(8912952) %0) unnamed_addr #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN2vl14regex_internal15PureInterpretorE, i32 0, i32 0, i32 2), ptr %4, align 8, !tbaa !9
  %5 = getelementptr inbounds %"class.vl::regex_internal::PureInterpretor", ptr %4, i32 0, i32 4
  %6 = load ptr, ptr %5, align 8, !tbaa !11
  %7 = icmp ne ptr %6, null
  br i1 %7, label %8, label %14

8:                                                ; preds = %1
  %9 = getelementptr inbounds %"class.vl::regex_internal::PureInterpretor", ptr %4, i32 0, i32 4
  %10 = load ptr, ptr %9, align 8, !tbaa !11
  %11 = icmp eq ptr %10, null
  br i1 %11, label %13, label %12

12:                                               ; preds = %8
  call void @_ZdaPv(ptr noundef %10) #3
  br label %13

13:                                               ; preds = %12, %8
  br label %14

14:                                               ; preds = %13, %1
  %15 = getelementptr inbounds %"class.vl::regex_internal::PureInterpretor", ptr %4, i32 0, i32 3
  %16 = load ptr, ptr %15, align 8, !tbaa !15
  %17 = icmp eq ptr %16, null
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  call void @_ZdaPv(ptr noundef %16) #3
  br label %19

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

20:                                               ; preds = %35, %19
  %21 = load i64, ptr %3, align 8, !tbaa !16
  %22 = getelementptr inbounds %"class.vl::regex_internal::PureInterpretor", ptr %4, i32 0, i32 5
  %23 = load i64, ptr %22, align 8, !tbaa !17
  %24 = icmp slt i64 %21, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %38

26:                                               ; preds = %20
  %27 = getelementptr inbounds %"class.vl::regex_internal::PureInterpretor", ptr %4, i32 0, i32 2
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  %29 = load i64, ptr %3, align 8, !tbaa !16
  %30 = getelementptr inbounds ptr, ptr %28, i64 %29
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  %32 = icmp eq ptr %31, null
  br i1 %32, label %34, label %33

33:                                               ; preds = %26
  call void @_ZdaPv(ptr noundef %31) #3
  br label %34

34:                                               ; preds = %33, %26
  br label %35

35:                                               ; preds = %34
  %36 = load i64, ptr %3, align 8, !tbaa !16
  %37 = add nsw i64 %36, 1
  store i64 %37, ptr %3, align 8, !tbaa !16
  br label %20, !llvm.loop !19

38:                                               ; preds = %25
  %39 = getelementptr inbounds %"class.vl::regex_internal::PureInterpretor", ptr %4, i32 0, i32 2
  %40 = load ptr, ptr %39, align 8, !tbaa !18
  %41 = icmp eq ptr %40, null
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  call void @_ZdaPv(ptr noundef %40) #3
  br label %43

43:                                               ; preds = %42, %38
  call void @_ZN2vl6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  ret void
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #2

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

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 = { nobuiltin nounwind "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 = { builtin nounwind }
attributes #4 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !6, i64 8912920}
!12 = !{!"_ZTSN2vl14regex_internal15PureInterpretorE", !13, i64 0, !7, i64 8, !6, i64 8912904, !6, i64 8912912, !6, i64 8912920, !14, i64 8912928, !14, i64 8912936, !14, i64 8912944}
!13 = !{!"_ZTSN2vl6ObjectE"}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !6, i64 8912912}
!16 = !{!14, !14, i64 0}
!17 = !{!12, !14, i64 8912928}
!18 = !{!12, !6, i64 8912904}
!19 = distinct !{!19, !20}
!20 = !{!"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"

@_ZTVN2vl14regex_internal15PureInterpretorE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN2vl14regex_internal15PureInterpretorD2Ev(ptr noundef nonnull align 8 dereferenceable(8912952) %0) unnamed_addr #0 align 2 {
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN2vl14regex_internal15PureInterpretorE, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 8912920
  %3 = load ptr, ptr %2, align 8, !tbaa !8
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %5, label %4

4:                                                ; preds = %1
  tail call void @_ZdaPv(ptr noundef nonnull %3) #2
  br label %5

5:                                                ; preds = %4, %1
  %6 = getelementptr inbounds i8, ptr %0, i64 8912912
  %7 = load ptr, ptr %6, align 8, !tbaa !14
  %8 = icmp eq ptr %7, null
  br i1 %8, label %10, label %9

9:                                                ; preds = %5
  tail call void @_ZdaPv(ptr noundef nonnull %7) #2
  br label %10

10:                                               ; preds = %9, %5
  %11 = getelementptr inbounds i8, ptr %0, i64 8912928
  %12 = load i64, ptr %11, align 8, !tbaa !15
  %13 = icmp sgt i64 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %10
  %14 = getelementptr inbounds i8, ptr %0, i64 8912904
  br label %18

._crit_edge:                                      ; preds = %25, %10
  %15 = getelementptr inbounds i8, ptr %0, i64 8912904
  %16 = load ptr, ptr %15, align 8, !tbaa !16
  %17 = icmp eq ptr %16, null
  br i1 %17, label %30, label %29

18:                                               ; preds = %.lr.ph, %25
  %19 = phi i64 [ %12, %.lr.ph ], [ %26, %25 ]
  %.07 = phi i64 [ 0, %.lr.ph ], [ %27, %25 ]
  %20 = load ptr, ptr %14, align 8, !tbaa !16
  %21 = getelementptr inbounds ptr, ptr %20, i64 %.07
  %22 = load ptr, ptr %21, align 8, !tbaa !17
  %23 = icmp eq ptr %22, null
  br i1 %23, label %25, label %24

24:                                               ; preds = %18
  tail call void @_ZdaPv(ptr noundef nonnull %22) #2
  %.pre = load i64, ptr %11, align 8, !tbaa !15
  br label %25

25:                                               ; preds = %18, %24
  %26 = phi i64 [ %19, %18 ], [ %.pre, %24 ]
  %27 = add nuw nsw i64 %.07, 1
  %28 = icmp slt i64 %27, %26
  br i1 %28, label %18, label %._crit_edge, !llvm.loop !18

29:                                               ; preds = %._crit_edge
  tail call void @_ZdaPv(ptr noundef nonnull %16) #2
  br label %30

30:                                               ; preds = %29, %._crit_edge
  tail call void @_ZN2vl6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #3
  ret void
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #1

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

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 = { nobuiltin nounwind "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 = { builtin nounwind }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !12, i64 8912920}
!9 = !{!"_ZTSN2vl14regex_internal15PureInterpretorE", !10, i64 0, !11, i64 8, !12, i64 8912904, !12, i64 8912912, !12, i64 8912920, !13, i64 8912928, !13, i64 8912936, !13, i64 8912944}
!10 = !{!"_ZTSN2vl6ObjectE"}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"any pointer", !11, i64 0}
!13 = !{!"long", !11, i64 0}
!14 = !{!9, !12, i64 8912912}
!15 = !{!9, !13, i64 8912928}
!16 = !{!9, !12, i64 8912904}
!17 = !{!12, !12, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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