; LLVM IR from brewlin/garbage-collect :: generational (test)

; 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.header = type { i64, i64, i64, i64, ptr, ptr }
%struct.t = type { i32, ptr }

@rs_index = external global i32, align 4
@.str.1 = external hidden unnamed_addr constant [77 x i8], align 1
@survivorfromg = external global i32, align 4
@.str.6 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [3 x i8], align 1
@__PRETTY_FUNCTION__.test_promote = external hidden unnamed_addr constant [20 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [14 x i8], align 1
@oldg = external global i32, align 4
@.str.23 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [16 x i8], align 1

declare void @gc_init(i64 noundef) #0

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

declare ptr @minor_malloc(i64 noundef) #0

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

declare ptr @is_pointer_to_space(ptr noundef, i64 noundef) #0

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

declare void @add_roots(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @test_promote() #3 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  call void @gc_init(i64 noundef 128)
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  %4 = call ptr @minor_malloc(i64 noundef 16)
  store ptr %4, ptr %1, align 8, !tbaa !5
  call void @add_roots(ptr noundef %1)
  %5 = load ptr, ptr %1, align 8, !tbaa !5
  %6 = icmp ne ptr %5, null
  br i1 %6, label %7, label %8

7:                                                ; preds = %0
  br label %9

8:                                                ; preds = %0
  call void @__assert_fail(ptr noundef @.str.20, ptr noundef @.str.1, i32 noundef 128, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

9:                                                ; preds = %7
  call void @minor_gc()
  %10 = load ptr, ptr %1, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.header, ptr %10, i64 -1
  %12 = getelementptr inbounds %struct.header, ptr %11, i32 0, i32 3
  %13 = load i64, ptr %12, align 8, !tbaa !9
  %14 = icmp eq i64 %13, 1
  br i1 %14, label %15, label %16

15:                                               ; preds = %9
  br label %17

16:                                               ; preds = %9
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 132, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

17:                                               ; preds = %15
  %18 = load ptr, ptr %1, align 8, !tbaa !5
  %19 = load i32, ptr @survivorfromg, align 4, !tbaa !12
  %20 = sext i32 %19 to i64
  %21 = call ptr @is_pointer_to_space(ptr noundef %18, i64 noundef %20)
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %24

23:                                               ; preds = %17
  br label %25

24:                                               ; preds = %17
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 133, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

25:                                               ; preds = %23
  call void @minor_gc()
  %26 = load ptr, ptr %1, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.header, ptr %26, i64 -1
  %28 = getelementptr inbounds %struct.header, ptr %27, i32 0, i32 3
  %29 = load i64, ptr %28, align 8, !tbaa !9
  %30 = icmp eq i64 %29, 2
  br i1 %30, label %31, label %32

31:                                               ; preds = %25
  br label %33

32:                                               ; preds = %25
  call void @__assert_fail(ptr noundef @.str.18, ptr noundef @.str.1, i32 noundef 137, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

33:                                               ; preds = %31
  %34 = load ptr, ptr %1, align 8, !tbaa !5
  %35 = load i32, ptr @survivorfromg, align 4, !tbaa !12
  %36 = sext i32 %35 to i64
  %37 = call ptr @is_pointer_to_space(ptr noundef %34, i64 noundef %36)
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %40

39:                                               ; preds = %33
  br label %41

40:                                               ; preds = %33
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 138, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

41:                                               ; preds = %39
  call void @minor_gc()
  %42 = load ptr, ptr %1, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.header, ptr %42, i64 -1
  %44 = getelementptr inbounds %struct.header, ptr %43, i32 0, i32 3
  %45 = load i64, ptr %44, align 8, !tbaa !9
  %46 = icmp eq i64 %45, 3
  br i1 %46, label %47, label %48

47:                                               ; preds = %41
  br label %49

48:                                               ; preds = %41
  call void @__assert_fail(ptr noundef @.str.21, ptr noundef @.str.1, i32 noundef 143, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

49:                                               ; preds = %47
  %50 = load ptr, ptr %1, align 8, !tbaa !5
  %51 = load i32, ptr @survivorfromg, align 4, !tbaa !12
  %52 = sext i32 %51 to i64
  %53 = call ptr @is_pointer_to_space(ptr noundef %50, i64 noundef %52)
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %56

55:                                               ; preds = %49
  br label %57

56:                                               ; preds = %49
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 144, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

57:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %58 = call ptr @minor_malloc(i64 noundef 16)
  store ptr %58, ptr %2, align 8, !tbaa !5
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = load ptr, ptr %1, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.t, ptr %60, i32 0, i32 1
  store ptr %59, ptr %61, align 8, !tbaa !14
  call void @minor_gc()
  %62 = load i32, ptr @rs_index, align 4, !tbaa !12
  %63 = icmp eq i32 %62, 1
  br i1 %63, label %64, label %65

64:                                               ; preds = %57
  br label %66

65:                                               ; preds = %57
  call void @__assert_fail(ptr noundef @.str.22, ptr noundef @.str.1, i32 noundef 153, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

66:                                               ; preds = %64
  %67 = load ptr, ptr %1, align 8, !tbaa !5
  %68 = load i32, ptr @oldg, align 4, !tbaa !12
  %69 = sext i32 %68 to i64
  %70 = call ptr @is_pointer_to_space(ptr noundef %67, i64 noundef %69)
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %73

72:                                               ; preds = %66
  br label %74

73:                                               ; preds = %66
  call void @__assert_fail(ptr noundef @.str.23, ptr noundef @.str.1, i32 noundef 155, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

74:                                               ; preds = %72
  %75 = load ptr, ptr %1, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.t, ptr %75, i32 0, i32 1
  %77 = load ptr, ptr %76, align 8, !tbaa !14
  %78 = getelementptr inbounds %struct.header, ptr %77, i64 -1
  %79 = getelementptr inbounds %struct.header, ptr %78, i32 0, i32 3
  %80 = load i64, ptr %79, align 8, !tbaa !9
  %81 = icmp eq i64 %80, 1
  br i1 %81, label %82, label %83

82:                                               ; preds = %74
  br label %84

83:                                               ; preds = %74
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.1, i32 noundef 156, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

84:                                               ; preds = %82
  %85 = load ptr, ptr %1, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.t, ptr %85, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8, !tbaa !14
  %88 = load i32, ptr @survivorfromg, align 4, !tbaa !12
  %89 = sext i32 %88 to i64
  %90 = call ptr @is_pointer_to_space(ptr noundef %87, i64 noundef %89)
  %91 = icmp ne ptr %90, null
  br i1 %91, label %92, label %93

92:                                               ; preds = %84
  br label %94

93:                                               ; preds = %84
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 157, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

94:                                               ; preds = %92
  %95 = load ptr, ptr %1, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.t, ptr %95, i32 0, i32 0
  store i32 11, ptr %96, align 8, !tbaa !16
  %97 = load ptr, ptr %1, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.t, ptr %97, i32 0, i32 1
  %99 = load ptr, ptr %98, align 8, !tbaa !14
  %100 = getelementptr inbounds %struct.t, ptr %99, i32 0, i32 0
  store i32 22, ptr %100, align 8, !tbaa !16
  call void @minor_gc()
  %101 = load ptr, ptr %1, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.t, ptr %101, i32 0, i32 1
  %103 = load ptr, ptr %102, align 8, !tbaa !14
  %104 = getelementptr inbounds %struct.header, ptr %103, i64 -1
  %105 = getelementptr inbounds %struct.header, ptr %104, i32 0, i32 3
  %106 = load i64, ptr %105, align 8, !tbaa !9
  %107 = icmp eq i64 %106, 2
  br i1 %107, label %108, label %109

108:                                              ; preds = %94
  br label %110

109:                                              ; preds = %94
  call void @__assert_fail(ptr noundef @.str.19, ptr noundef @.str.1, i32 noundef 164, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

110:                                              ; preds = %108
  call void @minor_gc()
  %111 = load ptr, ptr %1, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.t, ptr %111, i32 0, i32 1
  %113 = load ptr, ptr %112, align 8, !tbaa !14
  %114 = getelementptr inbounds %struct.header, ptr %113, i64 -1
  %115 = getelementptr inbounds %struct.header, ptr %114, i32 0, i32 3
  %116 = load i64, ptr %115, align 8, !tbaa !9
  %117 = icmp eq i64 %116, 3
  br i1 %117, label %118, label %119

118:                                              ; preds = %110
  br label %120

119:                                              ; preds = %110
  call void @__assert_fail(ptr noundef @.str.24, ptr noundef @.str.1, i32 noundef 166, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

120:                                              ; preds = %118
  call void @minor_gc()
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %121 = load ptr, ptr %1, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.t, ptr %121, i32 0, i32 1
  %123 = load ptr, ptr %122, align 8, !tbaa !14
  store ptr %123, ptr %3, align 8, !tbaa !5
  %124 = load ptr, ptr %1, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.t, ptr %124, i32 0, i32 1
  %126 = load ptr, ptr %125, align 8, !tbaa !14
  %127 = load i32, ptr @oldg, align 4, !tbaa !12
  %128 = sext i32 %127 to i64
  %129 = call ptr @is_pointer_to_space(ptr noundef %126, i64 noundef %128)
  %130 = icmp ne ptr %129, null
  br i1 %130, label %131, label %132

131:                                              ; preds = %120
  br label %133

132:                                              ; preds = %120
  call void @__assert_fail(ptr noundef @.str.25, ptr noundef @.str.1, i32 noundef 171, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

133:                                              ; preds = %131
  call void @major_gc()
  %134 = load ptr, ptr %1, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.t, ptr %134, i32 0, i32 0
  %136 = load i32, ptr %135, align 8, !tbaa !16
  %137 = icmp eq i32 %136, 0
  br i1 %137, label %138, label %139

138:                                              ; preds = %133
  br label %140

139:                                              ; preds = %133
  call void @__assert_fail(ptr noundef @.str.26, ptr noundef @.str.1, i32 noundef 176, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

140:                                              ; preds = %138
  %141 = load ptr, ptr %3, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.t, ptr %141, i32 0, i32 0
  %143 = load i32, ptr %142, align 8, !tbaa !16
  %144 = icmp eq i32 %143, 0
  br i1 %144, label %145, label %146

145:                                              ; preds = %140
  br label %147

146:                                              ; preds = %140
  call void @__assert_fail(ptr noundef @.str.27, ptr noundef @.str.1, i32 noundef 177, ptr noundef @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

147:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

declare void @minor_gc() #0

declare void @major_gc() #0

attributes #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 = { 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 = { 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 #4 = { nounwind }
attributes #5 = { noreturn 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, !11, i64 24}
!10 = !{!"header", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 8}
!15 = !{!"t", !13, i64 0, !6, i64 8}
!16 = !{!15, !13, 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"

@rs_index = external local_unnamed_addr global i32, align 4
@.str.1 = external hidden unnamed_addr constant [77 x i8], align 1
@survivorfromg = external local_unnamed_addr global i32, align 4
@.str.6 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [3 x i8], align 1
@__PRETTY_FUNCTION__.test_promote = external hidden unnamed_addr constant [20 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [14 x i8], align 1
@oldg = external local_unnamed_addr global i32, align 4
@.str.23 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [16 x i8], align 1

declare void @gc_init(i64 noundef) local_unnamed_addr #0

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

declare ptr @minor_malloc(i64 noundef) local_unnamed_addr #0

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

declare ptr @is_pointer_to_space(ptr noundef, i64 noundef) local_unnamed_addr #0

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

declare void @add_roots(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @test_promote() local_unnamed_addr #3 {
  %1 = alloca ptr, align 8
  tail call void @gc_init(i64 noundef 128) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  %2 = tail call ptr @minor_malloc(i64 noundef 16) #4
  store ptr %2, ptr %1, align 8, !tbaa !5
  call void @add_roots(ptr noundef nonnull %1) #4
  %3 = load ptr, ptr %1, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %0
  call void @__assert_fail(ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.1, i32 noundef 128, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

5:                                                ; preds = %0
  call void @minor_gc() #4
  %6 = load ptr, ptr %1, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8, !tbaa !9
  %9 = icmp eq i64 %8, 1
  br i1 %9, label %11, label %10

10:                                               ; preds = %5
  call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 132, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

11:                                               ; preds = %5
  %12 = load i32, ptr @survivorfromg, align 4, !tbaa !12
  %13 = sext i32 %12 to i64
  %14 = call ptr @is_pointer_to_space(ptr noundef nonnull %6, i64 noundef %13) #4
  %.not2 = icmp eq ptr %14, null
  br i1 %.not2, label %15, label %16

15:                                               ; preds = %11
  call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 133, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

16:                                               ; preds = %11
  call void @minor_gc() #4
  %17 = load ptr, ptr %1, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 -24
  %19 = load i64, ptr %18, align 8, !tbaa !9
  %20 = icmp eq i64 %19, 2
  br i1 %20, label %22, label %21

21:                                               ; preds = %16
  call void @__assert_fail(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.1, i32 noundef 137, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

22:                                               ; preds = %16
  %23 = load i32, ptr @survivorfromg, align 4, !tbaa !12
  %24 = sext i32 %23 to i64
  %25 = call ptr @is_pointer_to_space(ptr noundef nonnull %17, i64 noundef %24) #4
  %.not3 = icmp eq ptr %25, null
  br i1 %.not3, label %26, label %27

26:                                               ; preds = %22
  call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 138, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

27:                                               ; preds = %22
  call void @minor_gc() #4
  %28 = load ptr, ptr %1, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %28, i64 -24
  %30 = load i64, ptr %29, align 8, !tbaa !9
  %31 = icmp eq i64 %30, 3
  br i1 %31, label %33, label %32

32:                                               ; preds = %27
  call void @__assert_fail(ptr noundef nonnull @.str.21, ptr noundef nonnull @.str.1, i32 noundef 143, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

33:                                               ; preds = %27
  %34 = load i32, ptr @survivorfromg, align 4, !tbaa !12
  %35 = sext i32 %34 to i64
  %36 = call ptr @is_pointer_to_space(ptr noundef nonnull %28, i64 noundef %35) #4
  %.not4 = icmp eq ptr %36, null
  br i1 %.not4, label %37, label %38

37:                                               ; preds = %33
  call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 144, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

38:                                               ; preds = %33
  %39 = call ptr @minor_malloc(i64 noundef 16) #4
  %40 = load ptr, ptr %1, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 8
  store ptr %39, ptr %41, align 8, !tbaa !14
  call void @minor_gc() #4
  %42 = load i32, ptr @rs_index, align 4, !tbaa !12
  %43 = icmp eq i32 %42, 1
  br i1 %43, label %45, label %44

44:                                               ; preds = %38
  call void @__assert_fail(ptr noundef nonnull @.str.22, ptr noundef nonnull @.str.1, i32 noundef 153, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

45:                                               ; preds = %38
  %46 = load ptr, ptr %1, align 8, !tbaa !5
  %47 = load i32, ptr @oldg, align 4, !tbaa !12
  %48 = sext i32 %47 to i64
  %49 = call ptr @is_pointer_to_space(ptr noundef %46, i64 noundef %48) #4
  %.not5 = icmp eq ptr %49, null
  br i1 %.not5, label %50, label %51

50:                                               ; preds = %45
  call void @__assert_fail(ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, i32 noundef 155, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

51:                                               ; preds = %45
  %52 = load ptr, ptr %1, align 8, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %52, i64 8
  %54 = load ptr, ptr %53, align 8, !tbaa !14
  %55 = getelementptr inbounds i8, ptr %54, i64 -24
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = icmp eq i64 %56, 1
  br i1 %57, label %59, label %58

58:                                               ; preds = %51
  call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.1, i32 noundef 156, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

59:                                               ; preds = %51
  %60 = load i32, ptr @survivorfromg, align 4, !tbaa !12
  %61 = sext i32 %60 to i64
  %62 = call ptr @is_pointer_to_space(ptr noundef nonnull %54, i64 noundef %61) #4
  %.not6 = icmp eq ptr %62, null
  br i1 %.not6, label %63, label %64

63:                                               ; preds = %59
  call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 157, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

64:                                               ; preds = %59
  %65 = load ptr, ptr %1, align 8, !tbaa !5
  store i32 11, ptr %65, align 8, !tbaa !16
  %66 = getelementptr inbounds i8, ptr %65, i64 8
  %67 = load ptr, ptr %66, align 8, !tbaa !14
  store i32 22, ptr %67, align 8, !tbaa !16
  call void @minor_gc() #4
  %68 = load ptr, ptr %1, align 8, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %68, i64 8
  %70 = load ptr, ptr %69, align 8, !tbaa !14
  %71 = getelementptr inbounds i8, ptr %70, i64 -24
  %72 = load i64, ptr %71, align 8, !tbaa !9
  %73 = icmp eq i64 %72, 2
  br i1 %73, label %75, label %74

74:                                               ; preds = %64
  call void @__assert_fail(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.1, i32 noundef 164, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

75:                                               ; preds = %64
  call void @minor_gc() #4
  %76 = load ptr, ptr %1, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %76, i64 8
  %78 = load ptr, ptr %77, align 8, !tbaa !14
  %79 = getelementptr inbounds i8, ptr %78, i64 -24
  %80 = load i64, ptr %79, align 8, !tbaa !9
  %81 = icmp eq i64 %80, 3
  br i1 %81, label %83, label %82

82:                                               ; preds = %75
  call void @__assert_fail(ptr noundef nonnull @.str.24, ptr noundef nonnull @.str.1, i32 noundef 166, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

83:                                               ; preds = %75
  call void @minor_gc() #4
  %84 = load ptr, ptr %1, align 8, !tbaa !5
  %85 = getelementptr inbounds i8, ptr %84, i64 8
  %86 = load ptr, ptr %85, align 8, !tbaa !14
  %87 = load i32, ptr @oldg, align 4, !tbaa !12
  %88 = sext i32 %87 to i64
  %89 = call ptr @is_pointer_to_space(ptr noundef %86, i64 noundef %88) #4
  %.not7 = icmp eq ptr %89, null
  br i1 %.not7, label %90, label %91

90:                                               ; preds = %83
  call void @__assert_fail(ptr noundef nonnull @.str.25, ptr noundef nonnull @.str.1, i32 noundef 171, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

91:                                               ; preds = %83
  call void @major_gc() #4
  %92 = load ptr, ptr %1, align 8, !tbaa !5
  %93 = load i32, ptr %92, align 8, !tbaa !16
  %94 = icmp eq i32 %93, 0
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  call void @__assert_fail(ptr noundef nonnull @.str.26, ptr noundef nonnull @.str.1, i32 noundef 176, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

96:                                               ; preds = %91
  %97 = load i32, ptr %86, align 8, !tbaa !16
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %100, label %99

99:                                               ; preds = %96
  call void @__assert_fail(ptr noundef nonnull @.str.27, ptr noundef nonnull @.str.1, i32 noundef 177, ptr noundef nonnull @__PRETTY_FUNCTION__.test_promote) #5
  unreachable

100:                                              ; preds = %96
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret void
}

declare void @minor_gc() local_unnamed_addr #0

declare void @major_gc() local_unnamed_addr #0

attributes #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nounwind }
attributes #5 = { noreturn 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, !11, i64 24}
!10 = !{!"header", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 8}
!15 = !{!"t", !13, i64 0, !6, i64 8}
!16 = !{!15, !13, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass