; LLVM IR from brewlin/garbage-collect :: gc-python/malloc (obmalloc)

; 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.arena_object = type { i64, ptr, i32, i32, ptr, ptr, ptr }

@arenas = external dso_local global ptr, align 8
@maxarenas = external dso_local global i32, align 4
@unused_arena_objects = external dso_local global ptr, align 8
@usable_arenas = external dso_local global ptr, align 8
@narenas_currently_allocated = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [85 x i8], align 1
@__PRETTY_FUNCTION__.new_arena = external hidden unnamed_addr constant [37 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [47 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @new_arena() #0 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %8 = load ptr, ptr @unused_arena_objects, align 8, !tbaa !5
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %86

10:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %11 = load i32, ptr @maxarenas, align 4, !tbaa !9
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %13, label %16

13:                                               ; preds = %10
  %14 = load i32, ptr @maxarenas, align 4, !tbaa !9
  %15 = shl i32 %14, 1
  br label %17

16:                                               ; preds = %10
  br label %17

17:                                               ; preds = %16, %13
  %18 = phi i32 [ %15, %13 ], [ 16, %16 ]
  store i32 %18, ptr %5, align 4, !tbaa !9
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = load i32, ptr @maxarenas, align 4, !tbaa !9
  %21 = icmp ule i32 %19, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %17
  store ptr null, ptr %1, align 8
  store i32 1, ptr %7, align 4
  br label %83

23:                                               ; preds = %17
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = mul i64 %25, 48
  store i64 %26, ptr %6, align 8, !tbaa !11
  %27 = load ptr, ptr @arenas, align 8, !tbaa !5
  %28 = load i64, ptr %6, align 8, !tbaa !11
  %29 = call ptr @realloc(ptr noundef %27, i64 noundef %28) #6
  store ptr %29, ptr %2, align 8, !tbaa !5
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %33

32:                                               ; preds = %23
  store ptr null, ptr %1, align 8
  store i32 1, ptr %7, align 4
  br label %83

33:                                               ; preds = %23
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %34, ptr @arenas, align 8, !tbaa !5
  %35 = load ptr, ptr @usable_arenas, align 8, !tbaa !5
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %38

37:                                               ; preds = %33
  br label %39

38:                                               ; preds = %33
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 79, ptr noundef @__PRETTY_FUNCTION__.new_arena) #7
  unreachable

39:                                               ; preds = %37
  %40 = load ptr, ptr @unused_arena_objects, align 8, !tbaa !5
  %41 = icmp eq ptr %40, null
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  br label %44

43:                                               ; preds = %39
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 80, ptr noundef @__PRETTY_FUNCTION__.new_arena) #7
  unreachable

44:                                               ; preds = %42
  %45 = load i32, ptr @maxarenas, align 4, !tbaa !9
  store i32 %45, ptr %4, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %74, %44
  %47 = load i32, ptr %4, align 4, !tbaa !9
  %48 = load i32, ptr %5, align 4, !tbaa !9
  %49 = icmp ult i32 %47, %48
  br i1 %49, label %50, label %77

50:                                               ; preds = %46
  %51 = load ptr, ptr @arenas, align 8, !tbaa !5
  %52 = load i32, ptr %4, align 4, !tbaa !9
  %53 = zext i32 %52 to i64
  %54 = getelementptr inbounds %struct.arena_object, ptr %51, i64 %53
  %55 = getelementptr inbounds %struct.arena_object, ptr %54, i32 0, i32 0
  store i64 0, ptr %55, align 8, !tbaa !13
  %56 = load i32, ptr %4, align 4, !tbaa !9
  %57 = load i32, ptr %5, align 4, !tbaa !9
  %58 = sub i32 %57, 1
  %59 = icmp ult i32 %56, %58
  br i1 %59, label %60, label %66

60:                                               ; preds = %50
  %61 = load ptr, ptr @arenas, align 8, !tbaa !5
  %62 = load i32, ptr %4, align 4, !tbaa !9
  %63 = add i32 %62, 1
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds %struct.arena_object, ptr %61, i64 %64
  br label %67

66:                                               ; preds = %50
  br label %67

67:                                               ; preds = %66, %60
  %68 = phi ptr [ %65, %60 ], [ null, %66 ]
  %69 = load ptr, ptr @arenas, align 8, !tbaa !5
  %70 = load i32, ptr %4, align 4, !tbaa !9
  %71 = zext i32 %70 to i64
  %72 = getelementptr inbounds %struct.arena_object, ptr %69, i64 %71
  %73 = getelementptr inbounds %struct.arena_object, ptr %72, i32 0, i32 5
  store ptr %68, ptr %73, align 8, !tbaa !15
  br label %74

74:                                               ; preds = %67
  %75 = load i32, ptr %4, align 4, !tbaa !9
  %76 = add i32 %75, 1
  store i32 %76, ptr %4, align 4, !tbaa !9
  br label %46, !llvm.loop !16

77:                                               ; preds = %46
  %78 = load ptr, ptr @arenas, align 8, !tbaa !5
  %79 = load i32, ptr @maxarenas, align 4, !tbaa !9
  %80 = zext i32 %79 to i64
  %81 = getelementptr inbounds %struct.arena_object, ptr %78, i64 %80
  store ptr %81, ptr @unused_arena_objects, align 8, !tbaa !5
  %82 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %82, ptr @maxarenas, align 4, !tbaa !9
  store i32 0, ptr %7, align 4
  br label %83

83:                                               ; preds = %77, %32, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %84 = load i32, ptr %7, align 4
  switch i32 %84, label %163 [
    i32 0, label %85
  ]

85:                                               ; preds = %83
  br label %86

86:                                               ; preds = %85, %0
  %87 = load ptr, ptr @unused_arena_objects, align 8, !tbaa !5
  %88 = icmp ne ptr %87, null
  br i1 %88, label %89, label %90

89:                                               ; preds = %86
  br label %91

90:                                               ; preds = %86
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 94, ptr noundef @__PRETTY_FUNCTION__.new_arena) #7
  unreachable

91:                                               ; preds = %89
  %92 = load ptr, ptr @unused_arena_objects, align 8, !tbaa !5
  store ptr %92, ptr %2, align 8, !tbaa !5
  %93 = load ptr, ptr %2, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.arena_object, ptr %93, i32 0, i32 5
  %95 = load ptr, ptr %94, align 8, !tbaa !15
  store ptr %95, ptr @unused_arena_objects, align 8, !tbaa !5
  %96 = load ptr, ptr %2, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.arena_object, ptr %96, i32 0, i32 0
  %98 = load i64, ptr %97, align 8, !tbaa !13
  %99 = icmp eq i64 %98, 0
  br i1 %99, label %100, label %101

100:                                              ; preds = %91
  br label %102

101:                                              ; preds = %91
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 98, ptr noundef @__PRETTY_FUNCTION__.new_arena) #7
  unreachable

102:                                              ; preds = %100
  %103 = call noalias ptr @malloc(i64 noundef 262144) #8
  %104 = ptrtoint ptr %103 to i64
  %105 = load ptr, ptr %2, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.arena_object, ptr %105, i32 0, i32 0
  store i64 %104, ptr %106, align 8, !tbaa !13
  %107 = load ptr, ptr %2, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.arena_object, ptr %107, i32 0, i32 0
  %109 = load i64, ptr %108, align 8, !tbaa !13
  %110 = icmp eq i64 %109, 0
  br i1 %110, label %111, label %116

111:                                              ; preds = %102
  %112 = load ptr, ptr @unused_arena_objects, align 8, !tbaa !5
  %113 = load ptr, ptr %2, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.arena_object, ptr %113, i32 0, i32 5
  store ptr %112, ptr %114, align 8, !tbaa !15
  %115 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %115, ptr @unused_arena_objects, align 8, !tbaa !5
  store ptr null, ptr %1, align 8
  store i32 1, ptr %7, align 4
  br label %163

116:                                              ; preds = %102
  %117 = load i64, ptr @narenas_currently_allocated, align 8, !tbaa !11
  %118 = add i64 %117, 1
  store i64 %118, ptr @narenas_currently_allocated, align 8, !tbaa !11
  %119 = load ptr, ptr %2, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.arena_object, ptr %119, i32 0, i32 4
  store ptr null, ptr %120, align 8, !tbaa !18
  %121 = load ptr, ptr %2, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.arena_object, ptr %121, i32 0, i32 0
  %123 = load i64, ptr %122, align 8, !tbaa !13
  %124 = inttoptr i64 %123 to ptr
  %125 = load ptr, ptr %2, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.arena_object, ptr %125, i32 0, i32 1
  store ptr %124, ptr %126, align 8, !tbaa !19
  %127 = load ptr, ptr %2, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.arena_object, ptr %127, i32 0, i32 2
  store i32 64, ptr %128, align 8, !tbaa !20
  %129 = load ptr, ptr %2, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.arena_object, ptr %129, i32 0, i32 2
  %131 = load i32, ptr %130, align 8, !tbaa !20
  %132 = mul i32 4096, %131
  %133 = icmp eq i32 %132, 262144
  br i1 %133, label %134, label %135

134:                                              ; preds = %116
  br label %136

135:                                              ; preds = %116
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 113, ptr noundef @__PRETTY_FUNCTION__.new_arena) #7
  unreachable

136:                                              ; preds = %134
  %137 = load ptr, ptr %2, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.arena_object, ptr %137, i32 0, i32 0
  %139 = load i64, ptr %138, align 8, !tbaa !13
  %140 = and i64 %139, 4095
  %141 = trunc i64 %140 to i32
  store i32 %141, ptr %3, align 4, !tbaa !9
  %142 = load i32, ptr %3, align 4, !tbaa !9
  %143 = icmp ne i32 %142, 0
  br i1 %143, label %144, label %156

144:                                              ; preds = %136
  %145 = load ptr, ptr %2, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.arena_object, ptr %145, i32 0, i32 2
  %147 = load i32, ptr %146, align 8, !tbaa !20
  %148 = add i32 %147, -1
  store i32 %148, ptr %146, align 8, !tbaa !20
  %149 = load i32, ptr %3, align 4, !tbaa !9
  %150 = sub i32 4096, %149
  %151 = load ptr, ptr %2, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.arena_object, ptr %151, i32 0, i32 1
  %153 = load ptr, ptr %152, align 8, !tbaa !19
  %154 = zext i32 %150 to i64
  %155 = getelementptr inbounds i8, ptr %153, i64 %154
  store ptr %155, ptr %152, align 8, !tbaa !19
  br label %156

156:                                              ; preds = %144, %136
  %157 = load ptr, ptr %2, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.arena_object, ptr %157, i32 0, i32 2
  %159 = load i32, ptr %158, align 8, !tbaa !20
  %160 = load ptr, ptr %2, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.arena_object, ptr %160, i32 0, i32 3
  store i32 %159, ptr %161, align 4, !tbaa !21
  %162 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %162, ptr %1, align 8
  store i32 1, ptr %7, align 4
  br label %163

163:                                              ; preds = %156, %111, %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %164 = load ptr, ptr %1, align 8
  ret ptr %164
}

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

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

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 = { nounwind allocsize(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 #3 = { noreturn 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 allocsize(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 }
attributes #6 = { nounwind allocsize(1) }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind allocsize(0) }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"arena_object", !12, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !6, i64 24, !6, i64 32, !6, i64 40}
!15 = !{!14, !6, i64 32}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!14, !6, i64 24}
!19 = !{!14, !6, i64 8}
!20 = !{!14, !10, i64 16}
!21 = !{!14, !10, i64 20}


; 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.arena_object = type { i64, ptr, i32, i32, ptr, ptr, ptr }

@arenas = external dso_local local_unnamed_addr global ptr, align 8
@maxarenas = external dso_local local_unnamed_addr global i32, align 4
@unused_arena_objects = external dso_local local_unnamed_addr global ptr, align 8
@usable_arenas = external dso_local local_unnamed_addr global ptr, align 8
@narenas_currently_allocated = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [85 x i8], align 1
@__PRETTY_FUNCTION__.new_arena = external hidden unnamed_addr constant [37 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @new_arena() local_unnamed_addr #0 {
  %1 = load ptr, ptr @unused_arena_objects, align 8, !tbaa !5
  %2 = icmp eq ptr %1, null
  br i1 %2, label %3, label %.thread

3:                                                ; preds = %0
  %4 = load i32, ptr @maxarenas, align 4
  %.not = icmp eq i32 %4, 0
  %5 = shl i32 %4, 1
  %6 = select i1 %.not, i32 16, i32 %5
  %.not40 = icmp ugt i32 %6, %4
  br i1 %.not40, label %7, label %81

7:                                                ; preds = %3
  %8 = zext i32 %6 to i64
  %9 = mul nuw nsw i64 %8, 48
  %10 = load ptr, ptr @arenas, align 8, !tbaa !5
  %11 = tail call ptr @realloc(ptr noundef %10, i64 noundef %9) #4
  %12 = icmp eq ptr %11, null
  br i1 %12, label %81, label %13

13:                                               ; preds = %7
  store ptr %11, ptr @arenas, align 8, !tbaa !5
  %14 = load ptr, ptr @usable_arenas, align 8, !tbaa !5
  %15 = icmp eq ptr %14, null
  br i1 %15, label %17, label %16

16:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 79, ptr noundef nonnull @__PRETTY_FUNCTION__.new_arena) #5
  unreachable

17:                                               ; preds = %13
  %18 = load ptr, ptr @unused_arena_objects, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 80, ptr noundef nonnull @__PRETTY_FUNCTION__.new_arena) #5
  unreachable

21:                                               ; preds = %17
  %22 = load i32, ptr @maxarenas, align 4, !tbaa !9
  %23 = icmp ult i32 %22, %6
  br i1 %23, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %21
  %.pre46 = zext i32 %22 to i64
  %24 = getelementptr inbounds %struct.arena_object, ptr %11, i64 %.pre46
  store i32 %6, ptr @maxarenas, align 4, !tbaa !9
  br label %.thread

.lr.ph:                                           ; preds = %21
  %25 = add i32 %6, -1
  %26 = zext i32 %22 to i64
  %27 = zext i32 %25 to i64
  %xtraiter = and i64 %26, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.prol.loopexit, label %.prol.loopexit.unr-lcssa

.prol.loopexit.unr-lcssa:                         ; preds = %.lr.ph
  %28 = load ptr, ptr @arenas, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.arena_object, ptr %28, i64 %26
  store i64 0, ptr %29, align 8, !tbaa !11
  %30 = icmp ult i32 %22, %25
  %31 = load ptr, ptr @arenas, align 8
  %indvars.iv.next.prol = add nuw nsw i64 %26, 1
  %32 = getelementptr inbounds %struct.arena_object, ptr %31, i64 %indvars.iv.next.prol
  %33 = select i1 %30, ptr %32, ptr null
  %34 = getelementptr inbounds %struct.arena_object, ptr %31, i64 %26, i32 5
  store ptr %33, ptr %34, align 8, !tbaa !14
  br label %.prol.loopexit

.prol.loopexit:                                   ; preds = %.prol.loopexit.unr-lcssa, %.lr.ph
  %indvars.iv.unr = phi i64 [ %26, %.lr.ph ], [ %indvars.iv.next.prol, %.prol.loopexit.unr-lcssa ]
  %35 = add nsw i64 %8, -1
  %36 = icmp eq i64 %35, %26
  br i1 %36, label %._crit_edge, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.prol.loopexit, %.lr.ph.new
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.lr.ph.new ], [ %indvars.iv.unr, %.prol.loopexit ]
  %37 = load ptr, ptr @arenas, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.arena_object, ptr %37, i64 %indvars.iv
  store i64 0, ptr %38, align 8, !tbaa !11
  %39 = icmp ult i64 %indvars.iv, %27
  %40 = load ptr, ptr @arenas, align 8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %41 = getelementptr inbounds %struct.arena_object, ptr %40, i64 %indvars.iv.next
  %42 = select i1 %39, ptr %41, ptr null
  %43 = getelementptr inbounds %struct.arena_object, ptr %40, i64 %indvars.iv, i32 5
  store ptr %42, ptr %43, align 8, !tbaa !14
  %44 = load ptr, ptr @arenas, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.arena_object, ptr %44, i64 %indvars.iv.next
  store i64 0, ptr %45, align 8, !tbaa !11
  %46 = icmp ult i64 %indvars.iv.next, %27
  %47 = load ptr, ptr @arenas, align 8
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %48 = getelementptr inbounds %struct.arena_object, ptr %47, i64 %indvars.iv.next.1
  %49 = select i1 %46, ptr %48, ptr null
  %50 = getelementptr inbounds %struct.arena_object, ptr %47, i64 %indvars.iv.next, i32 5
  store ptr %49, ptr %50, align 8, !tbaa !14
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %8
  br i1 %exitcond.not.1, label %._crit_edge, label %.lr.ph.new, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph.new, %.prol.loopexit
  %.pre = load ptr, ptr @arenas, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.arena_object, ptr %.pre, i64 %26
  store ptr %51, ptr @unused_arena_objects, align 8, !tbaa !5
  store i32 %6, ptr @maxarenas, align 4, !tbaa !9
  %.not41 = icmp eq ptr %.pre, null
  br i1 %.not41, label %52, label %.thread

52:                                               ; preds = %._crit_edge
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 94, ptr noundef nonnull @__PRETTY_FUNCTION__.new_arena) #5
  unreachable

.thread:                                          ; preds = %._crit_edge.thread, %0, %._crit_edge
  %53 = phi ptr [ %51, %._crit_edge ], [ %1, %0 ], [ %24, %._crit_edge.thread ]
  %54 = getelementptr inbounds i8, ptr %53, i64 32
  %55 = load ptr, ptr %54, align 8, !tbaa !14
  store ptr %55, ptr @unused_arena_objects, align 8, !tbaa !5
  %56 = load i64, ptr %53, align 8, !tbaa !11
  %57 = icmp eq i64 %56, 0
  br i1 %57, label %59, label %58

58:                                               ; preds = %.thread
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 98, ptr noundef nonnull @__PRETTY_FUNCTION__.new_arena) #5
  unreachable

59:                                               ; preds = %.thread
  %60 = tail call noalias dereferenceable_or_null(262144) ptr @malloc(i64 noundef 262144) #6
  %61 = ptrtoint ptr %60 to i64
  store i64 %61, ptr %53, align 8, !tbaa !11
  %62 = icmp eq ptr %60, null
  br i1 %62, label %63, label %64

63:                                               ; preds = %59
  store ptr %53, ptr @unused_arena_objects, align 8, !tbaa !5
  br label %81

64:                                               ; preds = %59
  %65 = load i64, ptr @narenas_currently_allocated, align 8, !tbaa !17
  %66 = add i64 %65, 1
  store i64 %66, ptr @narenas_currently_allocated, align 8, !tbaa !17
  %67 = getelementptr inbounds i8, ptr %53, i64 24
  store ptr null, ptr %67, align 8, !tbaa !18
  %68 = load i64, ptr %53, align 8, !tbaa !11
  %69 = inttoptr i64 %68 to ptr
  %70 = getelementptr inbounds i8, ptr %53, i64 8
  store ptr %69, ptr %70, align 8, !tbaa !19
  %71 = getelementptr inbounds i8, ptr %53, i64 16
  store i32 64, ptr %71, align 8, !tbaa !20
  %72 = trunc i64 %68 to i32
  %73 = and i32 %72, 4095
  %.not42 = icmp eq i32 %73, 0
  br i1 %.not42, label %78, label %74

74:                                               ; preds = %64
  store i32 63, ptr %71, align 8, !tbaa !20
  %75 = sub nuw nsw i32 4096, %73
  %76 = zext nneg i32 %75 to i64
  %77 = getelementptr inbounds i8, ptr %69, i64 %76
  store ptr %77, ptr %70, align 8, !tbaa !19
  br label %78

78:                                               ; preds = %74, %64
  %79 = phi i32 [ 63, %74 ], [ 64, %64 ]
  %80 = getelementptr inbounds i8, ptr %53, i64 20
  store i32 %79, ptr %80, align 4, !tbaa !21
  br label %81

81:                                               ; preds = %3, %7, %78, %63
  %.1 = phi ptr [ null, %63 ], [ %53, %78 ], [ null, %7 ], [ null, %3 ]
  ret ptr %.1
}

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { noreturn 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 allocsize(1) }
attributes #5 = { noreturn nounwind }
attributes #6 = { nounwind allocsize(0) }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"arena_object", !13, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !6, i64 24, !6, i64 32, !6, i64 40}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !6, i64 32}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!13, !13, i64 0}
!18 = !{!12, !6, i64 24}
!19 = !{!12, !6, i64 8}
!20 = !{!12, !10, i64 16}
!21 = !{!12, !10, i64 20}


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