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

; 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_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 }
%struct.s2n_hash = type { ptr, ptr, ptr, ptr, ptr, 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.11 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.15 = 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: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) #3

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

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

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

10:                                               ; preds = %3
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = call i32 @s2n_hash_state_validate(ptr noundef %11)
  %13 = getelementptr inbounds %struct.s2n_result, ptr %9, i32 0, i32 0
  store i32 %12, ptr %13, align 4
  %14 = getelementptr inbounds %struct.s2n_result, ptr %9, i32 0, i32 0
  %15 = load i32, ptr %14, align 4
  %16 = call zeroext i1 @s2n_result_is_ok(i32 %15)
  %17 = xor i1 %16, true
  %18 = xor i1 %17, true
  %19 = zext i1 %18 to i32
  %20 = sext i32 %19 to i64
  %21 = call i64 @llvm.expect.i64(i64 %20, i64 1)
  %22 = icmp ne i64 %21, 0
  br i1 %22, label %23, label %25

23:                                               ; preds = %10
  %24 = getelementptr inbounds %struct.s2n_result, ptr %8, i32 0, i32 0
  store i32 0, ptr %24, align 4, !tbaa !11
  br label %27

25:                                               ; preds = %10
  %26 = getelementptr inbounds %struct.s2n_result, ptr %8, i32 0, i32 0
  store i32 -1, ptr %26, align 4, !tbaa !11
  br label %27

27:                                               ; preds = %25, %23
  %28 = getelementptr inbounds %struct.s2n_result, ptr %8, i32 0, i32 0
  %29 = load i32, ptr %28, align 4
  %30 = call zeroext i1 @s2n_result_is_ok(i32 %29)
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  store i32 -1, ptr %4, align 4
  br label %250

32:                                               ; preds = %27
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %71, label %37

37:                                               ; preds = %34
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %71, label %40

40:                                               ; preds = %37
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  %43 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %44 = getelementptr inbounds %struct.s2n_debug_info, ptr %43, i32 0, i32 0
  store ptr @.str.11, ptr %44, align 8, !tbaa !13
  %45 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %46 = getelementptr inbounds %struct.s2n_debug_info, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !13
  %48 = getelementptr inbounds i8, ptr %47, i64 21
  %49 = call ptr @strrchr(ptr noundef %48, i32 noundef 47) #6
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %58

51:                                               ; preds = %42
  %52 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %53 = getelementptr inbounds %struct.s2n_debug_info, ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8, !tbaa !13
  %55 = getelementptr inbounds i8, ptr %54, i64 21
  %56 = call ptr @strrchr(ptr noundef %55, i32 noundef 47) #6
  %57 = getelementptr inbounds i8, ptr %56, i64 1
  br label %63

58:                                               ; preds = %42
  %59 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %60 = getelementptr inbounds %struct.s2n_debug_info, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !13
  %62 = getelementptr inbounds i8, ptr %61, i64 21
  br label %63

63:                                               ; preds = %58, %51
  %64 = phi ptr [ %57, %51 ], [ %62, %58 ]
  %65 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %66 = getelementptr inbounds %struct.s2n_debug_info, ptr %65, i32 0, i32 1
  store ptr %64, ptr %66, align 8, !tbaa !15
  %67 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653249, ptr %67, align 4, !tbaa !9
  %68 = call i32 @s2n_calculate_stacktrace()
  br label %69

69:                                               ; preds = %63
  store i32 -1, ptr %4, align 4
  br label %250

70:                                               ; No predecessors!
  br label %71

71:                                               ; preds = %70, %37, %34
  br label %72

72:                                               ; preds = %71
  br label %73

73:                                               ; preds = %72
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.s2n_hash_state, ptr %74, i32 0, i32 2
  %76 = load i8, ptr %75, align 4, !tbaa !16
  %77 = icmp ne i8 %76, 0
  br i1 %77, label %109, label %78

78:                                               ; preds = %73
  br label %79

79:                                               ; preds = %78
  br label %80

80:                                               ; preds = %79
  %81 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %82 = getelementptr inbounds %struct.s2n_debug_info, ptr %81, i32 0, i32 0
  store ptr @.str.12, ptr %82, align 8, !tbaa !13
  %83 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %84 = getelementptr inbounds %struct.s2n_debug_info, ptr %83, i32 0, i32 0
  %85 = load ptr, ptr %84, align 8, !tbaa !13
  %86 = getelementptr inbounds i8, ptr %85, i64 21
  %87 = call ptr @strrchr(ptr noundef %86, i32 noundef 47) #6
  %88 = icmp ne ptr %87, null
  br i1 %88, label %89, label %96

89:                                               ; preds = %80
  %90 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %91 = getelementptr inbounds %struct.s2n_debug_info, ptr %90, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !13
  %93 = getelementptr inbounds i8, ptr %92, i64 21
  %94 = call ptr @strrchr(ptr noundef %93, i32 noundef 47) #6
  %95 = getelementptr inbounds i8, ptr %94, i64 1
  br label %101

96:                                               ; preds = %80
  %97 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %98 = getelementptr inbounds %struct.s2n_debug_info, ptr %97, i32 0, i32 0
  %99 = load ptr, ptr %98, align 8, !tbaa !13
  %100 = getelementptr inbounds i8, ptr %99, i64 21
  br label %101

101:                                              ; preds = %96, %89
  %102 = phi ptr [ %95, %89 ], [ %100, %96 ]
  %103 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %104 = getelementptr inbounds %struct.s2n_debug_info, ptr %103, i32 0, i32 1
  store ptr %102, ptr %104, align 8, !tbaa !15
  %105 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544342, ptr %105, align 4, !tbaa !9
  %106 = call i32 @s2n_calculate_stacktrace()
  br label %107

107:                                              ; preds = %101
  store i32 -1, ptr %4, align 4
  br label %250

108:                                              ; No predecessors!
  br label %109

109:                                              ; preds = %108, %73
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.s2n_hash_state, ptr %112, i32 0, i32 0
  %114 = load ptr, ptr %113, align 8, !tbaa !19
  %115 = icmp ne ptr %114, null
  br i1 %115, label %147, label %116

116:                                              ; preds = %111
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117
  %119 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %120 = getelementptr inbounds %struct.s2n_debug_info, ptr %119, i32 0, i32 0
  store ptr @.str.13, ptr %120, align 8, !tbaa !13
  %121 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %122 = getelementptr inbounds %struct.s2n_debug_info, ptr %121, i32 0, i32 0
  %123 = load ptr, ptr %122, align 8, !tbaa !13
  %124 = getelementptr inbounds i8, ptr %123, i64 21
  %125 = call ptr @strrchr(ptr noundef %124, i32 noundef 47) #6
  %126 = icmp ne ptr %125, null
  br i1 %126, label %127, label %134

127:                                              ; preds = %118
  %128 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %129 = getelementptr inbounds %struct.s2n_debug_info, ptr %128, i32 0, i32 0
  %130 = load ptr, ptr %129, align 8, !tbaa !13
  %131 = getelementptr inbounds i8, ptr %130, i64 21
  %132 = call ptr @strrchr(ptr noundef %131, i32 noundef 47) #6
  %133 = getelementptr inbounds i8, ptr %132, i64 1
  br label %139

134:                                              ; preds = %118
  %135 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %136 = getelementptr inbounds %struct.s2n_debug_info, ptr %135, i32 0, i32 0
  %137 = load ptr, ptr %136, align 8, !tbaa !13
  %138 = getelementptr inbounds i8, ptr %137, i64 21
  br label %139

139:                                              ; preds = %134, %127
  %140 = phi ptr [ %133, %127 ], [ %138, %134 ]
  %141 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %142 = getelementptr inbounds %struct.s2n_debug_info, ptr %141, i32 0, i32 1
  store ptr %140, ptr %142, align 8, !tbaa !15
  %143 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %143, align 4, !tbaa !9
  %144 = call i32 @s2n_calculate_stacktrace()
  br label %145

145:                                              ; preds = %139
  store i32 -1, ptr %4, align 4
  br label %250

146:                                              ; No predecessors!
  br label %147

147:                                              ; preds = %146, %111
  br label %148

148:                                              ; preds = %147
  br label %149

149:                                              ; preds = %148
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.s2n_hash_state, ptr %150, i32 0, i32 0
  %152 = load ptr, ptr %151, align 8, !tbaa !19
  %153 = getelementptr inbounds %struct.s2n_hash, ptr %152, i32 0, i32 2
  %154 = load ptr, ptr %153, align 8, !tbaa !20
  %155 = icmp ne ptr %154, null
  br i1 %155, label %187, label %156

156:                                              ; preds = %149
  br label %157

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157
  %159 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %160 = getelementptr inbounds %struct.s2n_debug_info, ptr %159, i32 0, i32 0
  store ptr @.str.14, ptr %160, align 8, !tbaa !13
  %161 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %162 = getelementptr inbounds %struct.s2n_debug_info, ptr %161, i32 0, i32 0
  %163 = load ptr, ptr %162, align 8, !tbaa !13
  %164 = getelementptr inbounds i8, ptr %163, i64 21
  %165 = call ptr @strrchr(ptr noundef %164, i32 noundef 47) #6
  %166 = icmp ne ptr %165, null
  br i1 %166, label %167, label %174

167:                                              ; preds = %158
  %168 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %169 = getelementptr inbounds %struct.s2n_debug_info, ptr %168, i32 0, i32 0
  %170 = load ptr, ptr %169, align 8, !tbaa !13
  %171 = getelementptr inbounds i8, ptr %170, i64 21
  %172 = call ptr @strrchr(ptr noundef %171, i32 noundef 47) #6
  %173 = getelementptr inbounds i8, ptr %172, i64 1
  br label %179

174:                                              ; preds = %158
  %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 0
  %177 = load ptr, ptr %176, align 8, !tbaa !13
  %178 = getelementptr inbounds i8, ptr %177, i64 21
  br label %179

179:                                              ; preds = %174, %167
  %180 = phi ptr [ %173, %167 ], [ %178, %174 ]
  %181 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %182 = getelementptr inbounds %struct.s2n_debug_info, ptr %181, i32 0, i32 1
  store ptr %180, ptr %182, align 8, !tbaa !15
  %183 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %183, align 4, !tbaa !9
  %184 = call i32 @s2n_calculate_stacktrace()
  br label %185

185:                                              ; preds = %179
  store i32 -1, ptr %4, align 4
  br label %250

186:                                              ; No predecessors!
  br label %187

187:                                              ; preds = %186, %149
  br label %188

188:                                              ; preds = %187
  br label %189

189:                                              ; preds = %188
  %190 = load ptr, ptr %5, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.s2n_hash_state, ptr %190, i32 0, i32 0
  %192 = load ptr, ptr %191, align 8, !tbaa !19
  %193 = getelementptr inbounds %struct.s2n_hash, ptr %192, i32 0, i32 2
  %194 = load ptr, ptr %193, align 8, !tbaa !20
  %195 = load ptr, ptr %5, align 8, !tbaa !5
  %196 = load ptr, ptr %6, align 8, !tbaa !5
  %197 = load i32, ptr %7, align 4, !tbaa !9
  %198 = call i32 %194(ptr noundef %195, ptr noundef %196, i32 noundef %197)
  %199 = icmp sgt i32 %198, -1
  br i1 %199, label %201, label %200

200:                                              ; preds = %189
  store i32 -1, ptr %4, align 4
  br label %250

201:                                              ; preds = %189
  br label %202

202:                                              ; preds = %201
  br label %203

203:                                              ; preds = %202
  %204 = load i32, ptr %7, align 4, !tbaa !9
  %205 = zext i32 %204 to i64
  %206 = load ptr, ptr %5, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.s2n_hash_state, ptr %206, i32 0, i32 3
  %208 = load i64, ptr %207, align 8, !tbaa !22
  %209 = sub i64 -1, %208
  %210 = icmp ule i64 %205, %209
  br i1 %210, label %242, label %211

211:                                              ; preds = %203
  br label %212

212:                                              ; preds = %211
  br label %213

213:                                              ; preds = %212
  %214 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %215 = getelementptr inbounds %struct.s2n_debug_info, ptr %214, i32 0, i32 0
  store ptr @.str.15, ptr %215, align 8, !tbaa !13
  %216 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %217 = getelementptr inbounds %struct.s2n_debug_info, ptr %216, i32 0, i32 0
  %218 = load ptr, ptr %217, align 8, !tbaa !13
  %219 = getelementptr inbounds i8, ptr %218, i64 21
  %220 = call ptr @strrchr(ptr noundef %219, i32 noundef 47) #6
  %221 = icmp ne ptr %220, null
  br i1 %221, label %222, label %229

222:                                              ; preds = %213
  %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 !13
  %226 = getelementptr inbounds i8, ptr %225, i64 21
  %227 = call ptr @strrchr(ptr noundef %226, i32 noundef 47) #6
  %228 = getelementptr inbounds i8, ptr %227, i64 1
  br label %234

229:                                              ; preds = %213
  %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 !13
  %233 = getelementptr inbounds i8, ptr %232, i64 21
  br label %234

234:                                              ; preds = %229, %222
  %235 = phi ptr [ %228, %222 ], [ %233, %229 ]
  %236 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %237 = getelementptr inbounds %struct.s2n_debug_info, ptr %236, i32 0, i32 1
  store ptr %235, ptr %237, align 8, !tbaa !15
  %238 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653251, ptr %238, align 4, !tbaa !9
  %239 = call i32 @s2n_calculate_stacktrace()
  br label %240

240:                                              ; preds = %234
  store i32 -1, ptr %4, align 4
  br label %250

241:                                              ; No predecessors!
  br label %242

242:                                              ; preds = %241, %203
  br label %243

243:                                              ; preds = %242
  %244 = load i32, ptr %7, align 4, !tbaa !9
  %245 = zext i32 %244 to i64
  %246 = load ptr, ptr %5, align 8, !tbaa !5
  %247 = getelementptr inbounds %struct.s2n_hash_state, ptr %246, i32 0, i32 3
  %248 = load i64, ptr %247, align 8, !tbaa !22
  %249 = add i64 %248, %245
  store i64 %249, ptr %247, align 8, !tbaa !22
  store i32 0, ptr %4, align 4
  br label %250

250:                                              ; preds = %243, %240, %200, %185, %145, %107, %69, %31
  %251 = load i32, ptr %4, align 4
  ret i32 %251
}

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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(none) }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"", !10, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!15 = !{!14, !6, i64 8}
!16 = !{!17, !7, i64 12}
!17 = !{!"s2n_hash_state", !6, i64 0, !10, i64 8, !7, i64 12, !18, i64 16, !7, i64 24}
!18 = !{!"long", !7, i64 0}
!19 = !{!17, !6, i64 0}
!20 = !{!21, !6, i64 16}
!21 = !{!"s2n_hash", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!22 = !{!17, !18, i64 16}


; 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.11 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.15 = 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_hash_state_validate(ptr noundef) local_unnamed_addr #4

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

7:                                                ; preds = %3
  %8 = icmp eq i32 %2, 0
  %9 = icmp ne ptr %1, null
  %or.cond = or i1 %9, %8
  br i1 %or.cond, label %18, label %10

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

18:                                               ; preds = %7
  %19 = getelementptr inbounds i8, ptr %0, i64 12
  %20 = load i8, ptr %19, align 4, !tbaa !13
  %.not24 = icmp eq i8 %20, 0
  br i1 %.not24, label %21, label %29

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

29:                                               ; preds = %18
  %30 = load ptr, ptr %0, align 8, !tbaa !16
  %.not26 = icmp eq ptr %30, null
  br i1 %.not26, label %31, label %39

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

39:                                               ; preds = %29
  %40 = getelementptr inbounds i8, ptr %30, i64 16
  %41 = load ptr, ptr %40, align 8, !tbaa !17
  %.not28 = icmp eq ptr %41, null
  br i1 %.not28, label %42, label %50

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

50:                                               ; preds = %39
  %51 = tail call i32 %41(ptr noundef nonnull %0, ptr noundef %1, i32 noundef %2) #6
  %52 = icmp sgt i32 %51, -1
  br i1 %52, label %53, label %68

53:                                               ; preds = %50
  %54 = zext i32 %2 to i64
  %55 = getelementptr inbounds i8, ptr %0, i64 16
  %56 = load i64, ptr %55, align 8, !tbaa !19
  %57 = xor i64 %56, -1
  %.not30 = icmp ugt i64 %54, %57
  br i1 %.not30, label %58, label %66

58:                                               ; preds = %53
  %59 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.15, ptr %59, align 8, !tbaa !5
  %60 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.15, i64 21), i32 noundef 47) #5
  %.not31 = icmp eq ptr %60, null
  %61 = getelementptr inbounds i8, ptr %60, i64 1
  %62 = select i1 %.not31, ptr getelementptr inbounds (i8, ptr @.str.15, i64 21), ptr %61
  %63 = getelementptr inbounds i8, ptr %59, i64 8
  store ptr %62, ptr %63, align 8, !tbaa !10
  %64 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653251, ptr %64, align 4, !tbaa !11
  %65 = tail call i32 @s2n_calculate_stacktrace() #6
  br label %68

66:                                               ; preds = %53
  %67 = add i64 %56, %54
  store i64 %67, ptr %55, align 8, !tbaa !19
  br label %68

68:                                               ; preds = %50, %3, %66, %58, %42, %31, %21, %10
  %.0 = phi i32 [ 0, %66 ], [ -1, %58 ], [ -1, %42 ], [ -1, %31 ], [ -1, %21 ], [ -1, %10 ], [ -1, %3 ], [ -1, %50 ]
  ret i32 %.0
}

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 willreturn memory(read) }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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, !8, i64 12}
!14 = !{!"s2n_hash_state", !7, i64 0, !12, i64 8, !8, i64 12, !15, i64 16, !8, i64 24}
!15 = !{!"long", !8, i64 0}
!16 = !{!14, !7, i64 0}
!17 = !{!18, !7, i64 16}
!18 = !{!"s2n_hash", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}
!19 = !{!14, !15, i64 16}


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