; LLVM IR from specinfo-ua/UAPKI :: library/common/pkix (attribute-helper)

; 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" = 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.std::allocator.6" = type { i8 }
%struct.SigningCertificateV2 = type { %"struct.SigningCertificateV2::certs", ptr, %struct.asn_struct_ctx_s }
%"struct.SigningCertificateV2::certs" = type { %struct.anon.10, %struct.asn_struct_ctx_s }
%struct.anon.10 = type { ptr, i32, i32, ptr }
%struct.asn_struct_ctx_s = type { i16, i16, i32, ptr, i64 }
%struct.ESSCertIDv2 = type { ptr, %struct.OCTET_STRING, ptr, %struct.asn_struct_ctx_s }
%struct.OCTET_STRING = type { ptr, i32, %struct.asn_struct_ctx_s }
%"struct.UapkiNS::OtherHash" = type { %"struct.UapkiNS::AlgorithmIdentifier", ptr }
%"struct.UapkiNS::AlgorithmIdentifier" = type { %"class.std::__cxx11::basic_string", ptr }
%struct.IssuerSerial = type { %struct.GeneralNames, %struct.ASN__PRIMITIVE_TYPE_s, ptr, %struct.asn_struct_ctx_s }
%struct.GeneralNames = type { %struct.anon.9, %struct.asn_struct_ctx_s }
%struct.anon.9 = type { ptr, i32, i32, ptr }
%struct.ASN__PRIMITIVE_TYPE_s = type { ptr, i32 }
%"struct.UapkiNS::AttrCertId" = type { %"struct.UapkiNS::OtherHash", %"struct.UapkiNS::AttrCertId::IssuerSerial" }
%"struct.UapkiNS::AttrCertId::IssuerSerial" = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [33 x i8], align 1
@OID_SHA256 = 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

declare ptr @asn_decode_ba_with_alloc(ptr noundef, ptr noundef) #1

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

declare i32 @asn_encode_ba(ptr noundef, ptr noundef, ptr noundef) #1

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

declare void @asn_free(ptr noundef, ptr noundef) #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIN7UapkiNS10AttrCertIdESaIS1_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_cxxneIPN7UapkiNS10AttrCertIdESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(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(64) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7UapkiNS10AttrCertIdESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

declare i32 @asn_OCTSTRING2ba(ptr noundef, ptr noundef) #1

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

declare ptr @get_GeneralNames_desc() #1

declare i32 @asn_INTEGER2ba(ptr noundef, ptr noundef) #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7UapkiNS15AttributeHelper24decodeSigningCertificateEPK12ByteArray_stRSt6vectorINS_10AttrCertIdESaIS5_EE(ptr noundef %0, ptr noundef nonnull align 8 dereferenceable(24) %1) #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %"class.std::__cxx11::basic_string", align 8
  %16 = alloca %"class.std::allocator.6", align 1
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr null, ptr %7, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %2
  %20 = call ptr @get_SigningCertificateV2_desc()
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = call ptr @asn_decode_ba_with_alloc(ptr noundef %20, ptr noundef %21)
  store ptr %22, ptr %7, align 8, !tbaa !5
  %23 = icmp eq ptr null, %22
  br i1 %23, label %24, label %26

24:                                               ; preds = %19
  store i32 2, ptr %6, align 4, !tbaa !9
  %25 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 209, i32 noundef %25)
  br label %162

26:                                               ; preds = %19
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.SigningCertificateV2, ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds %"struct.SigningCertificateV2::certs", ptr %30, i32 0, i32 0
  %32 = getelementptr inbounds %struct.anon.10, ptr %31, i32 0, i32 1
  %33 = load i32, ptr %32, align 8, !tbaa !11
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %35, label %161

35:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 0, ptr %8, align 8, !tbaa !18
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.SigningCertificateV2, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds %"struct.SigningCertificateV2::certs", ptr %38, i32 0, i32 0
  %40 = getelementptr inbounds %struct.anon.10, ptr %39, i32 0, i32 1
  %41 = load i32, ptr %40, align 8, !tbaa !11
  %42 = sext i32 %41 to i64
  call void @_ZNSt6vectorIN7UapkiNS10AttrCertIdESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %36, i64 noundef %42)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %43, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = call ptr @_ZNSt6vectorIN7UapkiNS10AttrCertIdESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %44) #5
  %46 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %45, ptr %46, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = call ptr @_ZNSt6vectorIN7UapkiNS10AttrCertIdESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %47) #5
  %49 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  store ptr %48, ptr %49, align 8
  br label %50

50:                                               ; preds = %153, %35
  %51 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPN7UapkiNS10AttrCertIdESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #5
  br i1 %51, label %53, label %52

52:                                               ; preds = %50
  store i32 5, ptr %12, align 4
  br label %155

53:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %54 = call noundef nonnull align 8 dereferenceable(64) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7UapkiNS10AttrCertIdESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #5
  store ptr %54, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.SigningCertificateV2, ptr %55, i32 0, i32 0
  %57 = getelementptr inbounds %"struct.SigningCertificateV2::certs", ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds %struct.anon.10, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  %60 = load i64, ptr %8, align 8, !tbaa !18
  %61 = add i64 %60, 1
  store i64 %61, ptr %8, align 8, !tbaa !18
  %62 = getelementptr inbounds ptr, ptr %59, i64 %60
  %63 = load ptr, ptr %62, align 8, !tbaa !5
  store ptr %63, ptr %14, align 8, !tbaa !5
  %64 = load ptr, ptr %14, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.ESSCertIDv2, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !20
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %83

68:                                               ; preds = %53
  br label %69

69:                                               ; preds = %68
  %70 = load ptr, ptr %14, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.ESSCertIDv2, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !20
  %73 = load ptr, ptr %13, align 8, !tbaa !5
  %74 = getelementptr inbounds %"struct.UapkiNS::OtherHash", ptr %73, i32 0, i32 0
  %75 = call noundef i32 @_ZN7UapkiNS4Util27algorithmIdentifierFromAsn1ERK19AlgorithmIdentifierRNS_19AlgorithmIdentifierE(ptr noundef nonnull align 8 dereferenceable(48) %72, ptr noundef nonnull align 8 dereferenceable(40) %74)
  store i32 %75, ptr %6, align 4, !tbaa !9
  %76 = load i32, ptr %6, align 4, !tbaa !9
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %80

78:                                               ; preds = %69
  %79 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 219, i32 noundef %79)
  store i32 4, ptr %12, align 4
  br label %147

80:                                               ; preds = %69
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81
  br label %94

83:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #5
  %84 = load ptr, ptr @OID_SHA256, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef %84, ptr noundef nonnull align 1 dereferenceable(1) %16)
          to label %85 unwind label %90

85:                                               ; preds = %83
  %86 = load ptr, ptr %13, align 8, !tbaa !5
  %87 = getelementptr inbounds %"struct.UapkiNS::OtherHash", ptr %86, i32 0, i32 0
  %88 = getelementptr inbounds %"struct.UapkiNS::AlgorithmIdentifier", ptr %87, i32 0, i32 0
  %89 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %88, ptr noundef nonnull align 8 dereferenceable(32) %15) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #5
  br label %94

90:                                               ; preds = %83
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %17, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %18, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %168

94:                                               ; preds = %85, %82
  br label %95

95:                                               ; preds = %94
  %96 = load ptr, ptr %14, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.ESSCertIDv2, ptr %96, i32 0, i32 1
  %98 = load ptr, ptr %13, align 8, !tbaa !5
  %99 = getelementptr inbounds %"struct.UapkiNS::OtherHash", ptr %98, i32 0, i32 1
  %100 = call i32 @asn_OCTSTRING2ba(ptr noundef %97, ptr noundef %99)
  store i32 %100, ptr %6, align 4, !tbaa !9
  %101 = load i32, ptr %6, align 4, !tbaa !9
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %105

103:                                              ; preds = %95
  %104 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 225, i32 noundef %104)
  store i32 4, ptr %12, align 4
  br label %147

105:                                              ; preds = %95
  br label %106

106:                                              ; preds = %105
  br label %107

107:                                              ; preds = %106
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.ESSCertIDv2, ptr %108, i32 0, i32 2
  %110 = load ptr, ptr %109, align 8, !tbaa !23
  %111 = icmp ne ptr %110, null
  br i1 %111, label %112, label %146

112:                                              ; preds = %107
  br label %113

113:                                              ; preds = %112
  %114 = call ptr @get_GeneralNames_desc()
  %115 = load ptr, ptr %14, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.ESSCertIDv2, ptr %115, i32 0, i32 2
  %117 = load ptr, ptr %116, align 8, !tbaa !23
  %118 = getelementptr inbounds %struct.IssuerSerial, ptr %117, i32 0, i32 0
  %119 = load ptr, ptr %13, align 8, !tbaa !5
  %120 = getelementptr inbounds %"struct.UapkiNS::AttrCertId", ptr %119, i32 0, i32 1
  %121 = getelementptr inbounds %"struct.UapkiNS::AttrCertId::IssuerSerial", ptr %120, i32 0, i32 0
  %122 = call i32 @asn_encode_ba(ptr noundef %114, ptr noundef %118, ptr noundef %121)
  store i32 %122, ptr %6, align 4, !tbaa !9
  %123 = load i32, ptr %6, align 4, !tbaa !9
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %127

125:                                              ; preds = %113
  %126 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 229, i32 noundef %126)
  store i32 4, ptr %12, align 4
  br label %147

127:                                              ; preds = %113
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128
  br label %130

130:                                              ; preds = %129
  %131 = load ptr, ptr %14, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.ESSCertIDv2, ptr %131, i32 0, i32 2
  %133 = load ptr, ptr %132, align 8, !tbaa !23
  %134 = getelementptr inbounds %struct.IssuerSerial, ptr %133, i32 0, i32 1
  %135 = load ptr, ptr %13, align 8, !tbaa !5
  %136 = getelementptr inbounds %"struct.UapkiNS::AttrCertId", ptr %135, i32 0, i32 1
  %137 = getelementptr inbounds %"struct.UapkiNS::AttrCertId::IssuerSerial", ptr %136, i32 0, i32 1
  %138 = call i32 @asn_INTEGER2ba(ptr noundef %134, ptr noundef %137)
  store i32 %138, ptr %6, align 4, !tbaa !9
  %139 = load i32, ptr %6, align 4, !tbaa !9
  %140 = icmp ne i32 %139, 0
  br i1 %140, label %141, label %143

141:                                              ; preds = %130
  %142 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 231, i32 noundef %142)
  store i32 4, ptr %12, align 4
  br label %147

143:                                              ; preds = %130
  br label %144

144:                                              ; preds = %143
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145, %107
  store i32 0, ptr %12, align 4
  br label %147

147:                                              ; preds = %146, %141, %125, %103, %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %148 = load i32, ptr %12, align 4
  switch i32 %148, label %150 [
    i32 0, label %149
  ]

149:                                              ; preds = %147
  store i32 0, ptr %12, align 4
  br label %150

150:                                              ; preds = %149, %147
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  %151 = load i32, ptr %12, align 4
  switch i32 %151, label %155 [
    i32 0, label %152
  ]

152:                                              ; preds = %150
  br label %153

153:                                              ; preds = %152
  %154 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPN7UapkiNS10AttrCertIdESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #5
  br label %50

155:                                              ; preds = %150, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  %156 = load i32, ptr %12, align 4
  switch i32 %156, label %158 [
    i32 5, label %157
  ]

157:                                              ; preds = %155
  store i32 0, ptr %12, align 4
  br label %158

158:                                              ; preds = %157, %155
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %159 = load i32, ptr %12, align 4
  switch i32 %159, label %166 [
    i32 0, label %160
    i32 4, label %162
  ]

160:                                              ; preds = %158
  br label %161

161:                                              ; preds = %160, %28
  br label %162

162:                                              ; preds = %161, %158, %24
  %163 = call ptr @get_SigningCertificateV2_desc()
  %164 = load ptr, ptr %7, align 8, !tbaa !5
  call void @asn_free(ptr noundef %163, ptr noundef %164)
  %165 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %165, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %166

166:                                              ; preds = %162, %158
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %167 = load i32, ptr %3, align 4
  ret i32 %167

168:                                              ; preds = %90
  %169 = load ptr, ptr %17, align 8
  %170 = load i32, ptr %18, align 4
  %171 = insertvalue { ptr, i32 } poison, ptr %169, 0
  %172 = insertvalue { ptr, i32 } %171, i32 %170, 1
  resume { ptr, i32 } %172
}

declare ptr @get_SigningCertificateV2_desc() #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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTS20SigningCertificateV2", !13, i64 0, !6, i64 48, !15, i64 56}
!13 = !{!"_ZTSN20SigningCertificateV25certsE", !14, i64 0, !15, i64 24}
!14 = !{!"_ZTSN20SigningCertificateV25certsUt_E", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16}
!15 = !{!"_ZTS16asn_struct_ctx_s", !16, i64 0, !16, i64 2, !10, i64 4, !6, i64 8, !17, i64 16}
!16 = !{!"short", !7, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!17, !17, i64 0}
!19 = !{!12, !6, i64 0}
!20 = !{!21, !6, i64 0}
!21 = !{!"_ZTS11ESSCertIDv2", !6, i64 0, !22, i64 8, !6, i64 48, !15, i64 56}
!22 = !{!"_ZTS12OCTET_STRING", !6, i64 0, !10, i64 8, !15, i64 16}
!23 = !{!21, !6, i64 48}


; 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" = 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.std::allocator.6" = type { i8 }

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

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

declare ptr @asn_decode_ba_with_alloc(ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare i32 @asn_encode_ba(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare void @asn_free(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIN7UapkiNS10AttrCertIdESaIS1_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_cxxneIPN7UapkiNS10AttrCertIdESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(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(64) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7UapkiNS10AttrCertIdESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

declare i32 @asn_OCTSTRING2ba(ptr noundef, ptr noundef) local_unnamed_addr #1

declare noundef i32 @_ZN7UapkiNS4Util27algorithmIdentifierFromAsn1ERK19AlgorithmIdentifierRNS_19AlgorithmIdentifierE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #1

declare ptr @get_GeneralNames_desc() local_unnamed_addr #1

declare i32 @asn_INTEGER2ba(ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7UapkiNS15AttributeHelper24decodeSigningCertificateEPK12ByteArray_stRSt6vectorINS_10AttrCertIdESaIS5_EE(ptr noundef %0, ptr noundef nonnull align 8 dereferenceable(24) %1) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::allocator.6", align 1
  %7 = tail call ptr @get_SigningCertificateV2_desc()
  %8 = tail call ptr @asn_decode_ba_with_alloc(ptr noundef %7, ptr noundef %0)
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %2
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 209, i32 noundef 2)
  br label %58

11:                                               ; preds = %2
  %12 = getelementptr inbounds i8, ptr %8, i64 8
  %13 = load i32, ptr %12, align 8, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %15, label %58

15:                                               ; preds = %11
  %16 = zext nneg i32 %13 to i64
  tail call void @_ZNSt6vectorIN7UapkiNS10AttrCertIdESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %16)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %17 = tail call ptr @_ZNSt6vectorIN7UapkiNS10AttrCertIdESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #5
  store ptr %17, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %18 = tail call ptr @_ZNSt6vectorIN7UapkiNS10AttrCertIdESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #5
  store ptr %18, ptr %4, align 8
  %19 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPN7UapkiNS10AttrCertIdESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  br i1 %19, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %15, %55
  %.04166 = phi i64 [ %22, %55 ], [ 0, %15 ]
  %20 = call noundef nonnull align 8 dereferenceable(64) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPN7UapkiNS10AttrCertIdESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %21 = load ptr, ptr %8, align 8, !tbaa !16
  %22 = add i64 %.04166, 1
  %23 = getelementptr inbounds ptr, ptr %21, i64 %.04166
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  %25 = load ptr, ptr %24, align 8, !tbaa !18
  %.not = icmp eq ptr %25, null
  br i1 %.not, label %29, label %26

26:                                               ; preds = %.lr.ph
  %27 = call noundef i32 @_ZN7UapkiNS4Util27algorithmIdentifierFromAsn1ERK19AlgorithmIdentifierRNS_19AlgorithmIdentifierE(ptr noundef nonnull align 8 dereferenceable(48) %25, ptr noundef nonnull align 8 dereferenceable(40) %20)
  %.not53 = icmp eq i32 %27, 0
  br i1 %.not53, label %35, label %28

28:                                               ; preds = %26
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 219, i32 noundef %27)
  br label %.thread

29:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  %30 = load ptr, ptr @OID_SHA256, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef %30, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %31 unwind label %33

31:                                               ; preds = %29
  %32 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %20, ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  br label %35

33:                                               ; preds = %29
  %34 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  resume { ptr, i32 } %34

35:                                               ; preds = %31, %26
  %36 = getelementptr inbounds i8, ptr %24, i64 8
  %37 = getelementptr inbounds i8, ptr %20, i64 40
  %38 = call i32 @asn_OCTSTRING2ba(ptr noundef nonnull %36, ptr noundef nonnull %37)
  %.not54 = icmp eq i32 %38, 0
  br i1 %.not54, label %40, label %39

39:                                               ; preds = %35
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 225, i32 noundef %38)
  br label %.thread

40:                                               ; preds = %35
  %41 = getelementptr inbounds i8, ptr %24, i64 48
  %42 = load ptr, ptr %41, align 8, !tbaa !21
  %.not55 = icmp eq ptr %42, null
  br i1 %.not55, label %55, label %43

43:                                               ; preds = %40
  %44 = call ptr @get_GeneralNames_desc()
  %45 = load ptr, ptr %41, align 8, !tbaa !21
  %46 = getelementptr inbounds i8, ptr %20, i64 48
  %47 = call i32 @asn_encode_ba(ptr noundef %44, ptr noundef %45, ptr noundef nonnull %46)
  %.not56 = icmp eq i32 %47, 0
  br i1 %.not56, label %49, label %48

48:                                               ; preds = %43
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 229, i32 noundef %47)
  br label %.thread

49:                                               ; preds = %43
  %50 = load ptr, ptr %41, align 8, !tbaa !21
  %51 = getelementptr inbounds i8, ptr %50, i64 48
  %52 = getelementptr inbounds i8, ptr %20, i64 56
  %53 = call i32 @asn_INTEGER2ba(ptr noundef nonnull %51, ptr noundef nonnull %52)
  %.not57 = icmp eq i32 %53, 0
  br i1 %.not57, label %55, label %54

54:                                               ; preds = %49
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 231, i32 noundef %53)
  br label %.thread

55:                                               ; preds = %49, %40
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPN7UapkiNS10AttrCertIdESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %57 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPN7UapkiNS10AttrCertIdESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  br i1 %57, label %.lr.ph, label %.thread

.thread:                                          ; preds = %55, %15, %54, %48, %39, %28
  %.3 = phi i32 [ %53, %54 ], [ %47, %48 ], [ %38, %39 ], [ %27, %28 ], [ 0, %15 ], [ 0, %55 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %58

58:                                               ; preds = %.thread, %11, %10
  %.4 = phi i32 [ 2, %10 ], [ %.3, %.thread ], [ 0, %11 ]
  %59 = call ptr @get_SigningCertificateV2_desc()
  call void @asn_free(ptr noundef %59, ptr noundef %8)
  ret i32 %.4
}

declare ptr @get_SigningCertificateV2_desc() local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { 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, !12, i64 8}
!6 = !{!"_ZTS20SigningCertificateV2", !7, i64 0, !9, i64 48, !13, i64 56}
!7 = !{!"_ZTSN20SigningCertificateV25certsE", !8, i64 0, !13, i64 24}
!8 = !{!"_ZTSN20SigningCertificateV25certsUt_E", !9, i64 0, !12, i64 8, !12, i64 12, !9, i64 16}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!"_ZTS16asn_struct_ctx_s", !14, i64 0, !14, i64 2, !12, i64 4, !9, i64 8, !15, i64 16}
!14 = !{!"short", !10, i64 0}
!15 = !{!"long", !10, i64 0}
!16 = !{!6, !9, i64 0}
!17 = !{!9, !9, i64 0}
!18 = !{!19, !9, i64 0}
!19 = !{!"_ZTS11ESSCertIDv2", !9, i64 0, !20, i64 8, !9, i64 48, !13, i64 56}
!20 = !{!"_ZTS12OCTET_STRING", !9, i64 0, !12, i64 8, !13, i64 16}
!21 = !{!19, !9, i64 48}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass