; LLVM IR from aws/s2n-tls :: tests/unit (s2n_tls13_pq_handshake_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_kem_preferences = type { i8, ptr, i8, ptr, i8 }
%struct.s2n_kem_group = type { ptr, i16, ptr, 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.20 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [110 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: 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: nounwind uwtable
define dso_local ptr @s2n_get_predicted_negotiated_kem_group(ptr noundef %0, ptr noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %2
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %48, 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.20, 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) #5
  %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) #5
  %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
  store ptr null, ptr %3, align 8
  br label %365

47:                                               ; No predecessors!
  br label %48

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

49:                                               ; preds = %48
  br label %50

50:                                               ; preds = %49
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = icmp ne ptr %51, null
  br i1 %52, label %84, label %53

53:                                               ; preds = %50
  br label %54

54:                                               ; preds = %53
  br label %55

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

64:                                               ; preds = %55
  %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 !9
  %68 = getelementptr inbounds i8, ptr %67, i64 21
  %69 = call ptr @strrchr(ptr noundef %68, i32 noundef 47) #5
  %70 = getelementptr inbounds i8, ptr %69, i64 1
  br label %76

71:                                               ; preds = %55
  %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 !9
  %75 = getelementptr inbounds i8, ptr %74, i64 21
  br label %76

76:                                               ; preds = %71, %64
  %77 = phi ptr [ %70, %64 ], [ %75, %71 ]
  %78 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %79 = getelementptr inbounds %struct.s2n_debug_info, ptr %78, i32 0, i32 1
  store ptr %77, ptr %79, align 8, !tbaa !11
  %80 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %80, align 4, !tbaa !12
  %81 = call i32 @s2n_calculate_stacktrace()
  br label %82

82:                                               ; preds = %76
  store ptr null, ptr %3, align 8
  br label %365

83:                                               ; No predecessors!
  br label %84

84:                                               ; preds = %83, %50
  br label %85

85:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %86, i32 0, i32 3
  %88 = load ptr, ptr %87, align 8, !tbaa !14
  %89 = getelementptr inbounds ptr, ptr %88, i64 0
  %90 = load ptr, ptr %89, align 8, !tbaa !5
  store ptr %90, ptr %6, align 8, !tbaa !5
  br label %91

91:                                               ; preds = %85
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = icmp ne ptr %92, null
  br i1 %93, label %127, label %94

94:                                               ; preds = %91
  br label %95

95:                                               ; preds = %94
  br label %96

96:                                               ; preds = %95
  %97 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %98 = getelementptr inbounds %struct.s2n_debug_info, ptr %97, i32 0, i32 0
  store ptr @.str.22, ptr %98, align 8, !tbaa !9
  %99 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %100 = getelementptr inbounds %struct.s2n_debug_info, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !9
  %102 = getelementptr inbounds i8, ptr %101, i64 21
  %103 = call ptr @strrchr(ptr noundef %102, i32 noundef 47) #5
  %104 = icmp ne ptr %103, null
  br i1 %104, label %105, label %112

105:                                              ; preds = %96
  %106 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %107 = getelementptr inbounds %struct.s2n_debug_info, ptr %106, i32 0, i32 0
  %108 = load ptr, ptr %107, align 8, !tbaa !9
  %109 = getelementptr inbounds i8, ptr %108, i64 21
  %110 = call ptr @strrchr(ptr noundef %109, i32 noundef 47) #5
  %111 = getelementptr inbounds i8, ptr %110, i64 1
  br label %117

112:                                              ; preds = %96
  %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
  %115 = load ptr, ptr %114, align 8, !tbaa !9
  %116 = getelementptr inbounds i8, ptr %115, i64 21
  br label %117

117:                                              ; preds = %112, %105
  %118 = phi ptr [ %111, %105 ], [ %116, %112 ]
  %119 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %120 = getelementptr inbounds %struct.s2n_debug_info, ptr %119, i32 0, i32 1
  store ptr %118, ptr %120, align 8, !tbaa !11
  %121 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %121, align 4, !tbaa !12
  %122 = call i32 @s2n_calculate_stacktrace()
  br label %123

123:                                              ; preds = %117
  br label %124

124:                                              ; preds = %123
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %364

125:                                              ; No predecessors!
  br label %126

126:                                              ; preds = %125
  br label %127

127:                                              ; preds = %126, %91
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !12
  br label %130

130:                                              ; preds = %209, %129
  %131 = load i32, ptr %8, align 4, !tbaa !12
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %132, i32 0, i32 2
  %134 = load i8, ptr %133, align 8, !tbaa !16
  %135 = zext i8 %134 to i32
  %136 = icmp slt i32 %131, %135
  br i1 %136, label %138, label %137

137:                                              ; preds = %130
  store i32 20, ptr %7, align 4
  br label %212

138:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %139, i32 0, i32 3
  %141 = load ptr, ptr %140, align 8, !tbaa !14
  %142 = load i32, ptr %8, align 4, !tbaa !12
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds ptr, ptr %141, i64 %143
  %145 = load ptr, ptr %144, align 8, !tbaa !5
  store ptr %145, ptr %9, align 8, !tbaa !5
  br label %146

146:                                              ; preds = %138
  %147 = load ptr, ptr %9, align 8, !tbaa !5
  %148 = icmp ne ptr %147, null
  br i1 %148, label %182, label %149

149:                                              ; preds = %146
  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.23, ptr %153, align 8, !tbaa !9
  %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 !9
  %157 = getelementptr inbounds i8, ptr %156, i64 21
  %158 = call ptr @strrchr(ptr noundef %157, i32 noundef 47) #5
  %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 !9
  %164 = getelementptr inbounds i8, ptr %163, i64 21
  %165 = call ptr @strrchr(ptr noundef %164, i32 noundef 47) #5
  %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 !9
  %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 !11
  %176 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %176, align 4, !tbaa !12
  %177 = call i32 @s2n_calculate_stacktrace()
  br label %178

178:                                              ; preds = %172
  br label %179

179:                                              ; preds = %178
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %206

180:                                              ; No predecessors!
  br label %181

181:                                              ; preds = %180
  br label %182

182:                                              ; preds = %181, %146
  br label %183

183:                                              ; preds = %182
  br label %184

184:                                              ; preds = %183
  %185 = load ptr, ptr %6, align 8, !tbaa !5
  %186 = call zeroext i1 @s2n_kem_group_is_available(ptr noundef %185)
  br i1 %186, label %187, label %205

187:                                              ; preds = %184
  %188 = load ptr, ptr %9, align 8, !tbaa !5
  %189 = call zeroext i1 @s2n_kem_group_is_available(ptr noundef %188)
  br i1 %189, label %190, label %205

190:                                              ; preds = %187
  %191 = load ptr, ptr %6, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.s2n_kem_group, ptr %191, i32 0, i32 1
  %193 = load i16, ptr %192, align 8, !tbaa !17
  %194 = zext i16 %193 to i32
  %195 = load ptr, ptr %9, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.s2n_kem_group, ptr %195, i32 0, i32 1
  %197 = load i16, ptr %196, align 8, !tbaa !17
  %198 = zext i16 %197 to i32
  %199 = icmp eq i32 %194, %198
  br i1 %199, label %200, label %205

200:                                              ; preds = %190
  %201 = load ptr, ptr %6, align 8, !tbaa !5
  %202 = call zeroext i1 @s2n_kem_group_is_available(ptr noundef %201)
  br i1 %202, label %203, label %205

203:                                              ; preds = %200
  %204 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %204, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %206

205:                                              ; preds = %200, %190, %187, %184
  store i32 0, ptr %7, align 4
  br label %206

206:                                              ; preds = %205, %203, %179
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  %207 = load i32, ptr %7, align 4
  switch i32 %207, label %212 [
    i32 0, label %208
  ]

208:                                              ; preds = %206
  br label %209

209:                                              ; preds = %208
  %210 = load i32, ptr %8, align 4, !tbaa !12
  %211 = add nsw i32 %210, 1
  store i32 %211, ptr %8, align 4, !tbaa !12
  br label %130, !llvm.loop !21

212:                                              ; preds = %206, %137
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %213 = load i32, ptr %7, align 4
  switch i32 %213, label %364 [
    i32 20, label %214
  ]

214:                                              ; preds = %212
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !12
  br label %215

215:                                              ; preds = %358, %214
  %216 = load i32, ptr %10, align 4, !tbaa !12
  %217 = load ptr, ptr %5, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %217, i32 0, i32 2
  %219 = load i8, ptr %218, align 8, !tbaa !16
  %220 = zext i8 %219 to i32
  %221 = icmp slt i32 %216, %220
  br i1 %221, label %223, label %222

222:                                              ; preds = %215
  store i32 29, ptr %7, align 4
  br label %361

223:                                              ; preds = %215
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %224 = load ptr, ptr %5, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %224, i32 0, i32 3
  %226 = load ptr, ptr %225, align 8, !tbaa !14
  %227 = load i32, ptr %10, align 4, !tbaa !12
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds ptr, ptr %226, i64 %228
  %230 = load ptr, ptr %229, align 8, !tbaa !5
  store ptr %230, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1, ptr %12, align 4, !tbaa !12
  br label %231

231:                                              ; preds = %349, %223
  %232 = load i32, ptr %12, align 4, !tbaa !12
  %233 = load ptr, ptr %4, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %233, i32 0, i32 2
  %235 = load i8, ptr %234, align 8, !tbaa !16
  %236 = zext i8 %235 to i32
  %237 = icmp slt i32 %232, %236
  br i1 %237, label %239, label %238

238:                                              ; preds = %231
  store i32 32, ptr %7, align 4
  br label %352

239:                                              ; preds = %231
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %240 = load ptr, ptr %4, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.s2n_kem_preferences, ptr %240, i32 0, i32 3
  %242 = load ptr, ptr %241, align 8, !tbaa !14
  %243 = load i32, ptr %12, align 4, !tbaa !12
  %244 = sext i32 %243 to i64
  %245 = getelementptr inbounds ptr, ptr %242, i64 %244
  %246 = load ptr, ptr %245, align 8, !tbaa !5
  store ptr %246, ptr %13, align 8, !tbaa !5
  br label %247

247:                                              ; preds = %239
  %248 = load ptr, ptr %13, align 8, !tbaa !5
  %249 = icmp ne ptr %248, null
  br i1 %249, label %283, label %250

250:                                              ; preds = %247
  br label %251

251:                                              ; preds = %250
  br label %252

252:                                              ; preds = %251
  %253 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %254 = getelementptr inbounds %struct.s2n_debug_info, ptr %253, i32 0, i32 0
  store ptr @.str.24, ptr %254, align 8, !tbaa !9
  %255 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %256 = getelementptr inbounds %struct.s2n_debug_info, ptr %255, i32 0, i32 0
  %257 = load ptr, ptr %256, align 8, !tbaa !9
  %258 = getelementptr inbounds i8, ptr %257, i64 21
  %259 = call ptr @strrchr(ptr noundef %258, i32 noundef 47) #5
  %260 = icmp ne ptr %259, null
  br i1 %260, label %261, label %268

261:                                              ; preds = %252
  %262 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %263 = getelementptr inbounds %struct.s2n_debug_info, ptr %262, i32 0, i32 0
  %264 = load ptr, ptr %263, align 8, !tbaa !9
  %265 = getelementptr inbounds i8, ptr %264, i64 21
  %266 = call ptr @strrchr(ptr noundef %265, i32 noundef 47) #5
  %267 = getelementptr inbounds i8, ptr %266, i64 1
  br label %273

268:                                              ; preds = %252
  %269 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %270 = getelementptr inbounds %struct.s2n_debug_info, ptr %269, i32 0, i32 0
  %271 = load ptr, ptr %270, align 8, !tbaa !9
  %272 = getelementptr inbounds i8, ptr %271, i64 21
  br label %273

273:                                              ; preds = %268, %261
  %274 = phi ptr [ %267, %261 ], [ %272, %268 ]
  %275 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %276 = getelementptr inbounds %struct.s2n_debug_info, ptr %275, i32 0, i32 1
  store ptr %274, ptr %276, align 8, !tbaa !11
  %277 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %277, align 4, !tbaa !12
  %278 = call i32 @s2n_calculate_stacktrace()
  br label %279

279:                                              ; preds = %273
  br label %280

280:                                              ; preds = %279
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %346

281:                                              ; No predecessors!
  br label %282

282:                                              ; preds = %281
  br label %283

283:                                              ; preds = %282, %247
  br label %284

284:                                              ; preds = %283
  br label %285

285:                                              ; preds = %284
  br label %286

286:                                              ; preds = %285
  %287 = load ptr, ptr %11, align 8, !tbaa !5
  %288 = icmp ne ptr %287, null
  br i1 %288, label %322, label %289

289:                                              ; preds = %286
  br label %290

290:                                              ; preds = %289
  br label %291

291:                                              ; preds = %290
  %292 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %293 = getelementptr inbounds %struct.s2n_debug_info, ptr %292, i32 0, i32 0
  store ptr @.str.25, ptr %293, align 8, !tbaa !9
  %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 0
  %296 = load ptr, ptr %295, align 8, !tbaa !9
  %297 = getelementptr inbounds i8, ptr %296, i64 21
  %298 = call ptr @strrchr(ptr noundef %297, i32 noundef 47) #5
  %299 = icmp ne ptr %298, null
  br i1 %299, label %300, label %307

300:                                              ; preds = %291
  %301 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %302 = getelementptr inbounds %struct.s2n_debug_info, ptr %301, i32 0, i32 0
  %303 = load ptr, ptr %302, align 8, !tbaa !9
  %304 = getelementptr inbounds i8, ptr %303, i64 21
  %305 = call ptr @strrchr(ptr noundef %304, i32 noundef 47) #5
  %306 = getelementptr inbounds i8, ptr %305, i64 1
  br label %312

307:                                              ; preds = %291
  %308 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %309 = getelementptr inbounds %struct.s2n_debug_info, ptr %308, i32 0, i32 0
  %310 = load ptr, ptr %309, align 8, !tbaa !9
  %311 = getelementptr inbounds i8, ptr %310, i64 21
  br label %312

312:                                              ; preds = %307, %300
  %313 = phi ptr [ %306, %300 ], [ %311, %307 ]
  %314 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %315 = getelementptr inbounds %struct.s2n_debug_info, ptr %314, i32 0, i32 1
  store ptr %313, ptr %315, align 8, !tbaa !11
  %316 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %316, align 4, !tbaa !12
  %317 = call i32 @s2n_calculate_stacktrace()
  br label %318

318:                                              ; preds = %312
  br label %319

319:                                              ; preds = %318
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %346

320:                                              ; No predecessors!
  br label %321

321:                                              ; preds = %320
  br label %322

322:                                              ; preds = %321, %286
  br label %323

323:                                              ; preds = %322
  br label %324

324:                                              ; preds = %323
  %325 = load ptr, ptr %13, align 8, !tbaa !5
  %326 = call zeroext i1 @s2n_kem_group_is_available(ptr noundef %325)
  br i1 %326, label %327, label %345

327:                                              ; preds = %324
  %328 = load ptr, ptr %11, align 8, !tbaa !5
  %329 = call zeroext i1 @s2n_kem_group_is_available(ptr noundef %328)
  br i1 %329, label %330, label %345

330:                                              ; preds = %327
  %331 = load ptr, ptr %13, align 8, !tbaa !5
  %332 = getelementptr inbounds %struct.s2n_kem_group, ptr %331, i32 0, i32 1
  %333 = load i16, ptr %332, align 8, !tbaa !17
  %334 = zext i16 %333 to i32
  %335 = load ptr, ptr %11, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct.s2n_kem_group, ptr %335, i32 0, i32 1
  %337 = load i16, ptr %336, align 8, !tbaa !17
  %338 = zext i16 %337 to i32
  %339 = icmp eq i32 %334, %338
  br i1 %339, label %340, label %345

340:                                              ; preds = %330
  %341 = load ptr, ptr %13, align 8, !tbaa !5
  %342 = call zeroext i1 @s2n_kem_group_is_available(ptr noundef %341)
  br i1 %342, label %343, label %345

343:                                              ; preds = %340
  %344 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %344, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %346

345:                                              ; preds = %340, %330, %327, %324
  store i32 0, ptr %7, align 4
  br label %346

346:                                              ; preds = %345, %343, %319, %280
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  %347 = load i32, ptr %7, align 4
  switch i32 %347, label %352 [
    i32 0, label %348
  ]

348:                                              ; preds = %346
  br label %349

349:                                              ; preds = %348
  %350 = load i32, ptr %12, align 4, !tbaa !12
  %351 = add nsw i32 %350, 1
  store i32 %351, ptr %12, align 4, !tbaa !12
  br label %231, !llvm.loop !23

352:                                              ; preds = %346, %238
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  %353 = load i32, ptr %7, align 4
  switch i32 %353, label %355 [
    i32 32, label %354
  ]

354:                                              ; preds = %352
  store i32 0, ptr %7, align 4
  br label %355

355:                                              ; preds = %354, %352
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  %356 = load i32, ptr %7, align 4
  switch i32 %356, label %361 [
    i32 0, label %357
  ]

357:                                              ; preds = %355
  br label %358

358:                                              ; preds = %357
  %359 = load i32, ptr %10, align 4, !tbaa !12
  %360 = add nsw i32 %359, 1
  store i32 %360, ptr %10, align 4, !tbaa !12
  br label %215, !llvm.loop !24

361:                                              ; preds = %355, %222
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %362 = load i32, ptr %7, align 4
  switch i32 %362, label %364 [
    i32 29, label %363
  ]

363:                                              ; preds = %361
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %364

364:                                              ; preds = %363, %361, %212, %124
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %365

365:                                              ; preds = %364, %82, %46
  %366 = load ptr, ptr %3, align 8
  ret ptr %366
}

declare zeroext i1 @s2n_kem_group_is_available(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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind willreturn memory(read) }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !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, !6, i64 24}
!15 = !{!"s2n_kem_preferences", !7, i64 0, !6, i64 8, !7, i64 16, !6, i64 24, !7, i64 32}
!16 = !{!15, !7, i64 16}
!17 = !{!18, !19, i64 8}
!18 = !{!"s2n_kem_group", !6, i64 0, !19, i64 8, !6, i64 16, !6, i64 24, !20, i64 32}
!19 = !{!"short", !7, i64 0}
!20 = !{!"_Bool", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = distinct !{!24, !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.20 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [110 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 ptr @s2n_get_predicted_negotiated_kem_group(ptr noundef readonly %0, ptr noundef readonly %1) local_unnamed_addr #3 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %.thread81.sink.split, label %3

3:                                                ; preds = %2
  %.not66 = icmp eq ptr %1, null
  br i1 %.not66, label %.thread81.sink.split, label %4

4:                                                ; preds = %3
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = load ptr, ptr %6, align 8, !tbaa !10
  %.not68 = icmp eq ptr %7, null
  br i1 %.not68, label %.thread81.sink.split, label %.preheader90

.preheader90:                                     ; preds = %4
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = load i8, ptr %8, align 8, !tbaa !11
  %.not7296.not = icmp eq i8 %9, 0
  br i1 %.not7296.not, label %.thread81, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader90
  %10 = getelementptr inbounds i8, ptr %1, i64 24
  %11 = getelementptr inbounds i8, ptr %7, i64 8
  br label %14

.preheader:                                       ; preds = %29
  %.not78103.not = icmp eq i8 %30, 0
  br i1 %.not78103.not, label %.thread81, label %.lr.ph105

.lr.ph105:                                        ; preds = %.preheader
  %12 = getelementptr inbounds i8, ptr %1, i64 24
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %.pre = load i8, ptr %13, align 8, !tbaa !11
  br label %32

14:                                               ; preds = %.lr.ph, %29
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %29 ]
  %15 = load ptr, ptr %10, align 8, !tbaa !5
  %16 = getelementptr inbounds ptr, ptr %15, i64 %indvars.iv
  %17 = load ptr, ptr %16, align 8, !tbaa !10
  %.not70 = icmp eq ptr %17, null
  br i1 %.not70, label %.thread81.sink.split, label %18

18:                                               ; preds = %14
  %19 = tail call zeroext i1 @s2n_kem_group_is_available(ptr noundef nonnull %7) #4
  br i1 %19, label %20, label %29

20:                                               ; preds = %18
  %21 = tail call zeroext i1 @s2n_kem_group_is_available(ptr noundef nonnull %17) #4
  br i1 %21, label %22, label %29

22:                                               ; preds = %20
  %23 = load i16, ptr %11, align 8, !tbaa !12
  %24 = getelementptr inbounds i8, ptr %17, i64 8
  %25 = load i16, ptr %24, align 8, !tbaa !12
  %26 = icmp eq i16 %23, %25
  br i1 %26, label %27, label %29

27:                                               ; preds = %22
  %28 = tail call zeroext i1 @s2n_kem_group_is_available(ptr noundef nonnull %7) #4
  br i1 %28, label %.thread81, label %29

29:                                               ; preds = %27, %22, %20, %18
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %30 = load i8, ptr %8, align 8, !tbaa !11
  %31 = zext i8 %30 to i64
  %.not72 = icmp ult i64 %indvars.iv.next, %31
  br i1 %.not72, label %14, label %.preheader, !llvm.loop !16

32:                                               ; preds = %.lr.ph105, %._crit_edge
  %33 = phi i8 [ %30, %.lr.ph105 ], [ %59, %._crit_edge ]
  %34 = phi i8 [ %.pre, %.lr.ph105 ], [ %60, %._crit_edge ]
  %indvars.iv114 = phi i64 [ 0, %.lr.ph105 ], [ %indvars.iv.next115, %._crit_edge ]
  %35 = load ptr, ptr %12, align 8, !tbaa !5
  %36 = getelementptr inbounds ptr, ptr %35, i64 %indvars.iv114
  %37 = load ptr, ptr %36, align 8, !tbaa !10
  %.fr = freeze ptr %37
  %.not7798 = icmp ugt i8 %34, 1
  br i1 %.not7798, label %.lr.ph100, label %._crit_edge

.lr.ph100:                                        ; preds = %32
  %.not75 = icmp eq ptr %.fr, null
  %38 = getelementptr inbounds i8, ptr %.fr, i64 8
  br i1 %.not75, label %.lr.ph100.split.us, label %.lr.ph100.split

.lr.ph100.split.us:                               ; preds = %.lr.ph100
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 8
  %41 = load ptr, ptr %40, align 8, !tbaa !10
  %.not73.us = icmp eq ptr %41, null
  %spec.select = select i1 %.not73.us, ptr @.str.24, ptr @.str.25
  %spec.select130 = select i1 %.not73.us, ptr getelementptr inbounds (i8, ptr @.str.24, i64 21), ptr getelementptr inbounds (i8, ptr @.str.25, i64 21)
  br label %.thread81.sink.split

.lr.ph100.split:                                  ; preds = %.lr.ph100, %56
  %indvars.iv111 = phi i64 [ %indvars.iv.next112, %56 ], [ 1, %.lr.ph100 ]
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds ptr, ptr %42, i64 %indvars.iv111
  %44 = load ptr, ptr %43, align 8, !tbaa !10
  %.not73 = icmp eq ptr %44, null
  br i1 %.not73, label %.thread81.sink.split, label %45

45:                                               ; preds = %.lr.ph100.split
  %46 = tail call zeroext i1 @s2n_kem_group_is_available(ptr noundef nonnull %44) #4
  br i1 %46, label %47, label %56

47:                                               ; preds = %45
  %48 = tail call zeroext i1 @s2n_kem_group_is_available(ptr noundef nonnull %.fr) #4
  br i1 %48, label %49, label %56

49:                                               ; preds = %47
  %50 = getelementptr inbounds i8, ptr %44, i64 8
  %51 = load i16, ptr %50, align 8, !tbaa !12
  %52 = load i16, ptr %38, align 8, !tbaa !12
  %53 = icmp eq i16 %51, %52
  br i1 %53, label %54, label %56

54:                                               ; preds = %49
  %55 = tail call zeroext i1 @s2n_kem_group_is_available(ptr noundef nonnull %44) #4
  br i1 %55, label %.thread81, label %56

56:                                               ; preds = %54, %49, %47, %45
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %57 = load i8, ptr %13, align 8, !tbaa !11
  %58 = zext i8 %57 to i64
  %.not77 = icmp ult i64 %indvars.iv.next112, %58
  br i1 %.not77, label %.lr.ph100.split, label %._crit_edge.loopexit, !llvm.loop !18

._crit_edge.loopexit:                             ; preds = %56
  %.pre117 = load i8, ptr %8, align 8, !tbaa !11
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %32
  %59 = phi i8 [ %.pre117, %._crit_edge.loopexit ], [ %33, %32 ]
  %60 = phi i8 [ %57, %._crit_edge.loopexit ], [ %34, %32 ]
  %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
  %61 = zext i8 %59 to i64
  %.not78 = icmp ult i64 %indvars.iv.next115, %61
  br i1 %.not78, label %32, label %.thread81, !llvm.loop !19

.thread81.sink.split:                             ; preds = %14, %.lr.ph100.split, %.lr.ph100.split.us, %4, %3, %2
  %.str.24.sink = phi ptr [ @.str.20, %2 ], [ @.str.21, %3 ], [ @.str.22, %4 ], [ %spec.select, %.lr.ph100.split.us ], [ @.str.24, %.lr.ph100.split ], [ @.str.23, %14 ]
  %.sink129 = phi ptr [ getelementptr inbounds (i8, ptr @.str.20, i64 21), %2 ], [ getelementptr inbounds (i8, ptr @.str.21, i64 21), %3 ], [ getelementptr inbounds (i8, ptr @.str.22, i64 21), %4 ], [ %spec.select130, %.lr.ph100.split.us ], [ getelementptr inbounds (i8, ptr @.str.24, i64 21), %.lr.ph100.split ], [ getelementptr inbounds (i8, ptr @.str.23, i64 21), %14 ]
  %62 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr %.str.24.sink, ptr %62, align 8, !tbaa !20
  %63 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) %.sink129, i32 noundef 47) #5
  %.not74 = icmp eq ptr %63, null
  %64 = getelementptr inbounds i8, ptr %63, i64 1
  %65 = select i1 %.not74, ptr %.sink129, ptr %64
  %66 = getelementptr inbounds i8, ptr %62, i64 8
  store ptr %65, ptr %66, align 8, !tbaa !22
  %67 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %67, align 4, !tbaa !23
  %68 = tail call i32 @s2n_calculate_stacktrace() #4
  br label %.thread81

.thread81:                                        ; preds = %27, %._crit_edge, %54, %.thread81.sink.split, %.preheader90, %.preheader
  %.9 = phi ptr [ null, %.preheader ], [ null, %.preheader90 ], [ null, %.thread81.sink.split ], [ %44, %54 ], [ null, %._crit_edge ], [ %7, %27 ]
  ret ptr %.9
}

declare zeroext i1 @s2n_kem_group_is_available(ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { 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, !9, i64 24}
!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 = !{!9, !9, i64 0}
!11 = !{!6, !7, i64 16}
!12 = !{!13, !14, i64 8}
!13 = !{!"s2n_kem_group", !9, i64 0, !14, i64 8, !9, i64 16, !9, i64 24, !15, i64 32}
!14 = !{!"short", !7, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}
!20 = !{!21, !9, i64 0}
!21 = !{!"s2n_debug_info", !9, i64 0, !9, i64 8}
!22 = !{!21, !9, i64 8}
!23 = !{!24, !24, i64 0}
!24 = !{!"int", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass