; LLVM IR from aws/s2n-tls :: stuffer (s2n_stuffer)

; 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_result = type { i32 }
%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 global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.12 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [92 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_stuffer_validate(ptr noundef) #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: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) #4

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

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

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

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

declare i32 @s2n_free(ptr noundef) #3

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

15:                                               ; preds = %2
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = call i32 @s2n_stuffer_validate(ptr noundef %16)
  %18 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  store i32 %17, ptr %18, align 4
  %19 = getelementptr inbounds %struct.s2n_result, ptr %7, i32 0, i32 0
  %20 = load i32, ptr %19, align 4
  %21 = call zeroext i1 @s2n_result_is_ok(i32 %20)
  %22 = xor i1 %21, true
  %23 = xor i1 %22, true
  %24 = zext i1 %23 to i32
  %25 = sext i32 %24 to i64
  %26 = call i64 @llvm.expect.i64(i64 %25, i64 1)
  %27 = icmp ne i64 %26, 0
  br i1 %27, label %28, label %30

28:                                               ; preds = %15
  %29 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 0, ptr %29, align 4, !tbaa !11
  br label %32

30:                                               ; preds = %15
  %31 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 -1, ptr %31, align 4, !tbaa !11
  br label %32

32:                                               ; preds = %30, %28
  %33 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  %34 = load i32, ptr %33, align 4
  %35 = call zeroext i1 @s2n_result_is_ok(i32 %34)
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  store i32 -1, ptr %3, align 4
  br label %310

37:                                               ; preds = %32
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.s2n_stuffer, ptr %40, i32 0, i32 4
  %42 = load i8, ptr %41, align 4
  %43 = lshr i8 %42, 2
  %44 = and i8 %43, 1
  %45 = zext i8 %44 to i32
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %78

47:                                               ; preds = %39
  br label %48

48:                                               ; preds = %47
  br label %49

49:                                               ; preds = %48
  %50 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %51 = getelementptr inbounds %struct.s2n_debug_info, ptr %50, i32 0, i32 0
  store ptr @.str.12, ptr %51, align 8, !tbaa !13
  %52 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %53 = getelementptr inbounds %struct.s2n_debug_info, ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8, !tbaa !13
  %55 = getelementptr inbounds i8, ptr %54, i64 21
  %56 = call ptr @strrchr(ptr noundef %55, i32 noundef 47) #8
  %57 = icmp ne ptr %56, null
  br i1 %57, label %58, label %65

58:                                               ; preds = %49
  %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
  %61 = load ptr, ptr %60, align 8, !tbaa !13
  %62 = getelementptr inbounds i8, ptr %61, i64 21
  %63 = call ptr @strrchr(ptr noundef %62, i32 noundef 47) #8
  %64 = getelementptr inbounds i8, ptr %63, i64 1
  br label %70

65:                                               ; preds = %49
  %66 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %67 = getelementptr inbounds %struct.s2n_debug_info, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !13
  %69 = getelementptr inbounds i8, ptr %68, i64 21
  br label %70

70:                                               ; preds = %65, %58
  %71 = phi ptr [ %64, %58 ], [ %69, %65 ]
  %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 1
  store ptr %71, ptr %73, align 8, !tbaa !15
  %74 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653200, ptr %74, align 4, !tbaa !9
  %75 = call i32 @s2n_calculate_stacktrace()
  br label %76

76:                                               ; preds = %70
  store i32 -1, ptr %3, align 4
  br label %310

77:                                               ; No predecessors!
  br label %78

78:                                               ; preds = %77, %39
  br label %79

79:                                               ; preds = %78
  br label %80

80:                                               ; preds = %79
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.s2n_stuffer, ptr %81, i32 0, i32 4
  %83 = load i8, ptr %82, align 4
  %84 = lshr i8 %83, 1
  %85 = and i8 %84, 1
  %86 = zext i8 %85 to i32
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %119, label %88

88:                                               ; preds = %80
  br label %89

89:                                               ; preds = %88
  br label %90

90:                                               ; preds = %89
  %91 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %92 = getelementptr inbounds %struct.s2n_debug_info, ptr %91, i32 0, i32 0
  store ptr @.str.13, ptr %92, align 8, !tbaa !13
  %93 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %94 = getelementptr inbounds %struct.s2n_debug_info, ptr %93, i32 0, i32 0
  %95 = load ptr, ptr %94, align 8, !tbaa !13
  %96 = getelementptr inbounds i8, ptr %95, i64 21
  %97 = call ptr @strrchr(ptr noundef %96, i32 noundef 47) #8
  %98 = icmp ne ptr %97, null
  br i1 %98, label %99, label %106

99:                                               ; preds = %90
  %100 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %101 = getelementptr inbounds %struct.s2n_debug_info, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !13
  %103 = getelementptr inbounds i8, ptr %102, i64 21
  %104 = call ptr @strrchr(ptr noundef %103, i32 noundef 47) #8
  %105 = getelementptr inbounds i8, ptr %104, i64 1
  br label %111

106:                                              ; preds = %90
  %107 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %108 = getelementptr inbounds %struct.s2n_debug_info, ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !13
  %110 = getelementptr inbounds i8, ptr %109, i64 21
  br label %111

111:                                              ; preds = %106, %99
  %112 = phi ptr [ %105, %99 ], [ %110, %106 ]
  %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 1
  store ptr %112, ptr %114, align 8, !tbaa !15
  %115 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653199, ptr %115, align 4, !tbaa !9
  %116 = call i32 @s2n_calculate_stacktrace()
  br label %117

117:                                              ; preds = %111
  store i32 -1, ptr %3, align 4
  br label %310

118:                                              ; No predecessors!
  br label %119

119:                                              ; preds = %118, %80
  br label %120

120:                                              ; preds = %119
  %121 = load i32, ptr %5, align 4, !tbaa !9
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.s2n_stuffer, ptr %122, i32 0, i32 0
  %124 = getelementptr inbounds %struct.s2n_blob, ptr %123, i32 0, i32 1
  %125 = load i32, ptr %124, align 8, !tbaa !16
  %126 = icmp eq i32 %121, %125
  br i1 %126, label %127, label %128

127:                                              ; preds = %120
  store i32 0, ptr %3, align 4
  br label %310

128:                                              ; preds = %120
  %129 = load i32, ptr %5, align 4, !tbaa !9
  %130 = icmp eq i32 %129, 0
  br i1 %130, label %131, label %137

131:                                              ; preds = %128
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = call i32 @s2n_stuffer_wipe(ptr noundef %132)
  %134 = load ptr, ptr %4, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.s2n_stuffer, ptr %134, i32 0, i32 0
  %136 = call i32 @s2n_free(ptr noundef %135)
  store i32 %136, ptr %3, align 4
  br label %310

137:                                              ; preds = %128
  %138 = load i32, ptr %5, align 4, !tbaa !9
  %139 = load ptr, ptr %4, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.s2n_stuffer, ptr %139, i32 0, i32 0
  %141 = getelementptr inbounds %struct.s2n_blob, ptr %140, i32 0, i32 1
  %142 = load i32, ptr %141, align 8, !tbaa !16
  %143 = icmp ult i32 %138, %142
  br i1 %143, label %144, label %276

144:                                              ; preds = %137
  br label %145

145:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.s2n_stuffer, ptr %146, i32 0, i32 0
  %148 = getelementptr inbounds %struct.s2n_blob, ptr %147, i32 0, i32 1
  %149 = load i32, ptr %148, align 8, !tbaa !16
  %150 = load i32, ptr %5, align 4, !tbaa !9
  %151 = sub i32 %149, %150
  store i32 %151, ptr %8, align 4, !tbaa !9
  %152 = load i32, ptr %8, align 4, !tbaa !9
  %153 = icmp ne i32 %152, 0
  %154 = xor i1 %153, true
  %155 = xor i1 %154, true
  %156 = zext i1 %155 to i32
  %157 = sext i32 %156 to i64
  %158 = call i64 @llvm.expect.i64(i64 %157, i64 1)
  %159 = icmp ne i64 %158, 0
  br i1 %159, label %160, label %213

160:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.s2n_stuffer, ptr %161, i32 0, i32 0
  %163 = getelementptr inbounds %struct.s2n_blob, ptr %162, i32 0, i32 0
  %164 = load ptr, ptr %163, align 8, !tbaa !19
  %165 = load i32, ptr %5, align 4, !tbaa !9
  %166 = zext i32 %165 to i64
  %167 = getelementptr inbounds i8, ptr %164, i64 %166
  store ptr %167, ptr %9, align 8, !tbaa !5
  br label %168

168:                                              ; preds = %160
  %169 = load ptr, ptr %9, align 8, !tbaa !5
  %170 = icmp ne ptr %169, null
  br i1 %170, label %204, label %171

171:                                              ; preds = %168
  br label %172

172:                                              ; preds = %171
  br label %173

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

182:                                              ; preds = %173
  %183 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %184 = getelementptr inbounds %struct.s2n_debug_info, ptr %183, i32 0, i32 0
  %185 = load ptr, ptr %184, align 8, !tbaa !13
  %186 = getelementptr inbounds i8, ptr %185, i64 21
  %187 = call ptr @strrchr(ptr noundef %186, i32 noundef 47) #8
  %188 = getelementptr inbounds i8, ptr %187, i64 1
  br label %194

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

194:                                              ; preds = %189, %182
  %195 = phi ptr [ %188, %182 ], [ %193, %189 ]
  %196 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %197 = getelementptr inbounds %struct.s2n_debug_info, ptr %196, i32 0, i32 1
  store ptr %195, ptr %197, align 8, !tbaa !15
  %198 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %198, align 4, !tbaa !9
  %199 = call i32 @s2n_calculate_stacktrace()
  br label %200

200:                                              ; preds = %194
  br label %201

201:                                              ; preds = %200
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %210

202:                                              ; No predecessors!
  br label %203

203:                                              ; preds = %202
  br label %204

204:                                              ; preds = %203, %168
  br label %205

205:                                              ; preds = %204
  br label %206

206:                                              ; preds = %205
  %207 = load ptr, ptr %9, align 8, !tbaa !5
  %208 = load i32, ptr %8, align 4, !tbaa !9
  %209 = zext i32 %208 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %207, i8 119, i64 %209, i1 false)
  store i32 0, ptr %10, align 4
  br label %210

210:                                              ; preds = %206, %201
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  %211 = load i32, ptr %10, align 4
  switch i32 %211, label %214 [
    i32 0, label %212
  ]

212:                                              ; preds = %210
  br label %213

213:                                              ; preds = %212, %145
  store i32 0, ptr %10, align 4
  br label %214

214:                                              ; preds = %213, %210
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  %215 = load i32, ptr %10, align 4
  switch i32 %215, label %312 [
    i32 0, label %216
    i32 1, label %310
  ]

216:                                              ; preds = %214
  br label %217

217:                                              ; preds = %216
  %218 = load ptr, ptr %4, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct.s2n_stuffer, ptr %218, i32 0, i32 1
  %220 = load i32, ptr %219, align 8, !tbaa !20
  %221 = load i32, ptr %5, align 4, !tbaa !9
  %222 = icmp ugt i32 %220, %221
  br i1 %222, label %223, label %227

223:                                              ; preds = %217
  %224 = load i32, ptr %5, align 4, !tbaa !9
  %225 = load ptr, ptr %4, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.s2n_stuffer, ptr %225, i32 0, i32 1
  store i32 %224, ptr %226, align 8, !tbaa !20
  br label %227

227:                                              ; preds = %223, %217
  %228 = load ptr, ptr %4, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.s2n_stuffer, ptr %228, i32 0, i32 2
  %230 = load i32, ptr %229, align 4, !tbaa !21
  %231 = load i32, ptr %5, align 4, !tbaa !9
  %232 = icmp ugt i32 %230, %231
  br i1 %232, label %233, label %237

233:                                              ; preds = %227
  %234 = load i32, ptr %5, align 4, !tbaa !9
  %235 = load ptr, ptr %4, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.s2n_stuffer, ptr %235, i32 0, i32 2
  store i32 %234, ptr %236, align 4, !tbaa !21
  br label %237

237:                                              ; preds = %233, %227
  %238 = load ptr, ptr %4, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct.s2n_stuffer, ptr %238, i32 0, i32 3
  %240 = load i32, ptr %239, align 8, !tbaa !22
  %241 = load i32, ptr %5, align 4, !tbaa !9
  %242 = icmp ugt i32 %240, %241
  br i1 %242, label %243, label %247

243:                                              ; preds = %237
  %244 = load i32, ptr %5, align 4, !tbaa !9
  %245 = load ptr, ptr %4, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.s2n_stuffer, ptr %245, i32 0, i32 3
  store i32 %244, ptr %246, align 8, !tbaa !22
  br label %247

247:                                              ; preds = %243, %237
  %248 = load i32, ptr %5, align 4, !tbaa !9
  %249 = load ptr, ptr %4, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct.s2n_stuffer, ptr %249, i32 0, i32 0
  %251 = getelementptr inbounds %struct.s2n_blob, ptr %250, i32 0, i32 1
  store i32 %248, ptr %251, align 8, !tbaa !16
  br label %252

252:                                              ; preds = %247
  %253 = load ptr, ptr %4, align 8, !tbaa !5
  %254 = call i32 @s2n_stuffer_validate(ptr noundef %253)
  %255 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  store i32 %254, ptr %255, align 4
  %256 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  %257 = load i32, ptr %256, align 4
  %258 = call zeroext i1 @s2n_result_is_ok(i32 %257)
  %259 = xor i1 %258, true
  %260 = xor i1 %259, true
  %261 = zext i1 %260 to i32
  %262 = sext i32 %261 to i64
  %263 = call i64 @llvm.expect.i64(i64 %262, i64 1)
  %264 = icmp ne i64 %263, 0
  br i1 %264, label %265, label %267

265:                                              ; preds = %252
  %266 = getelementptr inbounds %struct.s2n_result, ptr %11, i32 0, i32 0
  store i32 0, ptr %266, align 4, !tbaa !11
  br label %269

267:                                              ; preds = %252
  %268 = getelementptr inbounds %struct.s2n_result, ptr %11, i32 0, i32 0
  store i32 -1, ptr %268, align 4, !tbaa !11
  br label %269

269:                                              ; preds = %267, %265
  %270 = getelementptr inbounds %struct.s2n_result, ptr %11, i32 0, i32 0
  %271 = load i32, ptr %270, align 4
  %272 = call zeroext i1 @s2n_result_is_ok(i32 %271)
  br i1 %272, label %274, label %273

273:                                              ; preds = %269
  store i32 -1, ptr %3, align 4
  br label %310

274:                                              ; preds = %269
  br label %275

275:                                              ; preds = %274
  store i32 0, ptr %3, align 4
  br label %310

276:                                              ; preds = %137
  br label %277

277:                                              ; preds = %276
  %278 = load ptr, ptr %4, align 8, !tbaa !5
  %279 = getelementptr inbounds %struct.s2n_stuffer, ptr %278, i32 0, i32 0
  %280 = load i32, ptr %5, align 4, !tbaa !9
  %281 = call i32 @s2n_realloc(ptr noundef %279, i32 noundef %280)
  %282 = icmp sgt i32 %281, -1
  br i1 %282, label %284, label %283

283:                                              ; preds = %277
  store i32 -1, ptr %3, align 4
  br label %310

284:                                              ; preds = %277
  br label %285

285:                                              ; preds = %284
  br label %286

286:                                              ; preds = %285
  %287 = load ptr, ptr %4, align 8, !tbaa !5
  %288 = call i32 @s2n_stuffer_validate(ptr noundef %287)
  %289 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  store i32 %288, ptr %289, align 4
  %290 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  %291 = load i32, ptr %290, align 4
  %292 = call zeroext i1 @s2n_result_is_ok(i32 %291)
  %293 = xor i1 %292, true
  %294 = xor i1 %293, true
  %295 = zext i1 %294 to i32
  %296 = sext i32 %295 to i64
  %297 = call i64 @llvm.expect.i64(i64 %296, i64 1)
  %298 = icmp ne i64 %297, 0
  br i1 %298, label %299, label %301

299:                                              ; preds = %286
  %300 = getelementptr inbounds %struct.s2n_result, ptr %13, i32 0, i32 0
  store i32 0, ptr %300, align 4, !tbaa !11
  br label %303

301:                                              ; preds = %286
  %302 = getelementptr inbounds %struct.s2n_result, ptr %13, i32 0, i32 0
  store i32 -1, ptr %302, align 4, !tbaa !11
  br label %303

303:                                              ; preds = %301, %299
  %304 = getelementptr inbounds %struct.s2n_result, ptr %13, i32 0, i32 0
  %305 = load i32, ptr %304, align 4
  %306 = call zeroext i1 @s2n_result_is_ok(i32 %305)
  br i1 %306, label %308, label %307

307:                                              ; preds = %303
  store i32 -1, ptr %3, align 4
  br label %310

308:                                              ; preds = %303
  br label %309

309:                                              ; preds = %308
  store i32 0, ptr %3, align 4
  br label %310

310:                                              ; preds = %309, %307, %283, %275, %273, %214, %131, %127, %117, %76, %36
  %311 = load i32, ptr %3, align 4
  ret i32 %311

312:                                              ; preds = %214
  unreachable
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_stuffer_wipe(ptr noundef) #0

declare i32 @s2n_realloc(ptr noundef, i32 noundef) #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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 #5 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #6 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"", !10, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!15 = !{!14, !6, i64 8}
!16 = !{!17, !10, i64 8}
!17 = !{!"s2n_stuffer", !18, i64 0, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 36, !10, i64 36}
!18 = !{!"s2n_blob", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!19 = !{!17, !6, i64 0}
!20 = !{!17, !10, i64 24}
!21 = !{!17, !10, i64 28}
!22 = !{!17, !10, i64 32}


; 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.12 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [92 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_stuffer_validate(ptr noundef) local_unnamed_addr #0

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #3

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

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

declare i32 @s2n_free(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_stuffer_resize(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = tail call i32 @s2n_stuffer_validate(ptr noundef %0)
  %4 = tail call zeroext i1 @s2n_result_is_ok(i32 %3)
  %not. = xor i1 %4, true
  %. = sext i1 %not. to i32
  %5 = tail call zeroext i1 @s2n_result_is_ok(i32 %.)
  br i1 %5, label %6, label %70

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 36
  %8 = load i8, ptr %7, align 4
  %9 = and i8 %8, 4
  %.not = icmp eq i8 %9, 0
  br i1 %.not, label %18, label %10

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

18:                                               ; preds = %6
  %19 = and i8 %8, 2
  %.not50 = icmp eq i8 %19, 0
  br i1 %.not50, label %20, label %28

20:                                               ; preds = %18
  %21 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.13, ptr %21, align 8, !tbaa !5
  %22 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.13, i64 21), i32 noundef 47) #6
  %.not51 = icmp eq ptr %22, null
  %23 = getelementptr inbounds i8, ptr %22, i64 1
  %24 = select i1 %.not51, ptr getelementptr inbounds (i8, ptr @.str.13, i64 21), ptr %23
  %25 = getelementptr inbounds i8, ptr %21, i64 8
  store ptr %24, ptr %25, align 8, !tbaa !10
  %26 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653199, ptr %26, align 4, !tbaa !11
  %27 = tail call i32 @s2n_calculate_stacktrace() #7
  br label %70

28:                                               ; preds = %18
  %29 = getelementptr inbounds i8, ptr %0, i64 8
  %30 = load i32, ptr %29, align 8, !tbaa !13
  %31 = icmp eq i32 %30, %1
  br i1 %31, label %70, label %32

32:                                               ; preds = %28
  %33 = icmp eq i32 %1, 0
  br i1 %33, label %34, label %37

34:                                               ; preds = %32
  %35 = tail call i32 @s2n_stuffer_wipe(ptr noundef nonnull %0)
  %36 = tail call i32 @s2n_free(ptr noundef nonnull %0) #7
  br label %70

37:                                               ; preds = %32
  %38 = icmp ugt i32 %30, %1
  br i1 %38, label %39, label %63

39:                                               ; preds = %37
  %40 = sub i32 %30, %1
  %41 = load ptr, ptr %0, align 8, !tbaa !16
  %42 = zext i32 %1 to i64
  %43 = getelementptr inbounds i8, ptr %41, i64 %42
  %44 = zext i32 %40 to i64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 %43, i8 119, i64 %44, i1 false)
  %45 = getelementptr inbounds i8, ptr %0, i64 24
  %46 = load i32, ptr %45, align 8, !tbaa !17
  %47 = icmp ugt i32 %46, %1
  br i1 %47, label %48, label %49

48:                                               ; preds = %39
  store i32 %1, ptr %45, align 8, !tbaa !17
  br label %49

49:                                               ; preds = %48, %39
  %50 = getelementptr inbounds i8, ptr %0, i64 28
  %51 = load i32, ptr %50, align 4, !tbaa !18
  %52 = icmp ugt i32 %51, %1
  br i1 %52, label %53, label %54

53:                                               ; preds = %49
  store i32 %1, ptr %50, align 4, !tbaa !18
  br label %54

54:                                               ; preds = %53, %49
  %55 = getelementptr inbounds i8, ptr %0, i64 32
  %56 = load i32, ptr %55, align 8, !tbaa !19
  %57 = icmp ugt i32 %56, %1
  br i1 %57, label %58, label %59

58:                                               ; preds = %54
  store i32 %1, ptr %55, align 8, !tbaa !19
  br label %59

59:                                               ; preds = %58, %54
  store i32 %1, ptr %29, align 8, !tbaa !13
  %60 = tail call i32 @s2n_stuffer_validate(ptr noundef nonnull %0)
  %61 = tail call zeroext i1 @s2n_result_is_ok(i32 %60)
  %not.59 = xor i1 %61, true
  %.54 = sext i1 %not.59 to i32
  %62 = tail call zeroext i1 @s2n_result_is_ok(i32 %.54)
  %not.60 = xor i1 %62, true
  %spec.select = sext i1 %not.60 to i32
  br label %70

63:                                               ; preds = %37
  %64 = tail call i32 @s2n_realloc(ptr noundef nonnull %0, i32 noundef %1) #7
  %65 = icmp sgt i32 %64, -1
  br i1 %65, label %66, label %70

66:                                               ; preds = %63
  %67 = tail call i32 @s2n_stuffer_validate(ptr noundef nonnull %0)
  %68 = tail call zeroext i1 @s2n_result_is_ok(i32 %67)
  %not.57 = xor i1 %68, true
  %.55 = sext i1 %not.57 to i32
  %69 = tail call zeroext i1 @s2n_result_is_ok(i32 %.55)
  %not.58 = xor i1 %69, true
  %spec.select56 = sext i1 %not.58 to i32
  br label %70

70:                                               ; preds = %66, %59, %63, %28, %2, %34, %20, %10
  %.3 = phi i32 [ -1, %10 ], [ %36, %34 ], [ -1, %20 ], [ -1, %2 ], [ 0, %28 ], [ -1, %63 ], [ %spec.select, %59 ], [ %spec.select56, %66 ]
  ret i32 %.3
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_stuffer_wipe(ptr noundef) local_unnamed_addr #0

declare i32 @s2n_realloc(ptr noundef, i32 noundef) local_unnamed_addr #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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, !12, i64 8}
!14 = !{!"s2n_stuffer", !15, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!15 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!16 = !{!14, !7, i64 0}
!17 = !{!14, !12, i64 24}
!18 = !{!14, !12, i64 28}
!19 = !{!14, !12, i64 32}


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