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

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

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.3 = 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_map_embiggen(ptr noundef, i32 noundef) #5

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

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

12:                                               ; preds = %3
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %47, label %15

15:                                               ; preds = %12
  br label %16

16:                                               ; preds = %15
  br label %17

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

26:                                               ; preds = %17
  %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 !9
  %30 = getelementptr inbounds i8, ptr %29, i64 21
  %31 = call ptr @strrchr(ptr noundef %30, i32 noundef 47) #6
  %32 = getelementptr inbounds i8, ptr %31, i64 1
  br label %38

33:                                               ; preds = %17
  %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 !9
  %37 = getelementptr inbounds i8, ptr %36, i64 21
  br label %38

38:                                               ; preds = %33, %26
  %39 = phi ptr [ %32, %26 ], [ %37, %33 ]
  %40 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %41 = getelementptr inbounds %struct.s2n_debug_info, ptr %40, i32 0, i32 1
  store ptr %39, ptr %41, align 8, !tbaa !11
  %42 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %42, align 4, !tbaa !12
  %43 = call i32 @s2n_calculate_stacktrace()
  br label %44

44:                                               ; preds = %38
  %45 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %45, align 4, !tbaa !14
  br label %251

46:                                               ; No predecessors!
  br label %47

47:                                               ; preds = %46, %12
  br label %48

48:                                               ; preds = %47
  br label %49

49:                                               ; preds = %48
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.s2n_map, ptr %50, i32 0, i32 2
  %52 = load i32, ptr %51, align 8, !tbaa !16
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %86

54:                                               ; preds = %49
  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.2, ptr %58, align 8, !tbaa !9
  %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 !9
  %62 = getelementptr inbounds i8, ptr %61, i64 21
  %63 = call ptr @strrchr(ptr noundef %62, i32 noundef 47) #6
  %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 !9
  %69 = getelementptr inbounds i8, ptr %68, i64 21
  %70 = call ptr @strrchr(ptr noundef %69, i32 noundef 47) #6
  %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 !9
  %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 !11
  %81 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653226, ptr %81, align 4, !tbaa !12
  %82 = call i32 @s2n_calculate_stacktrace()
  br label %83

83:                                               ; preds = %77
  %84 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %84, align 4, !tbaa !14
  br label %251

85:                                               ; No predecessors!
  br label %86

86:                                               ; preds = %85, %49
  br label %87

87:                                               ; preds = %86
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.s2n_map, ptr %88, i32 0, i32 0
  %90 = load i32, ptr %89, align 8, !tbaa !18
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.s2n_map, ptr %91, i32 0, i32 1
  %93 = load i32, ptr %92, align 4, !tbaa !19
  %94 = mul i32 %93, 2
  %95 = icmp ult i32 %90, %94
  br i1 %95, label %96, label %112

96:                                               ; preds = %87
  br label %97

97:                                               ; preds = %96
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.s2n_map, ptr %99, i32 0, i32 0
  %101 = load i32, ptr %100, align 8, !tbaa !18
  %102 = mul i32 %101, 2
  %103 = call i32 @s2n_map_embiggen(ptr noundef %98, i32 noundef %102)
  %104 = getelementptr inbounds %struct.s2n_result, ptr %8, i32 0, i32 0
  store i32 %103, ptr %104, align 4
  %105 = getelementptr inbounds %struct.s2n_result, ptr %8, i32 0, i32 0
  %106 = load i32, ptr %105, align 4
  %107 = call zeroext i1 @s2n_result_is_ok(i32 %106)
  br i1 %107, label %110, label %108

108:                                              ; preds = %97
  %109 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %109, align 4, !tbaa !14
  br label %251

110:                                              ; preds = %97
  br label %111

111:                                              ; preds = %110
  br label %112

112:                                              ; preds = %111, %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !12
  br label %113

113:                                              ; preds = %112
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = load ptr, ptr %6, align 8, !tbaa !5
  %116 = call i32 @s2n_map_slot(ptr noundef %114, ptr noundef %115, ptr noundef %9)
  %117 = getelementptr inbounds %struct.s2n_result, ptr %10, i32 0, i32 0
  store i32 %116, ptr %117, align 4
  %118 = getelementptr inbounds %struct.s2n_result, ptr %10, i32 0, i32 0
  %119 = load i32, ptr %118, align 4
  %120 = call zeroext i1 @s2n_result_is_ok(i32 %119)
  br i1 %120, label %123, label %121

121:                                              ; preds = %113
  %122 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %122, align 4, !tbaa !14
  store i32 1, ptr %11, align 4
  br label %250

123:                                              ; preds = %113
  br label %124

124:                                              ; preds = %123
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %211, %170, %125
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.s2n_map, ptr %127, i32 0, i32 3
  %129 = load ptr, ptr %128, align 8, !tbaa !20
  %130 = load i32, ptr %9, align 4, !tbaa !12
  %131 = zext i32 %130 to i64
  %132 = getelementptr inbounds %struct.s2n_map_entry, ptr %129, i64 %131
  %133 = getelementptr inbounds %struct.s2n_map_entry, ptr %132, i32 0, i32 0
  %134 = getelementptr inbounds %struct.s2n_blob, ptr %133, i32 0, i32 1
  %135 = load i32, ptr %134, align 8, !tbaa !21
  %136 = icmp ne i32 %135, 0
  br i1 %136, label %137, label %212

137:                                              ; preds = %126
  %138 = load ptr, ptr %6, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.s2n_blob, ptr %138, i32 0, i32 1
  %140 = load i32, ptr %139, align 8, !tbaa !24
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.s2n_map, ptr %141, i32 0, i32 3
  %143 = load ptr, ptr %142, align 8, !tbaa !20
  %144 = load i32, ptr %9, align 4, !tbaa !12
  %145 = zext i32 %144 to i64
  %146 = getelementptr inbounds %struct.s2n_map_entry, ptr %143, i64 %145
  %147 = getelementptr inbounds %struct.s2n_map_entry, ptr %146, i32 0, i32 0
  %148 = getelementptr inbounds %struct.s2n_blob, ptr %147, i32 0, i32 1
  %149 = load i32, ptr %148, align 8, !tbaa !21
  %150 = icmp ne i32 %140, %149
  br i1 %150, label %170, label %151

151:                                              ; preds = %137
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.s2n_blob, ptr %152, i32 0, i32 0
  %154 = load ptr, ptr %153, align 8, !tbaa !25
  %155 = load ptr, ptr %5, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.s2n_map, ptr %155, i32 0, i32 3
  %157 = load ptr, ptr %156, align 8, !tbaa !20
  %158 = load i32, ptr %9, align 4, !tbaa !12
  %159 = zext i32 %158 to i64
  %160 = getelementptr inbounds %struct.s2n_map_entry, ptr %157, i64 %159
  %161 = getelementptr inbounds %struct.s2n_map_entry, ptr %160, i32 0, i32 0
  %162 = getelementptr inbounds %struct.s2n_blob, ptr %161, i32 0, i32 0
  %163 = load ptr, ptr %162, align 8, !tbaa !26
  %164 = load ptr, ptr %6, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.s2n_blob, ptr %164, i32 0, i32 1
  %166 = load i32, ptr %165, align 8, !tbaa !24
  %167 = zext i32 %166 to i64
  %168 = call i32 @memcmp(ptr noundef %154, ptr noundef %163, i64 noundef %167) #6
  %169 = icmp ne i32 %168, 0
  br i1 %169, label %170, label %178

170:                                              ; preds = %151, %137
  %171 = load i32, ptr %9, align 4, !tbaa !12
  %172 = add i32 %171, 1
  store i32 %172, ptr %9, align 4, !tbaa !12
  %173 = load ptr, ptr %5, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.s2n_map, ptr %173, i32 0, i32 0
  %175 = load i32, ptr %174, align 8, !tbaa !18
  %176 = load i32, ptr %9, align 4, !tbaa !12
  %177 = urem i32 %176, %175
  store i32 %177, ptr %9, align 4, !tbaa !12
  br label %126, !llvm.loop !27

178:                                              ; preds = %151
  br label %179

179:                                              ; preds = %178
  br label %180

180:                                              ; preds = %179
  %181 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %182 = getelementptr inbounds %struct.s2n_debug_info, ptr %181, i32 0, i32 0
  store ptr @.str.3, ptr %182, align 8, !tbaa !9
  %183 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %184 = getelementptr inbounds %struct.s2n_debug_info, ptr %183, i32 0, i32 0
  %185 = load ptr, ptr %184, align 8, !tbaa !9
  %186 = getelementptr inbounds i8, ptr %185, i64 21
  %187 = call ptr @strrchr(ptr noundef %186, i32 noundef 47) #6
  %188 = icmp ne ptr %187, null
  br i1 %188, label %189, label %196

189:                                              ; preds = %180
  %190 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %191 = getelementptr inbounds %struct.s2n_debug_info, ptr %190, i32 0, i32 0
  %192 = load ptr, ptr %191, align 8, !tbaa !9
  %193 = getelementptr inbounds i8, ptr %192, i64 21
  %194 = call ptr @strrchr(ptr noundef %193, i32 noundef 47) #6
  %195 = getelementptr inbounds i8, ptr %194, i64 1
  br label %201

196:                                              ; preds = %180
  %197 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %198 = getelementptr inbounds %struct.s2n_debug_info, ptr %197, i32 0, i32 0
  %199 = load ptr, ptr %198, align 8, !tbaa !9
  %200 = getelementptr inbounds i8, ptr %199, i64 21
  br label %201

201:                                              ; preds = %196, %189
  %202 = phi ptr [ %195, %189 ], [ %200, %196 ]
  %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 1
  store ptr %202, ptr %204, align 8, !tbaa !11
  %205 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653225, ptr %205, align 4, !tbaa !12
  %206 = call i32 @s2n_calculate_stacktrace()
  br label %207

207:                                              ; preds = %201
  br label %208

208:                                              ; preds = %207
  %209 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %209, align 4, !tbaa !14
  store i32 1, ptr %11, align 4
  br label %250

210:                                              ; No predecessors!
  br label %211

211:                                              ; preds = %210
  br label %126, !llvm.loop !27

212:                                              ; preds = %126
  br label %213

213:                                              ; preds = %212
  %214 = load ptr, ptr %6, align 8, !tbaa !5
  %215 = load ptr, ptr %5, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.s2n_map, ptr %215, i32 0, i32 3
  %217 = load ptr, ptr %216, align 8, !tbaa !20
  %218 = load i32, ptr %9, align 4, !tbaa !12
  %219 = zext i32 %218 to i64
  %220 = getelementptr inbounds %struct.s2n_map_entry, ptr %217, i64 %219
  %221 = getelementptr inbounds %struct.s2n_map_entry, ptr %220, i32 0, i32 0
  %222 = call i32 @s2n_dup(ptr noundef %214, ptr noundef %221)
  %223 = icmp sgt i32 %222, -1
  br i1 %223, label %226, label %224

224:                                              ; preds = %213
  %225 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %225, align 4, !tbaa !14
  store i32 1, ptr %11, align 4
  br label %250

226:                                              ; preds = %213
  br label %227

227:                                              ; preds = %226
  br label %228

228:                                              ; preds = %227
  br label %229

229:                                              ; preds = %228
  %230 = load ptr, ptr %7, align 8, !tbaa !5
  %231 = load ptr, ptr %5, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.s2n_map, ptr %231, i32 0, i32 3
  %233 = load ptr, ptr %232, align 8, !tbaa !20
  %234 = load i32, ptr %9, align 4, !tbaa !12
  %235 = zext i32 %234 to i64
  %236 = getelementptr inbounds %struct.s2n_map_entry, ptr %233, i64 %235
  %237 = getelementptr inbounds %struct.s2n_map_entry, ptr %236, i32 0, i32 1
  %238 = call i32 @s2n_dup(ptr noundef %230, ptr noundef %237)
  %239 = icmp sgt i32 %238, -1
  br i1 %239, label %242, label %240

240:                                              ; preds = %229
  %241 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %241, align 4, !tbaa !14
  store i32 1, ptr %11, align 4
  br label %250

242:                                              ; preds = %229
  br label %243

243:                                              ; preds = %242
  br label %244

244:                                              ; preds = %243
  %245 = load ptr, ptr %5, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.s2n_map, ptr %245, i32 0, i32 1
  %247 = load i32, ptr %246, align 4, !tbaa !19
  %248 = add i32 %247, 1
  store i32 %248, ptr %246, align 4, !tbaa !19
  %249 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 0, ptr %249, align 4, !tbaa !14
  store i32 1, ptr %11, align 4
  br label %250

250:                                              ; preds = %244, %240, %224, %208, %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %251

251:                                              ; preds = %250, %108, %83, %44
  %252 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  %253 = load i32, ptr %252, align 4
  ret i32 %253
}

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_map_slot(ptr noundef, ptr noundef, ptr noundef) #5

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #1

declare i32 @s2n_dup(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = { 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, !6, i64 0}
!10 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 0}
!15 = !{!"", !13, i64 0}
!16 = !{!17, !13, i64 8}
!17 = !{!"s2n_map", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16}
!18 = !{!17, !13, i64 0}
!19 = !{!17, !13, i64 4}
!20 = !{!17, !6, i64 16}
!21 = !{!22, !13, i64 8}
!22 = !{!"s2n_map_entry", !23, i64 0, !23, i64 24}
!23 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!24 = !{!23, !13, i64 8}
!25 = !{!23, !6, i64 0}
!26 = !{!22, !6, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


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

@_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 [86 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.3 = 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_map_embiggen(ptr noundef, i32 noundef) local_unnamed_addr #5

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_map_add(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #5 {
  %4 = alloca i32, align 4
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %5, label %13

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

13:                                               ; preds = %3
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load i32, ptr %14, align 8, !tbaa !13
  %.not29 = icmp eq i32 %15, 0
  br i1 %.not29, label %24, label %16

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

24:                                               ; preds = %13
  %25 = load i32, ptr %0, align 8, !tbaa !15
  %26 = getelementptr inbounds i8, ptr %0, i64 4
  %27 = load i32, ptr %26, align 4, !tbaa !16
  %28 = shl i32 %27, 1
  %29 = icmp ult i32 %25, %28
  br i1 %29, label %30, label %34

30:                                               ; preds = %24
  %31 = shl i32 %25, 1
  %32 = tail call i32 @s2n_map_embiggen(ptr noundef nonnull %0, i32 noundef %31)
  %33 = tail call zeroext i1 @s2n_result_is_ok(i32 %32)
  br i1 %33, label %34, label %82

34:                                               ; preds = %30, %24
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  store i32 0, ptr %4, align 4, !tbaa !11
  %35 = call i32 @s2n_map_slot(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %4)
  %36 = call zeroext i1 @s2n_result_is_ok(i32 %35)
  br i1 %36, label %.preheader, label %81

.preheader:                                       ; preds = %34
  %37 = getelementptr inbounds i8, ptr %0, i64 16
  %38 = load ptr, ptr %37, align 8, !tbaa !17
  %.promoted = load i32, ptr %4, align 4, !tbaa !11
  %39 = zext i32 %.promoted to i64
  %40 = getelementptr inbounds %struct.s2n_map_entry, ptr %38, i64 %39
  %41 = getelementptr inbounds i8, ptr %40, i64 8
  %42 = load i32, ptr %41, align 8, !tbaa !18
  %.not3038 = icmp eq i32 %42, 0
  br i1 %.not3038, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %43 = getelementptr inbounds i8, ptr %1, i64 8
  %44 = load i32, ptr %43, align 8, !tbaa !21
  %45 = zext i32 %44 to i64
  br label %46

46:                                               ; preds = %.lr.ph, %53
  %47 = phi i32 [ %42, %.lr.ph ], [ %60, %53 ]
  %48 = phi ptr [ %40, %.lr.ph ], [ %58, %53 ]
  %49 = phi i32 [ %.promoted, %.lr.ph ], [ %56, %53 ]
  %.not31 = icmp eq i32 %44, %47
  br i1 %.not31, label %50, label %53

50:                                               ; preds = %46
  %51 = load ptr, ptr %1, align 8, !tbaa !22
  %52 = load ptr, ptr %48, align 8, !tbaa !23
  %bcmp = call i32 @bcmp(ptr %51, ptr %52, i64 %45)
  %.not32 = icmp eq i32 %bcmp, 0
  br i1 %.not32, label %61, label %53

53:                                               ; preds = %50, %46
  %54 = add i32 %49, 1
  %55 = load i32, ptr %0, align 8, !tbaa !15
  %56 = urem i32 %54, %55
  store i32 %56, ptr %4, align 4, !tbaa !11
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds %struct.s2n_map_entry, ptr %38, i64 %57
  %59 = getelementptr inbounds i8, ptr %58, i64 8
  %60 = load i32, ptr %59, align 8, !tbaa !18
  %.not30 = icmp eq i32 %60, 0
  br i1 %.not30, label %._crit_edge, label %46, !llvm.loop !24

61:                                               ; preds = %50
  %62 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.3, ptr %62, align 8, !tbaa !5
  %63 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.3, i64 21), i32 noundef 47) #7
  %.not33 = icmp eq ptr %63, null
  %64 = getelementptr inbounds i8, ptr %63, i64 1
  %65 = select i1 %.not33, ptr getelementptr inbounds (i8, ptr @.str.3, i64 21), ptr %64
  %66 = getelementptr inbounds i8, ptr %62, i64 8
  store ptr %65, ptr %66, align 8, !tbaa !10
  %67 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653225, ptr %67, align 4, !tbaa !11
  %68 = call i32 @s2n_calculate_stacktrace() #8
  br label %81

._crit_edge:                                      ; preds = %53, %.preheader
  %.lcssa = phi ptr [ %40, %.preheader ], [ %58, %53 ]
  %69 = call i32 @s2n_dup(ptr noundef %1, ptr noundef nonnull %.lcssa) #8
  %70 = icmp sgt i32 %69, -1
  br i1 %70, label %71, label %81

71:                                               ; preds = %._crit_edge
  %72 = load ptr, ptr %37, align 8, !tbaa !17
  %73 = load i32, ptr %4, align 4, !tbaa !11
  %74 = zext i32 %73 to i64
  %75 = getelementptr inbounds %struct.s2n_map_entry, ptr %72, i64 %74, i32 1
  %76 = call i32 @s2n_dup(ptr noundef %2, ptr noundef nonnull %75) #8
  %77 = icmp sgt i32 %76, -1
  br i1 %77, label %78, label %81

78:                                               ; preds = %71
  %79 = load i32, ptr %26, align 4, !tbaa !16
  %80 = add i32 %79, 1
  store i32 %80, ptr %26, align 4, !tbaa !16
  br label %81

81:                                               ; preds = %71, %._crit_edge, %34, %78, %61
  %.sroa.021.0 = phi i32 [ -1, %61 ], [ 0, %78 ], [ -1, %34 ], [ -1, %._crit_edge ], [ -1, %71 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  br label %82

82:                                               ; preds = %30, %81, %16, %5
  %.sroa.021.1 = phi i32 [ -1, %16 ], [ %.sroa.021.0, %81 ], [ -1, %5 ], [ -1, %30 ]
  ret i32 %.sroa.021.1
}

; Function Attrs: nounwind uwtable
declare hidden i32 @s2n_map_slot(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

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

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6

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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = { nofree nounwind willreturn memory(argmem: read) }
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, !7, i64 0}
!6 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"s2n_map", !12, i64 0, !12, i64 4, !12, i64 8, !7, i64 16}
!15 = !{!14, !12, i64 0}
!16 = !{!14, !12, i64 4}
!17 = !{!14, !7, i64 16}
!18 = !{!19, !12, i64 8}
!19 = !{!"s2n_map_entry", !20, i64 0, !20, i64 24}
!20 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!21 = !{!20, !12, i64 8}
!22 = !{!20, !7, i64 0}
!23 = !{!19, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass