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

; 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::Ptr.1009" = type { ptr, ptr, ptr, ptr }
%"class.vl::regex_internal::SequenceExpression" = type { %"class.vl::regex_internal::Expression", %"class.vl::Ptr.1009", %"class.vl::Ptr.1009" }
%"class.vl::regex_internal::Expression" = type { %"class.vl::Object" }
%"class.vl::Object" = type { ptr }

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #0

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_14regex_internal10ExpressionEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl14regex_internal9ParseUnitERPKw(ptr dead_on_unwind noalias writable sret(%"class.vl::Ptr.1009") align 8, ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK2vl3PtrINS_14regex_internal10ExpressionEEcvbEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl14regex_internal9ParseJoinERPKw(ptr dead_on_unwind noalias writable sret(%"class.vl::Ptr.1009") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %1) #4 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i1, align 1
  %6 = alloca %"class.vl::Ptr.1009", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  store i1 false, ptr %5, align 1
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN2vl14regex_internal9ParseUnitERPKw(ptr dead_on_unwind writable sret(%"class.vl::Ptr.1009") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %11)
  br label %12

12:                                               ; preds = %54, %2
  br label %13

13:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #6
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN2vl14regex_internal9ParseUnitERPKw(ptr dead_on_unwind writable sret(%"class.vl::Ptr.1009") align 8 %6, ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %15 unwind label %33

15:                                               ; preds = %13
  %16 = invoke noundef zeroext i1 @_ZNK2vl3PtrINS_14regex_internal10ExpressionEEcvbEv(ptr noundef nonnull align 8 dereferenceable(32) %6)
          to label %17 unwind label %37

17:                                               ; preds = %15
  br i1 %16, label %18, label %50

18:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %19 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 72) #7
          to label %20 unwind label %41

20:                                               ; preds = %18
  invoke void @_ZN2vl14regex_internal18SequenceExpressionC2Ev(ptr noundef nonnull align 8 dereferenceable(72) %19)
          to label %21 unwind label %45

21:                                               ; preds = %20
  store ptr %19, ptr %9, align 8, !tbaa !5
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.vl::regex_internal::SequenceExpression", ptr %22, i32 0, i32 1
  %24 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_14regex_internal10ExpressionEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %23, ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %25 unwind label %41

25:                                               ; preds = %21
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  %27 = getelementptr inbounds %"class.vl::regex_internal::SequenceExpression", ptr %26, i32 0, i32 2
  %28 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_14regex_internal10ExpressionEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %27, ptr noundef nonnull align 8 dereferenceable(32) %6)
          to label %29 unwind label %41

29:                                               ; preds = %25
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_14regex_internal10ExpressionEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %30)
          to label %32 unwind label %41

32:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %51

33:                                               ; preds = %13
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %7, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %8, align 4
  br label %56

37:                                               ; preds = %15
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %7, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %8, align 4
  br label %55

41:                                               ; preds = %29, %25, %21, %18
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %7, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %8, align 4
  br label %49

45:                                               ; preds = %20
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %7, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %19, i64 noundef 72) #8
  br label %49

49:                                               ; preds = %45, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %55

50:                                               ; preds = %17
  store i32 3, ptr %10, align 4
  br label %52

51:                                               ; preds = %32
  store i32 0, ptr %10, align 4
  br label %52

52:                                               ; preds = %51, %50
  call void @_ZN2vl3PtrINS_14regex_internal10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  %53 = load i32, ptr %10, align 4
  switch i32 %53, label %66 [
    i32 0, label %54
    i32 3, label %57
  ]

54:                                               ; preds = %52
  br label %12, !llvm.loop !9

55:                                               ; preds = %49, %37
  call void @_ZN2vl3PtrINS_14regex_internal10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  br label %56

56:                                               ; preds = %55, %33
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  call void @_ZN2vl3PtrINS_14regex_internal10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #6
  br label %61

57:                                               ; preds = %52
  store i1 true, ptr %5, align 1
  store i32 1, ptr %10, align 4
  %58 = load i1, ptr %5, align 1
  br i1 %58, label %60, label %59

59:                                               ; preds = %57
  call void @_ZN2vl3PtrINS_14regex_internal10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #6
  br label %60

60:                                               ; preds = %59, %57
  ret void

61:                                               ; preds = %56
  %62 = load ptr, ptr %7, align 8
  %63 = load i32, ptr %8, align 4
  %64 = insertvalue { ptr, i32 } poison, ptr %62, 0
  %65 = insertvalue { ptr, i32 } %64, i32 %63, 1
  resume { ptr, i32 } %65

66:                                               ; preds = %52
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_14regex_internal10ExpressionEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #4 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nobuiltin allocsize(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 = { 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 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 = { 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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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 = distinct !{!9, !10}
!10 = !{!"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::Ptr.1009" = type { ptr, ptr, ptr, ptr }

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #0

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_14regex_internal10ExpressionEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2vl14regex_internal9ParseUnitERPKw(ptr dead_on_unwind noalias writable sret(%"class.vl::Ptr.1009") align 8, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2vl14regex_internal9ParseJoinERPKw(ptr dead_on_unwind noalias writable sret(%"class.vl::Ptr.1009") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %1) local_unnamed_addr #4 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.vl::Ptr.1009", align 8
  tail call void @_ZN2vl14regex_internal9ParseUnitERPKw(ptr dead_on_unwind writable sret(%"class.vl::Ptr.1009") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %1)
  br label %4

4:                                                ; preds = %25, %2
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  invoke void @_ZN2vl14regex_internal9ParseUnitERPKw(ptr dead_on_unwind nonnull writable sret(%"class.vl::Ptr.1009") align 8 %3, ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %5 unwind label %18

5:                                                ; preds = %4
  %6 = call noundef zeroext i1 @_ZNK2vl3PtrINS_14regex_internal10ExpressionEEcvbEv(ptr noundef nonnull align 8 dereferenceable(32) %3)
  br i1 %6, label %7, label %27

7:                                                ; preds = %5
  %8 = invoke noalias noundef nonnull dereferenceable(72) ptr @_Znwm(i64 noundef 72) #7
          to label %9 unwind label %20

9:                                                ; preds = %7
  invoke void @_ZN2vl14regex_internal18SequenceExpressionC2Ev(ptr noundef nonnull align 8 dereferenceable(72) %8)
          to label %10 unwind label %22

10:                                               ; preds = %9
  %11 = getelementptr inbounds i8, ptr %8, i64 8
  %12 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_14regex_internal10ExpressionEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %13 unwind label %20

13:                                               ; preds = %10
  %14 = getelementptr inbounds i8, ptr %8, i64 40
  %15 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_14regex_internal10ExpressionEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %16 unwind label %20

16:                                               ; preds = %13
  %17 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_14regex_internal10ExpressionEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull %8)
          to label %25 unwind label %20

18:                                               ; preds = %4
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %26

20:                                               ; preds = %16, %13, %10, %7
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %24

22:                                               ; preds = %9
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %8, i64 noundef 72) #8
  br label %24

24:                                               ; preds = %22, %20
  %.pn = phi { ptr, i32 } [ %21, %20 ], [ %23, %22 ]
  call void @_ZN2vl3PtrINS_14regex_internal10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  br label %26

25:                                               ; preds = %16
  call void @_ZN2vl3PtrINS_14regex_internal10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  br label %4

26:                                               ; preds = %24, %18
  %.pn.pn = phi { ptr, i32 } [ %.pn, %24 ], [ %19, %18 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  call void @_ZN2vl3PtrINS_14regex_internal10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #6
  resume { ptr, i32 } %.pn.pn

27:                                               ; preds = %5
  call void @_ZN2vl3PtrINS_14regex_internal10ExpressionEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN2vl3PtrINS_14regex_internal10ExpressionEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #4 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nobuiltin allocsize(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 = { 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 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 = { 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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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)"}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass