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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN8NArchive3N7z16CFolderOutStream8OpenFileEv(ptr noundef nonnull align 8 dereferenceable(88) %0) #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %class.CMyComPtr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %12 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %13 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 5
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 8
  %16 = load i32, ptr %15, align 8, !tbaa !19
  %17 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK13CRecordVectorIbEixEi(ptr noundef nonnull align 8 dereferenceable(32) %14, i32 noundef %16)
  %18 = load i8, ptr %17, align 1, !tbaa !20, !range !21, !noundef !22
  %19 = trunc i8 %18 to i1
  br i1 %19, label %20, label %26

20:                                               ; preds = %1
  %21 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 10
  %22 = load i8, ptr %21, align 8, !tbaa !23, !range !21, !noundef !22
  %23 = trunc i8 %22 to i1
  %24 = zext i1 %23 to i64
  %25 = select i1 %23, i32 1, i32 0
  store i32 %25, ptr %4, align 4, !tbaa !24
  br label %27

26:                                               ; preds = %1
  store i32 2, ptr %4, align 4, !tbaa !24
  br label %27

27:                                               ; preds = %26, %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @_ZN9CMyComPtrI20ISequentialOutStreamEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %28 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 6
  %29 = load i32, ptr %28, align 8, !tbaa !25
  %30 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 8
  %31 = load i32, ptr %30, align 8, !tbaa !19
  %32 = add i32 %29, %31
  store i32 %32, ptr %6, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %33 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 9
  %34 = invoke noundef ptr @_ZNK9CMyComPtrI23IArchiveExtractCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %33)
          to label %35 unwind label %52

35:                                               ; preds = %27
  %36 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 7
  %37 = load i32, ptr %36, align 4, !tbaa !26
  %38 = load i32, ptr %6, align 4, !tbaa !24
  %39 = add i32 %37, %38
  %40 = invoke noundef ptr @_ZN9CMyComPtrI20ISequentialOutStreamEadEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %41 unwind label %52

41:                                               ; preds = %35
  %42 = load i32, ptr %4, align 4, !tbaa !24
  %43 = load ptr, ptr %34, align 8, !tbaa !27
  %44 = getelementptr inbounds ptr, ptr %43, i64 7
  %45 = load ptr, ptr %44, align 8
  %46 = invoke noundef i32 %45(ptr noundef nonnull align 8 dereferenceable(8) %34, i32 noundef %39, ptr noundef %40, i32 noundef %42)
          to label %47 unwind label %52

47:                                               ; preds = %41
  store i32 %46, ptr %7, align 4, !tbaa !24
  %48 = load i32, ptr %7, align 4, !tbaa !24
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %56

50:                                               ; preds = %47
  %51 = load i32, ptr %7, align 4, !tbaa !24
  store i32 %51, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %57

52:                                               ; preds = %41, %35, %27
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %8, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %115

56:                                               ; preds = %47
  store i32 0, ptr %10, align 4
  br label %57

57:                                               ; preds = %56, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  %58 = load i32, ptr %10, align 4
  switch i32 %58, label %113 [
    i32 0, label %59
  ]

59:                                               ; preds = %57
  %60 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 2
  %61 = load ptr, ptr %60, align 8, !tbaa !29
  %62 = invoke noundef ptr @_ZNK9CMyComPtrI20ISequentialOutStreamEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %63 unwind label %94

63:                                               ; preds = %59
  invoke void @_ZN17COutStreamWithCRC9SetStreamEP20ISequentialOutStream(ptr noundef nonnull align 8 dereferenceable(37) %61, ptr noundef %62)
          to label %64 unwind label %94

64:                                               ; preds = %63
  %65 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 2
  %66 = load ptr, ptr %65, align 8, !tbaa !29
  %67 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 12
  %68 = load i8, ptr %67, align 2, !tbaa !30, !range !21, !noundef !22
  %69 = trunc i8 %68 to i1
  invoke void @_ZN17COutStreamWithCRC4InitEb(ptr noundef nonnull align 8 dereferenceable(37) %66, i1 noundef zeroext %69)
          to label %70 unwind label %94

70:                                               ; preds = %64
  %71 = load i32, ptr %4, align 4, !tbaa !24
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %73, label %103

73:                                               ; preds = %70
  %74 = invoke noundef zeroext i1 @_ZNK9CMyComPtrI20ISequentialOutStreamEntEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %75 unwind label %94

75:                                               ; preds = %73
  br i1 %74, label %76, label %103

76:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %77 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 4
  %78 = load ptr, ptr %77, align 8, !tbaa !31
  %79 = getelementptr inbounds %"struct.NArchive::N7z::CArchiveDatabase", ptr %78, i32 0, i32 5
  %80 = load i32, ptr %6, align 4, !tbaa !24
  %81 = invoke noundef nonnull align 8 dereferenceable(36) ptr @_ZNK13CObjectVectorIN8NArchive3N7z9CFileItemEEixEi(ptr noundef nonnull align 8 dereferenceable(32) %79, i32 noundef %80)
          to label %82 unwind label %98

82:                                               ; preds = %76
  store ptr %81, ptr %11, align 8, !tbaa !5
  %83 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 4
  %84 = load ptr, ptr %83, align 8, !tbaa !31
  %85 = load i32, ptr %6, align 4, !tbaa !24
  %86 = invoke noundef zeroext i1 @_ZNK8NArchive3N7z16CArchiveDatabase10IsItemAntiEi(ptr noundef nonnull align 8 dereferenceable(480) %84, i32 noundef %85)
          to label %87 unwind label %98

87:                                               ; preds = %82
  br i1 %86, label %102, label %88

88:                                               ; preds = %87
  %89 = load ptr, ptr %11, align 8, !tbaa !5
  %90 = getelementptr inbounds %"struct.NArchive::N7z::CFileItem", ptr %89, i32 0, i32 5
  %91 = load i8, ptr %90, align 1, !tbaa !32, !range !21, !noundef !22
  %92 = trunc i8 %91 to i1
  br i1 %92, label %102, label %93

93:                                               ; preds = %88
  store i32 2, ptr %4, align 4, !tbaa !24
  br label %102

94:                                               ; preds = %106, %103, %73, %64, %63, %59
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %8, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %9, align 4
  br label %115

98:                                               ; preds = %82, %76
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %8, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %115

102:                                              ; preds = %93, %88, %87
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %103

103:                                              ; preds = %102, %75, %70
  %104 = getelementptr inbounds %"class.NArchive::N7z::CFolderOutStream", ptr %12, i32 0, i32 9
  %105 = invoke noundef ptr @_ZNK9CMyComPtrI23IArchiveExtractCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %104)
          to label %106 unwind label %94

106:                                              ; preds = %103
  %107 = load i32, ptr %4, align 4, !tbaa !24
  %108 = load ptr, ptr %105, align 8, !tbaa !27
  %109 = getelementptr inbounds ptr, ptr %108, i64 8
  %110 = load ptr, ptr %109, align 8
  %111 = invoke noundef i32 %110(ptr noundef nonnull align 8 dereferenceable(8) %105, i32 noundef %107)
          to label %112 unwind label %94

112:                                              ; preds = %106
  store i32 %111, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %113

113:                                              ; preds = %112, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @_ZN9CMyComPtrI20ISequentialOutStreamED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %114 = load i32, ptr %2, align 4
  ret i32 %114

115:                                              ; preds = %98, %94, %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @_ZN9CMyComPtrI20ISequentialOutStreamED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %116

116:                                              ; preds = %115
  %117 = load ptr, ptr %8, align 8
  %118 = load i32, ptr %9, align 4
  %119 = insertvalue { ptr, i32 } poison, ptr %117, 0
  %120 = insertvalue { ptr, i32 } %119, i32 %118, 1
  resume { ptr, i32 } %120
}

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(36) ptr @_ZNK13CObjectVectorIN8NArchive3N7z9CFileItemEEixEi(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK8NArchive3N7z16CArchiveDatabase10IsItemAntiEi(ptr noundef nonnull align 8 dereferenceable(480), i32 noundef) #1 align 2

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 40}
!10 = !{!"_ZTSN8NArchive3N7z16CFolderOutStreamE", !11, i64 0, !13, i64 8, !6, i64 16, !15, i64 24, !6, i64 32, !6, i64 40, !14, i64 48, !14, i64 52, !14, i64 56, !16, i64 64, !17, i64 72, !17, i64 73, !17, i64 74, !18, i64 80}
!11 = !{!"_ZTS20ISequentialOutStream", !12, i64 0}
!12 = !{!"_ZTS8IUnknown"}
!13 = !{!"_ZTS13CMyUnknownImp", !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTS9CMyComPtrI20ISequentialOutStreamE", !6, i64 0}
!16 = !{!"_ZTS9CMyComPtrI23IArchiveExtractCallbackE", !6, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"long long", !7, i64 0}
!19 = !{!10, !14, i64 56}
!20 = !{!17, !17, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!10, !17, i64 72}
!24 = !{!14, !14, i64 0}
!25 = !{!10, !14, i64 48}
!26 = !{!10, !14, i64 52}
!27 = !{!28, !28, i64 0}
!28 = !{!"vtable pointer", !8, i64 0}
!29 = !{!10, !6, i64 16}
!30 = !{!10, !17, i64 74}
!31 = !{!10, !6, i64 32}
!32 = !{!33, !17, i64 33}
!33 = !{!"_ZTSN8NArchive3N7z9CFileItemE", !18, i64 0, !14, i64 8, !14, i64 12, !34, i64 16, !17, i64 32, !17, i64 33, !17, i64 34, !17, i64 35}
!34 = !{!"_ZTS11CStringBaseIwE", !6, i64 0, !14, i64 8, !14, i64 12}


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

%class.CMyComPtr = type { ptr }

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN8NArchive3N7z16CFolderOutStream8OpenFileEv(ptr noundef nonnull align 8 dereferenceable(88) %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %class.CMyComPtr, align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 56
  %6 = load i32, ptr %5, align 8, !tbaa !18
  %7 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK13CRecordVectorIbEixEi(ptr noundef nonnull align 8 dereferenceable(32) %4, i32 noundef %6)
  %8 = load i8, ptr %7, align 1, !tbaa !19, !range !20, !noundef !21
  %9 = trunc nuw i8 %8 to i1
  %10 = getelementptr inbounds i8, ptr %0, i64 72
  %11 = load i8, ptr %10, align 8, !range !20
  %12 = zext nneg i8 %11 to i32
  %.016 = select i1 %9, i32 %12, i32 2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN9CMyComPtrI20ISequentialOutStreamEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %13 = getelementptr inbounds i8, ptr %0, i64 48
  %14 = load i32, ptr %13, align 8, !tbaa !22
  %15 = load i32, ptr %5, align 8, !tbaa !18
  %16 = add i32 %15, %14
  %17 = getelementptr inbounds i8, ptr %0, i64 64
  %18 = call noundef ptr @_ZNK9CMyComPtrI23IArchiveExtractCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %17)
  %19 = getelementptr inbounds i8, ptr %0, i64 52
  %20 = load i32, ptr %19, align 4, !tbaa !23
  %21 = add i32 %20, %16
  %22 = call noundef ptr @_ZN9CMyComPtrI20ISequentialOutStreamEadEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  %23 = load ptr, ptr %18, align 8, !tbaa !24
  %24 = getelementptr inbounds i8, ptr %23, i64 56
  %25 = load ptr, ptr %24, align 8
  %26 = invoke noundef i32 %25(ptr noundef nonnull align 8 dereferenceable(8) %18, i32 noundef %21, ptr noundef %22, i32 noundef %.016)
          to label %27 unwind label %28

27:                                               ; preds = %1
  %.not = icmp eq i32 %26, 0
  br i1 %.not, label %30, label %65

28:                                               ; preds = %1
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %66

30:                                               ; preds = %27
  %31 = getelementptr inbounds i8, ptr %0, i64 16
  %32 = load ptr, ptr %31, align 8, !tbaa !26
  %33 = call noundef ptr @_ZNK9CMyComPtrI20ISequentialOutStreamEcvPS0_Ev(ptr noundef nonnull align 8 dereferenceable(8) %2)
  invoke void @_ZN17COutStreamWithCRC9SetStreamEP20ISequentialOutStream(ptr noundef nonnull align 8 dereferenceable(37) %32, ptr noundef %33)
          to label %34 unwind label %55

34:                                               ; preds = %30
  %35 = load ptr, ptr %31, align 8, !tbaa !26
  %36 = getelementptr inbounds i8, ptr %0, i64 74
  %37 = load i8, ptr %36, align 2, !tbaa !27, !range !20, !noundef !21
  %38 = trunc nuw i8 %37 to i1
  call void @_ZN17COutStreamWithCRC4InitEb(ptr noundef nonnull align 8 dereferenceable(37) %35, i1 noundef zeroext %38)
  %39 = icmp eq i32 %.016, 0
  br i1 %39, label %40, label %59

40:                                               ; preds = %34
  %41 = call noundef zeroext i1 @_ZNK9CMyComPtrI20ISequentialOutStreamEntEv(ptr noundef nonnull align 8 dereferenceable(8) %2)
  br i1 %41, label %42, label %59

42:                                               ; preds = %40
  %43 = getelementptr inbounds i8, ptr %0, i64 32
  %44 = load ptr, ptr %43, align 8, !tbaa !28
  %45 = getelementptr inbounds i8, ptr %44, i64 160
  %46 = invoke noundef nonnull align 8 dereferenceable(36) ptr @_ZNK13CObjectVectorIN8NArchive3N7z9CFileItemEEixEi(ptr noundef nonnull align 8 dereferenceable(32) %45, i32 noundef %16)
          to label %47 unwind label %57

47:                                               ; preds = %42
  %48 = load ptr, ptr %43, align 8, !tbaa !28
  %49 = invoke noundef zeroext i1 @_ZNK8NArchive3N7z16CArchiveDatabase10IsItemAntiEi(ptr noundef nonnull align 8 dereferenceable(480) %48, i32 noundef %16)
          to label %50 unwind label %57

50:                                               ; preds = %47
  br i1 %49, label %59, label %51

51:                                               ; preds = %50
  %52 = getelementptr inbounds i8, ptr %46, i64 33
  %53 = load i8, ptr %52, align 1, !tbaa !29, !range !20, !noundef !21
  %54 = trunc nuw i8 %53 to i1
  %spec.select = select i1 %54, i32 0, i32 2
  br label %59

55:                                               ; preds = %59, %30
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %66

57:                                               ; preds = %47, %42
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %66

59:                                               ; preds = %51, %50, %40, %34
  %.2 = phi i32 [ 0, %40 ], [ %.016, %34 ], [ 0, %50 ], [ %spec.select, %51 ]
  %60 = call noundef ptr @_ZNK9CMyComPtrI23IArchiveExtractCallbackEptEv(ptr noundef nonnull align 8 dereferenceable(8) %17)
  %61 = load ptr, ptr %60, align 8, !tbaa !24
  %62 = getelementptr inbounds i8, ptr %61, i64 64
  %63 = load ptr, ptr %62, align 8
  %64 = invoke noundef i32 %63(ptr noundef nonnull align 8 dereferenceable(8) %60, i32 noundef %.2)
          to label %65 unwind label %55

65:                                               ; preds = %59, %27
  %.1 = phi i32 [ %26, %27 ], [ %64, %59 ]
  call void @_ZN9CMyComPtrI20ISequentialOutStreamED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  ret i32 %.1

66:                                               ; preds = %57, %55, %28
  %.pn = phi { ptr, i32 } [ %56, %55 ], [ %58, %57 ], [ %29, %28 ]
  call void @_ZN9CMyComPtrI20ISequentialOutStreamED2Ev(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
}

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

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

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

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

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

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

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

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

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

; 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 #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK8NArchive3N7z16CArchiveDatabase10IsItemAntiEi(ptr noundef nonnull align 8 dereferenceable(480), i32 noundef) local_unnamed_addr #1 align 2

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !13, i64 40}
!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, !10, i64 56}
!19 = !{!16, !16, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!6, !10, i64 48}
!23 = !{!6, !10, i64 52}
!24 = !{!25, !25, i64 0}
!25 = !{!"vtable pointer", !12, i64 0}
!26 = !{!6, !13, i64 16}
!27 = !{!6, !16, i64 74}
!28 = !{!6, !13, i64 32}
!29 = !{!30, !16, i64 33}
!30 = !{!"_ZTSN8NArchive3N7z9CFileItemE", !17, i64 0, !10, i64 8, !10, i64 12, !31, i64 16, !16, i64 32, !16, i64 33, !16, i64 34, !16, i64 35}
!31 = !{!"_ZTS11CStringBaseIwE", !13, i64 0, !10, i64 8, !10, i64 12}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass