; LLVM IR from SSBMTonberry/pocketlzma :: ref_spec/lzma1900/CPP/Common (Wildcard)

; 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.UString = type { ptr, i32, i32 }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z16SplitPathToPartsRK7UStringR13CObjectVectorIS_E(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %class.UString, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN13CObjectVectorI7UStringE5ClearEv(ptr noundef nonnull align 8 dereferenceable(16) %12)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = call noundef i32 @_ZNK7UString3LenEv(ptr noundef nonnull align 8 dereferenceable(16) %13)
  store i32 %14, ptr %5, align 4, !tbaa !9
  %15 = load i32, ptr %5, align 4, !tbaa !9
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %2
  store i32 1, ptr %6, align 4
  br label %68

18:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #5
  call void @_ZN7UStringC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %53, %18
  %20 = load i32, ptr %9, align 4, !tbaa !9
  %21 = load i32, ptr %5, align 4, !tbaa !9
  %22 = icmp ult i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %56

24:                                               ; preds = %19
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = invoke noundef ptr @_ZNK7UStringcvPKwEv(ptr noundef nonnull align 8 dereferenceable(16) %25)
          to label %27 unwind label %48

27:                                               ; preds = %24
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds i32, ptr %26, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !11
  %32 = invoke noundef zeroext i1 @_Z11IsPathSeparw(i32 noundef signext %31)
          to label %33 unwind label %48

33:                                               ; preds = %27
  br i1 %32, label %34, label %52

34:                                               ; preds = %33
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = invoke noundef ptr @_ZNK7UString3PtrEj(ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef %36)
          to label %38 unwind label %48

38:                                               ; preds = %34
  %39 = load i32, ptr %9, align 4, !tbaa !9
  %40 = load i32, ptr %8, align 4, !tbaa !9
  %41 = sub i32 %39, %40
  invoke void @_ZN7UString7SetFromEPKwj(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef %37, i32 noundef %41)
          to label %42 unwind label %48

42:                                               ; preds = %38
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = invoke noundef i32 @_ZN13CObjectVectorI7UStringE3AddERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %43, ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %45 unwind label %48

45:                                               ; preds = %42
  %46 = load i32, ptr %9, align 4, !tbaa !9
  %47 = add i32 %46, 1
  store i32 %47, ptr %8, align 4, !tbaa !9
  br label %52

48:                                               ; preds = %42, %38, %34, %27, %24
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %10, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %75

52:                                               ; preds = %45, %33
  br label %53

53:                                               ; preds = %52
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = add i32 %54, 1
  store i32 %55, ptr %9, align 4, !tbaa !9
  br label %19, !llvm.loop !13

56:                                               ; preds = %23
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = load i32, ptr %8, align 4, !tbaa !9
  %59 = invoke noundef ptr @_ZNK7UString3PtrEj(ptr noundef nonnull align 8 dereferenceable(16) %57, i32 noundef %58)
          to label %60 unwind label %71

60:                                               ; preds = %56
  %61 = load i32, ptr %5, align 4, !tbaa !9
  %62 = load i32, ptr %8, align 4, !tbaa !9
  %63 = sub i32 %61, %62
  invoke void @_ZN7UString7SetFromEPKwj(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef %59, i32 noundef %63)
          to label %64 unwind label %71

64:                                               ; preds = %60
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = invoke noundef i32 @_ZN13CObjectVectorI7UStringE3AddERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %65, ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %67 unwind label %71

67:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #5
  store i32 0, ptr %6, align 4
  br label %68

68:                                               ; preds = %67, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  %69 = load i32, ptr %6, align 4
  switch i32 %69, label %81 [
    i32 0, label %70
    i32 1, label %70
  ]

70:                                               ; preds = %68, %68
  ret void

71:                                               ; preds = %64, %60, %56
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %10, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %11, align 4
  br label %75

75:                                               ; preds = %71, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %76

76:                                               ; preds = %75
  %77 = load ptr, ptr %10, align 8
  %78 = load i32, ptr %11, align 4
  %79 = insertvalue { ptr, i32 } poison, ptr %77, 0
  %80 = insertvalue { ptr, i32 } %79, i32 %78, 1
  resume { ptr, i32 } %80

81:                                               ; preds = %68
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13CObjectVectorI7UStringE5ClearEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7UString3LenEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

declare void @_ZN7UStringC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z11IsPathSeparw(i32 noundef signext) #4

declare void @_ZN7UString7SetFromEPKwj(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i32 noundef) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN13CObjectVectorI7UStringE3AddERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2 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 = { 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 = { "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 = { 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 #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, !10, i64 0}
!10 = !{!"int", !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"

%class.UString = type { ptr, i32, i32 }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z16SplitPathToPartsRK7UStringR13CObjectVectorIS_E(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.UString, align 8
  tail call void @_ZN13CObjectVectorI7UStringE5ClearEv(ptr noundef nonnull align 8 dereferenceable(16) %1)
  %4 = tail call noundef i32 @_ZNK7UString3LenEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %5 = icmp eq i32 %4, 0
  br i1 %5, label %30, label %6

6:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  call void @_ZN7UStringC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %3)
  %wide.trip.count = zext i32 %4 to i64
  br label %10

7:                                                ; preds = %26
  %8 = call noundef ptr @_ZNK7UString3PtrEj(ptr noundef nonnull align 8 dereferenceable(16) %0, i32 noundef %.1)
  %9 = sub i32 %4, %.1
  invoke void @_ZN7UString7SetFromEPKwj(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef %8, i32 noundef %9)
          to label %27 unwind label %31

10:                                               ; preds = %6, %26
  %indvars.iv = phi i64 [ 0, %6 ], [ %indvars.iv.next.pre-phi, %26 ]
  %.02226 = phi i32 [ 0, %6 ], [ %.1, %26 ]
  %11 = call noundef ptr @_ZNK7UStringcvPKwEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %12 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = call noundef zeroext i1 @_Z11IsPathSeparw(i32 noundef signext %13)
  br i1 %14, label %15, label %._crit_edge

._crit_edge:                                      ; preds = %10
  %.pre = add nuw nsw i64 %indvars.iv, 1
  br label %26

15:                                               ; preds = %10
  %16 = call noundef ptr @_ZNK7UString3PtrEj(ptr noundef nonnull align 8 dereferenceable(16) %0, i32 noundef %.02226)
  %17 = trunc nuw i64 %indvars.iv to i32
  %18 = sub i32 %17, %.02226
  invoke void @_ZN7UString7SetFromEPKwj(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef %16, i32 noundef %18)
          to label %19 unwind label %24

19:                                               ; preds = %15
  %20 = invoke noundef i32 @_ZN13CObjectVectorI7UStringE3AddERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %3)
          to label %21 unwind label %24

21:                                               ; preds = %19
  %22 = add nuw nsw i64 %indvars.iv, 1
  %23 = trunc nuw i64 %22 to i32
  br label %26

24:                                               ; preds = %19, %15
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %33

26:                                               ; preds = %._crit_edge, %21
  %indvars.iv.next.pre-phi = phi i64 [ %.pre, %._crit_edge ], [ %22, %21 ]
  %.1 = phi i32 [ %.02226, %._crit_edge ], [ %23, %21 ]
  %exitcond.not = icmp eq i64 %indvars.iv.next.pre-phi, %wide.trip.count
  br i1 %exitcond.not, label %7, label %10, !llvm.loop !9

27:                                               ; preds = %7
  %28 = invoke noundef i32 @_ZN13CObjectVectorI7UStringE3AddERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %3)
          to label %29 unwind label %31

29:                                               ; preds = %27
  call void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  br label %30

30:                                               ; preds = %2, %29
  ret void

31:                                               ; preds = %27, %7
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %33

33:                                               ; preds = %31, %24
  %.pn = phi { ptr, i32 } [ %25, %24 ], [ %32, %31 ]
  call void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13CObjectVectorI7UStringE5ClearEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7UString3LenEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

declare void @_ZN7UStringC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z11IsPathSeparw(i32 noundef signext) local_unnamed_addr #4

declare void @_ZN7UString7SetFromEPKwj(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i32 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN13CObjectVectorI7UStringE3AddERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

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 = { "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 = { 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 #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 = !{!"wchar_t", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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