; 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_blob = type { ptr, i32, i32, i8 }
%struct.s2n_stuffer = type { %struct.s2n_blob, i32, 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.22 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [92 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(none)
declare i64 @llvm.expect.i64(i64, i64) #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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_stuffer_skip_read(ptr noundef, i32 noundef) #6

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_stuffer_erase_and_read(ptr noundef %0, ptr noundef %1) #6 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  br label %12

12:                                               ; preds = %2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.s2n_blob, ptr %14, i32 0, i32 1
  %16 = load i32, ptr %15, align 8, !tbaa !9
  %17 = call i32 @s2n_stuffer_skip_read(ptr noundef %13, i32 noundef %16)
  %18 = icmp sgt i32 %17, -1
  br i1 %18, label %20, label %19

19:                                               ; preds = %12
  store i32 -1, ptr %3, align 4
  br label %224

20:                                               ; preds = %12
  br label %21

21:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.s2n_stuffer, ptr %22, i32 0, i32 0
  %24 = getelementptr inbounds %struct.s2n_blob, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !12
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %43

27:                                               ; preds = %21
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.s2n_stuffer, ptr %28, i32 0, i32 0
  %30 = getelementptr inbounds %struct.s2n_blob, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !12
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.s2n_stuffer, ptr %32, i32 0, i32 1
  %34 = load i32, ptr %33, align 8, !tbaa !14
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds i8, ptr %31, i64 %35
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.s2n_blob, ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 8, !tbaa !9
  %40 = zext i32 %39 to i64
  %41 = sub i64 0, %40
  %42 = getelementptr inbounds i8, ptr %36, i64 %41
  br label %44

43:                                               ; preds = %21
  br label %44

44:                                               ; preds = %43, %27
  %45 = phi ptr [ %42, %27 ], [ null, %43 ]
  store ptr %45, ptr %6, align 8, !tbaa !5
  br label %46

46:                                               ; preds = %44
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.s2n_blob, ptr %47, i32 0, i32 1
  %49 = load i32, ptr %48, align 8, !tbaa !9
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %87, label %51

51:                                               ; preds = %46
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = icmp ne ptr %52, null
  br i1 %53, label %87, label %54

54:                                               ; preds = %51
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  %57 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %58 = getelementptr inbounds %struct.s2n_debug_info, ptr %57, i32 0, i32 0
  store ptr @.str.22, ptr %58, align 8, !tbaa !15
  %59 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %60 = getelementptr inbounds %struct.s2n_debug_info, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !15
  %62 = getelementptr inbounds i8, ptr %61, i64 21
  %63 = call ptr @strrchr(ptr noundef %62, i32 noundef 47) #8
  %64 = icmp ne ptr %63, null
  br i1 %64, label %65, label %72

65:                                               ; preds = %56
  %66 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %67 = getelementptr inbounds %struct.s2n_debug_info, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !15
  %69 = getelementptr inbounds i8, ptr %68, i64 21
  %70 = call ptr @strrchr(ptr noundef %69, i32 noundef 47) #8
  %71 = getelementptr inbounds i8, ptr %70, i64 1
  br label %77

72:                                               ; preds = %56
  %73 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %74 = getelementptr inbounds %struct.s2n_debug_info, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !15
  %76 = getelementptr inbounds i8, ptr %75, i64 21
  br label %77

77:                                               ; preds = %72, %65
  %78 = phi ptr [ %71, %65 ], [ %76, %72 ]
  %79 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %80 = getelementptr inbounds %struct.s2n_debug_info, ptr %79, i32 0, i32 1
  store ptr %78, ptr %80, align 8, !tbaa !17
  %81 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %81, align 4, !tbaa !18
  %82 = call i32 @s2n_calculate_stacktrace()
  br label %83

83:                                               ; preds = %77
  br label %84

84:                                               ; preds = %83
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %223

85:                                               ; No predecessors!
  br label %86

86:                                               ; preds = %85
  br label %87

87:                                               ; preds = %86, %51, %46
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  br label %90

90:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.s2n_blob, ptr %91, i32 0, i32 1
  %93 = load i32, ptr %92, align 8, !tbaa !9
  store i32 %93, ptr %8, align 4, !tbaa !18
  %94 = load i32, ptr %8, align 4, !tbaa !18
  %95 = icmp ne i32 %94, 0
  %96 = xor i1 %95, true
  %97 = xor i1 %96, true
  %98 = zext i1 %97 to i32
  %99 = sext i32 %98 to i64
  %100 = call i64 @llvm.expect.i64(i64 %99, i64 1)
  %101 = icmp ne i64 %100, 0
  br i1 %101, label %102, label %152

102:                                              ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.s2n_blob, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !19
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = load i32, ptr %8, align 4, !tbaa !18
  %108 = zext i32 %107 to i64
  %109 = call ptr @s2n_ensure_memmove_trace(ptr noundef %105, ptr noundef %106, i64 noundef %108)
  store ptr %109, ptr %9, align 8, !tbaa !5
  br label %110

110:                                              ; preds = %102
  %111 = load ptr, ptr %9, align 8, !tbaa !5
  %112 = icmp ne ptr %111, null
  br i1 %112, label %146, label %113

113:                                              ; preds = %110
  br label %114

114:                                              ; preds = %113
  br label %115

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

124:                                              ; preds = %115
  %125 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %126 = getelementptr inbounds %struct.s2n_debug_info, ptr %125, i32 0, i32 0
  %127 = load ptr, ptr %126, align 8, !tbaa !15
  %128 = getelementptr inbounds i8, ptr %127, i64 21
  %129 = call ptr @strrchr(ptr noundef %128, i32 noundef 47) #8
  %130 = getelementptr inbounds i8, ptr %129, i64 1
  br label %136

131:                                              ; preds = %115
  %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 0
  %134 = load ptr, ptr %133, align 8, !tbaa !15
  %135 = getelementptr inbounds i8, ptr %134, i64 21
  br label %136

136:                                              ; preds = %131, %124
  %137 = phi ptr [ %130, %124 ], [ %135, %131 ]
  %138 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %139 = getelementptr inbounds %struct.s2n_debug_info, ptr %138, i32 0, i32 1
  store ptr %137, ptr %139, align 8, !tbaa !17
  %140 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %140, align 4, !tbaa !18
  %141 = call i32 @s2n_calculate_stacktrace()
  br label %142

142:                                              ; preds = %136
  br label %143

143:                                              ; preds = %142
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %149

144:                                              ; No predecessors!
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145, %110
  br label %147

147:                                              ; preds = %146
  br label %148

148:                                              ; preds = %147
  store i32 0, ptr %7, align 4
  br label %149

149:                                              ; preds = %148, %143
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  %150 = load i32, ptr %7, align 4
  switch i32 %150, label %153 [
    i32 0, label %151
  ]

151:                                              ; preds = %149
  br label %152

152:                                              ; preds = %151, %90
  store i32 0, ptr %7, align 4
  br label %153

153:                                              ; preds = %152, %149
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  %154 = load i32, ptr %7, align 4
  switch i32 %154, label %223 [
    i32 0, label %155
  ]

155:                                              ; preds = %153
  br label %156

156:                                              ; preds = %155
  br label %157

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %159 = load ptr, ptr %5, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.s2n_blob, ptr %159, i32 0, i32 1
  %161 = load i32, ptr %160, align 8, !tbaa !9
  store i32 %161, ptr %10, align 4, !tbaa !18
  %162 = load i32, ptr %10, align 4, !tbaa !18
  %163 = icmp ne i32 %162, 0
  %164 = xor i1 %163, true
  %165 = xor i1 %164, true
  %166 = zext i1 %165 to i32
  %167 = sext i32 %166 to i64
  %168 = call i64 @llvm.expect.i64(i64 %167, i64 1)
  %169 = icmp ne i64 %168, 0
  br i1 %169, label %170, label %217

170:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %171 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %171, ptr %11, align 8, !tbaa !5
  br label %172

172:                                              ; preds = %170
  %173 = load ptr, ptr %11, align 8, !tbaa !5
  %174 = icmp ne ptr %173, null
  br i1 %174, label %208, label %175

175:                                              ; preds = %172
  br label %176

176:                                              ; preds = %175
  br label %177

177:                                              ; preds = %176
  %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
  store ptr @.str.24, ptr %179, align 8, !tbaa !15
  %180 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %181 = getelementptr inbounds %struct.s2n_debug_info, ptr %180, i32 0, i32 0
  %182 = load ptr, ptr %181, align 8, !tbaa !15
  %183 = getelementptr inbounds i8, ptr %182, i64 21
  %184 = call ptr @strrchr(ptr noundef %183, i32 noundef 47) #8
  %185 = icmp ne ptr %184, null
  br i1 %185, label %186, label %193

186:                                              ; preds = %177
  %187 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %188 = getelementptr inbounds %struct.s2n_debug_info, ptr %187, i32 0, i32 0
  %189 = load ptr, ptr %188, align 8, !tbaa !15
  %190 = getelementptr inbounds i8, ptr %189, i64 21
  %191 = call ptr @strrchr(ptr noundef %190, i32 noundef 47) #8
  %192 = getelementptr inbounds i8, ptr %191, i64 1
  br label %198

193:                                              ; preds = %177
  %194 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %195 = getelementptr inbounds %struct.s2n_debug_info, ptr %194, i32 0, i32 0
  %196 = load ptr, ptr %195, align 8, !tbaa !15
  %197 = getelementptr inbounds i8, ptr %196, i64 21
  br label %198

198:                                              ; preds = %193, %186
  %199 = phi ptr [ %192, %186 ], [ %197, %193 ]
  %200 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %201 = getelementptr inbounds %struct.s2n_debug_info, ptr %200, i32 0, i32 1
  store ptr %199, ptr %201, align 8, !tbaa !17
  %202 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %202, align 4, !tbaa !18
  %203 = call i32 @s2n_calculate_stacktrace()
  br label %204

204:                                              ; preds = %198
  br label %205

205:                                              ; preds = %204
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %214

206:                                              ; No predecessors!
  br label %207

207:                                              ; preds = %206
  br label %208

208:                                              ; preds = %207, %172
  br label %209

209:                                              ; preds = %208
  br label %210

210:                                              ; preds = %209
  %211 = load ptr, ptr %11, align 8, !tbaa !5
  %212 = load i32, ptr %10, align 4, !tbaa !18
  %213 = zext i32 %212 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %211, i8 0, i64 %213, i1 false)
  store i32 0, ptr %7, align 4
  br label %214

214:                                              ; preds = %210, %205
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  %215 = load i32, ptr %7, align 4
  switch i32 %215, label %218 [
    i32 0, label %216
  ]

216:                                              ; preds = %214
  br label %217

217:                                              ; preds = %216, %158
  store i32 0, ptr %7, align 4
  br label %218

218:                                              ; preds = %217, %214
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %219 = load i32, ptr %7, align 4
  switch i32 %219, label %223 [
    i32 0, label %220
  ]

220:                                              ; preds = %218
  br label %221

221:                                              ; preds = %220
  br label %222

222:                                              ; preds = %221
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %223

223:                                              ; preds = %222, %218, %153, %84
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %224

224:                                              ; preds = %223, %19
  %225 = load i32, ptr %3, align 4
  ret i32 %225
}

declare ptr @s2n_ensure_memmove_trace(ptr noundef, ptr noundef, i64 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(none) }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_stuffer_erase_and_read(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #4 {
  %3 = getelementptr inbounds i8, ptr %1, i64 8
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = tail call i32 @s2n_stuffer_skip_read(ptr noundef %0, i32 noundef %4)
  %6 = icmp sgt i32 %5, -1
  br i1 %6, label %7, label %.critedge45.thread

7:                                                ; preds = %2
  %8 = load ptr, ptr %0, align 8, !tbaa !11
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %thread-pre-split, label %9

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = load i32, ptr %10, align 8, !tbaa !13
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds i8, ptr %8, i64 %12
  %14 = load i32, ptr %3, align 8, !tbaa !5
  %15 = zext i32 %14 to i64
  %16 = sub nsw i64 0, %15
  %17 = getelementptr inbounds i8, ptr %13, i64 %16
  br label %18

thread-pre-split:                                 ; preds = %7
  %.pr = load i32, ptr %3, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %thread-pre-split, %9
  %19 = phi i32 [ %.pr, %thread-pre-split ], [ %14, %9 ]
  %20 = phi ptr [ null, %thread-pre-split ], [ %17, %9 ]
  %21 = icmp eq i32 %19, 0
  %22 = icmp ne ptr %20, null
  %or.cond = select i1 %21, i1 true, i1 %22
  br i1 %or.cond, label %31, label %23

23:                                               ; preds = %18
  %24 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.22, ptr %24, align 8, !tbaa !14
  %25 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.22, i64 21), i32 noundef 47) #5
  %.not38 = icmp eq ptr %25, null
  %26 = getelementptr inbounds i8, ptr %25, i64 1
  %27 = select i1 %.not38, ptr getelementptr inbounds (i8, ptr @.str.22, i64 21), ptr %26
  %28 = getelementptr inbounds i8, ptr %24, i64 8
  store ptr %27, ptr %28, align 8, !tbaa !16
  %29 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %29, align 4, !tbaa !17
  %30 = tail call i32 @s2n_calculate_stacktrace() #6
  br label %.critedge45.thread

31:                                               ; preds = %18
  br i1 %21, label %.critedge45.thread, label %32, !prof !18

32:                                               ; preds = %31
  %33 = load ptr, ptr %1, align 8, !tbaa !19
  %34 = zext i32 %19 to i64
  %35 = tail call ptr @s2n_ensure_memmove_trace(ptr noundef %33, ptr noundef %20, i64 noundef %34) #6
  %.not40.not = icmp eq ptr %35, null
  br i1 %.not40.not, label %36, label %.critedge45

36:                                               ; preds = %32
  %37 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.23, ptr %37, align 8, !tbaa !14
  %38 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.23, i64 21), i32 noundef 47) #5
  %.not41 = icmp eq ptr %38, null
  %39 = getelementptr inbounds i8, ptr %38, i64 1
  %40 = select i1 %.not41, ptr getelementptr inbounds (i8, ptr @.str.23, i64 21), ptr %39
  %41 = getelementptr inbounds i8, ptr %37, i64 8
  store ptr %40, ptr %41, align 8, !tbaa !16
  %42 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %42, align 4, !tbaa !17
  %43 = tail call i32 @s2n_calculate_stacktrace() #6
  br label %.critedge45.thread

.critedge45:                                      ; preds = %32
  %.pre = load i32, ptr %3, align 8, !tbaa !5
  %.not42 = icmp eq i32 %.pre, 0
  br i1 %.not42, label %.critedge45.thread, label %44, !prof !20

44:                                               ; preds = %.critedge45
  br i1 %22, label %.thread, label %46

.thread:                                          ; preds = %44
  %45 = zext i32 %.pre to i64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 %20, i8 0, i64 %45, i1 false)
  br label %.critedge45.thread

46:                                               ; preds = %44
  %47 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.24, ptr %47, align 8, !tbaa !14
  %48 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.24, i64 21), i32 noundef 47) #5
  %.not43 = icmp eq ptr %48, null
  %49 = getelementptr inbounds i8, ptr %48, i64 1
  %50 = select i1 %.not43, ptr getelementptr inbounds (i8, ptr @.str.24, i64 21), ptr %49
  %51 = getelementptr inbounds i8, ptr %47, i64 8
  store ptr %50, ptr %51, align 8, !tbaa !16
  %52 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %52, align 4, !tbaa !17
  %53 = tail call i32 @s2n_calculate_stacktrace() #6
  br label %.critedge45.thread

.critedge45.thread:                               ; preds = %31, %46, %.thread, %.critedge45, %36, %23, %2
  %.7 = phi i32 [ -1, %2 ], [ -1, %23 ], [ -1, %36 ], [ -1, %46 ], [ 0, %.thread ], [ 0, %.critedge45 ], [ 0, %31 ]
  ret i32 %.7
}

declare ptr @s2n_ensure_memmove_trace(ptr noundef, ptr noundef, i64 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind willreturn memory(read) }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 8}
!6 = !{!"s2n_blob", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"s2n_stuffer", !6, i64 0, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 36, !10, i64 36}
!13 = !{!12, !10, i64 24}
!14 = !{!15, !7, i64 0}
!15 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!16 = !{!15, !7, i64 8}
!17 = !{!10, !10, i64 0}
!18 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!19 = !{!6, !7, i64 0}
!20 = !{!"branch_weights", !"expected", i32 0, i32 -2147483648}


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