; LLVM IR from aws/s2n-tls :: tests/unit (s2n_resume_test)

; 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_config = type { i32, ptr, ptr, %struct.certs_by_type, %struct.s2n_blob, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, i64, ptr, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, i32, i8, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, %struct.s2n_x509_trust_store, i16, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, i32, i32, ptr, ptr, i32, %struct.s2n_blob }
%struct.certs_by_type = type { [4 x ptr] }
%struct.s2n_x509_trust_store = type { ptr, i8 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.s2n_ticket_key = type { [16 x i8], [32 x i8], [12 x i8], i64 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.24 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [87 x i8], align 1

; 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 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_config_is_encrypt_key_available(ptr noundef %0) #5 {
  %2 = alloca %struct.s2n_result, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.s2n_result, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %struct.s2n_result, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %struct.s2n_result, align 4
  %13 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %1
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %49, label %17

17:                                               ; preds = %14
  br label %18

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18
  %20 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %21 = getelementptr inbounds %struct.s2n_debug_info, ptr %20, i32 0, i32 0
  store ptr @.str.24, ptr %21, align 8, !tbaa !9
  %22 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %23 = getelementptr inbounds %struct.s2n_debug_info, ptr %22, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %24, i64 21
  %26 = call ptr @strrchr(ptr noundef %25, i32 noundef 47) #6
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %35

28:                                               ; preds = %19
  %29 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %30 = getelementptr inbounds %struct.s2n_debug_info, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %32 = getelementptr inbounds i8, ptr %31, i64 21
  %33 = call ptr @strrchr(ptr noundef %32, i32 noundef 47) #6
  %34 = getelementptr inbounds i8, ptr %33, i64 1
  br label %40

35:                                               ; preds = %19
  %36 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %37 = getelementptr inbounds %struct.s2n_debug_info, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = getelementptr inbounds i8, ptr %38, i64 21
  br label %40

40:                                               ; preds = %35, %28
  %41 = phi ptr [ %34, %28 ], [ %39, %35 ]
  %42 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %43 = getelementptr inbounds %struct.s2n_debug_info, ptr %42, i32 0, i32 1
  store ptr %41, ptr %43, align 8, !tbaa !11
  %44 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %44, align 4, !tbaa !12
  %45 = call i32 @s2n_calculate_stacktrace()
  br label %46

46:                                               ; preds = %40
  %47 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %47, align 4, !tbaa !14
  br label %205

48:                                               ; No predecessors!
  br label %49

49:                                               ; preds = %48, %14
  br label %50

50:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store i64 0, ptr %4, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store ptr null, ptr %5, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = call i32 @s2n_config_wall_clock(ptr noundef %52, ptr noundef %4)
  %54 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 %53, ptr %54, align 4
  %55 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  %56 = load i32, ptr %55, align 4
  %57 = call zeroext i1 @s2n_result_is_ok(i32 %56)
  br i1 %57, label %60, label %58

58:                                               ; preds = %51
  %59 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %59, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %203

60:                                               ; preds = %51
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.s2n_config, ptr %64, i32 0, i32 15
  %66 = load ptr, ptr %65, align 8, !tbaa !18
  %67 = icmp ne ptr %66, null
  br i1 %67, label %102, label %68

68:                                               ; preds = %63
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  %71 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %72 = getelementptr inbounds %struct.s2n_debug_info, ptr %71, i32 0, i32 0
  store ptr @.str.25, ptr %72, align 8, !tbaa !9
  %73 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %74 = getelementptr inbounds %struct.s2n_debug_info, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !9
  %76 = getelementptr inbounds i8, ptr %75, i64 21
  %77 = call ptr @strrchr(ptr noundef %76, i32 noundef 47) #6
  %78 = icmp ne ptr %77, null
  br i1 %78, label %79, label %86

79:                                               ; preds = %70
  %80 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %81 = getelementptr inbounds %struct.s2n_debug_info, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !9
  %83 = getelementptr inbounds i8, ptr %82, i64 21
  %84 = call ptr @strrchr(ptr noundef %83, i32 noundef 47) #6
  %85 = getelementptr inbounds i8, ptr %84, i64 1
  br label %91

86:                                               ; preds = %70
  %87 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %88 = getelementptr inbounds %struct.s2n_debug_info, ptr %87, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8, !tbaa !9
  %90 = getelementptr inbounds i8, ptr %89, i64 21
  br label %91

91:                                               ; preds = %86, %79
  %92 = phi ptr [ %85, %79 ], [ %90, %86 ]
  %93 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %94 = getelementptr inbounds %struct.s2n_debug_info, ptr %93, i32 0, i32 1
  store ptr %92, ptr %94, align 8, !tbaa !11
  %95 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %95, align 4, !tbaa !12
  %96 = call i32 @s2n_calculate_stacktrace()
  br label %97

97:                                               ; preds = %91
  br label %98

98:                                               ; preds = %97
  %99 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %99, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %203

100:                                              ; No predecessors!
  br label %101

101:                                              ; preds = %100
  br label %102

102:                                              ; preds = %101, %63
  br label %103

103:                                              ; preds = %102
  br label %104

104:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !12
  br label %105

105:                                              ; preds = %104
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.s2n_config, ptr %106, i32 0, i32 15
  %108 = load ptr, ptr %107, align 8, !tbaa !18
  %109 = call i32 @s2n_array_num_elements(ptr noundef %108, ptr noundef %8)
  %110 = getelementptr inbounds %struct.s2n_result, ptr %9, i32 0, i32 0
  store i32 %109, ptr %110, align 4
  %111 = getelementptr inbounds %struct.s2n_result, ptr %9, i32 0, i32 0
  %112 = load i32, ptr %111, align 4
  %113 = call zeroext i1 @s2n_result_is_ok(i32 %112)
  br i1 %113, label %116, label %114

114:                                              ; preds = %105
  %115 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %115, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %202

116:                                              ; preds = %105
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %119 = load i32, ptr %8, align 4, !tbaa !12
  store i32 %119, ptr %10, align 4, !tbaa !12
  br label %120

120:                                              ; preds = %163, %118
  %121 = load i32, ptr %10, align 4, !tbaa !12
  %122 = icmp ugt i32 %121, 0
  br i1 %122, label %124, label %123

123:                                              ; preds = %120
  store i32 18, ptr %7, align 4
  br label %166

124:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %125 = load i32, ptr %10, align 4, !tbaa !12
  %126 = sub i32 %125, 1
  store i32 %126, ptr %11, align 4, !tbaa !12
  br label %127

127:                                              ; preds = %124
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.s2n_config, ptr %128, i32 0, i32 15
  %130 = load ptr, ptr %129, align 8, !tbaa !18
  %131 = load i32, ptr %11, align 4, !tbaa !12
  %132 = call i32 @s2n_array_get(ptr noundef %130, i32 noundef %131, ptr noundef %5)
  %133 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  store i32 %132, ptr %133, align 4
  %134 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  %135 = load i32, ptr %134, align 4
  %136 = call zeroext i1 @s2n_result_is_ok(i32 %135)
  br i1 %136, label %139, label %137

137:                                              ; preds = %127
  %138 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %138, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %160

139:                                              ; preds = %127
  br label %140

140:                                              ; preds = %139
  br label %141

141:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.s2n_ticket_key, ptr %142, i32 0, i32 3
  %144 = load i64, ptr %143, align 8, !tbaa !24
  store i64 %144, ptr %13, align 8, !tbaa !16
  %145 = load i64, ptr %13, align 8, !tbaa !16
  %146 = load i64, ptr %4, align 8, !tbaa !16
  %147 = icmp ule i64 %145, %146
  br i1 %147, label %148, label %158

148:                                              ; preds = %141
  %149 = load i64, ptr %4, align 8, !tbaa !16
  %150 = load i64, ptr %13, align 8, !tbaa !16
  %151 = load ptr, ptr %3, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.s2n_config, ptr %151, i32 0, i32 16
  %153 = load i64, ptr %152, align 8, !tbaa !26
  %154 = add i64 %150, %153
  %155 = icmp ult i64 %149, %154
  br i1 %155, label %156, label %158

156:                                              ; preds = %148
  %157 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 0, ptr %157, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %159

158:                                              ; preds = %148, %141
  store i32 0, ptr %7, align 4
  br label %159

159:                                              ; preds = %158, %156
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %160

160:                                              ; preds = %159, %137
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  %161 = load i32, ptr %7, align 4
  switch i32 %161, label %166 [
    i32 0, label %162
  ]

162:                                              ; preds = %160
  br label %163

163:                                              ; preds = %162
  %164 = load i32, ptr %10, align 4, !tbaa !12
  %165 = add i32 %164, -1
  store i32 %165, ptr %10, align 4, !tbaa !12
  br label %120, !llvm.loop !27

166:                                              ; preds = %160, %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %167 = load i32, ptr %7, align 4
  switch i32 %167, label %202 [
    i32 18, label %168
  ]

168:                                              ; preds = %166
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169
  %171 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %172 = getelementptr inbounds %struct.s2n_debug_info, ptr %171, i32 0, i32 0
  store ptr @.str.26, ptr %172, align 8, !tbaa !9
  %173 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %174 = getelementptr inbounds %struct.s2n_debug_info, ptr %173, i32 0, i32 0
  %175 = load ptr, ptr %174, align 8, !tbaa !9
  %176 = getelementptr inbounds i8, ptr %175, i64 21
  %177 = call ptr @strrchr(ptr noundef %176, i32 noundef 47) #6
  %178 = icmp ne ptr %177, null
  br i1 %178, label %179, label %186

179:                                              ; preds = %170
  %180 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %181 = getelementptr inbounds %struct.s2n_debug_info, ptr %180, i32 0, i32 0
  %182 = load ptr, ptr %181, align 8, !tbaa !9
  %183 = getelementptr inbounds i8, ptr %182, i64 21
  %184 = call ptr @strrchr(ptr noundef %183, i32 noundef 47) #6
  %185 = getelementptr inbounds i8, ptr %184, i64 1
  br label %191

186:                                              ; preds = %170
  %187 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %188 = getelementptr inbounds %struct.s2n_debug_info, ptr %187, i32 0, i32 0
  %189 = load ptr, ptr %188, align 8, !tbaa !9
  %190 = getelementptr inbounds i8, ptr %189, i64 21
  br label %191

191:                                              ; preds = %186, %179
  %192 = phi ptr [ %185, %179 ], [ %190, %186 ]
  %193 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %194 = getelementptr inbounds %struct.s2n_debug_info, ptr %193, i32 0, i32 1
  store ptr %192, ptr %194, align 8, !tbaa !11
  %195 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762084, ptr %195, align 4, !tbaa !12
  %196 = call i32 @s2n_calculate_stacktrace()
  br label %197

197:                                              ; preds = %191
  br label %198

198:                                              ; preds = %197
  %199 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %199, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %202

200:                                              ; No predecessors!
  br label %201

201:                                              ; preds = %200
  store i32 0, ptr %7, align 4
  br label %202

202:                                              ; preds = %201, %198, %166, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %203

203:                                              ; preds = %202, %98, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  %204 = load i32, ptr %7, align 4
  switch i32 %204, label %208 [
    i32 0, label %205
    i32 1, label %205
  ]

205:                                              ; preds = %203, %203, %46
  %206 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  %207 = load i32, ptr %206, align 4
  ret i32 %207

208:                                              ; preds = %203
  unreachable
}

declare i32 @s2n_config_wall_clock(ptr noundef, ptr noundef) #3

declare i32 @s2n_array_num_elements(ptr noundef, ptr noundef) #3

declare i32 @s2n_array_get(ptr noundef, i32 noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #6 = { nounwind willreturn memory(read) }
attributes #7 = { 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, !6, i64 0}
!10 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 0}
!15 = !{!"", !13, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!19, !6, i64 152}
!19 = !{!"s2n_config", !13, i64 0, !13, i64 0, !13, i64 0, !13, i64 0, !13, i64 0, !13, i64 0, !13, i64 0, !13, i64 0, !13, i64 1, !13, i64 1, !13, i64 1, !13, i64 1, !13, i64 1, !13, i64 1, !13, i64 1, !13, i64 1, !13, i64 2, !13, i64 2, !13, i64 2, !13, i64 2, !6, i64 8, !6, i64 16, !20, i64 24, !21, i64 56, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !13, i64 128, !13, i64 132, !6, i64 136, !17, i64 144, !6, i64 152, !17, i64 160, !17, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !13, i64 224, !7, i64 228, !13, i64 232, !13, i64 236, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !22, i64 304, !23, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !13, i64 392, !13, i64 396, !13, i64 400, !6, i64 408, !13, i64 416, !13, i64 420, !6, i64 424, !6, i64 432, !13, i64 440, !21, i64 448}
!20 = !{!"certs_by_type", !7, i64 0}
!21 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!22 = !{!"s2n_x509_trust_store", !6, i64 0, !13, i64 8}
!23 = !{!"short", !7, i64 0}
!24 = !{!25, !17, i64 64}
!25 = !{!"s2n_ticket_key", !7, i64 0, !7, i64 16, !7, i64 48, !17, i64 64}
!26 = !{!19, !17, i64 160}
!27 = distinct !{!27, !28}
!28 = !{!"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.24 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [87 x i8], align 1

; 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 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @s2n_config_is_encrypt_key_available(ptr noundef %0) local_unnamed_addr #5 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %5, label %13

5:                                                ; preds = %1
  %6 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.24, ptr %6, align 8, !tbaa !5
  %7 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.24, i64 21), i32 noundef 47) #6
  %.not24 = icmp eq ptr %7, null
  %8 = getelementptr inbounds i8, ptr %7, i64 1
  %9 = select i1 %.not24, ptr getelementptr inbounds (i8, ptr @.str.24, i64 21), ptr %8
  %10 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr %9, ptr %10, align 8, !tbaa !10
  %11 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %11, align 4, !tbaa !11
  %12 = tail call i32 @s2n_calculate_stacktrace() #7
  br label %56

13:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  store i64 0, ptr %2, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  store ptr null, ptr %3, align 8, !tbaa !15
  %14 = call i32 @s2n_config_wall_clock(ptr noundef nonnull %0, ptr noundef nonnull %2) #7
  %15 = call zeroext i1 @s2n_result_is_ok(i32 %14)
  br i1 %15, label %16, label %55

16:                                               ; preds = %13
  %17 = getelementptr inbounds i8, ptr %0, i64 152
  %18 = load ptr, ptr %17, align 8, !tbaa !16
  %.not25 = icmp eq ptr %18, null
  br i1 %.not25, label %19, label %27

19:                                               ; preds = %16
  %20 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.25, ptr %20, align 8, !tbaa !5
  %21 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.25, i64 21), i32 noundef 47) #6
  %.not26 = icmp eq ptr %21, null
  %22 = getelementptr inbounds i8, ptr %21, i64 1
  %23 = select i1 %.not26, ptr getelementptr inbounds (i8, ptr @.str.25, i64 21), ptr %22
  %24 = getelementptr inbounds i8, ptr %20, i64 8
  store ptr %23, ptr %24, align 8, !tbaa !10
  %25 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %25, align 4, !tbaa !11
  %26 = call i32 @s2n_calculate_stacktrace() #7
  br label %55

27:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 0, ptr %4, align 4, !tbaa !11
  %28 = call i32 @s2n_array_num_elements(ptr noundef nonnull %18, ptr noundef nonnull %4) #7
  %29 = call zeroext i1 @s2n_result_is_ok(i32 %28)
  br i1 %29, label %30, label %.loopexit

30:                                               ; preds = %27
  %31 = load i32, ptr %4, align 4, !tbaa !11
  %.not2735 = icmp eq i32 %31, 0
  br i1 %.not2735, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %30
  %32 = getelementptr inbounds i8, ptr %0, i64 160
  br label %33

33:                                               ; preds = %.lr.ph, %47
  %.01736 = phi i32 [ %31, %.lr.ph ], [ %34, %47 ]
  %34 = add i32 %.01736, -1
  %35 = load ptr, ptr %17, align 8, !tbaa !16
  %36 = call i32 @s2n_array_get(ptr noundef %35, i32 noundef %34, ptr noundef nonnull %3) #7
  %37 = call zeroext i1 @s2n_result_is_ok(i32 %36)
  br i1 %37, label %38, label %.loopexit

38:                                               ; preds = %33
  %39 = load ptr, ptr %3, align 8, !tbaa !15
  %40 = getelementptr inbounds i8, ptr %39, i64 64
  %41 = load i64, ptr %40, align 8, !tbaa !22
  %42 = load i64, ptr %2, align 8, !tbaa !13
  %.not28 = icmp ugt i64 %41, %42
  br i1 %.not28, label %47, label %43

43:                                               ; preds = %38
  %44 = load i64, ptr %32, align 8, !tbaa !24
  %45 = add i64 %44, %41
  %46 = icmp ult i64 %42, %45
  br i1 %46, label %.loopexit, label %47

47:                                               ; preds = %43, %38
  %.not27 = icmp eq i32 %34, 0
  br i1 %.not27, label %._crit_edge, label %33, !llvm.loop !25

._crit_edge:                                      ; preds = %47, %30
  %48 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.26, ptr %48, align 8, !tbaa !5
  %49 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.26, i64 21), i32 noundef 47) #6
  %.not29 = icmp eq ptr %49, null
  %50 = getelementptr inbounds i8, ptr %49, i64 1
  %51 = select i1 %.not29, ptr getelementptr inbounds (i8, ptr @.str.26, i64 21), ptr %50
  %52 = getelementptr inbounds i8, ptr %48, i64 8
  store ptr %51, ptr %52, align 8, !tbaa !10
  %53 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762084, ptr %53, align 4, !tbaa !11
  %54 = call i32 @s2n_calculate_stacktrace() #7
  br label %.loopexit

.loopexit:                                        ; preds = %43, %33, %27, %._crit_edge
  %.sroa.016.4 = phi i32 [ -1, %._crit_edge ], [ -1, %27 ], [ -1, %33 ], [ 0, %43 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %55

55:                                               ; preds = %13, %.loopexit, %19
  %.sroa.016.5 = phi i32 [ %.sroa.016.4, %.loopexit ], [ -1, %19 ], [ -1, %13 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  br label %56

56:                                               ; preds = %55, %5
  %.sroa.016.6 = phi i32 [ %.sroa.016.5, %55 ], [ -1, %5 ]
  ret i32 %.sroa.016.6
}

declare i32 @s2n_config_wall_clock(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @s2n_array_num_elements(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @s2n_array_get(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !8, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !7, i64 152}
!17 = !{!"s2n_config", !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 0, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 1, !12, i64 2, !12, i64 2, !12, i64 2, !12, i64 2, !7, i64 8, !7, i64 16, !18, i64 24, !19, i64 56, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !12, i64 128, !12, i64 132, !7, i64 136, !14, i64 144, !7, i64 152, !14, i64 160, !14, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !12, i64 224, !8, i64 228, !12, i64 232, !12, i64 236, !7, i64 240, !7, i64 248, !7, i64 256, !7, i64 264, !7, i64 272, !7, i64 280, !7, i64 288, !8, i64 296, !8, i64 297, !20, i64 304, !21, i64 320, !7, i64 328, !7, i64 336, !7, i64 344, !7, i64 352, !7, i64 360, !7, i64 368, !7, i64 376, !7, i64 384, !12, i64 392, !12, i64 396, !12, i64 400, !7, i64 408, !12, i64 416, !12, i64 420, !7, i64 424, !7, i64 432, !12, i64 440, !19, i64 448}
!18 = !{!"certs_by_type", !8, i64 0}
!19 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!20 = !{!"s2n_x509_trust_store", !7, i64 0, !12, i64 8}
!21 = !{!"short", !8, i64 0}
!22 = !{!23, !14, i64 64}
!23 = !{!"s2n_ticket_key", !8, i64 0, !8, i64 16, !8, i64 48, !14, i64 64}
!24 = !{!17, !14, i64 160}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


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