; LLVM IR from aws/s2n-tls :: tests/testlib (s2n_ktls_test_utils)

; 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_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.s2n_test_ktls_io_stuffer = type { %struct.s2n_stuffer, %struct.s2n_stuffer, i64, i64 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.16 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [106 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; 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_test_validate_data(ptr noundef %0, ptr noundef %1, i16 noundef zeroext %2) #5 {
  %4 = alloca %struct.s2n_result, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i16, align 2
  %8 = alloca %struct.s2n_stuffer, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i16 %2, ptr %7, align 2, !tbaa !9
  br label %11

11:                                               ; preds = %3
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %46, label %14

14:                                               ; preds = %11
  br label %15

15:                                               ; preds = %14
  br label %16

16:                                               ; preds = %15
  %17 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %18 = getelementptr inbounds %struct.s2n_debug_info, ptr %17, i32 0, i32 0
  store ptr @.str.16, ptr %18, align 8, !tbaa !11
  %19 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %20 = getelementptr inbounds %struct.s2n_debug_info, ptr %19, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = getelementptr inbounds i8, ptr %21, i64 21
  %23 = call ptr @strrchr(ptr noundef %22, i32 noundef 47) #6
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %32

25:                                               ; preds = %16
  %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 = getelementptr inbounds i8, ptr %30, i64 1
  br label %37

32:                                               ; preds = %16
  %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
  br label %37

37:                                               ; preds = %32, %25
  %38 = phi ptr [ %31, %25 ], [ %36, %32 ]
  %39 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %40 = getelementptr inbounds %struct.s2n_debug_info, ptr %39, i32 0, i32 1
  store ptr %38, ptr %40, align 8, !tbaa !13
  %41 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %41, align 4, !tbaa !14
  %42 = call i32 @s2n_calculate_stacktrace()
  br label %43

43:                                               ; preds = %37
  %44 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %44, align 4, !tbaa !16
  br label %223

45:                                               ; No predecessors!
  br label %46

46:                                               ; preds = %45, %11
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %83, label %51

51:                                               ; preds = %48
  br label %52

52:                                               ; preds = %51
  br label %53

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

62:                                               ; preds = %53
  %63 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %64 = getelementptr inbounds %struct.s2n_debug_info, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !11
  %66 = getelementptr inbounds i8, ptr %65, i64 21
  %67 = call ptr @strrchr(ptr noundef %66, i32 noundef 47) #6
  %68 = getelementptr inbounds i8, ptr %67, i64 1
  br label %74

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

74:                                               ; preds = %69, %62
  %75 = phi ptr [ %68, %62 ], [ %73, %69 ]
  %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 1
  store ptr %75, ptr %77, align 8, !tbaa !13
  %78 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %78, align 4, !tbaa !14
  %79 = call i32 @s2n_calculate_stacktrace()
  br label %80

80:                                               ; preds = %74
  %81 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %81, align 4, !tbaa !16
  br label %223

82:                                               ; No predecessors!
  br label %83

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

84:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 40, ptr %8) #7
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.s2n_test_ktls_io_stuffer, ptr %85, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %86, i64 40, i1 false), !tbaa.struct !18
  br label %87

87:                                               ; preds = %84
  %88 = getelementptr inbounds %struct.s2n_stuffer, ptr %8, i32 0, i32 2
  %89 = load i32, ptr %88, align 4, !tbaa !20
  %90 = getelementptr inbounds %struct.s2n_stuffer, ptr %8, i32 0, i32 1
  %91 = load i32, ptr %90, align 8, !tbaa !23
  %92 = sub i32 %89, %91
  %93 = load i16, ptr %7, align 2, !tbaa !9
  %94 = zext i16 %93 to i32
  %95 = icmp eq i32 %92, %94
  br i1 %95, label %130, label %96

96:                                               ; preds = %87
  br label %97

97:                                               ; preds = %96
  br label %98

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

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

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

119:                                              ; preds = %114, %107
  %120 = phi ptr [ %113, %107 ], [ %118, %114 ]
  %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 1
  store ptr %120, ptr %122, align 8, !tbaa !13
  %123 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %123, align 4, !tbaa !14
  %124 = call i32 @s2n_calculate_stacktrace()
  br label %125

125:                                              ; preds = %119
  br label %126

126:                                              ; preds = %125
  %127 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %127, align 4, !tbaa !16
  store i32 1, ptr %9, align 4
  br label %222

128:                                              ; No predecessors!
  br label %129

129:                                              ; preds = %128
  br label %130

130:                                              ; preds = %129, %87
  br label %131

131:                                              ; preds = %130
  br label %132

132:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %133 = load i16, ptr %7, align 2, !tbaa !9
  %134 = zext i16 %133 to i32
  %135 = call ptr @s2n_stuffer_raw_read(ptr noundef %8, i32 noundef %134)
  store ptr %135, ptr %10, align 8, !tbaa !5
  br label %136

136:                                              ; preds = %132
  %137 = load ptr, ptr %10, align 8, !tbaa !5
  %138 = icmp ne ptr %137, null
  br i1 %138, label %173, label %139

139:                                              ; preds = %136
  br label %140

140:                                              ; preds = %139
  br label %141

141:                                              ; preds = %140
  %142 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %143 = getelementptr inbounds %struct.s2n_debug_info, ptr %142, i32 0, i32 0
  store ptr @.str.19, ptr %143, align 8, !tbaa !11
  %144 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %145 = getelementptr inbounds %struct.s2n_debug_info, ptr %144, i32 0, i32 0
  %146 = load ptr, ptr %145, align 8, !tbaa !11
  %147 = getelementptr inbounds i8, ptr %146, i64 21
  %148 = call ptr @strrchr(ptr noundef %147, i32 noundef 47) #6
  %149 = icmp ne ptr %148, null
  br i1 %149, label %150, label %157

150:                                              ; preds = %141
  %151 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %152 = getelementptr inbounds %struct.s2n_debug_info, ptr %151, i32 0, i32 0
  %153 = load ptr, ptr %152, align 8, !tbaa !11
  %154 = getelementptr inbounds i8, ptr %153, i64 21
  %155 = call ptr @strrchr(ptr noundef %154, i32 noundef 47) #6
  %156 = getelementptr inbounds i8, ptr %155, i64 1
  br label %162

157:                                              ; preds = %141
  %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 !11
  %161 = getelementptr inbounds i8, ptr %160, i64 21
  br label %162

162:                                              ; preds = %157, %150
  %163 = phi ptr [ %156, %150 ], [ %161, %157 ]
  %164 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %165 = getelementptr inbounds %struct.s2n_debug_info, ptr %164, i32 0, i32 1
  store ptr %163, ptr %165, align 8, !tbaa !13
  %166 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %166, align 4, !tbaa !14
  %167 = call i32 @s2n_calculate_stacktrace()
  br label %168

168:                                              ; preds = %162
  br label %169

169:                                              ; preds = %168
  %170 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %170, align 4, !tbaa !16
  store i32 1, ptr %9, align 4
  br label %221

171:                                              ; No predecessors!
  br label %172

172:                                              ; preds = %171
  br label %173

173:                                              ; preds = %172, %136
  br label %174

174:                                              ; preds = %173
  br label %175

175:                                              ; preds = %174
  br label %176

176:                                              ; preds = %175
  %177 = load ptr, ptr %10, align 8, !tbaa !5
  %178 = load ptr, ptr %6, align 8, !tbaa !5
  %179 = load i16, ptr %7, align 2, !tbaa !9
  %180 = zext i16 %179 to i64
  %181 = call i32 @memcmp(ptr noundef %177, ptr noundef %178, i64 noundef %180) #6
  %182 = icmp eq i32 %181, 0
  br i1 %182, label %217, label %183

183:                                              ; preds = %176
  br label %184

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184
  %186 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %187 = getelementptr inbounds %struct.s2n_debug_info, ptr %186, i32 0, i32 0
  store ptr @.str.20, ptr %187, align 8, !tbaa !11
  %188 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %189 = getelementptr inbounds %struct.s2n_debug_info, ptr %188, i32 0, i32 0
  %190 = load ptr, ptr %189, align 8, !tbaa !11
  %191 = getelementptr inbounds i8, ptr %190, i64 21
  %192 = call ptr @strrchr(ptr noundef %191, i32 noundef 47) #6
  %193 = icmp ne ptr %192, null
  br i1 %193, label %194, label %201

194:                                              ; preds = %185
  %195 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %196 = getelementptr inbounds %struct.s2n_debug_info, ptr %195, i32 0, i32 0
  %197 = load ptr, ptr %196, align 8, !tbaa !11
  %198 = getelementptr inbounds i8, ptr %197, i64 21
  %199 = call ptr @strrchr(ptr noundef %198, i32 noundef 47) #6
  %200 = getelementptr inbounds i8, ptr %199, i64 1
  br label %206

201:                                              ; preds = %185
  %202 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %203 = getelementptr inbounds %struct.s2n_debug_info, ptr %202, i32 0, i32 0
  %204 = load ptr, ptr %203, align 8, !tbaa !11
  %205 = getelementptr inbounds i8, ptr %204, i64 21
  br label %206

206:                                              ; preds = %201, %194
  %207 = phi ptr [ %200, %194 ], [ %205, %201 ]
  %208 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %209 = getelementptr inbounds %struct.s2n_debug_info, ptr %208, i32 0, i32 1
  store ptr %207, ptr %209, align 8, !tbaa !13
  %210 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %210, align 4, !tbaa !14
  %211 = call i32 @s2n_calculate_stacktrace()
  br label %212

212:                                              ; preds = %206
  br label %213

213:                                              ; preds = %212
  %214 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %214, align 4, !tbaa !16
  store i32 1, ptr %9, align 4
  br label %221

215:                                              ; No predecessors!
  br label %216

216:                                              ; preds = %215
  br label %217

217:                                              ; preds = %216, %176
  br label %218

218:                                              ; preds = %217
  br label %219

219:                                              ; preds = %218
  %220 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 0, ptr %220, align 4, !tbaa !16
  store i32 1, ptr %9, align 4
  br label %221

221:                                              ; preds = %219, %213, %169
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %222

222:                                              ; preds = %221, %126
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #7
  br label %223

223:                                              ; preds = %222, %80, %43
  %224 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  %225 = load i32, ptr %224, align 4
  ret i32 %225
}

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #1

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !15, i64 0}
!17 = !{!"", !15, i64 0}
!18 = !{i64 0, i64 8, !5, i64 8, i64 4, !14, i64 12, i64 4, !14, i64 16, i64 1, !19, i64 24, i64 4, !14, i64 28, i64 4, !14, i64 32, i64 4, !14, i64 36, i64 1, !19}
!19 = !{!7, !7, i64 0}
!20 = !{!21, !15, i64 28}
!21 = !{!"s2n_stuffer", !22, i64 0, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !15, i64 36, !15, i64 36}
!22 = !{!"s2n_blob", !6, i64 0, !15, i64 8, !15, i64 12, !15, i64 16}
!23 = !{!21, !15, 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_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_blob = type { ptr, 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.16 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [106 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; 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_test_validate_data(ptr noundef readonly %0, ptr noundef readonly %1, i16 noundef zeroext %2) local_unnamed_addr #5 {
  %4 = alloca %struct.s2n_stuffer, align 8
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %5, label %13

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

13:                                               ; preds = %3
  %.not17 = icmp eq ptr %1, null
  br i1 %.not17, label %14, label %22

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

22:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #8
  %23 = getelementptr inbounds i8, ptr %0, i64 40
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(40) %23, i64 40, i1 false), !tbaa.struct !13
  %24 = getelementptr inbounds i8, ptr %4, i64 28
  %25 = load i32, ptr %24, align 4, !tbaa !16
  %26 = getelementptr inbounds i8, ptr %4, i64 24
  %27 = load i32, ptr %26, align 8, !tbaa !19
  %28 = sub i32 %25, %27
  %29 = zext i16 %2 to i32
  %30 = icmp eq i32 %28, %29
  br i1 %30, label %39, label %31

31:                                               ; preds = %22
  %32 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.18, ptr %32, align 8, !tbaa !5
  %33 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.18, i64 21), i32 noundef 47) #7
  %.not19 = icmp eq ptr %33, null
  %34 = getelementptr inbounds i8, ptr %33, i64 1
  %35 = select i1 %.not19, ptr getelementptr inbounds (i8, ptr @.str.18, 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 402653194, ptr %37, align 4, !tbaa !11
  %38 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %60

39:                                               ; preds = %22
  %40 = call ptr @s2n_stuffer_raw_read(ptr noundef nonnull %4, i32 noundef %28) #8
  %.not20 = icmp eq ptr %40, null
  br i1 %.not20, label %41, label %49

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

49:                                               ; preds = %39
  %50 = zext i16 %2 to i64
  %bcmp = call i32 @bcmp(ptr nonnull %40, ptr nonnull %1, i64 %50)
  %51 = icmp eq i32 %bcmp, 0
  br i1 %51, label %60, label %52

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

60:                                               ; preds = %41, %52, %49, %31
  %.sroa.0.1 = phi i32 [ -1, %31 ], [ -1, %52 ], [ -1, %41 ], [ 0, %49 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #8
  br label %61

61:                                               ; preds = %60, %14, %5
  %.sroa.0.2 = phi i32 [ %.sroa.0.1, %60 ], [ -1, %14 ], [ -1, %5 ]
  ret i32 %.sroa.0.2
}

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

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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 = !{i64 0, i64 8, !14, i64 8, i64 4, !11, i64 12, i64 4, !11, i64 16, i64 1, !15, i64 24, i64 4, !11, i64 28, i64 4, !11, i64 32, i64 4, !11, i64 36, i64 1, !15}
!14 = !{!7, !7, i64 0}
!15 = !{!8, !8, i64 0}
!16 = !{!17, !12, i64 28}
!17 = !{!"s2n_stuffer", !18, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!18 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!19 = !{!17, !12, i64 24}


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