// File: /workspace/github_cpp_makefile_star2_O2/corecodec[P]coremake/coremake.c
// Function: preprocess_stdafx_includes
void preprocess_stdafx_includes(item* p,int lib)
{
	item** child;
	if (!p) return;
	for (child=p->child;child!=p->childend;++child)
	{
		size_t i;
		int prj = 0, host = 0;
        char gen_path[MAX_PATH];
		item* plugin = getvalue(item_find(*child,"plugin"));
		item* no_stdafx = getvalue(item_find(*child,"no_stdafx"));
		item* no_project = getvalue(item_find(*child,"no_project"));
		item* cls = item_get(*child,"class",0);
		item* reg = item_get(*child,"reg",0);
		item* path = getvalue(item_get(*child,"path",0));
        item *include = item_get(*child,"include",0);

        if (!path)
            continue;

        strcpy(gen_path,path->value);
        strip_path_abs(gen_path,path->flags);
        getabspath(gen_path,FLAG_PATH_GENERATED,"",FLAG_PATH_GENERATED);

        if (!plugin)
		    for (i=0;i<item_childcount(*child);++i)
			    if (item_childcount((*child)->child[i]) && is_project_data((*child)->child[i]))
			    {
				    prj = 1;
                    break;
                }

		for (i=0;i<item_childcount(*child);++i)
			if (item_childcount((*child)->child[i]) && is_host_data((*child)->child[i]))
			{
				host = 1;
				break;
			}

		if (prj && !no_project)
		{
            /* add _project.h */
            item *src;
			char file[MAX_PATH];
            item *add_inc;

            sprintf(file,"%s%s_project.h",gen_path,(*child)->value);
			src = item_get(item_get(*child,"header",0),file,1);
            set_path_type(src,FLAG_PATH_GENERATED);

            add_inc = item_get(include,gen_path,0);
            set_path_type(add_inc,FLAG_PATH_GENERATED);
            add_inc->flags |= FLAG_ATTRIB;
		}

		if (host && !lib)
		{
            /* add _host.h */
            item *src;
			char file[MAX_PATH];
            item *add_inc;

            sprintf(file,"%s%s_host.h",gen_path,(*child)->value);
			src = item_get(item_get(*child,"header",0),file,1);
            set_path_type(src,FLAG_PATH_GENERATED);

            add_inc = item_get(include,gen_path,0);
            set_path_type(add_inc,FLAG_PATH_GENERATED);
            add_inc->flags |= FLAG_ATTRIB;
        }

		if ((item_childcount(reg) || item_childcount(cls) || prj) && !lib && !no_stdafx)
		{
			/* add _stdafx.c */
            item *src;
			char file[MAX_PATH];
            item *add_inc;

            src = item_get(item_get(*child,"expinclude",0),gen_path,1);
            set_path_type(src,FLAG_PATH_GENERATED);
			sprintf(file,"%s%s_stdafx.c",gen_path,(*child)->value);
			src = item_get(item_get(*child,"source",0),file,1);
            set_path_type(src,FLAG_PATH_GENERATED);
            src = item_get(src,"NO_PCH",1);
            item_get(src,".",1);

            add_inc = item_get(include,gen_path,0);
            set_path_type(add_inc,FLAG_PATH_GENERATED);
            add_inc->flags |= FLAG_ATTRIB;

			/* add _stdafx.h */
			sprintf(file,"%s%s_stdafx.h",gen_path,(*child)->value);
			src = item_get(item_get(*child,"header",0),file,1);
            set_path_type(src,FLAG_PATH_GENERATED);
        }
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x838, %rsp            # imm = 0x838
movl %esi, 0x4(%rsp)
movq %rdi, 0x8(%rsp)
testq %rdi, %rdi
je 0x6003
movq 0x8(%rsp), %rax
movq 0x18(%rax), %r15
movq 0x8(%rsp), %rax
cmpq 0x20(%rax), %r15
je 0x6003
movq (%r15), %rbx
movq %rbx, %rdi
leaq 0xa9bd(%rip), %rsi      # 0x105b7
callq 0x262e
movq %rax, %rdi
callq 0x270e
movq %rax, %r12
movq %rbx, %rdi
leaq 0xa9aa(%rip), %rsi      # 0x105be
callq 0x262e
movq %rax, %rdi
callq 0x270e
movq %rax, %r14
movq %rbx, %rdi
leaq 0xa99a(%rip), %rsi      # 0x105c8
callq 0x262e
movq %rax, %rdi
callq 0x270e
movq %rax, %r13
movq %rbx, %rdi
leaq 0xa81b(%rip), %rsi      # 0x10463
xorl %edx, %edx
callq 0x26a2
movq %rax, 0x20(%rsp)
movq (%r15), %rdi
leaq 0xa801(%rip), %rsi      # 0x1045f
xorl %edx, %edx
callq 0x26a2
movq %rax, 0x28(%rsp)
movq (%r15), %rdi
leaq 0xb3fc(%rip), %rsi      # 0x11070
xorl %edx, %edx
callq 0x26a2
movq %rax, %rdi
callq 0x270e
movq %rax, %rbp
movq (%r15), %rdi
leaq 0xa5fb(%rip), %rsi      # 0x1028b
xorl %edx, %edx
callq 0x26a2
testq %rbp, %rbp
je 0x5ffa
movq %rax, %rbx
movq %r14, 0x10(%rsp)
movq (%rbp), %rsi
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x20b0
movl 0x30(%rbp), %esi
movq %r14, %rdi
callq 0x3f6b
movq %r14, %rdi
pushq $0x2
popq %rcx
movl %ecx, %esi
leaq 0xab91(%rip), %rdx      # 0x10864
callq 0x6015
movb $0x1, %bpl
testq %r12, %r12
je 0x5e83
xorl %r12d, %r12d
movq (%r15), %rax
testq %rax, %rax
je 0x5cfd
movq 0x20(%rax), %r14
subq 0x18(%rax), %r14
sarq $0x3, %r14
jmp 0x5d00
xorl %r14d, %r14d
cmpq %r14, %r12
jae 0x5d2a
movq 0x18(%rax), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x5d25
movq 0x20(%rdi), %rax
cmpq 0x18(%rdi), %rax
je 0x5d25
callq 0x5b28
testl %eax, %eax
jne 0x5d2a
incq %r12
jmp 0x5ce7
testq %r13, %r13
setne %al
orb %bpl, %al
jne 0x5db1
movq (%r15), %rax
movq (%rax), %rcx
movq %rbx, 0x18(%rsp)
leaq 0x430(%rsp), %rbx
movq %rbx, %rdi
leaq 0xa881(%rip), %rsi      # 0x105d3
leaq 0x30(%rsp), %r13
movq %r13, %rdx
xorl %eax, %eax
callq 0x2310
movq (%r15), %rdi
leaq 0xa601(%rip), %rsi      # 0x1036c
xorl %edx, %edx
callq 0x26a2
movq %rax, %rdi
movq %rbx, %rsi
movq 0x18(%rsp), %rbx
pushq $0x1
popq %rdx
callq 0x26a2
movl 0x30(%rax), %ecx
andl $-0x10, %ecx
orl $0x2, %ecx
movl %ecx, 0x30(%rax)
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x26a2
movl 0x30(%rax), %ecx
movl $0xfffffef0, %edx       # imm = 0xFFFFFEF0
andl %edx, %ecx
orl $0x102, %ecx            # imm = 0x102
movl %ecx, 0x30(%rax)
cmpl $0x0, 0x4(%rsp)
jne 0x5e35
cmpq %r14, %r12
jae 0x5e35
movq (%r15), %rax
movq (%rax), %rcx
movq %rbx, %r12
leaq 0x430(%rsp), %rbx
movq %rbx, %rdi
leaq 0xa80a(%rip), %rsi      # 0x105e2
leaq 0x30(%rsp), %r14
movq %r14, %rdx
xorl %eax, %eax
callq 0x2310
movq (%r15), %rdi
leaq 0xa57b(%rip), %rsi      # 0x1036c
xorl %edx, %edx
callq 0x26a2
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rbx
pushq $0x1
popq %rdx
callq 0x26a2
movl 0x30(%rax), %ecx
andl $-0x10, %ecx
orl $0x2, %ecx
movl %ecx, 0x30(%rax)
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x26a2
movl 0x30(%rax), %ecx
movl $0xfffffef0, %edx       # imm = 0xFFFFFEF0
andl %edx, %ecx
orl $0x102, %ecx            # imm = 0x102
movl %ecx, 0x30(%rax)
movq 0x28(%rsp), %rcx
testq %rcx, %rcx
je 0x5e67
movq 0x20(%rcx), %rax
cmpq 0x18(%rcx), %rax
je 0x5e67
cmpl $0x0, 0x4(%rsp)
movq 0x10(%rsp), %rax
jne 0x5ffa
testq %rax, %rax
je 0x5ef3
jmp 0x5ffa
movq 0x20(%rsp), %rdx
testq %rdx, %rdx
movq 0x10(%rsp), %rcx
je 0x5ed4
movq 0x20(%rdx), %rax
cmpq 0x18(%rdx), %rax
sete %al
jmp 0x5ed6
xorl %r14d, %r14d
movq (%r15), %rax
testq %rax, %rax
je 0x5e9c
movq 0x20(%rax), %rcx
subq 0x18(%rax), %rcx
sarq $0x3, %rcx
jmp 0x5e9e
xorl %ecx, %ecx
cmpq %rcx, %r14
setae %bpl
jae 0x5ce4
movq 0x18(%rax), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x5ecf
movq 0x20(%rdi), %rax
cmpq 0x18(%rdi), %rax
je 0x5ecf
callq 0x5aed
testl %eax, %eax
jne 0x5ce4
incq %r14
jmp 0x5e86
movb $0x1, %al
cmpl $0x0, 0x4(%rsp)
jne 0x5ffa
andb %al, %bpl
jne 0x5ffa
testq %rcx, %rcx
jne 0x5ffa
movq (%r15), %rdi
leaq 0xa414(%rip), %rsi      # 0x10311
xorl %edx, %edx
callq 0x26a2
movq %rax, %rdi
movq %rbx, %r12
leaq 0x30(%rsp), %rbx
movq %rbx, %rsi
pushq $0x1
popq %rbp
movl %ebp, %edx
callq 0x26a2
movl 0x30(%rax), %ecx
andl $-0x10, %ecx
orl $0x2, %ecx
movl %ecx, 0x30(%rax)
movq (%r15), %rax
movq (%rax), %rcx
leaq 0x430(%rsp), %r14
movq %r14, %rdi
leaq 0xa6ae(%rip), %rsi      # 0x105ee
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2310
movq (%r15), %rdi
leaq 0xa74b(%rip), %rsi      # 0x1069f
xorl %edx, %edx
callq 0x26a2
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x26a2
movl 0x30(%rax), %ecx
andl $-0x10, %ecx
orl $0x2, %ecx
movl %ecx, 0x30(%rax)
movq %rax, %rdi
leaq 0xa67e(%rip), %rsi      # 0x105fc
movl %ebp, %edx
callq 0x26a2
movq %rax, %rdi
leaq 0xa202(%rip), %rsi      # 0x10191
movl %ebp, %edx
callq 0x26a2
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x26a2
movl 0x30(%rax), %ecx
movl $0xfffffef0, %edx       # imm = 0xFFFFFEF0
andl %edx, %ecx
orl $0x102, %ecx            # imm = 0x102
movl %ecx, 0x30(%rax)
movq (%r15), %rax
movq (%rax), %rcx
movq %r14, %rdi
leaq 0xa63d(%rip), %rsi      # 0x10603
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2310
movq (%r15), %rdi
leaq 0xa392(%rip), %rsi      # 0x1036c
xorl %edx, %edx
callq 0x26a2
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x26a2
movl 0x30(%rax), %ecx
andl $-0x10, %ecx
orl $0x2, %ecx
movl %ecx, 0x30(%rax)
addq $0x8, %r15
jmp 0x5bde
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq