// File: corecodec[P]coremake/coremake.c
// Function: preprocess_workspace
void preprocess_workspace(item* p)
{
	item** child;
	for (child=p->child;child!=p->childend;++child)
	{
		item* use = item_get(*child,"use",0);
		size_t i;
		for (i=0;i<item_childcount(use);++i)
			use->child[i]->flags &= ~FLAG_PROCESSED;

		for (i=0;i<item_childcount(use);++i)
			if (!(use->child[i]->flags & FLAG_PROCESSED))
				preprocess_workspace_adddep(use,use->child[i]);

		for (i=0;i<item_childcount(use);++i)
		{
			item* ref = findref(use->child[i]);
			if (!ref || (ref->flags & FLAG_REMOVED))
			{
				item_delete(use->child[i]);
				--i;
			}
		}

		if (!item_childcount(use))
		{
			item_delete(*child);
			--child;
		}
#if 0
		else
		{
			// copy all the FRAMEWORK of each (use) into the WORKSPACE (*child)
			item *frameworks = item_get(*child,"framework",0);
			for (i=0;i<item_childcount(use);++i)
			{
				item* ref = findref(use->child[i]);
				if (ref)
				{
					item_merge(frameworks,item_find(ref,"framework"),NULL);
				}
			}
		}
#endif
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x20(%rcx), %rax
je 0xda4c
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x8845(%rip), %rsi      # 0x1610d
xorl %edx, %edx
callq 0x28d0
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
callq 0x25d0
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
jae 0xd922
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x30(%rax), %ecx
andl $0xffffff7f, %ecx       # imm = 0xFFFFFF7F
movl %ecx, 0x30(%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xd8db
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0x25d0
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jae 0xd98d
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x30(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0xd97d
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0xd690
jmp 0xd97f
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xd92a
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x25d0
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
jae 0xda12
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2a60
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xd9e1
movq -0x28(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0xda02
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3150
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xda04
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xd995
movq -0x18(%rbp), %rdi
callq 0x25d0
cmpq $0x0, %rax
jne 0xda39
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x3150
movq -0x10(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x10(%rbp)
jmp 0xda3b
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
jmp 0xd8a8
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)