// File: /workspace/github_cpp_makefile_star2_O3/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 0xae26
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 0xae18
movq (%rbp), %rdi
leaq 0x669e(%rip), %rsi      # 0x110eb
xorl %edx, %edx
callq 0x270b
movq %rax, %r13
xorl %r15d, %r15d
testq %r13, %r13
je 0xaa6d
movq 0x20(%r13), %rax
subq 0x18(%r13), %rax
sarq $0x3, %rax
jmp 0xaa6f
xorl %eax, %eax
cmpq %rax, %r15
jae 0xae0f
movq 0x18(%r13), %rax
movq (%rax,%r15,8), %rdi
callq 0x281b
testq %rax, %rax
je 0xae07
movq %rax, %r14
movq 0x10(%rax), %rax
movq (%rax), %r12
movq %r12, %rdi
leaq 0x76db(%rip), %rsi      # 0x1217d
callq 0x2070
testl %eax, %eax
jne 0xac33
movq 0x18(%r13), %rax
movq (%rax,%r15,8), %rax
testb $0x40, 0x30(%rax)
jne 0xac33
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xaac4
leaq 0x76c8(%rip), %rsi      # 0x1219f
xorl %edx, %edx
callq 0x270b
movq (%r14), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x270b
movq %rax, %r12
movq %r14, %rdi
leaq 0x6b7f(%rip), %rsi      # 0x11677
callq 0x2694
movq %rax, %rdi
callq 0x2d5b
movq %r14, %rdi
leaq 0x6b79(%rip), %rsi      # 0x11688
callq 0x2694
movq %rax, %rdi
callq 0x2d5b
movq 0x18(%r13), %rax
movq (%rax,%r15,8), %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x334a
movq %r14, %rdi
callq 0x2d5b
movq %r12, %rdi
leaq 0x659b(%rip), %rsi      # 0x110dc
xorl %edx, %edx
callq 0x270b
movq (%rbp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x2694
testq %rax, %rax
je 0xab64
movq %rax, %rdi
callq 0x2d5b
movq %r12, %rdi
leaq 0x6586(%rip), %rsi      # 0x110f4
xorl %edx, %edx
callq 0x270b
movq (%rbp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x2694
testq %rax, %rax
je 0xab91
movq %rax, %rdi
callq 0x2d5b
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xab94
leaq 0x75d6(%rip), %rsi      # 0x1217d
xorl %edx, %edx
callq 0x270b
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa8f2
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xabc1
leaq 0x75cb(%rip), %rsi      # 0x1219f
xorl %edx, %edx
callq 0x270b
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa8f2
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xabee
leaq 0x7571(%rip), %rsi      # 0x12172
xorl %edx, %edx
callq 0x270b
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa8f2
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xac1b
leaq 0x74f0(%rip), %rsi      # 0x1211e
jmp 0xadc9
movq %r12, %rdi
leaq 0x64c6(%rip), %rsi      # 0x11103
callq 0x2070
testl %eax, %eax
jne 0xae07
movq 0x18(%r13), %rax
movq (%rax,%r15,8), %rax
testb $0x40, 0x30(%rax)
jne 0xae07
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xac5f
leaq 0x64b2(%rip), %rsi      # 0x11124
xorl %edx, %edx
callq 0x270b
movq (%r14), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x270b
movq %rax, %r12
movq %r14, %rdi
leaq 0x69e4(%rip), %rsi      # 0x11677
callq 0x2694
movq %rax, %rdi
callq 0x2d5b
movq %r14, %rdi
leaq 0x69de(%rip), %rsi      # 0x11688
callq 0x2694
movq %rax, %rdi
callq 0x2d5b
movq 0x18(%r13), %rax
movq (%rax,%r15,8), %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0x334a
movq %r14, %rdi
callq 0x2d5b
movq %r12, %rdi
leaq 0x6400(%rip), %rsi      # 0x110dc
xorl %edx, %edx
callq 0x270b
movq (%rbp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x2694
testq %rax, %rax
je 0xacff
movq %rax, %rdi
callq 0x2d5b
movq %r12, %rdi
leaq 0x63eb(%rip), %rsi      # 0x110f4
xorl %edx, %edx
callq 0x270b
movq (%rbp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x2694
testq %rax, %rax
je 0xad2c
movq %rax, %rdi
callq 0x2d5b
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xad2f
leaq 0x63c1(%rip), %rsi      # 0x11103
xorl %edx, %edx
callq 0x270b
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa8f2
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xad5c
leaq 0x63b5(%rip), %rsi      # 0x11124
xorl %edx, %edx
callq 0x270b
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa8f2
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xad89
leaq 0x6372(%rip), %rsi      # 0x1110e
xorl %edx, %edx
callq 0x270b
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa8f2
movq %rbx, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0xadb6
leaq 0x6350(%rip), %rsi      # 0x11119
xorl %edx, %edx
callq 0x270b
movq (%r12), %rsi
movq (%rbp), %rdx
movq %rax, %rdi
callq 0xa8f2
movq (%rbp), %rdi
leaq 0x62f1(%rip), %rsi      # 0x110dc
xorl %edx, %edx
callq 0x270b
movq (%r12), %rsi
movq %rax, %rdi
movl $0x1, %edx
callq 0x270b
andb $-0x41, 0x30(%rax)
incq %r15
jmp 0xaa5a
addq $0x8, %rbp
jmp 0xaa38
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq