// File: /workspace/github_cpp_makefile_star2_O1/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:
testq %rdi, %rdi
je 0xae49
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rbp
cmpq 0x20(%rbx), %rbp
je 0xae3b
movq (%rbp), %rdi
leaq 0x767b(%rip), %rsi      # 0x120eb
xorl %edx, %edx
callq 0x2745
movq %rax, %r13
xorl %r15d, %r15d
testq %r13, %r13
je 0xaa90
movq 0x20(%r13), %rax
subq 0x18(%r13), %rax
sarq $0x3, %rax
jmp 0xaa92
xorl %eax, %eax
cmpq %rax, %r15
jae 0xae32
movq 0x18(%r13), %rax
movq (%rax,%r15,8), %rdi
callq 0x2877
testq %rax, %rax
je 0xae2a
movq %rax, %r14
movq 0x10(%rax), %rax
movq (%rax), %r12
movq %r12, %rdi
leaq 0x86b6(%rip), %rsi      # 0x1317b
callq 0x2070
testl %eax, %eax
jne 0xac56
movq 0x18(%r13), %rax
movq (%rax,%r15,8), %rax
testb $0x40, 0x30(%rax)
jne 0xac56
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xaae7
leaq 0x86a3(%rip), %rsi      # 0x1319d
xorl %edx, %edx
callq 0x2745
movq (%r14), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x2745
movq %rax, %r12
movq %r14, %rdi
leaq 0x7b5a(%rip), %rsi      # 0x12675
callq 0x26b0
movq %rax, %rdi
callq 0x2da0
movq %r14, %rdi
leaq 0x7b54(%rip), %rsi      # 0x12686
callq 0x26b0
movq %rax, %rdi
callq 0x2da0
movq 0x18(%r13), %rax
movq (%rax,%r15,8), %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x334b
movq %r14, %rdi
callq 0x2da0
movq %r12, %rdi
leaq 0x7578(%rip), %rsi      # 0x120dc
xorl %edx, %edx
callq 0x2745
movq (%rbp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x26b0
testq %rax, %rax
je 0xab87
movq %rax, %rdi
callq 0x2da0
movq %r12, %rdi
leaq 0x7563(%rip), %rsi      # 0x120f4
xorl %edx, %edx
callq 0x2745
movq (%rbp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x26b0
testq %rax, %rax
je 0xabb4
movq %rax, %rdi
callq 0x2da0
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xabb7
leaq 0x85b1(%rip), %rsi      # 0x1317b
xorl %edx, %edx
callq 0x2745
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa905
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xabe4
leaq 0x85a6(%rip), %rsi      # 0x1319d
xorl %edx, %edx
callq 0x2745
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa905
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xac11
leaq 0x854c(%rip), %rsi      # 0x13170
xorl %edx, %edx
callq 0x2745
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa905
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xac3e
leaq 0x84cb(%rip), %rsi      # 0x1311c
jmp 0xadec
movq %r12, %rdi
leaq 0x74a3(%rip), %rsi      # 0x12103
callq 0x2070
testl %eax, %eax
jne 0xae2a
movq 0x18(%r13), %rax
movq (%rax,%r15,8), %rax
testb $0x40, 0x30(%rax)
jne 0xae2a
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xac82
leaq 0x748f(%rip), %rsi      # 0x12124
xorl %edx, %edx
callq 0x2745
movq (%r14), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x2745
movq %rax, %r12
movq %r14, %rdi
leaq 0x79bf(%rip), %rsi      # 0x12675
callq 0x26b0
movq %rax, %rdi
callq 0x2da0
movq %r14, %rdi
leaq 0x79b9(%rip), %rsi      # 0x12686
callq 0x26b0
movq %rax, %rdi
callq 0x2da0
movq 0x18(%r13), %rax
movq (%rax,%r15,8), %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x334b
movq %r14, %rdi
callq 0x2da0
movq %r12, %rdi
leaq 0x73dd(%rip), %rsi      # 0x120dc
xorl %edx, %edx
callq 0x2745
movq (%rbp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x26b0
testq %rax, %rax
je 0xad22
movq %rax, %rdi
callq 0x2da0
movq %r12, %rdi
leaq 0x73c8(%rip), %rsi      # 0x120f4
xorl %edx, %edx
callq 0x2745
movq (%rbp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x26b0
testq %rax, %rax
je 0xad4f
movq %rax, %rdi
callq 0x2da0
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xad52
leaq 0x739e(%rip), %rsi      # 0x12103
xorl %edx, %edx
callq 0x2745
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa905
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xad7f
leaq 0x7392(%rip), %rsi      # 0x12124
xorl %edx, %edx
callq 0x2745
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa905
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xadac
leaq 0x734f(%rip), %rsi      # 0x1210e
xorl %edx, %edx
callq 0x2745
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa905
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xadd9
leaq 0x732d(%rip), %rsi      # 0x12119
xorl %edx, %edx
callq 0x2745
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa905
movq (%rbp), %rdi
leaq 0x72ce(%rip), %rsi      # 0x120dc
xorl %edx, %edx
callq 0x2745
movq (%r12), %rsi
movq %rax, %rdi
movl $0x1, %edx
callq 0x2745
andb $-0x41, 0x30(%rax)
incq %r15
jmp 0xaa7d
addq $0x8, %rbp
jmp 0xaa5b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq