// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, 0x8(%rsp)
testq %rdi, %rdi
je 0x9bb2
movq 0x8(%rsp), %rax
movq 0x18(%rax), %r15
leaq 0x792d(%rip), %r12      # 0x1117d
movq 0x8(%rsp), %rax
cmpq 0x20(%rax), %r15
je 0x9bb2
movq (%r15), %rdi
leaq 0x6882(%rip), %rsi      # 0x100eb
xorl %edx, %edx
callq 0x26a2
movq %rax, %rbp
xorl %r13d, %r13d
movq %r15, 0x20(%rsp)
testq %rbp, %rbp
je 0x988e
movq 0x20(%rbp), %rax
subq 0x18(%rbp), %rax
sarq $0x3, %rax
jmp 0x9890
xorl %eax, %eax
cmpq %rax, %r13
jae 0x9ba9
movq 0x18(%rbp), %rax
movq (%rax,%r13,8), %rdi
callq 0x2776
testq %rax, %rax
je 0x9ba1
movq %rax, %r14
movq 0x10(%rax), %rax
movq (%rax), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2070
testl %eax, %eax
jne 0x99bd
movq 0x18(%rbp), %rax
movq (%rax,%r13,8), %rax
testb $0x40, 0x30(%rax)
jne 0x99bd
movq 0x8(%rsp), %rdi
leaq 0x78b5(%rip), %rsi      # 0x1119f
callq 0x268c
movq (%r14), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x26a2
movq %rax, %r12
movq %r14, %rdi
leaq 0x6d6e(%rip), %rsi      # 0x10677
callq 0x262e
movq %rax, %rdi
callq 0x2be9
movq %r14, %rdi
leaq 0x6d68(%rip), %rsi      # 0x10688
callq 0x262e
movq %rax, %rdi
callq 0x2be9
movq 0x18(%rbp), %rax
movq (%rax,%r13,8), %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x30f9
movq %r14, %rdi
callq 0x2be9
movq %r12, %rdi
leaq 0x678a(%rip), %rsi      # 0x100dc
xorl %edx, %edx
callq 0x26a2
movq (%r15), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x262e
testq %rax, %rax
je 0x9974
movq %rax, %rdi
callq 0x2be9
movq %r12, %rdi
leaq 0x6776(%rip), %rsi      # 0x100f4
xorl %edx, %edx
callq 0x26a2
movq (%r15), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x262e
leaq 0x77e3(%rip), %rbx      # 0x1117d
leaq 0x77fe(%rip), %r15      # 0x1119f
testq %rax, %rax
je 0x9ad0
leaq 0x77c1(%rip), %rdx      # 0x11172
leaq 0x7766(%rip), %rcx      # 0x1111e
jmp 0x9abc
movq %rbx, %rdi
leaq 0x673c(%rip), %rsi      # 0x10103
callq 0x2070
testl %eax, %eax
jne 0x9ba1
movq 0x18(%rbp), %rax
movq (%rax,%r13,8), %rax
testb $0x40, 0x30(%rax)
jne 0x9ba1
movq 0x8(%rsp), %rdi
leaq 0x6732(%rip), %rsi      # 0x10124
callq 0x268c
movq (%r14), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x26a2
movq %rax, %r12
movq %r14, %rdi
leaq 0x6c66(%rip), %rsi      # 0x10677
callq 0x262e
movq %rax, %rdi
callq 0x2be9
movq %r14, %rdi
leaq 0x6c60(%rip), %rsi      # 0x10688
callq 0x262e
movq %rax, %rdi
callq 0x2be9
movq 0x18(%rbp), %rax
movq (%rax,%r13,8), %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x30f9
movq %r14, %rdi
callq 0x2be9
movq %r12, %rdi
leaq 0x6682(%rip), %rsi      # 0x100dc
xorl %edx, %edx
callq 0x26a2
movq (%r15), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x262e
testq %rax, %rax
je 0x9a7c
movq %rax, %rdi
callq 0x2be9
movq %r12, %rdi
leaq 0x666e(%rip), %rsi      # 0x100f4
xorl %edx, %edx
callq 0x26a2
movq (%r15), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x262e
leaq 0x6661(%rip), %rbx      # 0x10103
leaq 0x667b(%rip), %r15      # 0x10124
testq %rax, %rax
je 0x9ae5
leaq 0x6659(%rip), %rdx      # 0x1010e
leaq 0x665d(%rip), %rcx      # 0x10119
movq %rdx, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
movq %rax, %rdi
callq 0x2be9
jmp 0x9afd
leaq 0x769b(%rip), %rax      # 0x11172
movq %rax, 0x10(%rsp)
leaq 0x763b(%rip), %rax      # 0x1111e
jmp 0x9af8
leaq 0x6622(%rip), %rax      # 0x1010e
movq %rax, 0x10(%rsp)
leaq 0x6621(%rip), %rax      # 0x10119
movq %rax, 0x18(%rsp)
movq 0x8(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x268c
movq (%r12), %rsi
movq 0x20(%rsp), %rbx
movq (%rbx), %rdx
movq %rax, %rdi
callq 0x96fd
movq %r14, %rdi
movq %r15, %rsi
callq 0x268c
movq (%r12), %rsi
movq (%rbx), %rdx
movq %rax, %rdi
callq 0x96fd
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %r15
callq 0x268c
movq (%r12), %rsi
movq (%rbx), %rdx
movq %rax, %rdi
callq 0x96fd
movq %r14, %rdi
movq 0x18(%rsp), %rsi
callq 0x268c
movq (%r12), %rsi
movq (%rbx), %rdx
movq %rax, %rdi
callq 0x96fd
movq (%rbx), %rdi
leaq 0x655c(%rip), %rsi      # 0x100dc
xorl %edx, %edx
callq 0x26a2
movq (%r12), %rsi
movq %rax, %rdi
pushq $0x1
popq %rdx
callq 0x26a2
andb $-0x41, 0x30(%rax)
leaq 0x75dc(%rip), %r12      # 0x1117d
incq %r13
jmp 0x987b
addq $0x8, %r15
jmp 0x9850
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq