; LLVM IR from specinfo-ua/UAPKI :: library/common/pkix/tsp-helper.ll (ZN7UapkiNS3Tsp13TsTokenParserC2Ev)

; 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.UapkiNS::Tsp::TsTokenParser" = type { %"class.UapkiNS::Pkcs7::SignedDataParser", %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", ptr, ptr, i64, i8, i8, ptr }
%"class.UapkiNS::Pkcs7::SignedDataParser" = type { ptr, i32, %"class.std::vector", %"struct.UapkiNS::Pkcs7::EncapsulatedContentInfo", %"class.UapkiNS::VectorBA", %"class.UapkiNS::VectorBA", i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.UapkiNS::Pkcs7::EncapsulatedContentInfo" = type { %"class.std::__cxx11::basic_string", ptr }
%"class.UapkiNS::VectorBA" = type { %"class.std::vector.3" }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<ByteArray_st *, std::allocator<ByteArray_st *>>::_Vector_impl" }
%"struct.std::_Vector_base<ByteArray_st *, std::allocator<ByteArray_st *>>::_Vector_impl" = type { %"struct.std::_Vector_base<ByteArray_st *, std::allocator<ByteArray_st *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ByteArray_st *, std::allocator<ByteArray_st *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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] }

declare void @_ZN7UapkiNS5Pkcs716SignedDataParserC1Ev(ptr noundef nonnull align 8 dereferenceable(136)) unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7UapkiNS3Tsp13TsTokenParserC2Ev(ptr noundef nonnull align 8 dereferenceable(240) %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.UapkiNS::Tsp::TsTokenParser", ptr %3, i32 0, i32 0
  call void @_ZN7UapkiNS5Pkcs716SignedDataParserC1Ev(ptr noundef nonnull align 8 dereferenceable(136) %4)
  %5 = getelementptr inbounds %"class.UapkiNS::Tsp::TsTokenParser", ptr %3, i32 0, i32 1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #3
  %6 = getelementptr inbounds %"class.UapkiNS::Tsp::TsTokenParser", ptr %3, i32 0, i32 2
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #3
  %7 = getelementptr inbounds %"class.UapkiNS::Tsp::TsTokenParser", ptr %3, i32 0, i32 3
  store ptr null, ptr %7, align 8, !tbaa !9
  %8 = getelementptr inbounds %"class.UapkiNS::Tsp::TsTokenParser", ptr %3, i32 0, i32 4
  store ptr null, ptr %8, align 8, !tbaa !27
  %9 = getelementptr inbounds %"class.UapkiNS::Tsp::TsTokenParser", ptr %3, i32 0, i32 5
  store i64 0, ptr %9, align 8, !tbaa !28
  %10 = getelementptr inbounds %"class.UapkiNS::Tsp::TsTokenParser", ptr %3, i32 0, i32 6
  store i8 0, ptr %10, align 8, !tbaa !29
  %11 = getelementptr inbounds %"class.UapkiNS::Tsp::TsTokenParser", ptr %3, i32 0, i32 7
  store i8 0, ptr %11, align 1, !tbaa !30
  %12 = getelementptr inbounds %"class.UapkiNS::Tsp::TsTokenParser", ptr %3, i32 0, i32 8
  store ptr null, ptr %12, align 8, !tbaa !31
  ret void
}

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

attributes #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 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 = { 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 200}
!10 = !{!"_ZTSN7UapkiNS3Tsp13TsTokenParserE", !11, i64 0, !18, i64 136, !18, i64 168, !6, i64 200, !6, i64 208, !20, i64 216, !26, i64 224, !26, i64 225, !6, i64 232}
!11 = !{!"_ZTSN7UapkiNS5Pkcs716SignedDataParserE", !6, i64 0, !12, i64 8, !13, i64 16, !17, i64 40, !21, i64 80, !21, i64 104, !20, i64 128}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTSSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"_ZTSN7UapkiNS5Pkcs723EncapsulatedContentInfoE", !18, i64 0, !6, i64 32}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !19, i64 0, !20, i64 8, !7, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTSN7UapkiNS8VectorBAE", !22, i64 0}
!22 = !{!"_ZTSSt6vectorIP12ByteArray_stSaIS1_EE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIP12ByteArray_stSaIS1_EE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIP12ByteArray_stSaIS1_EE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIP12ByteArray_stSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{!"bool", !7, i64 0}
!27 = !{!10, !6, i64 208}
!28 = !{!10, !20, i64 216}
!29 = !{!10, !26, i64 224}
!30 = !{!10, !26, i64 225}
!31 = !{!10, !6, i64 232}


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

declare void @_ZN7UapkiNS5Pkcs716SignedDataParserC1Ev(ptr noundef nonnull align 8 dereferenceable(136)) unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7UapkiNS3Tsp13TsTokenParserC2Ev(ptr noundef nonnull align 8 dereferenceable(240) %0) unnamed_addr #1 align 2 {
  tail call void @_ZN7UapkiNS5Pkcs716SignedDataParserC1Ev(ptr noundef nonnull align 8 dereferenceable(136) %0)
  %2 = getelementptr inbounds i8, ptr %0, i64 136
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  %3 = getelementptr inbounds i8, ptr %0, i64 168
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #4
  %4 = getelementptr inbounds i8, ptr %0, i64 200
  %5 = getelementptr inbounds i8, ptr %0, i64 232
  store ptr null, ptr %5, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(26) %4, i8 0, i64 26, i1 false)
  ret void
}

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

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

attributes #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 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !8, i64 232}
!6 = !{!"_ZTSN7UapkiNS3Tsp13TsTokenParserE", !7, i64 0, !17, i64 136, !17, i64 168, !8, i64 200, !8, i64 208, !19, i64 216, !25, i64 224, !25, i64 225, !8, i64 232}
!7 = !{!"_ZTSN7UapkiNS5Pkcs716SignedDataParserE", !8, i64 0, !11, i64 8, !12, i64 16, !16, i64 40, !20, i64 80, !20, i64 104, !19, i64 128}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"_ZTSSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_Vector_impl_dataE", !8, i64 0, !8, i64 8, !8, i64 16}
!16 = !{!"_ZTSN7UapkiNS5Pkcs723EncapsulatedContentInfoE", !17, i64 0, !8, i64 32}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !18, i64 0, !19, i64 8, !9, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !8, i64 0}
!19 = !{!"long", !9, i64 0}
!20 = !{!"_ZTSN7UapkiNS8VectorBAE", !21, i64 0}
!21 = !{!"_ZTSSt6vectorIP12ByteArray_stSaIS1_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIP12ByteArray_stSaIS1_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIP12ByteArray_stSaIS1_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIP12ByteArray_stSaIS1_EE17_Vector_impl_dataE", !8, i64 0, !8, i64 8, !8, i64 16}
!25 = !{!"bool", !9, i64 0}


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