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

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

%struct.GUID = type { i32, i16, i16, [8 x i8] }
%class.CMyComPtr.8 = type { ptr }
%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 }

@IID_IOutStreamFinish = external global %struct.GUID, align 4

declare i32 @__gxx_personality_v0(...)

; 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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN12CFilterCoder15OutStreamFinishEv(ptr noundef nonnull align 8 dereferenceable(256) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %class.CMyComPtr.8, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  br label %10

10:                                               ; preds = %104, %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %11 = call noundef i32 @_ZN12CFilterCoder6Flush2Ev(ptr noundef nonnull align 8 dereferenceable(256) %9)
  store i32 %11, ptr %4, align 4, !tbaa !9
  %12 = load i32, ptr %4, align 4, !tbaa !9
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %14, label %16

14:                                               ; preds = %10
  %15 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %15, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %17

16:                                               ; preds = %10
  store i32 0, ptr %5, align 4
  br label %17

17:                                               ; preds = %16, %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %18 = load i32, ptr %5, align 4
  switch i32 %18, label %134 [
    i32 0, label %19
    i32 1, label %127
  ]

19:                                               ; preds = %17
  %20 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 26
  %21 = load i32, ptr %20, align 8, !tbaa !11
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %19
  br label %105

24:                                               ; preds = %19
  %25 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 35
  %26 = call noundef ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8) %25)
  %27 = getelementptr inbounds i8, ptr %9, i64 128
  %28 = getelementptr inbounds %struct.CAlignedMidBuffer, ptr %27, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8, !tbaa !42
  %30 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 26
  %31 = load i32, ptr %30, align 8, !tbaa !11
  %32 = load ptr, ptr %26, align 8, !tbaa !43
  %33 = getelementptr inbounds ptr, ptr %32, i64 6
  %34 = load ptr, ptr %33, align 8
  %35 = call noundef i32 %34(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef %29, i32 noundef %31)
  %36 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 28
  store i32 %35, ptr %36, align 8, !tbaa !45
  %37 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 28
  %38 = load i32, ptr %37, align 8, !tbaa !45
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %40, label %44

40:                                               ; preds = %24
  %41 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 26
  %42 = load i32, ptr %41, align 8, !tbaa !11
  %43 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 28
  store i32 %42, ptr %43, align 8, !tbaa !45
  br label %104

44:                                               ; preds = %24
  %45 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 28
  %46 = load i32, ptr %45, align 8, !tbaa !45
  %47 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 26
  %48 = load i32, ptr %47, align 8, !tbaa !11
  %49 = icmp ugt i32 %46, %48
  br i1 %49, label %50, label %103

50:                                               ; preds = %44
  %51 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 28
  %52 = load i32, ptr %51, align 8, !tbaa !45
  %53 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 17
  %54 = load i32, ptr %53, align 8, !tbaa !46
  %55 = icmp ugt i32 %52, %54
  br i1 %55, label %56, label %58

56:                                               ; preds = %50
  %57 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 28
  store i32 0, ptr %57, align 8, !tbaa !45
  store i32 -2147467259, ptr %2, align 4
  br label %127

58:                                               ; preds = %50
  %59 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 20
  %60 = load i8, ptr %59, align 4, !tbaa !47, !range !48, !noundef !49
  %61 = trunc i8 %60 to i1
  br i1 %61, label %64, label %62

62:                                               ; preds = %58
  %63 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 28
  store i32 0, ptr %63, align 8, !tbaa !45
  store i32 1, ptr %2, align 4
  br label %127

64:                                               ; preds = %58
  br label %65

65:                                               ; preds = %79, %64
  %66 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 26
  %67 = load i32, ptr %66, align 8, !tbaa !11
  %68 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 28
  %69 = load i32, ptr %68, align 8, !tbaa !45
  %70 = icmp ult i32 %67, %69
  br i1 %70, label %71, label %83

71:                                               ; preds = %65
  %72 = getelementptr inbounds i8, ptr %9, i64 128
  %73 = getelementptr inbounds %struct.CAlignedMidBuffer, ptr %72, i32 0, i32 0
  %74 = load ptr, ptr %73, align 8, !tbaa !42
  %75 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 26
  %76 = load i32, ptr %75, align 8, !tbaa !11
  %77 = zext i32 %76 to i64
  %78 = getelementptr inbounds i8, ptr %74, i64 %77
  store i8 0, ptr %78, align 1, !tbaa !50
  br label %79

79:                                               ; preds = %71
  %80 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 26
  %81 = load i32, ptr %80, align 8, !tbaa !11
  %82 = add i32 %81, 1
  store i32 %82, ptr %80, align 8, !tbaa !11
  br label %65, !llvm.loop !51

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

101:                                              ; preds = %83
  store i32 -2147467259, ptr %2, align 4
  br label %127

102:                                              ; preds = %83
  br label %103

103:                                              ; preds = %102, %44
  br label %104

104:                                              ; preds = %103, %40
  br label %10, !llvm.loop !53

105:                                              ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @_ZN9CMyComPtrI16IOutStreamFinishEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6)
  %106 = getelementptr inbounds %class.CFilterCoder, ptr %9, i32 0, i32 25
  %107 = invoke noundef ptr @_ZN9CMyComPtrI16IOutStreamFinishEadEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %108 unwind label %121

108:                                              ; preds = %105
  %109 = call noundef i32 @_ZNK9CMyComPtrI20ISequentialOutStreamE14QueryInterfaceI16IOutStreamFinishEEiRK4GUIDPPT_(ptr noundef nonnull align 8 dereferenceable(8) %106, ptr noundef nonnull align 4 dereferenceable(16) @IID_IOutStreamFinish, ptr noundef %107) #3
  %110 = invoke noundef ptr @_ZNK9CMyComPtrI16IOutStreamFinishEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %111 unwind label %121

111:                                              ; preds = %108
  %112 = icmp ne ptr %110, null
  br i1 %112, label %113, label %125

113:                                              ; preds = %111
  %114 = invoke noundef ptr @_ZNK9CMyComPtrI16IOutStreamFinishEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %115 unwind label %121

115:                                              ; preds = %113
  %116 = load ptr, ptr %114, align 8, !tbaa !43
  %117 = getelementptr inbounds ptr, ptr %116, i64 5
  %118 = load ptr, ptr %117, align 8
  %119 = invoke noundef i32 %118(ptr noundef nonnull align 8 dereferenceable(8) %114)
          to label %120 unwind label %121

120:                                              ; preds = %115
  store i32 %119, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %126

121:                                              ; preds = %115, %113, %108, %105
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %7, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %8, align 4
  call void @_ZN9CMyComPtrI16IOutStreamFinishED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %129

125:                                              ; preds = %111
  store i32 0, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %126

126:                                              ; preds = %125, %120
  call void @_ZN9CMyComPtrI16IOutStreamFinishED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %127

127:                                              ; preds = %126, %101, %62, %56, %17
  %128 = load i32, ptr %2, align 4
  ret i32 %128

129:                                              ; preds = %121
  %130 = load ptr, ptr %7, align 8
  %131 = load i32, ptr %8, align 4
  %132 = insertvalue { ptr, i32 } poison, ptr %130, 0
  %133 = insertvalue { ptr, i32 } %132, i32 %131, 1
  resume { ptr, i32 } %133

134:                                              ; preds = %17
  unreachable
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9CMyComPtrI16IOutStreamFinishED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 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 = { 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 = !{!30, !6, i64 0}
!43 = !{!44, !44, i64 0}
!44 = !{!"vtable pointer", !8, i64 0}
!45 = !{!12, !10, i64 192}
!46 = !{!12, !10, i64 136}
!47 = !{!12, !31, i64 148}
!48 = !{i8 0, i8 2}
!49 = !{}
!50 = !{!7, !7, i64 0}
!51 = distinct !{!51, !52}
!52 = !{!"llvm.loop.mustprogress"}
!53 = distinct !{!53, !52}


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

%struct.GUID = type { i32, i16, i16, [8 x i8] }
%class.CMyComPtr.8 = type { ptr }

@IID_IOutStreamFinish = external global %struct.GUID, align 4

declare i32 @__gxx_personality_v0(...)

; 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

; 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 @_ZN12CFilterCoder15OutStreamFinishEv(ptr noundef nonnull align 8 dereferenceable(256) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %class.CMyComPtr.8, align 8
  %3 = tail call noundef i32 @_ZN12CFilterCoder6Flush2Ev(ptr noundef nonnull align 8 dereferenceable(256) %0)
  %.not.not13 = icmp eq i32 %3, 0
  br i1 %.not.not13, label %.lr.ph16, label %.loopexit

.lr.ph16:                                         ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 184
  %5 = getelementptr inbounds i8, ptr %0, i64 248
  %6 = getelementptr inbounds i8, ptr %0, i64 128
  %7 = getelementptr inbounds i8, ptr %0, i64 192
  %8 = getelementptr inbounds i8, ptr %0, i64 136
  %9 = getelementptr inbounds i8, ptr %0, i64 148
  br label %10

10:                                               ; preds = %.lr.ph16, %50
  %11 = load i32, ptr %4, align 8, !tbaa !5
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %52, label %13

13:                                               ; preds = %10
  %14 = tail call noundef ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %15 = load ptr, ptr %6, align 8, !tbaa !40
  %16 = load i32, ptr %4, align 8, !tbaa !5
  %17 = load ptr, ptr %14, align 8, !tbaa !41
  %18 = getelementptr inbounds i8, ptr %17, i64 48
  %19 = load ptr, ptr %18, align 8
  %20 = tail call noundef i32 %19(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef %15, i32 noundef %16)
  store i32 %20, ptr %7, align 8, !tbaa !43
  %21 = icmp eq i32 %20, 0
  %22 = load i32, ptr %4, align 8, !tbaa !5
  br i1 %21, label %23, label %24

23:                                               ; preds = %13
  store i32 %22, ptr %7, align 8, !tbaa !43
  br label %50

24:                                               ; preds = %13
  %25 = icmp ugt i32 %20, %22
  br i1 %25, label %26, label %50

26:                                               ; preds = %24
  %27 = load i32, ptr %8, align 8, !tbaa !44
  %28 = icmp ugt i32 %20, %27
  br i1 %28, label %29, label %30

29:                                               ; preds = %26
  store i32 0, ptr %7, align 8, !tbaa !43
  br label %.loopexit

30:                                               ; preds = %26
  %31 = load i8, ptr %9, align 4, !tbaa !45, !range !46, !noundef !47
  %32 = trunc nuw i8 %31 to i1
  br i1 %32, label %.lr.ph, label %33

33:                                               ; preds = %30
  store i32 0, ptr %7, align 8, !tbaa !43
  br label %.loopexit

.lr.ph:                                           ; preds = %30, %.lr.ph
  %34 = phi i32 [ %39, %.lr.ph ], [ %22, %30 ]
  %35 = load ptr, ptr %6, align 8, !tbaa !40
  %36 = zext i32 %34 to i64
  %37 = getelementptr inbounds i8, ptr %35, i64 %36
  store i8 0, ptr %37, align 1, !tbaa !48
  %38 = load i32, ptr %4, align 8, !tbaa !5
  %39 = add i32 %38, 1
  store i32 %39, ptr %4, align 8, !tbaa !5
  %40 = load i32, ptr %7, align 8, !tbaa !43
  %41 = icmp ult i32 %39, %40
  br i1 %41, label %.lr.ph, label %._crit_edge, !llvm.loop !49

._crit_edge:                                      ; preds = %.lr.ph
  %42 = tail call noundef ptr @_ZNK9CMyComPtrI15ICompressFilterEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %43 = load ptr, ptr %6, align 8, !tbaa !40
  %44 = load i32, ptr %4, align 8, !tbaa !5
  %45 = load ptr, ptr %42, align 8, !tbaa !41
  %46 = getelementptr inbounds i8, ptr %45, i64 48
  %47 = load ptr, ptr %46, align 8
  %48 = tail call noundef i32 %47(ptr noundef nonnull align 8 dereferenceable(8) %42, ptr noundef %43, i32 noundef %44)
  store i32 %48, ptr %7, align 8, !tbaa !43
  %49 = load i32, ptr %4, align 8, !tbaa !5
  %.not10 = icmp eq i32 %48, %49
  br i1 %.not10, label %50, label %.loopexit

50:                                               ; preds = %24, %._crit_edge, %23
  %51 = tail call noundef i32 @_ZN12CFilterCoder6Flush2Ev(ptr noundef nonnull align 8 dereferenceable(256) %0)
  %.not.not = icmp eq i32 %51, 0
  br i1 %.not.not, label %10, label %.loopexit, !llvm.loop !51

52:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN9CMyComPtrI16IOutStreamFinishEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %53 = getelementptr inbounds i8, ptr %0, i64 176
  %54 = call noundef ptr @_ZN9CMyComPtrI16IOutStreamFinishEadEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %55 = call noundef i32 @_ZNK9CMyComPtrI20ISequentialOutStreamE14QueryInterfaceI16IOutStreamFinishEEiRK4GUIDPPT_(ptr noundef nonnull align 8 dereferenceable(8) %53, ptr noundef nonnull align 4 dereferenceable(16) @IID_IOutStreamFinish, ptr noundef %54) #3
  %56 = call noundef ptr @_ZNK9CMyComPtrI16IOutStreamFinishEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %.not11 = icmp eq ptr %56, null
  br i1 %.not11, label %65, label %57

57:                                               ; preds = %52
  %58 = call noundef ptr @_ZNK9CMyComPtrI16IOutStreamFinishEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %59 = load ptr, ptr %58, align 8, !tbaa !41
  %60 = getelementptr inbounds i8, ptr %59, i64 40
  %61 = load ptr, ptr %60, align 8
  %62 = invoke noundef i32 %61(ptr noundef nonnull align 8 dereferenceable(8) %58)
          to label %65 unwind label %63

63:                                               ; preds = %57
  %64 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN9CMyComPtrI16IOutStreamFinishED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  resume { ptr, i32 } %64

65:                                               ; preds = %52, %57
  %.2 = phi i32 [ %62, %57 ], [ 0, %52 ]
  call void @_ZN9CMyComPtrI16IOutStreamFinishED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge, %50, %1, %65, %33, %29
  %.3 = phi i32 [ %.2, %65 ], [ -2147467259, %29 ], [ 1, %33 ], [ %3, %1 ], [ -2147467259, %._crit_edge ], [ %51, %50 ]
  ret i32 %.3
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9CMyComPtrI16IOutStreamFinishED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 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 = { 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, !24, i64 184}
!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, !20, i64 96, !21, i64 104, !22, i64 112, !23, i64 120, !27, i64 128, !24, i64 136, !24, i64 140, !24, i64 144, !29, i64 148, !29, i64 149, !30, i64 152, !30, i64 160, !31, i64 168, !32, i64 176, !24, i64 184, !24, i64 188, !24, i64 192, !33, i64 200, !34, i64 208, !35, i64 216, !36, i64 224, !37, i64 232, !38, i64 240, !39, i64 248}
!7 = !{!"_ZTS14ICompressCoder", !8, i64 0}
!8 = !{!"_ZTS8IUnknown"}
!9 = !{!"_ZTS25ICompressSetOutStreamSize", !8, i64 0}
!10 = !{!"_ZTS20ICompressInitEncoder", !8, i64 0}
!11 = !{!"_ZTS20ICompressSetInStream", !8, i64 0}
!12 = !{!"_ZTS19ISequentialInStream", !8, i64 0}
!13 = !{!"_ZTS21ICompressSetOutStream", !8, i64 0}
!14 = !{!"_ZTS20ISequentialOutStream", !8, i64 0}
!15 = !{!"_ZTS16IOutStreamFinish", !8, i64 0}
!16 = !{!"_ZTS19ICompressSetBufSize", !8, i64 0}
!17 = !{!"_ZTS18ICryptoSetPassword", !8, i64 0}
!18 = !{!"_ZTS17ICryptoProperties", !8, i64 0}
!19 = !{!"_ZTS27ICompressSetCoderProperties", !8, i64 0}
!20 = !{!"_ZTS29ICompressWriteCoderProperties", !8, i64 0}
!21 = !{!"_ZTS22ICryptoResetInitVector", !8, i64 0}
!22 = !{!"_ZTS30ICompressSetDecoderProperties2", !8, i64 0}
!23 = !{!"_ZTS13CMyUnknownImp", !24, i64 0}
!24 = !{!"int", !25, i64 0}
!25 = !{!"omnipotent char", !26, i64 0}
!26 = !{!"Simple C++ TBAA"}
!27 = !{!"_ZTS17CAlignedMidBuffer", !28, i64 0}
!28 = !{!"any pointer", !25, i64 0}
!29 = !{!"bool", !25, i64 0}
!30 = !{!"long long", !25, i64 0}
!31 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !28, i64 0}
!32 = !{!"_ZTS9CMyComPtrI20ISequentialOutStreamE", !28, i64 0}
!33 = !{!"_ZTS9CMyComPtrI18ICryptoSetPasswordE", !28, i64 0}
!34 = !{!"_ZTS9CMyComPtrI17ICryptoPropertiesE", !28, i64 0}
!35 = !{!"_ZTS9CMyComPtrI27ICompressSetCoderPropertiesE", !28, i64 0}
!36 = !{!"_ZTS9CMyComPtrI29ICompressWriteCoderPropertiesE", !28, i64 0}
!37 = !{!"_ZTS9CMyComPtrI22ICryptoResetInitVectorE", !28, i64 0}
!38 = !{!"_ZTS9CMyComPtrI30ICompressSetDecoderProperties2E", !28, i64 0}
!39 = !{!"_ZTS9CMyComPtrI15ICompressFilterE", !28, i64 0}
!40 = !{!27, !28, i64 0}
!41 = !{!42, !42, i64 0}
!42 = !{!"vtable pointer", !26, i64 0}
!43 = !{!6, !24, i64 192}
!44 = !{!6, !24, i64 136}
!45 = !{!6, !29, i64 148}
!46 = !{i8 0, i8 2}
!47 = !{}
!48 = !{!25, !25, i64 0}
!49 = distinct !{!49, !50}
!50 = !{!"llvm.loop.mustprogress"}
!51 = distinct !{!51, !50}


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