; LLVM IR from troldal/KZip :: KZip/KZip.ll (ZN4KZip4Impl10ZipArchiveC2Ev)

; 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.KZip::Impl::ZipArchive" = type { %struct.mz_zip_archive, %"class.std::vector.6", %"class.std::filesystem::__cxx11::path", i8, i32 }
%struct.mz_zip_archive = type { i64, i64, i32, i32, i32, i32, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%"class.std::vector.6" = type { %"struct.std::_Vector_base.7" }
%"struct.std::_Vector_base.7" = type { %"struct.std::_Vector_base<KZip::Impl::ZipEntryWrapper, std::allocator<KZip::Impl::ZipEntryWrapper>>::_Vector_impl" }
%"struct.std::_Vector_base<KZip::Impl::ZipEntryWrapper, std::allocator<KZip::Impl::ZipEntryWrapper>>::_Vector_impl" = type { %"struct.std::_Vector_base<KZip::Impl::ZipEntryWrapper, std::allocator<KZip::Impl::ZipEntryWrapper>>::_Vector_impl_data" }
%"struct.std::_Vector_base<KZip::Impl::ZipEntryWrapper, std::allocator<KZip::Impl::ZipEntryWrapper>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::filesystem::__cxx11::path" = type { %"class.std::__cxx11::basic_string", %"struct.std::filesystem::__cxx11::path::_List" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"struct.std::filesystem::__cxx11::path::_List" = type { %"class.std::unique_ptr" }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.12" }
%"struct.std::_Head_base.12" = type { ptr }

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4KZip4Impl10ZipArchiveC2Ev(ptr noundef nonnull align 8 dereferenceable(184) %0) unnamed_addr #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %"class.KZip::Impl::ZipArchive", ptr %3, i32 0, i32 0
  call void @llvm.memset.p0.i64(ptr align 8 %4, i8 0, i64 112, i1 false)
  %5 = getelementptr inbounds %"class.KZip::Impl::ZipArchive", ptr %3, i32 0, i32 1
  call void @llvm.memset.p0.i64(ptr align 8 %5, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIN4KZip4Impl15ZipEntryWrapperESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #2
  %6 = getelementptr inbounds %"class.KZip::Impl::ZipArchive", ptr %3, i32 0, i32 2
  call void @_ZNSt10filesystem7__cxx114pathC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %6) #2
  %7 = getelementptr inbounds %"class.KZip::Impl::ZipArchive", ptr %3, i32 0, i32 3
  store i8 0, ptr %7, align 8, !tbaa !9
  %8 = getelementptr inbounds %"class.KZip::Impl::ZipArchive", ptr %3, i32 0, i32 4
  store i32 0, ptr %8, align 4, !tbaa !32
  ret void
}

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

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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, !31, i64 176}
!10 = !{!"_ZTSN4KZip4Impl10ZipArchiveE", !11, i64 0, !17, i64 112, !21, i64 136, !31, i64 176, !13, i64 180}
!11 = !{!"_ZTS14mz_zip_archive", !12, i64 0, !12, i64 8, !13, i64 16, !14, i64 20, !15, i64 24, !16, i64 28, !12, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104}
!12 = !{!"long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS11mz_zip_mode", !7, i64 0}
!15 = !{!"_ZTS11mz_zip_type", !7, i64 0}
!16 = !{!"_ZTS12mz_zip_error", !7, i64 0}
!17 = !{!"_ZTSSt6vectorIN4KZip4Impl15ZipEntryWrapperESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIN4KZip4Impl15ZipEntryWrapperESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN4KZip4Impl15ZipEntryWrapperESaIS2_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN4KZip4Impl15ZipEntryWrapperESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"_ZTSNSt10filesystem7__cxx114pathE", !22, i64 0, !24, i64 32}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !12, i64 8, !7, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!24 = !{!"_ZTSNSt10filesystem7__cxx114path5_ListE", !25, i64 0}
!25 = !{!"_ZTSSt10unique_ptrINSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEE", !26, i64 0}
!26 = !{!"_ZTSSt15__uniq_ptr_dataINSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterELb1ELb1EE", !27, i64 0}
!27 = !{!"_ZTSSt15__uniq_ptr_implINSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEE", !28, i64 0}
!28 = !{!"_ZTSSt5tupleIJPNSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEEE", !29, i64 0}
!29 = !{!"_ZTSSt11_Tuple_implILm0EJPNSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEEE", !30, i64 0}
!30 = !{!"_ZTSSt10_Head_baseILm0EPNSt10filesystem7__cxx114path5_List5_ImplELb0EE", !6, i64 0}
!31 = !{!"bool", !7, i64 0}
!32 = !{!10, !13, i64 180}


; 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 nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4KZip4Impl10ZipArchiveC2Ev(ptr noundef nonnull align 8 dereferenceable(184) %0) unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 112
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(136) %0, i8 0, i64 136, i1 false)
  tail call void @_ZNSt6vectorIN4KZip4Impl15ZipEntryWrapperESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #2
  %3 = getelementptr inbounds i8, ptr %0, i64 136
  tail call void @_ZNSt10filesystem7__cxx114pathC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #2
  %4 = getelementptr inbounds i8, ptr %0, i64 176
  store i8 0, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 180
  store i32 0, ptr %5, align 4, !tbaa !31
  ret void
}

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

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

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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, !30, i64 176}
!6 = !{!"_ZTSN4KZip4Impl10ZipArchiveE", !7, i64 0, !16, i64 112, !20, i64 136, !30, i64 176, !11, i64 180}
!7 = !{!"_ZTS14mz_zip_archive", !8, i64 0, !8, i64 8, !11, i64 16, !12, i64 20, !13, i64 24, !14, i64 28, !8, i64 32, !15, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !15, i64 96, !15, i64 104}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"_ZTS11mz_zip_mode", !9, i64 0}
!13 = !{!"_ZTS11mz_zip_type", !9, i64 0}
!14 = !{!"_ZTS12mz_zip_error", !9, i64 0}
!15 = !{!"any pointer", !9, i64 0}
!16 = !{!"_ZTSSt6vectorIN4KZip4Impl15ZipEntryWrapperESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIN4KZip4Impl15ZipEntryWrapperESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN4KZip4Impl15ZipEntryWrapperESaIS2_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN4KZip4Impl15ZipEntryWrapperESaIS2_EE17_Vector_impl_dataE", !15, i64 0, !15, i64 8, !15, i64 16}
!20 = !{!"_ZTSNSt10filesystem7__cxx114pathE", !21, i64 0, !23, i64 32}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !22, i64 0, !8, i64 8, !9, i64 16}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !15, i64 0}
!23 = !{!"_ZTSNSt10filesystem7__cxx114path5_ListE", !24, i64 0}
!24 = !{!"_ZTSSt10unique_ptrINSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEE", !25, i64 0}
!25 = !{!"_ZTSSt15__uniq_ptr_dataINSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterELb1ELb1EE", !26, i64 0}
!26 = !{!"_ZTSSt15__uniq_ptr_implINSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEE", !27, i64 0}
!27 = !{!"_ZTSSt5tupleIJPNSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEEE", !28, i64 0}
!28 = !{!"_ZTSSt11_Tuple_implILm0EJPNSt10filesystem7__cxx114path5_List5_ImplENS3_13_Impl_deleterEEE", !29, i64 0}
!29 = !{!"_ZTSSt10_Head_baseILm0EPNSt10filesystem7__cxx114path5_List5_ImplELb0EE", !15, i64 0}
!30 = !{!"bool", !9, i64 0}
!31 = !{!6, !11, i64 180}


; Effective O3 passes: EarlyCSEPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass