; LLVM IR from specinfo-ua/UAPKI :: library/cm-pkcs12/src/storage/file-storage.ll (ZN11FileStorage9decodeIitEPKc)

; 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.std::allocator" = type { i8 }
%class.FileStorage = type { ptr, %"class.std::__cxx11::basic_string", i8, i8, %"class.std::__cxx11::basic_string", i8, %"class.std::vector", ptr, %struct.FileStorageParam }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<StoreBag *, std::allocator<StoreBag *>>::_Vector_impl" }
%"struct.std::_Vector_base<StoreBag *, std::allocator<StoreBag *>>::_Vector_impl" = type { %"struct.std::_Vector_base<StoreBag *, std::allocator<StoreBag *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<StoreBag *, std::allocator<StoreBag *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.FileStorageParam = type { ptr, ptr, ptr, i64 }

@OID_PKCS12_P8_SHROUDED_KEY_BAG = external global ptr, align 8
@.str = external hidden unnamed_addr constant [35 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11FileStorage6addBagEPK8StoreBag(ptr noundef nonnull align 8 dereferenceable(152), 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 uwtable
define dso_local noundef i32 @_ZN11FileStorage9decodeIitEPKc(ptr noundef nonnull align 8 dereferenceable(152) %0, ptr noundef %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca [2 x ptr], align 16
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.std::__cxx11::basic_string", align 8
  %14 = alloca %"class.std::allocator", align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #8
  call void @llvm.memset.p0.i64(ptr align 16 %7, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  store ptr null, ptr %8, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %2
  %17 = getelementptr inbounds %class.FileStorage, ptr %15, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds [2 x ptr], ptr %7, i64 0, i64 0
  %21 = call i32 @pkcs8_decrypt(ptr noundef %18, ptr noundef %19, ptr noundef %20, ptr noundef null, ptr noundef null)
  store i32 %21, ptr %6, align 4, !tbaa !9
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %16
  %25 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 296, i32 noundef %25)
  br label %93

26:                                               ; preds = %16
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  %30 = getelementptr inbounds [2 x ptr], ptr %7, i64 0, i64 0
  %31 = load ptr, ptr %30, align 16, !tbaa !5
  %32 = getelementptr inbounds [2 x ptr], ptr %7, i64 0, i64 1
  %33 = call i32 @pkcs12_iit_read_kep_key(ptr noundef %31, ptr noundef %32)
  store i32 %33, ptr %6, align 4, !tbaa !9
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %38

36:                                               ; preds = %29
  %37 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 297, i32 noundef %37)
  br label %93

38:                                               ; preds = %29
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  store i64 0, ptr %9, align 8, !tbaa !22
  br label %41

41:                                               ; preds = %76, %40
  %42 = load i64, ptr %9, align 8, !tbaa !22
  %43 = icmp ult i64 %42, 2
  br i1 %43, label %45, label %44

44:                                               ; preds = %41
  store i32 7, ptr %10, align 4
  br label %88

45:                                               ; preds = %41
  %46 = load i64, ptr %9, align 8, !tbaa !22
  %47 = getelementptr inbounds [2 x ptr], ptr %7, i64 0, i64 %46
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %51, label %50

50:                                               ; preds = %45
  br label %76

51:                                               ; preds = %45
  br label %52

52:                                               ; preds = %51
  %53 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 120) #9
  invoke void @_ZN8StoreBagC1Ev(ptr noundef nonnull align 8 dereferenceable(120) %53)
          to label %54 unwind label %58

54:                                               ; preds = %52
  store ptr %53, ptr %8, align 8, !tbaa !5
  %55 = icmp eq ptr null, %53
  br i1 %55, label %56, label %62

56:                                               ; preds = %54
  store i32 2, ptr %6, align 4, !tbaa !9
  %57 = load i32, ptr %6, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 305, i32 noundef %57)
  store i32 4, ptr %10, align 4
  br label %88

58:                                               ; preds = %52
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %11, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %12, align 4
  call void @_ZdlPvm(ptr noundef %53, i64 noundef 120) #10
  br label %90

62:                                               ; preds = %54
  br label %63

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #8
  %66 = load ptr, ptr @OID_PKCS12_P8_SHROUDED_KEY_BAG, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef %66, ptr noundef nonnull align 1 dereferenceable(1) %14)
          to label %67 unwind label %79

67:                                               ; preds = %64
  invoke void @_ZN8StoreBag8setBagIdERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(120) %65, ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %68 unwind label %83

68:                                               ; preds = %67
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #8
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = load i64, ptr %9, align 8, !tbaa !22
  %71 = getelementptr inbounds [2 x ptr], ptr %7, i64 0, i64 %70
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  call void @_ZN8StoreBag7setDataENS_8BAG_TYPEEP12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(120) %69, i32 noundef 1, ptr noundef %72)
  %73 = load i64, ptr %9, align 8, !tbaa !22
  %74 = getelementptr inbounds [2 x ptr], ptr %7, i64 0, i64 %73
  store ptr null, ptr %74, align 8, !tbaa !5
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11FileStorage6addBagEPK8StoreBag(ptr noundef nonnull align 8 dereferenceable(152) %15, ptr noundef %75)
  store ptr null, ptr %8, align 8, !tbaa !5
  br label %76

76:                                               ; preds = %68, %50
  %77 = load i64, ptr %9, align 8, !tbaa !22
  %78 = add i64 %77, 1
  store i64 %78, ptr %9, align 8, !tbaa !22
  br label %41, !llvm.loop !23

79:                                               ; preds = %64
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %11, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %12, align 4
  br label %87

83:                                               ; preds = %67
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %11, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %12, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #8
  br label %87

87:                                               ; preds = %83, %79
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %14) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #8
  br label %90

88:                                               ; preds = %56, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  %89 = load i32, ptr %10, align 4
  switch i32 %89, label %107 [
    i32 7, label %91
    i32 4, label %93
  ]

90:                                               ; preds = %87, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %109

91:                                               ; preds = %88
  %92 = getelementptr inbounds %class.FileStorage, ptr %15, i32 0, i32 5
  store i8 1, ptr %92, align 8, !tbaa !25
  br label %93

93:                                               ; preds = %91, %88, %36, %24
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = icmp ne ptr %94, null
  br i1 %95, label %96, label %101

96:                                               ; preds = %93
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = icmp eq ptr %97, null
  br i1 %98, label %100, label %99

99:                                               ; preds = %96
  call void @_ZN8StoreBagD1Ev(ptr noundef nonnull align 8 dereferenceable(120) %97) #8
  call void @_ZdlPvm(ptr noundef %97, i64 noundef 120) #10
  br label %100

100:                                              ; preds = %99, %96
  br label %101

101:                                              ; preds = %100, %93
  %102 = getelementptr inbounds [2 x ptr], ptr %7, i64 0, i64 0
  %103 = load ptr, ptr %102, align 16, !tbaa !5
  call void @ba_free(ptr noundef %103)
  %104 = getelementptr inbounds [2 x ptr], ptr %7, i64 0, i64 1
  %105 = load ptr, ptr %104, align 8, !tbaa !5
  call void @ba_free(ptr noundef %105)
  %106 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %106, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %107

107:                                              ; preds = %101, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  %108 = load i32, ptr %3, align 4
  ret i32 %108

109:                                              ; preds = %90
  %110 = load ptr, ptr %11, align 8
  %111 = load i32, ptr %12, align 4
  %112 = insertvalue { ptr, i32 } poison, ptr %110, 0
  %113 = insertvalue { ptr, i32 } %112, i32 %111, 1
  resume { ptr, i32 } %113
}

; Function Attrs: nounwind
declare void @_ZN8StoreBagD1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #3

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #4

declare void @ba_free(ptr noundef) #5

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

declare i32 @pkcs8_decrypt(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #5

declare i32 @pkcs12_iit_read_kep_key(ptr noundef, ptr noundef) #5

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #7

declare void @_ZN8StoreBagC1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #5

declare void @_ZN8StoreBag8setBagIdERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(32)) #5

declare void @_ZN8StoreBag7setDataENS_8BAG_TYPEEP12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef, ptr noundef) #5

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

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 = { 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 #4 = { nobuiltin 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 = { "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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nobuiltin allocsize(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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin 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, !6, i64 0}
!12 = !{!"_ZTS11FileStorage", !6, i64 0, !13, i64 8, !16, i64 40, !16, i64 41, !13, i64 48, !16, i64 80, !17, i64 88, !6, i64 112, !21, i64 120}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !15, i64 8, !7, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTSSt6vectorIP8StoreBagSaIS1_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIP8StoreBagSaIS1_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIP8StoreBagSaIS1_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIP8StoreBagSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"_ZTS16FileStorageParam", !6, i64 0, !6, i64 8, !6, i64 16, !15, i64 24}
!22 = !{!15, !15, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!12, !16, i64 80}


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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11FileStorage6addBagEPK8StoreBag(ptr noundef nonnull align 8 dereferenceable(152), 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 uwtable
define dso_local noundef i32 @_ZN11FileStorage9decodeIitEPKc(ptr noundef nonnull align 8 dereferenceable(152) %0, ptr noundef %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca [2 x ptr], align 16
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::allocator", align 1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %3, i8 0, i64 16, i1 false)
  %6 = load ptr, ptr %0, align 8, !tbaa !5
  %7 = call i32 @pkcs8_decrypt(ptr noundef %6, ptr noundef %1, ptr noundef nonnull %3, ptr noundef null, ptr noundef null)
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %9, label %8

8:                                                ; preds = %2
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 296, i32 noundef %7)
  br label %40

9:                                                ; preds = %2
  %10 = load ptr, ptr %3, align 16, !tbaa !19
  %11 = getelementptr inbounds i8, ptr %3, i64 8
  %12 = call i32 @pkcs12_iit_read_kep_key(ptr noundef %10, ptr noundef nonnull %11)
  %.not33 = icmp eq i32 %12, 0
  br i1 %.not33, label %.preheader.preheader, label %14

.preheader.preheader:                             ; preds = %9
  %13 = load ptr, ptr %3, align 16, !tbaa !19
  %.not34 = icmp eq ptr %13, null
  br i1 %.not34, label %.preheader.1, label %15

14:                                               ; preds = %9
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 297, i32 noundef %12)
  br label %40

15:                                               ; preds = %.preheader.preheader
  %16 = call noalias noundef nonnull dereferenceable(120) ptr @_Znwm(i64 noundef 120) #8
  invoke void @_ZN8StoreBagC1Ev(ptr noundef nonnull align 8 dereferenceable(120) %16)
          to label %19 unwind label %17

17:                                               ; preds = %25, %15
  %.lcssa = phi ptr [ %16, %15 ], [ %26, %25 ]
  %18 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %.lcssa, i64 noundef 120) #9
  br label %39

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #7
  %20 = load ptr, ptr @OID_PKCS12_P8_SHROUDED_KEY_BAG, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef %20, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %21 unwind label %34

21:                                               ; preds = %19
  invoke void @_ZN8StoreBag8setBagIdERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(120) %16, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %22 unwind label %36

22:                                               ; preds = %21
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  %23 = load ptr, ptr %3, align 16, !tbaa !19
  call void @_ZN8StoreBag7setDataENS_8BAG_TYPEEP12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(120) %16, i32 noundef 1, ptr noundef %23)
  store ptr null, ptr %3, align 16, !tbaa !19
  call void @_ZN11FileStorage6addBagEPK8StoreBag(ptr noundef nonnull align 8 dereferenceable(152) %0, ptr noundef nonnull %16)
  br label %.preheader.1

.preheader.1:                                     ; preds = %.preheader.preheader, %22
  %24 = load ptr, ptr %11, align 8, !tbaa !19
  %.not34.1 = icmp eq ptr %24, null
  br i1 %.not34.1, label %32, label %25

25:                                               ; preds = %.preheader.1
  %26 = call noalias noundef nonnull dereferenceable(120) ptr @_Znwm(i64 noundef 120) #8
  invoke void @_ZN8StoreBagC1Ev(ptr noundef nonnull align 8 dereferenceable(120) %26)
          to label %27 unwind label %17

27:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #7
  %28 = load ptr, ptr @OID_PKCS12_P8_SHROUDED_KEY_BAG, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef %28, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %29 unwind label %34

29:                                               ; preds = %27
  invoke void @_ZN8StoreBag8setBagIdERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(120) %26, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %30 unwind label %36

30:                                               ; preds = %29
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  %31 = load ptr, ptr %11, align 8, !tbaa !19
  call void @_ZN8StoreBag7setDataENS_8BAG_TYPEEP12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(120) %26, i32 noundef 1, ptr noundef %31)
  store ptr null, ptr %11, align 8, !tbaa !19
  call void @_ZN11FileStorage6addBagEPK8StoreBag(ptr noundef nonnull align 8 dereferenceable(152) %0, ptr noundef nonnull %26)
  br label %32

32:                                               ; preds = %30, %.preheader.1
  %33 = getelementptr inbounds i8, ptr %0, i64 80
  store i8 1, ptr %33, align 8, !tbaa !20
  br label %40

34:                                               ; preds = %27, %19
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %38

36:                                               ; preds = %29, %21
  %37 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  br label %38

38:                                               ; preds = %36, %34
  %.pn = phi { ptr, i32 } [ %37, %36 ], [ %35, %34 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  br label %39

39:                                               ; preds = %38, %17
  %.pn.pn = phi { ptr, i32 } [ %.pn, %38 ], [ %18, %17 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn.pn

40:                                               ; preds = %8, %14, %32
  %.128 = phi i32 [ %7, %8 ], [ %12, %14 ], [ 0, %32 ]
  %41 = load ptr, ptr %3, align 16, !tbaa !19
  call void @ba_free(ptr noundef %41)
  %42 = getelementptr inbounds i8, ptr %3, i64 8
  %43 = load ptr, ptr %42, align 8, !tbaa !19
  call void @ba_free(ptr noundef %43)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  ret i32 %.128
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #3

declare void @ba_free(ptr noundef) local_unnamed_addr #4

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

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

declare i32 @pkcs8_decrypt(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @pkcs12_iit_read_kep_key(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #6

declare void @_ZN8StoreBagC1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #4

declare void @_ZN8StoreBag8setBagIdERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

declare void @_ZN8StoreBag7setDataENS_8BAG_TYPEEP12ByteArray_st(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef, ptr noundef) local_unnamed_addr #4

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

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 = { nobuiltin 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 #4 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nobuiltin allocsize(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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin 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, !7, i64 0}
!6 = !{!"_ZTS11FileStorage", !7, i64 0, !10, i64 8, !13, i64 40, !13, i64 41, !10, i64 48, !13, i64 80, !14, i64 88, !7, i64 112, !18, i64 120}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !11, i64 0, !12, i64 8, !8, i64 16}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!"_ZTSSt6vectorIP8StoreBagSaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIP8StoreBagSaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIP8StoreBagSaIS1_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIP8StoreBagSaIS1_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!18 = !{!"_ZTS16FileStorageParam", !7, i64 0, !7, i64 8, !7, i64 16, !12, i64 24}
!19 = !{!7, !7, i64 0}
!20 = !{!6, !13, i64 80}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass