; LLVM IR from SSBMTonberry/pocketlzma :: ref_spec/lzma1900/CPP/7zip/Archive/7z (7zFolderInStream)

; 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 = type { ptr }
%class.CMyComPtr.3 = type { ptr }
%"class.NArchive::N7z::CFolderInStream" = type { %struct.ISequentialInStream, %struct.ICompressGetSubStreamSize, %class.CMyUnknownImp, %class.CMyComPtr, i64, i32, i8, i64, ptr, i32, i32, %class.CMyComPtr.0, %class.CRecordVector, %class.CRecordVector.1, %class.CRecordVector.2 }
%struct.ISequentialInStream = type { %struct.IUnknown }
%struct.IUnknown = type { ptr }
%struct.ICompressGetSubStreamSize = type { %struct.IUnknown }
%class.CMyUnknownImp = type { i32 }
%class.CMyComPtr.0 = type { ptr }
%class.CRecordVector = type { ptr, i32, i32 }
%class.CRecordVector.1 = type { ptr, i32, i32 }
%class.CRecordVector.2 = type { ptr, i32, i32 }

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN8NArchive3N7z15CFolderInStream10OpenStreamEv(ptr noundef nonnull align 8 dereferenceable(128) %0) #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca %class.CMyComPtr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %class.CMyComPtr.3, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8
  %12 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 4
  store i64 0, ptr %12, align 8, !tbaa !9
  %13 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 5
  store i32 -1, ptr %13, align 8, !tbaa !23
  %14 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 6
  store i8 0, ptr %14, align 4, !tbaa !24
  %15 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 7
  store i64 0, ptr %15, align 8, !tbaa !25
  br label %16

16:                                               ; preds = %119, %1
  %17 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 10
  %18 = load i32, ptr %17, align 4, !tbaa !26
  %19 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 9
  %20 = load i32, ptr %19, align 8, !tbaa !27
  %21 = icmp ult i32 %18, %20
  br i1 %21, label %22, label %121

22:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @_ZN9CMyComPtrI19ISequentialInStreamEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %23 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 11
  %24 = invoke noundef ptr @_ZNK9CMyComPtrI22IArchiveUpdateCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %23)
          to label %25 unwind label %47

25:                                               ; preds = %22
  %26 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 8
  %27 = load ptr, ptr %26, align 8, !tbaa !28
  %28 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 10
  %29 = load i32, ptr %28, align 4, !tbaa !26
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr %27, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !29
  %33 = invoke noundef ptr @_ZN9CMyComPtrI19ISequentialInStreamEadEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %34 unwind label %47

34:                                               ; preds = %25
  %35 = load ptr, ptr %24, align 8, !tbaa !30
  %36 = getelementptr inbounds ptr, ptr %35, i64 9
  %37 = load ptr, ptr %36, align 8
  %38 = invoke noundef i32 %37(ptr noundef nonnull align 8 dereferenceable(8) %24, i32 noundef %32, ptr noundef %33)
          to label %39 unwind label %47

39:                                               ; preds = %34
  store i32 %38, ptr %5, align 4, !tbaa !29
  %40 = load i32, ptr %5, align 4, !tbaa !29
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %52

42:                                               ; preds = %39
  %43 = load i32, ptr %5, align 4, !tbaa !29
  %44 = icmp ne i32 %43, 1
  br i1 %44, label %45, label %51

45:                                               ; preds = %42
  %46 = load i32, ptr %5, align 4, !tbaa !29
  store i32 %46, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %117

47:                                               ; preds = %113, %55, %52, %34, %25, %22
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %6, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %7, align 4
  br label %120

51:                                               ; preds = %42
  br label %52

52:                                               ; preds = %51, %39
  %53 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 3
  %54 = invoke noundef ptr @_ZN9CMyComPtrI19ISequentialInStreamEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %53, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %55 unwind label %47

55:                                               ; preds = %52
  %56 = invoke noundef ptr @_ZNK9CMyComPtrI19ISequentialInStreamEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %57 unwind label %47

57:                                               ; preds = %55
  %58 = icmp ne ptr %56, null
  br i1 %58, label %59, label %90

59:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  invoke void @_ZN9CMyComPtrI14IStreamGetSizeEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %60 unwind label %79

60:                                               ; preds = %59
  %61 = invoke noundef ptr @_ZN9CMyComPtrI14IStreamGetSizeEadEv(ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %62 unwind label %83

62:                                               ; preds = %60
  %63 = call noundef i32 @_ZNK9CMyComPtrI19ISequentialInStreamE14QueryInterfaceI14IStreamGetSizeEEiRK4GUIDPPT_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(16) @IID_IStreamGetSize, ptr noundef %61) #3
  %64 = invoke noundef ptr @_ZNK9CMyComPtrI14IStreamGetSizeEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %65 unwind label %83

65:                                               ; preds = %62
  %66 = icmp ne ptr %64, null
  br i1 %66, label %67, label %88

67:                                               ; preds = %65
  %68 = invoke noundef ptr @_ZNK9CMyComPtrI14IStreamGetSizeEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %69 unwind label %83

69:                                               ; preds = %67
  %70 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 7
  %71 = load ptr, ptr %68, align 8, !tbaa !30
  %72 = getelementptr inbounds ptr, ptr %71, i64 5
  %73 = load ptr, ptr %72, align 8
  %74 = invoke noundef i32 %73(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef %70)
          to label %75 unwind label %83

75:                                               ; preds = %69
  %76 = icmp eq i32 %74, 0
  br i1 %76, label %77, label %87

77:                                               ; preds = %75
  %78 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 6
  store i8 1, ptr %78, align 4, !tbaa !24
  br label %87

79:                                               ; preds = %59
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %6, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %7, align 4
  br label %89

83:                                               ; preds = %69, %67, %62, %60
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %6, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %7, align 4
  call void @_ZN9CMyComPtrI14IStreamGetSizeED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  br label %89

87:                                               ; preds = %77, %75
  br label %88

88:                                               ; preds = %87, %65
  store i32 0, ptr %2, align 4
  store i32 1, ptr %8, align 4
  call void @_ZN9CMyComPtrI14IStreamGetSizeED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %117

89:                                               ; preds = %83, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %120

90:                                               ; preds = %57
  %91 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 10
  %92 = load i32, ptr %91, align 4, !tbaa !26
  %93 = add i32 %92, 1
  store i32 %93, ptr %91, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %94 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %11, i32 0, i32 11
  %95 = invoke noundef ptr @_ZNK9CMyComPtrI22IArchiveUpdateCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %94)
          to label %96 unwind label %106

96:                                               ; preds = %90
  %97 = load ptr, ptr %95, align 8, !tbaa !30
  %98 = getelementptr inbounds ptr, ptr %97, i64 10
  %99 = load ptr, ptr %98, align 8
  %100 = invoke noundef i32 %99(ptr noundef nonnull align 8 dereferenceable(8) %95, i32 noundef 0)
          to label %101 unwind label %106

101:                                              ; preds = %96
  store i32 %100, ptr %10, align 4, !tbaa !29
  %102 = load i32, ptr %10, align 4, !tbaa !29
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %110

104:                                              ; preds = %101
  %105 = load i32, ptr %10, align 4, !tbaa !29
  store i32 %105, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %111

106:                                              ; preds = %96, %90
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %6, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %120

110:                                              ; preds = %101
  store i32 0, ptr %8, align 4
  br label %111

111:                                              ; preds = %110, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %112 = load i32, ptr %8, align 4
  switch i32 %112, label %117 [
    i32 0, label %113
  ]

113:                                              ; preds = %111
  %114 = load i32, ptr %5, align 4, !tbaa !29
  %115 = icmp eq i32 %114, 0
  invoke void @_ZN8NArchive3N7z15CFolderInStream11AddFileInfoEb(ptr noundef nonnull align 8 dereferenceable(128) %11, i1 noundef zeroext %115)
          to label %116 unwind label %47

116:                                              ; preds = %113
  store i32 0, ptr %8, align 4
  br label %117

117:                                              ; preds = %116, %111, %88, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @_ZN9CMyComPtrI19ISequentialInStreamED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %118 = load i32, ptr %8, align 4
  switch i32 %118, label %129 [
    i32 0, label %119
    i32 1, label %122
  ]

119:                                              ; preds = %117
  br label %16, !llvm.loop !32

120:                                              ; preds = %106, %89, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @_ZN9CMyComPtrI19ISequentialInStreamED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  br label %124

121:                                              ; preds = %16
  store i32 0, ptr %2, align 4
  br label %122

122:                                              ; preds = %121, %117
  %123 = load i32, ptr %2, align 4
  ret i32 %123

124:                                              ; preds = %120
  %125 = load ptr, ptr %6, align 8
  %126 = load i32, ptr %7, align 4
  %127 = insertvalue { ptr, i32 } poison, ptr %125, 0
  %128 = insertvalue { ptr, i32 } %127, i32 %126, 1
  resume { ptr, i32 } %128

129:                                              ; preds = %117
  unreachable
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8NArchive3N7z15CFolderInStream11AddFileInfoEb(ptr noundef nonnull align 8 dereferenceable(128), i1 noundef zeroext) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9CMyComPtrI19ISequentialInStreamED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #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 = { 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, !17, i64 32}
!10 = !{!"_ZTSN8NArchive3N7z15CFolderInStreamE", !11, i64 0, !13, i64 8, !14, i64 16, !16, i64 24, !17, i64 32, !15, i64 40, !18, i64 44, !17, i64 48, !6, i64 56, !15, i64 64, !15, i64 68, !19, i64 72, !20, i64 80, !21, i64 96, !22, i64 112}
!11 = !{!"_ZTS19ISequentialInStream", !12, i64 0}
!12 = !{!"_ZTS8IUnknown"}
!13 = !{!"_ZTS25ICompressGetSubStreamSize", !12, i64 0}
!14 = !{!"_ZTS13CMyUnknownImp", !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !6, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTS9CMyComPtrI22IArchiveUpdateCallbackE", !6, i64 0}
!20 = !{!"_ZTS13CRecordVectorIbE", !6, i64 0, !15, i64 8, !15, i64 12}
!21 = !{!"_ZTS13CRecordVectorIjE", !6, i64 0, !15, i64 8, !15, i64 12}
!22 = !{!"_ZTS13CRecordVectorIyE", !6, i64 0, !15, i64 8, !15, i64 12}
!23 = !{!10, !15, i64 40}
!24 = !{!10, !18, i64 44}
!25 = !{!10, !17, i64 48}
!26 = !{!10, !15, i64 68}
!27 = !{!10, !15, i64 64}
!28 = !{!10, !6, i64 56}
!29 = !{!15, !15, i64 0}
!30 = !{!31, !31, i64 0}
!31 = !{!"vtable pointer", !8, i64 0}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN8NArchive3N7z15CFolderInStream10OpenStreamEv(ptr noundef nonnull align 8 dereferenceable(128) %0) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %class.CMyComPtr, align 8
  %3 = alloca %class.CMyComPtr.3, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  store i64 0, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 -1, ptr %5, align 8, !tbaa !22
  %6 = getelementptr inbounds i8, ptr %0, i64 44
  store i8 0, ptr %6, align 4, !tbaa !23
  %7 = getelementptr inbounds i8, ptr %0, i64 48
  store i64 0, ptr %7, align 8, !tbaa !24
  %8 = getelementptr inbounds i8, ptr %0, i64 68
  %9 = getelementptr inbounds i8, ptr %0, i64 64
  %10 = load i32, ptr %8, align 4, !tbaa !25
  %11 = load i32, ptr %9, align 8, !tbaa !26
  %12 = icmp ult i32 %10, %11
  br i1 %12, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %1
  %13 = getelementptr inbounds i8, ptr %0, i64 72
  %14 = getelementptr inbounds i8, ptr %0, i64 56
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  br label %16

16:                                               ; preds = %.lr.ph, %64
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN9CMyComPtrI19ISequentialInStreamEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %17 = call noundef ptr @_ZNK9CMyComPtrI22IArchiveUpdateCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13)
  %18 = load ptr, ptr %14, align 8, !tbaa !27
  %19 = load i32, ptr %8, align 4, !tbaa !25
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds i32, ptr %18, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !28
  %23 = call noundef ptr @_ZN9CMyComPtrI19ISequentialInStreamEadEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %24 = load ptr, ptr %17, align 8, !tbaa !29
  %25 = getelementptr inbounds i8, ptr %24, i64 72
  %26 = load ptr, ptr %25, align 8
  %27 = invoke noundef i32 %26(ptr noundef nonnull align 8 dereferenceable(8) %17, i32 noundef %22, ptr noundef %23)
          to label %28 unwind label %29

28:                                               ; preds = %16
  %or.cond = icmp ugt i32 %27, 1
  br i1 %or.cond, label %.thread, label %31

29:                                               ; preds = %62, %31, %16
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %68

31:                                               ; preds = %28
  %32 = invoke noundef ptr @_ZN9CMyComPtrI19ISequentialInStreamEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %33 unwind label %29

33:                                               ; preds = %31
  %34 = call noundef ptr @_ZNK9CMyComPtrI19ISequentialInStreamEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %.not = icmp eq ptr %34, null
  br i1 %.not, label %51, label %35

35:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  call void @_ZN9CMyComPtrI14IStreamGetSizeEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3)
  %36 = call noundef ptr @_ZN9CMyComPtrI14IStreamGetSizeEadEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
  %37 = call noundef i32 @_ZNK9CMyComPtrI19ISequentialInStreamE14QueryInterfaceI14IStreamGetSizeEEiRK4GUIDPPT_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(16) @IID_IStreamGetSize, ptr noundef %36) #3
  %38 = call noundef ptr @_ZNK9CMyComPtrI14IStreamGetSizeEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %3)
  %.not19 = icmp eq ptr %38, null
  br i1 %.not19, label %50, label %39

39:                                               ; preds = %35
  %40 = call noundef ptr @_ZNK9CMyComPtrI14IStreamGetSizeEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
  %41 = load ptr, ptr %40, align 8, !tbaa !29
  %42 = getelementptr inbounds i8, ptr %41, i64 40
  %43 = load ptr, ptr %42, align 8
  %44 = invoke noundef i32 %43(ptr noundef nonnull align 8 dereferenceable(8) %40, ptr noundef nonnull %7)
          to label %45 unwind label %48

45:                                               ; preds = %39
  %46 = icmp eq i32 %44, 0
  br i1 %46, label %47, label %50

47:                                               ; preds = %45
  store i8 1, ptr %6, align 4, !tbaa !23
  br label %50

48:                                               ; preds = %39
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN9CMyComPtrI14IStreamGetSizeED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br label %68

50:                                               ; preds = %45, %47, %35
  call void @_ZN9CMyComPtrI14IStreamGetSizeED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br label %.thread

51:                                               ; preds = %33
  %52 = load i32, ptr %8, align 4, !tbaa !25
  %53 = add i32 %52, 1
  store i32 %53, ptr %8, align 4, !tbaa !25
  %54 = call noundef ptr @_ZNK9CMyComPtrI22IArchiveUpdateCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13)
  %55 = load ptr, ptr %54, align 8, !tbaa !29
  %56 = getelementptr inbounds i8, ptr %55, i64 80
  %57 = load ptr, ptr %56, align 8
  %58 = invoke noundef i32 %57(ptr noundef nonnull align 8 dereferenceable(8) %54, i32 noundef 0)
          to label %59 unwind label %60

59:                                               ; preds = %51
  %.not18 = icmp eq i32 %58, 0
  br i1 %.not18, label %62, label %.thread

60:                                               ; preds = %51
  %61 = landingpad { ptr, i32 }
          cleanup
  br label %68

62:                                               ; preds = %59
  %63 = icmp eq i32 %27, 0
  invoke void @_ZN8NArchive3N7z15CFolderInStream11AddFileInfoEb(ptr noundef nonnull align 8 dereferenceable(128) %0, i1 noundef zeroext %63)
          to label %64 unwind label %29

.thread:                                          ; preds = %59, %28, %50
  %.2.ph = phi i32 [ 0, %50 ], [ %58, %59 ], [ %27, %28 ]
  call void @_ZN9CMyComPtrI19ISequentialInStreamED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  br label %.loopexit

64:                                               ; preds = %62
  call void @_ZN9CMyComPtrI19ISequentialInStreamED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  %65 = load i32, ptr %8, align 4, !tbaa !25
  %66 = load i32, ptr %9, align 8, !tbaa !26
  %67 = icmp ult i32 %65, %66
  br i1 %67, label %16, label %.loopexit

68:                                               ; preds = %60, %48, %29
  %.pn = phi { ptr, i32 } [ %49, %48 ], [ %30, %29 ], [ %61, %60 ]
  call void @_ZN9CMyComPtrI19ISequentialInStreamED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  resume { ptr, i32 } %.pn

.loopexit:                                        ; preds = %64, %1, %.thread
  %.3 = phi i32 [ %.2.ph, %.thread ], [ 0, %1 ], [ 0, %64 ]
  ret i32 %.3
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; 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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8NArchive3N7z15CFolderInStream11AddFileInfoEb(ptr noundef nonnull align 8 dereferenceable(128), i1 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9CMyComPtrI19ISequentialInStreamED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #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 = { mustprogress 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 = { 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, !16, i64 32}
!6 = !{!"_ZTSN8NArchive3N7z15CFolderInStreamE", !7, i64 0, !9, i64 8, !10, i64 16, !14, i64 24, !16, i64 32, !11, i64 40, !17, i64 44, !16, i64 48, !15, i64 56, !11, i64 64, !11, i64 68, !18, i64 72, !19, i64 80, !20, i64 96, !21, i64 112}
!7 = !{!"_ZTS19ISequentialInStream", !8, i64 0}
!8 = !{!"_ZTS8IUnknown"}
!9 = !{!"_ZTS25ICompressGetSubStreamSize", !8, i64 0}
!10 = !{!"_ZTS13CMyUnknownImp", !11, i64 0}
!11 = !{!"int", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !15, i64 0}
!15 = !{!"any pointer", !12, i64 0}
!16 = !{!"long long", !12, i64 0}
!17 = !{!"bool", !12, i64 0}
!18 = !{!"_ZTS9CMyComPtrI22IArchiveUpdateCallbackE", !15, i64 0}
!19 = !{!"_ZTS13CRecordVectorIbE", !15, i64 0, !11, i64 8, !11, i64 12}
!20 = !{!"_ZTS13CRecordVectorIjE", !15, i64 0, !11, i64 8, !11, i64 12}
!21 = !{!"_ZTS13CRecordVectorIyE", !15, i64 0, !11, i64 8, !11, i64 12}
!22 = !{!6, !11, i64 40}
!23 = !{!6, !17, i64 44}
!24 = !{!6, !16, i64 48}
!25 = !{!6, !11, i64 68}
!26 = !{!6, !11, i64 64}
!27 = !{!6, !15, i64 56}
!28 = !{!11, !11, i64 0}
!29 = !{!30, !30, i64 0}
!30 = !{!"vtable pointer", !13, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass