; LLVM IR from specinfo-ua/UAPKI :: library/uapki/src/doc-sign.ll (ZN7UapkiNS3Doc4Sign10SigningDoc15buildSignedDataEv)

; 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::Doc::Sign::SigningDoc" = type { ptr, %"class.UapkiNS::Pkcs7::SignedDataBuilder", ptr, %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i8, %"class.UapkiNS::ContentHasher", %"class.UapkiNS::SmartBA", %"class.UapkiNS::SmartBA", %"class.UapkiNS::SmartBA", %"class.std::__cxx11::basic_string", %"class.UapkiNS::Pkcs7::ArchiveTs3Helper", %"class.std::vector.3", %"class.std::vector.18", %"class.std::vector.18" }
%"class.UapkiNS::Pkcs7::SignedDataBuilder" = type { ptr, %"class.std::vector.8", ptr }
%"class.std::vector.8" = type { %"struct.std::_Vector_base.9" }
%"struct.std::_Vector_base.9" = type { %"struct.std::_Vector_base<UapkiNS::Pkcs7::SignedDataBuilder::SignerInfo *, std::allocator<UapkiNS::Pkcs7::SignedDataBuilder::SignerInfo *>>::_Vector_impl" }
%"struct.std::_Vector_base<UapkiNS::Pkcs7::SignedDataBuilder::SignerInfo *, std::allocator<UapkiNS::Pkcs7::SignedDataBuilder::SignerInfo *>>::_Vector_impl" = type { %"struct.std::_Vector_base<UapkiNS::Pkcs7::SignedDataBuilder::SignerInfo *, std::allocator<UapkiNS::Pkcs7::SignedDataBuilder::SignerInfo *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<UapkiNS::Pkcs7::SignedDataBuilder::SignerInfo *, std::allocator<UapkiNS::Pkcs7::SignedDataBuilder::SignerInfo *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.UapkiNS::ContentHasher" = type { i32, i32, ptr, i8, %"class.std::__cxx11::basic_string", ptr, i64, %"class.UapkiNS::SmartBA" }
%"class.UapkiNS::SmartBA" = type { 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] }
%"class.UapkiNS::Pkcs7::ArchiveTs3Helper" = type { ptr, i32, %"struct.UapkiNS::Pkcs7::ArchiveTs3Helper::ATSHashIndex", %struct.anon, %"class.UapkiNS::SmartBA" }
%"struct.UapkiNS::Pkcs7::ArchiveTs3Helper::ATSHashIndex" = type { %"class.UapkiNS::VectorBA", %"class.UapkiNS::VectorBA", %"class.UapkiNS::VectorBA" }
%"class.UapkiNS::VectorBA" = type { %"class.std::vector.13" }
%"class.std::vector.13" = type { %"struct.std::_Vector_base.14" }
%"struct.std::_Vector_base.14" = 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 }
%struct.anon = type { %"class.UapkiNS::SmartBA", %"class.UapkiNS::SmartBA", %"class.UapkiNS::SmartBA", %"class.UapkiNS::SmartBA" }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<UapkiNS::Doc::Sign::SigningDoc::CerDataItem *, std::allocator<UapkiNS::Doc::Sign::SigningDoc::CerDataItem *>>::_Vector_impl" }
%"struct.std::_Vector_base<UapkiNS::Doc::Sign::SigningDoc::CerDataItem *, std::allocator<UapkiNS::Doc::Sign::SigningDoc::CerDataItem *>>::_Vector_impl" = type { %"struct.std::_Vector_base<UapkiNS::Doc::Sign::SigningDoc::CerDataItem *, std::allocator<UapkiNS::Doc::Sign::SigningDoc::CerDataItem *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<UapkiNS::Doc::Sign::SigningDoc::CerDataItem *, std::allocator<UapkiNS::Doc::Sign::SigningDoc::CerDataItem *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.18" = type { %"struct.std::_Vector_base.19" }
%"struct.std::_Vector_base.19" = type { %"struct.std::_Vector_base<UapkiNS::Attribute *, std::allocator<UapkiNS::Attribute *>>::_Vector_impl" }
%"struct.std::_Vector_base<UapkiNS::Attribute *, std::allocator<UapkiNS::Attribute *>>::_Vector_impl" = type { %"struct.std::_Vector_base<UapkiNS::Attribute *, std::allocator<UapkiNS::Attribute *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<UapkiNS::Attribute *, std::allocator<UapkiNS::Attribute *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.UapkiNS::Doc::Sign::SigningDoc::SignParams" = type { i32, i8, i8, i32, i32, %"struct.UapkiNS::AlgorithmIdentifier", %"struct.UapkiNS::AlgorithmIdentifier", %"struct.UapkiNS::Doc::Sign::SigningDoc::CerDataItem", %"class.UapkiNS::SmartBA", i8, i8, i8, i8, i8, i8, %"struct.UapkiNS::LibraryConfig::OcspParams", %"struct.UapkiNS::LibraryConfig::TspParams", %"struct.UapkiNS::Attribute", %"struct.UapkiNS::Attribute", %"class.std::vector.3" }
%"struct.UapkiNS::AlgorithmIdentifier" = type { %"class.std::__cxx11::basic_string", ptr }
%"struct.UapkiNS::Doc::Sign::SigningDoc::CerDataItem" = type { ptr, ptr, i8, %"class.UapkiNS::SmartBA", %"class.UapkiNS::SmartBA", %"class.UapkiNS::SmartBA", ptr, ptr }
%"struct.UapkiNS::LibraryConfig::OcspParams" = type { i64 }
%"struct.UapkiNS::LibraryConfig::TspParams" = type { i8, i8, i64, %"class.std::__cxx11::basic_string", %"class.std::vector" }
%"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::Attribute" = type { %"class.std::__cxx11::basic_string", ptr }

@.str = external hidden unnamed_addr constant [19 x i8], align 1
@OID_PKCS7_SIGNED_DATA = external global ptr, align 8

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

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

declare void @stacktrace_add(ptr noundef, i64 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7UapkiNS3Doc4Sign10SigningDoc15buildSignedDataEv(ptr noundef nonnull align 8 dereferenceable(464) %0) #2 align 2 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 2
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = icmp ne ptr %7, null
  br i1 %8, label %10, label %9

9:                                                ; preds = %1
  store i32 4101, ptr %2, align 4
  br label %73

10:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !40
  br label %11

11:                                               ; preds = %10
  %12 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 1
  %13 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 2
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = call noundef i64 @_ZNK7UapkiNS5Pkcs717SignedDataBuilder10SignerInfo10getSidTypeEv(ptr noundef nonnull align 8 dereferenceable(80) %14)
  %16 = icmp eq i64 %15, 1
  %17 = zext i1 %16 to i64
  %18 = select i1 %16, i32 1, i32 3
  %19 = call noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder10setVersionEj(ptr noundef nonnull align 8 dereferenceable(40) %12, i32 noundef %18)
  store i32 %19, ptr %4, align 4, !tbaa !40
  %20 = load i32, ptr %4, align 4, !tbaa !40
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %11
  %23 = load i32, ptr %4, align 4, !tbaa !40
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 312, i32 noundef %23)
  br label %71

24:                                               ; preds = %11
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  br label %27

27:                                               ; preds = %26
  %28 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 1
  %29 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 4
  %30 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !42
  %32 = getelementptr inbounds %"struct.UapkiNS::Doc::Sign::SigningDoc::SignParams", ptr %31, i32 0, i32 9
  %33 = load i8, ptr %32, align 8, !tbaa !43, !range !55, !noundef !56
  %34 = trunc i8 %33 to i1
  br i1 %34, label %35, label %36

35:                                               ; preds = %27
  br label %39

36:                                               ; preds = %27
  %37 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 6
  %38 = call noundef ptr @_ZNK7UapkiNS13ContentHasher15getContentBytesEv(ptr noundef nonnull align 8 dereferenceable(80) %37)
  br label %39

39:                                               ; preds = %36, %35
  %40 = phi ptr [ null, %35 ], [ %38, %36 ]
  %41 = call noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder19setEncapContentInfoERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPK12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(40) %28, ptr noundef nonnull align 8 dereferenceable(32) %29, ptr noundef %40)
  store i32 %41, ptr %4, align 4, !tbaa !40
  %42 = load i32, ptr %4, align 4, !tbaa !40
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %46

44:                                               ; preds = %39
  %45 = load i32, ptr %4, align 4, !tbaa !40
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 313, i32 noundef %45)
  br label %71

46:                                               ; preds = %39
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  br label %49

49:                                               ; preds = %48
  %50 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 2
  %51 = load ptr, ptr %50, align 8, !tbaa !9
  %52 = call noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder10SignerInfo19encodeUnsignedAttrsEv(ptr noundef nonnull align 8 dereferenceable(80) %51)
  store i32 %52, ptr %4, align 4, !tbaa !40
  %53 = load i32, ptr %4, align 4, !tbaa !40
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %57

55:                                               ; preds = %49
  %56 = load i32, ptr %4, align 4, !tbaa !40
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 314, i32 noundef %56)
  br label %71

57:                                               ; preds = %49
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58
  br label %60

60:                                               ; preds = %59
  %61 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 1
  %62 = load ptr, ptr @OID_PKCS7_SIGNED_DATA, align 8, !tbaa !5
  %63 = call noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder6encodeEPKc(ptr noundef nonnull align 8 dereferenceable(40) %61, ptr noundef %62)
  store i32 %63, ptr %4, align 4, !tbaa !40
  %64 = load i32, ptr %4, align 4, !tbaa !40
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %68

66:                                               ; preds = %60
  %67 = load i32, ptr %4, align 4, !tbaa !40
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 316, i32 noundef %67)
  br label %71

68:                                               ; preds = %60
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  br label %71

71:                                               ; preds = %70, %66, %55, %44, %22
  %72 = load i32, ptr %4, align 4, !tbaa !40
  store i32 %72, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %73

73:                                               ; preds = %71, %9
  %74 = load i32, ptr %2, align 4
  ret i32 %74
}

declare noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder10setVersionEj(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) #1

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

declare noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder19setEncapContentInfoERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPK12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #1

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

declare noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder10SignerInfo19encodeUnsignedAttrsEv(ptr noundef nonnull align 8 dereferenceable(80)) #1

declare noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder6encodeEPKc(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 48}
!10 = !{!"_ZTSN7UapkiNS3Doc4Sign10SigningDocE", !6, i64 0, !11, i64 8, !6, i64 48, !16, i64 56, !16, i64 88, !19, i64 120, !20, i64 128, !23, i64 208, !23, i64 216, !23, i64 224, !16, i64 232, !24, i64 264, !32, i64 392, !36, i64 416, !36, i64 440}
!11 = !{!"_ZTSN7UapkiNS5Pkcs717SignedDataBuilderE", !6, i64 0, !12, i64 8, !6, i64 32}
!12 = !{!"_ZTSSt6vectorIPN7UapkiNS5Pkcs717SignedDataBuilder10SignerInfoESaIS4_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIPN7UapkiNS5Pkcs717SignedDataBuilder10SignerInfoESaIS4_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIPN7UapkiNS5Pkcs717SignedDataBuilder10SignerInfoESaIS4_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIPN7UapkiNS5Pkcs717SignedDataBuilder10SignerInfoESaIS4_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !18, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTSN7UapkiNS13ContentHasherE", !21, i64 0, !22, i64 4, !6, i64 8, !19, i64 16, !16, i64 24, !6, i64 56, !18, i64 64, !23, i64 72}
!21 = !{!"_ZTSN7UapkiNS13ContentHasher10SourceTypeE", !7, i64 0}
!22 = !{!"_ZTS7HashAlg", !7, i64 0}
!23 = !{!"_ZTSN7UapkiNS7SmartBAE", !6, i64 0}
!24 = !{!"_ZTSN7UapkiNS5Pkcs716ArchiveTs3HelperE", !6, i64 0, !22, i64 8, !25, i64 16, !31, i64 88, !23, i64 120}
!25 = !{!"_ZTSN7UapkiNS5Pkcs716ArchiveTs3Helper12ATSHashIndexE", !26, i64 0, !26, i64 24, !26, i64 48}
!26 = !{!"_ZTSN7UapkiNS8VectorBAE", !27, i64 0}
!27 = !{!"_ZTSSt6vectorIP12ByteArray_stSaIS1_EE", !28, i64 0}
!28 = !{!"_ZTSSt12_Vector_baseIP12ByteArray_stSaIS1_EE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseIP12ByteArray_stSaIS1_EE12_Vector_implE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseIP12ByteArray_stSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!31 = !{!"_ZTSN7UapkiNS5Pkcs716ArchiveTs3HelperUt_E", !23, i64 0, !23, i64 8, !23, i64 16, !23, i64 24}
!32 = !{!"_ZTSSt6vectorIPN7UapkiNS3Doc4Sign10SigningDoc11CerDataItemESaIS5_EE", !33, i64 0}
!33 = !{!"_ZTSSt12_Vector_baseIPN7UapkiNS3Doc4Sign10SigningDoc11CerDataItemESaIS5_EE", !34, i64 0}
!34 = !{!"_ZTSNSt12_Vector_baseIPN7UapkiNS3Doc4Sign10SigningDoc11CerDataItemESaIS5_EE12_Vector_implE", !35, i64 0}
!35 = !{!"_ZTSNSt12_Vector_baseIPN7UapkiNS3Doc4Sign10SigningDoc11CerDataItemESaIS5_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!36 = !{!"_ZTSSt6vectorIPN7UapkiNS9AttributeESaIS2_EE", !37, i64 0}
!37 = !{!"_ZTSSt12_Vector_baseIPN7UapkiNS9AttributeESaIS2_EE", !38, i64 0}
!38 = !{!"_ZTSNSt12_Vector_baseIPN7UapkiNS9AttributeESaIS2_EE12_Vector_implE", !39, i64 0}
!39 = !{!"_ZTSNSt12_Vector_baseIPN7UapkiNS9AttributeESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!40 = !{!41, !41, i64 0}
!41 = !{!"int", !7, i64 0}
!42 = !{!10, !6, i64 0}
!43 = !{!44, !19, i64 168}
!44 = !{!"_ZTSN7UapkiNS3Doc4Sign10SigningDoc10SignParamsE", !45, i64 0, !19, i64 4, !19, i64 5, !22, i64 8, !22, i64 12, !46, i64 16, !46, i64 56, !47, i64 96, !23, i64 160, !19, i64 168, !19, i64 169, !19, i64 170, !19, i64 171, !19, i64 172, !19, i64 173, !48, i64 176, !49, i64 184, !54, i64 256, !54, i64 296, !32, i64 336}
!45 = !{!"_ZTSN7UapkiNS15SignatureFormatE", !7, i64 0}
!46 = !{!"_ZTSN7UapkiNS19AlgorithmIdentifierE", !16, i64 0, !6, i64 32}
!47 = !{!"_ZTSN7UapkiNS3Doc4Sign10SigningDoc11CerDataItemE", !6, i64 0, !6, i64 8, !19, i64 16, !23, i64 24, !23, i64 32, !23, i64 40, !6, i64 48, !6, i64 56}
!48 = !{!"_ZTSN7UapkiNS13LibraryConfig10OcspParamsE", !18, i64 0}
!49 = !{!"_ZTSN7UapkiNS13LibraryConfig9TspParamsE", !19, i64 0, !19, i64 1, !18, i64 8, !16, i64 16, !50, i64 48}
!50 = !{!"_ZTSSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !51, i64 0}
!51 = !{!"_ZTSSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !52, i64 0}
!52 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE12_Vector_implE", !53, i64 0}
!53 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!54 = !{!"_ZTSN7UapkiNS9AttributeE", !16, i64 0, !6, i64 32}
!55 = !{i8 0, i8 2}
!56 = !{}


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

@.str = external hidden unnamed_addr constant [19 x i8], align 1
@OID_PKCS7_SIGNED_DATA = external local_unnamed_addr global ptr, align 8

declare void @stacktrace_add(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7UapkiNS3Doc4Sign10SigningDoc15buildSignedDataEv(ptr noundef nonnull align 8 dereferenceable(464) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 48
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %32, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = tail call noundef i64 @_ZNK7UapkiNS5Pkcs717SignedDataBuilder10SignerInfo10getSidTypeEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %7 = icmp eq i64 %6, 1
  %8 = select i1 %7, i32 1, i32 3
  %9 = tail call noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder10setVersionEj(ptr noundef nonnull align 8 dereferenceable(40) %5, i32 noundef %8)
  %.not16 = icmp eq i32 %9, 0
  br i1 %.not16, label %11, label %10

10:                                               ; preds = %4
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 312, i32 noundef %9)
  br label %32

11:                                               ; preds = %4
  %12 = getelementptr inbounds i8, ptr %0, i64 88
  %13 = load ptr, ptr %0, align 8, !tbaa !39
  %14 = getelementptr inbounds i8, ptr %13, i64 168
  %15 = load i8, ptr %14, align 8, !tbaa !40, !range !52, !noundef !53
  %16 = trunc nuw i8 %15 to i1
  br i1 %16, label %20, label %17

17:                                               ; preds = %11
  %18 = getelementptr inbounds i8, ptr %0, i64 128
  %19 = tail call noundef ptr @_ZNK7UapkiNS13ContentHasher15getContentBytesEv(ptr noundef nonnull align 8 dereferenceable(80) %18)
  br label %20

20:                                               ; preds = %11, %17
  %21 = phi ptr [ %19, %17 ], [ null, %11 ]
  %22 = tail call noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder19setEncapContentInfoERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPK12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef %21)
  %.not17 = icmp eq i32 %22, 0
  br i1 %.not17, label %24, label %23

23:                                               ; preds = %20
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 313, i32 noundef %22)
  br label %32

24:                                               ; preds = %20
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = tail call noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder10SignerInfo19encodeUnsignedAttrsEv(ptr noundef nonnull align 8 dereferenceable(80) %25)
  %.not18 = icmp eq i32 %26, 0
  br i1 %.not18, label %28, label %27

27:                                               ; preds = %24
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 314, i32 noundef %26)
  br label %32

28:                                               ; preds = %24
  %29 = load ptr, ptr @OID_PKCS7_SIGNED_DATA, align 8, !tbaa !54
  %30 = tail call noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder6encodeEPKc(ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef %29)
  %.not19 = icmp eq i32 %30, 0
  br i1 %.not19, label %32, label %31

31:                                               ; preds = %28
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 316, i32 noundef %30)
  br label %32

32:                                               ; preds = %10, %23, %27, %31, %28, %1
  %.010 = phi i32 [ 4101, %1 ], [ %9, %10 ], [ %22, %23 ], [ %26, %27 ], [ %30, %31 ], [ 0, %28 ]
  ret i32 %.010
}

declare noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder10setVersionEj(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) local_unnamed_addr #0

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

declare noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder19setEncapContentInfoERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPK12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #0

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

declare noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder10SignerInfo19encodeUnsignedAttrsEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0

declare noundef i32 @_ZN7UapkiNS5Pkcs717SignedDataBuilder6encodeEPKc(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) local_unnamed_addr #0

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

!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, !7, i64 48}
!6 = !{!"_ZTSN7UapkiNS3Doc4Sign10SigningDocE", !7, i64 0, !10, i64 8, !7, i64 48, !15, i64 56, !15, i64 88, !18, i64 120, !19, i64 128, !22, i64 208, !22, i64 216, !22, i64 224, !15, i64 232, !23, i64 264, !31, i64 392, !35, i64 416, !35, i64 440}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN7UapkiNS5Pkcs717SignedDataBuilderE", !7, i64 0, !11, i64 8, !7, i64 32}
!11 = !{!"_ZTSSt6vectorIPN7UapkiNS5Pkcs717SignedDataBuilder10SignerInfoESaIS4_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIPN7UapkiNS5Pkcs717SignedDataBuilder10SignerInfoESaIS4_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIPN7UapkiNS5Pkcs717SignedDataBuilder10SignerInfoESaIS4_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIPN7UapkiNS5Pkcs717SignedDataBuilder10SignerInfoESaIS4_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !17, i64 8, !8, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!17 = !{!"long", !8, i64 0}
!18 = !{!"bool", !8, i64 0}
!19 = !{!"_ZTSN7UapkiNS13ContentHasherE", !20, i64 0, !21, i64 4, !7, i64 8, !18, i64 16, !15, i64 24, !7, i64 56, !17, i64 64, !22, i64 72}
!20 = !{!"_ZTSN7UapkiNS13ContentHasher10SourceTypeE", !8, i64 0}
!21 = !{!"_ZTS7HashAlg", !8, i64 0}
!22 = !{!"_ZTSN7UapkiNS7SmartBAE", !7, i64 0}
!23 = !{!"_ZTSN7UapkiNS5Pkcs716ArchiveTs3HelperE", !7, i64 0, !21, i64 8, !24, i64 16, !30, i64 88, !22, i64 120}
!24 = !{!"_ZTSN7UapkiNS5Pkcs716ArchiveTs3Helper12ATSHashIndexE", !25, i64 0, !25, i64 24, !25, i64 48}
!25 = !{!"_ZTSN7UapkiNS8VectorBAE", !26, i64 0}
!26 = !{!"_ZTSSt6vectorIP12ByteArray_stSaIS1_EE", !27, i64 0}
!27 = !{!"_ZTSSt12_Vector_baseIP12ByteArray_stSaIS1_EE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIP12ByteArray_stSaIS1_EE12_Vector_implE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseIP12ByteArray_stSaIS1_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!30 = !{!"_ZTSN7UapkiNS5Pkcs716ArchiveTs3HelperUt_E", !22, i64 0, !22, i64 8, !22, i64 16, !22, i64 24}
!31 = !{!"_ZTSSt6vectorIPN7UapkiNS3Doc4Sign10SigningDoc11CerDataItemESaIS5_EE", !32, i64 0}
!32 = !{!"_ZTSSt12_Vector_baseIPN7UapkiNS3Doc4Sign10SigningDoc11CerDataItemESaIS5_EE", !33, i64 0}
!33 = !{!"_ZTSNSt12_Vector_baseIPN7UapkiNS3Doc4Sign10SigningDoc11CerDataItemESaIS5_EE12_Vector_implE", !34, i64 0}
!34 = !{!"_ZTSNSt12_Vector_baseIPN7UapkiNS3Doc4Sign10SigningDoc11CerDataItemESaIS5_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!35 = !{!"_ZTSSt6vectorIPN7UapkiNS9AttributeESaIS2_EE", !36, i64 0}
!36 = !{!"_ZTSSt12_Vector_baseIPN7UapkiNS9AttributeESaIS2_EE", !37, i64 0}
!37 = !{!"_ZTSNSt12_Vector_baseIPN7UapkiNS9AttributeESaIS2_EE12_Vector_implE", !38, i64 0}
!38 = !{!"_ZTSNSt12_Vector_baseIPN7UapkiNS9AttributeESaIS2_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!39 = !{!6, !7, i64 0}
!40 = !{!41, !18, i64 168}
!41 = !{!"_ZTSN7UapkiNS3Doc4Sign10SigningDoc10SignParamsE", !42, i64 0, !18, i64 4, !18, i64 5, !21, i64 8, !21, i64 12, !43, i64 16, !43, i64 56, !44, i64 96, !22, i64 160, !18, i64 168, !18, i64 169, !18, i64 170, !18, i64 171, !18, i64 172, !18, i64 173, !45, i64 176, !46, i64 184, !51, i64 256, !51, i64 296, !31, i64 336}
!42 = !{!"_ZTSN7UapkiNS15SignatureFormatE", !8, i64 0}
!43 = !{!"_ZTSN7UapkiNS19AlgorithmIdentifierE", !15, i64 0, !7, i64 32}
!44 = !{!"_ZTSN7UapkiNS3Doc4Sign10SigningDoc11CerDataItemE", !7, i64 0, !7, i64 8, !18, i64 16, !22, i64 24, !22, i64 32, !22, i64 40, !7, i64 48, !7, i64 56}
!45 = !{!"_ZTSN7UapkiNS13LibraryConfig10OcspParamsE", !17, i64 0}
!46 = !{!"_ZTSN7UapkiNS13LibraryConfig9TspParamsE", !18, i64 0, !18, i64 1, !17, i64 8, !15, i64 16, !47, i64 48}
!47 = !{!"_ZTSSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !48, i64 0}
!48 = !{!"_ZTSSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !49, i64 0}
!49 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE12_Vector_implE", !50, i64 0}
!50 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!51 = !{!"_ZTSN7UapkiNS9AttributeE", !15, i64 0, !7, i64 32}
!52 = !{i8 0, i8 2}
!53 = !{}
!54 = !{!7, !7, i64 0}


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