// File: dragazo[P]cpp-gc/GarbageCollection.cpp
// Function: GC::disjoint_module::~disjoint_module()
GC::disjoint_module::~disjoint_module()
{
	// getting here means there's no longer any owning handles for this disjoint module.
	// that means we're about to release control of all our stuff - the only thing that can leak is objects.
	// however we can't perform a collection because this thread no longer as living handle to this module.
	// so all we can do is enforce the fact that there should not be any memory leaks.

	// if we still have objects, bad news - the user probably violated a disjunction barrier
	if (!objs.empty())
	{
		std::cerr << "\n\nYOU MADE A USAGE VIOLATION!!\ndestruction of a disjoint gc module had leftover objects\n\n";
		std::cerr << objs.front() << ' ' << objs.front()->next << '\n' << roots.size() << '\n';
		std::abort();
	}
	// same thing for roots - less important cause this can't leak, but we don't want dangling pointers floating around out there.
	if (!roots.empty())
	{
		std::cerr << "\n\nYOU MADE A USAGE VIOLATION!!\ndestruction of a disjoint gc module had leftover roots\n\n";
		std::cerr << roots.size() << '\n' << *roots.begin() << '\n';
		std::abort();
	}
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq 0x60(%rsp), %rdi
movq %rdi, 0x50(%rsp)
addq $0x38, %rdi
callq 0x9460
testb $0x1, %al
jne 0x5cb9
movq 0x94405(%rip), %rdi     # 0x99ff0
leaq 0x5e4a2(%rip), %rsi     # 0x64094
callq 0x52f0
jmp 0x5bf9
movq 0x50(%rsp), %rdi
addq $0x38, %rdi
callq 0x9490
movq %rax, 0x48(%rsp)
jmp 0x5c0e
movq 0x48(%rsp), %rsi
movq 0x943d6(%rip), %rdi     # 0x99ff0
callq 0x5280
movq %rax, 0x40(%rsp)
jmp 0x5c26
movq 0x40(%rsp), %rdi
movl $0x20, %esi
callq 0x53c0
movq %rax, 0x38(%rsp)
jmp 0x5c3c
movq 0x50(%rsp), %rdi
addq $0x38, %rdi
callq 0x9490
movq %rax, 0x30(%rsp)
jmp 0x5c51
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rax
movq 0x38(%rax), %rsi
callq 0x5280
movq %rax, 0x28(%rsp)
jmp 0x5c6b
movq 0x28(%rsp), %rdi
movl $0xa, %esi
callq 0x53c0
movq %rax, 0x20(%rsp)
jmp 0x5c81
movq 0x50(%rsp), %rdi
addq $0x48, %rdi
callq 0x94a0
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x50c0
movq %rax, 0x18(%rsp)
jmp 0x5ca3
movq 0x18(%rsp), %rdi
movl $0xa, %esi
callq 0x53c0
jmp 0x5cb4
callq 0x51a0
movq 0x50(%rsp), %rdi
addq $0x48, %rdi
callq 0x94b0
testb $0x1, %al
jne 0x5d63
movq 0x9431a(%rip), %rdi     # 0x99ff0
leaq 0x5e411(%rip), %rsi     # 0x640ee
callq 0x52f0
jmp 0x5ce4
movq 0x50(%rsp), %rdi
addq $0x48, %rdi
callq 0x94a0
movq %rax, %rsi
movq 0x942f4(%rip), %rdi     # 0x99ff0
callq 0x50c0
movq %rax, 0x10(%rsp)
jmp 0x5d08
movq 0x10(%rsp), %rdi
movl $0xa, %esi
callq 0x53c0
movq %rax, 0x8(%rsp)
jmp 0x5d1e
movq 0x50(%rsp), %rdi
addq $0x48, %rdi
callq 0x94d0
movq %rax, 0x58(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x9500
movq 0x8(%rsp), %rdi
movq (%rax), %rsi
callq 0x5280
movq %rax, (%rsp)
jmp 0x5d4e
movq (%rsp), %rdi
movl $0xa, %esi
callq 0x53c0
jmp 0x5d5e
callq 0x51a0
movq 0x50(%rsp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
callq 0x9520
movq 0x50(%rsp), %rdi
addq $0x178, %rdi            # imm = 0x178
callq 0x9530
movq 0x50(%rsp), %rdi
addq $0x140, %rdi            # imm = 0x140
callq 0x9530
movq 0x50(%rsp), %rdi
addq $0x108, %rdi            # imm = 0x108
callq 0x9540
movq 0x50(%rsp), %rdi
addq $0xd0, %rdi
callq 0x9540
movq 0x50(%rsp), %rdi
addq $0x80, %rdi
callq 0x9540
movq 0x50(%rsp), %rdi
addq $0x48, %rdi
callq 0x9530
addq $0x68, %rsp
retq
movq %rax, %rdi
callq 0x9480
nopw %cs:(%rax,%rax)