; LLVM IR from facebook/redex :: libresource/Serialize.ll (ZN4arsc15ResTableBuilder9serializeEPN7android6VectorIcEE)

; 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.__gnu_cxx::__normal_iterator.182" = type { ptr }
%"class.arsc::ResTableBuilder" = type { %"struct.std::pair.148", %"class.std::vector.177" }
%"struct.std::pair.148" = type { %"class.std::shared_ptr", ptr }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::vector.177" = type { %"struct.std::_Vector_base.178" }
%"struct.std::_Vector_base.178" = type { %"struct.std::_Vector_base<std::pair<std::shared_ptr<arsc::ResPackageBuilder>, android::ResTable_package *>, std::allocator<std::pair<std::shared_ptr<arsc::ResPackageBuilder>, android::ResTable_package *>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::shared_ptr<arsc::ResPackageBuilder>, android::ResTable_package *>, std::allocator<std::pair<std::shared_ptr<arsc::ResPackageBuilder>, android::ResTable_package *>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::shared_ptr<arsc::ResPackageBuilder>, android::ResTable_package *>, std::allocator<std::pair<std::shared_ptr<arsc::ResPackageBuilder>, android::ResTable_package *>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::shared_ptr<arsc::ResPackageBuilder>, android::ResTable_package *>, std::allocator<std::pair<std::shared_ptr<arsc::ResPackageBuilder>, android::ResTable_package *>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair.183" = type { %"class.std::shared_ptr.185", ptr }
%"class.std::shared_ptr.185" = type { %"class.std::__shared_ptr.186" }
%"class.std::__shared_ptr.186" = type { ptr, %"class.std::__shared_count" }

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNK7android6VectorIcE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4arsc10push_shortEtPN7android6VectorIcEE(i16 noundef zeroext, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4arsc9push_longEjPN7android6VectorIcEE(i32 noundef, ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4arsc12_GLOBAL__N_117write_string_poolERSt4pairISt10shared_ptrINS_20ResStringPoolBuilderEEPN7android20ResStringPool_headerEEPNS5_6VectorIcEE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4arsc12_GLOBAL__N_110push_chunkEPN7android15ResChunk_headerEPNS1_6VectorIcEE(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4arsc15ResTableBuilder9serializeEPN7android6VectorIcEE(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator.182", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator.182", align 8
  %11 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = call noundef i64 @_ZNK7android6VectorIcE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %13)
  store i64 %14, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 12, ptr %6, align 8, !tbaa !9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4arsc10push_shortEtPN7android6VectorIcEE(i16 noundef zeroext 2, ptr noundef %15)
  %16 = load i64, ptr %6, align 8, !tbaa !9
  %17 = trunc i64 %16 to i16
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4arsc10push_shortEtPN7android6VectorIcEE(i16 noundef zeroext %17, ptr noundef %18)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = call noundef i64 @_ZNK7android6VectorIcE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %19)
  store i64 %20, ptr %7, align 8, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4arsc9push_longEjPN7android6VectorIcEE(i32 noundef -286331154, ptr noundef %21)
  %22 = getelementptr inbounds %"class.arsc::ResTableBuilder", ptr %12, i32 0, i32 1
  %23 = call noundef i64 @_ZNKSt6vectorISt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESaIS8_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #5
  %24 = trunc i64 %23 to i32
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4arsc9push_longEjPN7android6VectorIcEE(i32 noundef %24, ptr noundef %25)
  %26 = getelementptr inbounds %"class.arsc::ResTableBuilder", ptr %12, i32 0, i32 0
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4arsc12_GLOBAL__N_117write_string_poolERSt4pairISt10shared_ptrINS_20ResStringPoolBuilderEEPN7android20ResStringPool_headerEEPNS5_6VectorIcEE(ptr noundef nonnull align 8 dereferenceable(24) %26, ptr noundef %27)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %28 = getelementptr inbounds %"class.arsc::ResTableBuilder", ptr %12, i32 0, i32 1
  store ptr %28, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = call ptr @_ZNSt6vectorISt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESaIS8_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #5
  %31 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.182", ptr %9, i32 0, i32 0
  store ptr %30, ptr %31, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = call ptr @_ZNSt6vectorISt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESaIS8_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #5
  %34 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.182", ptr %10, i32 0, i32 0
  store ptr %33, ptr %34, align 8
  br label %35

35:                                               ; preds = %54, %2
  %36 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESt6vectorIS9_SaIS9_EEEEbRKNS_17__normal_iteratorIT_T0_EESJ_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #5
  br i1 %36, label %38, label %37

37:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %56

38:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %39 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESt6vectorIS9_SaIS9_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  store ptr %39, ptr %11, align 8, !tbaa !5
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.std::pair.183", ptr %40, i32 0, i32 0
  %42 = call noundef zeroext i1 @_ZStneIN4arsc17ResPackageBuilderEEbRKSt10shared_ptrIT_EDn(ptr noundef nonnull align 8 dereferenceable(16) %41, ptr null) #5
  br i1 %42, label %43, label %48

43:                                               ; preds = %38
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.std::pair.183", ptr %44, i32 0, i32 0
  %46 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN4arsc17ResPackageBuilderELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %45) #5
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4arsc17ResPackageBuilder9serializeEPN7android6VectorIcEE(ptr noundef nonnull align 8 dereferenceable(416) %46, ptr noundef %47)
  br label %53

48:                                               ; preds = %38
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.std::pair.183", ptr %49, i32 0, i32 1
  %51 = load ptr, ptr %50, align 8, !tbaa !11
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4arsc12_GLOBAL__N_110push_chunkEPN7android15ResChunk_headerEPNS1_6VectorIcEE(ptr noundef %51, ptr noundef %52)
  br label %53

53:                                               ; preds = %48, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %54

54:                                               ; preds = %53
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESt6vectorIS9_SaIS9_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  br label %35

56:                                               ; preds = %37
  %57 = load i64, ptr %7, align 8, !tbaa !9
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = call noundef i64 @_ZNK7android6VectorIcE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %58)
  %60 = load i64, ptr %5, align 8, !tbaa !9
  %61 = sub i64 %59, %60
  %62 = trunc i64 %61 to i32
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4arsc12_GLOBAL__N_117write_long_at_posEmjPN7android6VectorIcEE(i64 noundef %57, i32 noundef %62, ptr noundef %63)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  ret void
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESt6vectorIS9_SaIS9_EEEEbRKNS_17__normal_iteratorIT_T0_EESJ_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneIN4arsc17ResPackageBuilderEEbRKSt10shared_ptrIT_EDn(ptr noundef nonnull align 8 dereferenceable(16), ptr) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN4arsc17ResPackageBuilderELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4arsc12_GLOBAL__N_117write_long_at_posEmjPN7android6VectorIcEE(i64 noundef, i32 noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 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 = { 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 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"_ZTSSt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEE", !13, i64 0, !6, i64 16}
!13 = !{!"_ZTSSt10shared_ptrIN4arsc17ResPackageBuilderEE", !14, i64 0}
!14 = !{!"_ZTSSt12__shared_ptrIN4arsc17ResPackageBuilderELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !15, i64 8}
!15 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}


; 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.__gnu_cxx::__normal_iterator.182" = type { ptr }

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNK7android6VectorIcE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4arsc10push_shortEtPN7android6VectorIcEE(i16 noundef zeroext, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4arsc9push_longEjPN7android6VectorIcEE(i32 noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4arsc12_GLOBAL__N_117write_string_poolERSt4pairISt10shared_ptrINS_20ResStringPoolBuilderEEPN7android20ResStringPool_headerEEPNS5_6VectorIcEE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4arsc12_GLOBAL__N_110push_chunkEPN7android15ResChunk_headerEPNS1_6VectorIcEE(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4arsc15ResTableBuilder9serializeEPN7android6VectorIcEE(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %"class.__gnu_cxx::__normal_iterator.182", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator.182", align 8
  %5 = tail call noundef i64 @_ZNK7android6VectorIcE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  tail call void @_ZN4arsc10push_shortEtPN7android6VectorIcEE(i16 noundef zeroext 2, ptr noundef nonnull %1)
  tail call void @_ZN4arsc10push_shortEtPN7android6VectorIcEE(i16 noundef zeroext 12, ptr noundef nonnull %1)
  %6 = tail call noundef i64 @_ZNK7android6VectorIcE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  tail call void @_ZN4arsc9push_longEjPN7android6VectorIcEE(i32 noundef -286331154, ptr noundef nonnull %1)
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = tail call noundef i64 @_ZNKSt6vectorISt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESaIS8_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  %9 = trunc i64 %8 to i32
  tail call void @_ZN4arsc9push_longEjPN7android6VectorIcEE(i32 noundef %9, ptr noundef nonnull %1)
  tail call void @_ZN4arsc12_GLOBAL__N_117write_string_poolERSt4pairISt10shared_ptrINS_20ResStringPoolBuilderEEPN7android20ResStringPool_headerEEPNS5_6VectorIcEE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull %1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %10 = tail call ptr @_ZNSt6vectorISt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESaIS8_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  store ptr %10, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %11 = tail call ptr @_ZNSt6vectorISt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESaIS8_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  store ptr %11, ptr %4, align 8
  %12 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESt6vectorIS9_SaIS9_EEEEbRKNS_17__normal_iteratorIT_T0_EESJ_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  br i1 %12, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %23, %2
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  %13 = call noundef i64 @_ZNK7android6VectorIcE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  %14 = sub i64 %13, %5
  %15 = trunc i64 %14 to i32
  call void @_ZN4arsc12_GLOBAL__N_117write_long_at_posEmjPN7android6VectorIcEE(i64 noundef %6, i32 noundef %15, ptr noundef nonnull %1)
  ret void

.lr.ph:                                           ; preds = %2, %23
  %16 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESt6vectorIS9_SaIS9_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %17 = call noundef zeroext i1 @_ZStneIN4arsc17ResPackageBuilderEEbRKSt10shared_ptrIT_EDn(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr null) #5
  br i1 %17, label %18, label %20

18:                                               ; preds = %.lr.ph
  %19 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN4arsc17ResPackageBuilderELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %16) #5
  call void @_ZN4arsc17ResPackageBuilder9serializeEPN7android6VectorIcEE(ptr noundef nonnull align 8 dereferenceable(416) %19, ptr noundef nonnull %1)
  br label %23

20:                                               ; preds = %.lr.ph
  %21 = getelementptr inbounds i8, ptr %16, i64 16
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  call void @_ZN4arsc12_GLOBAL__N_110push_chunkEPN7android15ResChunk_headerEPNS1_6VectorIcEE(ptr noundef %22, ptr noundef nonnull %1)
  br label %23

23:                                               ; preds = %20, %18
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESt6vectorIS9_SaIS9_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %25 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESt6vectorIS9_SaIS9_EEEEbRKNS_17__normal_iteratorIT_T0_EESJ_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  br i1 %25, label %.lr.ph, label %._crit_edge
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEESt6vectorIS9_SaIS9_EEEEbRKNS_17__normal_iteratorIT_T0_EESJ_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneIN4arsc17ResPackageBuilderEEbRKSt10shared_ptrIT_EDn(ptr noundef nonnull align 8 dereferenceable(16), ptr) local_unnamed_addr #4

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

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4arsc12_GLOBAL__N_117write_long_at_posEmjPN7android6VectorIcEE(i64 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 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 = { 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 = { 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 #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, !9, i64 16}
!6 = !{!"_ZTSSt4pairISt10shared_ptrIN4arsc17ResPackageBuilderEEPN7android16ResTable_packageEE", !7, i64 0, !9, i64 16}
!7 = !{!"_ZTSSt10shared_ptrIN4arsc17ResPackageBuilderEE", !8, i64 0}
!8 = !{!"_ZTSSt12__shared_ptrIN4arsc17ResPackageBuilderELN9__gnu_cxx12_Lock_policyE2EE", !9, i64 0, !12, i64 8}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !9, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass