; LLVM IR from aws/s2n-tls :: tests/unit (s2n_psk_offered_test)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.s2n_debug_info = type { ptr, ptr }
%struct.s2n_psk = type { i32, %struct.s2n_blob, %struct.s2n_blob, i32, i32, i64, %struct.s2n_blob, %struct.s2n_early_data_config, i64 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.s2n_early_data_config = type { i32, i8, ptr, %struct.s2n_blob, %struct.s2n_blob }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.6 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [83 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(none)
declare i64 @llvm.expect.i64(i64, i64) #4

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

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

declare ptr @s2n_ensure_memmove_trace(ptr noundef, ptr noundef, i64 noundef) #2

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

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

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

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 %6, 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.7, ptr %56, align 8, !tbaa !11
  %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 !11
  %60 = getelementptr inbounds i8, ptr %59, i64 21
  %61 = call ptr @strrchr(ptr noundef %60, i32 noundef 47) #6
  %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 !11
  %67 = getelementptr inbounds i8, ptr %66, i64 21
  %68 = call ptr @strrchr(ptr noundef %67, i32 noundef 47) #6
  %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 !11
  %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 !13
  %79 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %79, align 4, !tbaa !14
  %80 = call i32 @s2n_calculate_stacktrace()
  br label %81

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

82:                                               ; No predecessors!
  br label %83

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

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  %86 = load i16, ptr %7, align 2, !tbaa !9
  %87 = zext i16 %86 to i32
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %120, label %89

89:                                               ; preds = %85
  br label %90

90:                                               ; preds = %89
  br label %91

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

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

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

112:                                              ; preds = %107, %100
  %113 = phi ptr [ %106, %100 ], [ %111, %107 ]
  %114 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %115 = getelementptr inbounds %struct.s2n_debug_info, ptr %114, i32 0, i32 1
  store ptr %113, ptr %115, align 8, !tbaa !13
  %116 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762089, ptr %116, align 4, !tbaa !14
  %117 = call i32 @s2n_calculate_stacktrace()
  br label %118

118:                                              ; preds = %112
  store i32 -1, ptr %4, align 4
  br label %265

119:                                              ; No predecessors!
  br label %120

120:                                              ; preds = %119, %85
  br label %121

121:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #7
  store i8 1, ptr %8, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #7
  store i16 0, ptr %9, align 2, !tbaa !9
  br label %122

122:                                              ; preds = %143, %121
  %123 = load i16, ptr %9, align 2, !tbaa !9
  %124 = zext i16 %123 to i32
  %125 = load i16, ptr %7, align 2, !tbaa !9
  %126 = zext i16 %125 to i32
  %127 = icmp slt i32 %124, %126
  br i1 %127, label %129, label %128

128:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #7
  br label %146

129:                                              ; preds = %122
  %130 = load i8, ptr %8, align 1, !tbaa !16, !range !18, !noundef !19
  %131 = trunc i8 %130 to i1
  br i1 %131, label %132, label %140

132:                                              ; preds = %129
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  %134 = load i16, ptr %9, align 2, !tbaa !9
  %135 = zext i16 %134 to i64
  %136 = getelementptr inbounds i8, ptr %133, i64 %135
  %137 = load i8, ptr %136, align 1, !tbaa !20
  %138 = zext i8 %137 to i32
  %139 = icmp eq i32 %138, 0
  br label %140

140:                                              ; preds = %132, %129
  %141 = phi i1 [ false, %129 ], [ %139, %132 ]
  %142 = zext i1 %141 to i8
  store i8 %142, ptr %8, align 1, !tbaa !16
  br label %143

143:                                              ; preds = %140
  %144 = load i16, ptr %9, align 2, !tbaa !9
  %145 = add i16 %144, 1
  store i16 %145, ptr %9, align 2, !tbaa !9
  br label %122, !llvm.loop !21

146:                                              ; preds = %128
  br label %147

147:                                              ; preds = %146
  %148 = load i8, ptr %8, align 1, !tbaa !16, !range !18, !noundef !19
  %149 = trunc i8 %148 to i1
  br i1 %149, label %150, label %183

150:                                              ; preds = %147
  br label %151

151:                                              ; preds = %150
  br label %152

152:                                              ; preds = %151
  %153 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %154 = getelementptr inbounds %struct.s2n_debug_info, ptr %153, i32 0, i32 0
  store ptr @.str.9, ptr %154, align 8, !tbaa !11
  %155 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %156 = getelementptr inbounds %struct.s2n_debug_info, ptr %155, i32 0, i32 0
  %157 = load ptr, ptr %156, align 8, !tbaa !11
  %158 = getelementptr inbounds i8, ptr %157, i64 21
  %159 = call ptr @strrchr(ptr noundef %158, i32 noundef 47) #6
  %160 = icmp ne ptr %159, null
  br i1 %160, label %161, label %168

161:                                              ; preds = %152
  %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
  %164 = load ptr, ptr %163, align 8, !tbaa !11
  %165 = getelementptr inbounds i8, ptr %164, i64 21
  %166 = call ptr @strrchr(ptr noundef %165, i32 noundef 47) #6
  %167 = getelementptr inbounds i8, ptr %166, i64 1
  br label %173

168:                                              ; preds = %152
  %169 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %170 = getelementptr inbounds %struct.s2n_debug_info, ptr %169, i32 0, i32 0
  %171 = load ptr, ptr %170, align 8, !tbaa !11
  %172 = getelementptr inbounds i8, ptr %171, i64 21
  br label %173

173:                                              ; preds = %168, %161
  %174 = phi ptr [ %167, %161 ], [ %172, %168 ]
  %175 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %176 = getelementptr inbounds %struct.s2n_debug_info, ptr %175, i32 0, i32 1
  store ptr %174, ptr %176, align 8, !tbaa !13
  %177 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762089, ptr %177, align 4, !tbaa !14
  %178 = call i32 @s2n_calculate_stacktrace()
  br label %179

179:                                              ; preds = %173
  br label %180

180:                                              ; preds = %179
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %264

181:                                              ; No predecessors!
  br label %182

182:                                              ; preds = %181
  br label %183

183:                                              ; preds = %182, %147
  br label %184

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184
  br label %186

186:                                              ; preds = %185
  %187 = load ptr, ptr %5, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.s2n_psk, ptr %187, i32 0, i32 2
  %189 = load i16, ptr %7, align 2, !tbaa !9
  %190 = zext i16 %189 to i32
  %191 = call i32 @s2n_realloc(ptr noundef %188, i32 noundef %190)
  %192 = icmp sgt i32 %191, -1
  br i1 %192, label %194, label %193

193:                                              ; preds = %186
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %264

194:                                              ; preds = %186
  br label %195

195:                                              ; preds = %194
  br label %196

196:                                              ; preds = %195
  br label %197

197:                                              ; preds = %196
  call void @llvm.lifetime.start.p0(i64 2, ptr %11) #7
  %198 = load i16, ptr %7, align 2, !tbaa !9
  store i16 %198, ptr %11, align 2, !tbaa !9
  %199 = load i16, ptr %11, align 2, !tbaa !9
  %200 = icmp ne i16 %199, 0
  %201 = xor i1 %200, true
  %202 = xor i1 %201, true
  %203 = zext i1 %202 to i32
  %204 = sext i32 %203 to i64
  %205 = call i64 @llvm.expect.i64(i64 %204, i64 1)
  %206 = icmp ne i64 %205, 0
  br i1 %206, label %207, label %258

207:                                              ; preds = %197
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %208 = load ptr, ptr %5, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.s2n_psk, ptr %208, i32 0, i32 2
  %210 = getelementptr inbounds %struct.s2n_blob, ptr %209, i32 0, i32 0
  %211 = load ptr, ptr %210, align 8, !tbaa !23
  %212 = load ptr, ptr %6, align 8, !tbaa !5
  %213 = load i16, ptr %11, align 2, !tbaa !9
  %214 = zext i16 %213 to i64
  %215 = call ptr @s2n_ensure_memmove_trace(ptr noundef %211, ptr noundef %212, i64 noundef %214)
  store ptr %215, ptr %12, align 8, !tbaa !5
  br label %216

216:                                              ; preds = %207
  %217 = load ptr, ptr %12, align 8, !tbaa !5
  %218 = icmp ne ptr %217, null
  br i1 %218, label %252, label %219

219:                                              ; preds = %216
  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.10, ptr %223, align 8, !tbaa !11
  %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 !11
  %227 = getelementptr inbounds i8, ptr %226, i64 21
  %228 = call ptr @strrchr(ptr noundef %227, i32 noundef 47) #6
  %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 !11
  %234 = getelementptr inbounds i8, ptr %233, i64 21
  %235 = call ptr @strrchr(ptr noundef %234, i32 noundef 47) #6
  %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 !11
  %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 !13
  %246 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %246, align 4, !tbaa !14
  %247 = call i32 @s2n_calculate_stacktrace()
  br label %248

248:                                              ; preds = %242
  br label %249

249:                                              ; preds = %248
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %255

250:                                              ; No predecessors!
  br label %251

251:                                              ; preds = %250
  br label %252

252:                                              ; preds = %251, %216
  br label %253

253:                                              ; preds = %252
  br label %254

254:                                              ; preds = %253
  store i32 0, ptr %10, align 4
  br label %255

255:                                              ; preds = %254, %249
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %256 = load i32, ptr %10, align 4
  switch i32 %256, label %259 [
    i32 0, label %257
  ]

257:                                              ; preds = %255
  br label %258

258:                                              ; preds = %257, %197
  store i32 0, ptr %10, align 4
  br label %259

259:                                              ; preds = %258, %255
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #7
  %260 = load i32, ptr %10, align 4
  switch i32 %260, label %264 [
    i32 0, label %261
  ]

261:                                              ; preds = %259
  br label %262

262:                                              ; preds = %261
  br label %263

263:                                              ; preds = %262
  store i32 0, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %264

264:                                              ; preds = %263, %259, %193, %180
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #7
  br label %265

265:                                              ; preds = %264, %118, %81, %45
  %266 = load i32, ptr %4, align 4
  ret i32 %266
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #5 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"_Bool", !7, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!24, !6, i64 32}
!24 = !{!"s2n_psk", !15, i64 0, !25, i64 8, !25, i64 32, !15, i64 56, !15, i64 60, !26, i64 64, !25, i64 72, !27, i64 96, !26, i64 160}
!25 = !{!"s2n_blob", !6, i64 0, !15, i64 8, !15, i64 12, !15, i64 16}
!26 = !{!"long", !7, i64 0}
!27 = !{!"s2n_early_data_config", !15, i64 0, !7, i64 4, !6, i64 8, !25, i64 16, !25, i64 40}


; 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.6 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [83 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

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

declare ptr @s2n_ensure_memmove_trace(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_psk_set_secret(ptr noundef %0, ptr noundef %1, i16 noundef zeroext %2) local_unnamed_addr #3 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %4, label %12

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

12:                                               ; preds = %3
  %.not34 = icmp eq ptr %1, null
  br i1 %.not34, label %13, label %21

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

21:                                               ; preds = %12
  %22 = zext i16 %2 to i32
  %.not36 = icmp eq i16 %2, 0
  br i1 %.not36, label %23, label %.preheader.preheader

.preheader.preheader:                             ; preds = %21
  %wide.trip.count = zext i16 %2 to i64
  br label %.preheader

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

31:                                               ; preds = %32
  br i1 %35, label %36, label %.thread46

.preheader:                                       ; preds = %.preheader.backedge, %.preheader.preheader
  %indvars.iv = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.be, %.preheader.backedge ]
  %.02143 = phi i1 [ true, %.preheader.preheader ], [ %.02143.be, %.preheader.backedge ]
  br i1 %.02143, label %32, label %.thread

32:                                               ; preds = %.preheader
  %33 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv
  %34 = load i8, ptr %33, align 1, !tbaa !13
  %35 = icmp eq i8 %34, 0
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %31, label %.preheader.backedge

.preheader.backedge:                              ; preds = %32, %.thread
  %indvars.iv.be = phi i64 [ %indvars.iv.next, %32 ], [ %indvars.iv.next44, %.thread ]
  %.02143.be = phi i1 [ %35, %32 ], [ false, %.thread ]
  br label %.preheader, !llvm.loop !14

.thread:                                          ; preds = %.preheader
  %indvars.iv.next44 = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not45 = icmp eq i64 %indvars.iv.next44, %wide.trip.count
  br i1 %exitcond.not45, label %.thread46, label %.preheader.backedge

36:                                               ; preds = %31
  %37 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.9, ptr %37, align 8, !tbaa !5
  %38 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.9, i64 21), i32 noundef 47) #4
  %.not40 = icmp eq ptr %38, null
  %39 = getelementptr inbounds i8, ptr %38, i64 1
  %40 = select i1 %.not40, ptr getelementptr inbounds (i8, ptr @.str.9, i64 21), ptr %39
  %41 = getelementptr inbounds i8, ptr %37, i64 8
  store ptr %40, ptr %41, align 8, !tbaa !10
  %42 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 469762089, ptr %42, align 4, !tbaa !11
  %43 = tail call i32 @s2n_calculate_stacktrace() #5
  br label %59

.thread46:                                        ; preds = %.thread, %31
  %44 = getelementptr inbounds i8, ptr %0, i64 32
  %45 = tail call i32 @s2n_realloc(ptr noundef nonnull %44, i32 noundef %22) #5
  %46 = icmp sgt i32 %45, -1
  br i1 %46, label %47, label %59

47:                                               ; preds = %.thread46
  %48 = load ptr, ptr %44, align 8, !tbaa !16
  %49 = tail call ptr @s2n_ensure_memmove_trace(ptr noundef %48, ptr noundef nonnull %1, i64 noundef %wide.trip.count) #5
  %.not38.not.not = icmp eq ptr %49, null
  br i1 %.not38.not.not, label %50, label %58

50:                                               ; preds = %47
  %51 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.10, ptr %51, align 8, !tbaa !5
  %52 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.10, i64 21), i32 noundef 47) #4
  %.not39 = icmp eq ptr %52, null
  %53 = getelementptr inbounds i8, ptr %52, i64 1
  %54 = select i1 %.not39, ptr getelementptr inbounds (i8, ptr @.str.10, i64 21), ptr %53
  %55 = getelementptr inbounds i8, ptr %51, i64 8
  store ptr %54, ptr %55, align 8, !tbaa !10
  %56 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %56, align 4, !tbaa !11
  %57 = tail call i32 @s2n_calculate_stacktrace() #5
  br label %58

58:                                               ; preds = %47, %50
  %spec.select41 = sext i1 %.not38.not.not to i32
  br label %59

59:                                               ; preds = %58, %36, %.thread46, %23, %13, %4
  %.4 = phi i32 [ -1, %23 ], [ -1, %13 ], [ -1, %4 ], [ -1, %36 ], [ -1, %.thread46 ], [ %spec.select41, %58 ]
  ret i32 %.4
}

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, !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 = !{!8, !8, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !7, i64 32}
!17 = !{!"s2n_psk", !12, i64 0, !18, i64 8, !18, i64 32, !12, i64 56, !12, i64 60, !19, i64 64, !18, i64 72, !20, i64 96, !19, i64 160}
!18 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!19 = !{!"long", !8, i64 0}
!20 = !{!"s2n_early_data_config", !12, i64 0, !8, i64 4, !7, i64 8, !18, i64 16, !18, i64 40}


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