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

; 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.session_cache_entry = type { [32 x i8], i8, [255 x i8], i8 }

@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.42 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [5 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @cache_retrieve_callback(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4, ptr noundef %5) #1 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca i8, align 1
  %20 = alloca i64, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store i64 %3, ptr %11, align 8, !tbaa !9
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %21, ptr %14, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %23 = load i64, ptr %11, align 8, !tbaa !9
  store i64 %23, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  store i64 1, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  store i64 32, ptr %17, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %22
  %25 = load i64, ptr %15, align 8, !tbaa !9
  %26 = load i64, ptr %16, align 8, !tbaa !9
  %27 = icmp uge i64 %25, %26
  br i1 %27, label %61, label %28

28:                                               ; preds = %24
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  %31 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %32 = getelementptr inbounds %struct.s2n_debug_info, ptr %31, i32 0, i32 0
  store ptr @.str.42, ptr %32, align 8, !tbaa !11
  %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
  %37 = call ptr @strrchr(ptr noundef %36, i32 noundef 47) #7
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %46

39:                                               ; preds = %30
  %40 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %41 = getelementptr inbounds %struct.s2n_debug_info, ptr %40, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !11
  %43 = getelementptr inbounds i8, ptr %42, i64 21
  %44 = call ptr @strrchr(ptr noundef %43, i32 noundef 47) #7
  %45 = getelementptr inbounds i8, ptr %44, i64 1
  br label %51

46:                                               ; preds = %30
  %47 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %48 = getelementptr inbounds %struct.s2n_debug_info, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !11
  %50 = getelementptr inbounds i8, ptr %49, i64 21
  br label %51

51:                                               ; preds = %46, %39
  %52 = phi ptr [ %45, %39 ], [ %50, %46 ]
  %53 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %54 = getelementptr inbounds %struct.s2n_debug_info, ptr %53, i32 0, i32 1
  store ptr %52, ptr %54, align 8, !tbaa !13
  %55 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %55, align 4, !tbaa !14
  %56 = call i32 @s2n_calculate_stacktrace()
  br label %57

57:                                               ; preds = %51
  br label %58

58:                                               ; preds = %57
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %18, align 4
  br label %104

59:                                               ; No predecessors!
  br label %60

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %60, %24
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63
  %65 = load i64, ptr %15, align 8, !tbaa !9
  %66 = load i64, ptr %17, align 8, !tbaa !9
  %67 = icmp ule i64 %65, %66
  br i1 %67, label %101, label %68

68:                                               ; preds = %64
  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.42, ptr %72, align 8, !tbaa !11
  %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 !11
  %76 = getelementptr inbounds i8, ptr %75, i64 21
  %77 = call ptr @strrchr(ptr noundef %76, i32 noundef 47) #7
  %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 !11
  %83 = getelementptr inbounds i8, ptr %82, i64 21
  %84 = call ptr @strrchr(ptr noundef %83, i32 noundef 47) #7
  %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 !11
  %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 !13
  %95 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %95, align 4, !tbaa !14
  %96 = call i32 @s2n_calculate_stacktrace()
  br label %97

97:                                               ; preds = %91
  br label %98

98:                                               ; preds = %97
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %18, align 4
  br label %104

99:                                               ; No predecessors!
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100, %64
  br label %102

102:                                              ; preds = %101
  br label %103

103:                                              ; preds = %102
  store i32 0, ptr %18, align 4
  br label %104

104:                                              ; preds = %103, %98, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  %105 = load i32, ptr %18, align 4
  switch i32 %105, label %292 [
    i32 0, label %106
  ]

106:                                              ; preds = %104
  br label %107

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #6
  %109 = load ptr, ptr %10, align 8, !tbaa !5
  %110 = getelementptr inbounds i8, ptr %109, i64 0
  %111 = load i8, ptr %110, align 1, !tbaa !16
  store i8 %111, ptr %19, align 1, !tbaa !16
  br label %112

112:                                              ; preds = %108
  %113 = load ptr, ptr %14, align 8, !tbaa !5
  %114 = load i8, ptr %19, align 1, !tbaa !16
  %115 = zext i8 %114 to i64
  %116 = getelementptr inbounds %struct.session_cache_entry, ptr %113, i64 %115
  %117 = getelementptr inbounds %struct.session_cache_entry, ptr %116, i32 0, i32 1
  %118 = load i8, ptr %117, align 1, !tbaa !17
  %119 = zext i8 %118 to i64
  %120 = load i64, ptr %11, align 8, !tbaa !9
  %121 = icmp eq i64 %119, %120
  br i1 %121, label %155, label %122

122:                                              ; preds = %112
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  %125 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %126 = getelementptr inbounds %struct.s2n_debug_info, ptr %125, i32 0, i32 0
  store ptr @.str.43, ptr %126, align 8, !tbaa !11
  %127 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %128 = getelementptr inbounds %struct.s2n_debug_info, ptr %127, i32 0, i32 0
  %129 = load ptr, ptr %128, align 8, !tbaa !11
  %130 = getelementptr inbounds i8, ptr %129, i64 21
  %131 = call ptr @strrchr(ptr noundef %130, i32 noundef 47) #7
  %132 = icmp ne ptr %131, null
  br i1 %132, label %133, label %140

133:                                              ; preds = %124
  %134 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %135 = getelementptr inbounds %struct.s2n_debug_info, ptr %134, i32 0, i32 0
  %136 = load ptr, ptr %135, align 8, !tbaa !11
  %137 = getelementptr inbounds i8, ptr %136, i64 21
  %138 = call ptr @strrchr(ptr noundef %137, i32 noundef 47) #7
  %139 = getelementptr inbounds i8, ptr %138, i64 1
  br label %145

140:                                              ; preds = %124
  %141 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %142 = getelementptr inbounds %struct.s2n_debug_info, ptr %141, i32 0, i32 0
  %143 = load ptr, ptr %142, align 8, !tbaa !11
  %144 = getelementptr inbounds i8, ptr %143, i64 21
  br label %145

145:                                              ; preds = %140, %133
  %146 = phi ptr [ %139, %133 ], [ %144, %140 ]
  %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 1
  store ptr %146, ptr %148, align 8, !tbaa !13
  %149 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762089, ptr %149, align 4, !tbaa !14
  %150 = call i32 @s2n_calculate_stacktrace()
  br label %151

151:                                              ; preds = %145
  br label %152

152:                                              ; preds = %151
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %18, align 4
  br label %291

153:                                              ; No predecessors!
  br label %154

154:                                              ; preds = %153
  br label %155

155:                                              ; preds = %154, %112
  br label %156

156:                                              ; preds = %155
  br label %157

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157
  %159 = load ptr, ptr %14, align 8, !tbaa !5
  %160 = load i8, ptr %19, align 1, !tbaa !16
  %161 = zext i8 %160 to i64
  %162 = getelementptr inbounds %struct.session_cache_entry, ptr %159, i64 %161
  %163 = getelementptr inbounds %struct.session_cache_entry, ptr %162, i32 0, i32 0
  %164 = getelementptr inbounds [32 x i8], ptr %163, i64 0, i64 0
  %165 = load ptr, ptr %10, align 8, !tbaa !5
  %166 = load i64, ptr %11, align 8, !tbaa !9
  %167 = call i32 @memcmp(ptr noundef %164, ptr noundef %165, i64 noundef %166) #7
  %168 = icmp eq i32 %167, 0
  br i1 %168, label %202, label %169

169:                                              ; preds = %158
  br label %170

170:                                              ; preds = %169
  br label %171

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

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

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

192:                                              ; preds = %187, %180
  %193 = phi ptr [ %186, %180 ], [ %191, %187 ]
  %194 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %195 = getelementptr inbounds %struct.s2n_debug_info, ptr %194, i32 0, i32 1
  store ptr %193, ptr %195, align 8, !tbaa !13
  %196 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762089, ptr %196, align 4, !tbaa !14
  %197 = call i32 @s2n_calculate_stacktrace()
  br label %198

198:                                              ; preds = %192
  br label %199

199:                                              ; preds = %198
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %18, align 4
  br label %291

200:                                              ; No predecessors!
  br label %201

201:                                              ; preds = %200
  br label %202

202:                                              ; preds = %201, %158
  br label %203

203:                                              ; preds = %202
  br label %204

204:                                              ; preds = %203
  br label %205

205:                                              ; preds = %204
  %206 = load ptr, ptr %13, align 8, !tbaa !5
  %207 = load i64, ptr %206, align 8, !tbaa !9
  %208 = load ptr, ptr %14, align 8, !tbaa !5
  %209 = load i8, ptr %19, align 1, !tbaa !16
  %210 = zext i8 %209 to i64
  %211 = getelementptr inbounds %struct.session_cache_entry, ptr %208, i64 %210
  %212 = getelementptr inbounds %struct.session_cache_entry, ptr %211, i32 0, i32 3
  %213 = load i8, ptr %212, align 1, !tbaa !19
  %214 = zext i8 %213 to i64
  %215 = icmp uge i64 %207, %214
  br i1 %215, label %249, label %216

216:                                              ; preds = %205
  br label %217

217:                                              ; preds = %216
  br label %218

218:                                              ; preds = %217
  %219 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %220 = getelementptr inbounds %struct.s2n_debug_info, ptr %219, i32 0, i32 0
  store ptr @.str.45, ptr %220, align 8, !tbaa !11
  %221 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %222 = getelementptr inbounds %struct.s2n_debug_info, ptr %221, i32 0, i32 0
  %223 = load ptr, ptr %222, align 8, !tbaa !11
  %224 = getelementptr inbounds i8, ptr %223, i64 21
  %225 = call ptr @strrchr(ptr noundef %224, i32 noundef 47) #7
  %226 = icmp ne ptr %225, null
  br i1 %226, label %227, label %234

227:                                              ; preds = %218
  %228 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %229 = getelementptr inbounds %struct.s2n_debug_info, ptr %228, i32 0, i32 0
  %230 = load ptr, ptr %229, align 8, !tbaa !11
  %231 = getelementptr inbounds i8, ptr %230, i64 21
  %232 = call ptr @strrchr(ptr noundef %231, i32 noundef 47) #7
  %233 = getelementptr inbounds i8, ptr %232, i64 1
  br label %239

234:                                              ; preds = %218
  %235 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %236 = getelementptr inbounds %struct.s2n_debug_info, ptr %235, i32 0, i32 0
  %237 = load ptr, ptr %236, align 8, !tbaa !11
  %238 = getelementptr inbounds i8, ptr %237, i64 21
  br label %239

239:                                              ; preds = %234, %227
  %240 = phi ptr [ %233, %227 ], [ %238, %234 ]
  %241 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %242 = getelementptr inbounds %struct.s2n_debug_info, ptr %241, i32 0, i32 1
  store ptr %240, ptr %242, align 8, !tbaa !13
  %243 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762089, ptr %243, align 4, !tbaa !14
  %244 = call i32 @s2n_calculate_stacktrace()
  br label %245

245:                                              ; preds = %239
  br label %246

246:                                              ; preds = %245
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %18, align 4
  br label %291

247:                                              ; No predecessors!
  br label %248

248:                                              ; preds = %247
  br label %249

249:                                              ; preds = %248, %205
  br label %250

250:                                              ; preds = %249
  br label %251

251:                                              ; preds = %250
  %252 = load ptr, ptr %14, align 8, !tbaa !5
  %253 = load i8, ptr %19, align 1, !tbaa !16
  %254 = zext i8 %253 to i64
  %255 = getelementptr inbounds %struct.session_cache_entry, ptr %252, i64 %254
  %256 = getelementptr inbounds %struct.session_cache_entry, ptr %255, i32 0, i32 3
  %257 = load i8, ptr %256, align 1, !tbaa !19
  %258 = zext i8 %257 to i64
  %259 = load ptr, ptr %13, align 8, !tbaa !5
  store i64 %258, ptr %259, align 8, !tbaa !9
  %260 = load ptr, ptr %12, align 8, !tbaa !5
  %261 = load ptr, ptr %14, align 8, !tbaa !5
  %262 = load i8, ptr %19, align 1, !tbaa !16
  %263 = zext i8 %262 to i64
  %264 = getelementptr inbounds %struct.session_cache_entry, ptr %261, i64 %263
  %265 = getelementptr inbounds %struct.session_cache_entry, ptr %264, i32 0, i32 2
  %266 = getelementptr inbounds [255 x i8], ptr %265, i64 0, i64 0
  %267 = load ptr, ptr %14, align 8, !tbaa !5
  %268 = load i8, ptr %19, align 1, !tbaa !16
  %269 = zext i8 %268 to i64
  %270 = getelementptr inbounds %struct.session_cache_entry, ptr %267, i64 %269
  %271 = getelementptr inbounds %struct.session_cache_entry, ptr %270, i32 0, i32 3
  %272 = load i8, ptr %271, align 1, !tbaa !19
  %273 = zext i8 %272 to i64
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %260, ptr align 1 %266, i64 %273, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  store i64 0, ptr %20, align 8, !tbaa !9
  br label %274

274:                                              ; preds = %286, %251
  %275 = load i64, ptr %20, align 8, !tbaa !9
  %276 = load i64, ptr %11, align 8, !tbaa !9
  %277 = icmp ult i64 %275, %276
  br i1 %277, label %279, label %278

278:                                              ; preds = %274
  store i32 34, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %289

279:                                              ; preds = %274
  %280 = load ptr, ptr %10, align 8, !tbaa !5
  %281 = load i64, ptr %20, align 8, !tbaa !9
  %282 = getelementptr inbounds i8, ptr %280, i64 %281
  %283 = load i8, ptr %282, align 1, !tbaa !16
  %284 = zext i8 %283 to i32
  %285 = call i32 (ptr, ...) @printf(ptr noundef @.str.46, i32 noundef %284)
  br label %286

286:                                              ; preds = %279
  %287 = load i64, ptr %20, align 8, !tbaa !9
  %288 = add i64 %287, 1
  store i64 %288, ptr %20, align 8, !tbaa !9
  br label %274, !llvm.loop !20

289:                                              ; preds = %278
  %290 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  store i32 0, ptr %7, align 4
  store i32 1, ptr %18, align 4
  br label %291

291:                                              ; preds = %289, %246, %199, %152
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #6
  br label %292

292:                                              ; preds = %291, %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  %293 = load i32, ptr %7, align 4
  ret i32 %293
}

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

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

declare i32 @s2n_calculate_stacktrace() #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #5

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #3

declare i32 @printf(ptr noundef, ...) #4

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #4 = { "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 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, !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, !6, i64 0}
!12 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !7, i64 32}
!18 = !{!"session_cache_entry", !7, i64 0, !7, i64 32, !7, i64 33, !7, i64 288}
!19 = !{!18, !7, i64 288}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.s2n_debug_info = type { ptr, ptr }
%struct.session_cache_entry = type { [32 x i8], i8, [255 x i8], i8 }

@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@_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.42 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @cache_retrieve_callback(ptr nocapture noundef readnone %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, i64 noundef %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef %5) local_unnamed_addr #0 {
  %.not = icmp eq i64 %3, 0
  br i1 %.not, label %7, label %15

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

15:                                               ; preds = %6
  %16 = icmp ult i64 %3, 33
  br i1 %16, label %25, label %17

17:                                               ; preds = %15
  %18 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.42, ptr %18, align 8, !tbaa !5
  %19 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.42, i64 21), i32 noundef 47) #7
  %.not42 = icmp eq ptr %19, null
  %20 = getelementptr inbounds i8, ptr %19, i64 1
  %21 = select i1 %.not42, ptr getelementptr inbounds (i8, ptr @.str.42, i64 21), ptr %20
  %22 = getelementptr inbounds i8, ptr %18, i64 8
  store ptr %21, ptr %22, align 8, !tbaa !10
  %23 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %23, align 4, !tbaa !11
  %24 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %.critedge

25:                                               ; preds = %15
  %26 = load i8, ptr %2, align 1, !tbaa !13
  %27 = zext i8 %26 to i64
  %28 = getelementptr inbounds %struct.session_cache_entry, ptr %1, i64 %27
  %29 = getelementptr inbounds i8, ptr %28, i64 32
  %30 = load i8, ptr %29, align 1, !tbaa !14
  %31 = zext i8 %30 to i64
  %32 = icmp eq i64 %31, %3
  br i1 %32, label %41, label %33

33:                                               ; preds = %25
  %34 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.43, ptr %34, align 8, !tbaa !5
  %35 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.43, i64 21), i32 noundef 47) #7
  %.not43 = icmp eq ptr %35, null
  %36 = getelementptr inbounds i8, ptr %35, i64 1
  %37 = select i1 %.not43, ptr getelementptr inbounds (i8, ptr @.str.43, i64 21), ptr %36
  %38 = getelementptr inbounds i8, ptr %34, i64 8
  store ptr %37, ptr %38, align 8, !tbaa !10
  %39 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762089, ptr %39, align 4, !tbaa !11
  %40 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %.critedge

41:                                               ; preds = %25
  %bcmp = tail call i32 @bcmp(ptr nonnull %28, ptr nonnull %2, i64 %3)
  %42 = icmp eq i32 %bcmp, 0
  br i1 %42, label %51, label %43

43:                                               ; preds = %41
  %44 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.44, ptr %44, align 8, !tbaa !5
  %45 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.44, i64 21), i32 noundef 47) #7
  %.not44 = icmp eq ptr %45, null
  %46 = getelementptr inbounds i8, ptr %45, i64 1
  %47 = select i1 %.not44, ptr getelementptr inbounds (i8, ptr @.str.44, i64 21), ptr %46
  %48 = getelementptr inbounds i8, ptr %44, i64 8
  store ptr %47, ptr %48, align 8, !tbaa !10
  %49 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762089, ptr %49, align 4, !tbaa !11
  %50 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %.critedge

51:                                               ; preds = %41
  %52 = load i64, ptr %5, align 8, !tbaa !16
  %53 = getelementptr inbounds i8, ptr %28, i64 288
  %54 = load i8, ptr %53, align 1, !tbaa !18
  %55 = zext i8 %54 to i64
  %.not45 = icmp ult i64 %52, %55
  br i1 %.not45, label %56, label %64

56:                                               ; preds = %51
  %57 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.45, ptr %57, align 8, !tbaa !5
  %58 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.45, i64 21), i32 noundef 47) #7
  %.not46 = icmp eq ptr %58, null
  %59 = getelementptr inbounds i8, ptr %58, i64 1
  %60 = select i1 %.not46, ptr getelementptr inbounds (i8, ptr @.str.45, i64 21), ptr %59
  %61 = getelementptr inbounds i8, ptr %57, i64 8
  store ptr %60, ptr %61, align 8, !tbaa !10
  %62 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762089, ptr %62, align 4, !tbaa !11
  %63 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %.critedge

64:                                               ; preds = %51
  store i64 %55, ptr %5, align 8, !tbaa !16
  %65 = getelementptr inbounds i8, ptr %28, i64 33
  tail call void @llvm.memmove.p0.p0.i64(ptr align 1 %4, ptr nonnull align 1 %65, i64 %55, i1 false)
  br label %68

66:                                               ; preds = %68
  %67 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  br label %.critedge

68:                                               ; preds = %64, %68
  %.047 = phi i64 [ 0, %64 ], [ %73, %68 ]
  %69 = getelementptr inbounds i8, ptr %2, i64 %.047
  %70 = load i8, ptr %69, align 1, !tbaa !13
  %71 = zext i8 %70 to i32
  %72 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.46, i32 noundef %71)
  %73 = add nuw i64 %.047, 1
  %exitcond.not = icmp eq i64 %73, %3
  br i1 %exitcond.not, label %66, label %68, !llvm.loop !19

.critedge:                                        ; preds = %17, %7, %33, %43, %56, %66
  %.2 = phi i32 [ 0, %66 ], [ -1, %56 ], [ -1, %43 ], [ -1, %33 ], [ -1, %7 ], [ -1, %17 ]
  ret i32 %.2
}

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #4

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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 = !{!8, !8, i64 0}
!14 = !{!15, !8, i64 32}
!15 = !{!"session_cache_entry", !8, i64 0, !8, i64 32, !8, i64 33, !8, i64 288}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !8, i64 0}
!18 = !{!15, !8, i64 288}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass