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

; 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::SmartBA" = type { ptr }
%struct.AuthenticatedSafe = type { %struct.anon.11, %struct.asn_struct_ctx_s }
%struct.anon.11 = type { ptr, i32, i32, ptr }
%struct.asn_struct_ctx_s = type { i16, i16, i32, ptr, i64 }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

declare void @stacktrace_create(ptr noundef, i64 noundef, i32 noundef, ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN11FileStorage12readContentsEPK12ByteArray_stPKc(ptr noundef nonnull align 8 dereferenceable(152) %0, ptr noundef %1, ptr noundef %2) #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"class.UapkiNS::SmartBA", align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %17 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store ptr null, ptr %9, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %3
  %19 = call ptr @get_AuthenticatedSafe_desc()
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = call ptr @asn_decode_ba_with_alloc(ptr noundef %19, ptr noundef %20)
  store ptr %21, ptr %9, align 8, !tbaa !5
  %22 = icmp eq ptr null, %21
  br i1 %22, label %23, label %25

23:                                               ; preds = %18
  store i32 2, ptr %8, align 4, !tbaa !9
  %24 = load i32, ptr %8, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 476, i32 noundef %24)
  br label %142

25:                                               ; preds = %18
  br label %26

26:                                               ; preds = %25
  br label %27

27:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %136, %27
  %29 = load i32, ptr %10, align 4, !tbaa !9
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.AuthenticatedSafe, ptr %30, i32 0, i32 0
  %32 = getelementptr inbounds %struct.anon.11, ptr %31, i32 0, i32 1
  %33 = load i32, ptr %32, align 8, !tbaa !11
  %34 = icmp slt i32 %29, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %28
  store i32 5, ptr %11, align 4
  br label %139

36:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.AuthenticatedSafe, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds %struct.anon.11, ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !17
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds ptr, ptr %40, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  store ptr %44, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @_ZN7UapkiNS7SmartBAC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14)
  br label %45

45:                                               ; preds = %36
  %46 = load ptr, ptr %12, align 8, !tbaa !5
  %47 = invoke i32 @cinfo_get_type(ptr noundef %46, ptr noundef %13)
          to label %48 unwind label %54

48:                                               ; preds = %45
  store i32 %47, ptr %8, align 4, !tbaa !9
  %49 = load i32, ptr %8, align 4, !tbaa !9
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %58

51:                                               ; preds = %48
  %52 = load i32, ptr %8, align 4, !tbaa !9
  invoke void @stacktrace_add(ptr noundef @.str, i64 noundef 482, i32 noundef %52)
          to label %53 unwind label %54

53:                                               ; preds = %51
  store i32 4, ptr %11, align 4
  br label %133

54:                                               ; preds = %126, %119, %113, %111, %105, %100, %96, %86, %80, %78, %72, %67, %64, %51, %45
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %15, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %16, align 4
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %148

58:                                               ; preds = %48
  br label %59

59:                                               ; preds = %58
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %13, align 4, !tbaa !18
  %62 = icmp eq i32 %61, 1
  br i1 %62, label %63, label %92

63:                                               ; preds = %60
  br label %64

64:                                               ; preds = %63
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = invoke noundef ptr @_ZN7UapkiNS7SmartBAadEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %67 unwind label %54

67:                                               ; preds = %64
  %68 = invoke i32 @cinfo_get_data(ptr noundef %65, ptr noundef %66)
          to label %69 unwind label %54

69:                                               ; preds = %67
  store i32 %68, ptr %8, align 4, !tbaa !9
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %75

72:                                               ; preds = %69
  %73 = load i32, ptr %8, align 4, !tbaa !9
  invoke void @stacktrace_add(ptr noundef @.str, i64 noundef 484, i32 noundef %73)
          to label %74 unwind label %54

74:                                               ; preds = %72
  store i32 4, ptr %11, align 4
  br label %133

75:                                               ; preds = %69
  br label %76

76:                                               ; preds = %75
  br label %77

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77
  %79 = invoke noundef ptr @_ZNK7UapkiNS7SmartBA3getEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %80 unwind label %54

80:                                               ; preds = %78
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = invoke noundef i32 @_ZN11FileStorage16readSafeContentsEPK12ByteArray_stPKc(ptr noundef nonnull align 8 dereferenceable(152) %17, ptr noundef %79, ptr noundef %81)
          to label %83 unwind label %54

83:                                               ; preds = %80
  store i32 %82, ptr %8, align 4, !tbaa !9
  %84 = load i32, ptr %8, align 4, !tbaa !9
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %89

86:                                               ; preds = %83
  %87 = load i32, ptr %8, align 4, !tbaa !9
  invoke void @stacktrace_add(ptr noundef @.str, i64 noundef 485, i32 noundef %87)
          to label %88 unwind label %54

88:                                               ; preds = %86
  store i32 4, ptr %11, align 4
  br label %133

89:                                               ; preds = %83
  br label %90

90:                                               ; preds = %89
  br label %91

91:                                               ; preds = %90
  br label %132

92:                                               ; preds = %60
  %93 = load i32, ptr %13, align 4, !tbaa !18
  %94 = icmp eq i32 %93, 4
  br i1 %94, label %95, label %125

95:                                               ; preds = %92
  br label %96

96:                                               ; preds = %95
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = invoke noundef ptr @_ZN7UapkiNS7SmartBAadEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %100 unwind label %54

100:                                              ; preds = %96
  %101 = invoke i32 @pkcs12_read_encrypted_content(ptr noundef %97, ptr noundef %98, ptr noundef %99)
          to label %102 unwind label %54

102:                                              ; preds = %100
  store i32 %101, ptr %8, align 4, !tbaa !9
  %103 = load i32, ptr %8, align 4, !tbaa !9
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %105, label %108

105:                                              ; preds = %102
  %106 = load i32, ptr %8, align 4, !tbaa !9
  invoke void @stacktrace_add(ptr noundef @.str, i64 noundef 487, i32 noundef %106)
          to label %107 unwind label %54

107:                                              ; preds = %105
  store i32 4, ptr %11, align 4
  br label %133

108:                                              ; preds = %102
  br label %109

109:                                              ; preds = %108
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  %112 = invoke noundef ptr @_ZNK7UapkiNS7SmartBA3getEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %113 unwind label %54

113:                                              ; preds = %111
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  %115 = invoke noundef i32 @_ZN11FileStorage16readSafeContentsEPK12ByteArray_stPKc(ptr noundef nonnull align 8 dereferenceable(152) %17, ptr noundef %112, ptr noundef %114)
          to label %116 unwind label %54

116:                                              ; preds = %113
  store i32 %115, ptr %8, align 4, !tbaa !9
  %117 = load i32, ptr %8, align 4, !tbaa !9
  %118 = icmp ne i32 %117, 0
  br i1 %118, label %119, label %122

119:                                              ; preds = %116
  %120 = load i32, ptr %8, align 4, !tbaa !9
  invoke void @stacktrace_add(ptr noundef @.str, i64 noundef 488, i32 noundef %120)
          to label %121 unwind label %54

121:                                              ; preds = %119
  store i32 4, ptr %11, align 4
  br label %133

122:                                              ; preds = %116
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  br label %131

125:                                              ; preds = %92
  br label %126

126:                                              ; preds = %125
  store i32 1038, ptr %8, align 4, !tbaa !9
  %127 = load i32, ptr %8, align 4, !tbaa !9
  invoke void @stacktrace_create(ptr noundef @.str, i64 noundef 490, i32 noundef %127, ptr noundef null)
          to label %128 unwind label %54

128:                                              ; preds = %126
  store i32 4, ptr %11, align 4
  br label %133

129:                                              ; No predecessors!
  br label %130

130:                                              ; preds = %129
  br label %131

131:                                              ; preds = %130, %124
  br label %132

132:                                              ; preds = %131, %91
  store i32 0, ptr %11, align 4
  br label %133

133:                                              ; preds = %132, %128, %121, %107, %88, %74, %53
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %134 = load i32, ptr %11, align 4
  switch i32 %134, label %139 [
    i32 0, label %135
  ]

135:                                              ; preds = %133
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %10, align 4, !tbaa !9
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %10, align 4, !tbaa !9
  br label %28, !llvm.loop !20

139:                                              ; preds = %133, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %140 = load i32, ptr %11, align 4
  switch i32 %140, label %146 [
    i32 5, label %141
    i32 4, label %142
  ]

141:                                              ; preds = %139
  br label %142

142:                                              ; preds = %141, %139, %23
  %143 = call ptr @get_AuthenticatedSafe_desc()
  %144 = load ptr, ptr %9, align 8, !tbaa !5
  call void @asn_free(ptr noundef %143, ptr noundef %144)
  %145 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %145, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %146

146:                                              ; preds = %142, %139
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %147 = load i32, ptr %4, align 4
  ret i32 %147

148:                                              ; preds = %54
  %149 = load ptr, ptr %15, align 8
  %150 = load i32, ptr %16, align 4
  %151 = insertvalue { ptr, i32 } poison, ptr %149, 0
  %152 = insertvalue { ptr, i32 } %151, i32 %150, 1
  resume { ptr, i32 } %152
}

declare void @asn_free(ptr noundef, ptr noundef) #2

declare ptr @get_AuthenticatedSafe_desc() #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN11FileStorage16readSafeContentsEPK12ByteArray_stPKc(ptr noundef nonnull align 8 dereferenceable(152), ptr noundef, ptr noundef) #3 align 2

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTS17AuthenticatedSafe", !13, i64 0, !14, i64 24}
!13 = !{!"_ZTSN17AuthenticatedSafeUt_E", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16}
!14 = !{!"_ZTS16asn_struct_ctx_s", !15, i64 0, !15, i64 2, !10, i64 4, !6, i64 8, !16, i64 16}
!15 = !{!"short", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!12, !6, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"_ZTS9CinfoType", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"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::SmartBA" = type { ptr }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

declare void @stacktrace_create(ptr noundef, i64 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN11FileStorage12readContentsEPK12ByteArray_stPKc(ptr noundef nonnull align 8 dereferenceable(152) %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca %"class.UapkiNS::SmartBA", align 8
  %6 = tail call ptr @get_AuthenticatedSafe_desc()
  %7 = tail call ptr @asn_decode_ba_with_alloc(ptr noundef %6, ptr noundef %1)
  %8 = icmp eq ptr %7, null
  br i1 %8, label %12, label %.preheader

.preheader:                                       ; preds = %3
  %9 = getelementptr inbounds i8, ptr %7, i64 8
  %10 = load i32, ptr %9, align 8, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %.loopexit

12:                                               ; preds = %3
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 476, i32 noundef 2)
  br label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %43
  %indvars.iv = phi i64 [ %indvars.iv.next, %43 ], [ 0, %.preheader ]
  %13 = load ptr, ptr %7, align 8, !tbaa !15
  %14 = getelementptr inbounds ptr, ptr %13, i64 %indvars.iv
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  store i32 0, ptr %4, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  call void @_ZN7UapkiNS7SmartBAC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %16 = invoke i32 @cinfo_get_type(ptr noundef %15, ptr noundef nonnull %4)
          to label %17 unwind label %.loopexit51

17:                                               ; preds = %.lr.ph
  %.not = icmp eq i32 %16, 0
  br i1 %.not, label %20, label %18

18:                                               ; preds = %17
  invoke void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 482, i32 noundef %16)
          to label %.thread unwind label %.loopexit.split-lp

.loopexit51:                                      ; preds = %.lr.ph, %22, %27, %32, %37
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %19

.loopexit.split-lp:                               ; preds = %18, %26, %31, %36, %41, %42
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %19

19:                                               ; preds = %.loopexit.split-lp, %.loopexit51
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit51 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  resume { ptr, i32 } %lpad.phi

20:                                               ; preds = %17
  %21 = load i32, ptr %4, align 4, !tbaa !17
  switch i32 %21, label %42 [
    i32 1, label %22
    i32 4, label %32
  ]

22:                                               ; preds = %20
  %23 = call noundef ptr @_ZN7UapkiNS7SmartBAadEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %24 = invoke i32 @cinfo_get_data(ptr noundef %15, ptr noundef %23)
          to label %25 unwind label %.loopexit51

25:                                               ; preds = %22
  %.not46 = icmp eq i32 %24, 0
  br i1 %.not46, label %27, label %26

26:                                               ; preds = %25
  invoke void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 484, i32 noundef %24)
          to label %.thread unwind label %.loopexit.split-lp

27:                                               ; preds = %25
  %28 = call noundef ptr @_ZNK7UapkiNS7SmartBA3getEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %29 = invoke noundef i32 @_ZN11FileStorage16readSafeContentsEPK12ByteArray_stPKc(ptr noundef nonnull align 8 dereferenceable(152) %0, ptr noundef %28, ptr noundef %2)
          to label %30 unwind label %.loopexit51

30:                                               ; preds = %27
  %.not47 = icmp eq i32 %29, 0
  br i1 %.not47, label %43, label %31

31:                                               ; preds = %30
  invoke void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 485, i32 noundef %29)
          to label %.thread unwind label %.loopexit.split-lp

32:                                               ; preds = %20
  %33 = call noundef ptr @_ZN7UapkiNS7SmartBAadEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %34 = invoke i32 @pkcs12_read_encrypted_content(ptr noundef %15, ptr noundef %2, ptr noundef %33)
          to label %35 unwind label %.loopexit51

35:                                               ; preds = %32
  %.not44 = icmp eq i32 %34, 0
  br i1 %.not44, label %37, label %36

36:                                               ; preds = %35
  invoke void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 487, i32 noundef %34)
          to label %.thread unwind label %.loopexit.split-lp

37:                                               ; preds = %35
  %38 = call noundef ptr @_ZNK7UapkiNS7SmartBA3getEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %39 = invoke noundef i32 @_ZN11FileStorage16readSafeContentsEPK12ByteArray_stPKc(ptr noundef nonnull align 8 dereferenceable(152) %0, ptr noundef %38, ptr noundef %2)
          to label %40 unwind label %.loopexit51

40:                                               ; preds = %37
  %.not45 = icmp eq i32 %39, 0
  br i1 %.not45, label %43, label %41

41:                                               ; preds = %40
  invoke void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 488, i32 noundef %39)
          to label %.thread unwind label %.loopexit.split-lp

42:                                               ; preds = %20
  invoke void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 490, i32 noundef 1038, ptr noundef null)
          to label %.thread unwind label %.loopexit.split-lp

.thread:                                          ; preds = %18, %26, %31, %36, %41, %42
  %.2.ph = phi i32 [ 1038, %42 ], [ %39, %41 ], [ %34, %36 ], [ %29, %31 ], [ %24, %26 ], [ %16, %18 ]
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  br label %.loopexit

43:                                               ; preds = %40, %30
  call void @_ZN7UapkiNS7SmartBAD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %44 = load i32, ptr %9, align 8, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = icmp slt i64 %indvars.iv.next, %45
  br i1 %46, label %.lr.ph, label %.loopexit, !llvm.loop !19

.loopexit:                                        ; preds = %43, %.preheader, %.thread, %12
  %.4 = phi i32 [ 2, %12 ], [ %.2.ph, %.thread ], [ 0, %.preheader ], [ 0, %43 ]
  %47 = call ptr @get_AuthenticatedSafe_desc()
  call void @asn_free(ptr noundef %47, ptr noundef %7)
  ret i32 %.4
}

declare void @asn_free(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @get_AuthenticatedSafe_desc() local_unnamed_addr #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN11FileStorage16readSafeContentsEPK12ByteArray_stPKc(ptr noundef nonnull align 8 dereferenceable(152), ptr noundef, ptr noundef) local_unnamed_addr #3 align 2

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !11, i64 8}
!6 = !{!"_ZTS17AuthenticatedSafe", !7, i64 0, !12, i64 24}
!7 = !{!"_ZTSN17AuthenticatedSafeUt_E", !8, i64 0, !11, i64 8, !11, i64 12, !8, i64 16}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"_ZTS16asn_struct_ctx_s", !13, i64 0, !13, i64 2, !11, i64 4, !8, i64 8, !14, i64 16}
!13 = !{!"short", !9, i64 0}
!14 = !{!"long", !9, i64 0}
!15 = !{!6, !8, i64 0}
!16 = !{!8, !8, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"_ZTS9CinfoType", !9, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


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