; LLVM IR from aws/s2n-tls :: tests/unit (s2n_self_talk_npn_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_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.s2n_result = type { i32 }
%struct.s2n_client_hello = type { %struct.s2n_blob, %struct.s2n_parsed_extensions_list, %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_blob, i8, i8, i8 }
%struct.s2n_parsed_extensions_list = type { [21 x %struct.s2n_parsed_extension], %struct.s2n_blob, i16 }
%struct.s2n_parsed_extension = type { %struct.s2n_blob, i16, i16, i8 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.93 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.94 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.95 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.96 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.97 = external hidden unnamed_addr constant [94 x i8], align 1

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

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

declare i32 @s2n_calculate_stacktrace() #2

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

declare i32 @s2n_stuffer_init_written(ptr noundef, ptr noundef) #2

declare i32 @s2n_stuffer_read_uint16(ptr noundef, ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_client_hello_get_parsed_extension(i32 noundef, ptr noundef, ptr noundef) #6

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

16:                                               ; preds = %4
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %50, label %19

19:                                               ; preds = %16
  br label %20

20:                                               ; preds = %19
  br label %21

21:                                               ; preds = %20
  %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
  store ptr @.str.93, ptr %23, align 8, !tbaa !11
  %24 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %25 = getelementptr inbounds %struct.s2n_debug_info, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !11
  %27 = getelementptr inbounds i8, ptr %26, i64 21
  %28 = call ptr @strrchr(ptr noundef %27, i32 noundef 47) #7
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %37

30:                                               ; preds = %21
  %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
  %33 = load ptr, ptr %32, align 8, !tbaa !11
  %34 = getelementptr inbounds i8, ptr %33, i64 21
  %35 = call ptr @strrchr(ptr noundef %34, i32 noundef 47) #7
  %36 = getelementptr inbounds i8, ptr %35, i64 1
  br label %42

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

42:                                               ; preds = %37, %30
  %43 = phi ptr [ %36, %30 ], [ %41, %37 ]
  %44 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %45 = getelementptr inbounds %struct.s2n_debug_info, ptr %44, i32 0, i32 1
  store ptr %43, ptr %45, align 8, !tbaa !13
  %46 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %46, align 4, !tbaa !14
  %47 = call i32 @s2n_calculate_stacktrace()
  br label %48

48:                                               ; preds = %42
  store i32 -1, ptr %5, align 4
  br label %262

49:                                               ; No predecessors!
  br label %50

50:                                               ; preds = %49, %16
  br label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  store i16 0, ptr %52, align 2, !tbaa !9
  br label %53

53:                                               ; preds = %51
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = icmp ne ptr %54, null
  br i1 %55, label %87, label %56

56:                                               ; preds = %53
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  %59 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %60 = getelementptr inbounds %struct.s2n_debug_info, ptr %59, i32 0, i32 0
  store ptr @.str.94, ptr %60, align 8, !tbaa !11
  %61 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %62 = getelementptr inbounds %struct.s2n_debug_info, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !11
  %64 = getelementptr inbounds i8, ptr %63, i64 21
  %65 = call ptr @strrchr(ptr noundef %64, i32 noundef 47) #7
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %74

67:                                               ; preds = %58
  %68 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %69 = getelementptr inbounds %struct.s2n_debug_info, ptr %68, i32 0, i32 0
  %70 = load ptr, ptr %69, align 8, !tbaa !11
  %71 = getelementptr inbounds i8, ptr %70, i64 21
  %72 = call ptr @strrchr(ptr noundef %71, i32 noundef 47) #7
  %73 = getelementptr inbounds i8, ptr %72, i64 1
  br label %79

74:                                               ; preds = %58
  %75 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %76 = getelementptr inbounds %struct.s2n_debug_info, ptr %75, i32 0, i32 0
  %77 = load ptr, ptr %76, align 8, !tbaa !11
  %78 = getelementptr inbounds i8, ptr %77, i64 21
  br label %79

79:                                               ; preds = %74, %67
  %80 = phi ptr [ %73, %67 ], [ %78, %74 ]
  %81 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %82 = getelementptr inbounds %struct.s2n_debug_info, ptr %81, i32 0, i32 1
  store ptr %80, ptr %82, align 8, !tbaa !13
  %83 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %83, align 4, !tbaa !14
  %84 = call i32 @s2n_calculate_stacktrace()
  br label %85

85:                                               ; preds = %79
  store i32 -1, ptr %5, align 4
  br label %262

86:                                               ; No predecessors!
  br label %87

87:                                               ; preds = %86, %53
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = icmp ne ptr %90, null
  br i1 %91, label %123, label %92

92:                                               ; preds = %89
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93
  %95 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %96 = getelementptr inbounds %struct.s2n_debug_info, ptr %95, i32 0, i32 0
  store ptr @.str.95, ptr %96, align 8, !tbaa !11
  %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
  %99 = load ptr, ptr %98, align 8, !tbaa !11
  %100 = getelementptr inbounds i8, ptr %99, i64 21
  %101 = call ptr @strrchr(ptr noundef %100, i32 noundef 47) #7
  %102 = icmp ne ptr %101, null
  br i1 %102, label %103, label %110

103:                                              ; preds = %94
  %104 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %105 = getelementptr inbounds %struct.s2n_debug_info, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !11
  %107 = getelementptr inbounds i8, ptr %106, i64 21
  %108 = call ptr @strrchr(ptr noundef %107, i32 noundef 47) #7
  %109 = getelementptr inbounds i8, ptr %108, i64 1
  br label %115

110:                                              ; preds = %94
  %111 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %112 = getelementptr inbounds %struct.s2n_debug_info, ptr %111, i32 0, i32 0
  %113 = load ptr, ptr %112, align 8, !tbaa !11
  %114 = getelementptr inbounds i8, ptr %113, i64 21
  br label %115

115:                                              ; preds = %110, %103
  %116 = phi ptr [ %109, %103 ], [ %114, %110 ]
  %117 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %118 = getelementptr inbounds %struct.s2n_debug_info, ptr %117, i32 0, i32 1
  store ptr %116, ptr %118, align 8, !tbaa !13
  %119 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %119, align 4, !tbaa !14
  %120 = call i32 @s2n_calculate_stacktrace()
  br label %121

121:                                              ; preds = %115
  store i32 -1, ptr %5, align 4
  br label %262

122:                                              ; No predecessors!
  br label %123

123:                                              ; preds = %122, %89
  br label %124

124:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  store ptr null, ptr %10, align 8, !tbaa !5
  br label %125

125:                                              ; preds = %124
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.s2n_client_hello, ptr %126, i32 0, i32 1
  %128 = call i32 @s2n_client_hello_get_parsed_extension(i32 noundef 10, ptr noundef %127, ptr noundef %10)
  %129 = icmp sgt i32 %128, -1
  br i1 %129, label %131, label %130

130:                                              ; preds = %125
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %261

131:                                              ; preds = %125
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  %135 = load ptr, ptr %10, align 8, !tbaa !5
  %136 = icmp ne ptr %135, null
  br i1 %136, label %170, label %137

137:                                              ; preds = %134
  br label %138

138:                                              ; preds = %137
  br label %139

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

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

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

160:                                              ; preds = %155, %148
  %161 = phi ptr [ %154, %148 ], [ %159, %155 ]
  %162 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %163 = getelementptr inbounds %struct.s2n_debug_info, ptr %162, i32 0, i32 1
  store ptr %161, ptr %163, align 8, !tbaa !13
  %164 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %164, align 4, !tbaa !14
  %165 = call i32 @s2n_calculate_stacktrace()
  br label %166

166:                                              ; preds = %160
  br label %167

167:                                              ; preds = %166
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %261

168:                                              ; No predecessors!
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169, %134
  br label %171

171:                                              ; preds = %170
  br label %172

172:                                              ; preds = %171
  call void @llvm.lifetime.start.p0(i64 40, ptr %12) #8
  call void @llvm.memset.p0.i64(ptr align 8 %12, i8 0, i64 40, i1 false)
  br label %173

173:                                              ; preds = %172
  %174 = load ptr, ptr %10, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.s2n_parsed_extension, ptr %174, i32 0, i32 0
  %176 = call i32 @s2n_stuffer_init_written(ptr noundef %12, ptr noundef %175)
  %177 = icmp sgt i32 %176, -1
  br i1 %177, label %179, label %178

178:                                              ; preds = %173
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %260

179:                                              ; preds = %173
  br label %180

180:                                              ; preds = %179
  br label %181

181:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 2, ptr %13) #8
  store i16 0, ptr %13, align 2, !tbaa !9
  br label %182

182:                                              ; preds = %181
  %183 = call i32 @s2n_supported_groups_parse_count(ptr noundef %12, ptr noundef %13)
  %184 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  store i32 %183, ptr %184, align 4
  %185 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  %186 = load i32, ptr %185, align 4
  %187 = call zeroext i1 @s2n_result_is_ok(i32 %186)
  br i1 %187, label %189, label %188

188:                                              ; preds = %182
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %259

189:                                              ; preds = %182
  br label %190

190:                                              ; preds = %189
  br label %191

191:                                              ; preds = %190
  br label %192

192:                                              ; preds = %191
  %193 = load i16, ptr %13, align 2, !tbaa !9
  %194 = zext i16 %193 to i32
  %195 = load i16, ptr %8, align 2, !tbaa !9
  %196 = zext i16 %195 to i32
  %197 = icmp sle i32 %194, %196
  br i1 %197, label %231, label %198

198:                                              ; preds = %192
  br label %199

199:                                              ; preds = %198
  br label %200

200:                                              ; preds = %199
  %201 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %202 = getelementptr inbounds %struct.s2n_debug_info, ptr %201, i32 0, i32 0
  store ptr @.str.97, ptr %202, align 8, !tbaa !11
  %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) #7
  %208 = icmp ne ptr %207, null
  br i1 %208, label %209, label %216

209:                                              ; preds = %200
  %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
  %214 = call ptr @strrchr(ptr noundef %213, i32 noundef 47) #7
  %215 = getelementptr inbounds i8, ptr %214, i64 1
  br label %221

216:                                              ; preds = %200
  %217 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %218 = getelementptr inbounds %struct.s2n_debug_info, ptr %217, i32 0, i32 0
  %219 = load ptr, ptr %218, align 8, !tbaa !11
  %220 = getelementptr inbounds i8, ptr %219, i64 21
  br label %221

221:                                              ; preds = %216, %209
  %222 = phi ptr [ %215, %209 ], [ %220, %216 ]
  %223 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %224 = getelementptr inbounds %struct.s2n_debug_info, ptr %223, i32 0, i32 1
  store ptr %222, ptr %224, align 8, !tbaa !13
  %225 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762120, ptr %225, align 4, !tbaa !14
  %226 = call i32 @s2n_calculate_stacktrace()
  br label %227

227:                                              ; preds = %221
  br label %228

228:                                              ; preds = %227
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %259

229:                                              ; No predecessors!
  br label %230

230:                                              ; preds = %229
  br label %231

231:                                              ; preds = %230, %192
  br label %232

232:                                              ; preds = %231
  br label %233

233:                                              ; preds = %232
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  store i64 0, ptr %15, align 8, !tbaa !16
  br label %234

234:                                              ; preds = %251, %233
  %235 = load i64, ptr %15, align 8, !tbaa !16
  %236 = load i16, ptr %13, align 2, !tbaa !9
  %237 = zext i16 %236 to i64
  %238 = icmp ult i64 %235, %237
  br i1 %238, label %240, label %239

239:                                              ; preds = %234
  store i32 38, ptr %11, align 4
  br label %254

240:                                              ; preds = %234
  br label %241

241:                                              ; preds = %240
  %242 = load ptr, ptr %7, align 8, !tbaa !5
  %243 = load i64, ptr %15, align 8, !tbaa !16
  %244 = getelementptr inbounds i16, ptr %242, i64 %243
  %245 = call i32 @s2n_stuffer_read_uint16(ptr noundef %12, ptr noundef %244)
  %246 = icmp sgt i32 %245, -1
  br i1 %246, label %248, label %247

247:                                              ; preds = %241
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %254

248:                                              ; preds = %241
  br label %249

249:                                              ; preds = %248
  br label %250

250:                                              ; preds = %249
  br label %251

251:                                              ; preds = %250
  %252 = load i64, ptr %15, align 8, !tbaa !16
  %253 = add i64 %252, 1
  store i64 %253, ptr %15, align 8, !tbaa !16
  br label %234, !llvm.loop !18

254:                                              ; preds = %247, %239
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  %255 = load i32, ptr %11, align 4
  switch i32 %255, label %259 [
    i32 38, label %256
  ]

256:                                              ; preds = %254
  %257 = load i16, ptr %13, align 2, !tbaa !9
  %258 = load ptr, ptr %9, align 8, !tbaa !5
  store i16 %257, ptr %258, align 2, !tbaa !9
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %259

259:                                              ; preds = %256, %254, %228, %188
  call void @llvm.lifetime.end.p0(i64 2, ptr %13) #8
  br label %260

260:                                              ; preds = %259, %178
  call void @llvm.lifetime.end.p0(i64 40, ptr %12) #8
  br label %261

261:                                              ; preds = %260, %167, %130
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %262

262:                                              ; preds = %261, %121, %85, %48
  %263 = load i32, ptr %5, align 4
  ret i32 %263
}

declare i32 @s2n_supported_groups_parse_count(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #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, !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 = !{!"short", !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, !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"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.s2n_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }

@_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.93 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.94 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.95 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.96 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.97 = external hidden unnamed_addr constant [94 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

declare i32 @s2n_stuffer_init_written(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @s2n_stuffer_read_uint16(ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_client_hello_get_parsed_extension(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_client_hello_get_supported_groups(ptr noundef %0, ptr noundef %1, i16 noundef zeroext %2, ptr noundef writeonly %3) local_unnamed_addr #6 {
  %5 = alloca ptr, align 8
  %6 = alloca %struct.s2n_stuffer, align 8
  %7 = alloca i16, align 2
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %8, label %16

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

16:                                               ; preds = %4
  store i16 0, ptr %3, align 2, !tbaa !13
  %.not23 = icmp eq ptr %0, null
  br i1 %.not23, label %17, label %25

17:                                               ; preds = %16
  %18 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.94, ptr %18, align 8, !tbaa !5
  %19 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.94, i64 21), i32 noundef 47) #7
  %.not24 = icmp eq ptr %19, null
  %20 = getelementptr inbounds i8, ptr %19, i64 1
  %21 = select i1 %.not24, ptr getelementptr inbounds (i8, ptr @.str.94, 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 402653193, ptr %23, align 4, !tbaa !11
  %24 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %74

25:                                               ; preds = %16
  %.not25 = icmp eq ptr %1, null
  br i1 %.not25, label %26, label %34

26:                                               ; preds = %25
  %27 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.95, ptr %27, align 8, !tbaa !5
  %28 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.95, i64 21), i32 noundef 47) #7
  %.not26 = icmp eq ptr %28, null
  %29 = getelementptr inbounds i8, ptr %28, i64 1
  %30 = select i1 %.not26, ptr getelementptr inbounds (i8, ptr @.str.95, i64 21), ptr %29
  %31 = getelementptr inbounds i8, ptr %27, i64 8
  store ptr %30, ptr %31, align 8, !tbaa !10
  %32 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %32, align 4, !tbaa !11
  %33 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %74

34:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  store ptr null, ptr %5, align 8, !tbaa !15
  %35 = getelementptr inbounds i8, ptr %0, i64 24
  %36 = call i32 @s2n_client_hello_get_parsed_extension(i32 noundef 10, ptr noundef nonnull %35, ptr noundef nonnull %5)
  %37 = icmp sgt i32 %36, -1
  br i1 %37, label %38, label %73

38:                                               ; preds = %34
  %39 = load ptr, ptr %5, align 8, !tbaa !15
  %.not27 = icmp eq ptr %39, null
  br i1 %.not27, label %40, label %48

40:                                               ; preds = %38
  %41 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.96, ptr %41, align 8, !tbaa !5
  %42 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.96, i64 21), i32 noundef 47) #7
  %.not28 = icmp eq ptr %42, null
  %43 = getelementptr inbounds i8, ptr %42, i64 1
  %44 = select i1 %.not28, ptr getelementptr inbounds (i8, ptr @.str.96, i64 21), ptr %43
  %45 = getelementptr inbounds i8, ptr %41, i64 8
  store ptr %44, ptr %45, align 8, !tbaa !10
  %46 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %46, align 4, !tbaa !11
  %47 = call i32 @s2n_calculate_stacktrace() #8
  br label %73

48:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %6) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %6, i8 0, i64 40, i1 false)
  %49 = call i32 @s2n_stuffer_init_written(ptr noundef nonnull %6, ptr noundef nonnull %39) #8
  %50 = icmp sgt i32 %49, -1
  br i1 %50, label %51, label %72

51:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %7) #8
  store i16 0, ptr %7, align 2, !tbaa !13
  %52 = call i32 @s2n_supported_groups_parse_count(ptr noundef nonnull %6, ptr noundef nonnull %7) #8
  %53 = call zeroext i1 @s2n_result_is_ok(i32 %52)
  br i1 %53, label %54, label %.loopexit

54:                                               ; preds = %51
  %55 = load i16, ptr %7, align 2, !tbaa !13
  %.not29 = icmp ugt i16 %55, %2
  br i1 %.not29, label %56, label %.preheader

.preheader:                                       ; preds = %54
  %.not3132.not = icmp eq i16 %55, 0
  br i1 %.not3132.not, label %.critedge, label %.lr.ph

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

64:                                               ; preds = %.lr.ph
  %65 = add nuw nsw i64 %.033, 1
  %66 = load i16, ptr %7, align 2, !tbaa !13
  %67 = zext i16 %66 to i64
  %.not31 = icmp ult i64 %65, %67
  br i1 %.not31, label %.lr.ph, label %.critedge, !llvm.loop !16

.lr.ph:                                           ; preds = %.preheader, %64
  %.033 = phi i64 [ %65, %64 ], [ 0, %.preheader ]
  %68 = getelementptr inbounds i16, ptr %1, i64 %.033
  %69 = call i32 @s2n_stuffer_read_uint16(ptr noundef nonnull %6, ptr noundef nonnull %68) #8
  %70 = icmp sgt i32 %69, -1
  br i1 %70, label %64, label %.loopexit

.critedge:                                        ; preds = %64, %.preheader
  %71 = phi i16 [ 0, %.preheader ], [ %66, %64 ]
  store i16 %71, ptr %3, align 2, !tbaa !13
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %51, %.critedge, %56
  %.1 = phi i32 [ 0, %.critedge ], [ -1, %56 ], [ -1, %51 ], [ -1, %.lr.ph ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %7) #8
  br label %72

72:                                               ; preds = %48, %.loopexit
  %.2 = phi i32 [ %.1, %.loopexit ], [ -1, %48 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #8
  br label %73

73:                                               ; preds = %34, %72, %40
  %.3 = phi i32 [ %.2, %72 ], [ -1, %40 ], [ -1, %34 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br label %74

74:                                               ; preds = %73, %26, %17, %8
  %.4 = phi i32 [ %.3, %73 ], [ -1, %26 ], [ -1, %17 ], [ -1, %8 ]
  ret i32 %.4
}

declare i32 @s2n_supported_groups_parse_count(ptr noundef, 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #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 = !{!14, !14, i64 0}
!14 = !{!"short", !8, i64 0}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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