; 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_incremental = external dso_local global i32, align 4
@GC_dont_expand = external dso_local global i32, align 4
@GC_free_space_divisor = external dso_local global i64, align 8
@GC_default_stop_func = external hidden global ptr, align 8
@GC_dont_gc = external global i32, align 4
@GC_arrays = external global %struct._GC_arrays, align 8
@GC_print_stats = external global i32, align 4
@GC_max_heapsize = external hidden global i64, align 8
@GC_max_retries = external dso_local global i64, align 8
@GC_current_warn_proc = external global ptr, align 8
@GC_fail_count = external dso_local global i32, align 4
@GC_allocd_bytes_per_finalizer = external hidden global i64, align 8
@last_fo_entries = external hidden global i64, align 8
@last_bytes_finalized = external hidden global i64, align 8
@GC_heapsize_at_forced_unmap = external hidden global i64, align 8
@GC_black_list_spacing = external global i64, align 8
@.str.11 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [27 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 dso_local i32 @GC_never_stop_func() #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @GC_should_collect() #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @GC_try_to_collect_inner(ptr noundef) #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 i32 @GC_expand_hp_inner(i64 noundef) #1

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

15:                                               ; preds = %3
  %16 = load i32, ptr @GC_dont_gc, align 4, !tbaa !9
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %68, label %18

18:                                               ; preds = %15
  %19 = load i32, ptr @GC_dont_expand, align 4, !tbaa !9
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %24

21:                                               ; preds = %18
  %22 = load i64, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 9), align 8, !tbaa !11
  %23 = icmp ugt i64 %22, 0
  br i1 %23, label %44, label %24

24:                                               ; preds = %21, %18
  %25 = load i64, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 34), align 8, !tbaa !16
  %26 = load i64, ptr @last_fo_entries, align 8, !tbaa !5
  %27 = icmp ugt i64 %25, %26
  br i1 %27, label %28, label %41

28:                                               ; preds = %24
  %29 = load i64, ptr @last_bytes_finalized, align 8, !tbaa !5
  %30 = load i64, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 11), align 8, !tbaa !17
  %31 = or i64 %29, %30
  %32 = icmp ne i64 %31, 0
  br i1 %32, label %33, label %41

33:                                               ; preds = %28
  %34 = load i64, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 34), align 8, !tbaa !16
  %35 = load i64, ptr @last_fo_entries, align 8, !tbaa !5
  %36 = sub i64 %34, %35
  %37 = load i64, ptr @GC_allocd_bytes_per_finalizer, align 8, !tbaa !5
  %38 = mul i64 %36, %37
  %39 = load i64, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 9), align 8, !tbaa !11
  %40 = icmp ugt i64 %38, %39
  br i1 %40, label %44, label %41

41:                                               ; preds = %33, %28, %24
  %42 = call i32 @GC_should_collect()
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %68

44:                                               ; preds = %41, %33, %21
  %45 = load i64, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 9), align 8, !tbaa !11
  %46 = icmp ugt i64 %45, 0
  br i1 %46, label %47, label %55

47:                                               ; preds = %44
  %48 = load i32, ptr @GC_dont_expand, align 4, !tbaa !9
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %53

50:                                               ; preds = %47
  %51 = load i32, ptr %7, align 4, !tbaa !9
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %55, label %53

53:                                               ; preds = %50, %47
  %54 = load ptr, ptr @GC_default_stop_func, align 8, !tbaa !18
  br label %56

55:                                               ; preds = %50, %44
  br label %56

56:                                               ; preds = %55, %53
  %57 = phi ptr [ %54, %53 ], [ @GC_never_stop_func, %55 ]
  %58 = call i32 @GC_try_to_collect_inner(ptr noundef %57)
  store i32 %58, ptr %8, align 4, !tbaa !9
  %59 = load i32, ptr %8, align 4, !tbaa !9
  %60 = icmp eq i32 %59, 1
  br i1 %60, label %64, label %61

61:                                               ; preds = %56
  %62 = load i32, ptr %7, align 4, !tbaa !9
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %67, label %64

64:                                               ; preds = %61, %56
  %65 = load i64, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 34), align 8, !tbaa !16
  store i64 %65, ptr @last_fo_entries, align 8, !tbaa !5
  %66 = load i64, ptr getelementptr inbounds (%struct._GC_arrays, ptr @GC_arrays, i32 0, i32 11), align 8, !tbaa !17
  store i64 %66, ptr @last_bytes_finalized, align 8, !tbaa !5
  store i32 1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %194

67:                                               ; preds = %61
  br label %68

68:                                               ; preds = %67, %41, %15, %3
  %69 = load i64, ptr @GC_arrays, align 8, !tbaa !19
  %70 = load i64, ptr @GC_heapsize_at_forced_unmap, align 8, !tbaa !5
  %71 = sub i64 %69, %70
  %72 = load i64, ptr @GC_free_space_divisor, align 8, !tbaa !5
  %73 = mul i64 4096, %72
  %74 = udiv i64 %71, %73
  %75 = load i64, ptr %5, align 8, !tbaa !5
  %76 = add i64 %74, %75
  store i64 %76, ptr %9, align 8, !tbaa !5
  %77 = load i64, ptr %9, align 8, !tbaa !5
  %78 = icmp ugt i64 %77, 2048
  br i1 %78, label %79, label %109

79:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %80 = load i32, ptr %6, align 4, !tbaa !9
  %81 = and i32 %80, 1
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %84

83:                                               ; preds = %79
  store i64 4, ptr %11, align 8, !tbaa !5
  br label %94

84:                                               ; preds = %79
  %85 = load i64, ptr @GC_black_list_spacing, align 8, !tbaa !5
  %86 = lshr i64 %85, 12
  %87 = mul i64 2, %86
  store i64 %87, ptr %11, align 8, !tbaa !5
  %88 = load i64, ptr %11, align 8, !tbaa !5
  %89 = load i64, ptr %5, align 8, !tbaa !5
  %90 = icmp ugt i64 %88, %89
  br i1 %90, label %91, label %93

91:                                               ; preds = %84
  %92 = load i64, ptr %5, align 8, !tbaa !5
  store i64 %92, ptr %11, align 8, !tbaa !5
  br label %93

93:                                               ; preds = %91, %84
  br label %94

94:                                               ; preds = %93, %83
  %95 = load i64, ptr %5, align 8, !tbaa !5
  %96 = load i64, ptr %11, align 8, !tbaa !5
  %97 = add i64 %95, %96
  %98 = icmp ugt i64 %97, 2048
  br i1 %98, label %99, label %103

99:                                               ; preds = %94
  %100 = load i64, ptr %5, align 8, !tbaa !5
  %101 = load i64, ptr %11, align 8, !tbaa !5
  %102 = add i64 %100, %101
  store i64 %102, ptr %9, align 8, !tbaa !5
  br label %104

103:                                              ; preds = %94
  store i64 2048, ptr %9, align 8, !tbaa !5
  br label %104

104:                                              ; preds = %103, %99
  %105 = load i64, ptr %9, align 8, !tbaa !5
  %106 = icmp ugt i64 %105, 4503599627370495
  br i1 %106, label %107, label %108

107:                                              ; preds = %104
  store i64 4503599627370495, ptr %9, align 8, !tbaa !5
  br label %108

108:                                              ; preds = %107, %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %114

109:                                              ; preds = %68
  %110 = load i64, ptr %9, align 8, !tbaa !5
  %111 = icmp ult i64 %110, 16
  br i1 %111, label %112, label %113

112:                                              ; preds = %109
  store i64 16, ptr %9, align 8, !tbaa !5
  br label %113

113:                                              ; preds = %112, %109
  br label %114

114:                                              ; preds = %113, %108
  %115 = load i64, ptr @GC_max_heapsize, align 8, !tbaa !5
  %116 = load i64, ptr @GC_arrays, align 8, !tbaa !19
  %117 = icmp ugt i64 %115, %116
  br i1 %117, label %118, label %137

118:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %119 = load i64, ptr @GC_max_heapsize, align 8, !tbaa !5
  %120 = load i64, ptr @GC_arrays, align 8, !tbaa !19
  %121 = sub i64 %119, %120
  %122 = lshr i64 %121, 12
  store i64 %122, ptr %12, align 8, !tbaa !5
  %123 = load i64, ptr %9, align 8, !tbaa !5
  %124 = load i64, ptr %12, align 8, !tbaa !5
  %125 = icmp ugt i64 %123, %124
  br i1 %125, label %126, label %136

126:                                              ; preds = %118
  %127 = load i64, ptr %12, align 8, !tbaa !5
  %128 = load i64, ptr %5, align 8, !tbaa !5
  %129 = icmp ugt i64 %127, %128
  br i1 %129, label %130, label %132

130:                                              ; preds = %126
  %131 = load i64, ptr %12, align 8, !tbaa !5
  br label %134

132:                                              ; preds = %126
  %133 = load i64, ptr %5, align 8, !tbaa !5
  br label %134

134:                                              ; preds = %132, %130
  %135 = phi i64 [ %131, %130 ], [ %133, %132 ]
  store i64 %135, ptr %9, align 8, !tbaa !5
  br label %136

136:                                              ; preds = %134, %118
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %137

137:                                              ; preds = %136, %114
  %138 = load i64, ptr %9, align 8, !tbaa !5
  %139 = call i32 @GC_expand_hp_inner(i64 noundef %138)
  %140 = icmp ne i32 %139, 0
  br i1 %140, label %178, label %141

141:                                              ; preds = %137
  %142 = load i64, ptr %9, align 8, !tbaa !5
  %143 = load i64, ptr %5, align 8, !tbaa !5
  %144 = icmp eq i64 %142, %143
  br i1 %144, label %149, label %145

145:                                              ; preds = %141
  %146 = load i64, ptr %5, align 8, !tbaa !5
  %147 = call i32 @GC_expand_hp_inner(i64 noundef %146)
  %148 = icmp ne i32 %147, 0
  br i1 %148, label %178, label %149

149:                                              ; preds = %145, %141
  %150 = load i32, ptr %8, align 4, !tbaa !9
  %151 = icmp eq i32 %150, 0
  br i1 %151, label %152, label %154

152:                                              ; preds = %149
  %153 = call i32 @GC_try_to_collect_inner(ptr noundef @GC_never_stop_func)
  br label %177

154:                                              ; preds = %149
  %155 = load i32, ptr @GC_fail_count, align 4, !tbaa !9
  %156 = add i32 %155, 1
  store i32 %156, ptr @GC_fail_count, align 4, !tbaa !9
  %157 = zext i32 %155 to i64
  %158 = load i64, ptr @GC_max_retries, align 8, !tbaa !5
  %159 = icmp ult i64 %157, %158
  br i1 %159, label %160, label %163

160:                                              ; preds = %154
  %161 = load ptr, ptr @GC_current_warn_proc, align 8, !tbaa !18
  call void %161(ptr noundef @.str.11, i64 noundef 0)
  %162 = call i32 @GC_try_to_collect_inner(ptr noundef @GC_never_stop_func)
  br label %176

163:                                              ; preds = %154
  %164 = load i64, ptr @GC_arrays, align 8, !tbaa !19
  %165 = icmp ugt i64 %164, 5242880
  br i1 %165, label %166, label %171

166:                                              ; preds = %163
  %167 = load ptr, ptr @GC_current_warn_proc, align 8, !tbaa !18
  %168 = load i64, ptr @GC_arrays, align 8, !tbaa !19
  %169 = sub i64 %168, 0
  %170 = lshr i64 %169, 20
  call void %167(ptr noundef @.str.12, i64 noundef %170)
  br label %175

171:                                              ; preds = %163
  %172 = load ptr, ptr @GC_current_warn_proc, align 8, !tbaa !18
  %173 = load i64, ptr @GC_arrays, align 8, !tbaa !19
  %174 = sub i64 %173, 0
  call void %172(ptr noundef @.str.13, i64 noundef %174)
  br label %175

175:                                              ; preds = %171, %166
  store i32 0, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %194

176:                                              ; preds = %160
  br label %177

177:                                              ; preds = %176, %152
  br label %193

178:                                              ; preds = %145, %137
  %179 = load i32, ptr @GC_fail_count, align 4, !tbaa !9
  %180 = icmp ne i32 %179, 0
  br i1 %180, label %181, label %192

181:                                              ; preds = %178
  %182 = load i32, ptr @GC_print_stats, align 4, !tbaa !9
  %183 = icmp ne i32 %182, 0
  %184 = xor i1 %183, true
  %185 = zext i1 %184 to i32
  %186 = sext i32 %185 to i64
  %187 = call i64 @llvm.expect.i64(i64 %186, i64 1)
  %188 = icmp ne i64 %187, 0
  br i1 %188, label %189, label %190

189:                                              ; preds = %181
  br label %191

190:                                              ; preds = %181
  call void (ptr, ...) @GC_log_printf(ptr noundef @.str.14)
  br label %191

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

192:                                              ; preds = %191, %178
  br label %193

193:                                              ; preds = %192, %177
  store i32 1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %194

194:                                              ; preds = %193, %175, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %195 = load i32, ptr %4, align 4
  ret i32 %195
}

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 = { 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 72}
!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 264}
!17 = !{!12, !6, i64 88}
!18 = !{!13, !13, i64 0}
!19 = !{!12, !6, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct._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_incremental = external dso_local local_unnamed_addr global i32, align 4
@GC_dont_expand = external dso_local local_unnamed_addr global i32, align 4
@GC_free_space_divisor = external dso_local local_unnamed_addr global i64, align 8
@GC_default_stop_func = external hidden local_unnamed_addr global ptr, align 8
@GC_dont_gc = external local_unnamed_addr global i32, align 4
@GC_arrays = external local_unnamed_addr global %struct._GC_arrays, align 8
@GC_print_stats = external local_unnamed_addr global i32, align 4
@GC_max_heapsize = external hidden local_unnamed_addr global i64, align 8
@GC_max_retries = external dso_local local_unnamed_addr global i64, align 8
@GC_current_warn_proc = external local_unnamed_addr global ptr, align 8
@GC_fail_count = external dso_local local_unnamed_addr global i32, align 4
@GC_allocd_bytes_per_finalizer = external hidden local_unnamed_addr global i64, align 8
@last_fo_entries = external hidden local_unnamed_addr global i64, align 8
@last_bytes_finalized = external hidden local_unnamed_addr global i64, align 8
@GC_heapsize_at_forced_unmap = external hidden local_unnamed_addr global i64, align 8
@GC_black_list_spacing = external local_unnamed_addr global i64, align 8
@.str.11 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @GC_never_stop_func() #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @GC_should_collect() local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @GC_collect_or_expand(i64 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = load i32, ptr @GC_incremental, align 4, !tbaa !5
  %5 = icmp ne i32 %4, 0
  %6 = load i32, ptr @GC_dont_gc, align 4
  %7 = icmp ne i32 %6, 0
  %or.cond = select i1 %5, i1 true, i1 %7
  br i1 %or.cond, label %41, label %8

8:                                                ; preds = %3
  %9 = load i32, ptr @GC_dont_expand, align 4, !tbaa !5
  %10 = icmp ne i32 %9, 0
  %11 = load i64, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 72), align 8
  %12 = icmp ne i64 %11, 0
  %or.cond3 = select i1 %10, i1 %12, i1 false
  br i1 %or.cond3, label %.thread, label %13

13:                                               ; preds = %8
  %14 = load i64, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 264), align 8, !tbaa !9
  %15 = load i64, ptr @last_fo_entries, align 8, !tbaa !15
  %16 = icmp ugt i64 %14, %15
  br i1 %16, label %17, label %26

17:                                               ; preds = %13
  %18 = load i64, ptr @last_bytes_finalized, align 8, !tbaa !15
  %19 = load i64, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 88), align 8, !tbaa !16
  %20 = or i64 %19, %18
  %.not = icmp eq i64 %20, 0
  br i1 %.not, label %26, label %21

21:                                               ; preds = %17
  %22 = sub i64 %14, %15
  %23 = load i64, ptr @GC_allocd_bytes_per_finalizer, align 8, !tbaa !15
  %24 = mul i64 %23, %22
  %25 = icmp ugt i64 %24, %11
  br i1 %25, label %28, label %26

26:                                               ; preds = %21, %17, %13
  %27 = tail call i32 @GC_should_collect()
  %.not51 = icmp eq i32 %27, 0
  br i1 %.not51, label %41, label %._crit_edge

._crit_edge:                                      ; preds = %26
  %.pr.pre = load i64, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 72), align 8, !tbaa !17
  br label %28

28:                                               ; preds = %._crit_edge, %21
  %.pr = phi i64 [ %.pr.pre, %._crit_edge ], [ %11, %21 ]
  %.not52 = icmp eq i64 %.pr, 0
  br i1 %.not52, label %33, label %..thread_crit_edge

..thread_crit_edge:                               ; preds = %28
  %.pre = load i32, ptr @GC_dont_expand, align 4, !tbaa !5
  %29 = icmp ne i32 %.pre, 0
  br label %.thread

.thread:                                          ; preds = %..thread_crit_edge, %8
  %30 = phi i1 [ %29, %..thread_crit_edge ], [ true, %8 ]
  %31 = icmp ne i32 %2, 0
  %or.cond5 = and i1 %31, %30
  %32 = load ptr, ptr @GC_default_stop_func, align 8
  %spec.select = select i1 %or.cond5, ptr @GC_never_stop_func, ptr %32
  br label %33

33:                                               ; preds = %.thread, %28
  %34 = phi ptr [ @GC_never_stop_func, %28 ], [ %spec.select, %.thread ]
  %35 = tail call i32 @GC_try_to_collect_inner(ptr noundef %34)
  %36 = icmp ne i32 %35, 1
  %37 = icmp ne i32 %2, 0
  %or.cond7 = and i1 %37, %36
  br i1 %or.cond7, label %41, label %38

38:                                               ; preds = %33
  %39 = load i64, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 264), align 8, !tbaa !9
  store i64 %39, ptr @last_fo_entries, align 8, !tbaa !15
  %40 = load i64, ptr getelementptr inbounds (i8, ptr @GC_arrays, i64 88), align 8, !tbaa !16
  store i64 %40, ptr @last_bytes_finalized, align 8, !tbaa !15
  br label %97

41:                                               ; preds = %33, %26, %3
  %.037 = phi i32 [ 1, %3 ], [ %35, %33 ], [ 1, %26 ]
  %42 = load i64, ptr @GC_arrays, align 8, !tbaa !18
  %43 = load i64, ptr @GC_heapsize_at_forced_unmap, align 8, !tbaa !15
  %44 = sub i64 %42, %43
  %45 = load i64, ptr @GC_free_space_divisor, align 8, !tbaa !15
  %46 = shl i64 %45, 12
  %47 = udiv i64 %44, %46
  %48 = add i64 %47, %0
  %49 = icmp ugt i64 %48, 2048
  br i1 %49, label %50, label %58

50:                                               ; preds = %41
  %51 = and i32 %1, 1
  %.not53 = icmp eq i32 %51, 0
  br i1 %.not53, label %52, label %56

52:                                               ; preds = %50
  %53 = load i64, ptr @GC_black_list_spacing, align 8, !tbaa !15
  %54 = lshr i64 %53, 11
  %55 = and i64 %54, 9007199254740990
  %spec.select58 = tail call i64 @llvm.umin.i64(i64 %55, i64 %0)
  br label %56

56:                                               ; preds = %52, %50
  %.035 = phi i64 [ 4, %50 ], [ %spec.select58, %52 ]
  %57 = add i64 %.035, %0
  %. = tail call i64 @llvm.umax.i64(i64 %57, i64 2048)
  %spec.store.select = tail call i64 @llvm.umin.i64(i64 %., i64 4503599627370495)
  br label %59

58:                                               ; preds = %41
  %spec.store.select8 = tail call i64 @llvm.umax.i64(i64 %48, i64 16)
  br label %59

59:                                               ; preds = %58, %56
  %.1 = phi i64 [ %spec.store.select, %56 ], [ %spec.store.select8, %58 ]
  %60 = load i64, ptr @GC_max_heapsize, align 8, !tbaa !15
  %61 = icmp ugt i64 %60, %42
  br i1 %61, label %62, label %67

62:                                               ; preds = %59
  %63 = sub i64 %60, %42
  %64 = lshr i64 %63, 12
  %65 = icmp ugt i64 %.1, %64
  %66 = tail call i64 @llvm.umax.i64(i64 %64, i64 %0)
  %.2 = select i1 %65, i64 %66, i64 %.1
  br label %67

67:                                               ; preds = %62, %59
  %.3 = phi i64 [ %.2, %62 ], [ %.1, %59 ]
  %68 = tail call i32 @GC_expand_hp_inner(i64 noundef %.3)
  %.not54 = icmp eq i32 %68, 0
  br i1 %.not54, label %69, label %93

69:                                               ; preds = %67
  %70 = icmp eq i64 %.3, %0
  br i1 %70, label %73, label %71

71:                                               ; preds = %69
  %72 = tail call i32 @GC_expand_hp_inner(i64 noundef %0)
  %.not55 = icmp eq i32 %72, 0
  br i1 %.not55, label %73, label %93

73:                                               ; preds = %71, %69
  %74 = icmp eq i32 %.037, 0
  br i1 %74, label %75, label %77

75:                                               ; preds = %73
  %76 = tail call i32 @GC_try_to_collect_inner(ptr noundef nonnull @GC_never_stop_func)
  br label %97

77:                                               ; preds = %73
  %78 = load i32, ptr @GC_fail_count, align 4, !tbaa !5
  %79 = add i32 %78, 1
  store i32 %79, ptr @GC_fail_count, align 4, !tbaa !5
  %80 = zext i32 %78 to i64
  %81 = load i64, ptr @GC_max_retries, align 8, !tbaa !15
  %82 = icmp ugt i64 %81, %80
  br i1 %82, label %83, label %86

83:                                               ; preds = %77
  %84 = load ptr, ptr @GC_current_warn_proc, align 8, !tbaa !19
  tail call void %84(ptr noundef nonnull @.str.11, i64 noundef 0) #3
  %85 = tail call i32 @GC_try_to_collect_inner(ptr noundef nonnull @GC_never_stop_func)
  br label %97

86:                                               ; preds = %77
  %87 = load i64, ptr @GC_arrays, align 8, !tbaa !18
  %88 = icmp ugt i64 %87, 5242880
  %89 = load ptr, ptr @GC_current_warn_proc, align 8, !tbaa !19
  br i1 %88, label %90, label %92

90:                                               ; preds = %86
  %91 = lshr i64 %87, 20
  tail call void %89(ptr noundef nonnull @.str.12, i64 noundef %91) #3
  br label %97

92:                                               ; preds = %86
  tail call void %89(ptr noundef nonnull @.str.13, i64 noundef %87) #3
  br label %97

93:                                               ; preds = %71, %67
  %94 = load i32, ptr @GC_fail_count, align 4, !tbaa !5
  %.not56 = icmp eq i32 %94, 0
  %95 = load i32, ptr @GC_print_stats, align 4
  %.not57 = icmp eq i32 %95, 0
  %or.cond59 = select i1 %.not56, i1 true, i1 %.not57
  br i1 %or.cond59, label %97, label %96, !prof !20

96:                                               ; preds = %93
  tail call void (ptr, ...) @GC_log_printf(ptr noundef nonnull @.str.14) #3
  br label %97

97:                                               ; preds = %83, %75, %96, %93, %90, %92, %38
  %.0 = phi i32 [ 1, %38 ], [ 0, %92 ], [ 0, %90 ], [ 1, %93 ], [ 1, %96 ], [ 1, %75 ], [ 1, %83 ]
  ret i32 %.0
}

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

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


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