// File: dragazo[P]cpp-gc/./GarbageCollection.h
// Function: GC::ptr<int []> GC::adopt<int, std::default_delete<int []>>(int*, unsigned long)
[[nodiscard]]
	static ptr<T[]> adopt(T obj[], std::size_t count)
	{
		// -- verification -- //

		// if obj is null, return an null ptr
		if (!obj) return {};

		// -- normalize T -- //

		// get the allocator
		typedef checked_aligned_allocator_for<info> allocator_t;

		// -- create the vtable -- //

		// use lambda to conveniently create the set of all router functions for type T
		auto router_set = [](info &handle, auto func) { for (std::size_t i = 0; i < handle.count; ++i) GC::route(reinterpret_cast<T*>(handle.obj)[i], func); };

		static const info_vtable _vtable(
			[](info &handle) { Deleter()(reinterpret_cast<T*>(handle.obj)); },
			[](info &handle) { allocator_t::dealloc(&handle); },
			router_set,
			router_set
		);

		// -- create the info object for management -- //

		info *handle;

		// allocate the buffer space for the info object
		try { handle = reinterpret_cast<info*>(allocator_t::alloc(sizeof(info))); }
		// on failure, delete the object and rethrow whatever killed us
		catch (...) { Deleter()(obj); throw; }

		// construct the info object
		new (handle) info(obj, count, &_vtable);

		// -- do the garbage collection aspects -- //

		// claim its children
		handle->route(GC::router_unroot);

		// create the ptr first - this roots obj
		ptr<T[]> res(obj, handle, GC::bind_new_obj);

		// begin timed collection (if it's not already)
		GC::start_timed_collect();

		// return the now-initialized ptr
		return res;
	}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x38(%rsp)
movq %rdi, %rax
movq %rax, 0x40(%rsp)
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq %rdx, 0x80(%rsp)
cmpq $0x0, 0x88(%rsp)
jne 0x3788a
movq 0x38(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x37550
jmp 0x37a3a
cmpb $0x0, 0x62c3f(%rip)     # 0x9a4d0
jne 0x3790c
leaq 0x62c36(%rip), %rdi     # 0x9a4d0
callq 0x5540
cmpl $0x0, %eax
je 0x3790c
leaq 0x7e(%rsp), %rdi
callq 0x39de0
movq %rax, 0x20(%rsp)
leaq 0x7d(%rsp), %rdi
callq 0x39df0
movq %rax, 0x28(%rsp)
leaq 0x7f(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x39e00
movq 0x18(%rsp), %rdi
movq %rax, 0x30(%rsp)
callq 0x39e10
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq %rax, %r8
leaq 0x62bb7(%rip), %rdi     # 0x9a4b0
callq 0x39840
jmp 0x37900
leaq 0x62bc9(%rip), %rdi     # 0x9a4d0
callq 0x51d0
movl $0x40, %edi
callq 0x39890
movq %rax, 0x10(%rsp)
jmp 0x3791d
movq 0x10(%rsp), %rax
movq %rax, 0x60(%rsp)
jmp 0x37998
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x70(%rsp)
movl %eax, 0x6c(%rsp)
leaq 0x62b92(%rip), %rdi     # 0x9a4d0
callq 0x51c0
jmp 0x37a47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x70(%rsp)
movl %eax, 0x6c(%rsp)
movq 0x70(%rsp), %rdi
callq 0x5110
movq 0x88(%rsp), %rsi
leaq 0x5f(%rsp), %rdi
callq 0x39e20
jmp 0x37974
callq 0x5450
jmp 0x37a59
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x70(%rsp)
movl %eax, 0x6c(%rsp)
callq 0x54b0
jmp 0x37993
jmp 0x37a47
movq 0x60(%rsp), %rdi
movq 0x88(%rsp), %rsi
movq 0x80(%rsp), %rdx
leaq 0x62afc(%rip), %rcx     # 0x9a4b0
callq 0x39950
movq 0x60(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq -0x2ec5a(%rip), %rsi    # 0x8d70
leaq 0x50(%rsp), %rdi
callq 0x9580
movq 0x8(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x9550
movq 0x38(%rsp), %rdi
movb $0x0, 0x4f(%rsp)
movq 0x88(%rsp), %rsi
movq 0x60(%rsp), %rdx
callq 0x39e50
callq 0x8e10
jmp 0x37a06
movb $0x1, 0x4f(%rsp)
testb $0x1, 0x4f(%rsp)
jne 0x37a38
jmp 0x37a2e
movq 0x38(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x70(%rsp)
movl %eax, 0x6c(%rsp)
callq 0x27540
jmp 0x37a47
movq 0x38(%rsp), %rdi
callq 0x27540
jmp 0x37a3a
movq 0x40(%rsp), %rax
addq $0x98, %rsp
retq
movq 0x70(%rsp), %rdi
callq 0x5510
movq %rax, %rdi
callq 0x9480
nopl (%rax)