; 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: 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

declare noundef i32 @_Z10ReadStreamP19ISequentialInStreamPvPm(ptr noundef, ptr noundef, ptr noundef) #1

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

; 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 uwtable
define dso_local noundef i32 @_ZN12CFilterCoder4ReadEPvjPj(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3) unnamed_addr #4 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 i64, align 8
  %14 = alloca i32, align 4
  %15 = 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
  %16 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %178, %176, %4
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = icmp ugt i32 %18, 0
  br i1 %19, label %20, label %179

20:                                               ; preds = %17
  %21 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 16
  %22 = load i32, ptr %21, align 4, !tbaa !11
  %23 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 17
  %24 = load i32, ptr %23, align 8, !tbaa !36
  %25 = icmp ne i32 %22, %24
  br i1 %25, label %26, label %57

26:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 17
  %29 = load i32, ptr %28, align 8, !tbaa !36
  %30 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 16
  %31 = load i32, ptr %30, align 4, !tbaa !11
  %32 = sub i32 %29, %31
  %33 = call noundef i32 @_Z5MyMinIjET_S0_S0_(i32 noundef %27, i32 noundef %32)
  store i32 %33, ptr %11, align 4, !tbaa !9
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 12
  %36 = load ptr, ptr %35, align 8, !tbaa !37
  %37 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 16
  %38 = load i32, ptr %37, align 4, !tbaa !11
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds i8, ptr %36, i64 %39
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %34, ptr align 1 %40, i64 %42, i1 false)
  %43 = load i32, ptr %11, align 4, !tbaa !9
  %44 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 16
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = add i32 %45, %43
  store i32 %46, ptr %44, align 4, !tbaa !11
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = load i32, ptr %11, 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
  %51 = load i32, ptr %11, align 4, !tbaa !9
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = sub i32 %52, %51
  store i32 %53, ptr %8, align 4, !tbaa !9
  %54 = load i32, ptr %11, align 4, !tbaa !9
  %55 = load i32, ptr %10, align 4, !tbaa !9
  %56 = add i32 %55, %54
  store i32 %56, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %179

57:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %81, %57
  %59 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 17
  %60 = load i32, ptr %59, align 8, !tbaa !36
  %61 = load i32, ptr %12, align 4, !tbaa !9
  %62 = add i32 %60, %61
  %63 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  %64 = load i32, ptr %63, align 8, !tbaa !38
  %65 = icmp ult i32 %62, %64
  br i1 %65, label %66, label %84

66:                                               ; preds = %58
  %67 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 12
  %68 = load ptr, ptr %67, align 8, !tbaa !37
  %69 = load i32, ptr %12, align 4, !tbaa !9
  %70 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 17
  %71 = load i32, ptr %70, align 8, !tbaa !36
  %72 = add i32 %69, %71
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds i8, ptr %68, i64 %73
  %75 = load i8, ptr %74, align 1, !tbaa !39
  %76 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 12
  %77 = load ptr, ptr %76, align 8, !tbaa !37
  %78 = load i32, ptr %12, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds i8, ptr %77, i64 %79
  store i8 %75, ptr %80, align 1, !tbaa !39
  br label %81

81:                                               ; preds = %66
  %82 = load i32, ptr %12, align 4, !tbaa !9
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %12, align 4, !tbaa !9
  br label %58, !llvm.loop !40

84:                                               ; preds = %58
  %85 = load i32, ptr %12, align 4, !tbaa !9
  %86 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  store i32 %85, ptr %86, align 8, !tbaa !38
  %87 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 17
  store i32 0, ptr %87, align 8, !tbaa !36
  %88 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 16
  store i32 0, ptr %88, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %89 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  %90 = load i32, ptr %89, align 8, !tbaa !38
  %91 = sub i32 131072, %90
  %92 = zext i32 %91 to i64
  store i64 %92, ptr %13, align 8, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %93 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 13
  %94 = call noundef ptr @_ZNK9CMyComPtrI19ISequentialInStreamEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %93)
  %95 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 12
  %96 = load ptr, ptr %95, align 8, !tbaa !37
  %97 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  %98 = load i32, ptr %97, align 8, !tbaa !38
  %99 = zext i32 %98 to i64
  %100 = getelementptr inbounds i8, ptr %96, i64 %99
  %101 = call noundef i32 @_Z10ReadStreamP19ISequentialInStreamPvPm(ptr noundef %94, ptr noundef %100, ptr noundef %13)
  store i32 %101, ptr %14, align 4, !tbaa !9
  %102 = load i32, ptr %14, align 4, !tbaa !9
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %106

104:                                              ; preds = %84
  %105 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %105, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %107

106:                                              ; preds = %84
  store i32 0, ptr %15, align 4
  br label %107

107:                                              ; preds = %106, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  %108 = load i32, ptr %15, align 4
  switch i32 %108, label %176 [
    i32 0, label %109
  ]

109:                                              ; preds = %107
  %110 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  %111 = load i32, ptr %110, align 8, !tbaa !38
  %112 = load i64, ptr %13, align 8, !tbaa !42
  %113 = trunc i64 %112 to i32
  %114 = add i32 %111, %113
  %115 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  store i32 %114, ptr %115, align 8, !tbaa !38
  %116 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 26
  %117 = call noundef ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8) %116)
  %118 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 12
  %119 = load ptr, ptr %118, align 8, !tbaa !37
  %120 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  %121 = load i32, ptr %120, align 8, !tbaa !38
  %122 = load ptr, ptr %117, align 8, !tbaa !44
  %123 = getelementptr inbounds ptr, ptr %122, i64 6
  %124 = load ptr, ptr %123, align 8
  %125 = call noundef i32 %124(ptr noundef nonnull align 8 dereferenceable(8) %117, ptr noundef %119, i32 noundef %121)
  %126 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 17
  store i32 %125, ptr %126, align 8, !tbaa !36
  %127 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 17
  %128 = load i32, ptr %127, align 8, !tbaa !36
  %129 = icmp eq i32 %128, 0
  br i1 %129, label %130, label %139

130:                                              ; preds = %109
  %131 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  %132 = load i32, ptr %131, align 8, !tbaa !38
  %133 = icmp eq i32 %132, 0
  br i1 %133, label %134, label %135

134:                                              ; preds = %130
  store i32 3, ptr %15, align 4
  br label %176

135:                                              ; preds = %130
  %136 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  %137 = load i32, ptr %136, align 8, !tbaa !38
  %138 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 17
  store i32 %137, ptr %138, align 8, !tbaa !36
  store i32 2, ptr %15, align 4
  br label %176, !llvm.loop !46

139:                                              ; preds = %109
  %140 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 17
  %141 = load i32, ptr %140, align 8, !tbaa !36
  %142 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  %143 = load i32, ptr %142, align 8, !tbaa !38
  %144 = icmp ugt i32 %141, %143
  br i1 %144, label %145, label %175

145:                                              ; preds = %139
  br label %146

146:                                              ; preds = %159, %145
  %147 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  %148 = load i32, ptr %147, align 8, !tbaa !38
  %149 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 17
  %150 = load i32, ptr %149, align 8, !tbaa !36
  %151 = icmp ult i32 %148, %150
  br i1 %151, label %152, label %163

152:                                              ; preds = %146
  %153 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 12
  %154 = load ptr, ptr %153, align 8, !tbaa !37
  %155 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  %156 = load i32, ptr %155, align 8, !tbaa !38
  %157 = zext i32 %156 to i64
  %158 = getelementptr inbounds i8, ptr %154, i64 %157
  store i8 0, ptr %158, align 1, !tbaa !39
  br label %159

159:                                              ; preds = %152
  %160 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  %161 = load i32, ptr %160, align 8, !tbaa !38
  %162 = add i32 %161, 1
  store i32 %162, ptr %160, align 8, !tbaa !38
  br label %146, !llvm.loop !47

163:                                              ; preds = %146
  %164 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 26
  %165 = call noundef ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8) %164)
  %166 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 12
  %167 = load ptr, ptr %166, align 8, !tbaa !37
  %168 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 15
  %169 = load i32, ptr %168, align 8, !tbaa !38
  %170 = load ptr, ptr %165, align 8, !tbaa !44
  %171 = getelementptr inbounds ptr, ptr %170, i64 6
  %172 = load ptr, ptr %171, align 8
  %173 = call noundef i32 %172(ptr noundef nonnull align 8 dereferenceable(8) %165, ptr noundef %167, i32 noundef %169)
  %174 = getelementptr inbounds %class.CFilterCoder, ptr %16, i32 0, i32 17
  store i32 %173, ptr %174, align 8, !tbaa !36
  br label %175

175:                                              ; preds = %163, %139
  store i32 0, ptr %15, align 4
  br label %176

176:                                              ; preds = %175, %135, %134, %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  %177 = load i32, ptr %15, align 4
  switch i32 %177, label %186 [
    i32 0, label %178
    i32 3, label %179
    i32 2, label %17
  ]

178:                                              ; preds = %176
  br label %17, !llvm.loop !46

179:                                              ; preds = %176, %26, %17
  %180 = load ptr, ptr %9, align 8, !tbaa !5
  %181 = icmp ne ptr %180, null
  br i1 %181, label %182, label %185

182:                                              ; preds = %179
  %183 = load i32, ptr %10, align 4, !tbaa !9
  %184 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %183, ptr %184, align 4, !tbaa !9
  br label %185

185:                                              ; preds = %182, %179
  store i32 0, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %186

186:                                              ; preds = %185, %176
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %187 = load i32, ptr %5, align 4
  ret i32 %187
}

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 #6 = { 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 124}
!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, !10, i64 128}
!37 = !{!12, !6, i64 96}
!38 = !{!12, !10, i64 120}
!39 = !{!7, !7, i64 0}
!40 = distinct !{!40, !41}
!41 = !{!"llvm.loop.mustprogress"}
!42 = !{!43, !43, i64 0}
!43 = !{!"long", !7, i64 0}
!44 = !{!45, !45, i64 0}
!45 = !{!"vtable pointer", !8, i64 0}
!46 = distinct !{!46, !41}
!47 = distinct !{!47, !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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

declare noundef i32 @_Z10ReadStreamP19ISequentialInStreamPvPm(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

; 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) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN12CFilterCoder4ReadEPvjPj(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr nocapture noundef writeonly %1, i32 noundef %2, ptr noundef writeonly %3) unnamed_addr #4 align 2 {
  %5 = alloca i64, align 8
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %.loopexit, label %.lr.ph60

.lr.ph60:                                         ; preds = %4
  %6 = getelementptr inbounds i8, ptr %0, i64 124
  %7 = getelementptr inbounds i8, ptr %0, i64 128
  %8 = getelementptr inbounds i8, ptr %0, i64 120
  %9 = getelementptr inbounds i8, ptr %0, i64 96
  %10 = getelementptr inbounds i8, ptr %0, i64 104
  %11 = getelementptr inbounds i8, ptr %0, i64 192
  %.pre = load i32, ptr %7, align 8, !tbaa !5
  %12 = load i32, ptr %6, align 4, !tbaa !34
  %.not3789 = icmp eq i32 %12, %.pre
  br i1 %.not3789, label %.preheader43, label %._crit_edge90

.preheader43:                                     ; preds = %.lr.ph60, %77
  %13 = phi i32 [ %78, %77 ], [ %.pre, %.lr.ph60 ]
  %14 = load i32, ptr %8, align 8, !tbaa !35
  %15 = icmp ult i32 %13, %14
  br i1 %15, label %.lr.ph, label %._crit_edge

._crit_edge90:                                    ; preds = %77, %.lr.ph60
  %.lcssa84 = phi i32 [ %.pre, %.lr.ph60 ], [ %78, %77 ]
  %.lcssa81 = phi i32 [ %12, %.lr.ph60 ], [ %79, %77 ]
  %16 = sub i32 %.lcssa84, %.lcssa81
  %17 = call noundef i32 @_Z5MyMinIjET_S0_S0_(i32 noundef %2, i32 noundef %16)
  %18 = load ptr, ptr %9, align 8, !tbaa !36
  %19 = load i32, ptr %6, align 4, !tbaa !34
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds i8, ptr %18, i64 %20
  %22 = zext i32 %17 to i64
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %1, ptr align 1 %21, i64 %22, i1 false)
  %23 = load i32, ptr %6, align 4, !tbaa !34
  %24 = add i32 %23, %17
  store i32 %24, ptr %6, align 4, !tbaa !34
  br label %.loopexit

.lr.ph:                                           ; preds = %.preheader43, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader43 ]
  %25 = phi i32 [ %33, %.lr.ph ], [ %13, %.preheader43 ]
  %26 = load ptr, ptr %9, align 8, !tbaa !36
  %27 = zext i32 %25 to i64
  %28 = getelementptr inbounds i8, ptr %26, i64 %27
  %29 = load i8, ptr %28, align 1, !tbaa !37
  %30 = getelementptr inbounds i8, ptr %26, i64 %indvars.iv
  store i8 %29, ptr %30, align 1, !tbaa !37
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %31 = load i32, ptr %7, align 8, !tbaa !5
  %32 = trunc nuw nsw i64 %indvars.iv.next to i32
  %33 = add i32 %31, %32
  %34 = load i32, ptr %8, align 8, !tbaa !35
  %35 = icmp ult i32 %33, %34
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !38

._crit_edge:                                      ; preds = %.lr.ph, %.preheader43
  %.026.lcssa = phi i32 [ 0, %.preheader43 ], [ %32, %.lr.ph ]
  store i32 %.026.lcssa, ptr %8, align 8, !tbaa !35
  store i32 0, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %6, align 4, !tbaa !34
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %36 = sub nsw i32 131072, %.026.lcssa
  %37 = zext i32 %36 to i64
  store i64 %37, ptr %5, align 8, !tbaa !40
  %38 = call noundef ptr @_ZNK9CMyComPtrI19ISequentialInStreamEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %10)
  %39 = load ptr, ptr %9, align 8, !tbaa !36
  %40 = load i32, ptr %8, align 8, !tbaa !35
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds i8, ptr %39, i64 %41
  %43 = call noundef i32 @_Z10ReadStreamP19ISequentialInStreamPvPm(ptr noundef %38, ptr noundef %42, ptr noundef nonnull %5)
  %.not38 = icmp eq i32 %43, 0
  br i1 %.not38, label %44, label %.thread41

.thread41:                                        ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %81

44:                                               ; preds = %._crit_edge
  %45 = load i32, ptr %8, align 8, !tbaa !35
  %46 = load i64, ptr %5, align 8, !tbaa !40
  %47 = trunc i64 %46 to i32
  %48 = add i32 %45, %47
  store i32 %48, ptr %8, align 8, !tbaa !35
  %49 = call noundef ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11)
  %50 = load ptr, ptr %9, align 8, !tbaa !36
  %51 = load i32, ptr %8, align 8, !tbaa !35
  %52 = load ptr, ptr %49, align 8, !tbaa !42
  %53 = getelementptr inbounds i8, ptr %52, i64 48
  %54 = load ptr, ptr %53, align 8
  %55 = call noundef i32 %54(ptr noundef nonnull align 8 dereferenceable(8) %49, ptr noundef %50, i32 noundef %51)
  store i32 %55, ptr %7, align 8, !tbaa !5
  %56 = icmp eq i32 %55, 0
  %57 = load i32, ptr %8, align 8, !tbaa !35
  br i1 %56, label %58, label %60

58:                                               ; preds = %44
  %59 = icmp eq i32 %57, 0
  br i1 %59, label %.thread, label %.sink.split, !llvm.loop !44

.thread:                                          ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %.loopexit

60:                                               ; preds = %44
  %61 = icmp ugt i32 %55, %57
  br i1 %61, label %.lr.ph56, label %77

.lr.ph56:                                         ; preds = %60, %.lr.ph56
  %62 = phi i32 [ %67, %.lr.ph56 ], [ %57, %60 ]
  %63 = load ptr, ptr %9, align 8, !tbaa !36
  %64 = zext i32 %62 to i64
  %65 = getelementptr inbounds i8, ptr %63, i64 %64
  store i8 0, ptr %65, align 1, !tbaa !37
  %66 = load i32, ptr %8, align 8, !tbaa !35
  %67 = add i32 %66, 1
  store i32 %67, ptr %8, align 8, !tbaa !35
  %68 = load i32, ptr %7, align 8, !tbaa !5
  %69 = icmp ult i32 %67, %68
  br i1 %69, label %.lr.ph56, label %._crit_edge57, !llvm.loop !45

._crit_edge57:                                    ; preds = %.lr.ph56
  %70 = call noundef ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11)
  %71 = load ptr, ptr %9, align 8, !tbaa !36
  %72 = load i32, ptr %8, align 8, !tbaa !35
  %73 = load ptr, ptr %70, align 8, !tbaa !42
  %74 = getelementptr inbounds i8, ptr %73, i64 48
  %75 = load ptr, ptr %74, align 8
  %76 = call noundef i32 %75(ptr noundef nonnull align 8 dereferenceable(8) %70, ptr noundef %71, i32 noundef %72)
  br label %.sink.split

.sink.split:                                      ; preds = %58, %._crit_edge57
  %.sink = phi i32 [ %76, %._crit_edge57 ], [ %57, %58 ]
  store i32 %.sink, ptr %7, align 8, !tbaa !5
  br label %77

77:                                               ; preds = %.sink.split, %60
  %78 = phi i32 [ %55, %60 ], [ %.sink, %.sink.split ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %79 = load i32, ptr %6, align 4, !tbaa !34
  %.not37 = icmp eq i32 %79, %78
  br i1 %.not37, label %.preheader43, label %._crit_edge90

.loopexit:                                        ; preds = %4, %.thread, %._crit_edge90
  %.027 = phi i32 [ %17, %._crit_edge90 ], [ 0, %.thread ], [ 0, %4 ]
  %.not39 = icmp eq ptr %3, null
  br i1 %.not39, label %81, label %80

80:                                               ; preds = %.loopexit
  store i32 %.027, ptr %3, align 4, !tbaa !46
  br label %81

81:                                               ; preds = %.thread41, %.loopexit, %80
  %.2 = phi i32 [ 0, %80 ], [ 0, %.loopexit ], [ %43, %.thread41 ]
  ret i32 %.2
}

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 #6 = { 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, !20, i64 128}
!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, !20, i64 124}
!35 = !{!6, !20, i64 120}
!36 = !{!6, !23, i64 96}
!37 = !{!21, !21, i64 0}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}
!40 = !{!41, !41, i64 0}
!41 = !{!"long", !21, i64 0}
!42 = !{!43, !43, i64 0}
!43 = !{!"vtable pointer", !22, i64 0}
!44 = distinct !{!44, !39}
!45 = distinct !{!45, !39}
!46 = !{!20, !20, i64 0}


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