; LLVM IR from aws/s2n-tls :: stuffer (s2n_stuffer)

; 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_reservation = type { ptr, i32, i8 }
%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 global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.5 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [91 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_stuffer_validate(ptr noundef) #0

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

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strrchr(ptr noundef, i32 noundef) #2

declare i32 @s2n_calculate_stacktrace() #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) #4

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

8:                                                ; preds = %1
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %43, label %11

11:                                               ; preds = %8
  br label %12

12:                                               ; preds = %11
  br label %13

13:                                               ; preds = %12
  %14 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %15 = getelementptr inbounds %struct.s2n_debug_info, ptr %14, i32 0, i32 0
  store ptr @.str.5, ptr %15, align 8, !tbaa !9
  %16 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %17 = getelementptr inbounds %struct.s2n_debug_info, ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = getelementptr inbounds i8, ptr %18, i64 21
  %20 = call ptr @strrchr(ptr noundef %19, i32 noundef 47) #7
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %29

22:                                               ; preds = %13
  %23 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %24 = getelementptr inbounds %struct.s2n_debug_info, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %25, i64 21
  %27 = call ptr @strrchr(ptr noundef %26, i32 noundef 47) #7
  %28 = getelementptr inbounds i8, ptr %27, i64 1
  br label %34

29:                                               ; preds = %13
  %30 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %31 = getelementptr inbounds %struct.s2n_debug_info, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = getelementptr inbounds i8, ptr %32, i64 21
  br label %34

34:                                               ; preds = %29, %22
  %35 = phi ptr [ %28, %22 ], [ %33, %29 ]
  %36 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %37 = getelementptr inbounds %struct.s2n_debug_info, ptr %36, i32 0, i32 1
  store ptr %35, ptr %37, align 8, !tbaa !11
  %38 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %38, align 4, !tbaa !12
  %39 = call i32 @s2n_calculate_stacktrace()
  br label %40

40:                                               ; preds = %34
  %41 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %41, align 4, !tbaa !14
  br label %199

42:                                               ; No predecessors!
  br label %43

43:                                               ; preds = %42, %8
  br label %44

44:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #8
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 %45, i64 16, i1 false), !tbaa.struct !16
  br label %46

46:                                               ; preds = %44
  %47 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %4, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !18
  %49 = call i32 @s2n_stuffer_validate(ptr noundef %48)
  %50 = getelementptr inbounds %struct.s2n_result, ptr %5, i32 0, i32 0
  store i32 %49, ptr %50, align 4
  %51 = getelementptr inbounds %struct.s2n_result, ptr %5, i32 0, i32 0
  %52 = load i32, ptr %51, align 4
  %53 = call zeroext i1 @s2n_result_is_ok(i32 %52)
  br i1 %53, label %56, label %54

54:                                               ; preds = %46
  %55 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %55, align 4, !tbaa !14
  store i32 1, ptr %6, align 4
  br label %198

56:                                               ; preds = %46
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 40, ptr %7) #8
  %59 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %4, i32 0, i32 0
  %60 = load ptr, ptr %59, align 8, !tbaa !18
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %60, i64 40, i1 false), !tbaa.struct !20
  br label %61

61:                                               ; preds = %58
  %62 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %4, i32 0, i32 1
  %63 = load i32, ptr %62, align 8, !tbaa !21
  %64 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %4, i32 0, i32 2
  %65 = load i8, ptr %64, align 4, !tbaa !22
  %66 = zext i8 %65 to i32
  %67 = sub i32 -1, %66
  %68 = icmp ule i32 %63, %67
  br i1 %68, label %103, label %69

69:                                               ; preds = %61
  br label %70

70:                                               ; preds = %69
  br label %71

71:                                               ; preds = %70
  %72 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %73 = getelementptr inbounds %struct.s2n_debug_info, ptr %72, i32 0, i32 0
  store ptr @.str.6, ptr %73, align 8, !tbaa !9
  %74 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %75 = getelementptr inbounds %struct.s2n_debug_info, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !9
  %77 = getelementptr inbounds i8, ptr %76, i64 21
  %78 = call ptr @strrchr(ptr noundef %77, i32 noundef 47) #7
  %79 = icmp ne ptr %78, null
  br i1 %79, label %80, label %87

80:                                               ; preds = %71
  %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
  %83 = load ptr, ptr %82, align 8, !tbaa !9
  %84 = getelementptr inbounds i8, ptr %83, i64 21
  %85 = call ptr @strrchr(ptr noundef %84, i32 noundef 47) #7
  %86 = getelementptr inbounds i8, ptr %85, i64 1
  br label %92

87:                                               ; preds = %71
  %88 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %89 = getelementptr inbounds %struct.s2n_debug_info, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !9
  %91 = getelementptr inbounds i8, ptr %90, i64 21
  br label %92

92:                                               ; preds = %87, %80
  %93 = phi ptr [ %86, %80 ], [ %91, %87 ]
  %94 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %95 = getelementptr inbounds %struct.s2n_debug_info, ptr %94, i32 0, i32 1
  store ptr %93, ptr %95, align 8, !tbaa !11
  %96 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %96, align 4, !tbaa !12
  %97 = call i32 @s2n_calculate_stacktrace()
  br label %98

98:                                               ; preds = %92
  br label %99

99:                                               ; preds = %98
  %100 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %100, align 4, !tbaa !14
  store i32 1, ptr %6, align 4
  br label %197

101:                                              ; No predecessors!
  br label %102

102:                                              ; preds = %101
  br label %103

103:                                              ; preds = %102, %61
  br label %104

104:                                              ; preds = %103
  br label %105

105:                                              ; preds = %104
  br label %106

106:                                              ; preds = %105
  %107 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %4, i32 0, i32 1
  %108 = load i32, ptr %107, align 8, !tbaa !21
  %109 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %4, i32 0, i32 2
  %110 = load i8, ptr %109, align 4, !tbaa !22
  %111 = zext i8 %110 to i32
  %112 = add i32 %108, %111
  %113 = getelementptr inbounds %struct.s2n_stuffer, ptr %7, i32 0, i32 2
  %114 = load i32, ptr %113, align 4, !tbaa !23
  %115 = icmp ule i32 %112, %114
  br i1 %115, label %150, label %116

116:                                              ; preds = %106
  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.7, ptr %120, align 8, !tbaa !9
  %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 !9
  %124 = getelementptr inbounds i8, ptr %123, i64 21
  %125 = call ptr @strrchr(ptr noundef %124, i32 noundef 47) #7
  %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 !9
  %131 = getelementptr inbounds i8, ptr %130, i64 21
  %132 = call ptr @strrchr(ptr noundef %131, i32 noundef 47) #7
  %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 !9
  %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 !11
  %143 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %143, align 4, !tbaa !12
  %144 = call i32 @s2n_calculate_stacktrace()
  br label %145

145:                                              ; preds = %139
  br label %146

146:                                              ; preds = %145
  %147 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %147, align 4, !tbaa !14
  store i32 1, ptr %6, align 4
  br label %197

148:                                              ; No predecessors!
  br label %149

149:                                              ; preds = %148
  br label %150

150:                                              ; preds = %149, %106
  br label %151

151:                                              ; preds = %150
  br label %152

152:                                              ; preds = %151
  br label %153

153:                                              ; preds = %152
  %154 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %4, i32 0, i32 1
  %155 = load i32, ptr %154, align 8, !tbaa !21
  %156 = getelementptr inbounds %struct.s2n_stuffer, ptr %7, i32 0, i32 1
  %157 = load i32, ptr %156, align 8, !tbaa !26
  %158 = icmp uge i32 %155, %157
  br i1 %158, label %193, label %159

159:                                              ; preds = %153
  br label %160

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160
  %162 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %163 = getelementptr inbounds %struct.s2n_debug_info, ptr %162, i32 0, i32 0
  store ptr @.str.8, ptr %163, align 8, !tbaa !9
  %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 0
  %166 = load ptr, ptr %165, align 8, !tbaa !9
  %167 = getelementptr inbounds i8, ptr %166, i64 21
  %168 = call ptr @strrchr(ptr noundef %167, i32 noundef 47) #7
  %169 = icmp ne ptr %168, null
  br i1 %169, label %170, label %177

170:                                              ; preds = %161
  %171 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %172 = getelementptr inbounds %struct.s2n_debug_info, ptr %171, i32 0, i32 0
  %173 = load ptr, ptr %172, align 8, !tbaa !9
  %174 = getelementptr inbounds i8, ptr %173, i64 21
  %175 = call ptr @strrchr(ptr noundef %174, i32 noundef 47) #7
  %176 = getelementptr inbounds i8, ptr %175, i64 1
  br label %182

177:                                              ; preds = %161
  %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 0
  %180 = load ptr, ptr %179, align 8, !tbaa !9
  %181 = getelementptr inbounds i8, ptr %180, i64 21
  br label %182

182:                                              ; preds = %177, %170
  %183 = phi ptr [ %176, %170 ], [ %181, %177 ]
  %184 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %185 = getelementptr inbounds %struct.s2n_debug_info, ptr %184, i32 0, i32 1
  store ptr %183, ptr %185, align 8, !tbaa !11
  %186 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %186, align 4, !tbaa !12
  %187 = call i32 @s2n_calculate_stacktrace()
  br label %188

188:                                              ; preds = %182
  br label %189

189:                                              ; preds = %188
  %190 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 -1, ptr %190, align 4, !tbaa !14
  store i32 1, ptr %6, align 4
  br label %197

191:                                              ; No predecessors!
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192, %153
  br label %194

194:                                              ; preds = %193
  br label %195

195:                                              ; preds = %194
  %196 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  store i32 0, ptr %196, align 4, !tbaa !14
  store i32 1, ptr %6, align 4
  br label %197

197:                                              ; preds = %195, %189, %146, %99
  call void @llvm.lifetime.end.p0(i64 40, ptr %7) #8
  br label %198

198:                                              ; preds = %197, %54
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #8
  br label %199

199:                                              ; preds = %198, %40
  %200 = getelementptr inbounds %struct.s2n_result, ptr %2, i32 0, i32 0
  %201 = load i32, ptr %200, align 4
  ret i32 %201
}

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

; 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) #6

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { "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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 0}
!15 = !{!"", !13, i64 0}
!16 = !{i64 0, i64 8, !5, i64 8, i64 4, !12, i64 12, i64 1, !17}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !6, i64 0}
!19 = !{!"s2n_stuffer_reservation", !6, i64 0, !13, i64 8, !7, i64 12}
!20 = !{i64 0, i64 8, !5, i64 8, i64 4, !12, i64 12, i64 4, !12, i64 16, i64 1, !17, i64 24, i64 4, !12, i64 28, i64 4, !12, i64 32, i64 4, !12, i64 36, i64 1, !17}
!21 = !{!19, !13, i64 8}
!22 = !{!19, !7, i64 12}
!23 = !{!24, !13, i64 28}
!24 = !{!"s2n_stuffer", !25, i64 0, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 36, !13, i64 36}
!25 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!26 = !{!24, !13, 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 }

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

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

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_stuffer_reservation_validate(ptr noundef readonly %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %.sink.split, label %2

2:                                                ; preds = %1
  %.sroa.02.0.copyload = load ptr, ptr %0, align 8, !tbaa !5
  %.sroa.54.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 8
  %.sroa.54.0.copyload = load i32, ptr %.sroa.54.0..sroa_idx, align 8, !tbaa !9
  %.sroa.8.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 12
  %.sroa.8.0.copyload = load i8, ptr %.sroa.8.0..sroa_idx, align 4, !tbaa !11
  %3 = tail call i32 @s2n_stuffer_validate(ptr noundef %.sroa.02.0.copyload)
  %4 = tail call zeroext i1 @s2n_result_is_ok(i32 %3)
  br i1 %4, label %5, label %18

5:                                                ; preds = %2
  %.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %.sroa.02.0.copyload, i64 24
  %.sroa.3.0.copyload = load i32, ptr %.sroa.3.0..sroa_idx, align 8, !tbaa !9
  %6 = zext i8 %.sroa.8.0.copyload to i32
  %7 = xor i32 %6, -1
  %.not15 = icmp ugt i32 %.sroa.54.0.copyload, %7
  br i1 %.not15, label %.sink.split, label %8

8:                                                ; preds = %5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %.sroa.02.0.copyload, i64 28
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !9
  %9 = add i32 %.sroa.54.0.copyload, %6
  %.not17 = icmp ugt i32 %9, %.sroa.4.0.copyload
  br i1 %.not17, label %.sink.split, label %10

10:                                               ; preds = %8
  %.not19 = icmp ult i32 %.sroa.54.0.copyload, %.sroa.3.0.copyload
  br i1 %.not19, label %.sink.split, label %18

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

18:                                               ; preds = %.sink.split, %2, %10
  %.sroa.09.2 = phi i32 [ -1, %2 ], [ 0, %10 ], [ -1, %.sink.split ]
  ret i32 %.sroa.09.2
}

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { "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 = { 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 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, !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 = !{!7, !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!14 = !{!13, !6, i64 8}


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