; LLVM IR from specinfo-ua/UAPKI :: library/uapki/src/api (session-list-keys)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.UapkiNS::VectorBA" = type { %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<ByteArray_st *, std::allocator<ByteArray_st *>>::_Vector_impl" }
%"struct.std::_Vector_base<ByteArray_st *, std::allocator<ByteArray_st *>>::_Vector_impl" = type { %"struct.std::_Vector_base<ByteArray_st *, std::allocator<ByteArray_st *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ByteArray_st *, std::allocator<ByteArray_st *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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.ParsonHelper = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1

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

24:                                               ; preds = %2
  store i32 4121, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %190

25:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #5
  call void @_ZN7UapkiNS8VectorBAC2Em(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = invoke noundef i32 @_ZN14CmStorageProxy15sessionListKeysERSt6vectorIP12ByteArray_stSaIS2_EERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(168) %26, ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %28 unwind label %33

28:                                               ; preds = %25
  store i32 %27, ptr %10, align 4, !tbaa !9
  %29 = load i32, ptr %10, align 4, !tbaa !9
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %37

31:                                               ; preds = %28
  %32 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %32, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %188

33:                                               ; preds = %25
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %11, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %12, align 4
  br label %189

37:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #5
  invoke void @_ZN12ParsonHelperC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %13)
          to label %38 unwind label %47

38:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store ptr null, ptr %14, align 8, !tbaa !5
  %39 = call noundef zeroext i1 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  br i1 %39, label %56, label %40

40:                                               ; preds = %38
  %41 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  %42 = invoke noundef ptr @_ZN12ParsonHelper5parseEPKcb(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef %41, i1 noundef zeroext false)
          to label %43 unwind label %51

43:                                               ; preds = %40
  store ptr %42, ptr %14, align 8, !tbaa !5
  %44 = load ptr, ptr %14, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %55, label %46

46:                                               ; preds = %43
  store i32 4099, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %185

47:                                               ; preds = %37
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %11, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %12, align 4
  br label %187

51:                                               ; preds = %40
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %11, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %12, align 4
  br label %186

55:                                               ; preds = %43
  br label %56

56:                                               ; preds = %55, %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store ptr null, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %57 = invoke noundef ptr @_ZN12ParsonHelper8getArrayEPKc(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef @.str)
          to label %58 unwind label %69

58:                                               ; preds = %56
  store ptr %57, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %59 = load ptr, ptr %16, align 8, !tbaa !5
  %60 = invoke i64 @json_array_get_count(ptr noundef %59)
          to label %61 unwind label %73

61:                                               ; preds = %58
  store i64 %60, ptr %17, align 8, !tbaa !11
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = invoke ptr @json_value_init_array()
          to label %64 unwind label %73

64:                                               ; preds = %61
  %65 = invoke i32 @json_object_set_value(ptr noundef %62, ptr noundef @.str, ptr noundef %63)
          to label %66 unwind label %73

66:                                               ; preds = %64
  %67 = icmp ne i32 %65, 0
  br i1 %67, label %68, label %77

68:                                               ; preds = %66
  store i32 4113, ptr %10, align 4, !tbaa !9
  br label %180

69:                                               ; preds = %56
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %11, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %12, align 4
  br label %184

73:                                               ; preds = %77, %64, %61, %58
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %11, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %12, align 4
  br label %183

77:                                               ; preds = %66
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = invoke ptr @json_object_get_array(ptr noundef %78, ptr noundef @.str)
          to label %80 unwind label %73

80:                                               ; preds = %77
  store ptr %79, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  store i64 0, ptr %18, align 8, !tbaa !11
  br label %81

81:                                               ; preds = %172, %80
  %82 = load i64, ptr %18, align 8, !tbaa !11
  %83 = load i64, ptr %17, align 8, !tbaa !11
  %84 = icmp ult i64 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 3, ptr %7, align 4
  br label %176

86:                                               ; preds = %81
  %87 = load ptr, ptr %15, align 8, !tbaa !5
  %88 = invoke ptr @json_value_init_object()
          to label %89 unwind label %94

89:                                               ; preds = %86
  %90 = invoke i32 @json_array_append_value(ptr noundef %87, ptr noundef %88)
          to label %91 unwind label %94

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

93:                                               ; preds = %91
  store i32 4113, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %7, align 4
  br label %176

94:                                               ; preds = %89, %86
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %11, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %12, align 4
  br label %178

98:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %99 = load ptr, ptr %15, align 8, !tbaa !5
  %100 = load i64, ptr %18, align 8, !tbaa !11
  %101 = invoke ptr @json_array_get_object(ptr noundef %99, i64 noundef %100)
          to label %102 unwind label %113

102:                                              ; preds = %98
  store ptr %101, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %103 = load ptr, ptr %16, align 8, !tbaa !5
  %104 = load i64, ptr %18, align 8, !tbaa !11
  %105 = invoke ptr @json_array_get_object(ptr noundef %103, i64 noundef %104)
          to label %106 unwind label %117

106:                                              ; preds = %102
  store ptr %105, ptr %20, align 8, !tbaa !5
  %107 = load ptr, ptr %19, align 8, !tbaa !5
  %108 = load ptr, ptr %20, align 8, !tbaa !5
  %109 = invoke noundef i32 @_ZL23json_object_copy_stringP13json_object_tS0_PKc(ptr noundef %107, ptr noundef %108, ptr noundef @.str.1)
          to label %110 unwind label %117

110:                                              ; preds = %106
  %111 = icmp ne i32 %109, 0
  br i1 %111, label %112, label %121

112:                                              ; preds = %110
  store i32 4113, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %7, align 4
  br label %169

113:                                              ; preds = %98
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %11, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %12, align 4
  br label %175

117:                                              ; preds = %163, %160, %157, %152, %149, %142, %135, %128, %121, %106, %102
  %118 = landingpad { ptr, i32 }
          cleanup
  %119 = extractvalue { ptr, i32 } %118, 0
  store ptr %119, ptr %11, align 8
  %120 = extractvalue { ptr, i32 } %118, 1
  store i32 %120, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %175

121:                                              ; preds = %110
  %122 = load ptr, ptr %19, align 8, !tbaa !5
  %123 = load ptr, ptr %20, align 8, !tbaa !5
  %124 = invoke noundef i32 @_ZL23json_object_copy_stringP13json_object_tS0_PKc(ptr noundef %122, ptr noundef %123, ptr noundef @.str.2)
          to label %125 unwind label %117

125:                                              ; preds = %121
  %126 = icmp ne i32 %124, 0
  br i1 %126, label %127, label %128

127:                                              ; preds = %125
  store i32 4113, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %7, align 4
  br label %169

128:                                              ; preds = %125
  %129 = load ptr, ptr %19, align 8, !tbaa !5
  %130 = load ptr, ptr %20, align 8, !tbaa !5
  %131 = invoke noundef i32 @_ZL23json_object_copy_stringP13json_object_tS0_PKc(ptr noundef %129, ptr noundef %130, ptr noundef @.str.3)
          to label %132 unwind label %117

132:                                              ; preds = %128
  %133 = icmp ne i32 %131, 0
  br i1 %133, label %134, label %135

134:                                              ; preds = %132
  store i32 4113, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %7, align 4
  br label %169

135:                                              ; preds = %132
  %136 = load ptr, ptr %19, align 8, !tbaa !5
  %137 = load ptr, ptr %20, align 8, !tbaa !5
  %138 = invoke noundef i32 @_ZL23json_object_copy_stringP13json_object_tS0_PKc(ptr noundef %136, ptr noundef %137, ptr noundef @.str.4)
          to label %139 unwind label %117

139:                                              ; preds = %135
  %140 = icmp ne i32 %138, 0
  br i1 %140, label %141, label %142

141:                                              ; preds = %139
  store i32 4113, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %7, align 4
  br label %169

142:                                              ; preds = %139
  %143 = load ptr, ptr %19, align 8, !tbaa !5
  %144 = load ptr, ptr %20, align 8, !tbaa !5
  %145 = invoke noundef i32 @_ZL23json_object_copy_stringP13json_object_tS0_PKc(ptr noundef %143, ptr noundef %144, ptr noundef @.str.5)
          to label %146 unwind label %117

146:                                              ; preds = %142
  %147 = icmp ne i32 %145, 0
  br i1 %147, label %148, label %149

148:                                              ; preds = %146
  store i32 4113, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %7, align 4
  br label %169

149:                                              ; preds = %146
  %150 = load ptr, ptr %19, align 8, !tbaa !5
  %151 = invoke ptr @json_value_init_array()
          to label %152 unwind label %117

152:                                              ; preds = %149
  %153 = invoke i32 @json_object_set_value(ptr noundef %150, ptr noundef @.str.6, ptr noundef %151)
          to label %154 unwind label %117

154:                                              ; preds = %152
  %155 = icmp ne i32 %153, 0
  br i1 %155, label %156, label %157

156:                                              ; preds = %154
  store i32 4113, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %7, align 4
  br label %169

157:                                              ; preds = %154
  %158 = load ptr, ptr %19, align 8, !tbaa !5
  %159 = invoke ptr @json_object_get_array(ptr noundef %158, ptr noundef @.str.6)
          to label %160 unwind label %117

160:                                              ; preds = %157
  %161 = load ptr, ptr %20, align 8, !tbaa !5
  %162 = invoke ptr @json_object_get_array(ptr noundef %161, ptr noundef @.str.6)
          to label %163 unwind label %117

163:                                              ; preds = %160
  %164 = invoke i32 @json_array_copy_all_items(ptr noundef %159, ptr noundef %162)
          to label %165 unwind label %117

165:                                              ; preds = %163
  %166 = icmp ne i32 %164, 0
  br i1 %166, label %167, label %168

167:                                              ; preds = %165
  store i32 4113, ptr %10, align 4, !tbaa !9
  store i32 2, ptr %7, align 4
  br label %169

168:                                              ; preds = %165
  store i32 0, ptr %7, align 4
  br label %169

169:                                              ; preds = %168, %167, %156, %148, %141, %134, %127, %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  %170 = load i32, ptr %7, align 4
  switch i32 %170, label %176 [
    i32 0, label %171
  ]

171:                                              ; preds = %169
  br label %172

172:                                              ; preds = %171
  %173 = load i64, ptr %18, align 8, !tbaa !11
  %174 = add i64 %173, 1
  store i64 %174, ptr %18, align 8, !tbaa !11
  br label %81, !llvm.loop !13

175:                                              ; preds = %117, %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %178

176:                                              ; preds = %169, %93, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  %177 = load i32, ptr %7, align 4
  switch i32 %177, label %182 [
    i32 3, label %179
    i32 2, label %180
  ]

178:                                              ; preds = %175, %94
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %183

179:                                              ; preds = %176
  br label %180

180:                                              ; preds = %179, %176, %68
  %181 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %181, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %182

182:                                              ; preds = %180, %176
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %185

183:                                              ; preds = %178, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %184

184:                                              ; preds = %183, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %186

185:                                              ; preds = %182, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @_ZN12ParsonHelperD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #5
  br label %188

186:                                              ; preds = %184, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @_ZN12ParsonHelperD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #5
  br label %187

187:                                              ; preds = %186, %47
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #5
  br label %189

188:                                              ; preds = %185, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #5
  call void @_ZN7UapkiNS8VectorBAD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #5
  br label %190

189:                                              ; preds = %187, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #5
  call void @_ZN7UapkiNS8VectorBAD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %192

190:                                              ; preds = %188, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %191 = load i32, ptr %3, align 4
  ret i32 %191

192:                                              ; preds = %189
  %193 = load ptr, ptr %11, align 8
  %194 = load i32, ptr %12, align 4
  %195 = insertvalue { ptr, i32 } poison, ptr %193, 0
  %196 = insertvalue { ptr, i32 } %195, i32 %194, 1
  resume { ptr, i32 } %196
}

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

declare noundef ptr @_ZN11CmProviders13openedStorageEv() #2

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

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

declare noundef i32 @_ZN14CmStorageProxy15sessionListKeysERSt6vectorIP12ByteArray_stSaIS2_EERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) #2

declare i32 @__gxx_personality_v0(...)

declare void @_ZN12ParsonHelperC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

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

declare noundef ptr @_ZN12ParsonHelper5parseEPKcb(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i1 noundef zeroext) #2

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

declare noundef ptr @_ZN12ParsonHelper8getArrayEPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #2

declare i64 @json_array_get_count(ptr noundef) #2

declare i32 @json_object_set_value(ptr noundef, ptr noundef, ptr noundef) #2

declare ptr @json_value_init_array() #2

declare ptr @json_object_get_array(ptr noundef, ptr noundef) #2

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

declare ptr @json_value_init_object() #2

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL23json_object_copy_stringP13json_object_tS0_PKc(ptr noundef, ptr noundef, ptr noundef) #0

declare i32 @json_array_copy_all_items(ptr noundef, ptr noundef) #2

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

; Function Attrs: nounwind
declare void @_ZN12ParsonHelperD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4

; 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 @_ZN7UapkiNS8VectorBAD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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.UapkiNS::VectorBA" = type { %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<ByteArray_st *, std::allocator<ByteArray_st *>>::_Vector_impl" }
%"struct.std::_Vector_base<ByteArray_st *, std::allocator<ByteArray_st *>>::_Vector_impl" = type { %"struct.std::_Vector_base<ByteArray_st *, std::allocator<ByteArray_st *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ByteArray_st *, std::allocator<ByteArray_st *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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.ParsonHelper = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @uapki_session_list_keys(ptr nocapture noundef readnone %0, ptr noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.UapkiNS::VectorBA", align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %class.ParsonHelper, align 8
  %6 = tail call noundef ptr @_ZN11CmProviders13openedStorageEv()
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %85, label %7

7:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #5
  call void @_ZN7UapkiNS8VectorBAC2Em(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  %8 = invoke noundef i32 @_ZN14CmStorageProxy15sessionListKeysERSt6vectorIP12ByteArray_stSaIS2_EERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(168) %6, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %9 unwind label %10

9:                                                ; preds = %7
  %.not55 = icmp eq i32 %8, 0
  br i1 %.not55, label %12, label %83

10:                                               ; preds = %7
  %11 = landingpad { ptr, i32 }
          cleanup
  br label %84

12:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  invoke void @_ZN12ParsonHelperC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %5)
          to label %13 unwind label %19

13:                                               ; preds = %12
  %14 = call noundef zeroext i1 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  br i1 %14, label %23, label %15

15:                                               ; preds = %13
  %16 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  %17 = invoke noundef ptr @_ZN12ParsonHelper5parseEPKcb(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef %16, i1 noundef zeroext false)
          to label %18 unwind label %21

18:                                               ; preds = %15
  %.not56 = icmp eq ptr %17, null
  br i1 %.not56, label %.thread, label %23

19:                                               ; preds = %12
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %82

21:                                               ; preds = %15
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %81

23:                                               ; preds = %18, %13
  %24 = invoke noundef ptr @_ZN12ParsonHelper8getArrayEPKc(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull @.str)
          to label %25 unwind label %32

25:                                               ; preds = %23
  %26 = invoke i64 @json_array_get_count(ptr noundef %24)
          to label %27 unwind label %34

27:                                               ; preds = %25
  %28 = invoke ptr @json_value_init_array()
          to label %29 unwind label %34

29:                                               ; preds = %27
  %30 = invoke i32 @json_object_set_value(ptr noundef %1, ptr noundef nonnull @.str, ptr noundef %28)
          to label %31 unwind label %34

31:                                               ; preds = %29
  %.not57 = icmp eq i32 %30, 0
  br i1 %.not57, label %36, label %.thread

32:                                               ; preds = %23
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %81

34:                                               ; preds = %36, %29, %27, %25
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %81

36:                                               ; preds = %31
  %37 = invoke ptr @json_object_get_array(ptr noundef %1, ptr noundef nonnull @.str)
          to label %.preheader unwind label %34

.preheader:                                       ; preds = %36
  %.not93 = icmp eq i64 %26, 0
  br i1 %.not93, label %.thread, label %.lr.ph

38:                                               ; preds = %80
  %39 = add nuw i64 %.03676, 1
  %exitcond.not = icmp eq i64 %39, %26
  br i1 %exitcond.not, label %.thread, label %.lr.ph, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader, %38
  %.03676 = phi i64 [ %39, %38 ], [ 0, %.preheader ]
  %40 = invoke ptr @json_value_init_object()
          to label %41 unwind label %44

41:                                               ; preds = %.lr.ph
  %42 = invoke i32 @json_array_append_value(ptr noundef %37, ptr noundef %40)
          to label %43 unwind label %44

43:                                               ; preds = %41
  %.not58 = icmp eq i32 %42, 0
  br i1 %.not58, label %46, label %.thread

44:                                               ; preds = %41, %.lr.ph
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %81

46:                                               ; preds = %43
  %47 = invoke ptr @json_array_get_object(ptr noundef %37, i64 noundef %.03676)
          to label %48 unwind label %53

48:                                               ; preds = %46
  %49 = invoke ptr @json_array_get_object(ptr noundef %24, i64 noundef %.03676)
          to label %50 unwind label %55

50:                                               ; preds = %48
  %51 = invoke noundef i32 @_ZL23json_object_copy_stringP13json_object_tS0_PKc(ptr noundef %47, ptr noundef %49, ptr noundef nonnull @.str.1)
          to label %52 unwind label %55

52:                                               ; preds = %50
  %.not59 = icmp eq i32 %51, 0
  br i1 %.not59, label %57, label %.thread

53:                                               ; preds = %46
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %81

55:                                               ; preds = %78, %76, %74, %71, %69, %66, %63, %60, %57, %50, %48
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %81

57:                                               ; preds = %52
  %58 = invoke noundef i32 @_ZL23json_object_copy_stringP13json_object_tS0_PKc(ptr noundef %47, ptr noundef %49, ptr noundef nonnull @.str.2)
          to label %59 unwind label %55

59:                                               ; preds = %57
  %.not60 = icmp eq i32 %58, 0
  br i1 %.not60, label %60, label %.thread

60:                                               ; preds = %59
  %61 = invoke noundef i32 @_ZL23json_object_copy_stringP13json_object_tS0_PKc(ptr noundef %47, ptr noundef %49, ptr noundef nonnull @.str.3)
          to label %62 unwind label %55

62:                                               ; preds = %60
  %.not61 = icmp eq i32 %61, 0
  br i1 %.not61, label %63, label %.thread

63:                                               ; preds = %62
  %64 = invoke noundef i32 @_ZL23json_object_copy_stringP13json_object_tS0_PKc(ptr noundef %47, ptr noundef %49, ptr noundef nonnull @.str.4)
          to label %65 unwind label %55

65:                                               ; preds = %63
  %.not62 = icmp eq i32 %64, 0
  br i1 %.not62, label %66, label %.thread

66:                                               ; preds = %65
  %67 = invoke noundef i32 @_ZL23json_object_copy_stringP13json_object_tS0_PKc(ptr noundef %47, ptr noundef %49, ptr noundef nonnull @.str.5)
          to label %68 unwind label %55

68:                                               ; preds = %66
  %.not63 = icmp eq i32 %67, 0
  br i1 %.not63, label %69, label %.thread

69:                                               ; preds = %68
  %70 = invoke ptr @json_value_init_array()
          to label %71 unwind label %55

71:                                               ; preds = %69
  %72 = invoke i32 @json_object_set_value(ptr noundef %47, ptr noundef nonnull @.str.6, ptr noundef %70)
          to label %73 unwind label %55

73:                                               ; preds = %71
  %.not64 = icmp eq i32 %72, 0
  br i1 %.not64, label %74, label %.thread

74:                                               ; preds = %73
  %75 = invoke ptr @json_object_get_array(ptr noundef %47, ptr noundef nonnull @.str.6)
          to label %76 unwind label %55

76:                                               ; preds = %74
  %77 = invoke ptr @json_object_get_array(ptr noundef %49, ptr noundef nonnull @.str.6)
          to label %78 unwind label %55

78:                                               ; preds = %76
  %79 = invoke i32 @json_array_copy_all_items(ptr noundef %75, ptr noundef %77)
          to label %80 unwind label %55

80:                                               ; preds = %78
  %.not72 = icmp eq i32 %79, 0
  br i1 %.not72, label %38, label %.thread

.thread:                                          ; preds = %43, %38, %80, %52, %59, %62, %65, %68, %73, %.preheader, %31, %18
  %.1 = phi i32 [ 4099, %18 ], [ 4113, %31 ], [ 0, %.preheader ], [ 4113, %43 ], [ 0, %38 ], [ 4113, %80 ], [ 4113, %52 ], [ 4113, %59 ], [ 4113, %62 ], [ 4113, %65 ], [ 4113, %68 ], [ 4113, %73 ]
  call void @_ZN12ParsonHelperD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  br label %83

81:                                               ; preds = %32, %44, %55, %53, %34, %21
  %.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %22, %21 ], [ %33, %32 ], [ %35, %34 ], [ %45, %44 ], [ %56, %55 ], [ %54, %53 ]
  call void @_ZN12ParsonHelperD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  br label %82

82:                                               ; preds = %81, %19
  %.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn.pn, %81 ], [ %20, %19 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  br label %84

83:                                               ; preds = %9, %.thread
  %.2 = phi i32 [ %.1, %.thread ], [ %8, %9 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  call void @_ZN7UapkiNS8VectorBAD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  br label %85

84:                                               ; preds = %82, %10
  %.pn.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn.pn.pn, %82 ], [ %11, %10 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  call void @_ZN7UapkiNS8VectorBAD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn.pn.pn.pn.pn.pn.pn

85:                                               ; preds = %2, %83
  %.3 = phi i32 [ %.2, %83 ], [ 4121, %2 ]
  ret i32 %.3
}

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

declare noundef ptr @_ZN11CmProviders13openedStorageEv() local_unnamed_addr #2

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

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

declare noundef i32 @_ZN14CmStorageProxy15sessionListKeysERSt6vectorIP12ByteArray_stSaIS2_EERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

declare void @_ZN12ParsonHelperC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

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

declare noundef ptr @_ZN12ParsonHelper5parseEPKcb(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i1 noundef zeroext) local_unnamed_addr #2

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

declare noundef ptr @_ZN12ParsonHelper8getArrayEPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #2

declare i64 @json_array_get_count(ptr noundef) local_unnamed_addr #2

declare i32 @json_object_set_value(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @json_value_init_array() local_unnamed_addr #2

declare ptr @json_object_get_array(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare ptr @json_value_init_object() local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL23json_object_copy_stringP13json_object_tS0_PKc(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @json_array_copy_all_items(ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind
declare void @_ZN12ParsonHelperD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4

; 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 @_ZN7UapkiNS8VectorBAD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass