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

; 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_hmac_state = type { i32, i16, i32, i16, i8, %struct.s2n_hash_state, %struct.s2n_hash_state, %struct.s2n_hash_state, %struct.s2n_hash_state, [128 x i8], [64 x i8] }
%struct.s2n_hash_state = type { ptr, i32, i8, i64, %union.anon }
%union.anon = type { %struct.s2n_hash_evp_digest }
%struct.s2n_hash_evp_digest = type { %struct.s2n_evp_digest, %struct.s2n_evp_digest }
%struct.s2n_evp_digest = type { ptr, ptr }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.18 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [88 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: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_hmac_state_validate(ptr noundef) #5

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

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

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

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

32:                                               ; preds = %19
  %33 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 0, ptr %33, align 4, !tbaa !9
  br label %36

34:                                               ; preds = %19
  %35 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 -1, ptr %35, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %34, %32
  %37 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  %38 = load i32, ptr %37, align 4
  %39 = call zeroext i1 @s2n_result_is_ok(i32 %38)
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %36
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = call i32 @s2n_hmac_state_validate(ptr noundef %44)
  %46 = getelementptr inbounds %struct.s2n_result, ptr %9, i32 0, i32 0
  store i32 %45, ptr %46, align 4
  %47 = getelementptr inbounds %struct.s2n_result, ptr %9, i32 0, i32 0
  %48 = load i32, ptr %47, align 4
  %49 = call zeroext i1 @s2n_result_is_ok(i32 %48)
  %50 = xor i1 %49, true
  %51 = xor i1 %50, true
  %52 = zext i1 %51 to i32
  %53 = sext i32 %52 to i64
  %54 = call i64 @llvm.expect.i64(i64 %53, i64 1)
  %55 = icmp ne i64 %54, 0
  br i1 %55, label %56, label %58

56:                                               ; preds = %43
  %57 = getelementptr inbounds %struct.s2n_result, ptr %8, i32 0, i32 0
  store i32 0, ptr %57, align 4, !tbaa !9
  br label %60

58:                                               ; preds = %43
  %59 = getelementptr inbounds %struct.s2n_result, ptr %8, i32 0, i32 0
  store i32 -1, ptr %59, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %58, %56
  %61 = getelementptr inbounds %struct.s2n_result, ptr %8, i32 0, i32 0
  %62 = load i32, ptr %61, align 4
  %63 = call zeroext i1 @s2n_result_is_ok(i32 %62)
  br i1 %63, label %65, label %64

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

65:                                               ; preds = %60
  br label %66

66:                                               ; preds = %65
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.s2n_hmac_state, ptr %67, i32 0, i32 0
  %69 = load i32, ptr %68, align 8, !tbaa !12
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.s2n_hmac_state, ptr %70, i32 0, i32 0
  store i32 %69, ptr %71, align 8, !tbaa !12
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.s2n_hmac_state, ptr %72, i32 0, i32 1
  %74 = load i16, ptr %73, align 4, !tbaa !17
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.s2n_hmac_state, ptr %75, i32 0, i32 1
  store i16 %74, ptr %76, align 4, !tbaa !17
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.s2n_hmac_state, ptr %77, i32 0, i32 2
  %79 = load i32, ptr %78, align 8, !tbaa !18
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.s2n_hmac_state, ptr %80, i32 0, i32 2
  store i32 %79, ptr %81, align 8, !tbaa !18
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.s2n_hmac_state, ptr %82, i32 0, i32 3
  %84 = load i16, ptr %83, align 4, !tbaa !19
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.s2n_hmac_state, ptr %85, i32 0, i32 3
  store i16 %84, ptr %86, align 4, !tbaa !19
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.s2n_hmac_state, ptr %87, i32 0, i32 4
  %89 = load i8, ptr %88, align 2, !tbaa !20
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.s2n_hmac_state, ptr %90, i32 0, i32 4
  store i8 %89, ptr %91, align 2, !tbaa !20
  br label %92

92:                                               ; preds = %66
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.s2n_hmac_state, ptr %93, i32 0, i32 5
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.s2n_hmac_state, ptr %95, i32 0, i32 5
  %97 = call i32 @s2n_hash_copy(ptr noundef %94, ptr noundef %96)
  %98 = icmp sgt i32 %97, -1
  br i1 %98, label %100, label %99

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

100:                                              ; preds = %92
  br label %101

101:                                              ; preds = %100
  br label %102

102:                                              ; preds = %101
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.s2n_hmac_state, ptr %103, i32 0, i32 6
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.s2n_hmac_state, ptr %105, i32 0, i32 6
  %107 = call i32 @s2n_hash_copy(ptr noundef %104, ptr noundef %106)
  %108 = icmp sgt i32 %107, -1
  br i1 %108, label %110, label %109

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

110:                                              ; preds = %102
  br label %111

111:                                              ; preds = %110
  br label %112

112:                                              ; preds = %111
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.s2n_hmac_state, ptr %113, i32 0, i32 7
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.s2n_hmac_state, ptr %115, i32 0, i32 7
  %117 = call i32 @s2n_hash_copy(ptr noundef %114, ptr noundef %116)
  %118 = icmp sgt i32 %117, -1
  br i1 %118, label %120, label %119

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

120:                                              ; preds = %112
  br label %121

121:                                              ; preds = %120
  br label %122

122:                                              ; preds = %121
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.s2n_hmac_state, ptr %123, i32 0, i32 8
  %125 = load ptr, ptr %5, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.s2n_hmac_state, ptr %125, i32 0, i32 8
  %127 = call i32 @s2n_hash_copy(ptr noundef %124, ptr noundef %126)
  %128 = icmp sgt i32 %127, -1
  br i1 %128, label %130, label %129

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

130:                                              ; preds = %122
  br label %131

131:                                              ; preds = %130
  br label %132

132:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store i64 128, ptr %10, align 8, !tbaa !21
  %133 = load i64, ptr %10, align 8, !tbaa !21
  %134 = icmp ne i64 %133, 0
  %135 = xor i1 %134, true
  %136 = xor i1 %135, true
  %137 = zext i1 %136 to i32
  %138 = sext i32 %137 to i64
  %139 = call i64 @llvm.expect.i64(i64 %138, i64 1)
  %140 = icmp ne i64 %139, 0
  br i1 %140, label %141, label %192

141:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %142 = load ptr, ptr %4, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.s2n_hmac_state, ptr %142, i32 0, i32 9
  %144 = getelementptr inbounds [128 x i8], ptr %143, i64 0, i64 0
  %145 = load ptr, ptr %5, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.s2n_hmac_state, ptr %145, i32 0, i32 9
  %147 = getelementptr inbounds [128 x i8], ptr %146, i64 0, i64 0
  %148 = load i64, ptr %10, align 8, !tbaa !21
  %149 = call ptr @s2n_ensure_memmove_trace(ptr noundef %144, ptr noundef %147, i64 noundef %148)
  store ptr %149, ptr %11, align 8, !tbaa !5
  br label %150

150:                                              ; preds = %141
  %151 = load ptr, ptr %11, align 8, !tbaa !5
  %152 = icmp ne ptr %151, null
  br i1 %152, label %186, label %153

153:                                              ; preds = %150
  br label %154

154:                                              ; preds = %153
  br label %155

155:                                              ; preds = %154
  %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 0
  store ptr @.str.18, ptr %157, align 8, !tbaa !22
  %158 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %159 = getelementptr inbounds %struct.s2n_debug_info, ptr %158, i32 0, i32 0
  %160 = load ptr, ptr %159, align 8, !tbaa !22
  %161 = getelementptr inbounds i8, ptr %160, i64 21
  %162 = call ptr @strrchr(ptr noundef %161, i32 noundef 47) #8
  %163 = icmp ne ptr %162, null
  br i1 %163, label %164, label %171

164:                                              ; preds = %155
  %165 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %166 = getelementptr inbounds %struct.s2n_debug_info, ptr %165, i32 0, i32 0
  %167 = load ptr, ptr %166, align 8, !tbaa !22
  %168 = getelementptr inbounds i8, ptr %167, i64 21
  %169 = call ptr @strrchr(ptr noundef %168, i32 noundef 47) #8
  %170 = getelementptr inbounds i8, ptr %169, i64 1
  br label %176

171:                                              ; preds = %155
  %172 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %173 = getelementptr inbounds %struct.s2n_debug_info, ptr %172, i32 0, i32 0
  %174 = load ptr, ptr %173, align 8, !tbaa !22
  %175 = getelementptr inbounds i8, ptr %174, i64 21
  br label %176

176:                                              ; preds = %171, %164
  %177 = phi ptr [ %170, %164 ], [ %175, %171 ]
  %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 1
  store ptr %177, ptr %179, align 8, !tbaa !24
  %180 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %180, align 4, !tbaa !25
  %181 = call i32 @s2n_calculate_stacktrace()
  br label %182

182:                                              ; preds = %176
  br label %183

183:                                              ; preds = %182
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %189

184:                                              ; No predecessors!
  br label %185

185:                                              ; preds = %184
  br label %186

186:                                              ; preds = %185, %150
  br label %187

187:                                              ; preds = %186
  br label %188

188:                                              ; preds = %187
  store i32 0, ptr %12, align 4
  br label %189

189:                                              ; preds = %188, %183
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  %190 = load i32, ptr %12, align 4
  switch i32 %190, label %193 [
    i32 0, label %191
  ]

191:                                              ; preds = %189
  br label %192

192:                                              ; preds = %191, %132
  store i32 0, ptr %12, align 4
  br label %193

193:                                              ; preds = %192, %189
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  %194 = load i32, ptr %12, align 4
  switch i32 %194, label %312 [
    i32 0, label %195
    i32 1, label %310
  ]

195:                                              ; preds = %193
  br label %196

196:                                              ; preds = %195
  br label %197

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

206:                                              ; preds = %197
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %207 = load ptr, ptr %4, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.s2n_hmac_state, ptr %207, i32 0, i32 10
  %209 = getelementptr inbounds [64 x i8], ptr %208, i64 0, i64 0
  %210 = load ptr, ptr %5, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.s2n_hmac_state, ptr %210, i32 0, i32 10
  %212 = getelementptr inbounds [64 x i8], ptr %211, i64 0, i64 0
  %213 = load i64, ptr %13, align 8, !tbaa !21
  %214 = call ptr @s2n_ensure_memmove_trace(ptr noundef %209, ptr noundef %212, i64 noundef %213)
  store ptr %214, ptr %14, align 8, !tbaa !5
  br label %215

215:                                              ; preds = %206
  %216 = load ptr, ptr %14, align 8, !tbaa !5
  %217 = icmp ne ptr %216, null
  br i1 %217, label %251, label %218

218:                                              ; preds = %215
  br label %219

219:                                              ; preds = %218
  br label %220

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

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

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

241:                                              ; preds = %236, %229
  %242 = phi ptr [ %235, %229 ], [ %240, %236 ]
  %243 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %244 = getelementptr inbounds %struct.s2n_debug_info, ptr %243, i32 0, i32 1
  store ptr %242, ptr %244, align 8, !tbaa !24
  %245 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %245, align 4, !tbaa !25
  %246 = call i32 @s2n_calculate_stacktrace()
  br label %247

247:                                              ; preds = %241
  br label %248

248:                                              ; preds = %247
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %254

249:                                              ; No predecessors!
  br label %250

250:                                              ; preds = %249
  br label %251

251:                                              ; preds = %250, %215
  br label %252

252:                                              ; preds = %251
  br label %253

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

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

256:                                              ; preds = %254
  br label %257

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

258:                                              ; preds = %257, %254
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  %259 = load i32, ptr %12, align 4
  switch i32 %259, label %312 [
    i32 0, label %260
    i32 1, label %310
  ]

260:                                              ; preds = %258
  br label %261

261:                                              ; preds = %260
  br label %262

262:                                              ; preds = %261
  %263 = load ptr, ptr %4, align 8, !tbaa !5
  %264 = call i32 @s2n_hmac_state_validate(ptr noundef %263)
  %265 = getelementptr inbounds %struct.s2n_result, ptr %16, i32 0, i32 0
  store i32 %264, ptr %265, align 4
  %266 = getelementptr inbounds %struct.s2n_result, ptr %16, i32 0, i32 0
  %267 = load i32, ptr %266, align 4
  %268 = call zeroext i1 @s2n_result_is_ok(i32 %267)
  %269 = xor i1 %268, true
  %270 = xor i1 %269, true
  %271 = zext i1 %270 to i32
  %272 = sext i32 %271 to i64
  %273 = call i64 @llvm.expect.i64(i64 %272, i64 1)
  %274 = icmp ne i64 %273, 0
  br i1 %274, label %275, label %277

275:                                              ; preds = %262
  %276 = getelementptr inbounds %struct.s2n_result, ptr %15, i32 0, i32 0
  store i32 0, ptr %276, align 4, !tbaa !9
  br label %279

277:                                              ; preds = %262
  %278 = getelementptr inbounds %struct.s2n_result, ptr %15, i32 0, i32 0
  store i32 -1, ptr %278, align 4, !tbaa !9
  br label %279

279:                                              ; preds = %277, %275
  %280 = getelementptr inbounds %struct.s2n_result, ptr %15, i32 0, i32 0
  %281 = load i32, ptr %280, align 4
  %282 = call zeroext i1 @s2n_result_is_ok(i32 %281)
  br i1 %282, label %284, label %283

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

284:                                              ; preds = %279
  br label %285

285:                                              ; preds = %284
  br label %286

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

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

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

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

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

308:                                              ; preds = %303
  br label %309

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

310:                                              ; preds = %309, %307, %283, %258, %193, %129, %119, %109, %99, %64, %40
  %311 = load i32, ptr %3, align 4
  ret i32 %311

312:                                              ; preds = %258, %193
  unreachable
}

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

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

!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, !11, i64 0}
!10 = !{!"", !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"s2n_hmac_state", !11, i64 0, !14, i64 4, !11, i64 8, !14, i64 12, !7, i64 14, !15, i64 16, !15, i64 72, !15, i64 128, !15, i64 184, !7, i64 240, !7, i64 368}
!14 = !{!"short", !7, i64 0}
!15 = !{!"s2n_hash_state", !6, i64 0, !11, i64 8, !7, i64 12, !16, i64 16, !7, i64 24}
!16 = !{!"long", !7, i64 0}
!17 = !{!13, !14, i64 4}
!18 = !{!13, !11, i64 8}
!19 = !{!13, !14, i64 12}
!20 = !{!13, !7, i64 14}
!21 = !{!16, !16, i64 0}
!22 = !{!23, !6, i64 0}
!23 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!24 = !{!23, !6, i64 8}
!25 = !{!11, !11, 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.18 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [88 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: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) local_unnamed_addr #3

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

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

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

6:                                                ; preds = %2
  %7 = tail call i32 @s2n_hmac_state_validate(ptr noundef %1)
  %8 = tail call zeroext i1 @s2n_result_is_ok(i32 %7)
  %not.61 = xor i1 %8, true
  %.52 = sext i1 %not.61 to i32
  %9 = tail call zeroext i1 @s2n_result_is_ok(i32 %.52)
  br i1 %9, label %10, label %73

10:                                               ; preds = %6
  %11 = load i32, ptr %1, align 8, !tbaa !5
  store i32 %11, ptr %0, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %1, i64 4
  %13 = load i16, ptr %12, align 4, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %0, i64 4
  store i16 %13, ptr %14, align 4, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %16, ptr %17, align 8, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %1, i64 12
  %19 = load i16, ptr %18, align 4, !tbaa !16
  %20 = getelementptr inbounds i8, ptr %0, i64 12
  store i16 %19, ptr %20, align 4, !tbaa !16
  %21 = getelementptr inbounds i8, ptr %1, i64 14
  %22 = load i8, ptr %21, align 2, !tbaa !17
  %23 = getelementptr inbounds i8, ptr %0, i64 14
  store i8 %22, ptr %23, align 2, !tbaa !17
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = getelementptr inbounds i8, ptr %1, i64 16
  %26 = tail call i32 @s2n_hash_copy(ptr noundef nonnull %24, ptr noundef nonnull %25) #5
  %27 = icmp sgt i32 %26, -1
  br i1 %27, label %28, label %73

28:                                               ; preds = %10
  %29 = getelementptr inbounds i8, ptr %0, i64 72
  %30 = getelementptr inbounds i8, ptr %1, i64 72
  %31 = tail call i32 @s2n_hash_copy(ptr noundef nonnull %29, ptr noundef nonnull %30) #5
  %32 = icmp sgt i32 %31, -1
  br i1 %32, label %33, label %73

33:                                               ; preds = %28
  %34 = getelementptr inbounds i8, ptr %0, i64 128
  %35 = getelementptr inbounds i8, ptr %1, i64 128
  %36 = tail call i32 @s2n_hash_copy(ptr noundef nonnull %34, ptr noundef nonnull %35) #5
  %37 = icmp sgt i32 %36, -1
  br i1 %37, label %38, label %73

38:                                               ; preds = %33
  %39 = getelementptr inbounds i8, ptr %0, i64 184
  %40 = getelementptr inbounds i8, ptr %1, i64 184
  %41 = tail call i32 @s2n_hash_copy(ptr noundef nonnull %39, ptr noundef nonnull %40) #5
  %42 = icmp sgt i32 %41, -1
  br i1 %42, label %43, label %73

43:                                               ; preds = %38
  %44 = getelementptr inbounds i8, ptr %0, i64 240
  %45 = getelementptr inbounds i8, ptr %1, i64 240
  %46 = tail call ptr @s2n_ensure_memmove_trace(ptr noundef nonnull %44, ptr noundef nonnull %45, i64 noundef 128) #5
  %.not.not = icmp eq ptr %46, null
  br i1 %.not.not, label %.critedge, label %54

.critedge:                                        ; preds = %43
  %47 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.18, ptr %47, align 8, !tbaa !18
  %48 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.18, i64 21), i32 noundef 47) #6
  %.not49 = icmp eq ptr %48, null
  %49 = getelementptr inbounds i8, ptr %48, i64 1
  %50 = select i1 %.not49, ptr getelementptr inbounds (i8, ptr @.str.18, i64 21), ptr %49
  %51 = getelementptr inbounds i8, ptr %47, i64 8
  store ptr %50, ptr %51, align 8, !tbaa !20
  %52 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %52, align 4, !tbaa !21
  %53 = tail call i32 @s2n_calculate_stacktrace() #5
  br label %73

54:                                               ; preds = %43
  %55 = getelementptr inbounds i8, ptr %0, i64 368
  %56 = getelementptr inbounds i8, ptr %1, i64 368
  %57 = tail call ptr @s2n_ensure_memmove_trace(ptr noundef nonnull %55, ptr noundef nonnull %56, i64 noundef 64) #5
  %.not.not51 = icmp eq ptr %57, null
  br i1 %.not.not51, label %.critedge54, label %65

.critedge54:                                      ; preds = %54
  %58 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.19, ptr %58, align 8, !tbaa !18
  %59 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.19, i64 21), i32 noundef 47) #6
  %.not50 = icmp eq ptr %59, null
  %60 = getelementptr inbounds i8, ptr %59, i64 1
  %61 = select i1 %.not50, ptr getelementptr inbounds (i8, ptr @.str.19, i64 21), ptr %60
  %62 = getelementptr inbounds i8, ptr %58, i64 8
  store ptr %61, ptr %62, align 8, !tbaa !20
  %63 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %63, align 4, !tbaa !21
  %64 = tail call i32 @s2n_calculate_stacktrace() #5
  br label %73

65:                                               ; preds = %54
  %66 = tail call i32 @s2n_hmac_state_validate(ptr noundef nonnull %0)
  %67 = tail call zeroext i1 @s2n_result_is_ok(i32 %66)
  %not.62 = xor i1 %67, true
  %.57 = sext i1 %not.62 to i32
  %68 = tail call zeroext i1 @s2n_result_is_ok(i32 %.57)
  br i1 %68, label %69, label %73

69:                                               ; preds = %65
  %70 = tail call i32 @s2n_hmac_state_validate(ptr noundef nonnull %1)
  %71 = tail call zeroext i1 @s2n_result_is_ok(i32 %70)
  %not.63 = xor i1 %71, true
  %.58 = sext i1 %not.63 to i32
  %72 = tail call zeroext i1 @s2n_result_is_ok(i32 %.58)
  %not.64 = xor i1 %72, true
  %spec.select = sext i1 %not.64 to i32
  br label %73

73:                                               ; preds = %.critedge54, %.critedge, %69, %65, %38, %33, %28, %10, %6, %2
  %.6 = phi i32 [ -1, %.critedge ], [ -1, %.critedge54 ], [ -1, %2 ], [ -1, %6 ], [ -1, %10 ], [ -1, %28 ], [ -1, %33 ], [ -1, %38 ], [ -1, %65 ], [ %spec.select, %69 ]
  ret i32 %.6
}

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

!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_hmac_state", !7, i64 0, !10, i64 4, !7, i64 8, !10, i64 12, !8, i64 14, !11, i64 16, !11, i64 72, !11, i64 128, !11, i64 184, !8, i64 240, !8, i64 368}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!"s2n_hash_state", !12, i64 0, !7, i64 8, !8, i64 12, !13, i64 16, !8, i64 24}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!6, !10, i64 4}
!15 = !{!6, !7, i64 8}
!16 = !{!6, !10, i64 12}
!17 = !{!6, !8, i64 14}
!18 = !{!19, !12, i64 0}
!19 = !{!"s2n_debug_info", !12, i64 0, !12, i64 8}
!20 = !{!19, !12, i64 8}
!21 = !{!7, !7, i64 0}


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