; LLVM IR from mncoppola/rpef :: utilities_src/squashfs4.2/lzma465/CPP/7zip/Common (FilterCoder)

; 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.CFilterCoder = type { %struct.ICompressCoder, %struct.ICompressSetInStream, %struct.ISequentialInStream, %struct.ICompressSetOutStream, %struct.ISequentialOutStream, %struct.IOutStreamFlush, %struct.ICryptoSetPassword, %struct.ICompressSetCoderProperties, %struct.ICompressWriteCoderProperties, %struct.ICryptoResetInitVector, %struct.ICompressSetDecoderProperties2, %class.CMyUnknownImp, ptr, %class.CMyComPtr, %class.CMyComPtr.0, i32, i32, i32, i8, i64, i64, %class.CMyComPtr.1, %class.CMyComPtr.2, %class.CMyComPtr.3, %class.CMyComPtr.4, %class.CMyComPtr.5, %class.CMyComPtr.6 }
%struct.ICompressCoder = type { %struct.IUnknown }
%struct.IUnknown = type { ptr }
%struct.ICompressSetInStream = type { %struct.IUnknown }
%struct.ISequentialInStream = type { %struct.IUnknown }
%struct.ICompressSetOutStream = type { %struct.IUnknown }
%struct.ISequentialOutStream = type { %struct.IUnknown }
%struct.IOutStreamFlush = type { %struct.IUnknown }
%struct.ICryptoSetPassword = type { %struct.IUnknown }
%struct.ICompressSetCoderProperties = type { %struct.IUnknown }
%struct.ICompressWriteCoderProperties = type { %struct.IUnknown }
%struct.ICryptoResetInitVector = type { %struct.IUnknown }
%struct.ICompressSetDecoderProperties2 = type { %struct.IUnknown }
%class.CMyUnknownImp = type { i32 }
%class.CMyComPtr = type { ptr }
%class.CMyComPtr.0 = type { ptr }
%class.CMyComPtr.1 = type { ptr }
%class.CMyComPtr.2 = type { ptr }
%class.CMyComPtr.3 = type { ptr }
%class.CMyComPtr.4 = type { ptr }
%class.CMyComPtr.5 = type { ptr }
%class.CMyComPtr.6 = type { ptr }

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN12CFilterCoder14WriteWithLimitEP20ISequentialOutStreamj(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef, i32 noundef) #0 align 2

; 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

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

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

18:                                               ; preds = %120, %4
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = icmp ugt i32 %19, 0
  br i1 %20, label %21, label %121

21:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %22 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 15
  %23 = load i32, ptr %22, align 8, !tbaa !11
  %24 = sub i32 131072, %23
  store i32 %24, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %25 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %25, ptr %12, align 4, !tbaa !9
  %26 = load i32, ptr %12, align 4, !tbaa !9
  %27 = load i32, ptr %11, align 4, !tbaa !9
  %28 = icmp ugt i32 %26, %27
  br i1 %28, label %29, label %31

29:                                               ; preds = %21
  %30 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %30, ptr %12, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %29, %21
  %32 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 12
  %33 = load ptr, ptr %32, align 8, !tbaa !36
  %34 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 15
  %35 = load i32, ptr %34, align 8, !tbaa !11
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds i8, ptr %33, i64 %36
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = load i32, ptr %12, align 4, !tbaa !9
  %40 = zext i32 %39 to i64
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %37, ptr align 1 %38, i64 %40, i1 false)
  %41 = load i32, ptr %12, align 4, !tbaa !9
  %42 = load i32, ptr %8, align 4, !tbaa !9
  %43 = sub i32 %42, %41
  store i32 %43, ptr %8, align 4, !tbaa !9
  %44 = load i32, ptr %12, align 4, !tbaa !9
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = add i32 %45, %44
  store i32 %46, ptr %10, align 4, !tbaa !9
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = load i32, ptr %12, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds i8, ptr %47, i64 %49
  store ptr %50, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %51 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 15
  %52 = load i32, ptr %51, align 8, !tbaa !11
  %53 = load i32, ptr %12, align 4, !tbaa !9
  %54 = add i32 %52, %53
  store i32 %54, ptr %13, align 4, !tbaa !9
  %55 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 26
  %56 = call noundef ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8) %55)
  %57 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 12
  %58 = load ptr, ptr %57, align 8, !tbaa !36
  %59 = load i32, ptr %13, align 4, !tbaa !9
  %60 = load ptr, ptr %56, align 8, !tbaa !37
  %61 = getelementptr inbounds ptr, ptr %60, i64 6
  %62 = load ptr, ptr %61, align 8
  %63 = call noundef i32 %62(ptr noundef nonnull align 8 dereferenceable(8) %56, ptr noundef %58, i32 noundef %59)
  %64 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 15
  store i32 %63, ptr %64, align 8, !tbaa !11
  %65 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 15
  %66 = load i32, ptr %65, align 8, !tbaa !11
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %71

68:                                               ; preds = %31
  %69 = load i32, ptr %13, align 4, !tbaa !9
  %70 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 15
  store i32 %69, ptr %70, align 8, !tbaa !11
  store i32 3, ptr %14, align 4
  br label %118

71:                                               ; preds = %31
  %72 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 15
  %73 = load i32, ptr %72, align 8, !tbaa !11
  %74 = load i32, ptr %13, align 4, !tbaa !9
  %75 = icmp ugt i32 %73, %74
  br i1 %75, label %76, label %81

76:                                               ; preds = %71
  %77 = load i32, ptr %8, align 4, !tbaa !9
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %76
  store i32 -2147467259, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %118

80:                                               ; preds = %76
  store i32 3, ptr %14, align 4
  br label %118

81:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %82 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 14
  %83 = call noundef ptr @_ZNK9CMyComPtrI20ISequentialOutStreamEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %82)
  %84 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 15
  %85 = load i32, ptr %84, align 8, !tbaa !11
  %86 = call noundef i32 @_ZN12CFilterCoder14WriteWithLimitEP20ISequentialOutStreamj(ptr noundef nonnull align 8 dereferenceable(200) %17, ptr noundef %83, i32 noundef %85)
  store i32 %86, ptr %15, align 4, !tbaa !9
  %87 = load i32, ptr %15, align 4, !tbaa !9
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %91

89:                                               ; preds = %81
  %90 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %90, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %92

91:                                               ; preds = %81
  store i32 0, ptr %14, align 4
  br label %92

92:                                               ; preds = %91, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %93 = load i32, ptr %14, align 4
  switch i32 %93, label %118 [
    i32 0, label %94
  ]

94:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %100, %94
  %96 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 15
  %97 = load i32, ptr %96, align 8, !tbaa !11
  %98 = load i32, ptr %13, align 4, !tbaa !9
  %99 = icmp ult i32 %97, %98
  br i1 %99, label %100, label %115

100:                                              ; preds = %95
  %101 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 12
  %102 = load ptr, ptr %101, align 8, !tbaa !36
  %103 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 15
  %104 = load i32, ptr %103, align 8, !tbaa !11
  %105 = add i32 %104, 1
  store i32 %105, ptr %103, align 8, !tbaa !11
  %106 = zext i32 %104 to i64
  %107 = getelementptr inbounds i8, ptr %102, i64 %106
  %108 = load i8, ptr %107, align 1, !tbaa !39
  %109 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 12
  %110 = load ptr, ptr %109, align 8, !tbaa !36
  %111 = load i32, ptr %16, align 4, !tbaa !9
  %112 = add i32 %111, 1
  store i32 %112, ptr %16, align 4, !tbaa !9
  %113 = zext i32 %111 to i64
  %114 = getelementptr inbounds i8, ptr %110, i64 %113
  store i8 %108, ptr %114, align 1, !tbaa !39
  br label %95, !llvm.loop !40

115:                                              ; preds = %95
  %116 = load i32, ptr %16, align 4, !tbaa !9
  %117 = getelementptr inbounds %class.CFilterCoder, ptr %17, i32 0, i32 15
  store i32 %116, ptr %117, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  store i32 0, ptr %14, align 4
  br label %118

118:                                              ; preds = %115, %92, %80, %79, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  %119 = load i32, ptr %14, align 4
  switch i32 %119, label %128 [
    i32 0, label %120
    i32 3, label %121
  ]

120:                                              ; preds = %118
  br label %18, !llvm.loop !42

121:                                              ; preds = %118, %18
  %122 = load ptr, ptr %9, align 8, !tbaa !5
  %123 = icmp ne ptr %122, null
  br i1 %123, label %124, label %127

124:                                              ; preds = %121
  %125 = load i32, ptr %10, align 4, !tbaa !9
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %125, ptr %126, align 4, !tbaa !9
  br label %127

127:                                              ; preds = %124, %121
  store i32 0, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %128

128:                                              ; preds = %127, %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %129 = load i32, ptr %5, align 4
  ret i32 %129
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #3

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 120}
!12 = !{!"_ZTS12CFilterCoder", !13, i64 0, !15, i64 8, !16, i64 16, !17, i64 24, !18, i64 32, !19, i64 40, !20, i64 48, !21, i64 56, !22, i64 64, !23, i64 72, !24, i64 80, !25, i64 88, !6, i64 96, !26, i64 104, !27, i64 112, !10, i64 120, !10, i64 124, !10, i64 128, !28, i64 132, !29, i64 136, !29, i64 144, !30, i64 152, !31, i64 160, !32, i64 168, !33, i64 176, !34, i64 184, !35, i64 192}
!13 = !{!"_ZTS14ICompressCoder", !14, i64 0}
!14 = !{!"_ZTS8IUnknown"}
!15 = !{!"_ZTS20ICompressSetInStream", !14, i64 0}
!16 = !{!"_ZTS19ISequentialInStream", !14, i64 0}
!17 = !{!"_ZTS21ICompressSetOutStream", !14, i64 0}
!18 = !{!"_ZTS20ISequentialOutStream", !14, i64 0}
!19 = !{!"_ZTS15IOutStreamFlush", !14, i64 0}
!20 = !{!"_ZTS18ICryptoSetPassword", !14, i64 0}
!21 = !{!"_ZTS27ICompressSetCoderProperties", !14, i64 0}
!22 = !{!"_ZTS29ICompressWriteCoderProperties", !14, i64 0}
!23 = !{!"_ZTS22ICryptoResetInitVector", !14, i64 0}
!24 = !{!"_ZTS30ICompressSetDecoderProperties2", !14, i64 0}
!25 = !{!"_ZTS13CMyUnknownImp", !10, i64 0}
!26 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !6, i64 0}
!27 = !{!"_ZTS9CMyComPtrI20ISequentialOutStreamE", !6, i64 0}
!28 = !{!"bool", !7, i64 0}
!29 = !{!"long long", !7, i64 0}
!30 = !{!"_ZTS9CMyComPtrI18ICryptoSetPasswordE", !6, i64 0}
!31 = !{!"_ZTS9CMyComPtrI27ICompressSetCoderPropertiesE", !6, i64 0}
!32 = !{!"_ZTS9CMyComPtrI29ICompressWriteCoderPropertiesE", !6, i64 0}
!33 = !{!"_ZTS9CMyComPtrI22ICryptoResetInitVectorE", !6, i64 0}
!34 = !{!"_ZTS9CMyComPtrI30ICompressSetDecoderProperties2E", !6, i64 0}
!35 = !{!"_ZTS9CMyComPtrI15ICompressFilterE", !6, i64 0}
!36 = !{!12, !6, i64 96}
!37 = !{!38, !38, i64 0}
!38 = !{!"vtable pointer", !8, i64 0}
!39 = !{!7, !7, i64 0}
!40 = distinct !{!40, !41}
!41 = !{!"llvm.loop.mustprogress"}
!42 = distinct !{!42, !41}


; 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 uwtable
declare dso_local noundef i32 @_ZN12CFilterCoder14WriteWithLimitEP20ISequentialOutStreamj(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef, i32 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN12CFilterCoder5WriteEPKvjPj(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr nocapture noundef readonly %1, i32 noundef %2, ptr noundef writeonly %3) unnamed_addr #0 align 2 {
  %.not70 = icmp eq i32 %2, 0
  br i1 %.not70, label %.thread51, label %.lr.ph76

.lr.ph76:                                         ; preds = %4
  %5 = getelementptr inbounds i8, ptr %0, i64 120
  %6 = getelementptr inbounds i8, ptr %0, i64 96
  %7 = getelementptr inbounds i8, ptr %0, i64 192
  %8 = getelementptr inbounds i8, ptr %0, i64 112
  %.pre = load i32, ptr %5, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %.lr.ph76, %._crit_edge
  %10 = phi i32 [ %.pre, %.lr.ph76 ], [ %.0.lcssa, %._crit_edge ]
  %.03273 = phi ptr [ %1, %.lr.ph76 ], [ %18, %._crit_edge ]
  %.03472 = phi i32 [ %2, %.lr.ph76 ], [ %16, %._crit_edge ]
  %.03571 = phi i32 [ 0, %.lr.ph76 ], [ %17, %._crit_edge ]
  %11 = sub i32 131072, %10
  %spec.select = tail call i32 @llvm.umin.i32(i32 %.03472, i32 %11)
  %12 = load ptr, ptr %6, align 8, !tbaa !34
  %13 = zext i32 %10 to i64
  %14 = getelementptr inbounds i8, ptr %12, i64 %13
  %15 = zext i32 %spec.select to i64
  tail call void @llvm.memmove.p0.p0.i64(ptr align 1 %14, ptr align 1 %.03273, i64 %15, i1 false)
  %16 = sub i32 %.03472, %spec.select
  %17 = add i32 %spec.select, %.03571
  %18 = getelementptr inbounds i8, ptr %.03273, i64 %15
  %19 = load i32, ptr %5, align 8, !tbaa !5
  %20 = add i32 %19, %spec.select
  %21 = tail call noundef ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7)
  %22 = load ptr, ptr %6, align 8, !tbaa !34
  %23 = load ptr, ptr %21, align 8, !tbaa !35
  %24 = getelementptr inbounds i8, ptr %23, i64 48
  %25 = load ptr, ptr %24, align 8
  %26 = tail call noundef i32 %25(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef %22, i32 noundef %20)
  store i32 %26, ptr %5, align 8, !tbaa !5
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %9
  store i32 %20, ptr %5, align 8, !tbaa !5
  br label %.thread51

29:                                               ; preds = %9
  %30 = icmp ugt i32 %26, %20
  br i1 %30, label %31, label %32

31:                                               ; preds = %29
  %.not44 = icmp eq i32 %16, 0
  br i1 %.not44, label %.thread51, label %.thread

32:                                               ; preds = %29
  %33 = tail call noundef ptr @_ZNK9CMyComPtrI20ISequentialOutStreamEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %8)
  %34 = load i32, ptr %5, align 8, !tbaa !5
  %35 = tail call noundef i32 @_ZN12CFilterCoder14WriteWithLimitEP20ISequentialOutStreamj(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef %33, i32 noundef %34)
  %.not43 = icmp eq i32 %35, 0
  br i1 %.not43, label %.preheader, label %.thread

.preheader:                                       ; preds = %32
  %36 = load i32, ptr %5, align 8, !tbaa !5
  %37 = icmp ult i32 %36, %20
  br i1 %37, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %38 = phi i32 [ %47, %.lr.ph ], [ %36, %.preheader ]
  %.069 = phi i32 [ %44, %.lr.ph ], [ 0, %.preheader ]
  %39 = load ptr, ptr %6, align 8, !tbaa !34
  %40 = add nuw i32 %38, 1
  store i32 %40, ptr %5, align 8, !tbaa !5
  %41 = zext i32 %38 to i64
  %42 = getelementptr inbounds i8, ptr %39, i64 %41
  %43 = load i8, ptr %42, align 1, !tbaa !37
  %44 = add i32 %.069, 1
  %45 = zext i32 %.069 to i64
  %46 = getelementptr inbounds i8, ptr %39, i64 %45
  store i8 %43, ptr %46, align 1, !tbaa !37
  %47 = load i32, ptr %5, align 8, !tbaa !5
  %48 = icmp ult i32 %47, %20
  br i1 %48, label %.lr.ph, label %._crit_edge, !llvm.loop !38

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %.0.lcssa = phi i32 [ 0, %.preheader ], [ %44, %.lr.ph ]
  store i32 %.0.lcssa, ptr %5, align 8, !tbaa !5
  %.not = icmp eq i32 %16, 0
  br i1 %.not, label %.thread51, label %9

.thread51:                                        ; preds = %._crit_edge, %4, %31, %28
  %.136 = phi i32 [ %17, %28 ], [ %17, %31 ], [ 0, %4 ], [ %17, %._crit_edge ]
  %.not45 = icmp eq ptr %3, null
  br i1 %.not45, label %.thread, label %49

49:                                               ; preds = %.thread51
  store i32 %.136, ptr %3, align 4, !tbaa !40
  br label %.thread

.thread:                                          ; preds = %32, %31, %.thread51, %49
  %.3 = phi i32 [ 0, %49 ], [ 0, %.thread51 ], [ -2147467259, %31 ], [ %35, %32 ]
  ret i32 %.3
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #3

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

!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, !20, i64 120}
!6 = !{!"_ZTS12CFilterCoder", !7, i64 0, !9, i64 8, !10, i64 16, !11, i64 24, !12, i64 32, !13, i64 40, !14, i64 48, !15, i64 56, !16, i64 64, !17, i64 72, !18, i64 80, !19, i64 88, !23, i64 96, !24, i64 104, !25, i64 112, !20, i64 120, !20, i64 124, !20, i64 128, !26, i64 132, !27, i64 136, !27, i64 144, !28, i64 152, !29, i64 160, !30, i64 168, !31, i64 176, !32, i64 184, !33, i64 192}
!7 = !{!"_ZTS14ICompressCoder", !8, i64 0}
!8 = !{!"_ZTS8IUnknown"}
!9 = !{!"_ZTS20ICompressSetInStream", !8, i64 0}
!10 = !{!"_ZTS19ISequentialInStream", !8, i64 0}
!11 = !{!"_ZTS21ICompressSetOutStream", !8, i64 0}
!12 = !{!"_ZTS20ISequentialOutStream", !8, i64 0}
!13 = !{!"_ZTS15IOutStreamFlush", !8, i64 0}
!14 = !{!"_ZTS18ICryptoSetPassword", !8, i64 0}
!15 = !{!"_ZTS27ICompressSetCoderProperties", !8, i64 0}
!16 = !{!"_ZTS29ICompressWriteCoderProperties", !8, i64 0}
!17 = !{!"_ZTS22ICryptoResetInitVector", !8, i64 0}
!18 = !{!"_ZTS30ICompressSetDecoderProperties2", !8, i64 0}
!19 = !{!"_ZTS13CMyUnknownImp", !20, i64 0}
!20 = !{!"int", !21, i64 0}
!21 = !{!"omnipotent char", !22, i64 0}
!22 = !{!"Simple C++ TBAA"}
!23 = !{!"any pointer", !21, i64 0}
!24 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !23, i64 0}
!25 = !{!"_ZTS9CMyComPtrI20ISequentialOutStreamE", !23, i64 0}
!26 = !{!"bool", !21, i64 0}
!27 = !{!"long long", !21, i64 0}
!28 = !{!"_ZTS9CMyComPtrI18ICryptoSetPasswordE", !23, i64 0}
!29 = !{!"_ZTS9CMyComPtrI27ICompressSetCoderPropertiesE", !23, i64 0}
!30 = !{!"_ZTS9CMyComPtrI29ICompressWriteCoderPropertiesE", !23, i64 0}
!31 = !{!"_ZTS9CMyComPtrI22ICryptoResetInitVectorE", !23, i64 0}
!32 = !{!"_ZTS9CMyComPtrI30ICompressSetDecoderProperties2E", !23, i64 0}
!33 = !{!"_ZTS9CMyComPtrI15ICompressFilterE", !23, i64 0}
!34 = !{!6, !23, i64 96}
!35 = !{!36, !36, i64 0}
!36 = !{!"vtable pointer", !22, i64 0}
!37 = !{!21, !21, i64 0}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}
!40 = !{!20, !20, i64 0}


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