; LLVM IR from specinfo-ua/UAPKI :: library/uapki/src (cm-storage-proxy)

; 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::lock_guard" = type { ptr }
%class.CmStorageProxy = type { %class.CmLoader, %"struct.std::atomic", %"struct.std::atomic", %"class.std::mutex", ptr, ptr }
%class.CmLoader = type { %struct.CM_PROVIDER_API }
%struct.CM_PROVIDER_API = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i8 }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.CM_KEY_API_ST = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14CmStorageProxy13arrayCmbaFreeEjPP12CM_BYTEARRAY(ptr noundef nonnull align 8 dereferenceable(168), i32 noundef, ptr noundef) #1 align 2

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

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14CmStorageProxy14keyDhUnwrapKeyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_RKSt6vectorIP12ByteArray_stSaISA_EESE_SE_RSC_(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %6) #1 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca %"class.std::lock_guard", align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  %24 = load ptr, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %25 = getelementptr inbounds %class.CmStorageProxy, ptr %24, i32 0, i32 3
  call void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(40) %25)
  %26 = invoke noundef zeroext i1 @_ZNK14CmStorageProxy15isOpenedStorageEv(ptr noundef nonnull align 8 dereferenceable(168) %24)
          to label %27 unwind label %29

27:                                               ; preds = %7
  br i1 %26, label %33, label %28

28:                                               ; preds = %27
  store i32 4121, ptr %8, align 4
  store i32 1, ptr %19, align 4
  br label %144

29:                                               ; preds = %7
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %17, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %18, align 4
  br label %146

33:                                               ; preds = %27
  %34 = getelementptr inbounds %class.CmStorageProxy, ptr %24, i32 0, i32 5
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = icmp ne ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 4108, ptr %8, align 4
  store i32 1, ptr %19, align 4
  br label %144

38:                                               ; preds = %33
  %39 = getelementptr inbounds %class.CmStorageProxy, ptr %24, i32 0, i32 5
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = getelementptr inbounds %struct.CM_KEY_API_ST, ptr %40, i32 0, i32 15
  %42 = load ptr, ptr %41, align 8, !tbaa !19
  %43 = icmp ne ptr %42, null
  br i1 %43, label %45, label %44

44:                                               ; preds = %38
  store i32 4118, ptr %8, align 4
  store i32 1, ptr %19, align 4
  br label %144

45:                                               ; preds = %38
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = call noundef zeroext i1 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(32) %46) #4
  br i1 %47, label %60, label %48

48:                                               ; preds = %45
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = call noundef zeroext i1 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(32) %49) #4
  br i1 %50, label %60, label %51

51:                                               ; preds = %48
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = call noundef zeroext i1 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %52) #4
  br i1 %53, label %60, label %54

54:                                               ; preds = %51
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = call noundef i64 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %55) #4
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = call noundef i64 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %57) #4
  %59 = icmp ne i64 %56, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %54, %51, %48, %45
  store i32 4101, ptr %8, align 4
  store i32 1, ptr %19, align 4
  br label %144

61:                                               ; preds = %54
  %62 = load ptr, ptr %13, align 8, !tbaa !5
  %63 = call noundef zeroext i1 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %62) #4
  br i1 %63, label %71, label %64

64:                                               ; preds = %61
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = call noundef i64 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %65) #4
  %67 = load ptr, ptr %13, align 8, !tbaa !5
  %68 = call noundef i64 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %67) #4
  %69 = icmp ne i64 %66, %68
  br i1 %69, label %70, label %71

70:                                               ; preds = %64
  store i32 4101, ptr %8, align 4
  store i32 1, ptr %19, align 4
  br label %144

71:                                               ; preds = %64, %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %72 = load ptr, ptr %12, align 8, !tbaa !5
  %73 = call noundef i64 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %72) #4
  %74 = trunc i64 %73 to i32
  store i32 %74, ptr %20, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  store ptr null, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %75 = getelementptr inbounds %class.CmStorageProxy, ptr %24, i32 0, i32 5
  %76 = load ptr, ptr %75, align 8, !tbaa !9
  %77 = getelementptr inbounds %struct.CM_KEY_API_ST, ptr %76, i32 0, i32 15
  %78 = load ptr, ptr %77, align 8, !tbaa !19
  %79 = getelementptr inbounds %class.CmStorageProxy, ptr %24, i32 0, i32 4
  %80 = load ptr, ptr %79, align 8, !tbaa !22
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %81) #4
  %83 = load ptr, ptr %11, align 8, !tbaa !5
  %84 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %83) #4
  %85 = load i32, ptr %20, align 4, !tbaa !21
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  %87 = call noundef ptr @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %86) #4
  %88 = load ptr, ptr %13, align 8, !tbaa !5
  %89 = call noundef zeroext i1 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %88) #4
  br i1 %89, label %93, label %90

90:                                               ; preds = %71
  %91 = load ptr, ptr %13, align 8, !tbaa !5
  %92 = call noundef ptr @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %91) #4
  br label %94

93:                                               ; preds = %71
  br label %94

94:                                               ; preds = %93, %90
  %95 = phi ptr [ %92, %90 ], [ null, %93 ]
  %96 = load ptr, ptr %14, align 8, !tbaa !5
  %97 = call noundef ptr @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %96) #4
  %98 = invoke noundef i32 %78(ptr noundef %80, ptr noundef %82, ptr noundef %84, i32 noundef %85, ptr noundef %87, ptr noundef %95, ptr noundef %97, ptr noundef %21)
          to label %99 unwind label %104

99:                                               ; preds = %94
  store i32 %98, ptr %22, align 4, !tbaa !21
  %100 = load i32, ptr %22, align 4, !tbaa !21
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %108

102:                                              ; preds = %99
  %103 = load i32, ptr %22, align 4, !tbaa !21
  store i32 %103, ptr %8, align 4
  store i32 1, ptr %19, align 4
  br label %142

104:                                              ; preds = %137, %108, %94
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %17, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %18, align 4
  br label %143

108:                                              ; preds = %99
  %109 = load ptr, ptr %15, align 8, !tbaa !5
  %110 = load i32, ptr %20, align 4, !tbaa !21
  %111 = zext i32 %110 to i64
  invoke void @_ZNSt6vectorIP12ByteArray_stSaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %109, i64 noundef %111)
          to label %112 unwind label %104

112:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  store i32 0, ptr %23, align 4, !tbaa !21
  br label %113

113:                                              ; preds = %130, %112
  %114 = load i32, ptr %23, align 4, !tbaa !21
  %115 = load i32, ptr %20, align 4, !tbaa !21
  %116 = icmp ult i32 %114, %115
  br i1 %116, label %118, label %117

117:                                              ; preds = %113
  store i32 2, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  br label %137

118:                                              ; preds = %113
  %119 = load ptr, ptr %21, align 8, !tbaa !5
  %120 = load i32, ptr %23, align 4, !tbaa !21
  %121 = zext i32 %120 to i64
  %122 = getelementptr inbounds ptr, ptr %119, i64 %121
  %123 = load ptr, ptr %122, align 8, !tbaa !5
  %124 = invoke ptr @ba_copy_with_alloc(ptr noundef %123, i64 noundef 0, i64 noundef 0)
          to label %125 unwind label %133

125:                                              ; preds = %118
  %126 = load ptr, ptr %15, align 8, !tbaa !5
  %127 = load i32, ptr %23, align 4, !tbaa !21
  %128 = zext i32 %127 to i64
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ByteArray_stSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %126, i64 noundef %128) #4
  store ptr %124, ptr %129, align 8, !tbaa !5
  br label %130

130:                                              ; preds = %125
  %131 = load i32, ptr %23, align 4, !tbaa !21
  %132 = add i32 %131, 1
  store i32 %132, ptr %23, align 4, !tbaa !21
  br label %113, !llvm.loop !23

133:                                              ; preds = %118
  %134 = landingpad { ptr, i32 }
          cleanup
  %135 = extractvalue { ptr, i32 } %134, 0
  store ptr %135, ptr %17, align 8
  %136 = extractvalue { ptr, i32 } %134, 1
  store i32 %136, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  br label %143

137:                                              ; preds = %117
  %138 = load i32, ptr %20, align 4, !tbaa !21
  %139 = load ptr, ptr %21, align 8, !tbaa !5
  invoke void @_ZN14CmStorageProxy13arrayCmbaFreeEjPP12CM_BYTEARRAY(ptr noundef nonnull align 8 dereferenceable(168) %24, i32 noundef %138, ptr noundef %139)
          to label %140 unwind label %104

140:                                              ; preds = %137
  %141 = load i32, ptr %22, align 4, !tbaa !21
  store i32 %141, ptr %8, align 4
  store i32 1, ptr %19, align 4
  br label %142

142:                                              ; preds = %140, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %144

143:                                              ; preds = %133, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %146

144:                                              ; preds = %142, %70, %60, %44, %37, %28
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  %145 = load i32, ptr %8, align 4
  ret i32 %145

146:                                              ; preds = %143, %29
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  br label %147

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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, !6, i64 160}
!10 = !{!"_ZTS14CmStorageProxy", !11, i64 0, !14, i64 104, !14, i64 105, !17, i64 112, !6, i64 152, !6, i64 160}
!11 = !{!"_ZTS8CmLoader", !12, i64 0}
!12 = !{!"_ZTS15CM_PROVIDER_API", !13, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSSt6atomicIbE", !15, i64 0}
!15 = !{!"_ZTSSt13__atomic_baseIbE", !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTSSt5mutex", !18, i64 0}
!18 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!19 = !{!20, !6, i64 120}
!20 = !{!"_ZTS13CM_KEY_API_ST", !13, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152}
!21 = !{!13, !13, i64 0}
!22 = !{!10, !6, i64 152}
!23 = distinct !{!23, !24}
!24 = !{!"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::lock_guard" = type { ptr }

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14CmStorageProxy13arrayCmbaFreeEjPP12CM_BYTEARRAY(ptr noundef nonnull align 8 dereferenceable(168), i32 noundef, ptr noundef) local_unnamed_addr #1 align 2

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

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14CmStorageProxy14keyDhUnwrapKeyERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_RKSt6vectorIP12ByteArray_stSaISA_EESE_SE_RSC_(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %6) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca %"class.std::lock_guard", align 8
  %9 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %10 = getelementptr inbounds i8, ptr %0, i64 112
  call void @_ZNSt10lock_guardISt5mutexEC2ERS0_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(40) %10)
  %11 = call noundef zeroext i1 @_ZNK14CmStorageProxy15isOpenedStorageEv(ptr noundef nonnull align 8 dereferenceable(168) %0)
  br i1 %11, label %12, label %66

12:                                               ; preds = %7
  %13 = getelementptr inbounds i8, ptr %0, i64 160
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %.not = icmp eq ptr %14, null
  br i1 %.not, label %66, label %15

15:                                               ; preds = %12
  %16 = getelementptr inbounds i8, ptr %14, i64 120
  %17 = load ptr, ptr %16, align 8, !tbaa !18
  %.not36 = icmp eq ptr %17, null
  br i1 %.not36, label %66, label %18

18:                                               ; preds = %15
  %19 = call noundef zeroext i1 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #4
  br i1 %19, label %66, label %20

20:                                               ; preds = %18
  %21 = call noundef zeroext i1 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  br i1 %21, label %66, label %22

22:                                               ; preds = %20
  %23 = call noundef zeroext i1 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  br i1 %23, label %66, label %24

24:                                               ; preds = %22
  %25 = call noundef i64 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  %26 = call noundef i64 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  %.not37 = icmp eq i64 %25, %26
  br i1 %.not37, label %27, label %66

27:                                               ; preds = %24
  %28 = call noundef zeroext i1 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  br i1 %28, label %32, label %29

29:                                               ; preds = %27
  %30 = call noundef i64 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  %31 = call noundef i64 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  %.not38 = icmp eq i64 %30, %31
  br i1 %.not38, label %32, label %66

32:                                               ; preds = %29, %27
  %33 = call noundef i64 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  %34 = trunc i64 %33 to i32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  store ptr null, ptr %9, align 8, !tbaa !20
  %35 = load ptr, ptr %13, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 120
  %37 = load ptr, ptr %36, align 8, !tbaa !18
  %38 = getelementptr inbounds i8, ptr %0, i64 152
  %39 = load ptr, ptr %38, align 8, !tbaa !21
  %40 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #4
  %41 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  %42 = call noundef ptr @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #4
  %43 = call noundef zeroext i1 @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  br i1 %43, label %46, label %44

44:                                               ; preds = %32
  %45 = call noundef ptr @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  br label %46

46:                                               ; preds = %32, %44
  %47 = phi ptr [ %45, %44 ], [ null, %32 ]
  %48 = call noundef ptr @_ZNKSt6vectorIP12ByteArray_stSaIS1_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  %49 = invoke noundef i32 %37(ptr noundef %39, ptr noundef %40, ptr noundef %41, i32 noundef %34, ptr noundef %42, ptr noundef %47, ptr noundef %48, ptr noundef nonnull %9)
          to label %50 unwind label %51

50:                                               ; preds = %46
  %.not39 = icmp eq i32 %49, 0
  br i1 %.not39, label %53, label %64

51:                                               ; preds = %._crit_edge, %53, %46
  %52 = landingpad { ptr, i32 }
          cleanup
  br label %65

53:                                               ; preds = %50
  %54 = and i64 %33, 4294967295
  invoke void @_ZNSt6vectorIP12ByteArray_stSaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %54)
          to label %.preheader unwind label %51

.preheader:                                       ; preds = %53
  %.not42 = icmp eq i32 %34, 0
  br i1 %.not42, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %wide.trip.count = and i64 %33, 4294967295
  br label %.lr.ph

._crit_edge:                                      ; preds = %60, %.preheader
  %55 = load ptr, ptr %9, align 8, !tbaa !20
  invoke void @_ZN14CmStorageProxy13arrayCmbaFreeEjPP12CM_BYTEARRAY(ptr noundef nonnull align 8 dereferenceable(168) %0, i32 noundef %34, ptr noundef %55)
          to label %64 unwind label %51

.lr.ph:                                           ; preds = %.lr.ph.preheader, %60
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %60 ]
  %56 = load ptr, ptr %9, align 8, !tbaa !20
  %57 = getelementptr inbounds ptr, ptr %56, i64 %indvars.iv
  %58 = load ptr, ptr %57, align 8, !tbaa !20
  %59 = invoke ptr @ba_copy_with_alloc(ptr noundef %58, i64 noundef 0, i64 noundef 0)
          to label %60 unwind label %62

60:                                               ; preds = %.lr.ph
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12ByteArray_stSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv) #4
  store ptr %59, ptr %61, align 8, !tbaa !20
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !22

62:                                               ; preds = %.lr.ph
  %63 = landingpad { ptr, i32 }
          cleanup
  br label %65

64:                                               ; preds = %._crit_edge, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  br label %66

65:                                               ; preds = %62, %51
  %.pn = phi { ptr, i32 } [ %63, %62 ], [ %52, %51 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  resume { ptr, i32 } %.pn

66:                                               ; preds = %29, %18, %20, %22, %24, %15, %12, %7, %64
  %.1 = phi i32 [ %49, %64 ], [ 4121, %7 ], [ 4108, %12 ], [ 4118, %15 ], [ 4101, %24 ], [ 4101, %22 ], [ 4101, %20 ], [ 4101, %18 ], [ 4101, %29 ]
  call void @_ZNSt10lock_guardISt5mutexED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  ret i32 %.1
}

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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, !12, i64 160}
!6 = !{!"_ZTS14CmStorageProxy", !7, i64 0, !13, i64 104, !13, i64 105, !16, i64 112, !12, i64 152, !12, i64 160}
!7 = !{!"_ZTS8CmLoader", !8, i64 0}
!8 = !{!"_ZTS15CM_PROVIDER_API", !9, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"any pointer", !10, i64 0}
!13 = !{!"_ZTSSt6atomicIbE", !14, i64 0}
!14 = !{!"_ZTSSt13__atomic_baseIbE", !15, i64 0}
!15 = !{!"bool", !10, i64 0}
!16 = !{!"_ZTSSt5mutex", !17, i64 0}
!17 = !{!"_ZTSSt12__mutex_base", !10, i64 0}
!18 = !{!19, !12, i64 120}
!19 = !{!"_ZTS13CM_KEY_API_ST", !9, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152}
!20 = !{!12, !12, i64 0}
!21 = !{!6, !12, i64 152}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


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