; LLVM IR from knizhnik/cppgc :: copygc/gc.ll (ZN2GC15MemoryAllocator3_gcEv)

; 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"

%"class.GC::MemoryAllocator" = type { i64, i64, ptr, ptr, i64, ptr, ptr, i64, i64, ptr, ptr }
%"class.GC::Pin" = type { ptr, ptr }
%"struct.GC::MemorySegment" = type { ptr, ptr }
%"class.GC::Root" = type { ptr, ptr }
%"class.GC::AnyWeakRef" = type { ptr, ptr }

; 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK2GC6Object9getHeaderEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN2GC15MemoryAllocator5_copyEPNS_6ObjectE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2GC15MemoryAllocator3_gcEv(ptr noundef nonnull align 8 dereferenceable(88) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %13 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 8
  %14 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %14, ptr %3, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %15 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 3
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  store ptr %16, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 3
  store ptr null, ptr %17, align 8, !tbaa !13
  %18 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 8
  store i64 -1, ptr %18, align 8, !tbaa !9
  %19 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 0
  %20 = load i64, ptr %19, align 8, !tbaa !14
  %21 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 1
  store i64 %20, ptr %21, align 8, !tbaa !15
  %22 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 10
  store ptr null, ptr %22, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %23 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 6
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  store ptr %24, ptr %5, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %49, %1
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %29, label %28

28:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %53

29:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %"class.GC::Pin", ptr %30, i32 0, i32 1
  %32 = load ptr, ptr %31, align 8, !tbaa !18
  %33 = call noundef ptr @_ZNK2GC6Object9getHeaderEv(ptr noundef nonnull align 8 dereferenceable(8) %32)
  store ptr %33, ptr %6, align 8, !tbaa !5
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = load ptr, ptr %34, align 8, !tbaa !20
  %36 = getelementptr inbounds %"struct.GC::MemorySegment", ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !21
  %38 = ptrtoint ptr %37 to i64
  %39 = or i64 %38, 1
  %40 = inttoptr i64 %39 to ptr
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = load ptr, ptr %41, align 8, !tbaa !20
  %43 = getelementptr inbounds %"struct.GC::MemorySegment", ptr %42, i32 0, i32 0
  store ptr %40, ptr %43, align 8, !tbaa !21
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %"class.GC::Pin", ptr %44, i32 0, i32 1
  %46 = load ptr, ptr %45, align 8, !tbaa !18
  %47 = ptrtoint ptr %46 to i64
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  store i64 %47, ptr %48, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %49

49:                                               ; preds = %29
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %"class.GC::Pin", ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !23
  store ptr %52, ptr %5, align 8, !tbaa !5
  br label %25, !llvm.loop !24

53:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %54 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 6
  %55 = load ptr, ptr %54, align 8, !tbaa !17
  store ptr %55, ptr %7, align 8, !tbaa !5
  br label %56

56:                                               ; preds = %65, %53
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = icmp ne ptr %57, null
  br i1 %58, label %60, label %59

59:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %69

60:                                               ; preds = %56
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds %"class.GC::Pin", ptr %61, i32 0, i32 1
  %63 = load ptr, ptr %62, align 8, !tbaa !18
  %64 = call noundef ptr @_ZN2GC15MemoryAllocator5_copyEPNS_6ObjectE(ptr noundef nonnull align 8 dereferenceable(88) %12, ptr noundef %63)
  br label %65

65:                                               ; preds = %60
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds %"class.GC::Pin", ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !23
  store ptr %68, ptr %7, align 8, !tbaa !5
  br label %56, !llvm.loop !26

69:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %70 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 5
  %71 = load ptr, ptr %70, align 8, !tbaa !27
  store ptr %71, ptr %8, align 8, !tbaa !5
  br label %72

72:                                               ; preds = %81, %69
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = icmp ne ptr %73, null
  br i1 %74, label %76, label %75

75:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %85

76:                                               ; preds = %72
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = load ptr, ptr %77, align 8, !tbaa !28
  %79 = getelementptr inbounds ptr, ptr %78, i64 0
  %80 = load ptr, ptr %79, align 8
  call void %80(ptr noundef nonnull align 8 dereferenceable(16) %77, ptr noundef %12)
  br label %81

81:                                               ; preds = %76
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = getelementptr inbounds %"class.GC::Root", ptr %82, i32 0, i32 1
  %84 = load ptr, ptr %83, align 8, !tbaa !30
  store ptr %84, ptr %8, align 8, !tbaa !5
  br label %72, !llvm.loop !32

85:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %86 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 10
  %87 = load ptr, ptr %86, align 8, !tbaa !16
  store ptr %87, ptr %9, align 8, !tbaa !5
  br label %88

88:                                               ; preds = %119, %85
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = icmp ne ptr %89, null
  br i1 %90, label %92, label %91

91:                                               ; preds = %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %123

92:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %93 = load ptr, ptr %9, align 8, !tbaa !5
  %94 = getelementptr inbounds %"class.GC::AnyWeakRef", ptr %93, i32 0, i32 1
  %95 = load ptr, ptr %94, align 8, !tbaa !33
  %96 = call noundef ptr @_ZNK2GC6Object9getHeaderEv(ptr noundef nonnull align 8 dereferenceable(8) %95)
  store ptr %96, ptr %10, align 8, !tbaa !5
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = load i64, ptr %97, align 8, !tbaa !20
  %99 = and i64 %98, 1
  %100 = icmp ne i64 %99, 0
  br i1 %100, label %101, label %108

101:                                              ; preds = %92
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = load i64, ptr %102, align 8, !tbaa !20
  %104 = sub i64 %103, 1
  %105 = inttoptr i64 %104 to ptr
  %106 = load ptr, ptr %9, align 8, !tbaa !5
  %107 = getelementptr inbounds %"class.GC::AnyWeakRef", ptr %106, i32 0, i32 1
  store ptr %105, ptr %107, align 8, !tbaa !33
  br label %118

108:                                              ; preds = %92
  %109 = load ptr, ptr %10, align 8, !tbaa !5
  %110 = load ptr, ptr %109, align 8, !tbaa !20
  %111 = getelementptr inbounds %"struct.GC::MemorySegment", ptr %110, i32 0, i32 1
  %112 = load ptr, ptr %111, align 8, !tbaa !35
  %113 = icmp eq ptr %112, %12
  br i1 %113, label %114, label %117

114:                                              ; preds = %108
  %115 = load ptr, ptr %9, align 8, !tbaa !5
  %116 = getelementptr inbounds %"class.GC::AnyWeakRef", ptr %115, i32 0, i32 1
  store ptr null, ptr %116, align 8, !tbaa !33
  br label %117

117:                                              ; preds = %114, %108
  br label %118

118:                                              ; preds = %117, %101
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %119

119:                                              ; preds = %118
  %120 = load ptr, ptr %9, align 8, !tbaa !5
  %121 = getelementptr inbounds %"class.GC::AnyWeakRef", ptr %120, i32 0, i32 0
  %122 = load ptr, ptr %121, align 8, !tbaa !36
  store ptr %122, ptr %9, align 8, !tbaa !5
  br label %88, !llvm.loop !37

123:                                              ; preds = %91
  br label %124

124:                                              ; preds = %164, %123
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = icmp ne ptr %125, null
  br i1 %126, label %127, label %168

127:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = getelementptr inbounds %"struct.GC::MemorySegment", ptr %128, i32 0, i32 0
  %130 = load ptr, ptr %129, align 8, !tbaa !21
  %131 = ptrtoint ptr %130 to i64
  store i64 %131, ptr %11, align 8, !tbaa !12
  %132 = load i64, ptr %11, align 8, !tbaa !12
  %133 = and i64 %132, 1
  %134 = icmp ne i64 %133, 0
  br i1 %134, label %135, label %147

135:                                              ; preds = %127
  %136 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 3
  %137 = load ptr, ptr %136, align 8, !tbaa !13
  %138 = ptrtoint ptr %137 to i64
  %139 = load i64, ptr %11, align 8, !tbaa !12
  %140 = and i64 %139, 2
  %141 = or i64 %138, %140
  %142 = inttoptr i64 %141 to ptr
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = getelementptr inbounds %"struct.GC::MemorySegment", ptr %143, i32 0, i32 0
  store ptr %142, ptr %144, align 8, !tbaa !21
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 3
  store ptr %145, ptr %146, align 8, !tbaa !13
  br label %164

147:                                              ; preds = %127
  %148 = load i64, ptr %11, align 8, !tbaa !12
  %149 = and i64 %148, 2
  %150 = icmp ne i64 %149, 0
  br i1 %150, label %151, label %156

151:                                              ; preds = %147
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = icmp eq ptr %152, null
  br i1 %153, label %155, label %154

154:                                              ; preds = %151
  call void @_ZdlPvm(ptr noundef %152, i64 noundef 16) #5
  br label %155

155:                                              ; preds = %154, %151
  br label %163

156:                                              ; preds = %147
  %157 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 2
  %158 = load ptr, ptr %157, align 8, !tbaa !38
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  %160 = getelementptr inbounds %"struct.GC::MemorySegment", ptr %159, i32 0, i32 0
  store ptr %158, ptr %160, align 8, !tbaa !21
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 2
  store ptr %161, ptr %162, align 8, !tbaa !38
  br label %163

163:                                              ; preds = %156, %155
  br label %164

164:                                              ; preds = %163, %135
  %165 = load i64, ptr %11, align 8, !tbaa !12
  %166 = and i64 %165, -4
  %167 = inttoptr i64 %166 to ptr
  store ptr %167, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %124, !llvm.loop !39

168:                                              ; preds = %124
  %169 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 4
  store i64 0, ptr %169, align 8, !tbaa !40
  %170 = load i64, ptr %3, align 8, !tbaa !12
  %171 = getelementptr inbounds %"class.GC::MemoryAllocator", ptr %12, i32 0, i32 8
  store i64 %170, ptr %171, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { mustprogress 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 = { nobuiltin 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 }
attributes #5 = { builtin 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++ TBAA"}
!9 = !{!10, !11, i64 64}
!10 = !{!"_ZTSN2GC15MemoryAllocatorE", !11, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !11, i64 64, !6, i64 72, !6, i64 80}
!11 = !{!"long", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !6, i64 24}
!14 = !{!10, !11, i64 0}
!15 = !{!10, !11, i64 8}
!16 = !{!10, !6, i64 80}
!17 = !{!10, !6, i64 48}
!18 = !{!19, !6, i64 8}
!19 = !{!"_ZTSN2GC3PinE", !6, i64 0, !6, i64 8}
!20 = !{!7, !7, i64 0}
!21 = !{!22, !6, i64 0}
!22 = !{!"_ZTSN2GC13MemorySegmentE", !6, i64 0, !6, i64 8}
!23 = !{!19, !6, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = !{!10, !6, i64 40}
!28 = !{!29, !29, i64 0}
!29 = !{!"vtable pointer", !8, i64 0}
!30 = !{!31, !6, i64 8}
!31 = !{!"_ZTSN2GC4RootE", !6, i64 8}
!32 = distinct !{!32, !25}
!33 = !{!34, !6, i64 8}
!34 = !{!"_ZTSN2GC10AnyWeakRefE", !6, i64 0, !6, i64 8}
!35 = !{!22, !6, i64 8}
!36 = !{!34, !6, i64 0}
!37 = distinct !{!37, !25}
!38 = !{!10, !6, i64 16}
!39 = distinct !{!39, !25}
!40 = !{!10, !11, i64 32}


; 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"

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK2GC6Object9getHeaderEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN2GC15MemoryAllocator5_copyEPNS_6ObjectE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2GC15MemoryAllocator3_gcEv(ptr noundef nonnull align 8 dereferenceable(88) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 64
  %3 = load i64, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = load ptr, ptr %4, align 8, !tbaa !11
  store ptr null, ptr %4, align 8, !tbaa !11
  store i64 -1, ptr %2, align 8, !tbaa !5
  %6 = load i64, ptr %0, align 8, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %6, ptr %7, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %0, i64 80
  store ptr null, ptr %8, align 8, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  %.03346 = load ptr, ptr %9, align 8, !tbaa !15
  %.not47 = icmp eq ptr %.03346, null
  br i1 %.not47, label %._crit_edge, label %.lr.ph

.preheader45:                                     ; preds = %.lr.ph
  %.03649.pre = load ptr, ptr %9, align 8, !tbaa !15
  %.not3750 = icmp eq ptr %.03649.pre, null
  br i1 %.not3750, label %._crit_edge, label %.lr.ph52

.lr.ph:                                           ; preds = %1, %.lr.ph
  %.03348 = phi ptr [ %.033, %.lr.ph ], [ %.03346, %1 ]
  %10 = getelementptr inbounds i8, ptr %.03348, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !16
  %12 = tail call noundef ptr @_ZNK2GC6Object9getHeaderEv(ptr noundef nonnull align 8 dereferenceable(8) %11)
  %13 = load ptr, ptr %12, align 8, !tbaa !18
  %14 = load ptr, ptr %13, align 8, !tbaa !19
  %15 = ptrtoint ptr %14 to i64
  %16 = or i64 %15, 1
  %17 = inttoptr i64 %16 to ptr
  store ptr %17, ptr %13, align 8, !tbaa !19
  %18 = load ptr, ptr %10, align 8, !tbaa !16
  %19 = ptrtoint ptr %18 to i64
  store i64 %19, ptr %12, align 8, !tbaa !18
  %.033 = load ptr, ptr %.03348, align 8, !tbaa !15
  %.not = icmp eq ptr %.033, null
  br i1 %.not, label %.preheader45, label %.lr.ph, !llvm.loop !21

._crit_edge:                                      ; preds = %.lr.ph52, %1, %.preheader45
  %20 = getelementptr inbounds i8, ptr %0, i64 40
  %.03553 = load ptr, ptr %20, align 8, !tbaa !15
  %.not3854 = icmp eq ptr %.03553, null
  br i1 %.not3854, label %.preheader44, label %.lr.ph57

.lr.ph52:                                         ; preds = %.preheader45, %.lr.ph52
  %.03651 = phi ptr [ %.036, %.lr.ph52 ], [ %.03649.pre, %.preheader45 ]
  %21 = getelementptr inbounds i8, ptr %.03651, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !16
  %23 = tail call noundef ptr @_ZN2GC15MemoryAllocator5_copyEPNS_6ObjectE(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %22)
  %.036 = load ptr, ptr %.03651, align 8, !tbaa !15
  %.not37 = icmp eq ptr %.036, null
  br i1 %.not37, label %._crit_edge, label %.lr.ph52, !llvm.loop !23

.preheader44:                                     ; preds = %.lr.ph57, %._crit_edge
  %.03458 = load ptr, ptr %8, align 8, !tbaa !15
  %.not3959 = icmp eq ptr %.03458, null
  br i1 %.not3959, label %.preheader, label %.lr.ph61

.lr.ph57:                                         ; preds = %._crit_edge, %.lr.ph57
  %.03555 = phi ptr [ %.035, %.lr.ph57 ], [ %.03553, %._crit_edge ]
  %24 = load ptr, ptr %.03555, align 8, !tbaa !24
  %25 = load ptr, ptr %24, align 8
  tail call void %25(ptr noundef nonnull align 8 dereferenceable(16) %.03555, ptr noundef nonnull %0)
  %26 = getelementptr inbounds i8, ptr %.03555, i64 8
  %.035 = load ptr, ptr %26, align 8, !tbaa !15
  %.not38 = icmp eq ptr %.035, null
  br i1 %.not38, label %.preheader44, label %.lr.ph57, !llvm.loop !26

.preheader:                                       ; preds = %41, %.preheader44
  %.not4062 = icmp eq ptr %5, null
  br i1 %.not4062, label %._crit_edge65, label %.lr.ph64

.lr.ph64:                                         ; preds = %.preheader
  %27 = getelementptr inbounds i8, ptr %0, i64 16
  br label %42

.lr.ph61:                                         ; preds = %.preheader44, %41
  %.03460 = phi ptr [ %.034, %41 ], [ %.03458, %.preheader44 ]
  %28 = getelementptr inbounds i8, ptr %.03460, i64 8
  %29 = load ptr, ptr %28, align 8, !tbaa !27
  %30 = tail call noundef ptr @_ZNK2GC6Object9getHeaderEv(ptr noundef nonnull align 8 dereferenceable(8) %29)
  %31 = load i64, ptr %30, align 8
  %32 = and i64 %31, 1
  %.not43 = icmp eq i64 %32, 0
  br i1 %.not43, label %36, label %33

33:                                               ; preds = %.lr.ph61
  %34 = add nsw i64 %31, -1
  %35 = inttoptr i64 %34 to ptr
  br label %.sink.split

36:                                               ; preds = %.lr.ph61
  %37 = inttoptr i64 %31 to ptr
  %38 = getelementptr inbounds i8, ptr %37, i64 8
  %39 = load ptr, ptr %38, align 8, !tbaa !29
  %40 = icmp eq ptr %39, %0
  br i1 %40, label %.sink.split, label %41

.sink.split:                                      ; preds = %36, %33
  %.sink = phi ptr [ %35, %33 ], [ null, %36 ]
  store ptr %.sink, ptr %28, align 8, !tbaa !27
  br label %41

41:                                               ; preds = %.sink.split, %36
  %.034 = load ptr, ptr %.03460, align 8, !tbaa !15
  %.not39 = icmp eq ptr %.034, null
  br i1 %.not39, label %.preheader, label %.lr.ph61, !llvm.loop !30

42:                                               ; preds = %.lr.ph64, %57
  %.063 = phi ptr [ %5, %.lr.ph64 ], [ %59, %57 ]
  %43 = load ptr, ptr %.063, align 8, !tbaa !19
  %44 = ptrtoint ptr %43 to i64
  %45 = and i64 %44, 1
  %.not41 = icmp eq i64 %45, 0
  br i1 %.not41, label %52, label %46

46:                                               ; preds = %42
  %47 = load ptr, ptr %4, align 8, !tbaa !11
  %48 = ptrtoint ptr %47 to i64
  %49 = and i64 %44, 2
  %50 = or i64 %49, %48
  %51 = inttoptr i64 %50 to ptr
  store ptr %51, ptr %.063, align 8, !tbaa !19
  store ptr %.063, ptr %4, align 8, !tbaa !11
  br label %57

52:                                               ; preds = %42
  %53 = and i64 %44, 2
  %.not42 = icmp eq i64 %53, 0
  br i1 %.not42, label %55, label %54

54:                                               ; preds = %52
  tail call void @_ZdlPvm(ptr noundef nonnull %.063, i64 noundef 16) #3
  br label %57

55:                                               ; preds = %52
  %56 = load ptr, ptr %27, align 8, !tbaa !31
  store ptr %56, ptr %.063, align 8, !tbaa !19
  store ptr %.063, ptr %27, align 8, !tbaa !31
  br label %57

57:                                               ; preds = %55, %54, %46
  %58 = and i64 %44, -4
  %59 = inttoptr i64 %58 to ptr
  %.not40 = icmp eq i64 %58, 0
  br i1 %.not40, label %._crit_edge65, label %42, !llvm.loop !32

._crit_edge65:                                    ; preds = %57, %.preheader
  %60 = getelementptr inbounds i8, ptr %0, i64 32
  store i64 0, ptr %60, align 8, !tbaa !33
  store i64 %3, ptr %2, align 8, !tbaa !5
  ret void
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress 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 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 = { nobuiltin 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 = { builtin nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 64}
!6 = !{!"_ZTSN2GC15MemoryAllocatorE", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !10, i64 40, !10, i64 48, !7, i64 56, !7, i64 64, !10, i64 72, !10, i64 80}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 24}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !10, i64 80}
!15 = !{!10, !10, i64 0}
!16 = !{!17, !10, i64 8}
!17 = !{!"_ZTSN2GC3PinE", !10, i64 0, !10, i64 8}
!18 = !{!8, !8, i64 0}
!19 = !{!20, !10, i64 0}
!20 = !{!"_ZTSN2GC13MemorySegmentE", !10, i64 0, !10, i64 8}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = !{!25, !25, i64 0}
!25 = !{!"vtable pointer", !9, i64 0}
!26 = distinct !{!26, !22}
!27 = !{!28, !10, i64 8}
!28 = !{!"_ZTSN2GC10AnyWeakRefE", !10, i64 0, !10, i64 8}
!29 = !{!20, !10, i64 8}
!30 = distinct !{!30, !22}
!31 = !{!6, !10, i64 16}
!32 = distinct !{!32, !22}
!33 = !{!6, !7, i64 32}


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