; LLVM IR from aws/s2n-tls :: tls/extensions (s2n_extension_list)

; 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_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.3 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [106 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

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

13:                                               ; preds = %2
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %47, label %16

16:                                               ; preds = %13
  br label %17

17:                                               ; preds = %16
  br label %18

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

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

34:                                               ; preds = %18
  %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 0
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds i8, ptr %37, i64 21
  br label %39

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

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

46:                                               ; No predecessors!
  br label %47

47:                                               ; preds = %46, %13
  br label %48

48:                                               ; preds = %47
  br label %49

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

52:                                               ; preds = %49
  br label %53

53:                                               ; preds = %52
  br label %54

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

63:                                               ; preds = %54
  %64 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %65 = getelementptr inbounds %struct.s2n_debug_info, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !9
  %67 = getelementptr inbounds i8, ptr %66, i64 21
  %68 = call ptr @strrchr(ptr noundef %67, i32 noundef 47) #7
  %69 = getelementptr inbounds i8, ptr %68, i64 1
  br label %75

70:                                               ; preds = %54
  %71 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %72 = getelementptr inbounds %struct.s2n_debug_info, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !9
  %74 = getelementptr inbounds i8, ptr %73, i64 21
  br label %75

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

81:                                               ; preds = %75
  store i32 -1, ptr %3, align 4
  br label %250

82:                                               ; No predecessors!
  br label %83

83:                                               ; preds = %82, %49
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  store i64 672, ptr %6, align 8, !tbaa !14
  %86 = load i64, ptr %6, align 8, !tbaa !14
  %87 = icmp ne i64 %86, 0
  %88 = xor i1 %87, true
  %89 = xor i1 %88, true
  %90 = zext i1 %89 to i32
  %91 = sext i32 %90 to i64
  %92 = call i64 @llvm.expect.i64(i64 %91, i64 1)
  %93 = icmp ne i64 %92, 0
  br i1 %93, label %94, label %142

94:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.s2n_parsed_extensions_list, ptr %95, i32 0, i32 0
  %97 = getelementptr inbounds [21 x %struct.s2n_parsed_extension], ptr %96, i64 0, i64 0
  store ptr %97, ptr %7, align 8, !tbaa !5
  br label %98

98:                                               ; preds = %94
  %99 = load ptr, ptr %7, align 8, !tbaa !5
  %100 = icmp ne ptr %99, null
  br i1 %100, label %134, label %101

101:                                              ; preds = %98
  br label %102

102:                                              ; preds = %101
  br label %103

103:                                              ; preds = %102
  %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
  store ptr @.str.5, ptr %105, align 8, !tbaa !9
  %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) #7
  %111 = icmp ne ptr %110, null
  br i1 %111, label %112, label %119

112:                                              ; preds = %103
  %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
  %117 = call ptr @strrchr(ptr noundef %116, i32 noundef 47) #7
  %118 = getelementptr inbounds i8, ptr %117, i64 1
  br label %124

119:                                              ; preds = %103
  %120 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %121 = getelementptr inbounds %struct.s2n_debug_info, ptr %120, i32 0, i32 0
  %122 = load ptr, ptr %121, align 8, !tbaa !9
  %123 = getelementptr inbounds i8, ptr %122, i64 21
  br label %124

124:                                              ; preds = %119, %112
  %125 = phi ptr [ %118, %112 ], [ %123, %119 ]
  %126 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %127 = getelementptr inbounds %struct.s2n_debug_info, ptr %126, i32 0, i32 1
  store ptr %125, ptr %127, align 8, !tbaa !11
  %128 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %128, align 4, !tbaa !12
  %129 = call i32 @s2n_calculate_stacktrace()
  br label %130

130:                                              ; preds = %124
  br label %131

131:                                              ; preds = %130
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %139

132:                                              ; No predecessors!
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133, %98
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  %138 = load i64, ptr %6, align 8, !tbaa !14
  call void @llvm.memset.p0.i64(ptr align 8 %137, i8 0, i64 %138, i1 false)
  store i32 0, ptr %8, align 4
  br label %139

139:                                              ; preds = %136, %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  %140 = load i32, ptr %8, align 4
  switch i32 %140, label %143 [
    i32 0, label %141
  ]

141:                                              ; preds = %139
  br label %142

142:                                              ; preds = %141, %85
  store i32 0, ptr %8, align 4
  br label %143

143:                                              ; preds = %142, %139
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  %144 = load i32, ptr %8, align 4
  switch i32 %144, label %252 [
    i32 0, label %145
    i32 1, label %250
  ]

145:                                              ; preds = %143
  br label %146

146:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #8
  store i16 0, ptr %9, align 2, !tbaa !16
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = call i32 @s2n_stuffer_read_uint16(ptr noundef %147, ptr noundef %9)
  %149 = icmp ne i32 %148, 0
  br i1 %149, label %150, label %151

150:                                              ; preds = %146
  store i16 0, ptr %9, align 2, !tbaa !16
  br label %151

151:                                              ; preds = %150, %146
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = load i16, ptr %9, align 2, !tbaa !16
  %154 = zext i16 %153 to i32
  %155 = call ptr @s2n_stuffer_raw_read(ptr noundef %152, i32 noundef %154)
  store ptr %155, ptr %10, align 8, !tbaa !5
  br label %156

156:                                              ; preds = %151
  %157 = load ptr, ptr %10, align 8, !tbaa !5
  %158 = icmp ne ptr %157, null
  br i1 %158, label %192, label %159

159:                                              ; preds = %156
  br label %160

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160
  %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 0
  store ptr @.str.6, ptr %163, align 8, !tbaa !9
  %164 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %165 = getelementptr inbounds %struct.s2n_debug_info, ptr %164, i32 0, i32 0
  %166 = load ptr, ptr %165, align 8, !tbaa !9
  %167 = getelementptr inbounds i8, ptr %166, i64 21
  %168 = call ptr @strrchr(ptr noundef %167, i32 noundef 47) #7
  %169 = icmp ne ptr %168, null
  br i1 %169, label %170, label %177

170:                                              ; preds = %161
  %171 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %172 = getelementptr inbounds %struct.s2n_debug_info, ptr %171, i32 0, i32 0
  %173 = load ptr, ptr %172, align 8, !tbaa !9
  %174 = getelementptr inbounds i8, ptr %173, i64 21
  %175 = call ptr @strrchr(ptr noundef %174, i32 noundef 47) #7
  %176 = getelementptr inbounds i8, ptr %175, i64 1
  br label %182

177:                                              ; preds = %161
  %178 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %179 = getelementptr inbounds %struct.s2n_debug_info, ptr %178, i32 0, i32 0
  %180 = load ptr, ptr %179, align 8, !tbaa !9
  %181 = getelementptr inbounds i8, ptr %180, i64 21
  br label %182

182:                                              ; preds = %177, %170
  %183 = phi ptr [ %176, %170 ], [ %181, %177 ]
  %184 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %185 = getelementptr inbounds %struct.s2n_debug_info, ptr %184, i32 0, i32 1
  store ptr %183, ptr %185, align 8, !tbaa !11
  %186 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %186, align 4, !tbaa !12
  %187 = call i32 @s2n_calculate_stacktrace()
  br label %188

188:                                              ; preds = %182
  br label %189

189:                                              ; preds = %188
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %249

190:                                              ; No predecessors!
  br label %191

191:                                              ; preds = %190
  br label %192

192:                                              ; preds = %191, %156
  br label %193

193:                                              ; preds = %192
  br label %194

194:                                              ; preds = %193
  br label %195

195:                                              ; preds = %194
  %196 = load ptr, ptr %5, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.s2n_parsed_extensions_list, ptr %196, i32 0, i32 1
  %198 = load ptr, ptr %10, align 8, !tbaa !5
  %199 = load i16, ptr %9, align 2, !tbaa !16
  %200 = zext i16 %199 to i32
  %201 = call i32 @s2n_blob_init(ptr noundef %197, ptr noundef %198, i32 noundef %200)
  %202 = icmp sgt i32 %201, -1
  br i1 %202, label %204, label %203

203:                                              ; preds = %195
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %249

204:                                              ; preds = %195
  br label %205

205:                                              ; preds = %204
  br label %206

206:                                              ; preds = %205
  call void @llvm.lifetime.start.p0(i64 40, ptr %11) #8
  call void @llvm.memset.p0.i64(ptr align 8 %11, i8 0, i64 40, i1 false)
  br label %207

207:                                              ; preds = %206
  %208 = load ptr, ptr %5, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.s2n_parsed_extensions_list, ptr %208, i32 0, i32 1
  %210 = call i32 @s2n_stuffer_init(ptr noundef %11, ptr noundef %209)
  %211 = icmp sgt i32 %210, -1
  br i1 %211, label %213, label %212

212:                                              ; preds = %207
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %248

213:                                              ; preds = %207
  br label %214

214:                                              ; preds = %213
  br label %215

215:                                              ; preds = %214
  br label %216

216:                                              ; preds = %215
  %217 = load i16, ptr %9, align 2, !tbaa !16
  %218 = zext i16 %217 to i32
  %219 = call i32 @s2n_stuffer_skip_write(ptr noundef %11, i32 noundef %218)
  %220 = icmp sgt i32 %219, -1
  br i1 %220, label %222, label %221

221:                                              ; preds = %216
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %248

222:                                              ; preds = %216
  br label %223

223:                                              ; preds = %222
  br label %224

224:                                              ; preds = %223
  call void @llvm.lifetime.start.p0(i64 2, ptr %12) #8
  store i16 0, ptr %12, align 2, !tbaa !16
  br label %225

225:                                              ; preds = %242, %224
  %226 = getelementptr inbounds %struct.s2n_stuffer, ptr %11, i32 0, i32 2
  %227 = load i32, ptr %226, align 4, !tbaa !18
  %228 = getelementptr inbounds %struct.s2n_stuffer, ptr %11, i32 0, i32 1
  %229 = load i32, ptr %228, align 8, !tbaa !21
  %230 = sub i32 %227, %229
  %231 = icmp ne i32 %230, 0
  br i1 %231, label %232, label %243

232:                                              ; preds = %225
  br label %233

233:                                              ; preds = %232
  %234 = load ptr, ptr %5, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.s2n_parsed_extensions_list, ptr %234, i32 0, i32 0
  %236 = getelementptr inbounds [21 x %struct.s2n_parsed_extension], ptr %235, i64 0, i64 0
  %237 = call i32 @s2n_extension_parse(ptr noundef %11, ptr noundef %236, ptr noundef %12)
  %238 = icmp sgt i32 %237, -1
  br i1 %238, label %240, label %239

239:                                              ; preds = %233
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %247

240:                                              ; preds = %233
  br label %241

241:                                              ; preds = %240
  br label %242

242:                                              ; preds = %241
  br label %225, !llvm.loop !22

243:                                              ; preds = %225
  %244 = load i16, ptr %12, align 2, !tbaa !16
  %245 = load ptr, ptr %5, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.s2n_parsed_extensions_list, ptr %245, i32 0, i32 2
  store i16 %244, ptr %246, align 8, !tbaa !24
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %247

247:                                              ; preds = %243, %239
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #8
  br label %248

248:                                              ; preds = %247, %221, %212
  call void @llvm.lifetime.end.p0(i64 40, ptr %11) #8
  br label %249

249:                                              ; preds = %248, %203, %189
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #8
  br label %250

250:                                              ; preds = %249, %143, %81, %45
  %251 = load i32, ptr %3, align 4
  ret i32 %251

252:                                              ; preds = %143
  unreachable
}

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

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

declare i32 @s2n_calculate_stacktrace() #5

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #6

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

declare ptr @s2n_stuffer_raw_read(ptr noundef, i32 noundef) #5

declare i32 @s2n_blob_init(ptr noundef, ptr noundef, i32 noundef) #5

declare i32 @s2n_stuffer_init(ptr noundef, ptr noundef) #5

declare i32 @s2n_stuffer_skip_write(ptr noundef, i32 noundef) #5

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_extension_parse(ptr noundef, ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #5 = { "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 = { nocallback nofree nosync nounwind willreturn memory(none) }
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, !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, !15, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"short", !7, i64 0}
!18 = !{!19, !13, i64 28}
!19 = !{!"s2n_stuffer", !20, i64 0, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 36, !13, i64 36}
!20 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!21 = !{!19, !13, i64 24}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!25, !17, i64 696}
!25 = !{!"", !7, i64 0, !20, i64 672, !17, i64 696}


; 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.3 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [106 x i8], align 1

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

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

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

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

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

14:                                               ; preds = %2
  %.not26 = icmp eq ptr %1, null
  br i1 %.not26, label %15, label %23

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

23:                                               ; preds = %14
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(672) %1, i8 0, i64 672, i1 false)
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %3) #7
  store i16 0, ptr %3, align 2, !tbaa !13
  %24 = call i32 @s2n_stuffer_read_uint16(ptr noundef nonnull %0, ptr noundef nonnull %3) #7
  %.not28 = icmp eq i32 %24, 0
  br i1 %.not28, label %._crit_edge, label %26

._crit_edge:                                      ; preds = %23
  %.pre = load i16, ptr %3, align 2, !tbaa !13
  %25 = zext i16 %.pre to i32
  br label %27

26:                                               ; preds = %23
  store i16 0, ptr %3, align 2, !tbaa !13
  br label %27

27:                                               ; preds = %._crit_edge, %26
  %28 = phi i32 [ %25, %._crit_edge ], [ 0, %26 ]
  %29 = call ptr @s2n_stuffer_raw_read(ptr noundef nonnull %0, i32 noundef %28) #7
  %.not29 = icmp eq ptr %29, null
  br i1 %.not29, label %30, label %38

30:                                               ; preds = %27
  %31 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.6, ptr %31, align 8, !tbaa !5
  %32 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.6, i64 21), i32 noundef 47) #6
  %.not30 = icmp eq ptr %32, null
  %33 = getelementptr inbounds i8, ptr %32, i64 1
  %34 = select i1 %.not30, ptr getelementptr inbounds (i8, ptr @.str.6, i64 21), ptr %33
  %35 = getelementptr inbounds i8, ptr %31, i64 8
  store ptr %34, ptr %35, align 8, !tbaa !10
  %36 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %36, align 4, !tbaa !11
  %37 = call i32 @s2n_calculate_stacktrace() #7
  br label %65

38:                                               ; preds = %27
  %39 = getelementptr inbounds i8, ptr %1, i64 672
  %40 = load i16, ptr %3, align 2, !tbaa !13
  %41 = zext i16 %40 to i32
  %42 = call i32 @s2n_blob_init(ptr noundef nonnull %39, ptr noundef nonnull %29, i32 noundef %41) #7
  %43 = icmp sgt i32 %42, -1
  br i1 %43, label %44, label %65

44:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %4, i8 0, i64 40, i1 false)
  %45 = call i32 @s2n_stuffer_init(ptr noundef nonnull %4, ptr noundef nonnull %39) #7
  %46 = icmp sgt i32 %45, -1
  br i1 %46, label %47, label %64

47:                                               ; preds = %44
  %48 = load i16, ptr %3, align 2, !tbaa !13
  %49 = zext i16 %48 to i32
  %50 = call i32 @s2n_stuffer_skip_write(ptr noundef nonnull %4, i32 noundef %49) #7
  %51 = icmp sgt i32 %50, -1
  br i1 %51, label %52, label %64

52:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %5) #7
  store i16 0, ptr %5, align 2, !tbaa !13
  %53 = getelementptr inbounds i8, ptr %4, i64 28
  %54 = getelementptr inbounds i8, ptr %4, i64 24
  br label %55

55:                                               ; preds = %58, %52
  %56 = load i32, ptr %53, align 4, !tbaa !15
  %57 = load i32, ptr %54, align 8, !tbaa !18
  %.not31 = icmp eq i32 %56, %57
  br i1 %.not31, label %61, label %58

58:                                               ; preds = %55
  %59 = call i32 @s2n_extension_parse(ptr noundef nonnull %4, ptr noundef nonnull %1, ptr noundef nonnull %5)
  %60 = icmp sgt i32 %59, -1
  br i1 %60, label %55, label %.loopexit, !llvm.loop !19

61:                                               ; preds = %55
  %62 = load i16, ptr %5, align 2, !tbaa !13
  %63 = getelementptr inbounds i8, ptr %1, i64 696
  store i16 %62, ptr %63, align 8, !tbaa !21
  br label %.loopexit

.loopexit:                                        ; preds = %58, %61
  %.3 = phi i32 [ 0, %61 ], [ -1, %58 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #7
  br label %64

64:                                               ; preds = %47, %44, %.loopexit
  %.4 = phi i32 [ %.3, %.loopexit ], [ -1, %44 ], [ -1, %47 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #7
  br label %65

65:                                               ; preds = %38, %64, %30
  %.5 = phi i32 [ %.4, %64 ], [ -1, %30 ], [ -1, %38 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #7
  br label %66

66:                                               ; preds = %65, %15, %6
  %.6 = phi i32 [ %.5, %65 ], [ -1, %15 ], [ -1, %6 ]
  ret i32 %.6
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strrchr(ptr noundef, i32 noundef) local_unnamed_addr #4

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #5

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

declare ptr @s2n_stuffer_raw_read(ptr noundef, i32 noundef) local_unnamed_addr #5

declare i32 @s2n_blob_init(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

declare i32 @s2n_stuffer_init(ptr noundef, ptr noundef) local_unnamed_addr #5

declare i32 @s2n_stuffer_skip_write(ptr noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_extension_parse(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"short", !8, i64 0}
!15 = !{!16, !12, i64 28}
!16 = !{!"s2n_stuffer", !17, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!17 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!18 = !{!16, !12, i64 24}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!22, !14, i64 696}
!22 = !{!"", !8, i64 0, !17, i64 672, !14, i64 696}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass