// File: /workspace/github_cpp_makefile_star2_O3/corecodec[P]coremake/coremake.c
// Function: preprocess_uselib
void preprocess_uselib(item* p,item* ref,item* uselib)
{
	item** child;
	if (!p) return;
	for (child=p->child;child!=p->childend;++child)
        if (!((*child)->flags & FLAG_REMOVED))
	    {
		    size_t i;
		    item* use = item_get(*child,"use",0);
		    for (i=0;i<item_childcount(use);++i)
		    {
			    if (stricmp(use->child[i]->value,ref->value)==0)
			    {
                    size_t j;
		            item* src = item_get(ref,"source",0);
		            for (j=0;j<item_childcount(src);++j)
		            {
                        char path[MAX_PATH];
                        strcpy(path,src->child[j]->value);
                        truncfileext(path);
                        if (stricmp(path,"rc")==0)
    			            item_merge(item_get(item_get(*child,"source",0),src->child[j]->value,1),src->child[j],use->child[i]);

			            item_merge(item_get(*child,"reg",0),item_find(src->child[j],"reg"),use->child[i]);
			            item_merge(item_get(*child,"class",0),item_find(src->child[j],"class"),use->child[i]);
		            }

	                item_merge(item_get(*child,"reg",0),item_find(ref,"reg"),use->child[i]);
	                item_merge(item_get(*child,"class",0),item_find(ref,"class"),use->child[i]);
	                item_merge(item_get(*child,"libs",0),item_find(ref,"libs"),use->child[i]);
	                item_merge(item_get(*child,"syslibs",0),item_find(ref,"syslibs"),use->child[i]);
	                item_merge(item_get(*child,"install",0),item_find(ref,"install"),use->child[i]);

	                // add to "include"
	                item_merge(item_get(*child,"include",0),item_find(ref,"expinclude"),use->child[i]);
	                // also merge "subinclude"
	                item_merge(item_get(*child,"subinclude",0),item_find(ref,"subinclude"),use->child[i]);
	                // also merge "sysinclude"
	                item_merge(item_get(*child,"sysinclude",0),item_find(ref,"sysinclude"),use->child[i]);
			        // also merge "libinclude"
			        item_merge(item_get(*child,"libinclude",0),item_find(ref,"libinclude"),use->child[i]);
			        // also merge "uselib"
			        item_merge(item_get(*child,"uselib",0),item_find(ref,"uselib"),use->child[i]);
			        // also merge "rpath"
			        item_merge(item_get(*child,"rpath",0),item_find(ref,"rpath"),use->child[i]);
	                // add to "define"
	                item_merge(item_get(*child,"define",0),item_find(ref,"expdefine"),use->child[i]);

				    item_get(item_get(*child,"uselib",1),uselib->value,1);
				    item_delete(use->child[i]);
				    --i;
			    }
		    }
	    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x438, %rsp            # imm = 0x438
movq %rdx, 0x28(%rsp)
movq %rdi, 0x10(%rsp)
testq %rdi, %rdi
je 0xb53b
movq 0x10(%rsp), %rax
movq 0x18(%rax), %r15
movq 0x20(%rax), %rax
cmpq %rax, %r15
je 0xb53b
movq %rsi, %r12
movq %rsi, 0x20(%rsp)
movq (%r15), %rdi
testb $0x40, 0x30(%rdi)
jne 0xb52e
leaq 0x6036(%rip), %rsi      # 0x110dc
xorl %edx, %edx
callq 0x270b
movq %rax, %r13
xorl %ebx, %ebx
movq %r15, 0x18(%rsp)
movq %rax, 0x8(%rsp)
testq %r13, %r13
je 0xb0cf
movq 0x20(%r13), %rax
subq 0x18(%r13), %rax
sarq $0x3, %rax
jmp 0xb0d1
xorl %eax, %eax
cmpq %rax, %rbx
jae 0xb525
movq 0x18(%r13), %rax
movq (%rax,%rbx,8), %rax
movq (%rax), %rdi
movq (%r12), %rsi
callq 0x2070
testl %eax, %eax
jne 0xb51d
movq %r12, %rdi
leaq 0x659f(%rip), %rsi      # 0x1169f
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
xorl %ebp, %ebp
testq %r14, %r14
je 0xb11f
movq 0x20(%r14), %rax
subq 0x18(%r14), %rax
sarq $0x3, %rax
jmp 0xb121
xorl %eax, %eax
cmpq %rax, %rbp
jae 0xb224
movq 0x18(%r14), %rax
movq (%rax,%rbp,8), %rax
movq (%rax), %rsi
leaq 0x30(%rsp), %r12
movq %r12, %rdi
callq 0x20b0
movq %r12, %rdi
callq 0x3cba
movq %r12, %rdi
leaq 0x6d78(%rip), %rsi      # 0x11ecc
callq 0x2070
testl %eax, %eax
jne 0xb19e
movq (%r15), %rdi
leaq 0x6538(%rip), %rsi      # 0x1169f
xorl %edx, %edx
callq 0x270b
movq 0x18(%r14), %rcx
movq (%rcx,%rbp,8), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
movl $0x1, %edx
callq 0x270b
movq 0x18(%r14), %rcx
movq (%rcx,%rbp,8), %rsi
movq 0x18(%r13), %rcx
movq (%rcx,%rbx,8), %rdx
movq %rax, %rdi
callq 0x334a
movq (%r15), %rdi
leaq 0x62b7(%rip), %r15      # 0x1145f
movq %r15, %rsi
xorl %edx, %edx
callq 0x270b
movq %rax, %r12
movq 0x18(%r14), %rax
movq (%rax,%rbp,8), %rdi
movq %r15, %rsi
movq 0x18(%rsp), %r15
callq 0x2694
movq 0x18(%r13), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r12, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
leaq 0x627c(%rip), %r13      # 0x11463
movq %r13, %rsi
xorl %edx, %edx
callq 0x270b
movq %rax, %r12
movq 0x18(%r14), %rax
movq (%rax,%rbp,8), %rdi
movq %r13, %rsi
movq 0x8(%rsp), %r13
callq 0x2694
movq 0x18(%r13), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r12, %rdi
movq %rax, %rsi
callq 0x334a
incq %rbp
jmp 0xb10c
movq (%r15), %rdi
leaq 0x6231(%rip), %r15      # 0x1145f
movq %r15, %rsi
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
movq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq 0x18(%rsp), %r15
callq 0x2694
movq 0x18(%r13), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
leaq 0x61f6(%rip), %r13      # 0x11463
movq %r13, %rsi
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0x2694
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
leaq 0x636d(%rip), %r13      # 0x11614
movq %r13, %rsi
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0x2694
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
leaq 0x6330(%rip), %r13      # 0x11611
movq %r13, %rsi
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0x2694
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
leaq 0x6094(%rip), %r13      # 0x113af
movq %r13, %rsi
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0x2694
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
leaq 0x5f36(%rip), %rsi      # 0x1128b
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
movq %r12, %rdi
leaq 0x5fa8(%rip), %rsi      # 0x11311
callq 0x2694
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
leaq 0x5f8c(%rip), %r13      # 0x1131c
movq %r13, %rsi
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0x2694
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
leaq 0x5f5d(%rip), %r13      # 0x11327
movq %r13, %rsi
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0x2694
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
leaq 0x5f39(%rip), %r13      # 0x1133d
movq %r13, %rsi
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0x2694
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
leaq 0x5e8a(%rip), %r13      # 0x112c8
movq %r13, %rsi
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0x2694
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
leaq 0x60f4(%rip), %rbp      # 0x1156c
movq %rbp, %rsi
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2694
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
leaq 0x6a0f(%rip), %rsi      # 0x11ec1
xorl %edx, %edx
callq 0x270b
movq %rax, %r14
movq %r12, %rdi
leaq 0x69f8(%rip), %rsi      # 0x11ebe
callq 0x2694
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq (%rcx,%rbx,8), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x334a
movq (%r15), %rdi
movq %r13, %rsi
movq 0x8(%rsp), %r13
movl $0x1, %edx
callq 0x270b
movq 0x28(%rsp), %rcx
movq (%rcx), %rsi
movq %rax, %rdi
movl $0x1, %edx
callq 0x270b
movq 0x18(%r13), %rax
movq (%rax,%rbx,8), %rdi
callq 0x2d5b
decq %rbx
incq %rbx
jmp 0xb0bc
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
addq $0x8, %r15
cmpq %rax, %r15
jne 0xb092
addq $0x438, %rsp            # imm = 0x438
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq