; LLVM IR from specinfo-ua/UAPKI :: library/uapki/src (store-json)

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

%"struct.UapkiNS::AlgorithmIdentifier" = type { %"class.std::__cxx11::basic_string", 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::SmartBA" = type { ptr }
%struct.Certificate = type { %struct.TBSCertificate, %struct.AlgorithmIdentifier, %struct.BIT_STRING_s, %struct.asn_struct_ctx_s }
%struct.TBSCertificate = type { ptr, %struct.ASN__PRIMITIVE_TYPE_s, %struct.AlgorithmIdentifier, %struct.Name, %struct.Validity, %struct.Name, %struct.SubjectPublicKeyInfo, ptr, ptr, ptr, %struct.asn_struct_ctx_s }
%struct.ASN__PRIMITIVE_TYPE_s = type { ptr, i32 }
%struct.Validity = type { %struct.PKIXTime, %struct.PKIXTime, %struct.asn_struct_ctx_s }
%struct.PKIXTime = type { i32, %"union.PKIXTime::PKIXTime_u", %struct.asn_struct_ctx_s }
%"union.PKIXTime::PKIXTime_u" = type { %struct.OCTET_STRING }
%struct.OCTET_STRING = type { ptr, i32, %struct.asn_struct_ctx_s }
%struct.Name = type { i32, %"union.Name::Name_u", %struct.asn_struct_ctx_s }
%"union.Name::Name_u" = type { %struct.RDNSequence }
%struct.RDNSequence = type { %struct.anon, %struct.asn_struct_ctx_s }
%struct.anon = type { ptr, i32, i32, ptr }
%struct.SubjectPublicKeyInfo = type { %struct.AlgorithmIdentifier, %struct.BIT_STRING_s, %struct.asn_struct_ctx_s }
%struct.AlgorithmIdentifier = type { %struct.ASN__PRIMITIVE_TYPE_s, ptr, %struct.asn_struct_ctx_s }
%struct.BIT_STRING_s = type { ptr, i32, i32, %struct.asn_struct_ctx_s }
%struct.asn_struct_ctx_s = type { i16, i16, i32, ptr, i64 }

@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [10 x i8], align 1

; 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 nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7UapkiNS4Cert10spkiToJsonEP13json_object_tPKNS0_7CerItemEb(ptr noundef %0, ptr noundef %1, i1 noundef zeroext %2) #3 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %"struct.UapkiNS::AlgorithmIdentifier", align 8
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"class.UapkiNS::SmartBA", align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  %15 = zext i1 %2 to i8
  store i8 %15, ptr %7, align 1, !tbaa !9
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %21

18:                                               ; preds = %3
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %22, label %21

21:                                               ; preds = %18, %3
  store i32 4097, ptr %4, align 4
  br label %154

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = call noundef ptr @_ZNK7UapkiNS4Cert7CerItem7getCertEv(ptr noundef nonnull align 8 dereferenceable(401) %23)
  %25 = getelementptr inbounds %struct.Certificate, ptr %24, i32 0, i32 0
  %26 = getelementptr inbounds %struct.TBSCertificate, ptr %25, i32 0, i32 6
  store ptr %26, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #4
  invoke void @_ZN7UapkiNS19AlgorithmIdentifierC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPK12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(40) %10, ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef null)
          to label %27 unwind label %39

27:                                               ; preds = %22
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  invoke void @_ZN7UapkiNS7SmartBAC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %28 unwind label %43

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.SubjectPublicKeyInfo, ptr %30, i32 0, i32 0
  %32 = invoke noundef i32 @_ZN7UapkiNS4Util27algorithmIdentifierFromAsn1ERK19AlgorithmIdentifierRNS_19AlgorithmIdentifierE(ptr noundef nonnull align 8 dereferenceable(48) %31, ptr noundef nonnull align 8 dereferenceable(40) %10)
          to label %33 unwind label %47

33:                                               ; preds = %29
  store i32 %32, ptr %8, align 4, !tbaa !11
  %34 = load i32, ptr %8, align 4, !tbaa !11
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %51

36:                                               ; preds = %33
  %37 = load i32, ptr %8, align 4, !tbaa !11
  invoke void @stacktrace_add(ptr noundef @.str.3, i64 noundef 426, i32 noundef %37)
          to label %38 unwind label %47

38:                                               ; preds = %36
  br label %150

39:                                               ; preds = %22
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %12, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %13, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #4
  br label %153

43:                                               ; preds = %27
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %12, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %13, align 4
  br label %152

47:                                               ; preds = %144, %139, %136, %129, %121, %108, %102, %97, %93, %83, %78, %74, %67, %62, %58, %53, %36, %29
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %12, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %13, align 4
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #4
  br label %152

51:                                               ; preds = %33
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  %54 = getelementptr inbounds %"struct.UapkiNS::AlgorithmIdentifier", ptr %10, i32 0, i32 0
  %55 = invoke noundef zeroext i1 @_ZN6DstuNS16isDstu4145familyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %54)
          to label %56 unwind label %47

56:                                               ; preds = %53
  br i1 %55, label %57, label %73

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.SubjectPublicKeyInfo, ptr %59, i32 0, i32 1
  %61 = invoke noundef ptr @_ZN7UapkiNS7SmartBAadEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %62 unwind label %47

62:                                               ; preds = %58
  %63 = invoke noundef i32 @_ZN7UapkiNS4Util27bitStringEncapOctetFromAsn1EPK12BIT_STRING_sPP12ByteArray_st(ptr noundef %60, ptr noundef %61)
          to label %64 unwind label %47

64:                                               ; preds = %62
  store i32 %63, ptr %8, align 4, !tbaa !11
  %65 = load i32, ptr %8, align 4, !tbaa !11
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %70

67:                                               ; preds = %64
  %68 = load i32, ptr %8, align 4, !tbaa !11
  invoke void @stacktrace_add(ptr noundef @.str.3, i64 noundef 428, i32 noundef %68)
          to label %69 unwind label %47

69:                                               ; preds = %67
  br label %150

70:                                               ; preds = %64
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71
  br label %89

73:                                               ; preds = %56
  br label %74

74:                                               ; preds = %73
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.SubjectPublicKeyInfo, ptr %75, i32 0, i32 1
  %77 = invoke noundef ptr @_ZN7UapkiNS7SmartBAadEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %78 unwind label %47

78:                                               ; preds = %74
  %79 = invoke i32 @asn_BITSTRING2ba(ptr noundef %76, ptr noundef %77)
          to label %80 unwind label %47

80:                                               ; preds = %78
  store i32 %79, ptr %8, align 4, !tbaa !11
  %81 = load i32, ptr %8, align 4, !tbaa !11
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %86

83:                                               ; preds = %80
  %84 = load i32, ptr %8, align 4, !tbaa !11
  invoke void @stacktrace_add(ptr noundef @.str.3, i64 noundef 431, i32 noundef %84)
          to label %85 unwind label %47

85:                                               ; preds = %83
  br label %150

86:                                               ; preds = %80
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88, %72
  %90 = load i8, ptr %7, align 1, !tbaa !9, !range !13, !noundef !14
  %91 = trunc i8 %90 to i1
  br i1 %91, label %92, label %108

92:                                               ; preds = %89
  br label %93

93:                                               ; preds = %92
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = invoke noundef ptr @_ZNK7UapkiNS4Cert7CerItem7getSpkiEv(ptr noundef nonnull align 8 dereferenceable(401) %95)
          to label %97 unwind label %47

97:                                               ; preds = %93
  %98 = invoke i32 @json_object_set_base64(ptr noundef %94, ptr noundef @.str.36, ptr noundef %96)
          to label %99 unwind label %47

99:                                               ; preds = %97
  store i32 %98, ptr %8, align 4, !tbaa !11
  %100 = load i32, ptr %8, align 4, !tbaa !11
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %105

102:                                              ; preds = %99
  %103 = load i32, ptr %8, align 4, !tbaa !11
  invoke void @stacktrace_add(ptr noundef @.str.3, i64 noundef 435, i32 noundef %103)
          to label %104 unwind label %47

104:                                              ; preds = %102
  br label %150

105:                                              ; preds = %99
  br label %106

106:                                              ; preds = %105
  br label %107

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107, %89
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds %"struct.UapkiNS::AlgorithmIdentifier", ptr %10, i32 0, i32 0
  %111 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %110) #4
  %112 = invoke i32 @json_object_set_string(ptr noundef %109, ptr noundef @.str.33, ptr noundef %111)
          to label %113 unwind label %47

113:                                              ; preds = %108
  %114 = icmp ne i32 %112, 0
  br i1 %114, label %115, label %116

115:                                              ; preds = %113
  store i32 4113, ptr %8, align 4, !tbaa !11
  br label %150

116:                                              ; preds = %113
  %117 = getelementptr inbounds %"struct.UapkiNS::AlgorithmIdentifier", ptr %10, i32 0, i32 1
  %118 = load ptr, ptr %117, align 8, !tbaa !15
  %119 = icmp ne ptr %118, null
  br i1 %119, label %120, label %135

120:                                              ; preds = %116
  br label %121

121:                                              ; preds = %120
  %122 = load ptr, ptr %5, align 8, !tbaa !5
  %123 = getelementptr inbounds %"struct.UapkiNS::AlgorithmIdentifier", ptr %10, i32 0, i32 1
  %124 = load ptr, ptr %123, align 8, !tbaa !15
  %125 = invoke i32 @json_object_set_base64(ptr noundef %122, ptr noundef @.str.34, ptr noundef %124)
          to label %126 unwind label %47

126:                                              ; preds = %121
  store i32 %125, ptr %8, align 4, !tbaa !11
  %127 = load i32, ptr %8, align 4, !tbaa !11
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %129, label %132

129:                                              ; preds = %126
  %130 = load i32, ptr %8, align 4, !tbaa !11
  invoke void @stacktrace_add(ptr noundef @.str.3, i64 noundef 439, i32 noundef %130)
          to label %131 unwind label %47

131:                                              ; preds = %129
  br label %150

132:                                              ; preds = %126
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134, %116
  br label %136

136:                                              ; preds = %135
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = invoke noundef ptr @_ZNK7UapkiNS7SmartBA3getEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %139 unwind label %47

139:                                              ; preds = %136
  %140 = invoke i32 @json_object_set_base64(ptr noundef %137, ptr noundef @.str.37, ptr noundef %138)
          to label %141 unwind label %47

141:                                              ; preds = %139
  store i32 %140, ptr %8, align 4, !tbaa !11
  %142 = load i32, ptr %8, align 4, !tbaa !11
  %143 = icmp ne i32 %142, 0
  br i1 %143, label %144, label %147

144:                                              ; preds = %141
  %145 = load i32, ptr %8, align 4, !tbaa !11
  invoke void @stacktrace_add(ptr noundef @.str.3, i64 noundef 441, i32 noundef %145)
          to label %146 unwind label %47

146:                                              ; preds = %144
  br label %150

147:                                              ; preds = %141
  br label %148

148:                                              ; preds = %147
  br label %149

149:                                              ; preds = %148
  br label %150

150:                                              ; preds = %149, %146, %131, %115, %104, %85, %69, %38
  %151 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %151, ptr %4, align 4
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @_ZN7UapkiNS19AlgorithmIdentifierD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %10) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %154

152:                                              ; preds = %47, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @_ZN7UapkiNS19AlgorithmIdentifierD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %10) #4
  br label %153

153:                                              ; preds = %152, %39
  call void @llvm.lifetime.end.p0(i64 40, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %156

154:                                              ; preds = %150, %21
  %155 = load i32, ptr %4, align 4
  ret i32 %155

156:                                              ; preds = %153
  %157 = load ptr, ptr %12, align 8
  %158 = load i32, ptr %13, align 4
  %159 = insertvalue { ptr, i32 } poison, ptr %157, 0
  %160 = insertvalue { ptr, i32 } %159, i32 %158, 1
  resume { ptr, i32 } %160
}

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

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

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

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

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

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

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

declare noundef zeroext i1 @_ZN6DstuNS16isDstu4145familyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) #1

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

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

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

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

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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !6, i64 32}
!16 = !{!"_ZTSN7UapkiNS19AlgorithmIdentifierE", !17, i64 0, !6, i64 32}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !18, i64 0, !19, i64 8, !7, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!19 = !{!"long", !7, 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"

%"struct.UapkiNS::AlgorithmIdentifier" = type { %"class.std::__cxx11::basic_string", 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::SmartBA" = type { ptr }

@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [10 x i8], align 1

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

; Function Attrs: mustprogress 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) local_unnamed_addr #1

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7UapkiNS4Cert10spkiToJsonEP13json_object_tPKNS0_7CerItemEb(ptr noundef %0, ptr noundef %1, i1 noundef zeroext %2) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"struct.UapkiNS::AlgorithmIdentifier", align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.UapkiNS::SmartBA", align 8
  %7 = icmp ne ptr %0, null
  %8 = icmp ne ptr %1, null
  %or.cond = and i1 %7, %8
  br i1 %or.cond, label %9, label %57

9:                                                ; preds = %3
  %10 = tail call noundef ptr @_ZNK7UapkiNS4Cert7CerItem7getCertEv(ptr noundef nonnull align 8 dereferenceable(401) %1)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  invoke void @_ZN7UapkiNS19AlgorithmIdentifierC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPK12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef null)
          to label %11 unwind label %16

11:                                               ; preds = %9
  %12 = getelementptr inbounds i8, ptr %10, i64 400
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  call void @_ZN7UapkiNS7SmartBAC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6)
  %13 = invoke noundef i32 @_ZN7UapkiNS4Util27algorithmIdentifierFromAsn1ERK19AlgorithmIdentifierRNS_19AlgorithmIdentifierE(ptr noundef nonnull align 8 dereferenceable(48) %12, ptr noundef nonnull align 8 dereferenceable(40) %4)
          to label %14 unwind label %18

14:                                               ; preds = %11
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %20, label %15

15:                                               ; preds = %14
  invoke void @stacktrace_add(ptr noundef nonnull @.str.3, i64 noundef 426, i32 noundef %13)
          to label %55 unwind label %18

16:                                               ; preds = %9
  %17 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  br label %56

18:                                               ; preds = %54, %50, %49, %46, %39, %38, %34, %32, %29, %28, %25, %20, %15, %11
  %19 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @_ZN7UapkiNS19AlgorithmIdentifierD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #4
  br label %56

20:                                               ; preds = %14
  %21 = invoke noundef zeroext i1 @_ZN6DstuNS16isDstu4145familyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %22 unwind label %18

22:                                               ; preds = %20
  %23 = getelementptr inbounds i8, ptr %10, i64 448
  %24 = call noundef ptr @_ZN7UapkiNS7SmartBAadEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  br i1 %21, label %25, label %29

25:                                               ; preds = %22
  %26 = invoke noundef i32 @_ZN7UapkiNS4Util27bitStringEncapOctetFromAsn1EPK12BIT_STRING_sPP12ByteArray_st(ptr noundef nonnull %23, ptr noundef %24)
          to label %27 unwind label %18

27:                                               ; preds = %25
  %.not41 = icmp eq i32 %26, 0
  br i1 %.not41, label %33, label %28

28:                                               ; preds = %27
  invoke void @stacktrace_add(ptr noundef nonnull @.str.3, i64 noundef 428, i32 noundef %26)
          to label %55 unwind label %18

29:                                               ; preds = %22
  %30 = invoke i32 @asn_BITSTRING2ba(ptr noundef nonnull %23, ptr noundef %24)
          to label %31 unwind label %18

31:                                               ; preds = %29
  %.not40 = icmp eq i32 %30, 0
  br i1 %.not40, label %33, label %32

32:                                               ; preds = %31
  invoke void @stacktrace_add(ptr noundef nonnull @.str.3, i64 noundef 431, i32 noundef %30)
          to label %55 unwind label %18

33:                                               ; preds = %31, %27
  br i1 %2, label %34, label %39

34:                                               ; preds = %33
  %35 = call noundef ptr @_ZNK7UapkiNS4Cert7CerItem7getSpkiEv(ptr noundef nonnull align 8 dereferenceable(401) %1)
  %36 = invoke i32 @json_object_set_base64(ptr noundef nonnull %0, ptr noundef nonnull @.str.36, ptr noundef %35)
          to label %37 unwind label %18

37:                                               ; preds = %34
  %.not42 = icmp eq i32 %36, 0
  br i1 %.not42, label %39, label %38

38:                                               ; preds = %37
  invoke void @stacktrace_add(ptr noundef nonnull @.str.3, i64 noundef 435, i32 noundef %36)
          to label %55 unwind label %18

39:                                               ; preds = %37, %33
  %40 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  %41 = invoke i32 @json_object_set_string(ptr noundef nonnull %0, ptr noundef nonnull @.str.33, ptr noundef %40)
          to label %42 unwind label %18

42:                                               ; preds = %39
  %.not43 = icmp eq i32 %41, 0
  br i1 %.not43, label %43, label %55

43:                                               ; preds = %42
  %44 = getelementptr inbounds i8, ptr %4, i64 32
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %.not44 = icmp eq ptr %45, null
  br i1 %.not44, label %50, label %46

46:                                               ; preds = %43
  %47 = invoke i32 @json_object_set_base64(ptr noundef nonnull %0, ptr noundef nonnull @.str.34, ptr noundef nonnull %45)
          to label %48 unwind label %18

48:                                               ; preds = %46
  %.not45 = icmp eq i32 %47, 0
  br i1 %.not45, label %50, label %49

49:                                               ; preds = %48
  invoke void @stacktrace_add(ptr noundef nonnull @.str.3, i64 noundef 439, i32 noundef %47)
          to label %55 unwind label %18

50:                                               ; preds = %43, %48
  %51 = call noundef ptr @_ZNK7UapkiNS7SmartBA3getEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  %52 = invoke i32 @json_object_set_base64(ptr noundef nonnull %0, ptr noundef nonnull @.str.37, ptr noundef %51)
          to label %53 unwind label %18

53:                                               ; preds = %50
  %.not46 = icmp eq i32 %52, 0
  br i1 %.not46, label %55, label %54

54:                                               ; preds = %53
  invoke void @stacktrace_add(ptr noundef nonnull @.str.3, i64 noundef 441, i32 noundef %52)
          to label %55 unwind label %18

55:                                               ; preds = %42, %53, %54, %49, %38, %32, %28, %15
  %.030 = phi i32 [ %13, %15 ], [ %26, %28 ], [ %36, %38 ], [ %47, %49 ], [ %52, %54 ], [ 0, %53 ], [ %30, %32 ], [ 4113, %42 ]
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @_ZN7UapkiNS19AlgorithmIdentifierD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #4
  br label %57

56:                                               ; preds = %18, %16
  %.pn = phi { ptr, i32 } [ %19, %18 ], [ %17, %16 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #4
  resume { ptr, i32 } %.pn

57:                                               ; preds = %3, %55
  %.029 = phi i32 [ %.030, %55 ], [ 4097, %3 ]
  ret i32 %.029
}

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

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

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

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

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

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

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

declare noundef zeroext i1 @_ZN6DstuNS16isDstu4145familyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1

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

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

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

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

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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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, !9, i64 32}
!6 = !{!"_ZTSN7UapkiNS19AlgorithmIdentifierE", !7, i64 0, !9, i64 32}
!7 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !8, i64 0, !12, i64 8, !10, i64 16}
!8 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"long", !10, i64 0}


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