; LLVM IR from aws/s2n-tls :: utils (s2n_mem)

; 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 }

@initialized = external hidden global 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.19 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [86 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: nounwind uwtable
declare dso_local i32 @s2n_alloc(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: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #5

declare ptr @s2n_ensure_memmove_trace(ptr noundef, ptr noundef, i64 noundef) #2

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

9:                                                ; preds = %2
  %10 = load i8, ptr @initialized, align 1, !tbaa !9, !range !11, !noundef !12
  %11 = trunc i8 %10 to i1
  br i1 %11, label %43, label %12

12:                                               ; preds = %9
  br label %13

13:                                               ; preds = %12
  br label %14

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

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

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

35:                                               ; preds = %30, %23
  %36 = phi ptr [ %29, %23 ], [ %34, %30 ]
  %37 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %38 = getelementptr inbounds %struct.s2n_debug_info, ptr %37, i32 0, i32 1
  store ptr %36, ptr %38, align 8, !tbaa !15
  %39 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653196, ptr %39, align 4, !tbaa !16
  %40 = call i32 @s2n_calculate_stacktrace()
  br label %41

41:                                               ; preds = %35
  store i32 -1, ptr %3, align 4
  br label %348

42:                                               ; No predecessors!
  br label %43

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

44:                                               ; preds = %43
  br label %45

45:                                               ; preds = %44
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %79, label %48

48:                                               ; preds = %45
  br label %49

49:                                               ; preds = %48
  br label %50

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

59:                                               ; preds = %50
  %60 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %61 = getelementptr inbounds %struct.s2n_debug_info, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !13
  %63 = getelementptr inbounds i8, ptr %62, i64 21
  %64 = call ptr @strrchr(ptr noundef %63, i32 noundef 47) #6
  %65 = getelementptr inbounds i8, ptr %64, i64 1
  br label %71

66:                                               ; preds = %50
  %67 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %68 = getelementptr inbounds %struct.s2n_debug_info, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !13
  %70 = getelementptr inbounds i8, ptr %69, i64 21
  br label %71

71:                                               ; preds = %66, %59
  %72 = phi ptr [ %65, %59 ], [ %70, %66 ]
  %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 1
  store ptr %72, ptr %74, align 8, !tbaa !15
  %75 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %75, align 4, !tbaa !16
  %76 = call i32 @s2n_calculate_stacktrace()
  br label %77

77:                                               ; preds = %71
  store i32 -1, ptr %3, align 4
  br label %348

78:                                               ; No predecessors!
  br label %79

79:                                               ; preds = %78, %45
  br label %80

80:                                               ; preds = %79
  br label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = icmp ne ptr %82, null
  br i1 %83, label %115, label %84

84:                                               ; preds = %81
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  %87 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %88 = getelementptr inbounds %struct.s2n_debug_info, ptr %87, i32 0, i32 0
  store ptr @.str.21, ptr %88, align 8, !tbaa !13
  %89 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %90 = getelementptr inbounds %struct.s2n_debug_info, ptr %89, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !13
  %92 = getelementptr inbounds i8, ptr %91, i64 21
  %93 = call ptr @strrchr(ptr noundef %92, i32 noundef 47) #6
  %94 = icmp ne ptr %93, null
  br i1 %94, label %95, label %102

95:                                               ; preds = %86
  %96 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %97 = getelementptr inbounds %struct.s2n_debug_info, ptr %96, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8, !tbaa !13
  %99 = getelementptr inbounds i8, ptr %98, i64 21
  %100 = call ptr @strrchr(ptr noundef %99, i32 noundef 47) #6
  %101 = getelementptr inbounds i8, ptr %100, i64 1
  br label %107

102:                                              ; preds = %86
  %103 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %104 = getelementptr inbounds %struct.s2n_debug_info, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !13
  %106 = getelementptr inbounds i8, ptr %105, i64 21
  br label %107

107:                                              ; preds = %102, %95
  %108 = phi ptr [ %101, %95 ], [ %106, %102 ]
  %109 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %110 = getelementptr inbounds %struct.s2n_debug_info, ptr %109, i32 0, i32 1
  store ptr %108, ptr %110, align 8, !tbaa !15
  %111 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %111, align 4, !tbaa !16
  %112 = call i32 @s2n_calculate_stacktrace()
  br label %113

113:                                              ; preds = %107
  store i32 -1, ptr %3, align 4
  br label %348

114:                                              ; No predecessors!
  br label %115

115:                                              ; preds = %114, %81
  br label %116

116:                                              ; preds = %115
  br label %117

117:                                              ; preds = %116
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.s2n_blob, ptr %118, i32 0, i32 1
  %120 = load i32, ptr %119, align 8, !tbaa !18
  %121 = icmp eq i32 %120, 0
  br i1 %121, label %153, label %122

122:                                              ; preds = %117
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  %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
  store ptr @.str.22, ptr %126, align 8, !tbaa !13
  %127 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %128 = getelementptr inbounds %struct.s2n_debug_info, ptr %127, i32 0, i32 0
  %129 = load ptr, ptr %128, align 8, !tbaa !13
  %130 = getelementptr inbounds i8, ptr %129, i64 21
  %131 = call ptr @strrchr(ptr noundef %130, i32 noundef 47) #6
  %132 = icmp ne ptr %131, null
  br i1 %132, label %133, label %140

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

140:                                              ; preds = %124
  %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 0
  %143 = load ptr, ptr %142, align 8, !tbaa !13
  %144 = getelementptr inbounds i8, ptr %143, i64 21
  br label %145

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

151:                                              ; preds = %145
  store i32 -1, ptr %3, align 4
  br label %348

152:                                              ; No predecessors!
  br label %153

153:                                              ; preds = %152, %117
  br label %154

154:                                              ; preds = %153
  br label %155

155:                                              ; preds = %154
  %156 = load ptr, ptr %5, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.s2n_blob, ptr %156, i32 0, i32 0
  %158 = load ptr, ptr %157, align 8, !tbaa !20
  %159 = icmp eq ptr %158, null
  br i1 %159, label %191, label %160

160:                                              ; preds = %155
  br label %161

161:                                              ; preds = %160
  br label %162

162:                                              ; preds = %161
  %163 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %164 = getelementptr inbounds %struct.s2n_debug_info, ptr %163, i32 0, i32 0
  store ptr @.str.23, ptr %164, align 8, !tbaa !13
  %165 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %166 = getelementptr inbounds %struct.s2n_debug_info, ptr %165, i32 0, i32 0
  %167 = load ptr, ptr %166, align 8, !tbaa !13
  %168 = getelementptr inbounds i8, ptr %167, i64 21
  %169 = call ptr @strrchr(ptr noundef %168, i32 noundef 47) #6
  %170 = icmp ne ptr %169, null
  br i1 %170, label %171, label %178

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

178:                                              ; preds = %162
  %179 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %180 = getelementptr inbounds %struct.s2n_debug_info, ptr %179, i32 0, i32 0
  %181 = load ptr, ptr %180, align 8, !tbaa !13
  %182 = getelementptr inbounds i8, ptr %181, i64 21
  br label %183

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

189:                                              ; preds = %183
  store i32 -1, ptr %3, align 4
  br label %348

190:                                              ; No predecessors!
  br label %191

191:                                              ; preds = %190, %155
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192
  %194 = load ptr, ptr %4, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.s2n_blob, ptr %194, i32 0, i32 1
  %196 = load i32, ptr %195, align 8, !tbaa !18
  %197 = icmp ne i32 %196, 0
  br i1 %197, label %229, label %198

198:                                              ; preds = %193
  br label %199

199:                                              ; preds = %198
  br label %200

200:                                              ; preds = %199
  %201 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %202 = getelementptr inbounds %struct.s2n_debug_info, ptr %201, i32 0, i32 0
  store ptr @.str.24, ptr %202, align 8, !tbaa !13
  %203 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %204 = getelementptr inbounds %struct.s2n_debug_info, ptr %203, i32 0, i32 0
  %205 = load ptr, ptr %204, align 8, !tbaa !13
  %206 = getelementptr inbounds i8, ptr %205, i64 21
  %207 = call ptr @strrchr(ptr noundef %206, i32 noundef 47) #6
  %208 = icmp ne ptr %207, null
  br i1 %208, label %209, label %216

209:                                              ; preds = %200
  %210 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %211 = getelementptr inbounds %struct.s2n_debug_info, ptr %210, i32 0, i32 0
  %212 = load ptr, ptr %211, align 8, !tbaa !13
  %213 = getelementptr inbounds i8, ptr %212, i64 21
  %214 = call ptr @strrchr(ptr noundef %213, i32 noundef 47) #6
  %215 = getelementptr inbounds i8, ptr %214, i64 1
  br label %221

216:                                              ; preds = %200
  %217 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %218 = getelementptr inbounds %struct.s2n_debug_info, ptr %217, i32 0, i32 0
  %219 = load ptr, ptr %218, align 8, !tbaa !13
  %220 = getelementptr inbounds i8, ptr %219, i64 21
  br label %221

221:                                              ; preds = %216, %209
  %222 = phi ptr [ %215, %209 ], [ %220, %216 ]
  %223 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %224 = getelementptr inbounds %struct.s2n_debug_info, ptr %223, i32 0, i32 1
  store ptr %222, ptr %224, align 8, !tbaa !15
  %225 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %225, align 4, !tbaa !16
  %226 = call i32 @s2n_calculate_stacktrace()
  br label %227

227:                                              ; preds = %221
  store i32 -1, ptr %3, align 4
  br label %348

228:                                              ; No predecessors!
  br label %229

229:                                              ; preds = %228, %193
  br label %230

230:                                              ; preds = %229
  br label %231

231:                                              ; preds = %230
  %232 = load ptr, ptr %4, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.s2n_blob, ptr %232, i32 0, i32 0
  %234 = load ptr, ptr %233, align 8, !tbaa !20
  %235 = icmp ne ptr %234, null
  br i1 %235, label %267, label %236

236:                                              ; preds = %231
  br label %237

237:                                              ; preds = %236
  br label %238

238:                                              ; preds = %237
  %239 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %240 = getelementptr inbounds %struct.s2n_debug_info, ptr %239, i32 0, i32 0
  store ptr @.str.25, ptr %240, align 8, !tbaa !13
  %241 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %242 = getelementptr inbounds %struct.s2n_debug_info, ptr %241, i32 0, i32 0
  %243 = load ptr, ptr %242, align 8, !tbaa !13
  %244 = getelementptr inbounds i8, ptr %243, i64 21
  %245 = call ptr @strrchr(ptr noundef %244, i32 noundef 47) #6
  %246 = icmp ne ptr %245, null
  br i1 %246, label %247, label %254

247:                                              ; preds = %238
  %248 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %249 = getelementptr inbounds %struct.s2n_debug_info, ptr %248, i32 0, i32 0
  %250 = load ptr, ptr %249, align 8, !tbaa !13
  %251 = getelementptr inbounds i8, ptr %250, i64 21
  %252 = call ptr @strrchr(ptr noundef %251, i32 noundef 47) #6
  %253 = getelementptr inbounds i8, ptr %252, i64 1
  br label %259

254:                                              ; preds = %238
  %255 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %256 = getelementptr inbounds %struct.s2n_debug_info, ptr %255, i32 0, i32 0
  %257 = load ptr, ptr %256, align 8, !tbaa !13
  %258 = getelementptr inbounds i8, ptr %257, i64 21
  br label %259

259:                                              ; preds = %254, %247
  %260 = phi ptr [ %253, %247 ], [ %258, %254 ]
  %261 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %262 = getelementptr inbounds %struct.s2n_debug_info, ptr %261, i32 0, i32 1
  store ptr %260, ptr %262, align 8, !tbaa !15
  %263 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %263, align 4, !tbaa !16
  %264 = call i32 @s2n_calculate_stacktrace()
  br label %265

265:                                              ; preds = %259
  store i32 -1, ptr %3, align 4
  br label %348

266:                                              ; No predecessors!
  br label %267

267:                                              ; preds = %266, %231
  br label %268

268:                                              ; preds = %267
  br label %269

269:                                              ; preds = %268
  %270 = load ptr, ptr %5, align 8, !tbaa !5
  %271 = load ptr, ptr %4, align 8, !tbaa !5
  %272 = getelementptr inbounds %struct.s2n_blob, ptr %271, i32 0, i32 1
  %273 = load i32, ptr %272, align 8, !tbaa !18
  %274 = call i32 @s2n_alloc(ptr noundef %270, i32 noundef %273)
  %275 = icmp sgt i32 %274, -1
  br i1 %275, label %277, label %276

276:                                              ; preds = %269
  store i32 -1, ptr %3, align 4
  br label %348

277:                                              ; preds = %269
  br label %278

278:                                              ; preds = %277
  br label %279

279:                                              ; preds = %278
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %280 = load ptr, ptr %5, align 8, !tbaa !5
  %281 = getelementptr inbounds %struct.s2n_blob, ptr %280, i32 0, i32 1
  %282 = load i32, ptr %281, align 8, !tbaa !18
  store i32 %282, ptr %6, align 4, !tbaa !16
  %283 = load i32, ptr %6, align 4, !tbaa !16
  %284 = icmp ne i32 %283, 0
  %285 = xor i1 %284, true
  %286 = xor i1 %285, true
  %287 = zext i1 %286 to i32
  %288 = sext i32 %287 to i64
  %289 = call i64 @llvm.expect.i64(i64 %288, i64 1)
  %290 = icmp ne i64 %289, 0
  br i1 %290, label %291, label %343

291:                                              ; preds = %279
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %292 = load ptr, ptr %5, align 8, !tbaa !5
  %293 = getelementptr inbounds %struct.s2n_blob, ptr %292, i32 0, i32 0
  %294 = load ptr, ptr %293, align 8, !tbaa !20
  %295 = load ptr, ptr %4, align 8, !tbaa !5
  %296 = getelementptr inbounds %struct.s2n_blob, ptr %295, i32 0, i32 0
  %297 = load ptr, ptr %296, align 8, !tbaa !20
  %298 = load i32, ptr %6, align 4, !tbaa !16
  %299 = zext i32 %298 to i64
  %300 = call ptr @s2n_ensure_memmove_trace(ptr noundef %294, ptr noundef %297, i64 noundef %299)
  store ptr %300, ptr %7, align 8, !tbaa !5
  br label %301

301:                                              ; preds = %291
  %302 = load ptr, ptr %7, align 8, !tbaa !5
  %303 = icmp ne ptr %302, null
  br i1 %303, label %337, label %304

304:                                              ; preds = %301
  br label %305

305:                                              ; preds = %304
  br label %306

306:                                              ; preds = %305
  %307 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %308 = getelementptr inbounds %struct.s2n_debug_info, ptr %307, i32 0, i32 0
  store ptr @.str.26, ptr %308, align 8, !tbaa !13
  %309 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %310 = getelementptr inbounds %struct.s2n_debug_info, ptr %309, i32 0, i32 0
  %311 = load ptr, ptr %310, align 8, !tbaa !13
  %312 = getelementptr inbounds i8, ptr %311, i64 21
  %313 = call ptr @strrchr(ptr noundef %312, i32 noundef 47) #6
  %314 = icmp ne ptr %313, null
  br i1 %314, label %315, label %322

315:                                              ; preds = %306
  %316 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %317 = getelementptr inbounds %struct.s2n_debug_info, ptr %316, i32 0, i32 0
  %318 = load ptr, ptr %317, align 8, !tbaa !13
  %319 = getelementptr inbounds i8, ptr %318, i64 21
  %320 = call ptr @strrchr(ptr noundef %319, i32 noundef 47) #6
  %321 = getelementptr inbounds i8, ptr %320, i64 1
  br label %327

322:                                              ; preds = %306
  %323 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %324 = getelementptr inbounds %struct.s2n_debug_info, ptr %323, i32 0, i32 0
  %325 = load ptr, ptr %324, align 8, !tbaa !13
  %326 = getelementptr inbounds i8, ptr %325, i64 21
  br label %327

327:                                              ; preds = %322, %315
  %328 = phi ptr [ %321, %315 ], [ %326, %322 ]
  %329 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %330 = getelementptr inbounds %struct.s2n_debug_info, ptr %329, i32 0, i32 1
  store ptr %328, ptr %330, align 8, !tbaa !15
  %331 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %331, align 4, !tbaa !16
  %332 = call i32 @s2n_calculate_stacktrace()
  br label %333

333:                                              ; preds = %327
  br label %334

334:                                              ; preds = %333
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %340

335:                                              ; No predecessors!
  br label %336

336:                                              ; preds = %335
  br label %337

337:                                              ; preds = %336, %301
  br label %338

338:                                              ; preds = %337
  br label %339

339:                                              ; preds = %338
  store i32 0, ptr %8, align 4
  br label %340

340:                                              ; preds = %339, %334
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %341 = load i32, ptr %8, align 4
  switch i32 %341, label %344 [
    i32 0, label %342
  ]

342:                                              ; preds = %340
  br label %343

343:                                              ; preds = %342, %279
  store i32 0, ptr %8, align 4
  br label %344

344:                                              ; preds = %343, %340
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %345 = load i32, ptr %8, align 4
  switch i32 %345, label %350 [
    i32 0, label %346
    i32 1, label %348
  ]

346:                                              ; preds = %344
  br label %347

347:                                              ; preds = %346
  store i32 0, ptr %3, align 4
  br label %348

348:                                              ; preds = %347, %344, %276, %265, %227, %189, %151, %113, %77, %41
  %349 = load i32, ptr %3, align 4
  ret i32 %349

350:                                              ; preds = %344
  unreachable
}

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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !6, i64 0}
!14 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!15 = !{!14, !6, i64 8}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!19, !17, i64 8}
!19 = !{!"s2n_blob", !6, i64 0, !17, i64 8, !17, i64 12, !17, i64 16}
!20 = !{!19, !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 }

@initialized = external hidden local_unnamed_addr global 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.19 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [86 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: nounwind uwtable
declare dso_local i32 @s2n_alloc(ptr noundef, i32 noundef) local_unnamed_addr #3

declare ptr @s2n_ensure_memmove_trace(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_dup(ptr noundef readonly %0, ptr noundef %1) local_unnamed_addr #3 {
  %3 = load i8, ptr @initialized, align 1, !tbaa !5, !range !9, !noundef !10
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %5, label %.sink.split

5:                                                ; preds = %2
  %.not30 = icmp eq ptr %1, null
  br i1 %.not30, label %.sink.split, label %6

6:                                                ; preds = %5
  %.not32 = icmp eq ptr %0, null
  br i1 %.not32, label %.sink.split, label %7

7:                                                ; preds = %6
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !11
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %11, label %.sink.split

11:                                               ; preds = %7
  %12 = load ptr, ptr %1, align 8, !tbaa !15
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %.sink.split

14:                                               ; preds = %11
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !11
  %.not36 = icmp eq i32 %16, 0
  br i1 %.not36, label %.sink.split, label %17

17:                                               ; preds = %14
  %18 = load ptr, ptr %0, align 8, !tbaa !15
  %.not38 = icmp eq ptr %18, null
  br i1 %.not38, label %.sink.split, label %19

19:                                               ; preds = %17
  %20 = tail call i32 @s2n_alloc(ptr noundef nonnull %1, i32 noundef %16)
  %21 = icmp sgt i32 %20, -1
  br i1 %21, label %22, label %36

22:                                               ; preds = %19
  %23 = load i32, ptr %8, align 8, !tbaa !11
  %.not40 = icmp eq i32 %23, 0
  br i1 %.not40, label %36, label %24, !prof !16

24:                                               ; preds = %22
  %25 = load ptr, ptr %1, align 8, !tbaa !15
  %26 = load ptr, ptr %0, align 8, !tbaa !15
  %27 = zext i32 %23 to i64
  %28 = tail call ptr @s2n_ensure_memmove_trace(ptr noundef %25, ptr noundef %26, i64 noundef %27) #4
  %.not41.not = icmp eq ptr %28, null
  br i1 %.not41.not, label %.sink.split, label %36

.sink.split:                                      ; preds = %24, %17, %14, %11, %7, %6, %5, %2
  %.str.26.sink = phi ptr [ @.str.19, %2 ], [ @.str.20, %5 ], [ @.str.21, %6 ], [ @.str.22, %7 ], [ @.str.23, %11 ], [ @.str.24, %14 ], [ @.str.25, %17 ], [ @.str.26, %24 ]
  %.sink53 = phi ptr [ getelementptr inbounds (i8, ptr @.str.19, i64 21), %2 ], [ getelementptr inbounds (i8, ptr @.str.20, i64 21), %5 ], [ getelementptr inbounds (i8, ptr @.str.21, i64 21), %6 ], [ getelementptr inbounds (i8, ptr @.str.22, i64 21), %7 ], [ getelementptr inbounds (i8, ptr @.str.23, i64 21), %11 ], [ getelementptr inbounds (i8, ptr @.str.24, i64 21), %14 ], [ getelementptr inbounds (i8, ptr @.str.25, i64 21), %17 ], [ getelementptr inbounds (i8, ptr @.str.26, i64 21), %24 ]
  %.sink = phi i32 [ 402653196, %2 ], [ 402653193, %5 ], [ 402653193, %6 ], [ 402653194, %7 ], [ 402653194, %11 ], [ 402653194, %14 ], [ 402653194, %17 ], [ 402653193, %24 ]
  %29 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr %.str.26.sink, ptr %29, align 8, !tbaa !17
  %30 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) %.sink53, i32 noundef 47) #5
  %.not42 = icmp eq ptr %30, null
  %31 = getelementptr inbounds i8, ptr %30, i64 1
  %32 = select i1 %.not42, ptr %.sink53, ptr %31
  %33 = getelementptr inbounds i8, ptr %29, i64 8
  store ptr %32, ptr %33, align 8, !tbaa !19
  %34 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 %.sink, ptr %34, align 4, !tbaa !20
  %35 = tail call i32 @s2n_calculate_stacktrace() #4
  br label %36

36:                                               ; preds = %.sink.split, %24, %22, %19
  %.3 = phi i32 [ -1, %19 ], [ 0, %24 ], [ 0, %22 ], [ -1, %.sink.split ]
  ret i32 %.3
}

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 = { 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 }
attributes #5 = { 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 = !{!"_Bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{!12, !14, i64 8}
!12 = !{!"s2n_blob", !13, i64 0, !14, i64 8, !14, i64 12, !14, i64 16}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !13, i64 0}
!16 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!17 = !{!18, !13, i64 0}
!18 = !{!"s2n_debug_info", !13, i64 0, !13, i64 8}
!19 = !{!18, !13, i64 8}
!20 = !{!14, !14, i64 0}


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