; LLVM IR from mncoppola/rpef :: utilities_src/squashfs4.2/lzma465/CPP/7zip/Archive/7z (7zFolderOutStream)

; 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::CFolderOutStream" = type { %struct.ISequentialOutStream, %class.CMyUnknownImp, ptr, %class.CMyComPtr, ptr, ptr, i32, i32, i32, %class.CMyComPtr.0, i8, i8, i8, i64 }
%struct.ISequentialOutStream = type { %struct.IUnknown }
%struct.IUnknown = type { ptr }
%class.CMyUnknownImp = type { i32 }
%class.CMyComPtr = type { ptr }
%class.CMyComPtr.0 = type { ptr }
%"struct.NArchive::N7z::CArchiveDatabase" = type { %class.CRecordVector.1, %class.CRecordVector, %class.CRecordVector.2, %class.CObjectVector, %class.CRecordVector.2, %class.CObjectVector.4, %"struct.NArchive::N7z::CUInt64DefVector", %"struct.NArchive::N7z::CUInt64DefVector", %"struct.NArchive::N7z::CUInt64DefVector", %"struct.NArchive::N7z::CUInt64DefVector", %class.CRecordVector }
%class.CRecordVector.1 = type { %class.CBaseRecordVector }
%class.CBaseRecordVector = type { ptr, i32, i32, ptr, i64 }
%class.CObjectVector = type { %class.CRecordVector.3 }
%class.CRecordVector.3 = type { %class.CBaseRecordVector }
%class.CRecordVector.2 = type { %class.CBaseRecordVector }
%class.CObjectVector.4 = type { %class.CRecordVector.3 }
%"struct.NArchive::N7z::CUInt64DefVector" = type { %class.CRecordVector.1, %class.CRecordVector }
%class.CRecordVector = type { %class.CBaseRecordVector }
%"struct.NArchive::N7z::CFileItem" = type <{ i64, i32, i32, %class.CStringBase, i8, i8, i8, i8, [4 x i8] }>
%class.CStringBase = type { ptr, i32, i32 }

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN8NArchive3N7z16CFolderOutStream8OpenFileEv(ptr noundef nonnull align 8 dereferenceable(88)) #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 @_ZNK9CMyComPtrI23IArchiveExtractCallbackEptEv(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 noundef nonnull align 8 dereferenceable(36) ptr @_ZNK13CObjectVectorIN8NArchive3N7z9CFileItemEEixEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN8NArchive3N7z16CFolderOutStream5WriteEPKvjPj(ptr noundef nonnull align 8 dereferenceable(88) %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 ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i8, align 1
  %19 = alloca i32, align 4
  %20 = 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
  %21 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %163, %4
  %23 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 8
  %24 = load i32, ptr %23, align 8, !tbaa !11
  %25 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 5
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  %27 = call noundef i32 @_ZNK17CBaseRecordVector4SizeEv(ptr noundef nonnull align 8 dereferenceable(32) %26)
  %28 = icmp slt i32 %24, %27
  br i1 %28, label %29, label %164

29:                                               ; preds = %22
  %30 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 11
  %31 = load i8, ptr %30, align 1, !tbaa !21, !range !22, !noundef !23
  %32 = trunc i8 %31 to i1
  br i1 %32, label %33, label %151

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %34 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 6
  %35 = load i32, ptr %34, align 8, !tbaa !24
  %36 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 8
  %37 = load i32, ptr %36, align 8, !tbaa !11
  %38 = add i32 %35, %37
  store i32 %38, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %39 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 4
  %40 = load ptr, ptr %39, align 8, !tbaa !25
  %41 = getelementptr inbounds %"struct.NArchive::N7z::CArchiveDatabase", ptr %40, i32 0, i32 5
  %42 = load i32, ptr %11, align 4, !tbaa !9
  %43 = call noundef nonnull align 8 dereferenceable(36) ptr @_ZNK13CObjectVectorIN8NArchive3N7z9CFileItemEEixEi(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef %42)
  store ptr %43, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.NArchive::N7z::CFileItem", ptr %44, i32 0, i32 0
  %46 = load i64, ptr %45, align 8, !tbaa !26
  store i64 %46, ptr %13, align 8, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %47 = load i64, ptr %13, align 8, !tbaa !29
  %48 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 13
  %49 = load i64, ptr %48, align 8, !tbaa !30
  %50 = sub i64 %47, %49
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = load i32, ptr %10, align 4, !tbaa !9
  %53 = sub i32 %51, %52
  %54 = zext i32 %53 to i64
  %55 = call noundef i64 @_Z5MyMinIyET_S0_S0_(i64 noundef %50, i64 noundef %54)
  %56 = trunc i64 %55 to i32
  store i32 %56, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %57 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 3
  %58 = call noundef ptr @_ZNK9CMyComPtrI20ISequentialOutStreamEptEv(ptr noundef nonnull align 8 dereferenceable(8) %57)
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = load i32, ptr %10, align 4, !tbaa !9
  %61 = zext i32 %60 to i64
  %62 = getelementptr inbounds i8, ptr %59, i64 %61
  %63 = load i32, ptr %14, align 4, !tbaa !9
  %64 = load ptr, ptr %58, align 8, !tbaa !31
  %65 = getelementptr inbounds ptr, ptr %64, i64 5
  %66 = load ptr, ptr %65, align 8
  %67 = call noundef i32 %66(ptr noundef nonnull align 8 dereferenceable(8) %58, ptr noundef %62, i32 noundef %63, ptr noundef %15)
  store i32 %67, ptr %16, align 4, !tbaa !9
  %68 = load i32, ptr %16, align 4, !tbaa !9
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %72

70:                                               ; preds = %33
  %71 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %71, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %73

72:                                               ; preds = %33
  store i32 0, ptr %17, align 4
  br label %73

73:                                               ; preds = %72, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  %74 = load i32, ptr %17, align 4
  switch i32 %74, label %148 [
    i32 0, label %75
  ]

75:                                               ; preds = %73
  %76 = load i32, ptr %15, align 4, !tbaa !9
  %77 = zext i32 %76 to i64
  %78 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 13
  %79 = load i64, ptr %78, align 8, !tbaa !30
  %80 = add i64 %79, %77
  store i64 %80, ptr %78, align 8, !tbaa !30
  %81 = load i32, ptr %15, align 4, !tbaa !9
  %82 = load i32, ptr %10, align 4, !tbaa !9
  %83 = add i32 %82, %81
  store i32 %83, ptr %10, align 4, !tbaa !9
  %84 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 13
  %85 = load i64, ptr %84, align 8, !tbaa !30
  %86 = load i64, ptr %13, align 8, !tbaa !29
  %87 = icmp eq i64 %85, %86
  br i1 %87, label %88, label %135

88:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #4
  %89 = load ptr, ptr %12, align 8, !tbaa !5
  %90 = getelementptr inbounds %"struct.NArchive::N7z::CFileItem", ptr %89, i32 0, i32 6
  %91 = load i8, ptr %90, align 2, !tbaa !33, !range !22, !noundef !23
  %92 = trunc i8 %91 to i1
  br i1 %92, label %93, label %106

93:                                               ; preds = %88
  %94 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 12
  %95 = load i8, ptr %94, align 2, !tbaa !34, !range !22, !noundef !23
  %96 = trunc i8 %95 to i1
  br i1 %96, label %97, label %106

97:                                               ; preds = %93
  %98 = load ptr, ptr %12, align 8, !tbaa !5
  %99 = getelementptr inbounds %"struct.NArchive::N7z::CFileItem", ptr %98, i32 0, i32 2
  %100 = load i32, ptr %99, align 4, !tbaa !35
  %101 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 2
  %102 = load ptr, ptr %101, align 8, !tbaa !36
  %103 = call noundef i32 @_ZNK17COutStreamWithCRC6GetCRCEv(ptr noundef nonnull align 8 dereferenceable(37) %102)
  %104 = icmp eq i32 %100, %103
  %105 = zext i1 %104 to i8
  store i8 %105, ptr %18, align 1, !tbaa !37
  br label %107

106:                                              ; preds = %93, %88
  store i8 1, ptr %18, align 1, !tbaa !37
  br label %107

107:                                              ; preds = %106, %97
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %108 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 9
  %109 = call noundef ptr @_ZNK9CMyComPtrI23IArchiveExtractCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %108)
  %110 = load i8, ptr %18, align 1, !tbaa !37, !range !22, !noundef !23
  %111 = trunc i8 %110 to i1
  %112 = zext i1 %111 to i64
  %113 = select i1 %111, i32 0, i32 3
  %114 = load ptr, ptr %109, align 8, !tbaa !31
  %115 = getelementptr inbounds ptr, ptr %114, i64 9
  %116 = load ptr, ptr %115, align 8
  %117 = call noundef i32 %116(ptr noundef nonnull align 8 dereferenceable(8) %109, i32 noundef %113)
  store i32 %117, ptr %19, align 4, !tbaa !9
  %118 = load i32, ptr %19, align 4, !tbaa !9
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %120, label %122

120:                                              ; preds = %107
  %121 = load i32, ptr %19, align 4, !tbaa !9
  store i32 %121, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %123

122:                                              ; preds = %107
  store i32 0, ptr %17, align 4
  br label %123

123:                                              ; preds = %122, %120
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  %124 = load i32, ptr %17, align 4
  switch i32 %124, label %132 [
    i32 0, label %125
  ]

125:                                              ; preds = %123
  %126 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 2
  %127 = load ptr, ptr %126, align 8, !tbaa !36
  call void @_ZN17COutStreamWithCRC13ReleaseStreamEv(ptr noundef nonnull align 8 dereferenceable(37) %127)
  %128 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 11
  store i8 0, ptr %128, align 1, !tbaa !21
  %129 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 8
  %130 = load i32, ptr %129, align 8, !tbaa !11
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %129, align 8, !tbaa !11
  store i32 0, ptr %17, align 4
  br label %132

132:                                              ; preds = %125, %123
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #4
  %133 = load i32, ptr %17, align 4
  switch i32 %133, label %148 [
    i32 0, label %134
  ]

134:                                              ; preds = %132
  br label %135

135:                                              ; preds = %134, %75
  %136 = load i32, ptr %10, align 4, !tbaa !9
  %137 = load i32, ptr %8, align 4, !tbaa !9
  %138 = icmp eq i32 %136, %137
  br i1 %138, label %139, label %147

139:                                              ; preds = %135
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = icmp ne ptr %140, null
  br i1 %141, label %142, label %145

142:                                              ; preds = %139
  %143 = load i32, ptr %10, align 4, !tbaa !9
  %144 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %143, ptr %144, align 4, !tbaa !9
  br label %145

145:                                              ; preds = %142, %139
  %146 = call noundef i32 @_ZN8NArchive3N7z16CFolderOutStream15WriteEmptyFilesEv(ptr noundef nonnull align 8 dereferenceable(88) %21)
  store i32 %146, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %148

147:                                              ; preds = %135
  store i32 0, ptr %17, align 4
  br label %148

148:                                              ; preds = %147, %145, %132, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  %149 = load i32, ptr %17, align 4
  switch i32 %149, label %171 [
    i32 0, label %150
  ]

150:                                              ; preds = %148
  br label %163

151:                                              ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %152 = call noundef i32 @_ZN8NArchive3N7z16CFolderOutStream8OpenFileEv(ptr noundef nonnull align 8 dereferenceable(88) %21)
  store i32 %152, ptr %20, align 4, !tbaa !9
  %153 = load i32, ptr %20, align 4, !tbaa !9
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %155, label %157

155:                                              ; preds = %151
  %156 = load i32, ptr %20, align 4, !tbaa !9
  store i32 %156, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %158

157:                                              ; preds = %151
  store i32 0, ptr %17, align 4
  br label %158

158:                                              ; preds = %157, %155
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  %159 = load i32, ptr %17, align 4
  switch i32 %159, label %171 [
    i32 0, label %160
  ]

160:                                              ; preds = %158
  %161 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 11
  store i8 1, ptr %161, align 1, !tbaa !21
  %162 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %21, i32 0, i32 13
  store i64 0, ptr %162, align 8, !tbaa !30
  br label %163

163:                                              ; preds = %160, %150
  br label %22, !llvm.loop !38

164:                                              ; preds = %22
  %165 = load ptr, ptr %9, align 8, !tbaa !5
  %166 = icmp ne ptr %165, null
  br i1 %166, label %167, label %170

167:                                              ; preds = %164
  %168 = load i32, ptr %8, align 4, !tbaa !9
  %169 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %168, ptr %169, align 4, !tbaa !9
  br label %170

170:                                              ; preds = %167, %164
  store i32 0, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %171

171:                                              ; preds = %170, %158, %148
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %172 = load i32, ptr %5, align 4
  ret i32 %172
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5MyMinIyET_S0_S0_(i64 noundef, i64 noundef) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK17COutStreamWithCRC6GetCRCEv(ptr noundef nonnull align 8 dereferenceable(37)) #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 = { 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 #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, !10, i64 56}
!12 = !{!"_ZTSN8NArchive3N7z16CFolderOutStreamE", !13, i64 0, !15, i64 8, !6, i64 16, !16, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !17, i64 64, !18, i64 72, !18, i64 73, !18, i64 74, !19, i64 80}
!13 = !{!"_ZTS20ISequentialOutStream", !14, i64 0}
!14 = !{!"_ZTS8IUnknown"}
!15 = !{!"_ZTS13CMyUnknownImp", !10, i64 0}
!16 = !{!"_ZTS9CMyComPtrI20ISequentialOutStreamE", !6, i64 0}
!17 = !{!"_ZTS9CMyComPtrI23IArchiveExtractCallbackE", !6, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"long long", !7, i64 0}
!20 = !{!12, !6, i64 40}
!21 = !{!12, !18, i64 73}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!12, !10, i64 48}
!25 = !{!12, !6, i64 32}
!26 = !{!27, !19, i64 0}
!27 = !{!"_ZTSN8NArchive3N7z9CFileItemE", !19, i64 0, !10, i64 8, !10, i64 12, !28, i64 16, !18, i64 32, !18, i64 33, !18, i64 34, !18, i64 35}
!28 = !{!"_ZTS11CStringBaseIwE", !6, i64 0, !10, i64 8, !10, i64 12}
!29 = !{!19, !19, i64 0}
!30 = !{!12, !19, i64 80}
!31 = !{!32, !32, i64 0}
!32 = !{!"vtable pointer", !8, i64 0}
!33 = !{!27, !18, i64 34}
!34 = !{!12, !18, i64 74}
!35 = !{!27, !10, i64 12}
!36 = !{!12, !6, i64 16}
!37 = !{!18, !18, i64 0}
!38 = distinct !{!38, !39}
!39 = !{!"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 noundef i32 @_ZN8NArchive3N7z16CFolderOutStream15WriteEmptyFilesEv(ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN8NArchive3N7z16CFolderOutStream8OpenFileEv(ptr noundef nonnull align 8 dereferenceable(88)) 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 @_ZNK9CMyComPtrI23IArchiveExtractCallbackEptEv(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 noundef nonnull align 8 dereferenceable(36) ptr @_ZNK13CObjectVectorIN8NArchive3N7z9CFileItemEEixEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN8NArchive3N7z16CFolderOutStream5WriteEPKvjPj(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1, i32 noundef %2, ptr noundef writeonly %3) unnamed_addr #0 align 2 {
  %5 = alloca i32, align 4
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  %8 = load i32, ptr %6, align 8, !tbaa !5
  %9 = load ptr, ptr %7, align 8, !tbaa !18
  %10 = tail call noundef i32 @_ZNK17CBaseRecordVector4SizeEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %11 = icmp slt i32 %8, %10
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %4
  %12 = getelementptr inbounds i8, ptr %0, i64 73
  %13 = getelementptr inbounds i8, ptr %0, i64 80
  %14 = getelementptr inbounds i8, ptr %0, i64 48
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = getelementptr inbounds i8, ptr %0, i64 74
  %18 = getelementptr inbounds i8, ptr %0, i64 64
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  br label %20

20:                                               ; preds = %.lr.ph, %86
  %.03764 = phi i32 [ 0, %.lr.ph ], [ %.239, %86 ]
  %21 = load i8, ptr %12, align 1, !tbaa !19, !range !20, !noundef !21
  %22 = trunc nuw i8 %21 to i1
  br i1 %22, label %23, label %83

23:                                               ; preds = %20
  %24 = load i32, ptr %14, align 8, !tbaa !22
  %25 = load i32, ptr %6, align 8, !tbaa !5
  %26 = add i32 %25, %24
  %27 = load ptr, ptr %15, align 8, !tbaa !23
  %28 = getelementptr inbounds i8, ptr %27, i64 160
  %29 = call noundef nonnull align 8 dereferenceable(36) ptr @_ZNK13CObjectVectorIN8NArchive3N7z9CFileItemEEixEi(ptr noundef nonnull align 8 dereferenceable(32) %28, i32 noundef %26)
  %30 = load i64, ptr %29, align 8, !tbaa !24
  %31 = load i64, ptr %13, align 8, !tbaa !27
  %32 = sub i64 %30, %31
  %33 = sub i32 %2, %.03764
  %34 = zext i32 %33 to i64
  %35 = call noundef i64 @_Z5MyMinIyET_S0_S0_(i64 noundef %32, i64 noundef %34)
  %36 = trunc i64 %35 to i32
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %37 = call noundef ptr @_ZNK9CMyComPtrI20ISequentialOutStreamEptEv(ptr noundef nonnull align 8 dereferenceable(8) %16)
  %38 = zext i32 %.03764 to i64
  %39 = getelementptr inbounds i8, ptr %1, i64 %38
  %40 = load ptr, ptr %37, align 8, !tbaa !28
  %41 = getelementptr inbounds i8, ptr %40, i64 40
  %42 = load ptr, ptr %41, align 8
  %43 = call noundef i32 %42(ptr noundef nonnull align 8 dereferenceable(8) %37, ptr noundef %39, i32 noundef %36, ptr noundef nonnull %5)
  %.not54 = icmp eq i32 %43, 0
  br i1 %.not54, label %44, label %.critedge.thread

44:                                               ; preds = %23
  %45 = load i32, ptr %5, align 4, !tbaa !30
  %46 = zext i32 %45 to i64
  %47 = load i64, ptr %13, align 8, !tbaa !27
  %48 = add i64 %47, %46
  store i64 %48, ptr %13, align 8, !tbaa !27
  %49 = add i32 %45, %.03764
  %50 = icmp eq i64 %48, %30
  br i1 %50, label %51, label %77

51:                                               ; preds = %44
  %52 = getelementptr inbounds i8, ptr %29, i64 34
  %53 = load i8, ptr %52, align 2, !tbaa !31, !range !20, !noundef !21
  %54 = trunc nuw i8 %53 to i1
  br i1 %54, label %55, label %.thread

55:                                               ; preds = %51
  %56 = load i8, ptr %17, align 2, !tbaa !32, !range !20, !noundef !21
  %57 = trunc nuw i8 %56 to i1
  br i1 %57, label %59, label %.thread

.thread:                                          ; preds = %55, %51
  %58 = call noundef ptr @_ZNK9CMyComPtrI23IArchiveExtractCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %18)
  br label %66

59:                                               ; preds = %55
  %60 = getelementptr inbounds i8, ptr %29, i64 12
  %61 = load i32, ptr %60, align 4, !tbaa !33
  %62 = load ptr, ptr %19, align 8, !tbaa !34
  %63 = call noundef i32 @_ZNK17COutStreamWithCRC6GetCRCEv(ptr noundef nonnull align 8 dereferenceable(37) %62)
  %.fr = freeze i32 %61
  %64 = icmp eq i32 %.fr, %63
  %65 = call noundef ptr @_ZNK9CMyComPtrI23IArchiveExtractCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %18)
  %spec.select = select i1 %64, i32 0, i32 3
  br label %66

66:                                               ; preds = %59, %.thread
  %67 = phi ptr [ %58, %.thread ], [ %65, %59 ]
  %68 = phi i32 [ 0, %.thread ], [ %spec.select, %59 ]
  %69 = load ptr, ptr %67, align 8, !tbaa !28
  %70 = getelementptr inbounds i8, ptr %69, i64 72
  %71 = load ptr, ptr %70, align 8
  %72 = call noundef i32 %71(ptr noundef nonnull align 8 dereferenceable(8) %67, i32 noundef %68)
  %.not55 = icmp eq i32 %72, 0
  br i1 %.not55, label %73, label %.critedge.thread

73:                                               ; preds = %66
  %74 = load ptr, ptr %19, align 8, !tbaa !34
  call void @_ZN17COutStreamWithCRC13ReleaseStreamEv(ptr noundef nonnull align 8 dereferenceable(37) %74)
  store i8 0, ptr %12, align 1, !tbaa !19
  %75 = load i32, ptr %6, align 8, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %6, align 8, !tbaa !5
  br label %77

77:                                               ; preds = %73, %44
  %78 = icmp eq i32 %49, %2
  br i1 %78, label %79, label %.critedge

79:                                               ; preds = %77
  %.not56 = icmp eq ptr %3, null
  br i1 %.not56, label %81, label %80

80:                                               ; preds = %79
  store i32 %2, ptr %3, align 4, !tbaa !30
  br label %81

81:                                               ; preds = %80, %79
  %82 = call noundef i32 @_ZN8NArchive3N7z16CFolderOutStream15WriteEmptyFilesEv(ptr noundef nonnull align 8 dereferenceable(88) %0)
  br label %.critedge.thread

.critedge.thread:                                 ; preds = %23, %66, %81
  %.4.ph = phi i32 [ %82, %81 ], [ %43, %23 ], [ %72, %66 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  br label %.loopexit

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

83:                                               ; preds = %20
  %84 = call noundef i32 @_ZN8NArchive3N7z16CFolderOutStream8OpenFileEv(ptr noundef nonnull align 8 dereferenceable(88) %0)
  %.not53 = icmp eq i32 %84, 0
  br i1 %.not53, label %85, label %.loopexit

85:                                               ; preds = %83
  store i8 1, ptr %12, align 1, !tbaa !19
  store i64 0, ptr %13, align 8, !tbaa !27
  br label %86

86:                                               ; preds = %.critedge, %85
  %.239 = phi i32 [ %49, %.critedge ], [ %.03764, %85 ]
  %87 = load i32, ptr %6, align 8, !tbaa !5
  %88 = load ptr, ptr %7, align 8, !tbaa !18
  %89 = call noundef i32 @_ZNK17CBaseRecordVector4SizeEv(ptr noundef nonnull align 8 dereferenceable(32) %88)
  %90 = icmp slt i32 %87, %89
  br i1 %90, label %20, label %._crit_edge, !llvm.loop !35

._crit_edge:                                      ; preds = %86, %4
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %.loopexit, label %91

91:                                               ; preds = %._crit_edge
  store i32 %2, ptr %3, align 4, !tbaa !30
  br label %.loopexit

.loopexit:                                        ; preds = %83, %.critedge.thread, %._crit_edge, %91
  %.7 = phi i32 [ 0, %91 ], [ 0, %._crit_edge ], [ %.4.ph, %.critedge.thread ], [ %84, %83 ]
  ret i32 %.7
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5MyMinIyET_S0_S0_(i64 noundef, i64 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK17COutStreamWithCRC6GetCRCEv(ptr noundef nonnull align 8 dereferenceable(37)) local_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 = { 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 #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, !10, i64 56}
!6 = !{!"_ZTSN8NArchive3N7z16CFolderOutStreamE", !7, i64 0, !9, i64 8, !13, i64 16, !14, i64 24, !13, i64 32, !13, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !15, i64 64, !16, i64 72, !16, i64 73, !16, i64 74, !17, i64 80}
!7 = !{!"_ZTS20ISequentialOutStream", !8, i64 0}
!8 = !{!"_ZTS8IUnknown"}
!9 = !{!"_ZTS13CMyUnknownImp", !10, i64 0}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"any pointer", !11, i64 0}
!14 = !{!"_ZTS9CMyComPtrI20ISequentialOutStreamE", !13, i64 0}
!15 = !{!"_ZTS9CMyComPtrI23IArchiveExtractCallbackE", !13, i64 0}
!16 = !{!"bool", !11, i64 0}
!17 = !{!"long long", !11, i64 0}
!18 = !{!6, !13, i64 40}
!19 = !{!6, !16, i64 73}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!6, !10, i64 48}
!23 = !{!6, !13, i64 32}
!24 = !{!25, !17, i64 0}
!25 = !{!"_ZTSN8NArchive3N7z9CFileItemE", !17, i64 0, !10, i64 8, !10, i64 12, !26, i64 16, !16, i64 32, !16, i64 33, !16, i64 34, !16, i64 35}
!26 = !{!"_ZTS11CStringBaseIwE", !13, i64 0, !10, i64 8, !10, i64 12}
!27 = !{!6, !17, i64 80}
!28 = !{!29, !29, i64 0}
!29 = !{!"vtable pointer", !12, i64 0}
!30 = !{!10, !10, i64 0}
!31 = !{!25, !16, i64 34}
!32 = !{!6, !16, i64 74}
!33 = !{!25, !10, i64 12}
!34 = !{!6, !13, i64 16}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}


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