; LLVM IR from SSBMTonberry/pocketlzma :: ref_spec/lzma1900/CPP/7zip/Common/FilterCoder.ll (ZN12CFilterCoder5WriteEPKvjPj)

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z5MyMinIjET_S0_S0_(i32 noundef, i32 noundef) #1

; 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 ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN12CFilterCoder6Flush2Ev(ptr noundef nonnull align 8 dereferenceable(256)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN12CFilterCoder5WriteEPKvjPj(ptr noundef nonnull align 8 dereferenceable(256) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3) unnamed_addr #3 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
  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
  %13 = load ptr, ptr %6, align 8
  %14 = load ptr, ptr %9, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %18

16:                                               ; preds = %4
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %16, %4
  br label %19

19:                                               ; preds = %109, %81, %18
  %20 = load i32, ptr %8, align 4, !tbaa !9
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %110

22:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %23 = call noundef i32 @_ZN12CFilterCoder6Flush2Ev(ptr noundef nonnull align 8 dereferenceable(256) %13)
  store i32 %23, ptr %10, align 4, !tbaa !9
  %24 = load i32, ptr %10, align 4, !tbaa !9
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %28

26:                                               ; preds = %22
  %27 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %27, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %29

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

29:                                               ; preds = %28, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %30 = load i32, ptr %11, align 4
  switch i32 %30, label %113 [
    i32 0, label %31
    i32 1, label %111
  ]

31:                                               ; preds = %29
  %32 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 26
  %33 = load i32, ptr %32, align 8, !tbaa !11
  %34 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 17
  %35 = load i32, ptr %34, align 8, !tbaa !42
  %36 = icmp ne i32 %33, %35
  br i1 %36, label %37, label %84

37:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %38 = load i32, ptr %8, align 4, !tbaa !9
  %39 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 17
  %40 = load i32, ptr %39, align 8, !tbaa !42
  %41 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 26
  %42 = load i32, ptr %41, align 8, !tbaa !11
  %43 = sub i32 %40, %42
  %44 = call noundef i32 @_Z5MyMinIjET_S0_S0_(i32 noundef %38, i32 noundef %43)
  store i32 %44, ptr %12, align 4, !tbaa !9
  %45 = getelementptr inbounds i8, ptr %13, i64 128
  %46 = getelementptr inbounds %struct.CAlignedMidBuffer, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !43
  %48 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 26
  %49 = load i32, ptr %48, align 8, !tbaa !11
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds i8, ptr %47, i64 %50
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = load i32, ptr %12, align 4, !tbaa !9
  %54 = zext i32 %53 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %51, ptr align 1 %52, i64 %54, i1 false)
  %55 = load i32, ptr %12, align 4, !tbaa !9
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = sub i32 %56, %55
  store i32 %57, ptr %8, align 4, !tbaa !9
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = load i32, ptr %12, align 4, !tbaa !9
  %60 = zext i32 %59 to i64
  %61 = getelementptr inbounds i8, ptr %58, i64 %60
  store ptr %61, ptr %7, align 8, !tbaa !5
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %69

64:                                               ; preds = %37
  %65 = load i32, ptr %12, align 4, !tbaa !9
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = load i32, ptr %66, align 4, !tbaa !9
  %68 = add i32 %67, %65
  store i32 %68, ptr %66, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %64, %37
  %70 = load i32, ptr %12, align 4, !tbaa !9
  %71 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 26
  %72 = load i32, ptr %71, align 8, !tbaa !11
  %73 = add i32 %72, %70
  store i32 %73, ptr %71, align 8, !tbaa !11
  %74 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 26
  %75 = load i32, ptr %74, align 8, !tbaa !11
  %76 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 17
  %77 = load i32, ptr %76, align 8, !tbaa !42
  %78 = icmp ne i32 %75, %77
  br i1 %78, label %79, label %80

79:                                               ; preds = %69
  store i32 2, ptr %11, align 4
  br label %81, !llvm.loop !44

80:                                               ; preds = %69
  store i32 0, ptr %11, align 4
  br label %81

81:                                               ; preds = %80, %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %82 = load i32, ptr %11, align 4
  switch i32 %82, label %113 [
    i32 0, label %83
    i32 2, label %19
  ]

83:                                               ; preds = %81
  br label %84

84:                                               ; preds = %83, %31
  %85 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 35
  %86 = call noundef ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8) %85)
  %87 = getelementptr inbounds i8, ptr %13, i64 128
  %88 = getelementptr inbounds %struct.CAlignedMidBuffer, ptr %87, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8, !tbaa !43
  %90 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 26
  %91 = load i32, ptr %90, align 8, !tbaa !11
  %92 = load ptr, ptr %86, align 8, !tbaa !46
  %93 = getelementptr inbounds ptr, ptr %92, i64 6
  %94 = load ptr, ptr %93, align 8
  %95 = call noundef i32 %94(ptr noundef nonnull align 8 dereferenceable(8) %86, ptr noundef %89, i32 noundef %91)
  %96 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 28
  store i32 %95, ptr %96, align 8, !tbaa !48
  %97 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 28
  %98 = load i32, ptr %97, align 8, !tbaa !48
  %99 = icmp eq i32 %98, 0
  br i1 %99, label %100, label %101

100:                                              ; preds = %84
  br label %110

101:                                              ; preds = %84
  %102 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 28
  %103 = load i32, ptr %102, align 8, !tbaa !48
  %104 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 26
  %105 = load i32, ptr %104, align 8, !tbaa !11
  %106 = icmp ugt i32 %103, %105
  br i1 %106, label %107, label %109

107:                                              ; preds = %101
  %108 = getelementptr inbounds %class.CFilterCoder, ptr %13, i32 0, i32 28
  store i32 0, ptr %108, align 8, !tbaa !48
  store i32 -2147467259, ptr %5, align 4
  br label %111

109:                                              ; preds = %101
  br label %19, !llvm.loop !44

110:                                              ; preds = %100, %19
  store i32 0, ptr %5, align 4
  br label %111

111:                                              ; preds = %110, %107, %29
  %112 = load i32, ptr %5, align 4
  ret i32 %112

113:                                              ; preds = %81, %29
  unreachable
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 184}
!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, !26, i64 96, !27, i64 104, !28, i64 112, !29, i64 120, !30, i64 128, !10, i64 136, !10, i64 140, !10, i64 144, !31, i64 148, !31, i64 149, !32, i64 152, !32, i64 160, !33, i64 168, !34, i64 176, !10, i64 184, !10, i64 188, !10, i64 192, !35, i64 200, !36, i64 208, !37, i64 216, !38, i64 224, !39, i64 232, !40, i64 240, !41, i64 248}
!13 = !{!"_ZTS14ICompressCoder", !14, i64 0}
!14 = !{!"_ZTS8IUnknown"}
!15 = !{!"_ZTS25ICompressSetOutStreamSize", !14, i64 0}
!16 = !{!"_ZTS20ICompressInitEncoder", !14, i64 0}
!17 = !{!"_ZTS20ICompressSetInStream", !14, i64 0}
!18 = !{!"_ZTS19ISequentialInStream", !14, i64 0}
!19 = !{!"_ZTS21ICompressSetOutStream", !14, i64 0}
!20 = !{!"_ZTS20ISequentialOutStream", !14, i64 0}
!21 = !{!"_ZTS16IOutStreamFinish", !14, i64 0}
!22 = !{!"_ZTS19ICompressSetBufSize", !14, i64 0}
!23 = !{!"_ZTS18ICryptoSetPassword", !14, i64 0}
!24 = !{!"_ZTS17ICryptoProperties", !14, i64 0}
!25 = !{!"_ZTS27ICompressSetCoderProperties", !14, i64 0}
!26 = !{!"_ZTS29ICompressWriteCoderProperties", !14, i64 0}
!27 = !{!"_ZTS22ICryptoResetInitVector", !14, i64 0}
!28 = !{!"_ZTS30ICompressSetDecoderProperties2", !14, i64 0}
!29 = !{!"_ZTS13CMyUnknownImp", !10, i64 0}
!30 = !{!"_ZTS17CAlignedMidBuffer", !6, i64 0}
!31 = !{!"bool", !7, i64 0}
!32 = !{!"long long", !7, i64 0}
!33 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !6, i64 0}
!34 = !{!"_ZTS9CMyComPtrI20ISequentialOutStreamE", !6, i64 0}
!35 = !{!"_ZTS9CMyComPtrI18ICryptoSetPasswordE", !6, i64 0}
!36 = !{!"_ZTS9CMyComPtrI17ICryptoPropertiesE", !6, i64 0}
!37 = !{!"_ZTS9CMyComPtrI27ICompressSetCoderPropertiesE", !6, i64 0}
!38 = !{!"_ZTS9CMyComPtrI29ICompressWriteCoderPropertiesE", !6, i64 0}
!39 = !{!"_ZTS9CMyComPtrI22ICryptoResetInitVectorE", !6, i64 0}
!40 = !{!"_ZTS9CMyComPtrI30ICompressSetDecoderProperties2E", !6, i64 0}
!41 = !{!"_ZTS9CMyComPtrI15ICompressFilterE", !6, i64 0}
!42 = !{!12, !10, i64 136}
!43 = !{!30, !6, i64 0}
!44 = distinct !{!44, !45}
!45 = !{!"llvm.loop.mustprogress"}
!46 = !{!47, !47, i64 0}
!47 = !{!"vtable pointer", !8, i64 0}
!48 = !{!12, !10, i64 192}


; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z5MyMinIjET_S0_S0_(i32 noundef, i32 noundef) local_unnamed_addr #0

; 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
declare dso_local noundef i32 @_ZN12CFilterCoder6Flush2Ev(ptr noundef nonnull align 8 dereferenceable(256)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN12CFilterCoder5WriteEPKvjPj(ptr noundef nonnull align 8 dereferenceable(256) %0, ptr nocapture noundef readonly %1, i32 noundef %2, ptr noundef %3) unnamed_addr #2 align 2 {
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %5, label %.thread

5:                                                ; preds = %4
  %.not3135 = icmp eq i32 %2, 0
  br i1 %.not3135, label %.loopexit, label %.lr.ph.split.us.preheader

.thread:                                          ; preds = %4
  store i32 0, ptr %3, align 4, !tbaa !5
  %.not313547 = icmp eq i32 %2, 0
  br i1 %.not313547, label %.loopexit, label %.lr.ph.split.preheader

.lr.ph.split.preheader:                           ; preds = %.thread
  %6 = getelementptr inbounds i8, ptr %0, i64 184
  %7 = getelementptr inbounds i8, ptr %0, i64 136
  %8 = getelementptr inbounds i8, ptr %0, i64 128
  %9 = getelementptr inbounds i8, ptr %0, i64 248
  %10 = getelementptr inbounds i8, ptr %0, i64 192
  br label %.lr.ph.split

.lr.ph.split.us.preheader:                        ; preds = %5
  %11 = getelementptr inbounds i8, ptr %0, i64 184
  %12 = getelementptr inbounds i8, ptr %0, i64 136
  %13 = getelementptr inbounds i8, ptr %0, i64 128
  %14 = getelementptr inbounds i8, ptr %0, i64 248
  %15 = getelementptr inbounds i8, ptr %0, i64 192
  br label %.lr.ph.split.us

.lr.ph.split.us:                                  ; preds = %.lr.ph.split.us.preheader, %.backedge.us
  %.02137.us = phi ptr [ %.021.be.us, %.backedge.us ], [ %1, %.lr.ph.split.us.preheader ]
  %.02336.us = phi i32 [ %.023.be.us, %.backedge.us ], [ %2, %.lr.ph.split.us.preheader ]
  %16 = tail call noundef i32 @_ZN12CFilterCoder6Flush2Ev(ptr noundef nonnull align 8 dereferenceable(256) %0)
  %.not32.not.us = icmp eq i32 %16, 0
  br i1 %.not32.not.us, label %17, label %.loopexit

17:                                               ; preds = %.lr.ph.split.us
  %18 = load i32, ptr %11, align 8, !tbaa !9
  %19 = load i32, ptr %12, align 8, !tbaa !41
  %.not33.us = icmp eq i32 %18, %19
  br i1 %.not33.us, label %33, label %20

20:                                               ; preds = %17
  %21 = sub i32 %19, %18
  %22 = tail call noundef i32 @_Z5MyMinIjET_S0_S0_(i32 noundef %.02336.us, i32 noundef %21)
  %23 = load ptr, ptr %13, align 8, !tbaa !42
  %24 = load i32, ptr %11, align 8, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds i8, ptr %23, i64 %25
  %27 = zext i32 %22 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %26, ptr align 1 %.02137.us, i64 %27, i1 false)
  %28 = sub i32 %.02336.us, %22
  %29 = getelementptr inbounds i8, ptr %.02137.us, i64 %27
  %30 = load i32, ptr %11, align 8, !tbaa !9
  %31 = add i32 %30, %22
  store i32 %31, ptr %11, align 8, !tbaa !9
  %32 = load i32, ptr %12, align 8, !tbaa !41
  %.not34.us = icmp eq i32 %31, %32
  br i1 %.not34.us, label %33, label %.backedge.us

33:                                               ; preds = %20, %17
  %.124.us = phi i32 [ %28, %20 ], [ %.02336.us, %17 ]
  %.122.us = phi ptr [ %29, %20 ], [ %.02137.us, %17 ]
  %34 = tail call noundef ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
  %35 = load ptr, ptr %13, align 8, !tbaa !42
  %36 = load i32, ptr %11, align 8, !tbaa !9
  %37 = load ptr, ptr %34, align 8, !tbaa !43
  %38 = getelementptr inbounds i8, ptr %37, i64 48
  %39 = load ptr, ptr %38, align 8
  %40 = tail call noundef i32 %39(ptr noundef nonnull align 8 dereferenceable(8) %34, ptr noundef %35, i32 noundef %36)
  store i32 %40, ptr %15, align 8, !tbaa !45
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %.loopexit, label %42

42:                                               ; preds = %33
  %43 = load i32, ptr %11, align 8, !tbaa !9
  %44 = icmp ugt i32 %40, %43
  br i1 %44, label %.split.us, label %.backedge.us

.backedge.us:                                     ; preds = %42, %20
  %.023.be.us = phi i32 [ %28, %20 ], [ %.124.us, %42 ]
  %.021.be.us = phi ptr [ %29, %20 ], [ %.122.us, %42 ]
  %.not31.us = icmp eq i32 %.023.be.us, 0
  br i1 %.not31.us, label %.loopexit, label %.lr.ph.split.us, !llvm.loop !46

.lr.ph.split:                                     ; preds = %.lr.ph.split.preheader, %.backedge
  %.02137 = phi ptr [ %.021.be, %.backedge ], [ %1, %.lr.ph.split.preheader ]
  %.02336 = phi i32 [ %.023.be, %.backedge ], [ %2, %.lr.ph.split.preheader ]
  %45 = tail call noundef i32 @_ZN12CFilterCoder6Flush2Ev(ptr noundef nonnull align 8 dereferenceable(256) %0)
  %.not32.not = icmp eq i32 %45, 0
  br i1 %.not32.not, label %46, label %.loopexit

46:                                               ; preds = %.lr.ph.split
  %47 = load i32, ptr %6, align 8, !tbaa !9
  %48 = load i32, ptr %7, align 8, !tbaa !41
  %.not33 = icmp eq i32 %47, %48
  br i1 %.not33, label %64, label %49

49:                                               ; preds = %46
  %50 = sub i32 %48, %47
  %51 = tail call noundef i32 @_Z5MyMinIjET_S0_S0_(i32 noundef %.02336, i32 noundef %50)
  %52 = load ptr, ptr %8, align 8, !tbaa !42
  %53 = load i32, ptr %6, align 8, !tbaa !9
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds i8, ptr %52, i64 %54
  %56 = zext i32 %51 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %55, ptr align 1 %.02137, i64 %56, i1 false)
  %57 = sub i32 %.02336, %51
  %58 = getelementptr inbounds i8, ptr %.02137, i64 %56
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = add i32 %59, %51
  store i32 %60, ptr %3, align 4, !tbaa !5
  %61 = load i32, ptr %6, align 8, !tbaa !9
  %62 = add i32 %61, %51
  store i32 %62, ptr %6, align 8, !tbaa !9
  %63 = load i32, ptr %7, align 8, !tbaa !41
  %.not34 = icmp eq i32 %62, %63
  br i1 %.not34, label %64, label %.backedge

64:                                               ; preds = %49, %46
  %.124 = phi i32 [ %57, %49 ], [ %.02336, %46 ]
  %.122 = phi ptr [ %58, %49 ], [ %.02137, %46 ]
  %65 = tail call noundef ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9)
  %66 = load ptr, ptr %8, align 8, !tbaa !42
  %67 = load i32, ptr %6, align 8, !tbaa !9
  %68 = load ptr, ptr %65, align 8, !tbaa !43
  %69 = getelementptr inbounds i8, ptr %68, i64 48
  %70 = load ptr, ptr %69, align 8
  %71 = tail call noundef i32 %70(ptr noundef nonnull align 8 dereferenceable(8) %65, ptr noundef %66, i32 noundef %67)
  store i32 %71, ptr %10, align 8, !tbaa !45
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %.loopexit, label %73

73:                                               ; preds = %64
  %74 = load i32, ptr %6, align 8, !tbaa !9
  %75 = icmp ugt i32 %71, %74
  br i1 %75, label %.split.us, label %.backedge

.backedge:                                        ; preds = %73, %49
  %.023.be = phi i32 [ %57, %49 ], [ %.124, %73 ]
  %.021.be = phi ptr [ %58, %49 ], [ %.122, %73 ]
  %.not31 = icmp eq i32 %.023.be, 0
  br i1 %.not31, label %.loopexit, label %.lr.ph.split, !llvm.loop !46

.split.us:                                        ; preds = %73, %42
  %76 = phi ptr [ %15, %42 ], [ %10, %73 ]
  store i32 0, ptr %76, align 8, !tbaa !45
  br label %.loopexit

.loopexit:                                        ; preds = %64, %.backedge, %.lr.ph.split, %33, %.backedge.us, %.lr.ph.split.us, %.thread, %5, %.split.us
  %.2 = phi i32 [ -2147467259, %.split.us ], [ 0, %5 ], [ 0, %.thread ], [ 0, %33 ], [ 0, %.backedge.us ], [ %16, %.lr.ph.split.us ], [ 0, %64 ], [ 0, %.backedge ], [ %45, %.lr.ph.split ]
  ret i32 %.2
}

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

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

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 184}
!10 = !{!"_ZTS12CFilterCoder", !11, i64 0, !13, i64 8, !14, i64 16, !15, i64 24, !16, i64 32, !17, i64 40, !18, i64 48, !19, i64 56, !20, i64 64, !21, i64 72, !22, i64 80, !23, i64 88, !24, i64 96, !25, i64 104, !26, i64 112, !27, i64 120, !28, i64 128, !6, i64 136, !6, i64 140, !6, i64 144, !30, i64 148, !30, i64 149, !31, i64 152, !31, i64 160, !32, i64 168, !33, i64 176, !6, i64 184, !6, i64 188, !6, i64 192, !34, i64 200, !35, i64 208, !36, i64 216, !37, i64 224, !38, i64 232, !39, i64 240, !40, i64 248}
!11 = !{!"_ZTS14ICompressCoder", !12, i64 0}
!12 = !{!"_ZTS8IUnknown"}
!13 = !{!"_ZTS25ICompressSetOutStreamSize", !12, i64 0}
!14 = !{!"_ZTS20ICompressInitEncoder", !12, i64 0}
!15 = !{!"_ZTS20ICompressSetInStream", !12, i64 0}
!16 = !{!"_ZTS19ISequentialInStream", !12, i64 0}
!17 = !{!"_ZTS21ICompressSetOutStream", !12, i64 0}
!18 = !{!"_ZTS20ISequentialOutStream", !12, i64 0}
!19 = !{!"_ZTS16IOutStreamFinish", !12, i64 0}
!20 = !{!"_ZTS19ICompressSetBufSize", !12, i64 0}
!21 = !{!"_ZTS18ICryptoSetPassword", !12, i64 0}
!22 = !{!"_ZTS17ICryptoProperties", !12, i64 0}
!23 = !{!"_ZTS27ICompressSetCoderProperties", !12, i64 0}
!24 = !{!"_ZTS29ICompressWriteCoderProperties", !12, i64 0}
!25 = !{!"_ZTS22ICryptoResetInitVector", !12, i64 0}
!26 = !{!"_ZTS30ICompressSetDecoderProperties2", !12, i64 0}
!27 = !{!"_ZTS13CMyUnknownImp", !6, i64 0}
!28 = !{!"_ZTS17CAlignedMidBuffer", !29, i64 0}
!29 = !{!"any pointer", !7, i64 0}
!30 = !{!"bool", !7, i64 0}
!31 = !{!"long long", !7, i64 0}
!32 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !29, i64 0}
!33 = !{!"_ZTS9CMyComPtrI20ISequentialOutStreamE", !29, i64 0}
!34 = !{!"_ZTS9CMyComPtrI18ICryptoSetPasswordE", !29, i64 0}
!35 = !{!"_ZTS9CMyComPtrI17ICryptoPropertiesE", !29, i64 0}
!36 = !{!"_ZTS9CMyComPtrI27ICompressSetCoderPropertiesE", !29, i64 0}
!37 = !{!"_ZTS9CMyComPtrI29ICompressWriteCoderPropertiesE", !29, i64 0}
!38 = !{!"_ZTS9CMyComPtrI22ICryptoResetInitVectorE", !29, i64 0}
!39 = !{!"_ZTS9CMyComPtrI30ICompressSetDecoderProperties2E", !29, i64 0}
!40 = !{!"_ZTS9CMyComPtrI15ICompressFilterE", !29, i64 0}
!41 = !{!10, !6, i64 136}
!42 = !{!28, !29, i64 0}
!43 = !{!44, !44, i64 0}
!44 = !{!"vtable pointer", !8, i64 0}
!45 = !{!10, !6, i64 192}
!46 = distinct !{!46, !47}
!47 = !{!"llvm.loop.mustprogress"}


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