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

; 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_blob = type { ptr, i32, i32, i8 }
%struct.s2n_stuffer = type { %struct.s2n_blob, i32, 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.5 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [7 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_hkdf_expand_label(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #4 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca [514 x i8], align 16
  %15 = alloca %struct.s2n_blob, align 8
  %16 = alloca %struct.s2n_stuffer, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %6
  %19 = load ptr, ptr %11, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %52, label %21

21:                                               ; preds = %18
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  %24 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %25 = getelementptr inbounds %struct.s2n_debug_info, ptr %24, i32 0, i32 0
  store ptr @.str.5, ptr %25, align 8, !tbaa !11
  %26 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %27 = getelementptr inbounds %struct.s2n_debug_info, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = getelementptr inbounds i8, ptr %28, i64 21
  %30 = call ptr @strrchr(ptr noundef %29, i32 noundef 47) #6
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %39

32:                                               ; preds = %23
  %33 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %34 = getelementptr inbounds %struct.s2n_debug_info, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  %36 = getelementptr inbounds i8, ptr %35, i64 21
  %37 = call ptr @strrchr(ptr noundef %36, i32 noundef 47) #6
  %38 = getelementptr inbounds i8, ptr %37, i64 1
  br label %44

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

44:                                               ; preds = %39, %32
  %45 = phi ptr [ %38, %32 ], [ %43, %39 ]
  %46 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %47 = getelementptr inbounds %struct.s2n_debug_info, ptr %46, i32 0, i32 1
  store ptr %45, ptr %47, align 8, !tbaa !13
  %48 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %48, align 4, !tbaa !9
  %49 = call i32 @s2n_calculate_stacktrace()
  br label %50

50:                                               ; preds = %44
  store i32 -1, ptr %7, align 4
  br label %259

51:                                               ; No predecessors!
  br label %52

52:                                               ; preds = %51, %18
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = icmp ne ptr %55, null
  br i1 %56, label %88, label %57

57:                                               ; preds = %54
  br label %58

58:                                               ; preds = %57
  br label %59

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

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

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

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

86:                                               ; preds = %80
  store i32 -1, ptr %7, align 4
  br label %259

87:                                               ; No predecessors!
  br label %88

88:                                               ; preds = %87, %54
  br label %89

89:                                               ; preds = %88
  br label %90

90:                                               ; preds = %89
  %91 = load ptr, ptr %13, align 8, !tbaa !5
  %92 = icmp ne ptr %91, null
  br i1 %92, label %124, label %93

93:                                               ; preds = %90
  br label %94

94:                                               ; preds = %93
  br label %95

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

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

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

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

122:                                              ; preds = %116
  store i32 -1, ptr %7, align 4
  br label %259

123:                                              ; No predecessors!
  br label %124

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

125:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 514, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #7
  call void @llvm.memset.p0.i64(ptr align 8 %15, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 40, ptr %16) #7
  call void @llvm.memset.p0.i64(ptr align 8 %16, i8 0, i64 40, i1 false)
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %11, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.s2n_blob, ptr %127, i32 0, i32 1
  %129 = load i32, ptr %128, align 8, !tbaa !14
  %130 = icmp ule i32 %129, 249
  br i1 %130, label %164, label %131

131:                                              ; preds = %126
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  %134 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %135 = getelementptr inbounds %struct.s2n_debug_info, ptr %134, i32 0, i32 0
  store ptr @.str.8, ptr %135, align 8, !tbaa !11
  %136 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %137 = getelementptr inbounds %struct.s2n_debug_info, ptr %136, i32 0, i32 0
  %138 = load ptr, ptr %137, align 8, !tbaa !11
  %139 = getelementptr inbounds i8, ptr %138, i64 21
  %140 = call ptr @strrchr(ptr noundef %139, i32 noundef 47) #6
  %141 = icmp ne ptr %140, null
  br i1 %141, label %142, label %149

142:                                              ; preds = %133
  %143 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %144 = getelementptr inbounds %struct.s2n_debug_info, ptr %143, i32 0, i32 0
  %145 = load ptr, ptr %144, align 8, !tbaa !11
  %146 = getelementptr inbounds i8, ptr %145, i64 21
  %147 = call ptr @strrchr(ptr noundef %146, i32 noundef 47) #6
  %148 = getelementptr inbounds i8, ptr %147, i64 1
  br label %154

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

154:                                              ; preds = %149, %142
  %155 = phi ptr [ %148, %142 ], [ %153, %149 ]
  %156 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %157 = getelementptr inbounds %struct.s2n_debug_info, ptr %156, i32 0, i32 1
  store ptr %155, ptr %157, align 8, !tbaa !13
  %158 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %158, align 4, !tbaa !9
  %159 = call i32 @s2n_calculate_stacktrace()
  br label %160

160:                                              ; preds = %154
  br label %161

161:                                              ; preds = %160
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %258

162:                                              ; No predecessors!
  br label %163

163:                                              ; preds = %162
  br label %164

164:                                              ; preds = %163, %126
  br label %165

165:                                              ; preds = %164
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166
  %168 = getelementptr inbounds [514 x i8], ptr %14, i64 0, i64 0
  %169 = call i32 @s2n_blob_init(ptr noundef %15, ptr noundef %168, i32 noundef 514)
  %170 = icmp sgt i32 %169, -1
  br i1 %170, label %172, label %171

171:                                              ; preds = %167
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %258

172:                                              ; preds = %167
  br label %173

173:                                              ; preds = %172
  br label %174

174:                                              ; preds = %173
  br label %175

175:                                              ; preds = %174
  %176 = call i32 @s2n_stuffer_init(ptr noundef %16, ptr noundef %15)
  %177 = icmp sgt i32 %176, -1
  br i1 %177, label %179, label %178

178:                                              ; preds = %175
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %258

179:                                              ; preds = %175
  br label %180

180:                                              ; preds = %179
  br label %181

181:                                              ; preds = %180
  br label %182

182:                                              ; preds = %181
  %183 = load ptr, ptr %13, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.s2n_blob, ptr %183, i32 0, i32 1
  %185 = load i32, ptr %184, align 8, !tbaa !14
  %186 = trunc i32 %185 to i16
  %187 = call i32 @s2n_stuffer_write_uint16(ptr noundef %16, i16 noundef zeroext %186)
  %188 = icmp sgt i32 %187, -1
  br i1 %188, label %190, label %189

189:                                              ; preds = %182
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %258

190:                                              ; preds = %182
  br label %191

191:                                              ; preds = %190
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192
  %194 = load ptr, ptr %11, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.s2n_blob, ptr %194, i32 0, i32 1
  %196 = load i32, ptr %195, align 8, !tbaa !14
  %197 = zext i32 %196 to i64
  %198 = add i64 %197, 7
  %199 = sub i64 %198, 1
  %200 = trunc i64 %199 to i8
  %201 = call i32 @s2n_stuffer_write_uint8(ptr noundef %16, i8 noundef zeroext %200)
  %202 = icmp sgt i32 %201, -1
  br i1 %202, label %204, label %203

203:                                              ; preds = %193
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %258

204:                                              ; preds = %193
  br label %205

205:                                              ; preds = %204
  br label %206

206:                                              ; preds = %205
  br label %207

207:                                              ; preds = %206
  %208 = call i32 @s2n_stuffer_write_bytes(ptr noundef %16, ptr noundef @.str.9, i32 noundef 6)
  %209 = icmp sgt i32 %208, -1
  br i1 %209, label %211, label %210

210:                                              ; preds = %207
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %258

211:                                              ; preds = %207
  br label %212

212:                                              ; preds = %211
  br label %213

213:                                              ; preds = %212
  br label %214

214:                                              ; preds = %213
  %215 = load ptr, ptr %11, align 8, !tbaa !5
  %216 = call i32 @s2n_stuffer_write(ptr noundef %16, ptr noundef %215)
  %217 = icmp sgt i32 %216, -1
  br i1 %217, label %219, label %218

218:                                              ; preds = %214
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %258

219:                                              ; preds = %214
  br label %220

220:                                              ; preds = %219
  br label %221

221:                                              ; preds = %220
  br label %222

222:                                              ; preds = %221
  %223 = load ptr, ptr %12, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.s2n_blob, ptr %223, i32 0, i32 1
  %225 = load i32, ptr %224, align 8, !tbaa !14
  %226 = trunc i32 %225 to i8
  %227 = call i32 @s2n_stuffer_write_uint8(ptr noundef %16, i8 noundef zeroext %226)
  %228 = icmp sgt i32 %227, -1
  br i1 %228, label %230, label %229

229:                                              ; preds = %222
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %258

230:                                              ; preds = %222
  br label %231

231:                                              ; preds = %230
  br label %232

232:                                              ; preds = %231
  br label %233

233:                                              ; preds = %232
  %234 = load ptr, ptr %12, align 8, !tbaa !5
  %235 = call i32 @s2n_stuffer_write(ptr noundef %16, ptr noundef %234)
  %236 = icmp sgt i32 %235, -1
  br i1 %236, label %238, label %237

237:                                              ; preds = %233
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %258

238:                                              ; preds = %233
  br label %239

239:                                              ; preds = %238
  br label %240

240:                                              ; preds = %239
  %241 = getelementptr inbounds %struct.s2n_stuffer, ptr %16, i32 0, i32 2
  %242 = load i32, ptr %241, align 4, !tbaa !16
  %243 = getelementptr inbounds %struct.s2n_stuffer, ptr %16, i32 0, i32 1
  %244 = load i32, ptr %243, align 8, !tbaa !18
  %245 = sub i32 %242, %244
  %246 = getelementptr inbounds %struct.s2n_blob, ptr %15, i32 0, i32 1
  store i32 %245, ptr %246, align 8, !tbaa !14
  br label %247

247:                                              ; preds = %240
  %248 = load ptr, ptr %8, align 8, !tbaa !5
  %249 = load i32, ptr %9, align 4, !tbaa !9
  %250 = load ptr, ptr %10, align 8, !tbaa !5
  %251 = load ptr, ptr %13, align 8, !tbaa !5
  %252 = call i32 @s2n_hkdf_expand(ptr noundef %248, i32 noundef %249, ptr noundef %250, ptr noundef %15, ptr noundef %251)
  %253 = icmp sgt i32 %252, -1
  br i1 %253, label %255, label %254

254:                                              ; preds = %247
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %258

255:                                              ; preds = %247
  br label %256

256:                                              ; preds = %255
  br label %257

257:                                              ; preds = %256
  store i32 0, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %258

258:                                              ; preds = %257, %254, %237, %229, %218, %210, %203, %189, %178, %171, %161
  call void @llvm.lifetime.end.p0(i64 40, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 514, ptr %14) #7
  br label %259

259:                                              ; preds = %258, %122, %86, %50
  %260 = load i32, ptr %7, align 4
  ret i32 %260
}

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

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

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

declare i32 @s2n_stuffer_write_uint16(ptr noundef, i16 noundef zeroext) #2

declare i32 @s2n_stuffer_write_uint8(ptr noundef, i8 noundef zeroext) #2

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

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

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

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 = { 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, !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, !6, i64 0}
!12 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!15, !10, i64 8}
!15 = !{!"s2n_blob", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!16 = !{!17, !10, i64 28}
!17 = !{!"s2n_stuffer", !15, i64 0, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 36, !10, i64 36}
!18 = !{!17, !10, i64 24}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.s2n_debug_info = type { ptr, ptr }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.s2n_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }

@_s2n_debug_info = external thread_local local_unnamed_addr global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local local_unnamed_addr global i32, align 4
@.str.5 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_hkdf_expand_label(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #4 {
  %7 = alloca [514 x i8], align 16
  %8 = alloca %struct.s2n_blob, align 8
  %9 = alloca %struct.s2n_stuffer, align 8
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %10, label %18

10:                                               ; preds = %6
  %11 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.5, ptr %11, align 8, !tbaa !5
  %12 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.5, i64 21), i32 noundef 47) #6
  %.not20 = icmp eq ptr %12, null
  %13 = getelementptr inbounds i8, ptr %12, i64 1
  %14 = select i1 %.not20, ptr getelementptr inbounds (i8, ptr @.str.5, 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 402653193, ptr %16, align 4, !tbaa !11
  %17 = tail call i32 @s2n_calculate_stacktrace() #7
  br label %90

18:                                               ; preds = %6
  %.not21 = icmp eq ptr %4, null
  br i1 %.not21, label %19, label %27

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

27:                                               ; preds = %18
  %.not23 = icmp eq ptr %5, null
  br i1 %.not23, label %28, label %36

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

36:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 514, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %9) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %9, i8 0, i64 40, i1 false)
  %37 = getelementptr inbounds i8, ptr %3, i64 8
  %38 = load i32, ptr %37, align 8, !tbaa !13
  %39 = icmp ult i32 %38, 250
  br i1 %39, label %48, label %40

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

48:                                               ; preds = %36
  %49 = call i32 @s2n_blob_init(ptr noundef nonnull %8, ptr noundef nonnull %7, i32 noundef 514) #7
  %50 = icmp sgt i32 %49, -1
  br i1 %50, label %51, label %89

51:                                               ; preds = %48
  %52 = call i32 @s2n_stuffer_init(ptr noundef nonnull %9, ptr noundef nonnull %8) #7
  %53 = icmp sgt i32 %52, -1
  br i1 %53, label %54, label %89

54:                                               ; preds = %51
  %55 = getelementptr inbounds i8, ptr %5, i64 8
  %56 = load i32, ptr %55, align 8, !tbaa !13
  %57 = trunc i32 %56 to i16
  %58 = call i32 @s2n_stuffer_write_uint16(ptr noundef nonnull %9, i16 noundef zeroext %57) #7
  %59 = icmp sgt i32 %58, -1
  br i1 %59, label %60, label %89

60:                                               ; preds = %54
  %61 = load i32, ptr %37, align 8, !tbaa !13
  %62 = trunc i32 %61 to i8
  %63 = add i8 %62, 6
  %64 = call i32 @s2n_stuffer_write_uint8(ptr noundef nonnull %9, i8 noundef zeroext %63) #7
  %65 = icmp sgt i32 %64, -1
  br i1 %65, label %66, label %89

66:                                               ; preds = %60
  %67 = call i32 @s2n_stuffer_write_bytes(ptr noundef nonnull %9, ptr noundef nonnull @.str.9, i32 noundef 6) #7
  %68 = icmp sgt i32 %67, -1
  br i1 %68, label %69, label %89

69:                                               ; preds = %66
  %70 = call i32 @s2n_stuffer_write(ptr noundef nonnull %9, ptr noundef nonnull %3) #7
  %71 = icmp sgt i32 %70, -1
  br i1 %71, label %72, label %89

72:                                               ; preds = %69
  %73 = getelementptr inbounds i8, ptr %4, i64 8
  %74 = load i32, ptr %73, align 8, !tbaa !13
  %75 = trunc i32 %74 to i8
  %76 = call i32 @s2n_stuffer_write_uint8(ptr noundef nonnull %9, i8 noundef zeroext %75) #7
  %77 = icmp sgt i32 %76, -1
  br i1 %77, label %78, label %89

78:                                               ; preds = %72
  %79 = call i32 @s2n_stuffer_write(ptr noundef nonnull %9, ptr noundef nonnull %4) #7
  %80 = icmp sgt i32 %79, -1
  br i1 %80, label %81, label %89

81:                                               ; preds = %78
  %82 = getelementptr inbounds i8, ptr %9, i64 28
  %83 = load i32, ptr %82, align 4, !tbaa !15
  %84 = getelementptr inbounds i8, ptr %9, i64 24
  %85 = load i32, ptr %84, align 8, !tbaa !17
  %86 = sub i32 %83, %85
  %87 = getelementptr inbounds i8, ptr %8, i64 8
  store i32 %86, ptr %87, align 8, !tbaa !13
  %88 = call i32 @s2n_hkdf_expand(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef nonnull %8, ptr noundef nonnull %5)
  %.lobit = ashr i32 %88, 31
  br label %89

89:                                               ; preds = %81, %78, %72, %69, %66, %60, %54, %51, %48, %40
  %.0 = phi i32 [ -1, %40 ], [ -1, %48 ], [ -1, %51 ], [ -1, %54 ], [ -1, %60 ], [ -1, %66 ], [ -1, %69 ], [ -1, %72 ], [ -1, %78 ], [ %.lobit, %81 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 514, ptr nonnull %7) #7
  br label %90

90:                                               ; preds = %89, %28, %19, %10
  %.1 = phi i32 [ %.0, %89 ], [ -1, %28 ], [ -1, %19 ], [ -1, %10 ]
  ret i32 %.1
}

; 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_blob_init(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

declare i32 @s2n_stuffer_write_uint16(ptr noundef, i16 noundef zeroext) local_unnamed_addr #2

declare i32 @s2n_stuffer_write_uint8(ptr noundef, i8 noundef zeroext) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_hkdf_expand(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #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 = { mustprogress 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 = { 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_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!15 = !{!16, !12, i64 28}
!16 = !{!"s2n_stuffer", !14, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!17 = !{!16, !12, i64 24}


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