; LLVM IR from brewlin/garbage-collect :: gc-golang/central (central)

; 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.mheap = type { %union.pthread_mutex_t, %struct.mtreap, %struct.mtreap, %struct.array_t, [2 x %struct.gcSweepBuf], %struct.mfixalloc, %struct.mfixalloc, %struct.mfixalloc, %struct.mfixalloc, %struct.mfixalloc, %struct.mfixalloc, %struct.lineralloc, %struct.array_t, ptr, [1 x %struct.array_t], i64, i32, i32, i32, ptr, i64, i64, i64, [134 x %struct.mcentral] }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.mtreap = type { ptr }
%struct.gcSweepBuf = type { %union.pthread_mutex_t, ptr, i64, i64, i32 }
%struct.mfixalloc = type { i64, ptr, ptr, ptr, i64, i32, i64, i8 }
%struct.lineralloc = type { i64, i64, i64 }
%struct.array_t = type { ptr, i32, i64, i32 }
%struct.mcentral = type { %union.pthread_mutex_t, i8, %struct.mspanlist, %struct.mspanlist, i64 }
%struct.mspanlist = type { ptr, ptr }
%struct.mspan = type { ptr, ptr, ptr, i64, i64, i64, i8, i8, i8, i16, i32, i64, i8, i16, i8, i8, i16, i64, i64, i64, ptr, ptr, i64 }

@class_to_allocnpages = external global [67 x i8], align 16
@heap_ = external global %struct.mheap, align 8
@.str = external hidden unnamed_addr constant [25 x i8], align 1
@gcBlackenEnabled = external global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local ptr @central_cacheSpan(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.mcentral, ptr %15, i32 0, i32 1
  %17 = load i8, ptr %16, align 8, !tbaa !9
  %18 = call signext i8 @sizeclass(i8 noundef zeroext %17)
  %19 = sext i8 %18 to i64
  %20 = getelementptr inbounds [67 x i8], ptr @class_to_allocnpages, i64 0, i64 %19
  %21 = load i8, ptr %20, align 1, !tbaa !13
  %22 = zext i8 %21 to i64
  %23 = mul i64 %22, 8192
  store i64 %23, ptr %4, align 8, !tbaa !14
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.mcentral, ptr %24, i32 0, i32 0
  %26 = call i32 @pthread_mutex_lock(ptr noundef %25) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #4
  store i8 0, ptr %5, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %27 = load i32, ptr getelementptr inbounds (%struct.mheap, ptr @heap_, i32 0, i32 16), align 8, !tbaa !15
  store i32 %27, ptr %6, align 4, !tbaa !22
  br label %28

28:                                               ; preds = %139, %1
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.mcentral, ptr %29, i32 0, i32 2
  %31 = getelementptr inbounds %struct.mspanlist, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !23
  store ptr %32, ptr %7, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %83, %28
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %87

36:                                               ; preds = %33
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.mspan, ptr %37, i32 0, i32 10
  %39 = load i32, ptr %38, align 8, !tbaa !24
  %40 = load i32, ptr %6, align 4, !tbaa !22
  %41 = sub i32 %40, 2
  %42 = icmp eq i32 %39, %41
  br i1 %42, label %43, label %65

43:                                               ; preds = %36
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.mspan, ptr %44, i32 0, i32 10
  %46 = load i32, ptr %6, align 4, !tbaa !22
  %47 = sub i32 %46, 2
  %48 = load i32, ptr %6, align 4, !tbaa !22
  %49 = sub i32 %48, 1
  %50 = call zeroext i8 @atomic_Cas(ptr noundef %45, i32 noundef %47, i32 noundef %49)
  %51 = zext i8 %50 to i32
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %65

53:                                               ; preds = %43
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.mcentral, ptr %54, i32 0, i32 2
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  call void @spanlist_remove(ptr noundef %55, ptr noundef %56)
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.mcentral, ptr %57, i32 0, i32 3
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  call void @spanlist_insertback(ptr noundef %58, ptr noundef %59)
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.mcentral, ptr %60, i32 0, i32 0
  %62 = call i32 @pthread_mutex_unlock(ptr noundef %61) #4
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = call zeroext i8 @span_sweep(ptr noundef %63, i8 noundef zeroext 1)
  br label %173

65:                                               ; preds = %43, %36
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.mspan, ptr %66, i32 0, i32 10
  %68 = load i32, ptr %67, align 8, !tbaa !24
  %69 = load i32, ptr %6, align 4, !tbaa !22
  %70 = sub i32 %69, 1
  %71 = icmp eq i32 %68, %70
  br i1 %71, label %72, label %73

72:                                               ; preds = %65
  br label %83

73:                                               ; preds = %65
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.mcentral, ptr %74, i32 0, i32 2
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  call void @spanlist_remove(ptr noundef %75, ptr noundef %76)
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.mcentral, ptr %77, i32 0, i32 3
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  call void @spanlist_insertback(ptr noundef %78, ptr noundef %79)
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.mcentral, ptr %80, i32 0, i32 0
  %82 = call i32 @pthread_mutex_unlock(ptr noundef %81) #4
  br label %173

83:                                               ; preds = %72
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.mspan, ptr %84, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8, !tbaa !27
  store ptr %86, ptr %7, align 8, !tbaa !5
  br label %33, !llvm.loop !28

87:                                               ; preds = %33
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.mcentral, ptr %88, i32 0, i32 3
  %90 = getelementptr inbounds %struct.mspanlist, ptr %89, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !30
  store ptr %91, ptr %7, align 8, !tbaa !5
  br label %92

92:                                               ; preds = %150, %87
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = icmp ne ptr %93, null
  br i1 %94, label %95, label %154

95:                                               ; preds = %92
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.mspan, ptr %96, i32 0, i32 10
  %98 = load i32, ptr %97, align 8, !tbaa !24
  %99 = load i32, ptr %6, align 4, !tbaa !22
  %100 = sub i32 %99, 2
  %101 = icmp eq i32 %98, %100
  br i1 %101, label %102, label %141

102:                                              ; preds = %95
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.mspan, ptr %103, i32 0, i32 10
  %105 = load i32, ptr %6, align 4, !tbaa !22
  %106 = sub i32 %105, 2
  %107 = load i32, ptr %6, align 4, !tbaa !22
  %108 = sub i32 %107, 1
  %109 = call zeroext i8 @atomic_Cas(ptr noundef %104, i32 noundef %106, i32 noundef %108)
  %110 = zext i8 %109 to i32
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %112, label %141

112:                                              ; preds = %102
  %113 = load ptr, ptr %3, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.mcentral, ptr %113, i32 0, i32 3
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  call void @spanlist_remove(ptr noundef %114, ptr noundef %115)
  %116 = load ptr, ptr %3, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.mcentral, ptr %116, i32 0, i32 3
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  call void @spanlist_insertback(ptr noundef %117, ptr noundef %118)
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.mcentral, ptr %119, i32 0, i32 0
  %121 = call i32 @pthread_mutex_unlock(ptr noundef %120) #4
  %122 = load ptr, ptr %7, align 8, !tbaa !5
  %123 = call zeroext i8 @span_sweep(ptr noundef %122, i8 noundef zeroext 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %124 = load ptr, ptr %7, align 8, !tbaa !5
  %125 = call i64 @span_nextFreeIndex(ptr noundef %124)
  store i64 %125, ptr %8, align 8, !tbaa !14
  %126 = load i64, ptr %8, align 8, !tbaa !14
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.mspan, ptr %127, i32 0, i32 19
  %129 = load i64, ptr %128, align 8, !tbaa !31
  %130 = icmp ne i64 %126, %129
  br i1 %130, label %131, label %135

131:                                              ; preds = %112
  %132 = load i64, ptr %8, align 8, !tbaa !14
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.mspan, ptr %133, i32 0, i32 18
  store i64 %132, ptr %134, align 8, !tbaa !32
  store i32 6, ptr %9, align 4
  br label %139

135:                                              ; preds = %112
  %136 = load ptr, ptr %3, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.mcentral, ptr %136, i32 0, i32 0
  %138 = call i32 @pthread_mutex_lock(ptr noundef %137) #4
  store i32 2, ptr %9, align 4
  br label %139

139:                                              ; preds = %135, %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %140 = load i32, ptr %9, align 4
  switch i32 %140, label %239 [
    i32 2, label %28
    i32 6, label %173
  ]

141:                                              ; preds = %102, %95
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.mspan, ptr %142, i32 0, i32 10
  %144 = load i32, ptr %143, align 8, !tbaa !24
  %145 = load i32, ptr %6, align 4, !tbaa !22
  %146 = sub i32 %145, 1
  %147 = icmp eq i32 %144, %146
  br i1 %147, label %148, label %149

148:                                              ; preds = %141
  br label %150

149:                                              ; preds = %141
  br label %154

150:                                              ; preds = %148
  %151 = load ptr, ptr %7, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.mspan, ptr %151, i32 0, i32 0
  %153 = load ptr, ptr %152, align 8, !tbaa !27
  store ptr %153, ptr %7, align 8, !tbaa !5
  br label %92, !llvm.loop !33

154:                                              ; preds = %149, %92
  %155 = load ptr, ptr %3, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.mcentral, ptr %155, i32 0, i32 0
  %157 = call i32 @pthread_mutex_unlock(ptr noundef %156) #4
  %158 = load ptr, ptr %3, align 8, !tbaa !5
  %159 = call ptr @central_grow(ptr noundef %158)
  store ptr %159, ptr %7, align 8, !tbaa !5
  %160 = load ptr, ptr %7, align 8, !tbaa !5
  %161 = icmp eq ptr %160, null
  br i1 %161, label %162, label %163

162:                                              ; preds = %154
  store ptr null, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %239

163:                                              ; preds = %154
  %164 = load ptr, ptr %3, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.mcentral, ptr %164, i32 0, i32 0
  %166 = call i32 @pthread_mutex_lock(ptr noundef %165) #4
  %167 = load ptr, ptr %3, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.mcentral, ptr %167, i32 0, i32 3
  %169 = load ptr, ptr %7, align 8, !tbaa !5
  call void @spanlist_insertback(ptr noundef %168, ptr noundef %169)
  %170 = load ptr, ptr %3, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.mcentral, ptr %170, i32 0, i32 0
  %172 = call i32 @pthread_mutex_unlock(ptr noundef %171) #4
  br label %173

173:                                              ; preds = %163, %139, %73, %53
  %174 = load ptr, ptr %7, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.mspan, ptr %174, i32 0, i32 19
  %176 = load i64, ptr %175, align 8, !tbaa !31
  %177 = trunc i64 %176 to i32
  %178 = load ptr, ptr %7, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.mspan, ptr %178, i32 0, i32 9
  %180 = load i16, ptr %179, align 4, !tbaa !34
  %181 = zext i16 %180 to i32
  %182 = sub nsw i32 %177, %181
  store i32 %182, ptr %10, align 4, !tbaa !22
  %183 = load i32, ptr %10, align 4, !tbaa !22
  %184 = icmp eq i32 %183, 0
  br i1 %184, label %202, label %185

185:                                              ; preds = %173
  %186 = load ptr, ptr %7, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.mspan, ptr %186, i32 0, i32 18
  %188 = load i64, ptr %187, align 8, !tbaa !32
  %189 = load ptr, ptr %7, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.mspan, ptr %189, i32 0, i32 19
  %191 = load i64, ptr %190, align 8, !tbaa !31
  %192 = icmp eq i64 %188, %191
  br i1 %192, label %202, label %193

193:                                              ; preds = %185
  %194 = load ptr, ptr %7, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.mspan, ptr %194, i32 0, i32 9
  %196 = load i16, ptr %195, align 4, !tbaa !34
  %197 = zext i16 %196 to i64
  %198 = load ptr, ptr %7, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.mspan, ptr %198, i32 0, i32 19
  %200 = load i64, ptr %199, align 8, !tbaa !31
  %201 = icmp eq i64 %197, %200
  br i1 %201, label %202, label %204

202:                                              ; preds = %193, %185, %173
  %203 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 poison, ptr %11, align 4, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %204

204:                                              ; preds = %202, %193
  %205 = load ptr, ptr %3, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.mcentral, ptr %205, i32 0, i32 4
  %207 = load i32, ptr %10, align 4, !tbaa !22
  %208 = sext i32 %207 to i64
  %209 = call i64 @atomic_Xadd64(ptr noundef %206, i64 noundef %208)
  %210 = load ptr, ptr %7, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.mspan, ptr %210, i32 0, i32 9
  %212 = load i16, ptr %211, align 4, !tbaa !34
  %213 = zext i16 %212 to i64
  %214 = load ptr, ptr %7, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.mspan, ptr %214, i32 0, i32 17
  %216 = load i64, ptr %215, align 8, !tbaa !35
  %217 = mul i64 %213, %216
  store i64 %217, ptr %12, align 8, !tbaa !14
  %218 = load i32, ptr @gcBlackenEnabled, align 4, !tbaa !22
  %219 = icmp ne i32 %218, 0
  br i1 %219, label %220, label %221

220:                                              ; preds = %204
  br label %221

221:                                              ; preds = %220, %204
  %222 = load ptr, ptr %7, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.mspan, ptr %222, i32 0, i32 18
  %224 = load i64, ptr %223, align 8, !tbaa !32
  %225 = and i64 %224, -64
  store i64 %225, ptr %13, align 8, !tbaa !14
  %226 = load i64, ptr %13, align 8, !tbaa !14
  %227 = udiv i64 %226, 8
  store i64 %227, ptr %14, align 8, !tbaa !14
  %228 = load ptr, ptr %7, align 8, !tbaa !5
  %229 = load i64, ptr %14, align 8, !tbaa !14
  call void @span_refillAllocCache(ptr noundef %228, i64 noundef %229)
  %230 = load ptr, ptr %7, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.mspan, ptr %230, i32 0, i32 18
  %232 = load i64, ptr %231, align 8, !tbaa !32
  %233 = urem i64 %232, 64
  %234 = load ptr, ptr %7, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.mspan, ptr %234, i32 0, i32 22
  %236 = load i64, ptr %235, align 8, !tbaa !36
  %237 = lshr i64 %236, %233
  store i64 %237, ptr %235, align 8, !tbaa !36
  %238 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %238, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %239

239:                                              ; preds = %221, %162, %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %240 = load ptr, ptr %2, align 8
  ret ptr %240
}

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

declare signext i8 @sizeclass(i8 noundef zeroext) #2

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) #3

declare zeroext i8 @atomic_Cas(ptr noundef, i32 noundef, i32 noundef) #2

declare void @spanlist_remove(ptr noundef, ptr noundef) #2

declare void @spanlist_insertback(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) #3

declare zeroext i8 @span_sweep(ptr noundef, i8 noundef zeroext) #2

declare i64 @span_nextFreeIndex(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @central_grow(ptr noundef) #0

declare i32 @printf(ptr noundef, ...) #2

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

declare void @span_refillAllocCache(ptr noundef, i64 noundef) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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 }

!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, !7, i64 40}
!10 = !{!"mcentral", !7, i64 0, !7, i64 40, !11, i64 48, !11, i64 64, !12, i64 80}
!11 = !{!"mspanlist", !6, i64 0, !6, i64 8}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!12, !12, i64 0}
!15 = !{!16, !19, i64 720}
!16 = !{!"mheap", !7, i64 0, !17, i64 40, !17, i64 48, !18, i64 56, !7, i64 88, !20, i64 232, !20, i64 296, !20, i64 360, !20, i64 424, !20, i64 488, !20, i64 552, !21, i64 616, !18, i64 640, !6, i64 672, !7, i64 680, !12, i64 712, !19, i64 720, !19, i64 724, !19, i64 728, !6, i64 736, !12, i64 744, !12, i64 752, !12, i64 760, !7, i64 768}
!17 = !{!"mtreap", !6, i64 0}
!18 = !{!"", !6, i64 0, !19, i64 8, !12, i64 16, !19, i64 24}
!19 = !{!"int", !7, i64 0}
!20 = !{!"mfixalloc", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !19, i64 40, !12, i64 48, !7, i64 56}
!21 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16}
!22 = !{!19, !19, i64 0}
!23 = !{!10, !6, i64 48}
!24 = !{!25, !19, i64 56}
!25 = !{!"mspan", !6, i64 0, !6, i64 8, !6, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !7, i64 48, !7, i64 49, !7, i64 50, !26, i64 52, !19, i64 56, !12, i64 64, !7, i64 72, !26, i64 74, !7, i64 76, !7, i64 77, !26, i64 78, !12, i64 80, !12, i64 88, !12, i64 96, !6, i64 104, !6, i64 112, !12, i64 120}
!26 = !{!"short", !7, i64 0}
!27 = !{!25, !6, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!10, !6, i64 64}
!31 = !{!25, !12, i64 96}
!32 = !{!25, !12, i64 88}
!33 = distinct !{!33, !29}
!34 = !{!25, !26, i64 52}
!35 = !{!25, !12, i64 80}
!36 = !{!25, !12, i64 120}


; 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.mheap = type { %union.pthread_mutex_t, %struct.mtreap, %struct.mtreap, %struct.array_t, [2 x %struct.gcSweepBuf], %struct.mfixalloc, %struct.mfixalloc, %struct.mfixalloc, %struct.mfixalloc, %struct.mfixalloc, %struct.mfixalloc, %struct.lineralloc, %struct.array_t, ptr, [1 x %struct.array_t], i64, i32, i32, i32, ptr, i64, i64, i64, [134 x %struct.mcentral] }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.mtreap = type { ptr }
%struct.gcSweepBuf = type { %union.pthread_mutex_t, ptr, i64, i64, i32 }
%struct.mfixalloc = type { i64, ptr, ptr, ptr, i64, i32, i64, i8 }
%struct.lineralloc = type { i64, i64, i64 }
%struct.array_t = type { ptr, i32, i64, i32 }
%struct.mcentral = type { %union.pthread_mutex_t, i8, %struct.mspanlist, %struct.mspanlist, i64 }
%struct.mspanlist = type { ptr, ptr }

@heap_ = external local_unnamed_addr global %struct.mheap, align 8
@.str = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @central_cacheSpan(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 40
  %3 = load i8, ptr %2, align 8, !tbaa !5
  %4 = tail call signext i8 @sizeclass(i8 noundef zeroext %3) #4
  %5 = tail call i32 @pthread_mutex_lock(ptr noundef %0) #4
  %6 = load i32, ptr getelementptr inbounds (i8, ptr @heap_, i64 720), align 8, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %0, i64 48
  %8 = add i32 %6, -2
  %9 = add i32 %6, -1
  %10 = getelementptr inbounds i8, ptr %0, i64 64
  br label %11

11:                                               ; preds = %.backedge, %1
  %.071.in = phi ptr [ %7, %1 ], [ %.071.in.be, %.backedge ]
  %.071 = load ptr, ptr %.071.in, align 8, !tbaa !19
  %.not = icmp eq ptr %.071, null
  br i1 %.not, label %.preheader, label %12

12:                                               ; preds = %11
  %13 = getelementptr inbounds i8, ptr %.071, i64 56
  %14 = load i32, ptr %13, align 8, !tbaa !20
  %15 = icmp eq i32 %14, %8
  br i1 %15, label %16, label %21

16:                                               ; preds = %12
  %17 = tail call zeroext i8 @atomic_Cas(ptr noundef nonnull %13, i32 noundef %8, i32 noundef %9) #4
  %.not81 = icmp eq i8 %17, 0
  br i1 %.not81, label %._crit_edge, label %18

._crit_edge:                                      ; preds = %16
  %.pre = load i32, ptr %13, align 8, !tbaa !20
  br label %21

18:                                               ; preds = %16
  tail call void @spanlist_remove(ptr noundef nonnull %7, ptr noundef nonnull %.071) #4
  tail call void @spanlist_insertback(ptr noundef nonnull %10, ptr noundef nonnull %.071) #4
  %19 = tail call i32 @pthread_mutex_unlock(ptr noundef %0) #4
  %20 = tail call zeroext i8 @span_sweep(ptr noundef nonnull %.071, i8 noundef zeroext 1) #4
  br label %51

21:                                               ; preds = %._crit_edge, %12
  %22 = phi i32 [ %.pre, %._crit_edge ], [ %14, %12 ]
  %23 = icmp eq i32 %22, %9
  br i1 %23, label %.backedge, label %24

.backedge:                                        ; preds = %21, %39
  %.071.in.be = phi ptr [ %.071, %21 ], [ %7, %39 ]
  br label %11, !llvm.loop !23

24:                                               ; preds = %21
  tail call void @spanlist_remove(ptr noundef nonnull %7, ptr noundef nonnull %.071) #4
  tail call void @spanlist_insertback(ptr noundef nonnull %10, ptr noundef nonnull %.071) #4
  %25 = tail call i32 @pthread_mutex_unlock(ptr noundef %0) #4
  br label %51

.preheader:                                       ; preds = %11, %41
  %.1.in = phi ptr [ %.1, %41 ], [ %10, %11 ]
  %.1 = load ptr, ptr %.1.in, align 8, !tbaa !19
  %.not78 = icmp eq ptr %.1, null
  br i1 %.not78, label %44, label %26

26:                                               ; preds = %.preheader
  %27 = getelementptr inbounds i8, ptr %.1, i64 56
  %28 = load i32, ptr %27, align 8, !tbaa !20
  %29 = icmp eq i32 %28, %8
  br i1 %29, label %30, label %41

30:                                               ; preds = %26
  %31 = tail call zeroext i8 @atomic_Cas(ptr noundef nonnull %27, i32 noundef %8, i32 noundef %9) #4
  %.not79 = icmp eq i8 %31, 0
  br i1 %.not79, label %._crit_edge99, label %32

._crit_edge99:                                    ; preds = %30
  %.pre100 = load i32, ptr %27, align 8, !tbaa !20
  br label %41

32:                                               ; preds = %30
  tail call void @spanlist_remove(ptr noundef nonnull %10, ptr noundef nonnull %.1) #4
  tail call void @spanlist_insertback(ptr noundef nonnull %10, ptr noundef nonnull %.1) #4
  %33 = tail call i32 @pthread_mutex_unlock(ptr noundef %0) #4
  %34 = tail call zeroext i8 @span_sweep(ptr noundef nonnull %.1, i8 noundef zeroext 1) #4
  %35 = tail call i64 @span_nextFreeIndex(ptr noundef nonnull %.1) #4
  %36 = getelementptr inbounds i8, ptr %.1, i64 96
  %37 = load i64, ptr %36, align 8, !tbaa !25
  %.not80 = icmp eq i64 %35, %37
  br i1 %.not80, label %39, label %.thread

.thread:                                          ; preds = %32
  %38 = getelementptr inbounds i8, ptr %.1, i64 88
  store i64 %35, ptr %38, align 8, !tbaa !26
  br label %51

39:                                               ; preds = %32
  %40 = tail call i32 @pthread_mutex_lock(ptr noundef %0) #4
  br label %.backedge

41:                                               ; preds = %._crit_edge99, %26
  %42 = phi i32 [ %.pre100, %._crit_edge99 ], [ %28, %26 ]
  %43 = icmp eq i32 %42, %9
  br i1 %43, label %.preheader, label %44, !llvm.loop !27

44:                                               ; preds = %41, %.preheader
  %45 = tail call i32 @pthread_mutex_unlock(ptr noundef %0) #4
  %46 = tail call ptr @central_grow(ptr noundef %0)
  %47 = icmp eq ptr %46, null
  br i1 %47, label %81, label %48

48:                                               ; preds = %44
  %49 = tail call i32 @pthread_mutex_lock(ptr noundef %0) #4
  tail call void @spanlist_insertback(ptr noundef nonnull %10, ptr noundef nonnull %46) #4
  %50 = tail call i32 @pthread_mutex_unlock(ptr noundef %0) #4
  br label %51

51:                                               ; preds = %.thread, %48, %24, %18
  %.2 = phi ptr [ %.071, %18 ], [ %.071, %24 ], [ %46, %48 ], [ %.1, %.thread ]
  %52 = getelementptr inbounds i8, ptr %.2, i64 96
  %53 = load i64, ptr %52, align 8, !tbaa !25
  %54 = trunc i64 %53 to i32
  %55 = getelementptr inbounds i8, ptr %.2, i64 52
  %56 = load i16, ptr %55, align 4, !tbaa !28
  %57 = zext i16 %56 to i32
  %58 = sub nsw i32 %54, %57
  %59 = icmp eq i32 %54, %57
  br i1 %59, label %66, label %60

60:                                               ; preds = %51
  %61 = getelementptr inbounds i8, ptr %.2, i64 88
  %62 = load i64, ptr %61, align 8, !tbaa !26
  %63 = icmp eq i64 %62, %53
  %64 = zext i16 %56 to i64
  %65 = icmp eq i64 %53, %64
  %or.cond = or i1 %65, %63
  br i1 %or.cond, label %66, label %68

66:                                               ; preds = %60, %51
  %67 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %68

68:                                               ; preds = %60, %66
  %69 = getelementptr inbounds i8, ptr %0, i64 80
  %70 = sext i32 %58 to i64
  %71 = tail call i64 @atomic_Xadd64(ptr noundef nonnull %69, i64 noundef %70) #4
  %72 = getelementptr inbounds i8, ptr %.2, i64 88
  %73 = load i64, ptr %72, align 8, !tbaa !26
  %74 = lshr i64 %73, 3
  %75 = and i64 %74, 2305843009213693944
  tail call void @span_refillAllocCache(ptr noundef nonnull %.2, i64 noundef %75) #4
  %76 = load i64, ptr %72, align 8, !tbaa !26
  %77 = and i64 %76, 63
  %78 = getelementptr inbounds i8, ptr %.2, i64 120
  %79 = load i64, ptr %78, align 8, !tbaa !29
  %80 = lshr i64 %79, %77
  store i64 %80, ptr %78, align 8, !tbaa !29
  br label %81

81:                                               ; preds = %44, %68
  %.0 = phi ptr [ %.2, %68 ], [ null, %44 ]
  ret ptr %.0
}

declare signext i8 @sizeclass(i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) local_unnamed_addr #2

declare zeroext i8 @atomic_Cas(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare void @spanlist_remove(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @spanlist_insertback(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) local_unnamed_addr #2

declare zeroext i8 @span_sweep(ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

declare i64 @span_nextFreeIndex(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @central_grow(ptr noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

declare i64 @atomic_Xadd64(ptr noundef, i64 noundef) local_unnamed_addr #1

declare void @span_refillAllocCache(ptr noundef, i64 noundef) local_unnamed_addr #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 = { nounwind "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 = { nofree nounwind "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 }

!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 40}
!6 = !{!"mcentral", !7, i64 0, !7, i64 40, !9, i64 48, !9, i64 64, !11, i64 80}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"mspanlist", !10, i64 0, !10, i64 8}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !16, i64 720}
!13 = !{!"mheap", !7, i64 0, !14, i64 40, !14, i64 48, !15, i64 56, !7, i64 88, !17, i64 232, !17, i64 296, !17, i64 360, !17, i64 424, !17, i64 488, !17, i64 552, !18, i64 616, !15, i64 640, !10, i64 672, !7, i64 680, !11, i64 712, !16, i64 720, !16, i64 724, !16, i64 728, !10, i64 736, !11, i64 744, !11, i64 752, !11, i64 760, !7, i64 768}
!14 = !{!"mtreap", !10, i64 0}
!15 = !{!"", !10, i64 0, !16, i64 8, !11, i64 16, !16, i64 24}
!16 = !{!"int", !7, i64 0}
!17 = !{!"mfixalloc", !11, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !11, i64 32, !16, i64 40, !11, i64 48, !7, i64 56}
!18 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16}
!19 = !{!10, !10, i64 0}
!20 = !{!21, !16, i64 56}
!21 = !{!"mspan", !10, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !7, i64 48, !7, i64 49, !7, i64 50, !22, i64 52, !16, i64 56, !11, i64 64, !7, i64 72, !22, i64 74, !7, i64 76, !7, i64 77, !22, i64 78, !11, i64 80, !11, i64 88, !11, i64 96, !10, i64 104, !10, i64 112, !11, i64 120}
!22 = !{!"short", !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!21, !11, i64 96}
!26 = !{!21, !11, i64 88}
!27 = distinct !{!27, !24}
!28 = !{!21, !22, i64 52}
!29 = !{!21, !11, i64 120}


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