// File: /workspace/github_cpp_makefile_star2_O1/corecodec[P]coremake/coremake.c
// Function: load_item
int load_item(item* p,reader* file,int sub,itemcond* cond0)
{
	int result=0;
	item *i,*j=NULL;
    while (!reader_eof(file))
	{
		if (reader_istoken(file,"#include"))
		{
			if (reader_istoken(file,"*/*.proj"))
			{
				char path[MAX_PATH];
				DIR* dir;
				path[0] = 0;
				strins(path,file->filename,getfilename(file->filename));
				delendpath(path);
				dir = opendir(path[0]?path:".");
				if (dir)
				{
					struct dirent* entry;
                    struct stat entrystats;
					addendpath(path);
					while ((entry = readdir(dir)) != NULL)
					{
						sprintf(file->token,"%s%s",path,entry->d_name);
                        stat(file->token,&entrystats);
						if ((entrystats.st_mode & S_IFDIR) && entry->d_name[0]!='.')
						{
    						sprintf(file->token,"%s%s/%s.proj",path,entry->d_name,entry->d_name);
                            if (!load_file(p,file->token,FLAG_PATH_SOURCE,cond0) && strrchr(entry->d_name,'-'))
                            {
                                // if it's a UNIX library name, try without the version
						        char *empty = strrchr(file->token,'-');
                                *empty = 0;
                                strcat(file->token,".proj");
                                load_file(p,file->token,FLAG_PATH_SOURCE,cond0);
                            }
						}
					}
					closedir(dir);
				}
			}
			else
			{
                reader_token(file);
				reader_filename(file,0);
				load_file(p,file->token,FLAG_PATH_SOURCE,cond0);
			}
		}
		else
		if (reader_istoken(file,"if"))
		{
            itemcond* condextra = NULL;
			int mode;
			do
			{
				itemcond* cond = load_cond(p,file,1);
                itemcond* cond1 = itemcond_and(itemcond_and(itemcond_dup(cond),cond0),condextra);
				mode = load_item(p,file,2,cond1);
				itemcond_delete(cond1);
				if (mode==1)
				{
					itemcond* not1 = (itemcond*)itemcond_new(COND_NOT,NULL);
					not1->a = itemcond_dup(cond);
                    not1 = itemcond_and(itemcond_and(not1,cond0),condextra);
					load_item(p,file,3,not1);
	    			itemcond_delete(not1);
				}
                else if (mode==2)
                {
					itemcond* not1 = itemcond_new(COND_NOT,NULL);
					not1->a = itemcond_dup(cond);
                    condextra = itemcond_and(condextra,not1);
	    			itemcond_delete(not1);
                }
				itemcond_delete(cond);
			}
			while (mode==2);
            itemcond_delete(condextra);
		}
		else
		if (reader_istoken(file,"else"))
		{
			if (sub != 2)
				syntax(file);
			result = 1;
			break;
		}
		else
		if (reader_istoken(file,";"))
        {
            //nothing to do
        }
        else
		if (reader_istoken(file,"elif"))
		{
			if (sub != 2)
				syntax(file);
			result = 2;
			break;
		}
		else
		if (reader_istoken(file,"endif"))
		{
			if (sub != 2 && sub != 3)
				syntax(file);
			break;
		}
		else
		if (reader_istoken(file,"}"))
		{
			if (sub != 1)
				syntax(file);
			break;
		}
		else
		{
			int config = 0;
			int need_path;
			int filename;
            int uselib;
            int deepercond;
            int attrib;
            int generated_dir;
            int coremake_dir;
            int system_dir;
			itemcond* cond;
			reader_name(file);

            deepercond = !p->parent && stricmp(file->token,"project")==0;

			need_path = !p->parent && (
				   stricmp(file->token,"con")==0 ||
				   stricmp(file->token,"exe")==0 ||
				   stricmp(file->token,"group")==0 ||
				   stricmp(file->token,"lib")==0 ||
				   stricmp(file->token,"dll")==0 ||
				   stricmp(file->token,"lib_csharp")==0 ||
				   stricmp(file->token,"dll_csharp")==0 ||
				   stricmp(file->token,"exe_csharp")==0 ||
				   stricmp(file->token,"con_csharp")==0 ||
				   stricmp(file->token,"exe_android")==0 ||
				   stricmp(file->token,"dll_android")==0 ||
			       stricmp(file->token,"workspace")==0);

            uselib = stricmp(file->token,"uselib")==0 || stricmp(file->token,"builtlib")==0;

			filename = stricmp(file->token,"config_file")==0 ||
					   stricmp(file->token,"config_include")==0 ||
					   stricmp(file->token,"config_cleaner")==0 ||
					   stricmp(file->token,"platform_files")==0 ||
					   stricmp(file->token,"expinclude")==0 ||
					   stricmp(file->token,"subinclude")==0 ||
					   stricmp(file->token,"sysinclude")==0 ||
					   stricmp(file->token,"include")==0 ||
					   stricmp(file->token,"include_debug")==0 ||
					   stricmp(file->token,"include_release")==0 ||
					   stricmp(file->token,"os_include")==0 ||
					   stricmp(file->token,"libinclude")==0 ||
					   stricmp(file->token,"libinclude_debug")==0 ||
					   stricmp(file->token,"libinclude_release")==0 ||
					   stricmp(file->token,"def")==0 ||
					   stricmp(file->token,"icon")==0 ||
					   stricmp(file->token,"header")==0 ||
					   stricmp(file->token,"header_qt4")==0 ||
					   stricmp(file->token,"ui_form_qt4")==0 ||
					   stricmp(file->token,"resource_qt4")==0 ||
					   stricmp(file->token,"install_zip")==0 ||
					   stricmp(file->token,"install_cab")==0 ||
					   stricmp(file->token,"install")==0 ||
					   stricmp(file->token,"android_value")==0 ||
					   stricmp(file->token,"nsi")==0 ||
					   stricmp(file->token,"pmdoc")==0 ||
					   stricmp(file->token,"osx_icon")==0 ||
					   stricmp(file->token,"source_m68k")==0 ||
					   stricmp(file->token,"export_svn")==0 ||
					   stricmp(file->token,"source")==0 ||
					   stricmp(file->token, "sourcedir") == 0 ||
					   stricmp(file->token,"compile")==0 ||
					   stricmp(file->token,"linkfile")==0 ||
					   stricmp(file->token,"crt0")==0 ||
					   stricmp(file->token,"symbian_cert")==0 ||
					   stricmp(file->token,"symbian_key")==0 ||
					   stricmp(file->token,"doxygen")==0 ||
                       stricmp(file->token,"project_svn_revision")==0 || /* TODO really ? */
                       stricmp(file->token,"project_help")==0;

            generated_dir = stricmp(file->token,"config_file")==0 ||
                            stricmp(file->token,"config_include")==0;

            coremake_dir = stricmp(file->token,"platform_files")==0;

            system_dir = stricmp(file->token,"os_include")==0;

            attrib = filename ||
					   stricmp(file->token,"register_cab")==0 ||
                       stricmp(file->token,"reg")==0 ||
					   stricmp(file->token,"class")==0; // we need this because priority would mess up conditions

			if (stricmp(file->token,"config")==0)
			{
				config = 1;
				j = getconfig(p);
			}
			else
				j = item_get(p,file->token,0);

			cond = load_cond(p,file,0);
			cond = itemcond_and(cond,cond0);

			if (cond && config)
			{
				item* v;
				for (v=p;v;v=v->parent)
					cond = itemcond_and(cond,v->cond);
			}

			if (reader_istoken(file,"}"))
			{
				if (sub != 1)
					syntax(file);
				item_get(j,"1",1);
				break;
			}

			if (reader_istoken(file,",") || reader_istoken(file,";"))
			{
				item_get(j,"1",1);
			}
			else
			if (reader_istoken(file,"{"))
			{
				if (config)
					syntax(file);
				load_item(j,file,1,cond);
			}
			else
			{
				do
				{
                    int exists;
                    int is_abs=0;

					reader_token(file);
                    if (filename)
                    {
                        int file_flags = generated_dir?FLAG_PATH_GENERATED:(coremake_dir?FLAG_PATH_COREMAKE:(system_dir?FLAG_PATH_SYSTEM:FLAG_PATH_SOURCE));
                        if (ispathabs(file->token))
                        {
                            is_abs = 1;
                            file_flags |= FLAG_PATH_SET_ABSOLUTE;
                        }
                        reader_filename(file,file_flags);
                    }

                    exists = item_find(j,file->token)!=NULL;
					i = item_get(j,file->token,0);
                    if (attrib)
                        i->flags |= FLAG_ATTRIB;
                    if (is_abs)
                        i->flags |= FLAG_PATH_SET_ABSOLUTE;

                    if (coremake_dir)
                        set_path_type(i,FLAG_PATH_COREMAKE);
                    else if (generated_dir)
                        set_path_type(i,FLAG_PATH_GENERATED);
                    else if (filename || need_path)
                        set_path_type(i,FLAG_PATH_SOURCE);
                    else
                        set_path_type(i,FLAG_PATH_NOT_PATH);

					if (need_path)
					{
						char path[MAX_PATH];
						item *v = item_get(i,"PATH",0);
                        item *j;

                        if (exists)
                        {
                            item* existing = getvalue(v);
                            printf("project already defined at %s!\n%s:%d\n%s\r\n",existing?existing->value:"?",file->filename,file->r.no,file->line);
	                        exit(1);
                        }

                        path[0]=0;
                        strins(path,file->filename,getfilename(file->filename));
                        strip_path_abs(path,file->r.filename_kind);
                        if (generated_dir)
                            strins(path,proj_root,NULL);
                        else if (coremake_dir)
                            strins(path,coremake_root,NULL);
                        else
                            strins(path,src_root,NULL);

						j = item_get(v,path,1);
                        if (generated_dir)
                            set_path_type(j,FLAG_PATH_GENERATED);
                        else if (coremake_dir)
                            set_path_type(j,FLAG_PATH_COREMAKE);
                        else
                            set_path_type(j,FLAG_PATH_SOURCE);

                        // pre-define some items
						item_get(i,"OUTPUT",0);
						item_get(i,"EXPINCLUDE",0);
						item_get(i,"SUBINCLUDE",0);
						item_get(i,"SYSINCLUDE",0);
						item_get(i,"LIBINCLUDE",0);
						item_get(i,"LIBINCLUDE_DEBUG",0);
						item_get(i,"LIBINCLUDE_RELEASE",0);
						item_get(i,"INCLUDE",0);
						item_get(i,"INCLUDE_DEBUG",0);
						item_get(i,"INCLUDE_RELEASE",0);
						item_get(i,"EXPDEFINE",0);
						item_get(i,"DEFINE",0);
						item_get(i,"LIBS",0);
						item_get(i,"LIBS_DEBUG",0);
						item_get(i,"LIBS_RELEASE",0);
						item_get(i,"SYSLIBS",0);
					}

                    if (!deepercond)
                    {
                        if (exists)
                            i->cond = itemcond_or(i->cond,cond);
                        else
                            i->cond = itemcond_dup(cond);
                    }

                    if (uselib)
                    {
                        int exists;
                        item *incs;
                        item* i;
                        char path[MAX_PATH];
                        path[0]=0;
                        strins(path,file->filename,getfilename(file->filename));
                        incs = item_get(p,"libinclude",0);
                        exists = item_find(incs,path)!=NULL;
                        i = item_get(incs,path,0);
                        i->flags = file->r.filename_kind;
                        if (exists)
                            i->cond = itemcond_or(i->cond,cond);
                        else
                            i->cond = itemcond_dup(cond);
                    }

					if (reader_istoken(file,":"))
					{
                        int pri;
                        reader_token(file);
                        if (sscanf(file->token,"%d",&pri)!=1)
                            syntax(file);

                        item_get(item_get(i,"priority",0),file->token,1);
                    }

					if (reader_istoken(file,"{"))
					{
						if (config)
							syntax(file);
                        load_item(i,file,1,deepercond?cond:NULL);
					}
				}
				while (reader_istoken(file,","));
			}

			itemcond_delete(cond);
		}
	}
	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x508, %rsp            # imm = 0x508
movq %rcx, 0x30(%rsp)
movl %edx, 0x10(%rsp)
movq %rsi, %rbx
movq %rdi, %r15
leaq 0xd861(%rip), %rbp      # 0x12288
testb $0x2, 0x11(%rbx)
jne 0x4a3d
movq %rbx, %rdi
callq 0x3784
testl %eax, %eax
je 0x5a16
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x39dc
movq %rbx, %rdi
testl %eax, %eax
je 0x4be9
leaq 0xd837(%rip), %rsi      # 0x12291
callq 0x39dc
testl %eax, %eax
je 0x5a39
movb $0x0, 0x70(%rsp)
movq 0x38(%rbx), %r14
movq %r14, %rdi
movl $0x2f, %esi
callq 0x2150
leaq 0x1(%rax), %rdx
testq %rax, %rax
cmoveq %r14, %rdx
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
movq %rdi, %r14
callq 0x35d1
cmpb $0x0, 0x70(%rsp)
je 0x4ab3
movq %r14, %rdi
callq 0x2120
cmpb $0x2f, 0x6f(%rsp,%rax)
jne 0x4ab3
movb $0x0, 0x6f(%rsp,%rax)
cmpb $0x0, 0x70(%rsp)
movq %r14, %rdi
leaq 0xe6e9(%rip), %rax      # 0x131ab
cmoveq %rax, %rdi
callq 0x2100
testq %rax, %rax
je 0x4a27
movq %rax, %r13
movq %r14, %rdi
callq 0x3df1
movq %r13, %rdi
callq 0x2250
testq %rax, %rax
je 0x4bdc
movq %rax, %r12
movq 0x30(%rbx), %rdi
addq $0x13, %r12
leaq 0xd798(%rip), %rsi      # 0x1229a
movq %r14, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x2320
movq 0x30(%rbx), %rdi
leaq 0x478(%rsp), %rsi
callq 0x2230
testb $0x40, 0x491(%rsp)
je 0x4bc8
cmpb $0x2e, (%r12)
je 0x4bc8
movq 0x30(%rbx), %rdi
leaq 0xd75b(%rip), %rsi      # 0x1229f
movq %r14, %rdx
movq %r12, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x2320
movq 0x30(%rbx), %rsi
movq %r15, %rdi
movl $0x1, %edx
movq 0x30(%rsp), %rcx
callq 0x5ac2
testl %eax, %eax
jne 0x4bc8
movq %r12, %rdi
movl $0x2d, %esi
callq 0x2150
testq %rax, %rax
je 0x4bc8
movq 0x30(%rbx), %rdi
movl $0x2d, %esi
callq 0x2150
movb $0x0, (%rax)
movq 0x30(%rbx), %r14
movq %r14, %rdi
callq 0x2120
movl $0x6f72702e, (%r14,%rax) # imm = 0x6F72702E
movw $0x6a, 0x4(%r14,%rax)
leaq 0x70(%rsp), %r14
movq 0x30(%rbx), %rsi
movq %r15, %rdi
movl $0x1, %edx
movq 0x30(%rsp), %rcx
callq 0x5ac2
movq %r13, %rdi
callq 0x2250
movq %rax, %r12
testq %rax, %rax
jne 0x4af3
movq %r13, %rdi
callq 0x21a0
jmp 0x4a27
leaq 0xd6c9(%rip), %rsi      # 0x122b9
callq 0x39dc
testl %eax, %eax
jne 0x58a9
movq %rbx, %rdi
leaq 0xd6a5(%rip), %rsi      # 0x122ac
callq 0x39dc
testl %eax, %eax
jne 0x59cd
movq %rbx, %rdi
leaq 0xe594(%rip), %rsi      # 0x131b2
callq 0x39dc
testl %eax, %eax
jne 0x4a27
movq %rbx, %rdi
leaq 0xd67c(%rip), %rsi      # 0x122b1
callq 0x39dc
testl %eax, %eax
jne 0x59fc
movq %rbx, %rdi
leaq 0xd66a(%rip), %rsi      # 0x122b6
callq 0x39dc
testl %eax, %eax
jne 0x5a0a
movq %rbx, %rdi
leaq 0xe2f0(%rip), %rsi      # 0x12f53
callq 0x39dc
testl %eax, %eax
jne 0x5a2a
movq %rbx, %rdi
callq 0x3b62
movq 0x10(%r15), %r14
testq %r14, %r14
je 0x4c8b
movl $0x0, 0x20(%rsp)
jmp 0x4ca4
movq 0x30(%rbx), %rdi
leaq 0xd933(%rip), %rsi      # 0x125c9
callq 0x2070
testl %eax, %eax
sete %al
movl %eax, 0x20(%rsp)
testq %r14, %r14
je 0x5073
movl $0x0, 0x14(%rsp)
movq 0x30(%rbx), %r13
movq %r13, %rdi
leaq 0xd603(%rip), %rsi      # 0x122c6
callq 0x2070
movb $0x1, %r12b
movb $0x1, 0xf(%rsp)
testl %eax, %eax
je 0x4cea
movq %r13, %rdi
leaq 0xd5ef(%rip), %rsi      # 0x122cd
callq 0x2070
testl %eax, %eax
sete 0xf(%rsp)
movq %r13, %rdi
leaq 0xd5e2(%rip), %rsi      # 0x122d6
callq 0x2070
movl %eax, %ebp
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd5d5(%rip), %rsi      # 0x122e2
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd5cd(%rip), %rsi      # 0x122f1
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd5c5(%rip), %rsi      # 0x12300
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd5bd(%rip), %rsi      # 0x1230f
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd5b1(%rip), %rsi      # 0x1231a
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd5a5(%rip), %rsi      # 0x12325
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd4f2(%rip), %rsi      # 0x12289
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd59b(%rip), %rsi      # 0x12349
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd595(%rip), %rsi      # 0x1235a
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd554(%rip), %rsi      # 0x12330
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd548(%rip), %rsi      # 0x1233b
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd53c(%rip), %rsi      # 0x12346
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd536(%rip), %rsi      # 0x12357
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xe494(%rip), %rsi      # 0x132cc
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd582(%rip), %rsi      # 0x123d1
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd504(%rip), %rsi      # 0x1236a
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd4f4(%rip), %rsi      # 0x12371
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd4e8(%rip), %rsi      # 0x1237c
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd4dd(%rip), %rsi      # 0x12388
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd4d3(%rip), %rsi      # 0x12395
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd4c8(%rip), %rsi      # 0x123a1
callq 0x2070
testl %eax, %eax
je 0x519a
movq %r13, %rdi
leaq 0xd4bd(%rip), %rsi      # 0x123ad
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd4ae(%rip), %rsi      # 0x123b5
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd4a5(%rip), %rsi      # 0x123c3
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd492(%rip), %rsi      # 0x123c7
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd481(%rip), %rsi      # 0x123cd
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd473(%rip), %rsi      # 0x123d6
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd468(%rip), %rsi      # 0x123e2
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd70c(%rip), %rsi      # 0x1269d
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd445(%rip), %rsi      # 0x123ed
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd438(%rip), %rsi      # 0x123f7
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd429(%rip), %rsi      # 0x123ff
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd41b(%rip), %rsi      # 0x12408
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd409(%rip), %rsi      # 0x1240d
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd3ff(%rip), %rsi      # 0x1241a
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd3f4(%rip), %rsi      # 0x12426
callq 0x2070
testl %eax, %eax
je 0x5197
movq %r13, %rdi
leaq 0xd3e5(%rip), %rsi      # 0x1242e
callq 0x2070
testl %eax, %eax
movb $0x1, %r12b
je 0x519a
movq %r13, %rdi
leaq 0xd3e0(%rip), %rsi      # 0x12443
callq 0x2070
testl %eax, %eax
sete %r12b
jmp 0x519a
movq 0x30(%rbx), %r12
movq %r12, %rdi
leaq 0xe0ef(%rip), %rsi      # 0x13170
callq 0x2070
movb $0x1, %cl
movl %ecx, 0x14(%rsp)
testl %eax, %eax
je 0x4cb5
movq %r12, %rdi
leaq 0xe07e(%rip), %rsi      # 0x1311c
callq 0x2070
testl %eax, %eax
je 0x4cb5
movq %r12, %rdi
leaq 0xd048(%rip), %rsi      # 0x120fd
callq 0x2070
testl %eax, %eax
je 0x4cb5
movq %r12, %rdi
leaq 0xe0d1(%rip), %rsi      # 0x1319d
callq 0x2070
testl %eax, %eax
je 0x4cb5
movq %r12, %rdi
leaq 0xe098(%rip), %rsi      # 0x1317b
callq 0x2070
testl %eax, %eax
je 0x4cb5
movq %r12, %rdi
leaq 0xd02a(%rip), %rsi      # 0x12124
callq 0x2070
testl %eax, %eax
je 0x4cb5
movq %r12, %rdi
leaq 0xcff2(%rip), %rsi      # 0x12103
callq 0x2070
testl %eax, %eax
je 0x4cb5
movq %r12, %rdi
leaq 0xcff1(%rip), %rsi      # 0x12119
callq 0x2070
testl %eax, %eax
je 0x4cb5
movq %r12, %rdi
leaq 0xcfcf(%rip), %rsi      # 0x1210e
callq 0x2070
testl %eax, %eax
je 0x4cb5
movq %r12, %rdi
leaq 0xcfd9(%rip), %rsi      # 0x1212f
callq 0x2070
testl %eax, %eax
je 0x4cb5
movq %r12, %rdi
leaq 0xcfce(%rip), %rsi      # 0x1213b
callq 0x2070
testl %eax, %eax
je 0x4cb5
movq %r12, %rdi
leaq 0xd138(%rip), %rsi      # 0x122bc
callq 0x2070
testl %eax, %eax
sete %al
movl %eax, 0x14(%rsp)
jmp 0x4cb5
movb $0x1, %r12b
movb $0x1, 0xe(%rsp)
movb $0x1, 0xc(%rsp)
testl %ebp, %ebp
je 0x51be
movq %r13, %rdi
leaq 0xd130(%rip), %rsi      # 0x122e2
callq 0x2070
testl %eax, %eax
sete 0xc(%rsp)
movq %r13, %rdi
leaq 0xd138(%rip), %rsi      # 0x12300
callq 0x2070
movl %eax, 0x24(%rsp)
movq %r13, %rdi
leaq 0xd155(%rip), %rsi      # 0x12330
callq 0x2070
testb %r12b, %r12b
movl %eax, 0x18(%rsp)
jne 0x5225
movq %r13, %rdi
leaq 0xd25d(%rip), %rsi      # 0x12450
callq 0x2070
testl %eax, %eax
je 0x5225
movq %r13, %rdi
leaq 0xd257(%rip), %rsi      # 0x1245d
callq 0x2070
testl %eax, %eax
je 0x5225
movq %r13, %rdi
leaq 0xd248(%rip), %rsi      # 0x12461
callq 0x2070
testl %eax, %eax
sete 0xe(%rsp)
movq %r13, %rdi
leaq 0xcea2(%rip), %rsi      # 0x120d1
callq 0x2070
movl %eax, %ebp
testl %eax, %eax
je 0x5242
movq %r15, %rdi
movq %r13, %rsi
jmp 0x5258
movq %r15, %rax
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x5245
leaq 0xce79(%rip), %rsi      # 0x120d1
xorl %edx, %edx
callq 0x2745
movq %rax, 0x28(%rsp)
movl %ebp, 0x3c(%rsp)
testl %ebp, %ebp
setne %bpl
testq %r15, %r15
sete %r14b
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4949
movq %rax, %rdi
movq 0x30(%rsp), %rsi
callq 0x3163
movq %rax, %r13
testq %rax, %rax
sete %al
orb %bpl, %r14b
orb %al, %r14b
je 0x52a9
leaq 0xcfe1(%rip), %rbp      # 0x12288
jmp 0x52cb
movq %r15, %r14
leaq 0xcfd5(%rip), %rbp      # 0x12288
movq 0x8(%r14), %rsi
movq %r13, %rdi
callq 0x3163
movq %rax, %r13
movq 0x10(%r14), %r14
testq %r14, %r14
jne 0x52b3
movq %rbx, %rdi
leaq 0xdc7e(%rip), %rsi      # 0x12f53
callq 0x39dc
movl %eax, %r14d
testl %eax, %eax
je 0x5304
cmpl $0x1, 0x10(%rsp)
jne 0x59d9
movq 0x28(%rsp), %rdi
leaq 0xd16f(%rip), %rsi      # 0x12467
movl $0x1, %edx
callq 0x2745
jmp 0x5348
movq %rbx, %rdi
leaq 0xd15b(%rip), %rsi      # 0x12469
callq 0x39dc
testl %eax, %eax
jne 0x532a
movq %rbx, %rdi
leaq 0xde91(%rip), %rsi      # 0x131b2
callq 0x39dc
testl %eax, %eax
je 0x5356
movq 0x28(%rsp), %rdi
leaq 0xd131(%rip), %rsi      # 0x12467
movl $0x1, %edx
callq 0x2745
movq %r13, %rdi
callq 0x2d76
testl %r14d, %r14d
je 0x4a27
jmp 0x5a16
movq %rbx, %rdi
leaq 0xd10b(%rip), %rsi      # 0x1246b
callq 0x39dc
testl %eax, %eax
je 0x538b
cmpl $0x0, 0x3c(%rsp)
je 0x5a31
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
movl $0x1, %edx
movq %r13, %rcx
callq 0x4a00
jmp 0x5340
xorl %eax, %eax
cmpl $0x0, 0x18(%rsp)
sete %al
xorl %ecx, %ecx
cmpl $0x0, 0x24(%rsp)
leal 0x1(%rax,%rax,2), %edx
movl $0x3, %eax
cmovel %eax, %edx
sete %cl
cmpb $0x0, 0xc(%rsp)
movl $0x2, %eax
cmovnel %eax, %edx
leal 0x1(%rcx,%rcx), %ecx
cmovnel %eax, %ecx
movl %ecx, 0x44(%rsp)
movq %rdx, 0x58(%rsp)
leal 0x10(%rdx), %eax
movl %eax, 0x48(%rsp)
movl %r12d, %eax
orb 0x14(%rsp), %al
cmpb $0x0, 0x20(%rsp)
movl $0x0, %ecx
cmovneq %r13, %rcx
movq %rcx, 0x60(%rsp)
movzbl %al, %eax
andl $0x1, %eax
movl %eax, 0x40(%rsp)
movb %r12b, 0xd(%rsp)
movl %r14d, 0x4c(%rsp)
movq %rbx, %rdi
callq 0x3b23
movb $0x1, %bpl
testb %r12b, %r12b
je 0x542d
movq 0x30(%rbx), %rdi
callq 0x4016
testl %eax, %eax
sete %bpl
movl 0x48(%rsp), %esi
cmovel 0x58(%rsp), %esi
movq %rbx, %rdi
callq 0x45b2
movq 0x30(%rbx), %r14
movq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x26b0
movq %rax, 0x50(%rsp)
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x2745
cmpb $0x0, 0xe(%rsp)
je 0x545e
orb $0x1, 0x31(%rax)
testb %bpl, %bpl
leaq 0x70(%rsp), %r14
jne 0x546c
orb $0x10, 0x30(%rax)
movl 0x30(%rax), %ecx
andl $-0x10, %ecx
cmpl $0x0, 0x24(%rsp)
leaq 0xce0a(%rip), %rbp      # 0x12288
movb 0xd(%rsp), %r12b
je 0x5491
cmpb $0x0, 0xc(%rsp)
je 0x5496
orl $0x2, %ecx
jmp 0x549a
orl $0x3, %ecx
jmp 0x549a
orl 0x40(%rsp), %ecx
movl %ecx, 0x30(%rax)
cmpb $0x0, 0x14(%rsp)
movq %rax, 0x18(%rsp)
je 0x5711
movq %rax, %rdi
leaq 0xcd4e(%rip), %rsi      # 0x12205
xorl %edx, %edx
callq 0x2745
cmpq $0x0, 0x50(%rsp)
jne 0x5a60
movq %rax, 0x68(%rsp)
movb $0x0, 0x70(%rsp)
movq 0x38(%rbx), %r14
movq %r14, %rdi
movl $0x2f, %esi
callq 0x2150
leaq 0x1(%rax), %rdx
testq %rax, %rax
cmoveq %r14, %rdx
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
movq %rdi, %r14
callq 0x35d1
movl 0x14(%rbx), %esi
movq %r14, %rdi
callq 0x44c5
cmpb $0x0, 0xc(%rsp)
je 0x5551
leaq 0x124e7(%rip), %rdi     # 0x17a00
callq 0x2120
movq %r14, %rdi
movq %rax, %r14
leaq (%rsp,%rax), %r12
addq $0x70, %r12
callq 0x2120
leaq 0x1(%rax), %rdx
movq %r12, %rdi
leaq 0x70(%rsp), %r12
movq %r12, %rsi
callq 0x22d0
movq %r12, %rdi
leaq 0x124b1(%rip), %rsi     # 0x17a00
jmp 0x55ca
movq %r14, %rdi
callq 0x2120
movq %rax, %r12
incq %r12
cmpl $0x0, 0x24(%rsp)
je 0x5599
leaq 0x12093(%rip), %rdi     # 0x17600
callq 0x2120
movq %rax, %r14
leaq (%rsp,%rax), %rdi
addq $0x70, %rdi
leaq 0x70(%rsp), %rsi
movq %r12, %rdx
movq %rsi, %r12
callq 0x22d0
movq %r12, %rdi
leaq 0x12069(%rip), %rsi     # 0x17600
jmp 0x55ca
leaq 0x12860(%rip), %rdi     # 0x17e00
callq 0x2120
movq %rax, %r14
leaq (%rsp,%rax), %rdi
addq $0x70, %rdi
leaq 0x70(%rsp), %rsi
movq %r12, %rdx
movq %rsi, %r12
callq 0x22d0
movq %r12, %rdi
leaq 0x12836(%rip), %rsi     # 0x17e00
movq %r14, %rdx
callq 0x2240
movq 0x68(%rsp), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x2745
movl 0x30(%rax), %ecx
andl $-0x10, %ecx
addl 0x44(%rsp), %ecx
movl %ecx, 0x30(%rax)
movq 0x18(%rsp), %r14
movq %r14, %rdi
leaq 0xce99(%rip), %rsi      # 0x12499
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce8f(%rip), %rsi      # 0x124a0
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce89(%rip), %rsi      # 0x124ab
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce83(%rip), %rsi      # 0x124b6
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce7d(%rip), %rsi      # 0x124c1
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce77(%rip), %rsi      # 0x124cc
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce77(%rip), %rsi      # 0x124dd
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce4d(%rip), %rsi      # 0x124c4
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce47(%rip), %rsi      # 0x124cf
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce47(%rip), %rsi      # 0x124e0
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce46(%rip), %rsi      # 0x124f0
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce38(%rip), %rsi      # 0x124f3
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce49(%rip), %rsi      # 0x12515
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce1d(%rip), %rsi      # 0x124fa
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce17(%rip), %rsi      # 0x12505
xorl %edx, %edx
callq 0x2745
movq %r14, %rdi
leaq 0xce13(%rip), %rsi      # 0x12512
xorl %edx, %edx
callq 0x2745
movq %r14, %rax
movq %r12, %r14
movb 0xd(%rsp), %r12b
cmpb $0x0, 0x20(%rsp)
jne 0x5749
cmpq $0x0, 0x50(%rsp)
je 0x573c
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movq %r13, %rsi
callq 0x31b7
movq 0x18(%rsp), %rcx
movq %rax, 0x8(%rcx)
jmp 0x5749
testq %r13, %r13
je 0x5745
incl (%r13)
movq %r13, 0x8(%rax)
cmpb $0x0, 0xf(%rsp)
je 0x57f6
movb $0x0, 0x70(%rsp)
movq 0x38(%rbx), %r14
movq %r14, %rdi
movl $0x2f, %esi
callq 0x2150
leaq 0x1(%rax), %rdx
testq %rax, %rax
cmoveq %r14, %rdx
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x35d1
movq %r15, %rdi
leaq 0xcbaf(%rip), %rsi      # 0x1233b
xorl %edx, %edx
callq 0x2745
movq %rax, %r14
movq %rax, %rdi
leaq 0x70(%rsp), %rsi
callq 0x26b0
movq %rax, %rbp
movq %r14, %rdi
leaq 0x70(%rsp), %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0x2745
movq %rax, %r12
movl 0x14(%rbx), %eax
movl %eax, 0x30(%r12)
testq %rbp, %rbp
je 0x57dc
movq 0x8(%r12), %rdi
movq %r13, %rsi
callq 0x31b7
movq %rax, 0x8(%r12)
jmp 0x57ea
testq %r13, %r13
je 0x57e5
incl (%r13)
movq %r13, 0x8(%r12)
leaq 0xca97(%rip), %rbp      # 0x12288
movb 0xd(%rsp), %r12b
movq %rbx, %rdi
leaq 0xcd1a(%rip), %rsi      # 0x1251a
callq 0x39dc
testl %eax, %eax
je 0x5853
movq %rbx, %rdi
callq 0x3b23
movq 0x30(%rbx), %rdi
leaq 0xcf47(%rip), %rsi      # 0x12763
movq %r14, %rdx
xorl %eax, %eax
callq 0x2280
cmpl $0x1, %eax
jne 0x59d9
movq 0x18(%rsp), %rdi
leaq 0xcce1(%rip), %rsi      # 0x1251c
xorl %edx, %edx
callq 0x2745
movq 0x30(%rbx), %rsi
movq %rax, %rdi
movl $0x1, %edx
callq 0x2745
movq %rbx, %rdi
leaq 0xcc0e(%rip), %rsi      # 0x1246b
callq 0x39dc
testl %eax, %eax
movl 0x4c(%rsp), %r14d
je 0x588d
cmpl $0x0, 0x3c(%rsp)
je 0x59d9
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl $0x1, %edx
movq 0x60(%rsp), %rcx
callq 0x4a00
movq %rbx, %rdi
leaq 0xcbd2(%rip), %rsi      # 0x12469
callq 0x39dc
testl %eax, %eax
jne 0x53fd
jmp 0x5340
xorl %r13d, %r13d
movq %r15, %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x4949
movq %rax, %r12
testq %rax, %rax
je 0x58c8
incl (%r12)
movq %r12, %rdi
movq 0x30(%rsp), %rsi
callq 0x3163
movq %rax, %rdi
movq %r13, %rsi
callq 0x3163
movq %rax, %r14
movq %r15, %rdi
movq %rbx, %rsi
movl $0x2, %edx
movq %rax, %rcx
callq 0x4a00
movl %eax, %ebp
movq %r14, %rdi
callq 0x2d76
cmpl $0x2, %ebp
je 0x596a
cmpl $0x1, %ebp
jne 0x59af
movl $0x20, %edi
callq 0x250a
movabsq $0x300000001, %rcx      # imm = 0x300000001
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
testq %r12, %r12
je 0x5936
incl (%r12)
movq %r12, 0x10(%rax)
movq %rax, %rdi
movq 0x30(%rsp), %rsi
callq 0x3163
movq %rax, %rdi
movq %r13, %rsi
callq 0x3163
movq %rax, %r14
movq %r15, %rdi
movq %rbx, %rsi
movl $0x3, %edx
movq %rax, %rcx
callq 0x4a00
jmp 0x59a7
movl $0x20, %edi
callq 0x250a
movq %rax, %r14
movabsq $0x300000001, %rax      # imm = 0x300000001
movq %rax, (%r14)
movq $0x0, 0x8(%r14)
testq %r12, %r12
je 0x5995
incl (%r12)
movq %r12, 0x10(%r14)
movq %r13, %rdi
movq %r14, %rsi
callq 0x3163
movq %rax, %r13
movq %r14, %rdi
callq 0x2d76
movq %r12, %rdi
callq 0x2d76
cmpl $0x2, %ebp
je 0x58ac
movq %r13, %rdi
callq 0x2d76
jmp 0x4a20
movl $0x1, %eax
cmpl $0x2, 0x10(%rsp)
je 0x5a18
movq 0x38(%rbx), %rsi
movl 0xc(%rbx), %edx
movq 0x28(%rbx), %rcx
leaq 0xc685(%rip), %rdi      # 0x12070
xorl %eax, %eax
callq 0x2140
movl $0x1, %edi
callq 0x2330
movl $0x2, %eax
cmpl $0x2, 0x10(%rsp)
je 0x5a18
jmp 0x5a31
movl 0x10(%rsp), %eax
addl $-0x4, %eax
cmpl $-0x3, %eax
jbe 0x5a31
xorl %eax, %eax
addq $0x508, %rsp            # imm = 0x508
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1, 0x10(%rsp)
je 0x5a16
movq %rbx, %rdi
callq 0x24e6
movq %rbx, %rdi
callq 0x3b23
leaq 0xc7e3(%rip), %rdi      # 0x1222b
leaq 0xc657(%rip), %rsi      # 0x120a6
leaq 0xc808(%rip), %rcx      # 0x1225e
movl $0x4fc, %edx            # imm = 0x4FC
callq 0x2160
testq %rax, %rax
je 0x5a91
movq 0x18(%rax), %rdx
movq 0x20(%rax), %rsi
cmpq %rsi, %rdx
sete %cl
jne 0x5a77
jmp 0x5a8c
movq (%rdx), %rax
testb $0x40, 0x30(%rax)
je 0x5a8c
addq $0x8, %rdx
cmpq %rsi, %rdx
sete %cl
jne 0x5a77
testb $0x1, %cl
je 0x5a93
xorl %eax, %eax
testq %rax, %rax
jne 0x5aa1
leaq 0xc9f8(%rip), %rsi      # 0x12497
jmp 0x5aa4
movq (%rax), %rsi
movq 0x38(%rbx), %rdx
movl 0xc(%rbx), %ecx
movq 0x28(%rbx), %r8
leaq 0xc9b7(%rip), %rdi      # 0x1246d
xorl %eax, %eax
callq 0x2140
jmp 0x59f2