; LLVM IR from machinefi/psa-crypto-arduino :: src/psa_layer (psa_crypto)

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

%struct.psa_global_data_t = type { i8, %struct.iotex_psa_external_random_context_t }
%struct.iotex_psa_external_random_context_t = type { [2 x i64] }
%struct.psa_key_slot_t = type { %struct.psa_core_key_attributes_t, i64, %struct.key_data }
%struct.psa_core_key_attributes_t = type { i16, i16, i32, i32, %struct.psa_key_policy_s, i16 }
%struct.psa_key_policy_s = type { i32, i32, i32 }
%struct.key_data = type { ptr, i64 }
%struct.psa_key_attributes_s = type { %struct.psa_core_key_attributes_t, ptr, i64 }

@global_data = external hidden global %struct.psa_global_data_t, align 8

; 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: nounwind uwtable
declare dso_local i32 @psa_allocate_buffer_to_slot(ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @psa_import_key(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i64 %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  %16 = load i8, ptr @global_data, align 8
  %17 = and i8 %16, 1
  %18 = zext i8 %17 to i32
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %21

20:                                               ; preds = %4
  store i32 -137, ptr %5, align 4
  br label %139

21:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %22 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %22, ptr %14, align 8, !tbaa !9
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %23, align 4, !tbaa !11
  %24 = load i64, ptr %8, align 8, !tbaa !9
  %25 = icmp eq i64 %24, 0
  br i1 %25, label %26, label %27

26:                                               ; preds = %21
  store i32 -135, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %138

27:                                               ; preds = %21
  %28 = load i64, ptr %8, align 8, !tbaa !9
  %29 = icmp ugt i64 %28, 2305843009213693951
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  store i32 -134, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %138

31:                                               ; preds = %27
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = call i32 @psa_start_key_creation(i32 noundef 0, ptr noundef %32, ptr noundef %11, ptr noundef %12)
  store i32 %33, ptr %10, align 4, !tbaa !11
  %34 = load i32, ptr %10, align 4, !tbaa !11
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %37

36:                                               ; preds = %31
  br label %130

37:                                               ; preds = %31
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.psa_key_slot_t, ptr %38, i32 0, i32 2
  %40 = getelementptr inbounds %struct.key_data, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !13
  %42 = icmp eq ptr %41, null
  br i1 %42, label %43, label %67

43:                                               ; preds = %37
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.psa_key_attributes_s, ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds %struct.psa_core_key_attributes_t, ptr %45, i32 0, i32 2
  %47 = load i32, ptr %46, align 4, !tbaa !19
  %48 = call i32 @psa_key_lifetime_is_external(i32 noundef %47)
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %59

50:                                               ; preds = %43
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = load i64, ptr %8, align 8, !tbaa !9
  %54 = call i32 @psa_driver_wrapper_get_key_buffer_size_from_key_data(ptr noundef %51, ptr noundef %52, i64 noundef %53, ptr noundef %14)
  store i32 %54, ptr %10, align 4, !tbaa !11
  %55 = load i32, ptr %10, align 4, !tbaa !11
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %58

57:                                               ; preds = %50
  br label %130

58:                                               ; preds = %50
  br label %59

59:                                               ; preds = %58, %43
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  %61 = load i64, ptr %14, align 8, !tbaa !9
  %62 = call i32 @psa_allocate_buffer_to_slot(ptr noundef %60, i64 noundef %61)
  store i32 %62, ptr %10, align 4, !tbaa !11
  %63 = load i32, ptr %10, align 4, !tbaa !11
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %59
  br label %130

66:                                               ; preds = %59
  br label %67

67:                                               ; preds = %66, %37
  %68 = load ptr, ptr %11, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.psa_key_slot_t, ptr %68, i32 0, i32 0
  %70 = getelementptr inbounds %struct.psa_core_key_attributes_t, ptr %69, i32 0, i32 1
  %71 = load i16, ptr %70, align 2, !tbaa !21
  %72 = zext i16 %71 to i64
  store i64 %72, ptr %13, align 8, !tbaa !9
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = load i64, ptr %8, align 8, !tbaa !9
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.psa_key_slot_t, ptr %76, i32 0, i32 2
  %78 = getelementptr inbounds %struct.key_data, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !13
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.psa_key_slot_t, ptr %80, i32 0, i32 2
  %82 = getelementptr inbounds %struct.key_data, ptr %81, i32 0, i32 1
  %83 = load i64, ptr %82, align 8, !tbaa !22
  %84 = load ptr, ptr %11, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.psa_key_slot_t, ptr %84, i32 0, i32 2
  %86 = getelementptr inbounds %struct.key_data, ptr %85, i32 0, i32 1
  %87 = call i32 @psa_driver_wrapper_import_key(ptr noundef %73, ptr noundef %74, i64 noundef %75, ptr noundef %79, i64 noundef %83, ptr noundef %86, ptr noundef %13)
  store i32 %87, ptr %10, align 4, !tbaa !11
  %88 = load i32, ptr %10, align 4, !tbaa !11
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %90, label %91

90:                                               ; preds = %67
  br label %130

91:                                               ; preds = %67
  %92 = load ptr, ptr %11, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.psa_key_slot_t, ptr %92, i32 0, i32 0
  %94 = getelementptr inbounds %struct.psa_core_key_attributes_t, ptr %93, i32 0, i32 1
  %95 = load i16, ptr %94, align 2, !tbaa !21
  %96 = zext i16 %95 to i32
  %97 = icmp eq i32 %96, 0
  br i1 %97, label %98, label %104

98:                                               ; preds = %91
  %99 = load i64, ptr %13, align 8, !tbaa !9
  %100 = trunc i64 %99 to i16
  %101 = load ptr, ptr %11, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.psa_key_slot_t, ptr %101, i32 0, i32 0
  %103 = getelementptr inbounds %struct.psa_core_key_attributes_t, ptr %102, i32 0, i32 1
  store i16 %100, ptr %103, align 2, !tbaa !21
  br label %114

104:                                              ; preds = %91
  %105 = load i64, ptr %13, align 8, !tbaa !9
  %106 = load ptr, ptr %11, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.psa_key_slot_t, ptr %106, i32 0, i32 0
  %108 = getelementptr inbounds %struct.psa_core_key_attributes_t, ptr %107, i32 0, i32 1
  %109 = load i16, ptr %108, align 2, !tbaa !21
  %110 = zext i16 %109 to i64
  %111 = icmp ne i64 %105, %110
  br i1 %111, label %112, label %113

112:                                              ; preds = %104
  store i32 -135, ptr %10, align 4, !tbaa !11
  br label %130

113:                                              ; preds = %104
  br label %114

114:                                              ; preds = %113, %98
  %115 = load i64, ptr %13, align 8, !tbaa !9
  %116 = icmp ugt i64 %115, 65528
  br i1 %116, label %117, label %118

117:                                              ; preds = %114
  store i32 -134, ptr %10, align 4, !tbaa !11
  br label %130

118:                                              ; preds = %114
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = call i32 @psa_validate_optional_attributes(ptr noundef %119, ptr noundef %120)
  store i32 %121, ptr %10, align 4, !tbaa !11
  %122 = load i32, ptr %10, align 4, !tbaa !11
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %125

124:                                              ; preds = %118
  br label %130

125:                                              ; preds = %118
  %126 = load ptr, ptr %11, align 8, !tbaa !5
  %127 = load ptr, ptr %12, align 8, !tbaa !5
  %128 = load ptr, ptr %9, align 8, !tbaa !5
  %129 = call i32 @psa_finish_key_creation(ptr noundef %126, ptr noundef %127, ptr noundef %128)
  store i32 %129, ptr %10, align 4, !tbaa !11
  br label %130

130:                                              ; preds = %125, %124, %117, %112, %90, %65, %57, %36
  %131 = load i32, ptr %10, align 4, !tbaa !11
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %136

133:                                              ; preds = %130
  %134 = load ptr, ptr %11, align 8, !tbaa !5
  %135 = load ptr, ptr %12, align 8, !tbaa !5
  call void @psa_fail_key_creation(ptr noundef %134, ptr noundef %135)
  br label %136

136:                                              ; preds = %133, %130
  %137 = load i32, ptr %10, align 4, !tbaa !11
  store i32 %137, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %138

138:                                              ; preds = %136, %30, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %139

139:                                              ; preds = %138, %20
  %140 = load i32, ptr %5, align 4
  ret i32 %140
}

; Function Attrs: nounwind uwtable
declare hidden i32 @psa_start_key_creation(i32 noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @psa_key_lifetime_is_external(i32 noundef) #2

declare i32 @psa_driver_wrapper_get_key_buffer_size_from_key_data(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #3

declare i32 @psa_driver_wrapper_import_key(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @psa_validate_optional_attributes(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @psa_finish_key_creation(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @psa_fail_key_creation(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 40}
!14 = !{!"", !15, i64 0, !10, i64 32, !18, i64 40}
!15 = !{!"", !16, i64 0, !16, i64 2, !12, i64 4, !12, i64 8, !17, i64 12, !16, i64 24}
!16 = !{!"short", !7, i64 0}
!17 = !{!"psa_key_policy_s", !12, i64 0, !12, i64 4, !12, i64 8}
!18 = !{!"key_data", !6, i64 0, !10, i64 8}
!19 = !{!20, !12, i64 4}
!20 = !{!"psa_key_attributes_s", !15, i64 0, !6, i64 32, !10, i64 40}
!21 = !{!14, !16, i64 2}
!22 = !{!14, !10, i64 48}


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

%struct.psa_global_data_t = type { i8, %struct.iotex_psa_external_random_context_t }
%struct.iotex_psa_external_random_context_t = type { [2 x i64] }

@global_data = external hidden local_unnamed_addr global %struct.psa_global_data_t, align 8

; 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: nounwind uwtable
declare dso_local i32 @psa_allocate_buffer_to_slot(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @psa_import_key(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = load i8, ptr @global_data, align 8
  %10 = and i8 %9, 1
  %11 = icmp eq i8 %10, 0
  br i1 %11, label %63, label %12

12:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  store i64 %2, ptr %8, align 8, !tbaa !9
  store i32 0, ptr %3, align 4, !tbaa !11
  %13 = icmp eq i64 %2, 0
  br i1 %13, label %62, label %14

14:                                               ; preds = %12
  %15 = icmp ugt i64 %2, 2305843009213693951
  br i1 %15, label %62, label %16

16:                                               ; preds = %14
  %17 = call i32 @psa_start_key_creation(i32 noundef 0, ptr noundef %0, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %18, label %.thread

18:                                               ; preds = %16
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 40
  %21 = load ptr, ptr %20, align 8, !tbaa !13
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %33

23:                                               ; preds = %18
  %24 = getelementptr inbounds i8, ptr %0, i64 4
  %25 = load i32, ptr %24, align 4, !tbaa !19
  %26 = call i32 @psa_key_lifetime_is_external(i32 noundef %25)
  %.not28 = icmp eq i32 %26, 0
  br i1 %.not28, label %29, label %27

27:                                               ; preds = %23
  %28 = call i32 @psa_driver_wrapper_get_key_buffer_size_from_key_data(ptr noundef nonnull %0, ptr noundef %1, i64 noundef %2, ptr noundef nonnull %8) #4
  %.not29 = icmp eq i32 %28, 0
  br i1 %.not29, label %._crit_edge, label %.thread

._crit_edge:                                      ; preds = %27
  %.pre = load i64, ptr %8, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %._crit_edge, %23
  %30 = phi i64 [ %.pre, %._crit_edge ], [ %2, %23 ]
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = call i32 @psa_allocate_buffer_to_slot(ptr noundef %31, i64 noundef %30)
  %.not30 = icmp eq i32 %32, 0
  br i1 %.not30, label %._crit_edge38, label %.thread

._crit_edge38:                                    ; preds = %29
  %.pre39 = load ptr, ptr %5, align 8, !tbaa !5
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.pre39, i64 40
  %.pre40 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !13
  br label %33

33:                                               ; preds = %._crit_edge38, %18
  %34 = phi ptr [ %.pre40, %._crit_edge38 ], [ %21, %18 ]
  %35 = phi ptr [ %.pre39, %._crit_edge38 ], [ %19, %18 ]
  %36 = getelementptr inbounds i8, ptr %35, i64 2
  %37 = load i16, ptr %36, align 2, !tbaa !21
  %38 = zext i16 %37 to i64
  store i64 %38, ptr %7, align 8, !tbaa !9
  %39 = getelementptr inbounds i8, ptr %35, i64 48
  %40 = load i64, ptr %39, align 8, !tbaa !22
  %41 = call i32 @psa_driver_wrapper_import_key(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %34, i64 noundef %40, ptr noundef nonnull %39, ptr noundef nonnull %7) #4
  %.not31 = icmp eq i32 %41, 0
  br i1 %.not31, label %42, label %.thread

42:                                               ; preds = %33
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i64 2
  %45 = load i16, ptr %44, align 2, !tbaa !21
  %46 = icmp eq i16 %45, 0
  %47 = load i64, ptr %7, align 8, !tbaa !9
  br i1 %46, label %48, label %50

48:                                               ; preds = %42
  %49 = trunc i64 %47 to i16
  store i16 %49, ptr %44, align 2, !tbaa !21
  br label %52

50:                                               ; preds = %42
  %51 = zext i16 %45 to i64
  %.not32 = icmp eq i64 %47, %51
  br i1 %.not32, label %52, label %.thread

52:                                               ; preds = %50, %48
  %53 = icmp ugt i64 %47, 65528
  br i1 %53, label %.thread, label %54

54:                                               ; preds = %52
  %55 = call i32 @psa_validate_optional_attributes(ptr noundef nonnull %43, ptr noundef %0)
  %.not33 = icmp eq i32 %55, 0
  br i1 %.not33, label %56, label %.thread

56:                                               ; preds = %54
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = call i32 @psa_finish_key_creation(ptr noundef %57, ptr noundef %58, ptr noundef nonnull %3)
  %.not34 = icmp eq i32 %59, 0
  br i1 %.not34, label %62, label %.thread

.thread:                                          ; preds = %52, %50, %54, %33, %29, %27, %16, %56
  %.037 = phi i32 [ %59, %56 ], [ -134, %52 ], [ -135, %50 ], [ %55, %54 ], [ %41, %33 ], [ %32, %29 ], [ %28, %27 ], [ %17, %16 ]
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  call void @psa_fail_key_creation(ptr noundef %60, ptr noundef %61)
  br label %62

62:                                               ; preds = %56, %.thread, %14, %12
  %.021 = phi i32 [ -135, %12 ], [ -134, %14 ], [ %.037, %.thread ], [ 0, %56 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  br label %63

63:                                               ; preds = %4, %62
  %.1 = phi i32 [ %.021, %62 ], [ -137, %4 ]
  ret i32 %.1
}

; Function Attrs: nounwind uwtable
declare hidden i32 @psa_start_key_creation(i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @psa_key_lifetime_is_external(i32 noundef) local_unnamed_addr #2

declare i32 @psa_driver_wrapper_get_key_buffer_size_from_key_data(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

declare i32 @psa_driver_wrapper_import_key(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden i32 @psa_validate_optional_attributes(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @psa_finish_key_creation(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @psa_fail_key_creation(ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 40}
!14 = !{!"", !15, i64 0, !10, i64 32, !18, i64 40}
!15 = !{!"", !16, i64 0, !16, i64 2, !12, i64 4, !12, i64 8, !17, i64 12, !16, i64 24}
!16 = !{!"short", !7, i64 0}
!17 = !{!"psa_key_policy_s", !12, i64 0, !12, i64 4, !12, i64 8}
!18 = !{!"key_data", !6, i64 0, !10, i64 8}
!19 = !{!20, !12, i64 4}
!20 = !{!"psa_key_attributes_s", !15, i64 0, !6, i64 32, !10, i64 40}
!21 = !{!14, !16, i64 2}
!22 = !{!14, !10, i64 48}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass