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

%"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.49 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [15 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 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)) #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

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

declare ptr @json_value_init_object() #1

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

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

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

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

; 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

declare void @_ZN8TimeUtil12mtimeToFtimeB5cxx11Emb(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8, i64 noundef, i1 noundef zeroext) #1

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

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

22:                                               ; preds = %2
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %26, label %25

25:                                               ; preds = %22, %2
  store i32 4097, ptr %3, align 4
  br label %143

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = call noundef i64 @_ZNK7UapkiNS3Crl7CrlItem20getCountRevokedCertsEv(ptr noundef nonnull align 8 dereferenceable(268) %27)
  store i64 %28, ptr %6, align 8, !tbaa !9
  %29 = load i64, ptr %6, align 8, !tbaa !9
  %30 = icmp eq i64 %29, 0
  br i1 %30, label %31, label %32

31:                                               ; preds = %26
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %142

32:                                               ; preds = %26
  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
  store i64 0, ptr %9, align 8, !tbaa !9
  br label %33

33:                                               ; preds = %132, %32
  %34 = load i64, ptr %9, align 8, !tbaa !9
  %35 = load i64, ptr %6, align 8, !tbaa !9
  %36 = icmp ult i64 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 2, ptr %7, align 4
  br label %136

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @_ZN7UapkiNS7SmartBAC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #4
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = load i64, ptr %9, align 8, !tbaa !9
  %42 = invoke noundef ptr @_ZN7UapkiNS7SmartBAadEv(ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %43 unwind label %51

43:                                               ; preds = %39
  %44 = invoke noundef i32 @_ZNK7UapkiNS3Crl7CrlItem17parsedRevokedCertEmPP12ByteArray_stRmRNS_9CrlReasonES5_(ptr noundef nonnull align 8 dereferenceable(268) %40, i64 noundef %41, ptr noundef %42, ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %45 unwind label %51

45:                                               ; preds = %43
  store i32 %44, ptr %8, align 4, !tbaa !11
  %46 = load i32, ptr %8, align 4, !tbaa !11
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %55

48:                                               ; preds = %45
  %49 = load i32, ptr %8, align 4, !tbaa !11
  invoke void @stacktrace_add(ptr noundef @.str.3, i64 noundef 580, i32 noundef %49)
          to label %50 unwind label %51

50:                                               ; preds = %48
  store i32 7, ptr %7, align 4
  br label %129

51:                                               ; preds = %115, %104, %100, %85, %78, %73, %70, %65, %60, %57, %48, %43, %39
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %16, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %17, align 4
  br label %135

55:                                               ; preds = %45
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = invoke ptr @json_value_init_object()
          to label %60 unwind label %51

60:                                               ; preds = %57
  %61 = invoke i32 @json_array_append_value(ptr noundef %58, ptr noundef %59)
          to label %62 unwind label %51

62:                                               ; preds = %60
  %63 = icmp ne i32 %61, 0
  br i1 %63, label %64, label %65

64:                                               ; preds = %62
  store i32 4113, ptr %8, align 4, !tbaa !11
  store i32 7, ptr %7, align 4
  br label %129

65:                                               ; preds = %62
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = load i64, ptr %9, align 8, !tbaa !9
  %68 = invoke ptr @json_array_get_object(ptr noundef %66, i64 noundef %67)
          to label %69 unwind label %51

69:                                               ; preds = %65
  store ptr %68, ptr %10, align 8, !tbaa !5
  br label %70

70:                                               ; preds = %69
  %71 = load ptr, ptr %10, align 8, !tbaa !5
  %72 = invoke noundef ptr @_ZNK7UapkiNS7SmartBA3getEv(ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %73 unwind label %51

73:                                               ; preds = %70
  %74 = invoke i32 @json_object_set_hex(ptr noundef %71, ptr noundef @.str.49, ptr noundef %72)
          to label %75 unwind label %51

75:                                               ; preds = %73
  store i32 %74, ptr %8, align 4, !tbaa !11
  %76 = load i32, ptr %8, align 4, !tbaa !11
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %81

78:                                               ; preds = %75
  %79 = load i32, ptr %8, align 4, !tbaa !11
  invoke void @stacktrace_add(ptr noundef @.str.3, i64 noundef 585, i32 noundef %79)
          to label %80 unwind label %51

80:                                               ; preds = %78
  store i32 7, ptr %7, align 4
  br label %129

81:                                               ; preds = %75
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 32, ptr %18) #4
  %84 = load i64, ptr %12, align 8, !tbaa !9
  invoke void @_ZN8TimeUtil12mtimeToFtimeB5cxx11Emb(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %18, i64 noundef %84, i1 noundef zeroext false)
          to label %85 unwind label %93

85:                                               ; preds = %83
  %86 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef nonnull align 8 dereferenceable(32) %18) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #4
  %87 = load ptr, ptr %10, align 8, !tbaa !5
  %88 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %15) #4
  %89 = invoke i32 @json_object_set_string(ptr noundef %87, ptr noundef @.str.50, ptr noundef %88)
          to label %90 unwind label %51

90:                                               ; preds = %85
  %91 = icmp ne i32 %89, 0
  br i1 %91, label %92, label %97

92:                                               ; preds = %90
  store i32 4113, ptr %8, align 4, !tbaa !11
  store i32 7, ptr %7, align 4
  br label %129

93:                                               ; preds = %83
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %16, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #4
  br label %135

97:                                               ; preds = %90
  %98 = load i32, ptr %14, align 4, !tbaa !13
  %99 = icmp sgt i32 %98, -1
  br i1 %99, label %100, label %110

100:                                              ; preds = %97
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = load i32, ptr %14, align 4, !tbaa !13
  %103 = invoke noundef ptr @_ZN7UapkiNS3Crl14crlReasonToStrENS_9CrlReasonE(i32 noundef %102)
          to label %104 unwind label %51

104:                                              ; preds = %100
  %105 = invoke i32 @json_object_set_string(ptr noundef %101, ptr noundef @.str.51, ptr noundef %103)
          to label %106 unwind label %51

106:                                              ; preds = %104
  %107 = icmp ne i32 %105, 0
  br i1 %107, label %108, label %109

108:                                              ; preds = %106
  store i32 4113, ptr %8, align 4, !tbaa !11
  store i32 7, ptr %7, align 4
  br label %129

109:                                              ; preds = %106
  br label %110

110:                                              ; preds = %109, %97
  %111 = load i64, ptr %13, align 8, !tbaa !9
  %112 = icmp ugt i64 %111, 0
  br i1 %112, label %113, label %128

113:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 32, ptr %19) #4
  %114 = load i64, ptr %13, align 8, !tbaa !9
  invoke void @_ZN8TimeUtil12mtimeToFtimeB5cxx11Emb(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %19, i64 noundef %114, i1 noundef zeroext false)
          to label %115 unwind label %123

115:                                              ; preds = %113
  %116 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef nonnull align 8 dereferenceable(32) %19) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %19) #4
  %117 = load ptr, ptr %10, align 8, !tbaa !5
  %118 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %15) #4
  %119 = invoke i32 @json_object_set_string(ptr noundef %117, ptr noundef @.str.52, ptr noundef %118)
          to label %120 unwind label %51

120:                                              ; preds = %115
  %121 = icmp ne i32 %119, 0
  br i1 %121, label %122, label %127

122:                                              ; preds = %120
  store i32 4113, ptr %8, align 4, !tbaa !11
  store i32 7, ptr %7, align 4
  br label %129

123:                                              ; preds = %113
  %124 = landingpad { ptr, i32 }
          cleanup
  %125 = extractvalue { ptr, i32 } %124, 0
  store ptr %125, ptr %16, align 8
  %126 = extractvalue { ptr, i32 } %124, 1
  store i32 %126, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 32, ptr %19) #4
  br label %135

127:                                              ; preds = %120
  br label %128

128:                                              ; preds = %127, %110
  store i32 0, ptr %7, align 4
  br label %129

129:                                              ; preds = %128, %122, %108, %92, %80, %64, %50
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %130 = load i32, ptr %7, align 4
  switch i32 %130, label %136 [
    i32 0, label %131
  ]

131:                                              ; preds = %129
  br label %132

132:                                              ; preds = %131
  %133 = load i64, ptr %9, align 8, !tbaa !9
  %134 = add i64 %133, 1
  store i64 %134, ptr %9, align 8, !tbaa !9
  br label %33, !llvm.loop !15

135:                                              ; preds = %123, %93, %51
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %145

136:                                              ; preds = %129, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %137 = load i32, ptr %7, align 4
  switch i32 %137, label %141 [
    i32 2, label %138
    i32 7, label %139
  ]

138:                                              ; preds = %136
  br label %139

139:                                              ; preds = %138, %136
  %140 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %140, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %141

141:                                              ; preds = %139, %136
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %142

142:                                              ; preds = %141, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %143

143:                                              ; preds = %142, %25
  %144 = load i32, ptr %3, align 4
  ret i32 %144

145:                                              ; preds = %135
  %146 = load ptr, ptr %16, align 8
  %147 = load i32, ptr %17, align 4
  %148 = insertvalue { ptr, i32 } poison, ptr %146, 0
  %149 = insertvalue { ptr, i32 } %148, i32 %147, 1
  resume { ptr, i32 } %149
}

declare noundef i32 @_ZNK7UapkiNS3Crl7CrlItem17parsedRevokedCertEmPP12ByteArray_stRmRNS_9CrlReasonES5_(ptr noundef nonnull align 8 dereferenceable(268), i64 noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(8)) #1

declare noundef ptr @_ZN7UapkiNS3Crl14crlReasonToStrENS_9CrlReasonE(i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTSN7UapkiNS9CrlReasonE", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; 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.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.49 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [15 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 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 #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

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

declare ptr @json_value_init_object() local_unnamed_addr #1

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

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

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

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

; 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

declare void @_ZN8TimeUtil12mtimeToFtimeB5cxx11Emb(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8, i64 noundef, i1 noundef zeroext) local_unnamed_addr #1

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

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

12:                                               ; preds = %2
  %13 = tail call noundef i64 @_ZNK7UapkiNS3Crl7CrlItem20getCountRevokedCertsEv(ptr noundef nonnull align 8 dereferenceable(268) %1)
  %14 = icmp eq i64 %13, 0
  br i1 %14, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %12, %61
  %.02748 = phi i64 [ %62, %61 ], [ 0, %12 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  call void @_ZN7UapkiNS7SmartBAC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  %15 = call noundef ptr @_ZN7UapkiNS7SmartBAadEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
  %16 = invoke noundef i32 @_ZNK7UapkiNS3Crl7CrlItem17parsedRevokedCertEmPP12ByteArray_stRmRNS_9CrlReasonES5_(ptr noundef nonnull align 8 dereferenceable(268) %1, i64 noundef %.02748, ptr noundef %15, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %17 unwind label %19

17:                                               ; preds = %.preheader
  %.not = icmp eq i32 %16, 0
  br i1 %.not, label %21, label %18

18:                                               ; preds = %17
  invoke void @stacktrace_add(ptr noundef nonnull @.str.3, i64 noundef 580, i32 noundef %16)
          to label %61 unwind label %19

19:                                               ; preds = %53, %47, %45, %35, %32, %28, %26, %23, %21, %18, %.preheader
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %63

21:                                               ; preds = %17
  %22 = invoke ptr @json_value_init_object()
          to label %23 unwind label %19

23:                                               ; preds = %21
  %24 = invoke i32 @json_array_append_value(ptr noundef nonnull %0, ptr noundef %22)
          to label %25 unwind label %19

25:                                               ; preds = %23
  %.not41 = icmp eq i32 %24, 0
  br i1 %.not41, label %26, label %61

26:                                               ; preds = %25
  %27 = invoke ptr @json_array_get_object(ptr noundef nonnull %0, i64 noundef %.02748)
          to label %28 unwind label %19

28:                                               ; preds = %26
  %29 = call noundef ptr @_ZNK7UapkiNS7SmartBA3getEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
  %30 = invoke i32 @json_object_set_hex(ptr noundef %27, ptr noundef nonnull @.str.49, ptr noundef %29)
          to label %31 unwind label %19

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

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

33:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #4
  %34 = load i64, ptr %4, align 8, !tbaa !5
  invoke void @_ZN8TimeUtil12mtimeToFtimeB5cxx11Emb(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %8, i64 noundef %34, i1 noundef zeroext false)
          to label %35 unwind label %40

35:                                               ; preds = %33
  %36 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #4
  %37 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  %38 = invoke i32 @json_object_set_string(ptr noundef %27, ptr noundef nonnull @.str.50, ptr noundef %37)
          to label %39 unwind label %19

39:                                               ; preds = %35
  %.not43 = icmp eq i32 %38, 0
  br i1 %.not43, label %42, label %61

40:                                               ; preds = %33
  %41 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #4
  br label %63

42:                                               ; preds = %39
  %43 = load i32, ptr %6, align 4, !tbaa !9
  %44 = icmp sgt i32 %43, -1
  br i1 %44, label %45, label %50

45:                                               ; preds = %42
  %46 = invoke noundef ptr @_ZN7UapkiNS3Crl14crlReasonToStrENS_9CrlReasonE(i32 noundef %43)
          to label %47 unwind label %19

47:                                               ; preds = %45
  %48 = invoke i32 @json_object_set_string(ptr noundef %27, ptr noundef nonnull @.str.51, ptr noundef %46)
          to label %49 unwind label %19

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

50:                                               ; preds = %49, %42
  %51 = load i64, ptr %5, align 8, !tbaa !5
  %.not45 = icmp eq i64 %51, 0
  br i1 %.not45, label %60, label %52

52:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #4
  invoke void @_ZN8TimeUtil12mtimeToFtimeB5cxx11Emb(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %9, i64 noundef %51, i1 noundef zeroext false)
          to label %53 unwind label %58

53:                                               ; preds = %52
  %54 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(32) %9) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #4
  %55 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  %56 = invoke i32 @json_object_set_string(ptr noundef %27, ptr noundef nonnull @.str.52, ptr noundef %55)
          to label %57 unwind label %19

57:                                               ; preds = %53
  %.not46 = icmp eq i32 %56, 0
  br i1 %.not46, label %60, label %61

58:                                               ; preds = %52
  %59 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #4
  br label %63

60:                                               ; preds = %57, %50
  br label %61

61:                                               ; preds = %57, %49, %39, %32, %25, %18, %60
  %cond.not = phi i1 [ false, %60 ], [ true, %18 ], [ true, %25 ], [ true, %32 ], [ true, %39 ], [ true, %49 ], [ true, %57 ]
  %.1 = phi i32 [ 0, %60 ], [ %16, %18 ], [ 4113, %25 ], [ %30, %32 ], [ 4113, %39 ], [ 4113, %49 ], [ 4113, %57 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  %62 = add nuw i64 %.02748, 1
  %exitcond.not = icmp eq i64 %62, %13
  %or.cond49 = select i1 %cond.not, i1 true, i1 %exitcond.not
  br i1 %or.cond49, label %.loopexit, label %.preheader, !llvm.loop !11

63:                                               ; preds = %58, %40, %19
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %59, %58 ], [ %41, %40 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  resume { ptr, i32 } %.pn

.loopexit:                                        ; preds = %61, %12, %2
  %.233 = phi i32 [ 4097, %2 ], [ 0, %12 ], [ %.1, %61 ]
  ret i32 %.233
}

declare noundef i32 @_ZNK7UapkiNS3Crl7CrlItem17parsedRevokedCertEmPP12ByteArray_stRmRNS_9CrlReasonES5_(ptr noundef nonnull align 8 dereferenceable(268), i64 noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

declare noundef ptr @_ZN7UapkiNS3Crl14crlReasonToStrENS_9CrlReasonE(i32 noundef) 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 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_ZTSN7UapkiNS9CrlReasonE", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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