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

; 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_security_policy = type { i8, ptr, ptr, ptr, ptr, ptr, ptr, i8, [2 x i8] }
%struct.s2n_certificate_key_preferences = type { i8, ptr }
%struct.s2n_certificate_key = type { ptr, i16, i16 }
%struct.s2n_cert_info = type { i32, i32, i32, i32, i8 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.180 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.181 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.182 = external hidden unnamed_addr constant [99 x i8], align 1

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

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

declare i32 @s2n_calculate_stacktrace() #2

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_security_policy_validate_cert_key(ptr noundef %0, ptr noundef %1, i32 noundef %2) #4 {
  %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 i64, align 8
  %10 = alloca i32, 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
  br label %11

11:                                               ; preds = %3
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %46, label %14

14:                                               ; preds = %11
  br label %15

15:                                               ; preds = %14
  br label %16

16:                                               ; preds = %15
  %17 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %18 = getelementptr inbounds %struct.s2n_debug_info, ptr %17, i32 0, i32 0
  store ptr @.str.180, ptr %18, align 8, !tbaa !11
  %19 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %20 = getelementptr inbounds %struct.s2n_debug_info, ptr %19, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = getelementptr inbounds i8, ptr %21, i64 21
  %23 = call ptr @strrchr(ptr noundef %22, i32 noundef 47) #5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %32

25:                                               ; preds = %16
  %26 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %27 = getelementptr inbounds %struct.s2n_debug_info, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = getelementptr inbounds i8, ptr %28, i64 21
  %30 = call ptr @strrchr(ptr noundef %29, i32 noundef 47) #5
  %31 = getelementptr inbounds i8, ptr %30, i64 1
  br label %37

32:                                               ; preds = %16
  %33 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %34 = getelementptr inbounds %struct.s2n_debug_info, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  %36 = getelementptr inbounds i8, ptr %35, i64 21
  br label %37

37:                                               ; preds = %32, %25
  %38 = phi ptr [ %31, %25 ], [ %36, %32 ]
  %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 1
  store ptr %38, ptr %40, align 8, !tbaa !13
  %41 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %41, align 4, !tbaa !9
  %42 = call i32 @s2n_calculate_stacktrace()
  br label %43

43:                                               ; preds = %37
  %44 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %44, align 4, !tbaa !14
  br label %173

45:                                               ; No predecessors!
  br label %46

46:                                               ; preds = %45, %11
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %83, label %51

51:                                               ; preds = %48
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  %54 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %55 = getelementptr inbounds %struct.s2n_debug_info, ptr %54, i32 0, i32 0
  store ptr @.str.181, ptr %55, align 8, !tbaa !11
  %56 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %57 = getelementptr inbounds %struct.s2n_debug_info, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !11
  %59 = getelementptr inbounds i8, ptr %58, i64 21
  %60 = call ptr @strrchr(ptr noundef %59, i32 noundef 47) #5
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %69

62:                                               ; preds = %53
  %63 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %64 = getelementptr inbounds %struct.s2n_debug_info, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !11
  %66 = getelementptr inbounds i8, ptr %65, i64 21
  %67 = call ptr @strrchr(ptr noundef %66, i32 noundef 47) #5
  %68 = getelementptr inbounds i8, ptr %67, i64 1
  br label %74

69:                                               ; preds = %53
  %70 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %71 = getelementptr inbounds %struct.s2n_debug_info, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !11
  %73 = getelementptr inbounds i8, ptr %72, i64 21
  br label %74

74:                                               ; preds = %69, %62
  %75 = phi ptr [ %68, %62 ], [ %73, %69 ]
  %76 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %77 = getelementptr inbounds %struct.s2n_debug_info, ptr %76, i32 0, i32 1
  store ptr %75, ptr %77, align 8, !tbaa !13
  %78 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %78, align 4, !tbaa !9
  %79 = call i32 @s2n_calculate_stacktrace()
  br label %80

80:                                               ; preds = %74
  %81 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %81, align 4, !tbaa !14
  br label %173

82:                                               ; No predecessors!
  br label %83

83:                                               ; preds = %82, %48
  br label %84

84:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.s2n_security_policy, ptr %85, i32 0, i32 6
  %87 = load ptr, ptr %86, align 8, !tbaa !16
  store ptr %87, ptr %8, align 8, !tbaa !5
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = icmp ne ptr %88, null
  br i1 %89, label %90, label %170

90:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !19
  br label %91

91:                                               ; preds = %130, %90
  %92 = load i64, ptr %9, align 8, !tbaa !19
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.s2n_certificate_key_preferences, ptr %93, i32 0, i32 0
  %95 = load i8, ptr %94, align 8, !tbaa !21
  %96 = zext i8 %95 to i64
  %97 = icmp ult i64 %92, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %91
  store i32 14, ptr %10, align 4
  br label %133

99:                                               ; preds = %91
  %100 = load ptr, ptr %8, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.s2n_certificate_key_preferences, ptr %100, i32 0, i32 1
  %102 = load ptr, ptr %101, align 8, !tbaa !23
  %103 = load i64, ptr %9, align 8, !tbaa !19
  %104 = getelementptr inbounds ptr, ptr %102, i64 %103
  %105 = load ptr, ptr %104, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.s2n_certificate_key, ptr %105, i32 0, i32 1
  %107 = load i16, ptr %106, align 8, !tbaa !24
  %108 = zext i16 %107 to i32
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.s2n_cert_info, ptr %109, i32 0, i32 2
  %111 = load i32, ptr %110, align 4, !tbaa !27
  %112 = icmp eq i32 %108, %111
  br i1 %112, label %113, label %129

113:                                              ; preds = %99
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.s2n_certificate_key_preferences, ptr %114, i32 0, i32 1
  %116 = load ptr, ptr %115, align 8, !tbaa !23
  %117 = load i64, ptr %9, align 8, !tbaa !19
  %118 = getelementptr inbounds ptr, ptr %116, i64 %117
  %119 = load ptr, ptr %118, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.s2n_certificate_key, ptr %119, i32 0, i32 2
  %121 = load i16, ptr %120, align 2, !tbaa !29
  %122 = zext i16 %121 to i32
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.s2n_cert_info, ptr %123, i32 0, i32 3
  %125 = load i32, ptr %124, align 4, !tbaa !30
  %126 = icmp eq i32 %122, %125
  br i1 %126, label %127, label %129

127:                                              ; preds = %113
  %128 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 0, ptr %128, align 4, !tbaa !14
  store i32 1, ptr %10, align 4
  br label %133

129:                                              ; preds = %113, %99
  br label %130

130:                                              ; preds = %129
  %131 = load i64, ptr %9, align 8, !tbaa !19
  %132 = add i64 %131, 1
  store i64 %132, ptr %9, align 8, !tbaa !19
  br label %91, !llvm.loop !31

133:                                              ; preds = %127, %98
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  %134 = load i32, ptr %10, align 4
  switch i32 %134, label %172 [
    i32 14, label %135
  ]

135:                                              ; preds = %133
  br label %136

136:                                              ; preds = %135
  br label %137

137:                                              ; preds = %136
  %138 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %139 = getelementptr inbounds %struct.s2n_debug_info, ptr %138, i32 0, i32 0
  store ptr @.str.182, ptr %139, align 8, !tbaa !11
  %140 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %141 = getelementptr inbounds %struct.s2n_debug_info, ptr %140, i32 0, i32 0
  %142 = load ptr, ptr %141, align 8, !tbaa !11
  %143 = getelementptr inbounds i8, ptr %142, i64 21
  %144 = call ptr @strrchr(ptr noundef %143, i32 noundef 47) #5
  %145 = icmp ne ptr %144, null
  br i1 %145, label %146, label %153

146:                                              ; preds = %137
  %147 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %148 = getelementptr inbounds %struct.s2n_debug_info, ptr %147, i32 0, i32 0
  %149 = load ptr, ptr %148, align 8, !tbaa !11
  %150 = getelementptr inbounds i8, ptr %149, i64 21
  %151 = call ptr @strrchr(ptr noundef %150, i32 noundef 47) #5
  %152 = getelementptr inbounds i8, ptr %151, i64 1
  br label %158

153:                                              ; preds = %137
  %154 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %155 = getelementptr inbounds %struct.s2n_debug_info, ptr %154, i32 0, i32 0
  %156 = load ptr, ptr %155, align 8, !tbaa !11
  %157 = getelementptr inbounds i8, ptr %156, i64 21
  br label %158

158:                                              ; preds = %153, %146
  %159 = phi ptr [ %152, %146 ], [ %157, %153 ]
  %160 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %161 = getelementptr inbounds %struct.s2n_debug_info, ptr %160, i32 0, i32 1
  store ptr %159, ptr %161, align 8, !tbaa !13
  %162 = load i32, ptr %7, align 4, !tbaa !9
  %163 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 %162, ptr %163, align 4, !tbaa !9
  %164 = call i32 @s2n_calculate_stacktrace()
  br label %165

165:                                              ; preds = %158
  br label %166

166:                                              ; preds = %165
  %167 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %167, align 4, !tbaa !14
  store i32 1, ptr %10, align 4
  br label %172

168:                                              ; No predecessors!
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169, %84
  %171 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 0, ptr %171, align 4, !tbaa !14
  store i32 1, ptr %10, align 4
  br label %172

172:                                              ; preds = %170, %166, %133
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %173

173:                                              ; preds = %172, %80, %43
  %174 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  %175 = load i32, ptr %174, align 4
  ret i32 %175
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = { nounwind willreturn memory(read) }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!15, !10, i64 0}
!15 = !{!"", !10, i64 0}
!16 = !{!17, !6, i64 48}
!17 = !{!"s2n_security_policy", !7, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !18, i64 56, !7, i64 57}
!18 = !{!"_Bool", !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!22, !7, i64 0}
!22 = !{!"s2n_certificate_key_preferences", !7, i64 0, !6, i64 8}
!23 = !{!22, !6, i64 8}
!24 = !{!25, !26, i64 8}
!25 = !{!"s2n_certificate_key", !6, i64 0, !26, i64 8, !26, i64 10}
!26 = !{!"short", !7, i64 0}
!27 = !{!28, !10, i64 8}
!28 = !{!"s2n_cert_info", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !18, i64 16}
!29 = !{!25, !26, i64 10}
!30 = !{!28, !10, i64 12}
!31 = distinct !{!31, !32}
!32 = !{!"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"

%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.180 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.181 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.182 = external hidden unnamed_addr constant [99 x i8], align 1

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_security_policy_validate_cert_key(ptr noundef readonly %0, ptr noundef readonly %1, i32 noundef %2) local_unnamed_addr #3 {
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %.loopexit.sink.split, label %4

4:                                                ; preds = %3
  %.not22 = icmp eq ptr %0, null
  br i1 %.not22, label %.loopexit.sink.split, label %5

5:                                                ; preds = %4
  %6 = getelementptr inbounds i8, ptr %0, i64 48
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %.not24 = icmp eq ptr %7, null
  br i1 %.not24, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %5
  %8 = load i8, ptr %7, align 8, !tbaa !11
  %9 = zext i8 %8 to i64
  %.not2527.not = icmp eq i8 %8, 0
  br i1 %.not2527.not, label %.loopexit.sink.split, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %10 = getelementptr inbounds i8, ptr %7, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load i32, ptr %12, align 4, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %1, i64 12
  br label %15

15:                                               ; preds = %.lr.ph, %28
  %.01428 = phi i64 [ 0, %.lr.ph ], [ %29, %28 ]
  %16 = getelementptr inbounds ptr, ptr %11, i64 %.01428
  %17 = load ptr, ptr %16, align 8, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %17, i64 8
  %19 = load i16, ptr %18, align 8, !tbaa !18
  %20 = zext i16 %19 to i32
  %21 = icmp eq i32 %13, %20
  br i1 %21, label %22, label %28

22:                                               ; preds = %15
  %23 = getelementptr inbounds i8, ptr %17, i64 10
  %24 = load i16, ptr %23, align 2, !tbaa !21
  %25 = zext i16 %24 to i32
  %26 = load i32, ptr %14, align 4, !tbaa !22
  %27 = icmp eq i32 %26, %25
  br i1 %27, label %.loopexit, label %28

28:                                               ; preds = %15, %22
  %29 = add nuw nsw i64 %.01428, 1
  %exitcond.not = icmp eq i64 %29, %9
  br i1 %exitcond.not, label %.loopexit.sink.split, label %15, !llvm.loop !23

.loopexit.sink.split:                             ; preds = %28, %.preheader, %4, %3
  %.str.182.sink = phi ptr [ @.str.180, %3 ], [ @.str.181, %4 ], [ @.str.182, %.preheader ], [ @.str.182, %28 ]
  %.sink37 = phi ptr [ getelementptr inbounds (i8, ptr @.str.180, i64 21), %3 ], [ getelementptr inbounds (i8, ptr @.str.181, i64 21), %4 ], [ getelementptr inbounds (i8, ptr @.str.182, i64 21), %.preheader ], [ getelementptr inbounds (i8, ptr @.str.182, i64 21), %28 ]
  %.sink = phi i32 [ 402653193, %3 ], [ 402653193, %4 ], [ %2, %.preheader ], [ %2, %28 ]
  %30 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr %.str.182.sink, ptr %30, align 8, !tbaa !25
  %31 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) %.sink37, i32 noundef 47) #4
  %.not26 = icmp eq ptr %31, null
  %32 = getelementptr inbounds i8, ptr %31, i64 1
  %33 = select i1 %.not26, ptr %.sink37, ptr %32
  %34 = getelementptr inbounds i8, ptr %30, i64 8
  store ptr %33, ptr %34, align 8, !tbaa !27
  %35 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 %.sink, ptr %35, align 4, !tbaa !28
  %36 = tail call i32 @s2n_calculate_stacktrace() #5
  br label %.loopexit

.loopexit:                                        ; preds = %22, %.loopexit.sink.split, %5
  %.sroa.0.2 = phi i32 [ 0, %5 ], [ -1, %.loopexit.sink.split ], [ 0, %22 ]
  ret i32 %.sroa.0.2
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #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 = { 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 #4 = { nounwind willreturn memory(read) }
attributes #5 = { 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, !9, i64 48}
!6 = !{!"s2n_security_policy", !7, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !9, i64 32, !9, i64 40, !9, i64 48, !10, i64 56, !7, i64 57}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"s2n_certificate_key_preferences", !7, i64 0, !9, i64 8}
!13 = !{!12, !9, i64 8}
!14 = !{!15, !16, i64 8}
!15 = !{!"s2n_cert_info", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12, !10, i64 16}
!16 = !{!"int", !7, i64 0}
!17 = !{!9, !9, i64 0}
!18 = !{!19, !20, i64 8}
!19 = !{!"s2n_certificate_key", !9, i64 0, !20, i64 8, !20, i64 10}
!20 = !{!"short", !7, i64 0}
!21 = !{!19, !20, i64 10}
!22 = !{!15, !16, i64 12}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!26, !9, i64 0}
!26 = !{!"s2n_debug_info", !9, i64 0, !9, i64 8}
!27 = !{!26, !9, i64 8}
!28 = !{!16, !16, i64 0}


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