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

%"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 = type { ptr }
%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 }

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK9CMyComPtrI22IArchiveUpdateCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 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: 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 uwtable
define dso_local noundef i32 @_ZN8NArchive3N7z15CFolderInStream4ReadEPvjPj(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3) unnamed_addr #0 align 2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  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
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %21

19:                                               ; preds = %4
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %19, %4
  br label %22

22:                                               ; preds = %114, %21
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %115

25:                                               ; preds = %22
  %26 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 3
  %27 = call noundef ptr @_ZNK9CMyComPtrI19ISequentialInStreamEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %26)
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %98

29:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %30 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %30, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 1048576, ptr %11, align 4, !tbaa !9
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = icmp ugt i32 %31, 1048576
  br i1 %32, label %33, label %34

33:                                               ; preds = %29
  store i32 1048576, ptr %10, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %33, %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %35 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 3
  %36 = call noundef ptr @_ZNK9CMyComPtrI19ISequentialInStreamEptEv(ptr noundef nonnull align 8 dereferenceable(8) %35)
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = load i32, ptr %10, align 4, !tbaa !9
  %39 = load ptr, ptr %36, align 8, !tbaa !11
  %40 = getelementptr inbounds ptr, ptr %39, i64 5
  %41 = load ptr, ptr %40, align 8
  %42 = call noundef i32 %41(ptr noundef nonnull align 8 dereferenceable(8) %36, ptr noundef %37, i32 noundef %38, ptr noundef %10)
  store i32 %42, ptr %12, align 4, !tbaa !9
  %43 = load i32, ptr %12, align 4, !tbaa !9
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %47

45:                                               ; preds = %34
  %46 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %46, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %48

47:                                               ; preds = %34
  store i32 0, ptr %13, align 4
  br label %48

48:                                               ; preds = %47, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %49 = load i32, ptr %13, align 4
  switch i32 %49, label %95 [
    i32 0, label %50
  ]

50:                                               ; preds = %48
  %51 = load i32, ptr %10, align 4, !tbaa !9
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %72

53:                                               ; preds = %50
  %54 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 5
  %55 = load i32, ptr %54, align 8, !tbaa !13
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = load i32, ptr %10, align 4, !tbaa !9
  %58 = zext i32 %57 to i64
  %59 = call i32 @CrcUpdate(i32 noundef %55, ptr noundef %56, i64 noundef %58)
  %60 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 5
  store i32 %59, ptr %60, align 8, !tbaa !13
  %61 = load i32, ptr %10, align 4, !tbaa !9
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 4
  %64 = load i64, ptr %63, align 8, !tbaa !26
  %65 = add i64 %64, %62
  store i64 %65, ptr %63, align 8, !tbaa !26
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %71

68:                                               ; preds = %53
  %69 = load i32, ptr %10, align 4, !tbaa !9
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %69, ptr %70, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %68, %53
  store i32 0, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %95

72:                                               ; preds = %50
  %73 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 3
  call void @_ZN9CMyComPtrI19ISequentialInStreamE7ReleaseEv(ptr noundef nonnull align 8 dereferenceable(8) %73)
  %74 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 10
  %75 = load i32, ptr %74, align 4, !tbaa !27
  %76 = add i32 %75, 1
  store i32 %76, ptr %74, align 4, !tbaa !27
  call void @_ZN8NArchive3N7z15CFolderInStream11AddFileInfoEb(ptr noundef nonnull align 8 dereferenceable(128) %16, i1 noundef zeroext true)
  %77 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 4
  store i64 0, ptr %77, align 8, !tbaa !26
  %78 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 5
  store i32 -1, ptr %78, align 8, !tbaa !13
  %79 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 6
  store i8 0, ptr %79, align 4, !tbaa !28
  %80 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 7
  store i64 0, ptr %80, align 8, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %81 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 11
  %82 = call noundef ptr @_ZNK9CMyComPtrI22IArchiveUpdateCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %81)
  %83 = load ptr, ptr %82, align 8, !tbaa !11
  %84 = getelementptr inbounds ptr, ptr %83, i64 10
  %85 = load ptr, ptr %84, align 8
  %86 = call noundef i32 %85(ptr noundef nonnull align 8 dereferenceable(8) %82, i32 noundef 0)
  store i32 %86, ptr %14, align 4, !tbaa !9
  %87 = load i32, ptr %14, align 4, !tbaa !9
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %91

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

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

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

94:                                               ; preds = %92
  store i32 0, ptr %13, align 4
  br label %95

95:                                               ; preds = %94, %92, %71, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %96 = load i32, ptr %13, align 4
  switch i32 %96, label %118 [
    i32 0, label %97
    i32 1, label %116
  ]

97:                                               ; preds = %95
  br label %98

98:                                               ; preds = %97, %25
  %99 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 10
  %100 = load i32, ptr %99, align 4, !tbaa !27
  %101 = getelementptr inbounds %"class.NArchive::N7z::CFolderInStream", ptr %16, i32 0, i32 9
  %102 = load i32, ptr %101, align 8, !tbaa !30
  %103 = icmp uge i32 %100, %102
  br i1 %103, label %104, label %105

104:                                              ; preds = %98
  br label %115

105:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %106 = call noundef i32 @_ZN8NArchive3N7z15CFolderInStream10OpenStreamEv(ptr noundef nonnull align 8 dereferenceable(128) %16)
  store i32 %106, ptr %15, align 4, !tbaa !9
  %107 = load i32, ptr %15, align 4, !tbaa !9
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %111

109:                                              ; preds = %105
  %110 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %110, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %112

111:                                              ; preds = %105
  store i32 0, ptr %13, align 4
  br label %112

112:                                              ; preds = %111, %109
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %113 = load i32, ptr %13, align 4
  switch i32 %113, label %118 [
    i32 0, label %114
    i32 1, label %116
  ]

114:                                              ; preds = %112
  br label %22, !llvm.loop !31

115:                                              ; preds = %104, %22
  store i32 0, ptr %5, align 4
  br label %116

116:                                              ; preds = %115, %112, %95
  %117 = load i32, ptr %5, align 4
  ret i32 %117

118:                                              ; preds = %112, %95
  unreachable
}

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

declare i32 @CrcUpdate(i32 noundef, ptr noundef, i64 noundef) #3

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 40}
!14 = !{!"_ZTSN8NArchive3N7z15CFolderInStreamE", !15, i64 0, !17, i64 8, !18, i64 16, !19, i64 24, !20, i64 32, !10, i64 40, !21, i64 44, !20, i64 48, !6, i64 56, !10, i64 64, !10, i64 68, !22, i64 72, !23, i64 80, !24, i64 96, !25, i64 112}
!15 = !{!"_ZTS19ISequentialInStream", !16, i64 0}
!16 = !{!"_ZTS8IUnknown"}
!17 = !{!"_ZTS25ICompressGetSubStreamSize", !16, i64 0}
!18 = !{!"_ZTS13CMyUnknownImp", !10, i64 0}
!19 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !6, i64 0}
!20 = !{!"long long", !7, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"_ZTS9CMyComPtrI22IArchiveUpdateCallbackE", !6, i64 0}
!23 = !{!"_ZTS13CRecordVectorIbE", !6, i64 0, !10, i64 8, !10, i64 12}
!24 = !{!"_ZTS13CRecordVectorIjE", !6, i64 0, !10, i64 8, !10, i64 12}
!25 = !{!"_ZTS13CRecordVectorIyE", !6, i64 0, !10, i64 8, !10, i64 12}
!26 = !{!14, !20, i64 32}
!27 = !{!14, !10, i64 68}
!28 = !{!14, !21, i64 44}
!29 = !{!14, !20, i64 48}
!30 = !{!14, !10, i64 64}
!31 = distinct !{!31, !32}
!32 = !{!"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"

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

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

; 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 noundef ptr @_ZNK9CMyComPtrI22IArchiveUpdateCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 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 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 uwtable
define dso_local noundef i32 @_ZN8NArchive3N7z15CFolderInStream4ReadEPvjPj(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef %1, i32 noundef %2, ptr noundef writeonly %3) unnamed_addr #0 align 2 {
  %5 = alloca i32, align 4
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %7, label %6

6:                                                ; preds = %4
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %6, %4
  %.not31 = icmp eq i32 %2, 0
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %spec.select = tail call i32 @llvm.umin.i32(i32 %2, i32 1048576)
  %9 = getelementptr inbounds i8, ptr %0, i64 68
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = getelementptr inbounds i8, ptr %0, i64 44
  %13 = getelementptr inbounds i8, ptr %0, i64 48
  %14 = getelementptr inbounds i8, ptr %0, i64 72
  %15 = getelementptr inbounds i8, ptr %0, i64 64
  br i1 %.not31, label %.loopexit.split, label %.split

.split:                                           ; preds = %7, %47
  %16 = call noundef ptr @_ZNK9CMyComPtrI19ISequentialInStreamEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %8)
  %.not32 = icmp eq ptr %16, null
  br i1 %.not32, label %44, label %17

17:                                               ; preds = %.split
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 %spec.select, ptr %5, align 4, !tbaa !5
  %18 = call noundef ptr @_ZNK9CMyComPtrI19ISequentialInStreamEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8)
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %20 = load ptr, ptr %18, align 8, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %20, i64 40
  %22 = load ptr, ptr %21, align 8
  %23 = call noundef i32 %22(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef %1, i32 noundef %19, ptr noundef nonnull %5)
  %.not33 = icmp eq i32 %23, 0
  br i1 %.not33, label %24, label %.thread

24:                                               ; preds = %17
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %.not34 = icmp eq i32 %25, 0
  br i1 %.not34, label %35, label %26

26:                                               ; preds = %24
  %27 = load i32, ptr %11, align 8, !tbaa !11
  %28 = zext i32 %25 to i64
  %29 = call i32 @CrcUpdate(i32 noundef %27, ptr noundef %1, i64 noundef %28)
  store i32 %29, ptr %11, align 8, !tbaa !11
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = zext i32 %30 to i64
  %32 = load i64, ptr %10, align 8, !tbaa !25
  %33 = add i64 %32, %31
  store i64 %33, ptr %10, align 8, !tbaa !25
  br i1 %.not, label %.thread, label %34

34:                                               ; preds = %26
  store i32 %30, ptr %3, align 4, !tbaa !5
  br label %.thread

35:                                               ; preds = %24
  call void @_ZN9CMyComPtrI19ISequentialInStreamE7ReleaseEv(ptr noundef nonnull align 8 dereferenceable(8) %8)
  %36 = load i32, ptr %9, align 4, !tbaa !26
  %37 = add i32 %36, 1
  store i32 %37, ptr %9, align 4, !tbaa !26
  call void @_ZN8NArchive3N7z15CFolderInStream11AddFileInfoEb(ptr noundef nonnull align 8 dereferenceable(128) %0, i1 noundef zeroext true)
  store i64 0, ptr %10, align 8, !tbaa !25
  store i32 -1, ptr %11, align 8, !tbaa !11
  store i8 0, ptr %12, align 4, !tbaa !27
  store i64 0, ptr %13, align 8, !tbaa !28
  %38 = call noundef ptr @_ZNK9CMyComPtrI22IArchiveUpdateCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  %40 = getelementptr inbounds i8, ptr %39, i64 80
  %41 = load ptr, ptr %40, align 8
  %42 = call noundef i32 %41(ptr noundef nonnull align 8 dereferenceable(8) %38, i32 noundef 0)
  %.not35 = icmp eq i32 %42, 0
  br i1 %.not35, label %43, label %.thread

.thread:                                          ; preds = %35, %17, %34, %26
  %.3.ph = phi i32 [ 0, %26 ], [ 0, %34 ], [ %42, %35 ], [ %23, %17 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %.loopexit.split

43:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %44

44:                                               ; preds = %43, %.split
  %45 = load i32, ptr %9, align 4, !tbaa !26
  %46 = load i32, ptr %15, align 8, !tbaa !29
  %.not36 = icmp ult i32 %45, %46
  br i1 %.not36, label %47, label %.loopexit.split

47:                                               ; preds = %44
  %48 = call noundef i32 @_ZN8NArchive3N7z15CFolderInStream10OpenStreamEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  %.not37.not = icmp eq i32 %48, 0
  br i1 %.not37.not, label %.split, label %.loopexit.split

.loopexit.split:                                  ; preds = %44, %47, %7, %.thread
  %.6 = phi i32 [ %.3.ph, %.thread ], [ 0, %7 ], [ 0, %44 ], [ %48, %47 ]
  ret i32 %.6
}

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

declare i32 @CrcUpdate(i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !6, i64 40}
!12 = !{!"_ZTSN8NArchive3N7z15CFolderInStreamE", !13, i64 0, !15, i64 8, !16, i64 16, !17, i64 24, !19, i64 32, !6, i64 40, !20, i64 44, !19, i64 48, !18, i64 56, !6, i64 64, !6, i64 68, !21, i64 72, !22, i64 80, !23, i64 96, !24, i64 112}
!13 = !{!"_ZTS19ISequentialInStream", !14, i64 0}
!14 = !{!"_ZTS8IUnknown"}
!15 = !{!"_ZTS25ICompressGetSubStreamSize", !14, i64 0}
!16 = !{!"_ZTS13CMyUnknownImp", !6, i64 0}
!17 = !{!"_ZTS9CMyComPtrI19ISequentialInStreamE", !18, i64 0}
!18 = !{!"any pointer", !7, i64 0}
!19 = !{!"long long", !7, i64 0}
!20 = !{!"bool", !7, i64 0}
!21 = !{!"_ZTS9CMyComPtrI22IArchiveUpdateCallbackE", !18, i64 0}
!22 = !{!"_ZTS13CRecordVectorIbE", !18, i64 0, !6, i64 8, !6, i64 12}
!23 = !{!"_ZTS13CRecordVectorIjE", !18, i64 0, !6, i64 8, !6, i64 12}
!24 = !{!"_ZTS13CRecordVectorIyE", !18, i64 0, !6, i64 8, !6, i64 12}
!25 = !{!12, !19, i64 32}
!26 = !{!12, !6, i64 68}
!27 = !{!12, !20, i64 44}
!28 = !{!12, !19, i64 48}
!29 = !{!12, !6, i64 64}


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