; LLVM IR from humz2k/sugaryc :: ext/bdwgc (alloc)

; 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._GC_arrays = type { i64, i64, i64, ptr, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i64, i64, i64, ptr, ptr, i64, i32, i64, i64, i64, %struct.dl_hashtbl_s, %struct.dl_hashtbl_s, %struct.fnlz_roots_s, i32, ptr, i64, i64, i32, i64, i64, i64, ptr, [64 x ptr], [8 x i8], [64 x ptr], [129 x ptr], [129 x ptr], [129 x ptr], [2049 x i64], [129 x ptr], [4096 x i8], [4096 x i64], [4096 x i64], ptr, [2048 x %struct.roots], [512 x %struct.exclusion], [2048 x ptr] }
%struct.dl_hashtbl_s = type { ptr, i64, i32 }
%struct.fnlz_roots_s = type { ptr, ptr }
%struct.roots = type { ptr, ptr, ptr, i32 }
%struct.exclusion = type { ptr, ptr }

@GC_gc_no = external dso_local global i64, align 8
@GC_arrays = external global %struct._GC_arrays, align 8
@GC_print_stats = external global i32, align 4
@GC_on_heap_resize = external dso_local global ptr, align 8
@GC_least_plausible_heap_addr = external dso_local global ptr, align 8
@GC_greatest_plausible_heap_addr = external dso_local global ptr, align 8
@GC_max_heapsize = external hidden global i64, align 8
@GC_page_size = external global i64, align 8
@.str.8 = external hidden unnamed_addr constant [54 x i8], align 1
@GC_current_warn_proc = external global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [48 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare hidden i64 @min_bytes_allocd() #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #2

declare void @GC_log_printf(ptr noundef, ...) #3

; Function Attrs: nounwind uwtable
declare dso_local ptr @GC_os_get_mem(i64 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @GC_add_to_heap(ptr noundef, i64 noundef) #1

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

12:                                               ; preds = %1
  store i64 1, ptr %3, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %12, %1
  %14 = load i64, ptr %3, align 8, !tbaa !5
  %15 = mul i64 %14, 4096
  %16 = load i64, ptr @GC_page_size, align 8, !tbaa !5
  %17 = sub i64 %16, 1
  %18 = sub i64 -1, %17
  %19 = icmp ult i64 %15, %18
  %20 = zext i1 %19 to i32
  %21 = sext i32 %20 to i64
  %22 = call i64 @llvm.expect.i64(i64 %21, i64 1)
  %23 = icmp ne i64 %22, 0
  br i1 %23, label %24, label %30

24:                                               ; preds = %13
  %25 = load i64, ptr %3, align 8, !tbaa !5
  %26 = mul i64 %25, 4096
  %27 = load i64, ptr @GC_page_size, align 8, !tbaa !5
  %28 = sub i64 %27, 1
  %29 = add i64 %26, %28
  br label %31

30:                                               ; preds = %13
  br label %31

31:                                               ; preds = %30, %24
  %32 = phi i64 [ %29, %24 ], [ -1, %30 ]
  %33 = load i64, ptr @GC_page_size, align 8, !tbaa !5
  %34 = sub i64 %33, 1
  %35 = xor i64 %34, -1
  %36 = and i64 %32, %35
  store i64 %36, ptr %4, align 8, !tbaa !5
  %37 = load i32, ptr @GC_print_stats, align 4, !tbaa !9
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %40, label %39

39:                                               ; preds = %31
  br label %50

40:                                               ; preds = %31
  %41 = call i32 @GC_compute_heap_usage_percent()
  %42 = load i64, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 25), align 8, !tbaa !11
  %43 = add i64 %42, 511
  %44 = lshr i64 %43, 10
  %45 = load i64, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 26), align 8, !tbaa !16
  %46 = load i64, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 9), align 8, !tbaa !17
  %47 = add i64 %45, %46
  %48 = add i64 %47, 511
  %49 = lshr i64 %48, 10
  call void (ptr, ...) @GC_log_printf(ptr noundef @.str.8, i32 noundef %41, i64 noundef %44, i64 noundef %49)
  br label %50

50:                                               ; preds = %40, %39
  %51 = load i64, ptr @GC_max_heapsize, align 8, !tbaa !5
  %52 = icmp ne i64 %51, 0
  br i1 %52, label %53, label %64

53:                                               ; preds = %50
  %54 = load i64, ptr @GC_max_heapsize, align 8, !tbaa !5
  %55 = load i64, ptr %4, align 8, !tbaa !5
  %56 = icmp ult i64 %54, %55
  br i1 %56, label %63, label %57

57:                                               ; preds = %53
  %58 = load i64, ptr @GC_arrays, align 8, !tbaa !18
  %59 = load i64, ptr @GC_max_heapsize, align 8, !tbaa !5
  %60 = load i64, ptr %4, align 8, !tbaa !5
  %61 = sub i64 %59, %60
  %62 = icmp ugt i64 %58, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %57, %53
  store i32 0, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %162

64:                                               ; preds = %57, %50
  %65 = load i64, ptr %4, align 8, !tbaa !5
  %66 = call ptr @GC_os_get_mem(i64 noundef %65)
  store ptr %66, ptr %5, align 8, !tbaa !19
  %67 = load ptr, ptr %5, align 8, !tbaa !19
  %68 = icmp eq ptr null, %67
  %69 = zext i1 %68 to i32
  %70 = sext i32 %69 to i64
  %71 = call i64 @llvm.expect.i64(i64 %70, i64 0)
  %72 = icmp ne i64 %71, 0
  br i1 %72, label %73, label %77

73:                                               ; preds = %64
  %74 = load ptr, ptr @GC_current_warn_proc, align 8, !tbaa !19
  %75 = load i64, ptr %4, align 8, !tbaa !5
  %76 = lshr i64 %75, 10
  call void %74(ptr noundef @.str.9, i64 noundef %76)
  store i32 0, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %162

77:                                               ; preds = %64
  %78 = load i64, ptr @GC_gc_no, align 8, !tbaa !5
  store i64 %78, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 27), align 8, !tbaa !20
  %79 = load i32, ptr @GC_print_stats, align 4, !tbaa !9
  %80 = icmp ne i32 %79, 0
  %81 = xor i1 %80, true
  %82 = zext i1 %81 to i32
  %83 = sext i32 %82 to i64
  %84 = call i64 @llvm.expect.i64(i64 %83, i64 1)
  %85 = icmp ne i64 %84, 0
  br i1 %85, label %86, label %87

86:                                               ; preds = %77
  br label %94

87:                                               ; preds = %77
  %88 = load i64, ptr @GC_arrays, align 8, !tbaa !18
  %89 = load i64, ptr %4, align 8, !tbaa !5
  %90 = add i64 %88, %89
  %91 = add i64 %90, 511
  %92 = lshr i64 %91, 10
  %93 = load i64, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 9), align 8, !tbaa !17
  call void (ptr, ...) @GC_log_printf(ptr noundef @.str.10, i64 noundef %92, i64 noundef %93)
  br label %94

94:                                               ; preds = %87, %86
  %95 = call i64 @min_bytes_allocd()
  %96 = add i64 %95, 33554432
  store i64 %96, ptr %6, align 8, !tbaa !5
  %97 = load ptr, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 3), align 8, !tbaa !21
  %98 = icmp eq ptr %97, null
  br i1 %98, label %99, label %104

99:                                               ; preds = %94
  %100 = load ptr, ptr %5, align 8, !tbaa !19
  %101 = ptrtoint ptr %100 to i64
  %102 = and i64 %101, -9223372036854775808
  %103 = icmp ne i64 %102, 0
  br i1 %103, label %104, label %113

104:                                              ; preds = %99, %94
  %105 = load ptr, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 3), align 8, !tbaa !21
  %106 = icmp ne ptr %105, null
  br i1 %106, label %107, label %133

107:                                              ; preds = %104
  %108 = load ptr, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 3), align 8, !tbaa !21
  %109 = ptrtoint ptr %108 to i64
  %110 = load ptr, ptr %5, align 8, !tbaa !19
  %111 = ptrtoint ptr %110 to i64
  %112 = icmp ult i64 %109, %111
  br i1 %112, label %113, label %133

113:                                              ; preds = %107, %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %114 = load ptr, ptr %5, align 8, !tbaa !19
  %115 = ptrtoint ptr %114 to i64
  %116 = load i64, ptr %4, align 8, !tbaa !5
  %117 = add i64 %115, %116
  %118 = load i64, ptr %6, align 8, !tbaa !5
  %119 = add i64 %117, %118
  store i64 %119, ptr %8, align 8, !tbaa !5
  %120 = load i64, ptr %8, align 8, !tbaa !5
  %121 = load ptr, ptr %5, align 8, !tbaa !19
  %122 = ptrtoint ptr %121 to i64
  %123 = icmp ugt i64 %120, %122
  br i1 %123, label %124, label %132

124:                                              ; preds = %113
  %125 = load ptr, ptr @GC_greatest_plausible_heap_addr, align 8, !tbaa !19
  %126 = ptrtoint ptr %125 to i64
  %127 = load i64, ptr %8, align 8, !tbaa !5
  %128 = icmp ult i64 %126, %127
  br i1 %128, label %129, label %132

129:                                              ; preds = %124
  %130 = load i64, ptr %8, align 8, !tbaa !5
  %131 = inttoptr i64 %130 to ptr
  store ptr %131, ptr @GC_greatest_plausible_heap_addr, align 8, !tbaa !19
  br label %132

132:                                              ; preds = %129, %124, %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %152

133:                                              ; preds = %107, %104
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %134 = load ptr, ptr %5, align 8, !tbaa !19
  %135 = ptrtoint ptr %134 to i64
  %136 = load i64, ptr %6, align 8, !tbaa !5
  %137 = sub i64 %135, %136
  %138 = sub i64 %137, 8
  store i64 %138, ptr %9, align 8, !tbaa !5
  %139 = load i64, ptr %9, align 8, !tbaa !5
  %140 = load ptr, ptr %5, align 8, !tbaa !19
  %141 = ptrtoint ptr %140 to i64
  %142 = icmp ult i64 %139, %141
  br i1 %142, label %143, label %151

143:                                              ; preds = %133
  %144 = load ptr, ptr @GC_least_plausible_heap_addr, align 8, !tbaa !19
  %145 = ptrtoint ptr %144 to i64
  %146 = load i64, ptr %9, align 8, !tbaa !5
  %147 = icmp ugt i64 %145, %146
  br i1 %147, label %148, label %151

148:                                              ; preds = %143
  %149 = load i64, ptr %9, align 8, !tbaa !5
  %150 = inttoptr i64 %149 to ptr
  store ptr %150, ptr @GC_least_plausible_heap_addr, align 8, !tbaa !19
  br label %151

151:                                              ; preds = %148, %143, %133
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %152

152:                                              ; preds = %151, %132
  %153 = load ptr, ptr %5, align 8, !tbaa !19
  store ptr %153, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 3), align 8, !tbaa !21
  %154 = load ptr, ptr %5, align 8, !tbaa !19
  %155 = load i64, ptr %4, align 8, !tbaa !5
  call void @GC_add_to_heap(ptr noundef %154, i64 noundef %155)
  %156 = load ptr, ptr @GC_on_heap_resize, align 8, !tbaa !19
  %157 = icmp ne ptr %156, null
  br i1 %157, label %158, label %161

158:                                              ; preds = %152
  %159 = load ptr, ptr @GC_on_heap_resize, align 8, !tbaa !19
  %160 = load i64, ptr @GC_arrays, align 8, !tbaa !18
  call void %159(i64 noundef %160)
  br label %161

161:                                              ; preds = %158, %152
  store i32 1, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %162

162:                                              ; preds = %161, %73, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %163 = load i32, ptr %2, align 4
  ret i32 %163
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @GC_compute_heap_usage_percent() #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #3 = { "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 = { 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 }

!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 = !{!"long", !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, !6, i64 192}
!12 = !{!"_GC_arrays", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !13, i64 112, !13, i64 120, !13, i64 128, !13, i64 136, !13, i64 144, !13, i64 152, !13, i64 160, !13, i64 168, !10, i64 176, !10, i64 180, !10, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !13, i64 216, !13, i64 224, !6, i64 232, !10, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !14, i64 272, !14, i64 296, !15, i64 320, !10, i64 336, !13, i64 344, !6, i64 352, !6, i64 360, !10, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !13, i64 400, !7, i64 408, !7, i64 920, !7, i64 928, !7, i64 1440, !7, i64 2472, !7, i64 3504, !7, i64 4536, !7, i64 20928, !7, i64 21960, !7, i64 26056, !7, i64 58824, !13, i64 91592, !7, i64 91600, !7, i64 157136, !7, i64 165328}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"dl_hashtbl_s", !13, i64 0, !6, i64 8, !10, i64 16}
!15 = !{!"fnlz_roots_s", !13, i64 0, !13, i64 8}
!16 = !{!12, !6, i64 200}
!17 = !{!12, !6, i64 72}
!18 = !{!12, !6, i64 0}
!19 = !{!13, !13, i64 0}
!20 = !{!12, !6, i64 208}
!21 = !{!12, !13, i64 24}


; 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._GC_arrays = type { i64, i64, i64, ptr, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i64, i64, i64, ptr, ptr, i64, i32, i64, i64, i64, %struct.dl_hashtbl_s, %struct.dl_hashtbl_s, %struct.fnlz_roots_s, i32, ptr, i64, i64, i32, i64, i64, i64, ptr, [64 x ptr], [8 x i8], [64 x ptr], [129 x ptr], [129 x ptr], [129 x ptr], [2049 x i64], [129 x ptr], [4096 x i8], [4096 x i64], [4096 x i64], ptr, [2048 x %struct.roots], [512 x %struct.exclusion], [2048 x ptr] }
%struct.dl_hashtbl_s = type { ptr, i64, i32 }
%struct.fnlz_roots_s = type { ptr, ptr }
%struct.roots = type { ptr, ptr, ptr, i32 }
%struct.exclusion = type { ptr, ptr }

@GC_gc_no = external dso_local local_unnamed_addr global i64, align 8
@GC_arrays = external local_unnamed_addr global %struct._GC_arrays, align 8
@GC_print_stats = external local_unnamed_addr global i32, align 4
@GC_on_heap_resize = external dso_local local_unnamed_addr global ptr, align 8
@GC_least_plausible_heap_addr = external dso_local local_unnamed_addr global ptr, align 8
@GC_greatest_plausible_heap_addr = external dso_local local_unnamed_addr global ptr, align 8
@GC_max_heapsize = external hidden local_unnamed_addr global i64, align 8
@GC_page_size = external local_unnamed_addr global i64, align 8
@.str.8 = external hidden unnamed_addr constant [54 x i8], align 1
@GC_current_warn_proc = external local_unnamed_addr global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [48 x i8], align 1

; Function Attrs: nounwind uwtable
declare hidden i64 @min_bytes_allocd() local_unnamed_addr #0

declare void @GC_log_printf(ptr noundef, ...) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare hidden void @GC_add_to_heap(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @GC_expand_hp_inner(i64 noundef %0) local_unnamed_addr #0 {
  %spec.store.select = tail call i64 @llvm.umax.i64(i64 %0, i64 1)
  %2 = shl i64 %spec.store.select, 12
  %3 = load i64, ptr @GC_page_size, align 8, !tbaa !5
  %4 = sub i64 0, %3
  %5 = icmp ult i64 %2, %4
  %6 = add i64 %2, -1
  %7 = add i64 %6, %3
  %8 = select i1 %5, i64 %7, i64 -1, !prof !9
  %9 = and i64 %8, %4
  %10 = load i32, ptr @GC_print_stats, align 4, !tbaa !10
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %21, label %11

11:                                               ; preds = %1
  %12 = tail call i32 @GC_compute_heap_usage_percent()
  %13 = load i64, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 192), align 8, !tbaa !12
  %14 = add i64 %13, 511
  %15 = lshr i64 %14, 10
  %16 = load i64, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 200), align 8, !tbaa !17
  %17 = load i64, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 72), align 8, !tbaa !18
  %18 = add i64 %16, 511
  %19 = add i64 %18, %17
  %20 = lshr i64 %19, 10
  tail call void (ptr, ...) @GC_log_printf(ptr noundef nonnull @.str.8, i32 noundef %12, i64 noundef %15, i64 noundef %20) #4
  br label %21

21:                                               ; preds = %1, %11
  %22 = load i64, ptr @GC_max_heapsize, align 8, !tbaa !5
  %.not35 = icmp eq i64 %22, 0
  br i1 %.not35, label %29, label %23

23:                                               ; preds = %21
  %24 = icmp ult i64 %22, %9
  br i1 %24, label %72, label %25

25:                                               ; preds = %23
  %26 = load i64, ptr @GC_arrays, align 8, !tbaa !19
  %27 = sub i64 %22, %9
  %28 = icmp ugt i64 %26, %27
  br i1 %28, label %72, label %29

29:                                               ; preds = %25, %21
  %30 = tail call ptr @GC_os_get_mem(i64 noundef %9)
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %35, !prof !20

32:                                               ; preds = %29
  %33 = load ptr, ptr @GC_current_warn_proc, align 8, !tbaa !21
  %34 = lshr i64 %9, 10
  tail call void %33(ptr noundef nonnull @.str.9, i64 noundef %34) #4
  br label %72

35:                                               ; preds = %29
  %36 = load i64, ptr @GC_gc_no, align 8, !tbaa !5
  store i64 %36, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 208), align 8, !tbaa !22
  %37 = load i32, ptr @GC_print_stats, align 4, !tbaa !10
  %.not36 = icmp eq i32 %37, 0
  br i1 %.not36, label %44, label %38, !prof !9

38:                                               ; preds = %35
  %39 = load i64, ptr @GC_arrays, align 8, !tbaa !19
  %40 = add i64 %9, 511
  %41 = add i64 %40, %39
  %42 = lshr i64 %41, 10
  %43 = load i64, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 72), align 8, !tbaa !18
  tail call void (ptr, ...) @GC_log_printf(ptr noundef nonnull @.str.10, i64 noundef %42, i64 noundef %43) #4
  br label %44

44:                                               ; preds = %35, %38
  %45 = tail call i64 @min_bytes_allocd()
  %46 = add i64 %45, 33554432
  %47 = load ptr, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 24), align 8, !tbaa !23
  %48 = icmp eq ptr %47, null
  %.not37 = icmp sgt ptr %30, inttoptr (i64 -1 to ptr)
  %or.cond = and i1 %.not37, %48
  br i1 %or.cond, label %51, label %49

49:                                               ; preds = %44
  %.not38 = icmp ne ptr %47, null
  %50 = icmp ult ptr %47, %30
  %or.cond40 = and i1 %.not38, %50
  br i1 %or.cond40, label %51, label %59

51:                                               ; preds = %49, %44
  %52 = ptrtoint ptr %30 to i64
  %53 = add i64 %9, %52
  %54 = add i64 %53, %46
  %55 = icmp ugt i64 %54, %52
  %56 = load ptr, ptr @GC_greatest_plausible_heap_addr, align 8
  %57 = ptrtoint ptr %56 to i64
  %58 = icmp ugt i64 %54, %57
  %or.cond43 = select i1 %55, i1 %58, i1 false
  br i1 %or.cond43, label %.sink.split, label %68

59:                                               ; preds = %49
  %60 = ptrtoint ptr %30 to i64
  %61 = sub i64 %60, %46
  %62 = add i64 %61, -8
  %63 = icmp ult i64 %62, %60
  %64 = load ptr, ptr @GC_least_plausible_heap_addr, align 8
  %65 = ptrtoint ptr %64 to i64
  %66 = icmp ult i64 %62, %65
  %or.cond46 = select i1 %63, i1 %66, i1 false
  br i1 %or.cond46, label %.sink.split, label %68

.sink.split:                                      ; preds = %59, %51
  %.sink47 = phi i64 [ %54, %51 ], [ %62, %59 ]
  %GC_least_plausible_heap_addr.sink = phi ptr [ @GC_greatest_plausible_heap_addr, %51 ], [ @GC_least_plausible_heap_addr, %59 ]
  %67 = inttoptr i64 %.sink47 to ptr
  store ptr %67, ptr %GC_least_plausible_heap_addr.sink, align 8, !tbaa !21
  br label %68

68:                                               ; preds = %.sink.split, %59, %51
  store ptr %30, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 24), align 8, !tbaa !23
  tail call void @GC_add_to_heap(ptr noundef nonnull %30, i64 noundef %9)
  %69 = load ptr, ptr @GC_on_heap_resize, align 8, !tbaa !21
  %.not39 = icmp eq ptr %69, null
  br i1 %.not39, label %72, label %70

70:                                               ; preds = %68
  %71 = load i64, ptr @GC_arrays, align 8, !tbaa !19
  tail call void %69(i64 noundef %71) #4
  br label %72

72:                                               ; preds = %68, %70, %23, %25, %32
  %.0 = phi i32 [ 0, %32 ], [ 0, %25 ], [ 0, %23 ], [ 1, %70 ], [ 1, %68 ]
  ret i32 %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @GC_compute_heap_usage_percent() local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #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 = { "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 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 192}
!13 = !{!"_GC_arrays", !6, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !14, i64 112, !14, i64 120, !14, i64 128, !14, i64 136, !14, i64 144, !14, i64 152, !14, i64 160, !14, i64 168, !11, i64 176, !11, i64 180, !11, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !14, i64 216, !14, i64 224, !6, i64 232, !11, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !15, i64 272, !15, i64 296, !16, i64 320, !11, i64 336, !14, i64 344, !6, i64 352, !6, i64 360, !11, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !14, i64 400, !7, i64 408, !7, i64 920, !7, i64 928, !7, i64 1440, !7, i64 2472, !7, i64 3504, !7, i64 4536, !7, i64 20928, !7, i64 21960, !7, i64 26056, !7, i64 58824, !14, i64 91592, !7, i64 91600, !7, i64 157136, !7, i64 165328}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!"dl_hashtbl_s", !14, i64 0, !6, i64 8, !11, i64 16}
!16 = !{!"fnlz_roots_s", !14, i64 0, !14, i64 8}
!17 = !{!13, !6, i64 200}
!18 = !{!13, !6, i64 72}
!19 = !{!13, !6, i64 0}
!20 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!21 = !{!14, !14, i64 0}
!22 = !{!13, !6, i64 208}
!23 = !{!13, !14, i64 24}


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