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

; 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.3 = external hidden unnamed_addr constant [105 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [105 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

declare i32 @s2n_stuffer_skip_write(ptr noundef, i32 noundef) #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

declare i32 @s2n_stuffer_validate(ptr noundef) #2

; 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_stuffer_reserve(ptr noundef %0, ptr noundef %1, i8 noundef zeroext %2) #6 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca %struct.s2n_result, align 4
  %9 = alloca %struct.s2n_result, align 4
  %10 = alloca %struct.s2n_stuffer_reservation, align 8
  %11 = alloca i8, align 1
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %struct.s2n_result, align 4
  %15 = 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 i8 %2, ptr %7, align 1, !tbaa !9
  br label %16

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

29:                                               ; preds = %16
  %30 = getelementptr inbounds %struct.s2n_result, ptr %8, i32 0, i32 0
  store i32 0, ptr %30, align 4, !tbaa !10
  br label %33

31:                                               ; preds = %16
  %32 = getelementptr inbounds %struct.s2n_result, ptr %8, i32 0, i32 0
  store i32 -1, ptr %32, align 4, !tbaa !10
  br label %33

33:                                               ; preds = %31, %29
  %34 = getelementptr inbounds %struct.s2n_result, ptr %8, i32 0, i32 0
  %35 = load i32, ptr %34, align 4
  %36 = call zeroext i1 @s2n_result_is_ok(i32 %35)
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 -1, ptr %4, align 4
  br label %192

38:                                               ; preds = %33
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %74, label %43

43:                                               ; preds = %40
  br label %44

44:                                               ; preds = %43
  br label %45

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

54:                                               ; preds = %45
  %55 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %56 = getelementptr inbounds %struct.s2n_debug_info, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !13
  %58 = getelementptr inbounds i8, ptr %57, i64 21
  %59 = call ptr @strrchr(ptr noundef %58, i32 noundef 47) #9
  %60 = getelementptr inbounds i8, ptr %59, i64 1
  br label %66

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

66:                                               ; preds = %61, %54
  %67 = phi ptr [ %60, %54 ], [ %65, %61 ]
  %68 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %69 = getelementptr inbounds %struct.s2n_debug_info, ptr %68, i32 0, i32 1
  store ptr %67, ptr %69, align 8, !tbaa !15
  %70 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %70, align 4, !tbaa !16
  %71 = call i32 @s2n_calculate_stacktrace()
  br label %72

72:                                               ; preds = %66
  store i32 -1, ptr %4, align 4
  br label %192

73:                                               ; No predecessors!
  br label %74

74:                                               ; preds = %73, %40
  br label %75

75:                                               ; preds = %74
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %10, i32 0, i32 0
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %78, ptr %77, align 8, !tbaa !17
  %79 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %10, i32 0, i32 1
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.s2n_stuffer, ptr %80, i32 0, i32 2
  %82 = load i32, ptr %81, align 4, !tbaa !19
  store i32 %82, ptr %79, align 8, !tbaa !22
  %83 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %10, i32 0, i32 2
  %84 = load i8, ptr %7, align 1, !tbaa !9
  store i8 %84, ptr %83, align 4, !tbaa !23
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %76, ptr align 8 %10, i64 16, i1 false), !tbaa.struct !24
  br label %85

85:                                               ; preds = %75
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %87, i32 0, i32 2
  %89 = load i8, ptr %88, align 4, !tbaa !23
  %90 = zext i8 %89 to i32
  %91 = call i32 @s2n_stuffer_skip_write(ptr noundef %86, i32 noundef %90)
  %92 = icmp sgt i32 %91, -1
  br i1 %92, label %94, label %93

93:                                               ; preds = %85
  store i32 -1, ptr %4, align 4
  br label %192

94:                                               ; preds = %85
  br label %95

95:                                               ; preds = %94
  br label %96

96:                                               ; preds = %95
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #10
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %97, i32 0, i32 2
  %99 = load i8, ptr %98, align 4, !tbaa !23
  store i8 %99, ptr %11, align 1, !tbaa !9
  %100 = load i8, ptr %11, align 1, !tbaa !9
  %101 = icmp ne i8 %100, 0
  %102 = xor i1 %101, true
  %103 = xor i1 %102, true
  %104 = zext i1 %103 to i32
  %105 = sext i32 %104 to i64
  %106 = call i64 @llvm.expect.i64(i64 %105, i64 1)
  %107 = icmp ne i64 %106, 0
  br i1 %107, label %108, label %163

108:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #10
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.s2n_stuffer, ptr %109, i32 0, i32 0
  %111 = getelementptr inbounds %struct.s2n_blob, ptr %110, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8, !tbaa !25
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.s2n_stuffer_reservation, ptr %113, i32 0, i32 1
  %115 = load i32, ptr %114, align 8, !tbaa !22
  %116 = zext i32 %115 to i64
  %117 = getelementptr inbounds i8, ptr %112, i64 %116
  store ptr %117, ptr %12, align 8, !tbaa !5
  br label %118

118:                                              ; preds = %108
  %119 = load ptr, ptr %12, align 8, !tbaa !5
  %120 = icmp ne ptr %119, null
  br i1 %120, label %154, label %121

121:                                              ; preds = %118
  br label %122

122:                                              ; preds = %121
  br label %123

123:                                              ; preds = %122
  %124 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %125 = getelementptr inbounds %struct.s2n_debug_info, ptr %124, i32 0, i32 0
  store ptr @.str.4, ptr %125, align 8, !tbaa !13
  %126 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %127 = getelementptr inbounds %struct.s2n_debug_info, ptr %126, i32 0, i32 0
  %128 = load ptr, ptr %127, align 8, !tbaa !13
  %129 = getelementptr inbounds i8, ptr %128, i64 21
  %130 = call ptr @strrchr(ptr noundef %129, i32 noundef 47) #9
  %131 = icmp ne ptr %130, null
  br i1 %131, label %132, label %139

132:                                              ; preds = %123
  %133 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %134 = getelementptr inbounds %struct.s2n_debug_info, ptr %133, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !13
  %136 = getelementptr inbounds i8, ptr %135, i64 21
  %137 = call ptr @strrchr(ptr noundef %136, i32 noundef 47) #9
  %138 = getelementptr inbounds i8, ptr %137, i64 1
  br label %144

139:                                              ; preds = %123
  %140 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %141 = getelementptr inbounds %struct.s2n_debug_info, ptr %140, i32 0, i32 0
  %142 = load ptr, ptr %141, align 8, !tbaa !13
  %143 = getelementptr inbounds i8, ptr %142, i64 21
  br label %144

144:                                              ; preds = %139, %132
  %145 = phi ptr [ %138, %132 ], [ %143, %139 ]
  %146 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %147 = getelementptr inbounds %struct.s2n_debug_info, ptr %146, i32 0, i32 1
  store ptr %145, ptr %147, align 8, !tbaa !15
  %148 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %148, align 4, !tbaa !16
  %149 = call i32 @s2n_calculate_stacktrace()
  br label %150

150:                                              ; preds = %144
  br label %151

151:                                              ; preds = %150
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %160

152:                                              ; No predecessors!
  br label %153

153:                                              ; preds = %152
  br label %154

154:                                              ; preds = %153, %118
  br label %155

155:                                              ; preds = %154
  br label %156

156:                                              ; preds = %155
  %157 = load ptr, ptr %12, align 8, !tbaa !5
  %158 = load i8, ptr %11, align 1, !tbaa !9
  %159 = zext i8 %158 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %157, i8 119, i64 %159, i1 false)
  store i32 0, ptr %13, align 4
  br label %160

160:                                              ; preds = %156, %151
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #10
  %161 = load i32, ptr %13, align 4
  switch i32 %161, label %164 [
    i32 0, label %162
  ]

162:                                              ; preds = %160
  br label %163

163:                                              ; preds = %162, %96
  store i32 0, ptr %13, align 4
  br label %164

164:                                              ; preds = %163, %160
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #10
  %165 = load i32, ptr %13, align 4
  switch i32 %165, label %194 [
    i32 0, label %166
    i32 1, label %192
  ]

166:                                              ; preds = %164
  br label %167

167:                                              ; preds = %166
  br label %168

168:                                              ; preds = %167
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = call i32 @s2n_stuffer_reservation_validate(ptr noundef %169)
  %171 = getelementptr inbounds %struct.s2n_result, ptr %15, i32 0, i32 0
  store i32 %170, ptr %171, align 4
  %172 = getelementptr inbounds %struct.s2n_result, ptr %15, i32 0, i32 0
  %173 = load i32, ptr %172, align 4
  %174 = call zeroext i1 @s2n_result_is_ok(i32 %173)
  %175 = xor i1 %174, true
  %176 = xor i1 %175, true
  %177 = zext i1 %176 to i32
  %178 = sext i32 %177 to i64
  %179 = call i64 @llvm.expect.i64(i64 %178, i64 1)
  %180 = icmp ne i64 %179, 0
  br i1 %180, label %181, label %183

181:                                              ; preds = %168
  %182 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  store i32 0, ptr %182, align 4, !tbaa !10
  br label %185

183:                                              ; preds = %168
  %184 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  store i32 -1, ptr %184, align 4, !tbaa !10
  br label %185

185:                                              ; preds = %183, %181
  %186 = getelementptr inbounds %struct.s2n_result, ptr %14, i32 0, i32 0
  %187 = load i32, ptr %186, align 4
  %188 = call zeroext i1 @s2n_result_is_ok(i32 %187)
  br i1 %188, label %190, label %189

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

190:                                              ; preds = %185
  br label %191

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

192:                                              ; preds = %191, %189, %164, %93, %72, %37
  %193 = load i32, ptr %4, align 4
  ret i32 %193

194:                                              ; preds = %164
  unreachable
}

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

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

declare i32 @s2n_stuffer_reservation_validate(ptr 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 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #6 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !12, i64 0}
!11 = !{!"", !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!15 = !{!14, !6, i64 8}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"s2n_stuffer_reservation", !6, i64 0, !12, i64 8, !7, i64 12}
!19 = !{!20, !12, i64 28}
!20 = !{!"s2n_stuffer", !21, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!21 = !{!"s2n_blob", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!22 = !{!18, !12, i64 8}
!23 = !{!18, !7, i64 12}
!24 = !{i64 0, i64 8, !5, i64 8, i64 4, !16, i64 12, i64 1, !9}
!25 = !{!20, !6, 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.3 = external hidden unnamed_addr constant [105 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [105 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

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

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

declare i32 @s2n_stuffer_validate(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_stuffer_reserve(ptr noundef %0, ptr noundef %1, i8 noundef zeroext %2) local_unnamed_addr #4 {
  %4 = tail call i32 @s2n_stuffer_validate(ptr noundef %0) #6
  %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 %43

7:                                                ; preds = %3
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %8, label %16

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

16:                                               ; preds = %7
  %17 = getelementptr inbounds i8, ptr %0, i64 28
  %18 = load i32, ptr %17, align 4, !tbaa !13
  store ptr %0, ptr %1, align 8, !tbaa !16
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  store i32 %18, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !11
  %.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 12
  store i8 %2, ptr %.sroa.3.0..sroa_idx, align 4, !tbaa !17
  %19 = zext i8 %2 to i32
  %20 = tail call i32 @s2n_stuffer_skip_write(ptr noundef %0, i32 noundef %19) #6
  %21 = icmp sgt i32 %20, -1
  br i1 %21, label %22, label %43

22:                                               ; preds = %16
  %23 = load i8, ptr %.sroa.3.0..sroa_idx, align 4, !tbaa !18
  %.not29 = icmp eq i8 %23, 0
  br i1 %.not29, label %39, label %24, !prof !20

24:                                               ; preds = %22
  %25 = load ptr, ptr %0, align 8, !tbaa !21
  %.not30.not = icmp eq ptr %25, null
  br i1 %.not30.not, label %31, label %26

26:                                               ; preds = %24
  %27 = load i32, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !22
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds i8, ptr %25, i64 %28
  %30 = zext i8 %23 to i64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 %29, i8 119, i64 %30, i1 false)
  br label %39

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

39:                                               ; preds = %26, %22
  %40 = tail call i32 @s2n_stuffer_reservation_validate(ptr noundef nonnull %1) #6
  %41 = tail call zeroext i1 @s2n_result_is_ok(i32 %40)
  %not.36 = xor i1 %41, true
  %.32 = sext i1 %not.36 to i32
  %42 = tail call zeroext i1 @s2n_result_is_ok(i32 %.32)
  %not.37 = xor i1 %42, true
  %spec.select = sext i1 %not.37 to i32
  br label %43

43:                                               ; preds = %31, %39, %16, %3, %8
  %.3 = phi i32 [ -1, %31 ], [ -1, %8 ], [ -1, %3 ], [ -1, %16 ], [ %spec.select, %39 ]
  ret i32 %.3
}

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

declare i32 @s2n_stuffer_reservation_validate(ptr 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { 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_debug_info", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!14, !12, i64 28}
!14 = !{!"s2n_stuffer", !15, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!15 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!16 = !{!7, !7, i64 0}
!17 = !{!8, !8, i64 0}
!18 = !{!19, !8, i64 12}
!19 = !{!"s2n_stuffer_reservation", !7, i64 0, !12, i64 8, !8, i64 12}
!20 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!21 = !{!14, !7, i64 0}
!22 = !{!19, !12, i64 8}


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