; LLVM IR from aws/s2n-tls :: crypto (s2n_pkey)

; 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.s2n_debug_info = type { ptr, ptr }
%struct.s2n_result = type { i32 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.s2n_pkey = type { ptr, ptr, ptr, ptr, ptr, ptr }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.16 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [88 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_pkey_setup_for_type(ptr noundef, i32 noundef) #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strrchr(ptr noundef, i32 noundef) #2

declare i32 @s2n_calculate_stacktrace() #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) #4

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_pkey_get_type(ptr noundef, ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_asn1der_to_private_key(ptr noundef %0, ptr noundef %1, i32 noundef %2) #0 {
  %4 = alloca %struct.s2n_result, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.s2n_result, align 4
  %14 = alloca %struct.s2n_result, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.s2n_blob, ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !11
  store ptr %17, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.s2n_blob, ptr %18, i32 0, i32 1
  %20 = load i32, ptr %19, align 8, !tbaa !13
  %21 = zext i32 %20 to i64
  %22 = call ptr @d2i_AutoPrivateKey(ptr noundef null, ptr noundef %8, i64 noundef %21)
  store ptr %22, ptr %9, align 8, !tbaa !5
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %32

25:                                               ; preds = %3
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.s2n_blob, ptr %27, i32 0, i32 1
  %29 = load i32, ptr %28, align 8, !tbaa !13
  %30 = zext i32 %29 to i64
  %31 = call ptr @d2i_PrivateKey(i32 noundef %26, ptr noundef null, ptr noundef %8, i64 noundef %30)
  store ptr %31, ptr %9, align 8, !tbaa !5
  br label %32

32:                                               ; preds = %25, %3
  br label %33

33:                                               ; preds = %32
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %70, label %36

36:                                               ; preds = %33
  br label %37

37:                                               ; preds = %36
  br label %38

38:                                               ; preds = %37
  %39 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %40 = getelementptr inbounds %struct.s2n_debug_info, ptr %39, i32 0, i32 0
  store ptr @.str.16, ptr %40, align 8, !tbaa !14
  %41 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %42 = getelementptr inbounds %struct.s2n_debug_info, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !14
  %44 = getelementptr inbounds i8, ptr %43, i64 21
  %45 = call ptr @strrchr(ptr noundef %44, i32 noundef 47) #8
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %54

47:                                               ; preds = %38
  %48 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %49 = getelementptr inbounds %struct.s2n_debug_info, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !14
  %51 = getelementptr inbounds i8, ptr %50, i64 21
  %52 = call ptr @strrchr(ptr noundef %51, i32 noundef 47) #8
  %53 = getelementptr inbounds i8, ptr %52, i64 1
  br label %59

54:                                               ; preds = %38
  %55 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %56 = getelementptr inbounds %struct.s2n_debug_info, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !14
  %58 = getelementptr inbounds i8, ptr %57, i64 21
  br label %59

59:                                               ; preds = %54, %47
  %60 = phi ptr [ %53, %47 ], [ %58, %54 ]
  %61 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %62 = getelementptr inbounds %struct.s2n_debug_info, ptr %61, i32 0, i32 1
  store ptr %60, ptr %62, align 8, !tbaa !16
  %63 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544345, ptr %63, align 4, !tbaa !9
  %64 = call i32 @s2n_calculate_stacktrace()
  br label %65

65:                                               ; preds = %59
  br label %66

66:                                               ; preds = %65
  %67 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %67, align 4, !tbaa !17
  store i32 1, ptr %10, align 4
  br label %155

68:                                               ; No predecessors!
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69, %33
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.s2n_blob, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !11
  %77 = ptrtoint ptr %73 to i64
  %78 = ptrtoint ptr %76 to i64
  %79 = sub i64 %77, %78
  %80 = trunc i64 %79 to i32
  store i32 %80, ptr %11, align 4, !tbaa !9
  br label %81

81:                                               ; preds = %72
  %82 = load i32, ptr %11, align 4, !tbaa !9
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.s2n_blob, ptr %83, i32 0, i32 1
  %85 = load i32, ptr %84, align 8, !tbaa !13
  %86 = icmp eq i32 %82, %85
  br i1 %86, label %121, label %87

87:                                               ; preds = %81
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  %90 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %91 = getelementptr inbounds %struct.s2n_debug_info, ptr %90, i32 0, i32 0
  store ptr @.str.17, ptr %91, align 8, !tbaa !14
  %92 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %93 = getelementptr inbounds %struct.s2n_debug_info, ptr %92, i32 0, i32 0
  %94 = load ptr, ptr %93, align 8, !tbaa !14
  %95 = getelementptr inbounds i8, ptr %94, i64 21
  %96 = call ptr @strrchr(ptr noundef %95, i32 noundef 47) #8
  %97 = icmp ne ptr %96, null
  br i1 %97, label %98, label %105

98:                                               ; preds = %89
  %99 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %100 = getelementptr inbounds %struct.s2n_debug_info, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !14
  %102 = getelementptr inbounds i8, ptr %101, i64 21
  %103 = call ptr @strrchr(ptr noundef %102, i32 noundef 47) #8
  %104 = getelementptr inbounds i8, ptr %103, i64 1
  br label %110

105:                                              ; preds = %89
  %106 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %107 = getelementptr inbounds %struct.s2n_debug_info, ptr %106, i32 0, i32 0
  %108 = load ptr, ptr %107, align 8, !tbaa !14
  %109 = getelementptr inbounds i8, ptr %108, i64 21
  br label %110

110:                                              ; preds = %105, %98
  %111 = phi ptr [ %104, %98 ], [ %109, %105 ]
  %112 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %113 = getelementptr inbounds %struct.s2n_debug_info, ptr %112, i32 0, i32 1
  store ptr %111, ptr %113, align 8, !tbaa !16
  %114 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544345, ptr %114, align 4, !tbaa !9
  %115 = call i32 @s2n_calculate_stacktrace()
  br label %116

116:                                              ; preds = %110
  br label %117

117:                                              ; preds = %116
  %118 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %118, align 4, !tbaa !17
  store i32 1, ptr %10, align 4
  br label %154

119:                                              ; No predecessors!
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120, %81
  br label %122

122:                                              ; preds = %121
  br label %123

123:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %123
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = call i32 @s2n_pkey_get_type(ptr noundef %125, ptr noundef %12)
  %127 = getelementptr inbounds %struct.s2n_result, ptr %13, i32 0, i32 0
  store i32 %126, ptr %127, align 4
  %128 = getelementptr inbounds %struct.s2n_result, ptr %13, i32 0, i32 0
  %129 = load i32, ptr %128, align 4
  %130 = call zeroext i1 @s2n_result_is_ok(i32 %129)
  br i1 %130, label %133, label %131

131:                                              ; preds = %124
  %132 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %132, align 4, !tbaa !17
  store i32 1, ptr %10, align 4
  br label %153

133:                                              ; preds = %124
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = load i32, ptr %12, align 4, !tbaa !9
  %139 = call i32 @s2n_pkey_setup_for_type(ptr noundef %137, i32 noundef %138)
  %140 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  store i32 %139, ptr %140, align 4
  %141 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  %142 = load i32, ptr %141, align 4
  %143 = call zeroext i1 @s2n_result_is_ok(i32 %142)
  br i1 %143, label %146, label %144

144:                                              ; preds = %136
  %145 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %145, align 4, !tbaa !17
  store i32 1, ptr %10, align 4
  br label %153

146:                                              ; preds = %136
  br label %147

147:                                              ; preds = %146
  br label %148

148:                                              ; preds = %147
  %149 = load ptr, ptr %9, align 8, !tbaa !5
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.s2n_pkey, ptr %150, i32 0, i32 0
  store ptr %149, ptr %151, align 8, !tbaa !19
  call void @llvm.memset.p0.i64(ptr align 8 %9, i8 0, i64 8, i1 false)
  %152 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 0, ptr %152, align 4, !tbaa !17
  store i32 1, ptr %10, align 4
  br label %153

153:                                              ; preds = %148, %144, %131
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %154

154:                                              ; preds = %153, %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %155

155:                                              ; preds = %154, %66
  call void @EVP_PKEY_free_pointer(ptr noundef %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  %156 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  %157 = load i32, ptr %156, align 4
  ret i32 %157
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @EVP_PKEY_free_pointer(ptr noundef) #4

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

attributes #0 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nounwind willreturn memory(read) "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 = { 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 #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"s2n_blob", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!13 = !{!12, !10, i64 8}
!14 = !{!15, !6, i64 0}
!15 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!16 = !{!15, !6, i64 8}
!17 = !{!18, !10, i64 0}
!18 = !{!"", !10, i64 0}
!19 = !{!20, !6, i64 0}
!20 = !{!"s2n_pkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}


; 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.s2n_debug_info = type { ptr, ptr }

@_s2n_debug_info = external thread_local local_unnamed_addr global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local local_unnamed_addr global i32, align 4
@.str.16 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [88 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_pkey_setup_for_type(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strrchr(ptr noundef, i32 noundef) local_unnamed_addr #2

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) local_unnamed_addr #4

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_pkey_get_type(ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_asn1der_to_private_key(ptr noundef %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %7 = load ptr, ptr %1, align 8, !tbaa !5
  store ptr %7, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !12
  %10 = zext i32 %9 to i64
  %11 = call ptr @d2i_AutoPrivateKey(ptr noundef null, ptr noundef nonnull %4, i64 noundef %10) #6
  store ptr %11, ptr %5, align 8, !tbaa !11
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %.thread

13:                                               ; preds = %3
  %14 = load i32, ptr %8, align 8, !tbaa !12
  %15 = zext i32 %14 to i64
  %16 = call ptr @d2i_PrivateKey(i32 noundef %2, ptr noundef null, ptr noundef nonnull %4, i64 noundef %15) #6
  store ptr %16, ptr %5, align 8, !tbaa !11
  %.not = icmp eq ptr %16, null
  br i1 %.not, label %17, label %.thread

17:                                               ; preds = %13
  %18 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.16, ptr %18, align 8, !tbaa !13
  %19 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.16, i64 21), i32 noundef 47) #7
  %.not11 = icmp eq ptr %19, null
  %20 = getelementptr inbounds i8, ptr %19, i64 1
  %21 = select i1 %.not11, ptr getelementptr inbounds (i8, ptr @.str.16, i64 21), ptr %20
  %22 = getelementptr inbounds i8, ptr %18, i64 8
  store ptr %21, ptr %22, align 8, !tbaa !15
  %23 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544345, ptr %23, align 4, !tbaa !16
  %24 = call i32 @s2n_calculate_stacktrace() #6
  br label %51

.thread:                                          ; preds = %3, %13
  %25 = phi ptr [ %16, %13 ], [ %11, %3 ]
  %26 = load ptr, ptr %4, align 8, !tbaa !11
  %27 = load ptr, ptr %1, align 8, !tbaa !5
  %28 = ptrtoint ptr %26 to i64
  %29 = ptrtoint ptr %27 to i64
  %30 = sub i64 %28, %29
  %31 = trunc i64 %30 to i32
  %32 = load i32, ptr %8, align 8, !tbaa !12
  %33 = icmp eq i32 %32, %31
  br i1 %33, label %42, label %34

34:                                               ; preds = %.thread
  %35 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.17, ptr %35, align 8, !tbaa !13
  %36 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.17, i64 21), i32 noundef 47) #7
  %.not12 = icmp eq ptr %36, null
  %37 = getelementptr inbounds i8, ptr %36, i64 1
  %38 = select i1 %.not12, ptr getelementptr inbounds (i8, ptr @.str.17, i64 21), ptr %37
  %39 = getelementptr inbounds i8, ptr %35, i64 8
  store ptr %38, ptr %39, align 8, !tbaa !15
  %40 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544345, ptr %40, align 4, !tbaa !16
  %41 = call i32 @s2n_calculate_stacktrace() #6
  br label %51

42:                                               ; preds = %.thread
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  store i32 0, ptr %6, align 4, !tbaa !16
  %43 = call i32 @s2n_pkey_get_type(ptr noundef nonnull %25, ptr noundef nonnull %6)
  %44 = call zeroext i1 @s2n_result_is_ok(i32 %43)
  br i1 %44, label %45, label %50

45:                                               ; preds = %42
  %46 = load i32, ptr %6, align 4, !tbaa !16
  %47 = call i32 @s2n_pkey_setup_for_type(ptr noundef %0, i32 noundef %46)
  %48 = call zeroext i1 @s2n_result_is_ok(i32 %47)
  br i1 %48, label %49, label %50

49:                                               ; preds = %45
  store ptr %25, ptr %0, align 8, !tbaa !17
  store i64 0, ptr %5, align 8
  br label %50

50:                                               ; preds = %45, %42, %49
  %.sroa.09.0 = phi i32 [ 0, %49 ], [ -1, %42 ], [ -1, %45 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  br label %51

51:                                               ; preds = %34, %50, %17
  %.sroa.09.2 = phi i32 [ -1, %17 ], [ %.sroa.09.0, %50 ], [ -1, %34 ]
  call void @EVP_PKEY_free_pointer(ptr noundef nonnull %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  ret i32 %.sroa.09.2
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @EVP_PKEY_free_pointer(ptr noundef) local_unnamed_addr #4

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

attributes #0 = { 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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 = !{!"s2n_blob", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!14, !7, i64 0}
!14 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!15 = !{!14, !7, i64 8}
!16 = !{!10, !10, i64 0}
!17 = !{!18, !7, i64 0}
!18 = !{!"s2n_pkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}


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