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

@.str = external hidden unnamed_addr constant [105 x i8], align 1
@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.1 = external hidden unnamed_addr constant [105 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [105 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_stuffer_write_network_order(ptr noundef %0, i64 noundef %1, i8 noundef zeroext %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i8, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i8, align 1
  %11 = alloca %struct.s2n_result, align 4
  %12 = alloca %struct.s2n_result, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i8 %2, ptr %7, align 1, !tbaa !11
  %14 = load i8, ptr %7, align 1, !tbaa !11
  %15 = zext i8 %14 to i32
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %3
  store i32 0, ptr %4, align 4
  br label %209

18:                                               ; preds = %3
  br label %19

19:                                               ; preds = %18
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %53, label %22

22:                                               ; preds = %19
  br label %23

23:                                               ; preds = %22
  br label %24

24:                                               ; preds = %23
  %25 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %26 = getelementptr inbounds %struct.s2n_debug_info, ptr %25, i32 0, i32 0
  store ptr @.str, ptr %26, align 8, !tbaa !12
  %27 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %28 = getelementptr inbounds %struct.s2n_debug_info, ptr %27, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8, !tbaa !12
  %30 = getelementptr inbounds i8, ptr %29, i64 21
  %31 = call ptr @strrchr(ptr noundef %30, i32 noundef 47) #7
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %40

33:                                               ; preds = %24
  %34 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %35 = getelementptr inbounds %struct.s2n_debug_info, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !12
  %37 = getelementptr inbounds i8, ptr %36, i64 21
  %38 = call ptr @strrchr(ptr noundef %37, i32 noundef 47) #7
  %39 = getelementptr inbounds i8, ptr %38, i64 1
  br label %45

40:                                               ; preds = %24
  %41 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %42 = getelementptr inbounds %struct.s2n_debug_info, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !12
  %44 = getelementptr inbounds i8, ptr %43, i64 21
  br label %45

45:                                               ; preds = %40, %33
  %46 = phi ptr [ %39, %33 ], [ %44, %40 ]
  %47 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %48 = getelementptr inbounds %struct.s2n_debug_info, ptr %47, i32 0, i32 1
  store ptr %46, ptr %48, align 8, !tbaa !14
  %49 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %49, align 4, !tbaa !15
  %50 = call i32 @s2n_calculate_stacktrace()
  br label %51

51:                                               ; preds = %45
  store i32 -1, ptr %4, align 4
  br label %209

52:                                               ; No predecessors!
  br label %53

53:                                               ; preds = %52, %19
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  %56 = load i8, ptr %7, align 1, !tbaa !11
  %57 = zext i8 %56 to i64
  %58 = icmp ule i64 %57, 8
  br i1 %58, label %90, label %59

59:                                               ; preds = %55
  br label %60

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %60
  %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
  store ptr @.str.1, ptr %63, align 8, !tbaa !12
  %64 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %65 = getelementptr inbounds %struct.s2n_debug_info, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !12
  %67 = getelementptr inbounds i8, ptr %66, i64 21
  %68 = call ptr @strrchr(ptr noundef %67, i32 noundef 47) #7
  %69 = icmp ne ptr %68, null
  br i1 %69, label %70, label %77

70:                                               ; preds = %61
  %71 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %72 = getelementptr inbounds %struct.s2n_debug_info, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !12
  %74 = getelementptr inbounds i8, ptr %73, i64 21
  %75 = call ptr @strrchr(ptr noundef %74, i32 noundef 47) #7
  %76 = getelementptr inbounds i8, ptr %75, i64 1
  br label %82

77:                                               ; preds = %61
  %78 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %79 = getelementptr inbounds %struct.s2n_debug_info, ptr %78, i32 0, i32 0
  %80 = load ptr, ptr %79, align 8, !tbaa !12
  %81 = getelementptr inbounds i8, ptr %80, i64 21
  br label %82

82:                                               ; preds = %77, %70
  %83 = phi ptr [ %76, %70 ], [ %81, %77 ]
  %84 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %85 = getelementptr inbounds %struct.s2n_debug_info, ptr %84, i32 0, i32 1
  store ptr %83, ptr %85, align 8, !tbaa !14
  %86 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %86, align 4, !tbaa !15
  %87 = call i32 @s2n_calculate_stacktrace()
  br label %88

88:                                               ; preds = %82
  store i32 -1, ptr %4, align 4
  br label %209

89:                                               ; No predecessors!
  br label %90

90:                                               ; preds = %89, %55
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = load i8, ptr %7, align 1, !tbaa !11
  %95 = zext i8 %94 to i32
  %96 = call i32 @s2n_stuffer_skip_write(ptr noundef %93, i32 noundef %95)
  %97 = icmp sgt i32 %96, -1
  br i1 %97, label %99, label %98

98:                                               ; preds = %92
  store i32 -1, ptr %4, align 4
  br label %209

99:                                               ; preds = %92
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.s2n_stuffer, ptr %102, i32 0, i32 0
  %104 = getelementptr inbounds %struct.s2n_blob, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !17
  %106 = icmp ne ptr %105, null
  br i1 %106, label %138, label %107

107:                                              ; preds = %101
  br label %108

108:                                              ; preds = %107
  br label %109

109:                                              ; preds = %108
  %110 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %111 = getelementptr inbounds %struct.s2n_debug_info, ptr %110, i32 0, i32 0
  store ptr @.str.2, ptr %111, align 8, !tbaa !12
  %112 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %113 = getelementptr inbounds %struct.s2n_debug_info, ptr %112, i32 0, i32 0
  %114 = load ptr, ptr %113, align 8, !tbaa !12
  %115 = getelementptr inbounds i8, ptr %114, i64 21
  %116 = call ptr @strrchr(ptr noundef %115, i32 noundef 47) #7
  %117 = icmp ne ptr %116, null
  br i1 %117, label %118, label %125

118:                                              ; preds = %109
  %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
  %121 = load ptr, ptr %120, align 8, !tbaa !12
  %122 = getelementptr inbounds i8, ptr %121, i64 21
  %123 = call ptr @strrchr(ptr noundef %122, i32 noundef 47) #7
  %124 = getelementptr inbounds i8, ptr %123, i64 1
  br label %130

125:                                              ; preds = %109
  %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 !12
  %129 = getelementptr inbounds i8, ptr %128, i64 21
  br label %130

130:                                              ; preds = %125, %118
  %131 = phi ptr [ %124, %118 ], [ %129, %125 ]
  %132 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %133 = getelementptr inbounds %struct.s2n_debug_info, ptr %132, i32 0, i32 1
  store ptr %131, ptr %133, align 8, !tbaa !14
  %134 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %134, align 4, !tbaa !15
  %135 = call i32 @s2n_calculate_stacktrace()
  br label %136

136:                                              ; preds = %130
  store i32 -1, ptr %4, align 4
  br label %209

137:                                              ; No predecessors!
  br label %138

138:                                              ; preds = %137, %101
  br label %139

139:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %140 = load ptr, ptr %5, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.s2n_stuffer, ptr %140, i32 0, i32 0
  %142 = getelementptr inbounds %struct.s2n_blob, ptr %141, i32 0, i32 0
  %143 = load ptr, ptr %142, align 8, !tbaa !17
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.s2n_stuffer, ptr %144, i32 0, i32 2
  %146 = load i32, ptr %145, align 4, !tbaa !20
  %147 = zext i32 %146 to i64
  %148 = getelementptr inbounds i8, ptr %143, i64 %147
  %149 = load i8, ptr %7, align 1, !tbaa !11
  %150 = zext i8 %149 to i32
  %151 = sext i32 %150 to i64
  %152 = sub i64 0, %151
  %153 = getelementptr inbounds i8, ptr %148, i64 %152
  store ptr %153, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !15
  br label %154

154:                                              ; preds = %179, %139
  %155 = load i32, ptr %9, align 4, !tbaa !15
  %156 = load i8, ptr %7, align 1, !tbaa !11
  %157 = zext i8 %156 to i32
  %158 = icmp slt i32 %155, %157
  br i1 %158, label %160, label %159

159:                                              ; preds = %154
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %182

160:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #8
  %161 = load i8, ptr %7, align 1, !tbaa !11
  %162 = zext i8 %161 to i32
  %163 = load i32, ptr %9, align 4, !tbaa !15
  %164 = sub nsw i32 %162, %163
  %165 = sub nsw i32 %164, 1
  %166 = mul nsw i32 %165, 8
  %167 = trunc i32 %166 to i8
  store i8 %167, ptr %10, align 1, !tbaa !11
  %168 = load i64, ptr %6, align 8, !tbaa !9
  %169 = load i8, ptr %10, align 1, !tbaa !11
  %170 = zext i8 %169 to i32
  %171 = zext i32 %170 to i64
  %172 = lshr i64 %168, %171
  %173 = and i64 %172, 255
  %174 = trunc i64 %173 to i8
  %175 = load ptr, ptr %8, align 8, !tbaa !5
  %176 = load i32, ptr %9, align 4, !tbaa !15
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds i8, ptr %175, i64 %177
  store i8 %174, ptr %178, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #8
  br label %179

179:                                              ; preds = %160
  %180 = load i32, ptr %9, align 4, !tbaa !15
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %9, align 4, !tbaa !15
  br label %154, !llvm.loop !21

182:                                              ; preds = %159
  br label %183

183:                                              ; preds = %182
  %184 = load ptr, ptr %5, align 8, !tbaa !5
  %185 = call i32 @s2n_stuffer_validate(ptr noundef %184)
  %186 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  store i32 %185, ptr %186, align 4
  %187 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  %188 = load i32, ptr %187, align 4
  %189 = call zeroext i1 @s2n_result_is_ok(i32 %188)
  %190 = xor i1 %189, true
  %191 = xor i1 %190, true
  %192 = zext i1 %191 to i32
  %193 = sext i32 %192 to i64
  %194 = call i64 @llvm.expect.i64(i64 %193, i64 1)
  %195 = icmp ne i64 %194, 0
  br i1 %195, label %196, label %198

196:                                              ; preds = %183
  %197 = getelementptr inbounds %struct.s2n_result, ptr %11, i32 0, i32 0
  store i32 0, ptr %197, align 4, !tbaa !23
  br label %200

198:                                              ; preds = %183
  %199 = getelementptr inbounds %struct.s2n_result, ptr %11, i32 0, i32 0
  store i32 -1, ptr %199, align 4, !tbaa !23
  br label %200

200:                                              ; preds = %198, %196
  %201 = getelementptr inbounds %struct.s2n_result, ptr %11, i32 0, i32 0
  %202 = load i32, ptr %201, align 4
  %203 = call zeroext i1 @s2n_result_is_ok(i32 %202)
  br i1 %203, label %205, label %204

204:                                              ; preds = %200
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %208

205:                                              ; preds = %200
  br label %206

206:                                              ; preds = %205
  br label %207

207:                                              ; preds = %206
  store i32 0, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %208

208:                                              ; preds = %207, %204
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %209

209:                                              ; preds = %208, %136, %98, %88, %51, %17
  %210 = load i32, ptr %4, align 4
  ret i32 %210
}

; 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

declare i32 @s2n_stuffer_skip_write(ptr noundef, i32 noundef) #3

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

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

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

declare i32 @s2n_stuffer_validate(ptr noundef) #3

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind willreturn memory(none) }
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, !10, i64 0}
!10 = !{!"long", !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}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"s2n_stuffer", !19, i64 0, !16, i64 24, !16, i64 28, !16, i64 32, !16, i64 36, !16, i64 36, !16, i64 36}
!19 = !{!"s2n_blob", !6, i64 0, !16, i64 8, !16, i64 12, !16, i64 16}
!20 = !{!18, !16, i64 28}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!24, !16, i64 0}
!24 = !{!"", !16, 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 }

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_stuffer_write_network_order(ptr noundef %0, i64 noundef %1, i8 noundef zeroext %2) local_unnamed_addr #0 {
  %4 = zext i8 %2 to i32
  %5 = icmp eq i8 %2, 0
  br i1 %5, label %104, label %6

6:                                                ; preds = %3
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %7, label %15

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

15:                                               ; preds = %6
  %16 = icmp ult i8 %2, 9
  br i1 %16, label %25, label %17

17:                                               ; preds = %15
  %18 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.1, ptr %18, align 8, !tbaa !5
  %19 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.1, i64 21), i32 noundef 47) #5
  %.not28 = icmp eq ptr %19, null
  %20 = getelementptr inbounds i8, ptr %19, i64 1
  %21 = select i1 %.not28, ptr getelementptr inbounds (i8, ptr @.str.1, i64 21), ptr %20
  %22 = getelementptr inbounds i8, ptr %18, i64 8
  store ptr %21, ptr %22, align 8, !tbaa !10
  %23 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %23, align 4, !tbaa !11
  %24 = tail call i32 @s2n_calculate_stacktrace() #6
  br label %104

25:                                               ; preds = %15
  %26 = tail call i32 @s2n_stuffer_skip_write(ptr noundef nonnull %0, i32 noundef %4) #6
  %27 = icmp sgt i32 %26, -1
  br i1 %27, label %28, label %104

28:                                               ; preds = %25
  %29 = load ptr, ptr %0, align 8, !tbaa !13
  %.not29 = icmp eq ptr %29, null
  br i1 %.not29, label %30, label %vector.ph

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

vector.ph:                                        ; preds = %28
  %38 = getelementptr inbounds i8, ptr %0, i64 28
  %39 = load i32, ptr %38, align 4, !tbaa !16
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds i8, ptr %29, i64 %40
  %42 = zext nneg i8 %2 to i64
  %43 = sub nsw i64 0, %42
  %44 = getelementptr inbounds i8, ptr %41, i64 %43
  %wide.trip.count = zext nneg i8 %2 to i64
  %trip.count.minus.1 = add nsw i64 %wide.trip.count, -1
  %broadcast.splatinsert = insertelement <8 x i64> poison, i64 %trip.count.minus.1, i64 0
  %broadcast.splat = shufflevector <8 x i64> %broadcast.splatinsert, <8 x i64> poison, <8 x i32> zeroinitializer
  %45 = icmp uge <8 x i64> %broadcast.splat, <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7>
  %46 = extractelement <8 x i1> %45, i64 0
  br i1 %46, label %pred.store.if, label %pred.store.continue

pred.store.if:                                    ; preds = %vector.ph
  %47 = shl nuw nsw i8 %2, 3
  %48 = add nsw i8 %47, -8
  %49 = zext nneg i8 %48 to i64
  %50 = lshr i64 %1, %49
  %51 = trunc i64 %50 to i8
  store i8 %51, ptr %44, align 1, !tbaa !17
  br label %pred.store.continue

pred.store.continue:                              ; preds = %pred.store.if, %vector.ph
  %52 = extractelement <8 x i1> %45, i64 1
  br i1 %52, label %pred.store.if34, label %pred.store.continue35

pred.store.if34:                                  ; preds = %pred.store.continue
  %53 = shl nuw nsw i8 %2, 3
  %54 = add nsw i8 %53, -16
  %55 = zext nneg i8 %54 to i64
  %56 = lshr i64 %1, %55
  %57 = getelementptr inbounds i8, ptr %44, i64 1
  %58 = trunc i64 %56 to i8
  store i8 %58, ptr %57, align 1, !tbaa !17
  br label %pred.store.continue35

pred.store.continue35:                            ; preds = %pred.store.if34, %pred.store.continue
  %59 = extractelement <8 x i1> %45, i64 2
  br i1 %59, label %pred.store.if36, label %pred.store.continue37

pred.store.if36:                                  ; preds = %pred.store.continue35
  %60 = shl nuw nsw i8 %2, 3
  %61 = add nsw i8 %60, -24
  %62 = zext nneg i8 %61 to i64
  %63 = lshr i64 %1, %62
  %64 = getelementptr inbounds i8, ptr %44, i64 2
  %65 = trunc i64 %63 to i8
  store i8 %65, ptr %64, align 1, !tbaa !17
  br label %pred.store.continue37

pred.store.continue37:                            ; preds = %pred.store.if36, %pred.store.continue35
  %66 = extractelement <8 x i1> %45, i64 3
  br i1 %66, label %pred.store.if38, label %pred.store.continue39

pred.store.if38:                                  ; preds = %pred.store.continue37
  %67 = shl nuw nsw i8 %2, 3
  %68 = add nsw i8 %67, -32
  %69 = zext nneg i8 %68 to i64
  %70 = lshr i64 %1, %69
  %71 = getelementptr inbounds i8, ptr %44, i64 3
  %72 = trunc i64 %70 to i8
  store i8 %72, ptr %71, align 1, !tbaa !17
  br label %pred.store.continue39

pred.store.continue39:                            ; preds = %pred.store.if38, %pred.store.continue37
  %73 = extractelement <8 x i1> %45, i64 4
  br i1 %73, label %pred.store.if40, label %pred.store.continue41

pred.store.if40:                                  ; preds = %pred.store.continue39
  %74 = shl nuw nsw i8 %2, 3
  %75 = add nsw i8 %74, -40
  %76 = zext nneg i8 %75 to i64
  %77 = lshr i64 %1, %76
  %78 = getelementptr inbounds i8, ptr %44, i64 4
  %79 = trunc i64 %77 to i8
  store i8 %79, ptr %78, align 1, !tbaa !17
  br label %pred.store.continue41

pred.store.continue41:                            ; preds = %pred.store.if40, %pred.store.continue39
  %80 = extractelement <8 x i1> %45, i64 5
  br i1 %80, label %pred.store.if42, label %pred.store.continue43

pred.store.if42:                                  ; preds = %pred.store.continue41
  %81 = shl nuw nsw i8 %2, 3
  %82 = add nsw i8 %81, -48
  %83 = zext nneg i8 %82 to i64
  %84 = lshr i64 %1, %83
  %85 = getelementptr inbounds i8, ptr %44, i64 5
  %86 = trunc i64 %84 to i8
  store i8 %86, ptr %85, align 1, !tbaa !17
  br label %pred.store.continue43

pred.store.continue43:                            ; preds = %pred.store.if42, %pred.store.continue41
  %87 = extractelement <8 x i1> %45, i64 6
  br i1 %87, label %pred.store.if44, label %pred.store.continue45

pred.store.if44:                                  ; preds = %pred.store.continue43
  %88 = shl nuw nsw i8 %2, 3
  %89 = add nsw i8 %88, -56
  %90 = zext nneg i8 %89 to i64
  %91 = lshr i64 %1, %90
  %92 = getelementptr inbounds i8, ptr %44, i64 6
  %93 = trunc i64 %91 to i8
  store i8 %93, ptr %92, align 1, !tbaa !17
  br label %pred.store.continue45

pred.store.continue45:                            ; preds = %pred.store.if44, %pred.store.continue43
  %94 = extractelement <8 x i1> %45, i64 7
  br i1 %94, label %pred.store.if46, label %pred.store.continue47

pred.store.if46:                                  ; preds = %pred.store.continue45
  %95 = shl nuw nsw i8 %2, 3
  %96 = add nsw i8 %95, -64
  %97 = zext nneg i8 %96 to i64
  %98 = lshr i64 %1, %97
  %99 = getelementptr inbounds i8, ptr %44, i64 7
  %100 = trunc i64 %98 to i8
  store i8 %100, ptr %99, align 1, !tbaa !17
  br label %pred.store.continue47

pred.store.continue47:                            ; preds = %pred.store.if46, %pred.store.continue45
  %101 = tail call i32 @s2n_stuffer_validate(ptr noundef nonnull %0) #6
  %102 = tail call zeroext i1 @s2n_result_is_ok(i32 %101)
  %not. = xor i1 %102, true
  %. = sext i1 %not. to i32
  %103 = tail call zeroext i1 @s2n_result_is_ok(i32 %.)
  %not.31 = xor i1 %103, true
  %.0 = sext i1 %not.31 to i32
  br label %104

104:                                              ; preds = %25, %3, %pred.store.continue47, %30, %17, %7
  %.1 = phi i32 [ %.0, %pred.store.continue47 ], [ -1, %30 ], [ -1, %17 ], [ -1, %7 ], [ 0, %3 ], [ -1, %25 ]
  ret i32 %.1
}

; 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

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

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

declare i32 @s2n_stuffer_validate(ptr noundef) local_unnamed_addr #3

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, !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, !7, i64 0}
!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 = !{!14, !12, i64 28}
!17 = !{!8, !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopLoadEliminationPass,LoopRotatePass,LoopUnrollPass,LoopVectorizePass,LowerExpectIntrinsicPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass