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

; 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_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.3 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [85 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: nounwind uwtable
define dso_local i32 @s2n_tls13_aead_aad_init(i16 noundef zeroext %0, i8 noundef zeroext %1, ptr noundef %2) #4 {
  %4 = alloca %struct.s2n_result, align 4
  %5 = alloca i16, align 2
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i16, align 2
  store i16 %0, ptr %5, align 2, !tbaa !5
  store i8 %1, ptr %6, align 1, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !10
  br label %12

12:                                               ; preds = %3
  %13 = load i8, ptr %6, align 1, !tbaa !9
  %14 = zext i8 %13 to i32
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %48, label %16

16:                                               ; preds = %12
  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 !12
  %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 !12
  %24 = getelementptr inbounds i8, ptr %23, i64 21
  %25 = call ptr @strrchr(ptr noundef %24, i32 noundef 47) #5
  %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 !12
  %31 = getelementptr inbounds i8, ptr %30, i64 21
  %32 = call ptr @strrchr(ptr noundef %31, i32 noundef 47) #5
  %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 !12
  %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 !14
  %43 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %43, align 4, !tbaa !15
  %44 = call i32 @s2n_calculate_stacktrace()
  br label %45

45:                                               ; preds = %39
  %46 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %46, align 4, !tbaa !17
  br label %259

47:                                               ; No predecessors!
  br label %48

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

49:                                               ; preds = %48
  br label %50

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

53:                                               ; preds = %50
  br label %54

54:                                               ; preds = %53
  br label %55

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

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

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

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

82:                                               ; preds = %76
  %83 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %83, align 4, !tbaa !17
  br label %259

84:                                               ; No predecessors!
  br label %85

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

86:                                               ; preds = %85
  br label %87

87:                                               ; preds = %86
  %88 = load ptr, ptr %7, align 8, !tbaa !10
  %89 = getelementptr inbounds %struct.s2n_blob, ptr %88, i32 0, i32 1
  %90 = load i32, ptr %89, align 8, !tbaa !19
  %91 = icmp uge i32 %90, 5
  br i1 %91, label %124, label %92

92:                                               ; preds = %87
  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.5, ptr %96, align 8, !tbaa !12
  %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 !12
  %100 = getelementptr inbounds i8, ptr %99, i64 21
  %101 = call ptr @strrchr(ptr noundef %100, i32 noundef 47) #5
  %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 !12
  %107 = getelementptr inbounds i8, ptr %106, i64 21
  %108 = call ptr @strrchr(ptr noundef %107, i32 noundef 47) #5
  %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 !12
  %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 !14
  %119 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %119, align 4, !tbaa !15
  %120 = call i32 @s2n_calculate_stacktrace()
  br label %121

121:                                              ; preds = %115
  %122 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %122, align 4, !tbaa !17
  br label %259

123:                                              ; No predecessors!
  br label %124

124:                                              ; preds = %123, %87
  br label %125

125:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %126 = load ptr, ptr %7, align 8, !tbaa !10
  %127 = getelementptr inbounds %struct.s2n_blob, ptr %126, i32 0, i32 0
  %128 = load ptr, ptr %127, align 8, !tbaa !21
  store ptr %128, ptr %8, align 8, !tbaa !10
  br label %129

129:                                              ; preds = %125
  %130 = load ptr, ptr %8, align 8, !tbaa !10
  %131 = icmp ne ptr %130, null
  br i1 %131, label %134, label %132

132:                                              ; preds = %129
  %133 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %133, align 4, !tbaa !17
  store i32 1, ptr %9, align 4
  br label %258

134:                                              ; preds = %129
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !22
  %137 = load ptr, ptr %8, align 8, !tbaa !10
  %138 = load i64, ptr %10, align 8, !tbaa !22
  %139 = add i64 %138, 1
  store i64 %139, ptr %10, align 8, !tbaa !22
  %140 = getelementptr inbounds i8, ptr %137, i64 %138
  store i8 23, ptr %140, align 1, !tbaa !9
  %141 = load ptr, ptr %8, align 8, !tbaa !10
  %142 = load i64, ptr %10, align 8, !tbaa !22
  %143 = add i64 %142, 1
  store i64 %143, ptr %10, align 8, !tbaa !22
  %144 = getelementptr inbounds i8, ptr %141, i64 %142
  store i8 3, ptr %144, align 1, !tbaa !9
  %145 = load ptr, ptr %8, align 8, !tbaa !10
  %146 = load i64, ptr %10, align 8, !tbaa !22
  %147 = add i64 %146, 1
  store i64 %147, ptr %10, align 8, !tbaa !22
  %148 = getelementptr inbounds i8, ptr %145, i64 %146
  store i8 3, ptr %148, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %11) #6
  %149 = load i16, ptr %5, align 2, !tbaa !5
  %150 = zext i16 %149 to i32
  %151 = load i8, ptr %6, align 1, !tbaa !9
  %152 = zext i8 %151 to i32
  %153 = add nsw i32 %150, %152
  %154 = trunc i32 %153 to i16
  store i16 %154, ptr %11, align 2, !tbaa !5
  br label %155

155:                                              ; preds = %136
  %156 = load i16, ptr %11, align 2, !tbaa !5
  %157 = zext i16 %156 to i32
  %158 = icmp sle i32 %157, 16640
  br i1 %158, label %193, label %159

159:                                              ; preds = %155
  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 !12
  %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 !12
  %167 = getelementptr inbounds i8, ptr %166, i64 21
  %168 = call ptr @strrchr(ptr noundef %167, i32 noundef 47) #5
  %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 !12
  %174 = getelementptr inbounds i8, ptr %173, i64 21
  %175 = call ptr @strrchr(ptr noundef %174, i32 noundef 47) #5
  %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 !12
  %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 !14
  %186 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544365, ptr %186, align 4, !tbaa !15
  %187 = call i32 @s2n_calculate_stacktrace()
  br label %188

188:                                              ; preds = %182
  br label %189

189:                                              ; preds = %188
  %190 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %190, align 4, !tbaa !17
  store i32 1, ptr %9, align 4
  br label %257

191:                                              ; No predecessors!
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192, %155
  br label %194

194:                                              ; preds = %193
  br label %195

195:                                              ; preds = %194
  %196 = load i16, ptr %11, align 2, !tbaa !5
  %197 = zext i16 %196 to i32
  %198 = ashr i32 %197, 8
  %199 = trunc i32 %198 to i8
  %200 = load ptr, ptr %8, align 8, !tbaa !10
  %201 = load i64, ptr %10, align 8, !tbaa !22
  %202 = add i64 %201, 1
  store i64 %202, ptr %10, align 8, !tbaa !22
  %203 = getelementptr inbounds i8, ptr %200, i64 %201
  store i8 %199, ptr %203, align 1, !tbaa !9
  %204 = load i16, ptr %11, align 2, !tbaa !5
  %205 = zext i16 %204 to i32
  %206 = and i32 %205, 255
  %207 = trunc i32 %206 to i8
  %208 = load ptr, ptr %8, align 8, !tbaa !10
  %209 = load i64, ptr %10, align 8, !tbaa !22
  %210 = add i64 %209, 1
  store i64 %210, ptr %10, align 8, !tbaa !22
  %211 = getelementptr inbounds i8, ptr %208, i64 %209
  store i8 %207, ptr %211, align 1, !tbaa !9
  br label %212

212:                                              ; preds = %195
  %213 = load i64, ptr %10, align 8, !tbaa !22
  %214 = load ptr, ptr %7, align 8, !tbaa !10
  %215 = getelementptr inbounds %struct.s2n_blob, ptr %214, i32 0, i32 1
  %216 = load i32, ptr %215, align 8, !tbaa !19
  %217 = zext i32 %216 to i64
  %218 = icmp ule i64 %213, %217
  br i1 %218, label %253, label %219

219:                                              ; preds = %212
  br label %220

220:                                              ; preds = %219
  br label %221

221:                                              ; preds = %220
  %222 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %223 = getelementptr inbounds %struct.s2n_debug_info, ptr %222, i32 0, i32 0
  store ptr @.str.7, ptr %223, align 8, !tbaa !12
  %224 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %225 = getelementptr inbounds %struct.s2n_debug_info, ptr %224, i32 0, i32 0
  %226 = load ptr, ptr %225, align 8, !tbaa !12
  %227 = getelementptr inbounds i8, ptr %226, i64 21
  %228 = call ptr @strrchr(ptr noundef %227, i32 noundef 47) #5
  %229 = icmp ne ptr %228, null
  br i1 %229, label %230, label %237

230:                                              ; preds = %221
  %231 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %232 = getelementptr inbounds %struct.s2n_debug_info, ptr %231, i32 0, i32 0
  %233 = load ptr, ptr %232, align 8, !tbaa !12
  %234 = getelementptr inbounds i8, ptr %233, i64 21
  %235 = call ptr @strrchr(ptr noundef %234, i32 noundef 47) #5
  %236 = getelementptr inbounds i8, ptr %235, i64 1
  br label %242

237:                                              ; preds = %221
  %238 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %239 = getelementptr inbounds %struct.s2n_debug_info, ptr %238, i32 0, i32 0
  %240 = load ptr, ptr %239, align 8, !tbaa !12
  %241 = getelementptr inbounds i8, ptr %240, i64 21
  br label %242

242:                                              ; preds = %237, %230
  %243 = phi ptr [ %236, %230 ], [ %241, %237 ]
  %244 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %245 = getelementptr inbounds %struct.s2n_debug_info, ptr %244, i32 0, i32 1
  store ptr %243, ptr %245, align 8, !tbaa !14
  %246 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %246, align 4, !tbaa !15
  %247 = call i32 @s2n_calculate_stacktrace()
  br label %248

248:                                              ; preds = %242
  br label %249

249:                                              ; preds = %248
  %250 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %250, align 4, !tbaa !17
  store i32 1, ptr %9, align 4
  br label %257

251:                                              ; No predecessors!
  br label %252

252:                                              ; preds = %251
  br label %253

253:                                              ; preds = %252, %212
  br label %254

254:                                              ; preds = %253
  br label %255

255:                                              ; preds = %254
  %256 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 0, ptr %256, align 4, !tbaa !17
  store i32 1, ptr %9, align 4
  br label %257

257:                                              ; preds = %255, %249, %189
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %258

258:                                              ; preds = %257, %132
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %259

259:                                              ; preds = %258, %121, %82, %45
  %260 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  %261 = load i32, ptr %260, align 4
  ret i32 %261
}

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

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

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


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

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_tls13_aead_aad_init(i16 noundef zeroext %0, i8 noundef zeroext %1, ptr noundef readonly %2) local_unnamed_addr #3 {
  %4 = zext i8 %1 to i16
  %.not = icmp eq i8 %1, 0
  br i1 %.not, label %.sink.split, label %5

5:                                                ; preds = %3
  %.not30 = icmp eq ptr %2, null
  br i1 %.not30, label %.sink.split, label %6

6:                                                ; preds = %5
  %7 = getelementptr inbounds i8, ptr %2, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp ugt i32 %8, 4
  br i1 %9, label %10, label %.sink.split

10:                                               ; preds = %6
  %11 = load ptr, ptr %2, align 8, !tbaa !11
  %.not33 = icmp eq ptr %11, null
  br i1 %.not33, label %32, label %12

12:                                               ; preds = %10
  store i8 23, ptr %11, align 1, !tbaa !12
  %13 = getelementptr inbounds i8, ptr %11, i64 1
  store i8 3, ptr %13, align 1, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %11, i64 2
  store i8 3, ptr %14, align 1, !tbaa !12
  %15 = add i16 %4, %0
  %16 = icmp ult i16 %15, 16641
  br i1 %16, label %17, label %.sink.split

17:                                               ; preds = %12
  %18 = lshr i16 %15, 8
  %19 = trunc nuw i16 %18 to i8
  %20 = getelementptr inbounds i8, ptr %11, i64 3
  store i8 %19, ptr %20, align 1, !tbaa !12
  %21 = trunc i16 %15 to i8
  %22 = getelementptr inbounds i8, ptr %11, i64 4
  store i8 %21, ptr %22, align 1, !tbaa !12
  %23 = load i32, ptr %7, align 8, !tbaa !5
  %24 = icmp ugt i32 %23, 4
  br i1 %24, label %32, label %.sink.split

.sink.split:                                      ; preds = %17, %12, %6, %5, %3
  %.str.7.sink = phi ptr [ @.str.3, %3 ], [ @.str.4, %5 ], [ @.str.5, %6 ], [ @.str.6, %12 ], [ @.str.7, %17 ]
  %.sink44 = phi ptr [ getelementptr inbounds (i8, ptr @.str.3, i64 21), %3 ], [ getelementptr inbounds (i8, ptr @.str.4, i64 21), %5 ], [ getelementptr inbounds (i8, ptr @.str.5, i64 21), %6 ], [ getelementptr inbounds (i8, ptr @.str.6, i64 21), %12 ], [ getelementptr inbounds (i8, ptr @.str.7, i64 21), %17 ]
  %.sink = phi i32 [ 402653194, %3 ], [ 402653193, %5 ], [ 402653194, %6 ], [ 335544365, %12 ], [ 402653194, %17 ]
  %25 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr %.str.7.sink, ptr %25, align 8, !tbaa !13
  %26 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) %.sink44, i32 noundef 47) #4
  %.not35 = icmp eq ptr %26, null
  %27 = getelementptr inbounds i8, ptr %26, i64 1
  %28 = select i1 %.not35, ptr %.sink44, ptr %27
  %29 = getelementptr inbounds i8, ptr %25, i64 8
  store ptr %28, ptr %29, align 8, !tbaa !15
  %30 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 %.sink, ptr %30, align 4, !tbaa !16
  %31 = tail call i32 @s2n_calculate_stacktrace() #5
  br label %32

32:                                               ; preds = %.sink.split, %10, %17
  %.sroa.0.2 = phi i32 [ -1, %10 ], [ 0, %17 ], [ -1, %.sink.split ]
  ret i32 %.sroa.0.2
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind willreturn memory(read) }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 8}
!6 = !{!"s2n_blob", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!8, !8, i64 0}
!13 = !{!14, !7, i64 0}
!14 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!15 = !{!14, !7, i64 8}
!16 = !{!10, !10, i64 0}


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