; 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_kem_preferences = type { i8, ptr, i8, ptr, i8 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.165 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.166 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.167 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.168 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.169 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.170 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.171 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.172 = 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: nounwind uwtable
define dso_local i32 @s2n_validate_kem_preferences(ptr noundef %0, i1 noundef zeroext %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  %6 = zext i1 %1 to i8
  store i8 %6, ptr %5, align 1, !tbaa !9
  br label %7

7:                                                ; preds = %2
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %41, label %10

10:                                               ; preds = %7
  br label %11

11:                                               ; preds = %10
  br label %12

12:                                               ; preds = %11
  %13 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %14 = getelementptr inbounds %struct.s2n_debug_info, ptr %13, i32 0, i32 0
  store ptr @.str.165, ptr %14, align 8, !tbaa !11
  %15 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %16 = getelementptr inbounds %struct.s2n_debug_info, ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !11
  %18 = getelementptr inbounds i8, ptr %17, i64 21
  %19 = call ptr @strrchr(ptr noundef %18, i32 noundef 47) #4
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %28

21:                                               ; preds = %12
  %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 !11
  %25 = getelementptr inbounds i8, ptr %24, i64 21
  %26 = call ptr @strrchr(ptr noundef %25, i32 noundef 47) #4
  %27 = getelementptr inbounds i8, ptr %26, i64 1
  br label %33

28:                                               ; preds = %12
  %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 !11
  %32 = getelementptr inbounds i8, ptr %31, i64 21
  br label %33

33:                                               ; preds = %28, %21
  %34 = phi ptr [ %27, %21 ], [ %32, %28 ]
  %35 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %36 = getelementptr inbounds %struct.s2n_debug_info, ptr %35, i32 0, i32 1
  store ptr %34, ptr %36, align 8, !tbaa !13
  %37 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %37, align 4, !tbaa !14
  %38 = call i32 @s2n_calculate_stacktrace()
  br label %39

39:                                               ; preds = %33
  store i32 -1, ptr %3, align 4
  br label %341

40:                                               ; No predecessors!
  br label %41

41:                                               ; preds = %40, %7
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %44, i32 0, i32 2
  %46 = load i8, ptr %45, align 8, !tbaa !16
  %47 = zext i8 %46 to i32
  %48 = icmp eq i32 %47, 0
  %49 = xor i1 %48, true
  %50 = xor i1 %49, true
  %51 = zext i1 %50 to i32
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %52, i32 0, i32 3
  %54 = load ptr, ptr %53, align 8, !tbaa !18
  %55 = icmp eq ptr %54, null
  %56 = xor i1 %55, true
  %57 = xor i1 %56, true
  %58 = zext i1 %57 to i32
  %59 = icmp eq i32 %51, %58
  br i1 %59, label %91, label %60

60:                                               ; preds = %43
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  %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
  store ptr @.str.166, ptr %64, align 8, !tbaa !11
  %65 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %66 = getelementptr inbounds %struct.s2n_debug_info, ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !11
  %68 = getelementptr inbounds i8, ptr %67, i64 21
  %69 = call ptr @strrchr(ptr noundef %68, i32 noundef 47) #4
  %70 = icmp ne ptr %69, null
  br i1 %70, label %71, label %78

71:                                               ; preds = %62
  %72 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %73 = getelementptr inbounds %struct.s2n_debug_info, ptr %72, i32 0, i32 0
  %74 = load ptr, ptr %73, align 8, !tbaa !11
  %75 = getelementptr inbounds i8, ptr %74, i64 21
  %76 = call ptr @strrchr(ptr noundef %75, i32 noundef 47) #4
  %77 = getelementptr inbounds i8, ptr %76, i64 1
  br label %83

78:                                               ; preds = %62
  %79 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %80 = getelementptr inbounds %struct.s2n_debug_info, ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !11
  %82 = getelementptr inbounds i8, ptr %81, i64 21
  br label %83

83:                                               ; preds = %78, %71
  %84 = phi ptr [ %77, %71 ], [ %82, %78 ]
  %85 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %86 = getelementptr inbounds %struct.s2n_debug_info, ptr %85, i32 0, i32 1
  store ptr %84, ptr %86, align 8, !tbaa !13
  %87 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762101, ptr %87, align 4, !tbaa !14
  %88 = call i32 @s2n_calculate_stacktrace()
  br label %89

89:                                               ; preds = %83
  store i32 -1, ptr %3, align 4
  br label %341

90:                                               ; No predecessors!
  br label %91

91:                                               ; preds = %90, %43
  br label %92

92:                                               ; preds = %91
  br label %93

93:                                               ; preds = %92
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %94, i32 0, i32 0
  %96 = load i8, ptr %95, align 8, !tbaa !19
  %97 = zext i8 %96 to i32
  %98 = icmp eq i32 %97, 0
  %99 = xor i1 %98, true
  %100 = xor i1 %99, true
  %101 = zext i1 %100 to i32
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %102, i32 0, i32 1
  %104 = load ptr, ptr %103, align 8, !tbaa !20
  %105 = icmp eq ptr %104, null
  %106 = xor i1 %105, true
  %107 = xor i1 %106, true
  %108 = zext i1 %107 to i32
  %109 = icmp eq i32 %101, %108
  br i1 %109, label %141, label %110

110:                                              ; preds = %93
  br label %111

111:                                              ; preds = %110
  br label %112

112:                                              ; preds = %111
  %113 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %114 = getelementptr inbounds %struct.s2n_debug_info, ptr %113, i32 0, i32 0
  store ptr @.str.167, ptr %114, align 8, !tbaa !11
  %115 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %116 = getelementptr inbounds %struct.s2n_debug_info, ptr %115, i32 0, i32 0
  %117 = load ptr, ptr %116, align 8, !tbaa !11
  %118 = getelementptr inbounds i8, ptr %117, i64 21
  %119 = call ptr @strrchr(ptr noundef %118, i32 noundef 47) #4
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %128

121:                                              ; preds = %112
  %122 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %123 = getelementptr inbounds %struct.s2n_debug_info, ptr %122, i32 0, i32 0
  %124 = load ptr, ptr %123, align 8, !tbaa !11
  %125 = getelementptr inbounds i8, ptr %124, i64 21
  %126 = call ptr @strrchr(ptr noundef %125, i32 noundef 47) #4
  %127 = getelementptr inbounds i8, ptr %126, i64 1
  br label %133

128:                                              ; preds = %112
  %129 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %130 = getelementptr inbounds %struct.s2n_debug_info, ptr %129, i32 0, i32 0
  %131 = load ptr, ptr %130, align 8, !tbaa !11
  %132 = getelementptr inbounds i8, ptr %131, i64 21
  br label %133

133:                                              ; preds = %128, %121
  %134 = phi ptr [ %127, %121 ], [ %132, %128 ]
  %135 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %136 = getelementptr inbounds %struct.s2n_debug_info, ptr %135, i32 0, i32 1
  store ptr %134, ptr %136, align 8, !tbaa !13
  %137 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762101, ptr %137, align 4, !tbaa !14
  %138 = call i32 @s2n_calculate_stacktrace()
  br label %139

139:                                              ; preds = %133
  store i32 -1, ptr %3, align 4
  br label %341

140:                                              ; No predecessors!
  br label %141

141:                                              ; preds = %140, %93
  br label %142

142:                                              ; preds = %141
  br label %143

143:                                              ; preds = %142
  %144 = load ptr, ptr %4, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %144, i32 0, i32 2
  %146 = load i8, ptr %145, align 8, !tbaa !16
  %147 = zext i8 %146 to i32
  %148 = icmp sle i32 %147, 8
  br i1 %148, label %180, label %149

149:                                              ; preds = %143
  br label %150

150:                                              ; preds = %149
  br label %151

151:                                              ; preds = %150
  %152 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %153 = getelementptr inbounds %struct.s2n_debug_info, ptr %152, i32 0, i32 0
  store ptr @.str.168, ptr %153, align 8, !tbaa !11
  %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
  %158 = call ptr @strrchr(ptr noundef %157, i32 noundef 47) #4
  %159 = icmp ne ptr %158, null
  br i1 %159, label %160, label %167

160:                                              ; preds = %151
  %161 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %162 = getelementptr inbounds %struct.s2n_debug_info, ptr %161, i32 0, i32 0
  %163 = load ptr, ptr %162, align 8, !tbaa !11
  %164 = getelementptr inbounds i8, ptr %163, i64 21
  %165 = call ptr @strrchr(ptr noundef %164, i32 noundef 47) #4
  %166 = getelementptr inbounds i8, ptr %165, i64 1
  br label %172

167:                                              ; preds = %151
  %168 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %169 = getelementptr inbounds %struct.s2n_debug_info, ptr %168, i32 0, i32 0
  %170 = load ptr, ptr %169, align 8, !tbaa !11
  %171 = getelementptr inbounds i8, ptr %170, i64 21
  br label %172

172:                                              ; preds = %167, %160
  %173 = phi ptr [ %166, %160 ], [ %171, %167 ]
  %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 1
  store ptr %173, ptr %175, align 8, !tbaa !13
  %176 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653252, ptr %176, align 4, !tbaa !14
  %177 = call i32 @s2n_calculate_stacktrace()
  br label %178

178:                                              ; preds = %172
  store i32 -1, ptr %3, align 4
  br label %341

179:                                              ; No predecessors!
  br label %180

180:                                              ; preds = %179, %143
  br label %181

181:                                              ; preds = %180
  %182 = load i8, ptr %5, align 1, !tbaa !9, !range !21, !noundef !22
  %183 = trunc i8 %182 to i1
  br i1 %183, label %184, label %262

184:                                              ; preds = %181
  br label %185

185:                                              ; preds = %184
  %186 = load ptr, ptr %4, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %186, i32 0, i32 0
  %188 = load i8, ptr %187, align 8, !tbaa !19
  %189 = zext i8 %188 to i32
  %190 = icmp sgt i32 %189, 0
  br i1 %190, label %222, label %191

191:                                              ; preds = %185
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192
  %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 0
  store ptr @.str.169, ptr %195, align 8, !tbaa !11
  %196 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %197 = getelementptr inbounds %struct.s2n_debug_info, ptr %196, i32 0, i32 0
  %198 = load ptr, ptr %197, align 8, !tbaa !11
  %199 = getelementptr inbounds i8, ptr %198, i64 21
  %200 = call ptr @strrchr(ptr noundef %199, i32 noundef 47) #4
  %201 = icmp ne ptr %200, null
  br i1 %201, label %202, label %209

202:                                              ; preds = %193
  %203 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %204 = getelementptr inbounds %struct.s2n_debug_info, ptr %203, i32 0, i32 0
  %205 = load ptr, ptr %204, align 8, !tbaa !11
  %206 = getelementptr inbounds i8, ptr %205, i64 21
  %207 = call ptr @strrchr(ptr noundef %206, i32 noundef 47) #4
  %208 = getelementptr inbounds i8, ptr %207, i64 1
  br label %214

209:                                              ; preds = %193
  %210 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %211 = getelementptr inbounds %struct.s2n_debug_info, ptr %210, i32 0, i32 0
  %212 = load ptr, ptr %211, align 8, !tbaa !11
  %213 = getelementptr inbounds i8, ptr %212, i64 21
  br label %214

214:                                              ; preds = %209, %202
  %215 = phi ptr [ %208, %202 ], [ %213, %209 ]
  %216 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %217 = getelementptr inbounds %struct.s2n_debug_info, ptr %216, i32 0, i32 1
  store ptr %215, ptr %217, align 8, !tbaa !13
  %218 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762101, ptr %218, align 4, !tbaa !14
  %219 = call i32 @s2n_calculate_stacktrace()
  br label %220

220:                                              ; preds = %214
  store i32 -1, ptr %3, align 4
  br label %341

221:                                              ; No predecessors!
  br label %222

222:                                              ; preds = %221, %185
  br label %223

223:                                              ; preds = %222
  br label %224

224:                                              ; preds = %223
  %225 = load ptr, ptr %4, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %225, i32 0, i32 1
  %227 = load ptr, ptr %226, align 8, !tbaa !20
  %228 = icmp ne ptr %227, null
  br i1 %228, label %260, label %229

229:                                              ; preds = %224
  br label %230

230:                                              ; preds = %229
  br label %231

231:                                              ; preds = %230
  %232 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %233 = getelementptr inbounds %struct.s2n_debug_info, ptr %232, i32 0, i32 0
  store ptr @.str.170, ptr %233, align 8, !tbaa !11
  %234 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %235 = getelementptr inbounds %struct.s2n_debug_info, ptr %234, i32 0, i32 0
  %236 = load ptr, ptr %235, align 8, !tbaa !11
  %237 = getelementptr inbounds i8, ptr %236, i64 21
  %238 = call ptr @strrchr(ptr noundef %237, i32 noundef 47) #4
  %239 = icmp ne ptr %238, null
  br i1 %239, label %240, label %247

240:                                              ; preds = %231
  %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 0
  %243 = load ptr, ptr %242, align 8, !tbaa !11
  %244 = getelementptr inbounds i8, ptr %243, i64 21
  %245 = call ptr @strrchr(ptr noundef %244, i32 noundef 47) #4
  %246 = getelementptr inbounds i8, ptr %245, i64 1
  br label %252

247:                                              ; preds = %231
  %248 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %249 = getelementptr inbounds %struct.s2n_debug_info, ptr %248, i32 0, i32 0
  %250 = load ptr, ptr %249, align 8, !tbaa !11
  %251 = getelementptr inbounds i8, ptr %250, i64 21
  br label %252

252:                                              ; preds = %247, %240
  %253 = phi ptr [ %246, %240 ], [ %251, %247 ]
  %254 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %255 = getelementptr inbounds %struct.s2n_debug_info, ptr %254, i32 0, i32 1
  store ptr %253, ptr %255, align 8, !tbaa !13
  %256 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762101, ptr %256, align 4, !tbaa !14
  %257 = call i32 @s2n_calculate_stacktrace()
  br label %258

258:                                              ; preds = %252
  store i32 -1, ptr %3, align 4
  br label %341

259:                                              ; No predecessors!
  br label %260

260:                                              ; preds = %259, %224
  br label %261

261:                                              ; preds = %260
  br label %340

262:                                              ; preds = %181
  br label %263

263:                                              ; preds = %262
  %264 = load ptr, ptr %4, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %264, i32 0, i32 0
  %266 = load i8, ptr %265, align 8, !tbaa !19
  %267 = zext i8 %266 to i32
  %268 = icmp eq i32 %267, 0
  br i1 %268, label %300, label %269

269:                                              ; preds = %263
  br label %270

270:                                              ; preds = %269
  br label %271

271:                                              ; preds = %270
  %272 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %273 = getelementptr inbounds %struct.s2n_debug_info, ptr %272, i32 0, i32 0
  store ptr @.str.171, ptr %273, align 8, !tbaa !11
  %274 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %275 = getelementptr inbounds %struct.s2n_debug_info, ptr %274, i32 0, i32 0
  %276 = load ptr, ptr %275, align 8, !tbaa !11
  %277 = getelementptr inbounds i8, ptr %276, i64 21
  %278 = call ptr @strrchr(ptr noundef %277, i32 noundef 47) #4
  %279 = icmp ne ptr %278, null
  br i1 %279, label %280, label %287

280:                                              ; preds = %271
  %281 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %282 = getelementptr inbounds %struct.s2n_debug_info, ptr %281, i32 0, i32 0
  %283 = load ptr, ptr %282, align 8, !tbaa !11
  %284 = getelementptr inbounds i8, ptr %283, i64 21
  %285 = call ptr @strrchr(ptr noundef %284, i32 noundef 47) #4
  %286 = getelementptr inbounds i8, ptr %285, i64 1
  br label %292

287:                                              ; preds = %271
  %288 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %289 = getelementptr inbounds %struct.s2n_debug_info, ptr %288, i32 0, i32 0
  %290 = load ptr, ptr %289, align 8, !tbaa !11
  %291 = getelementptr inbounds i8, ptr %290, i64 21
  br label %292

292:                                              ; preds = %287, %280
  %293 = phi ptr [ %286, %280 ], [ %291, %287 ]
  %294 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %295 = getelementptr inbounds %struct.s2n_debug_info, ptr %294, i32 0, i32 1
  store ptr %293, ptr %295, align 8, !tbaa !13
  %296 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762101, ptr %296, align 4, !tbaa !14
  %297 = call i32 @s2n_calculate_stacktrace()
  br label %298

298:                                              ; preds = %292
  store i32 -1, ptr %3, align 4
  br label %341

299:                                              ; No predecessors!
  br label %300

300:                                              ; preds = %299, %263
  br label %301

301:                                              ; preds = %300
  br label %302

302:                                              ; preds = %301
  %303 = load ptr, ptr %4, align 8, !tbaa !5
  %304 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %303, i32 0, i32 1
  %305 = load ptr, ptr %304, align 8, !tbaa !20
  %306 = icmp eq ptr %305, null
  br i1 %306, label %338, label %307

307:                                              ; preds = %302
  br label %308

308:                                              ; preds = %307
  br label %309

309:                                              ; preds = %308
  %310 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %311 = getelementptr inbounds %struct.s2n_debug_info, ptr %310, i32 0, i32 0
  store ptr @.str.172, ptr %311, align 8, !tbaa !11
  %312 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %313 = getelementptr inbounds %struct.s2n_debug_info, ptr %312, i32 0, i32 0
  %314 = load ptr, ptr %313, align 8, !tbaa !11
  %315 = getelementptr inbounds i8, ptr %314, i64 21
  %316 = call ptr @strrchr(ptr noundef %315, i32 noundef 47) #4
  %317 = icmp ne ptr %316, null
  br i1 %317, label %318, label %325

318:                                              ; preds = %309
  %319 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %320 = getelementptr inbounds %struct.s2n_debug_info, ptr %319, i32 0, i32 0
  %321 = load ptr, ptr %320, align 8, !tbaa !11
  %322 = getelementptr inbounds i8, ptr %321, i64 21
  %323 = call ptr @strrchr(ptr noundef %322, i32 noundef 47) #4
  %324 = getelementptr inbounds i8, ptr %323, i64 1
  br label %330

325:                                              ; preds = %309
  %326 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %327 = getelementptr inbounds %struct.s2n_debug_info, ptr %326, i32 0, i32 0
  %328 = load ptr, ptr %327, align 8, !tbaa !11
  %329 = getelementptr inbounds i8, ptr %328, i64 21
  br label %330

330:                                              ; preds = %325, %318
  %331 = phi ptr [ %324, %318 ], [ %329, %325 ]
  %332 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %333 = getelementptr inbounds %struct.s2n_debug_info, ptr %332, i32 0, i32 1
  store ptr %331, ptr %333, align 8, !tbaa !13
  %334 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762101, ptr %334, align 4, !tbaa !14
  %335 = call i32 @s2n_calculate_stacktrace()
  br label %336

336:                                              ; preds = %330
  store i32 -1, ptr %3, align 4
  br label %341

337:                                              ; No predecessors!
  br label %338

338:                                              ; preds = %337, %302
  br label %339

339:                                              ; preds = %338
  br label %340

340:                                              ; preds = %339, %261
  store i32 0, ptr %3, align 4
  br label %341

341:                                              ; preds = %340, %336, %298, %258, %220, %178, %139, %89, %39
  %342 = load i32, ptr %3, align 4
  ret i32 %342
}

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 = { 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) }

!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 = !{!"_Bool", !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 = !{!17, !7, i64 16}
!17 = !{!"s2n_kem_preferences", !7, i64 0, !6, i64 8, !7, i64 16, !6, i64 24, !7, i64 32}
!18 = !{!17, !6, i64 24}
!19 = !{!17, !7, i64 0}
!20 = !{!17, !6, i64 8}
!21 = !{i8 0, i8 2}
!22 = !{}


; 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.165 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.166 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.167 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.168 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.169 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.170 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.171 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.172 = 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_validate_kem_preferences(ptr noundef readonly %0, i1 noundef zeroext %1) local_unnamed_addr #3 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %.sink.split, label %3

3:                                                ; preds = %2
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  %5 = load i8, ptr %4, align 8, !tbaa !5
  %6 = icmp eq i8 %5, 0
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load ptr, ptr %7, align 8, !tbaa !10
  %9 = icmp ne ptr %8, null
  %10 = xor i1 %6, %9
  br i1 %10, label %11, label %.sink.split

11:                                               ; preds = %3
  %12 = load i8, ptr %0, align 8, !tbaa !11
  %13 = icmp eq i8 %12, 0
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !12
  %16 = icmp eq ptr %15, null
  %17 = xor i1 %13, %16
  br i1 %17, label %.sink.split, label %18

18:                                               ; preds = %11
  %19 = icmp ult i8 %5, 9
  br i1 %19, label %20, label %.sink.split

20:                                               ; preds = %18
  br i1 %1, label %21, label %22

21:                                               ; preds = %20
  %brmerge = or i1 %13, %16
  %.str.169.mux = select i1 %13, ptr @.str.169, ptr @.str.170
  %.mux = select i1 %13, ptr getelementptr inbounds (i8, ptr @.str.169, i64 21), ptr getelementptr inbounds (i8, ptr @.str.170, i64 21)
  br i1 %brmerge, label %.sink.split, label %30

22:                                               ; preds = %20
  %brmerge42.not = and i1 %13, %16
  %.str.171.mux = select i1 %13, ptr @.str.172, ptr @.str.171
  %.mux43 = select i1 %13, ptr getelementptr inbounds (i8, ptr @.str.172, i64 21), ptr getelementptr inbounds (i8, ptr @.str.171, i64 21)
  br i1 %brmerge42.not, label %30, label %.sink.split

.sink.split:                                      ; preds = %22, %21, %18, %11, %3, %2
  %.str.172.sink = phi ptr [ @.str.165, %2 ], [ @.str.166, %3 ], [ @.str.167, %11 ], [ @.str.168, %18 ], [ %.str.169.mux, %21 ], [ %.str.171.mux, %22 ]
  %.sink38 = phi ptr [ getelementptr inbounds (i8, ptr @.str.165, i64 21), %2 ], [ getelementptr inbounds (i8, ptr @.str.166, i64 21), %3 ], [ getelementptr inbounds (i8, ptr @.str.167, i64 21), %11 ], [ getelementptr inbounds (i8, ptr @.str.168, i64 21), %18 ], [ %.mux, %21 ], [ %.mux43, %22 ]
  %.sink = phi i32 [ 402653193, %2 ], [ 469762101, %3 ], [ 469762101, %11 ], [ 402653252, %18 ], [ 469762101, %21 ], [ 469762101, %22 ]
  %23 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr %.str.172.sink, ptr %23, align 8, !tbaa !13
  %24 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) %.sink38, i32 noundef 47) #4
  %.not25 = icmp eq ptr %24, null
  %25 = getelementptr inbounds i8, ptr %24, i64 1
  %26 = select i1 %.not25, ptr %.sink38, ptr %25
  %27 = getelementptr inbounds i8, ptr %23, i64 8
  store ptr %26, ptr %27, align 8, !tbaa !15
  %28 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 %.sink, ptr %28, align 4, !tbaa !16
  %29 = tail call i32 @s2n_calculate_stacktrace() #5
  br label %30

30:                                               ; preds = %22, %21, %.sink.split
  %.0 = phi i32 [ -1, %.sink.split ], [ 0, %21 ], [ 0, %22 ]
  ret i32 %.0
}

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


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