// File: corecodec[P]coremake/coremake.c
// Function: preprocess_usemerge
void preprocess_usemerge(item* p)
{
	item** child;
	if (!p) return;
	for (child=p->child;child!=p->childend;++child)
	{
		size_t i;
		item* merge = item_get(*child,"usemerge",0);
		for (i=0;i<item_childcount(merge);++i)
		{
			item* dll = findref(merge->child[i]);
			if (dll && stricmp(dll->parent->value,"dll")==0 && !(merge->child[i]->flags & FLAG_REMOVED))
			{
                item* use;
                item* lib = item_get(getroot(p,"lib"),dll->value,0);

                item_delete(item_find(dll,"nolib"));
                item_delete(item_find(dll,"output"));

		        item_merge(lib,dll,merge->child[i]);
                item_delete(dll);

                use = item_find(item_get(lib,"use",0),(*child)->value);
                if (use)
                    item_delete(use);

                use = item_find(item_get(lib,"usebuilt",0),(*child)->value);
                if (use)
                    item_delete(use);

				replace_use(getroot(p,"dll"),lib->value,*child);
				replace_use(getroot(p,"lib"),lib->value,*child);
				replace_use(getroot(p,"con"),lib->value,*child);
				replace_use(getroot(p,"exe"),lib->value,*child);

                item_get(item_get(*child,"use",0),lib->value,1)->flags &= ~FLAG_REMOVED;
			}
            else
			if (dll && stricmp(dll->parent->value,"dll_csharp")==0 && !(merge->child[i]->flags & FLAG_REMOVED))
			{
                item* use;
                item* lib = item_get(getroot(p,"lib_csharp"),dll->value,0);

                item_delete(item_find(dll,"nolib"));
                item_delete(item_find(dll,"output"));

		        item_merge(lib,dll,merge->child[i]);
                item_delete(dll);

                use = item_find(item_get(lib,"use",0),(*child)->value);
                if (use)
                    item_delete(use);

                use = item_find(item_get(lib,"usebuilt",0),(*child)->value);
                if (use)
                    item_delete(use);

				replace_use(getroot(p,"dll_csharp"),lib->value,*child);
				replace_use(getroot(p,"lib_csharp"),lib->value,*child);
				replace_use(getroot(p,"con_csharp"),lib->value,*child);
				replace_use(getroot(p,"exe_csharp"),lib->value,*child);

                item_get(item_get(*child,"use",0),lib->value,1)->flags &= ~FLAG_REMOVED;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0xdca8
jmp 0xe14c
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 0xe14c
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x8448(%rip), %rsi      # 0x1611c
xorl %edx, %edx
callq 0x28d0
movq %rax, -0x20(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rdi
callq 0x25d0
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
jae 0xe139
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2a60
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xdf25
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
leaq 0x9553(%rip), %rsi      # 0x17291
callq 0x2050
cmpl $0x0, %eax
jne 0xdf25
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x30(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0xdf25
movq -0x8(%rbp), %rdi
leaq 0x953d(%rip), %rsi      # 0x172b3
callq 0x2890
movq %rax, %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
xorl %edx, %edx
callq 0x28d0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x89f0(%rip), %rsi      # 0x1678b
callq 0x27d0
movq %rax, %rdi
callq 0x3150
movq -0x28(%rbp), %rdi
leaq 0x89e9(%rip), %rsi      # 0x1679c
callq 0x27d0
movq %rax, %rdi
callq 0x3150
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
callq 0x3b20
movq -0x28(%rbp), %rdi
callq 0x3150
movq -0x38(%rbp), %rdi
leaq 0x831c(%rip), %rsi      # 0x1610d
xorl %edx, %edx
callq 0x28d0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rsi
callq 0x27d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xde1e
movq -0x30(%rbp), %rdi
callq 0x3150
movq -0x38(%rbp), %rdi
leaq 0x82fc(%rip), %rsi      # 0x16125
xorl %edx, %edx
callq 0x28d0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rsi
callq 0x27d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xde56
movq -0x30(%rbp), %rdi
callq 0x3150
movq -0x8(%rbp), %rdi
leaq 0x9430(%rip), %rsi      # 0x17291
callq 0x2890
movq %rax, %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
callq 0xdb20
movq -0x8(%rbp), %rdi
leaq 0x942c(%rip), %rsi      # 0x172b3
callq 0x2890
movq %rax, %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
callq 0xdb20
movq -0x8(%rbp), %rdi
leaq 0x93d9(%rip), %rsi      # 0x17286
callq 0x2890
movq %rax, %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
callq 0xdb20
movq -0x8(%rbp), %rdi
leaq 0x935f(%rip), %rsi      # 0x17232
callq 0x2890
movq %rax, %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
callq 0xdb20
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x8211(%rip), %rsi      # 0x1610d
xorl %edx, %edx
callq 0x28d0
movq %rax, %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movl $0x1, %edx
callq 0x28d0
movl 0x30(%rax), %ecx
andl $-0x41, %ecx
movl %ecx, 0x30(%rax)
jmp 0xe126
cmpq $0x0, -0x28(%rbp)
je 0xe124
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
leaq 0x81f2(%rip), %rsi      # 0x16134
callq 0x2050
cmpl $0x0, %eax
jne 0xe124
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x30(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0xe124
movq -0x8(%rbp), %rdi
leaq 0x81db(%rip), %rsi      # 0x16155
callq 0x2890
movq %rax, %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
xorl %edx, %edx
callq 0x28d0
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x87ec(%rip), %rsi      # 0x1678b
callq 0x27d0
movq %rax, %rdi
callq 0x3150
movq -0x28(%rbp), %rdi
leaq 0x87e5(%rip), %rsi      # 0x1679c
callq 0x27d0
movq %rax, %rdi
callq 0x3150
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
callq 0x3b20
movq -0x28(%rbp), %rdi
callq 0x3150
movq -0x48(%rbp), %rdi
leaq 0x8118(%rip), %rsi      # 0x1610d
xorl %edx, %edx
callq 0x28d0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rsi
callq 0x27d0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xe022
movq -0x40(%rbp), %rdi
callq 0x3150
movq -0x48(%rbp), %rdi
leaq 0x80f8(%rip), %rsi      # 0x16125
xorl %edx, %edx
callq 0x28d0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rsi
callq 0x27d0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xe05a
movq -0x40(%rbp), %rdi
callq 0x3150
movq -0x8(%rbp), %rdi
leaq 0x80cf(%rip), %rsi      # 0x16134
callq 0x2890
movq %rax, %rdi
movq -0x48(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
callq 0xdb20
movq -0x8(%rbp), %rdi
leaq 0x80ca(%rip), %rsi      # 0x16155
callq 0x2890
movq %rax, %rdi
movq -0x48(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
callq 0xdb20
movq -0x8(%rbp), %rdi
leaq 0x808e(%rip), %rsi      # 0x1613f
callq 0x2890
movq %rax, %rdi
movq -0x48(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
callq 0xdb20
movq -0x8(%rbp), %rdi
leaq 0x8073(%rip), %rsi      # 0x1614a
callq 0x2890
movq %rax, %rdi
movq -0x48(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
callq 0xdb20
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x800d(%rip), %rsi      # 0x1610d
xorl %edx, %edx
callq 0x28d0
movq %rax, %rdi
movq -0x48(%rbp), %rax
movq (%rax), %rsi
movl $0x1, %edx
callq 0x28d0
movl 0x30(%rax), %ecx
andl $-0x41, %ecx
movl %ecx, 0x30(%rax)
jmp 0xe126
jmp 0xe128
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xdce7
jmp 0xe13b
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
jmp 0xdcb4
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)