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

; 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

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

declare ptr @ba_copy_with_alloc(ptr noundef, i64 noundef, i64 noundef) #1

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7UapkiNS3Doc4Sign10SigningDoc13digestMessageEv(ptr noundef nonnull align 8 dereferenceable(464) %0) #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !9
  %6 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 5
  %7 = load i8, ptr %6, align 8, !tbaa !11, !range !42, !noundef !43
  %8 = trunc i8 %7 to i1
  br i1 %8, label %31, label %9

9:                                                ; preds = %1
  br label %10

10:                                               ; preds = %9
  %11 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 6
  %12 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !44
  %14 = getelementptr inbounds %"struct.UapkiNS::Doc::Sign::SigningDoc::SignParams", ptr %13, i32 0, i32 3
  %15 = load i32, ptr %14, align 8, !tbaa !45
  %16 = call noundef i32 @_ZN7UapkiNS13ContentHasher6digestE7HashAlg(ptr noundef nonnull align 8 dereferenceable(80) %11, i32 noundef %15)
  store i32 %16, ptr %3, align 4, !tbaa !9
  %17 = load i32, ptr %3, align 4, !tbaa !9
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %21

19:                                               ; preds = %10
  %20 = load i32, ptr %3, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 379, i32 noundef %20)
  br label %53

21:                                               ; preds = %10
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  %24 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 7
  %25 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 6
  %26 = call noundef ptr @_ZNK7UapkiNS13ContentHasher12getHashValueEv(ptr noundef nonnull align 8 dereferenceable(80) %25)
  %27 = call ptr @ba_copy_with_alloc(ptr noundef %26, i64 noundef 0, i64 noundef 0)
  %28 = call noundef zeroext i1 @_ZN7UapkiNS7SmartBA3setEP12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef %27)
  br i1 %28, label %30, label %29

29:                                               ; preds = %23
  store i32 4097, ptr %3, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %29, %23
  br label %52

31:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %32 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !44
  %34 = getelementptr inbounds %"struct.UapkiNS::Doc::Sign::SigningDoc::SignParams", ptr %33, i32 0, i32 3
  %35 = load i32, ptr %34, align 8, !tbaa !45
  %36 = call i64 @hash_get_size(i32 noundef %35)
  store i64 %36, ptr %4, align 8, !tbaa !57
  %37 = load i64, ptr %4, align 8, !tbaa !57
  %38 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 6
  %39 = call noundef ptr @_ZNK7UapkiNS13ContentHasher15getContentBytesEv(ptr noundef nonnull align 8 dereferenceable(80) %38)
  %40 = call i64 @ba_get_len(ptr noundef %39)
  %41 = icmp eq i64 %37, %40
  br i1 %41, label %42, label %50

42:                                               ; preds = %31
  %43 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 7
  %44 = getelementptr inbounds %"class.UapkiNS::Doc::Sign::SigningDoc", ptr %5, i32 0, i32 6
  %45 = call noundef ptr @_ZNK7UapkiNS13ContentHasher15getContentBytesEv(ptr noundef nonnull align 8 dereferenceable(80) %44)
  %46 = call ptr @ba_copy_with_alloc(ptr noundef %45, i64 noundef 0, i64 noundef 0)
  %47 = call noundef zeroext i1 @_ZN7UapkiNS7SmartBA3setEP12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(8) %43, ptr noundef %46)
  br i1 %47, label %49, label %48

48:                                               ; preds = %42
  store i32 4097, ptr %3, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %48, %42
  br label %51

50:                                               ; preds = %31
  store i32 4101, ptr %3, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %50, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %52

52:                                               ; preds = %51, %30
  br label %53

53:                                               ; preds = %52, %19
  %54 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret i32 %54
}

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

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

declare i64 @hash_get_size(i32 noundef) #1

declare i64 @ba_get_len(ptr noundef) #1

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

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

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

declare ptr @ba_copy_with_alloc(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7UapkiNS3Doc4Sign10SigningDoc13digestMessageEv(ptr noundef nonnull align 8 dereferenceable(464) %0) local_unnamed_addr #2 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 120
  %3 = load i8, ptr %2, align 8, !tbaa !5, !range !39, !noundef !40
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %17, label %5

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 128
  %7 = load ptr, ptr %0, align 8, !tbaa !41
  %8 = getelementptr inbounds i8, ptr %7, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !42
  %10 = tail call noundef i32 @_ZN7UapkiNS13ContentHasher6digestE7HashAlg(ptr noundef nonnull align 8 dereferenceable(80) %6, i32 noundef %9)
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %12, label %11

11:                                               ; preds = %5
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 379, i32 noundef %10)
  br label %31

12:                                               ; preds = %5
  %13 = getelementptr inbounds i8, ptr %0, i64 208
  %14 = tail call noundef ptr @_ZNK7UapkiNS13ContentHasher12getHashValueEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
  %15 = tail call ptr @ba_copy_with_alloc(ptr noundef %14, i64 noundef 0, i64 noundef 0)
  %16 = tail call noundef zeroext i1 @_ZN7UapkiNS7SmartBA3setEP12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef %15)
  %spec.select = select i1 %16, i32 0, i32 4097
  br label %31

17:                                               ; preds = %1
  %18 = load ptr, ptr %0, align 8, !tbaa !41
  %19 = getelementptr inbounds i8, ptr %18, i64 8
  %20 = load i32, ptr %19, align 8, !tbaa !42
  %21 = tail call i64 @hash_get_size(i32 noundef %20)
  %22 = getelementptr inbounds i8, ptr %0, i64 128
  %23 = tail call noundef ptr @_ZNK7UapkiNS13ContentHasher15getContentBytesEv(ptr noundef nonnull align 8 dereferenceable(80) %22)
  %24 = tail call i64 @ba_get_len(ptr noundef %23)
  %25 = icmp eq i64 %21, %24
  br i1 %25, label %26, label %31

26:                                               ; preds = %17
  %27 = getelementptr inbounds i8, ptr %0, i64 208
  %28 = tail call noundef ptr @_ZNK7UapkiNS13ContentHasher15getContentBytesEv(ptr noundef nonnull align 8 dereferenceable(80) %22)
  %29 = tail call ptr @ba_copy_with_alloc(ptr noundef %28, i64 noundef 0, i64 noundef 0)
  %30 = tail call noundef zeroext i1 @_ZN7UapkiNS7SmartBA3setEP12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef %29)
  %spec.select6 = select i1 %30, i32 0, i32 4097
  br label %31

31:                                               ; preds = %26, %12, %17, %11
  %.1 = phi i32 [ %10, %11 ], [ %spec.select, %12 ], [ %spec.select6, %26 ], [ 4101, %17 ]
  ret i32 %.1
}

declare noundef i32 @_ZN7UapkiNS13ContentHasher6digestE7HashAlg(ptr noundef nonnull align 8 dereferenceable(80), i32 noundef) local_unnamed_addr #1

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

declare i64 @hash_get_size(i32 noundef) local_unnamed_addr #1

declare i64 @ba_get_len(ptr noundef) local_unnamed_addr #1

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

!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, !18, i64 120}
!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 = !{i8 0, i8 2}
!40 = !{}
!41 = !{!6, !7, i64 0}
!42 = !{!43, !21, i64 8}
!43 = !{!"_ZTSN7UapkiNS3Doc4Sign10SigningDoc10SignParamsE", !44, i64 0, !18, i64 4, !18, i64 5, !21, i64 8, !21, i64 12, !45, i64 16, !45, i64 56, !46, i64 96, !22, i64 160, !18, i64 168, !18, i64 169, !18, i64 170, !18, i64 171, !18, i64 172, !18, i64 173, !47, i64 176, !48, i64 184, !53, i64 256, !53, i64 296, !31, i64 336}
!44 = !{!"_ZTSN7UapkiNS15SignatureFormatE", !8, i64 0}
!45 = !{!"_ZTSN7UapkiNS19AlgorithmIdentifierE", !15, i64 0, !7, i64 32}
!46 = !{!"_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}
!47 = !{!"_ZTSN7UapkiNS13LibraryConfig10OcspParamsE", !17, i64 0}
!48 = !{!"_ZTSN7UapkiNS13LibraryConfig9TspParamsE", !18, i64 0, !18, i64 1, !17, i64 8, !15, i64 16, !49, i64 48}
!49 = !{!"_ZTSSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !50, i64 0}
!50 = !{!"_ZTSSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !51, i64 0}
!51 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE12_Vector_implE", !52, i64 0}
!52 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!53 = !{!"_ZTSN7UapkiNS9AttributeE", !15, i64 0, !7, i64 32}


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