decompiled_code:
__int64 __fastcall weightType_function(const char *a1, int a2, __int64 a3)
{
const char *v5; // rax
const char *v6; // rsi

if ( a2 == 2 )
{
printf("<%s%s", "/", a1);
if ( !a3 )
{
v6 = (const char *)&unk_1A79;
goto LABEL_6;
}
}
else
{
printf("<%s%s", (const char *)&unk_1A79, a1);
if ( !a3 )
goto LABEL_4;
}
v5 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" limit=\"%s\"", v5);
LABEL_4:
v6 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v6 = (const char *)&unk_1A79;
LABEL_6:
printf("%s>\n", v6);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func8(const char *a1, int a2, __int64 a3)
{
const char *v5; // rax
const char *v6; // rsi

if ( a2 == 2 )
{
printf("<%s%s", "/", a1);
if ( !a3 )
{
v6 = (const char *)&unk_1A79;
goto LABEL_6;
}
}
else
{
printf("<%s%s", (const char *)&unk_1A79, a1);
if ( !a3 )
goto LABEL_4;
}
v5 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" limit=\"%s\"", v5);
LABEL_4:
v6 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v6 = (const char *)&unk_1A79;
LABEL_6:
printf("%s>\n", v6);
return 0LL;
}

original_code:
static int weightType_function(const char *_tag_,int _type_,const char *limit)
{
 if(_type_&1)
   {
    double l;
    do { if(!limit || !*limit || !ParseXML_IsFloating(limit)) { fprintf(stderr,"XML Parser: Error on line %llu: '" "limit" "' attribute must be a number in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0); l=atof(limit);
    loaded_profiles[nloaded_profiles-1]->weight=(weight_t)((l)*5);
   }
 return(0);
}

canonical_original_code:
static int weightType_function(char *_tag_, int _type_, char *limit)
{
 if(_type_&1)
   {
    double l;
    do { if(!limit || !*limit || !ParseXML_IsFloating(limit)) { fprintf(stderr,"XML Parser: Error on line %llu: '" "limit" "' attribute must be a number in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0); l=atof(limit);
    loaded_profiles[nloaded_profiles-1]->weight=(weight_t)((l)*5);
   }
 return(0);
}


repo: mauricesvay/Routino

decompiled_code:
__int64 __fastcall turnsType_function(const char *a1, int a2, __int64 a3)
{
const char *v5; // rax
const char *v6; // rsi

if ( a2 == 2 )
{
printf("<%s%s", "/", a1);
if ( !a3 )
{
v6 = (const char *)&unk_1A79;
goto LABEL_6;
}
}
else
{
printf("<%s%s", (const char *)&unk_1A79, a1);
if ( !a3 )
goto LABEL_4;
}
v5 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" obey=\"%s\"", v5);
LABEL_4:
v6 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v6 = (const char *)&unk_1A79;
LABEL_6:
printf("%s>\n", v6);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func9(const char *a1, int a2, __int64 a3)
{
const char *v5; // rax
const char *v6; // rsi

if ( a2 == 2 )
{
printf("<%s%s", "/", a1);
if ( !a3 )
{
v6 = (const char *)&unk_1A79;
goto LABEL_6;
}
}
else
{
printf("<%s%s", (const char *)&unk_1A79, a1);
if ( !a3 )
goto LABEL_4;
}
v5 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" obey=\"%s\"", v5);
LABEL_4:
v6 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v6 = (const char *)&unk_1A79;
LABEL_6:
printf("%s>\n", v6);
return 0LL;
}

original_code:
static int turnsType_function(const char *_tag_,int _type_,const char *obey)
{
 if(_type_&1)
   {
    int o;
    do { if(!obey || !*obey || !ParseXML_IsInteger(obey)) { fprintf(stderr,"XML Parser: Error on line %llu: '" "obey" "' attribute must be a integer in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0); o=atoi(obey);
    loaded_profiles[nloaded_profiles-1]->turns=!!o;
   }
 return(0);
}

canonical_original_code:
static int turnsType_function(char *_tag_, int _type_, char *obey)
{
 if(_type_&1)
   {
    int o;
    do { if(!obey || !*obey || !ParseXML_IsInteger(obey)) { fprintf(stderr,"XML Parser: Error on line %llu: '" "obey" "' attribute must be a integer in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0); o=atoi(obey);
    loaded_profiles[nloaded_profiles-1]->turns=!!o;
   }
 return(0);
}

variable_types:
obey
char *

variable_types: o int

return_type: int


decompiled_code:
__int64 __fastcall onewayType_function(const char *a1, int a2, __int64 a3)
{
const char *v5; // rax
const char *v6; // rsi

if ( a2 == 2 )
{
printf("<%s%s", "/", a1);
if ( !a3 )
{
v6 = (const char *)&unk_1A79;
goto LABEL_6;
}
}
else
{
printf("<%s%s", (const char *)&unk_1A79, a1);
if ( !a3 )
goto LABEL_4;
}
v5 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" obey=\"%s\"", v5);
LABEL_4:
v6 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v6 = (const char *)&unk_1A79;
LABEL_6:
printf("%s>\n", v6);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func10(const char *a1, int a2, __int64 a3)
{
const char *v5; // rax
const char *v6; // rsi

if ( a2 == 2 )
{
printf("<%s%s", "/", a1);
if ( !a3 )
{
v6 = (const char *)&unk_1A79;
goto LABEL_6;
}
}
else
{
printf("<%s%s", (const char *)&unk_1A79, a1);
if ( !a3 )
goto LABEL_4;
}
v5 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" obey=\"%s\"", v5);
LABEL_4:
v6 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v6 = (const char *)&unk_1A79;
LABEL_6:
printf("%s>\n", v6);
return 0LL;
}

original_code:
static int onewayType_function(const char *_tag_,int _type_,const char *obey)
{
 if(_type_&1)
   {
    int o;
    do { if(!obey || !*obey || !ParseXML_IsInteger(obey)) { fprintf(stderr,"XML Parser: Error on line %llu: '" "obey" "' attribute must be a integer in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0); o=atoi(obey);
    loaded_profiles[nloaded_profiles-1]->oneway=!!o;
   }
 return(0);
}

canonical_original_code:
static int onewayType_function(char *_tag_, int _type_, char *obey)
{
 if(_type_&1)
   {
    int o;
    do { if(!obey || !*obey || !ParseXML_IsInteger(obey)) { fprintf(stderr,"XML Parser: Error on line %llu: '" "obey" "' attribute must be a integer in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0); o=atoi(obey);
    loaded_profiles[nloaded_profiles-1]->oneway=!!o;
   }
 return(0);
}


decompiled_code:
__int64 __fastcall propertyType_function(const char *a1, int a2, __int64 a3, __int64 a4)
{
bool v7; // zf
const char *v8; // rsi
const char *v9; // rax
const char *v10; // rax
const char *v11; // rsi

v7 = a2 == 2;
v8 = "/";
if ( !v7 )
v8 = (const char *)&unk_1A79;
printf("<%s%s", v8, a1);
if ( a3 )
{
v9 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" type=\"%s\"", v9);
}
if ( a4 )
{
v10 = (const char *)ParseXML_Encode_Safe_XML(a4);
printf(" percent=\"%s\"", v10);
}
v11 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v11 = (const char *)&unk_1A79;
printf("%s>\n", v11);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func11(const char *a1, int a2, __int64 a3, __int64 a4)
{
bool v7; // zf
const char *v8; // rsi
const char *v9; // rax
const char *v10; // rax
const char *v11; // rsi

v7 = a2 == 2;
v8 = "/";
if ( !v7 )
v8 = (const char *)&unk_1A79;
printf("<%s%s", v8, a1);
if ( a3 )
{
v9 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" type=\"%s\"", v9);
}
if ( a4 )
{
v10 = (const char *)ParseXML_Encode_Safe_XML(a4);
printf(" percent=\"%s\"", v10);
}
v11 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v11 = (const char *)&unk_1A79;
printf("%s>\n", v11);
return 0LL;
}

original_code:
static int propertyType_function(const char *_tag_,int _type_,const char *type,const char *percent)
{
 if(_type_&1)
   {
    Property property;
    double p;
    do { if(!type) { fprintf(stderr,"XML Parser: Error on line %llu: '" "type" "' attribute must be specified in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0);
    property=PropertyType(type);
    if(property==Property_Count)
       do { fprintf(stderr,"XML Parser: Error on line %llu: Invalid value for '" "type" "' attribute in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } while(0);
    do { if(!percent || !*percent || !ParseXML_IsFloating(percent)) { fprintf(stderr,"XML Parser: Error on line %llu: '" "percent" "' attribute must be a number in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0); p=atof(percent);
    loaded_profiles[nloaded_profiles-1]->props_yes[property]=p;
   }
 return(0);
}

canonical_original_code:
static int propertyType_function(char *_tag_, int _type_, char *type, char *percent)
{
 if(_type_&1)
   {
    enum _Property property;
    double p;
    do { if(!type) { fprintf(stderr,"XML Parser: Error on line %llu: '" "type" "' attribute must be specified in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0);
    property=PropertyType(type);
    if(property==Property_Count)
       do { fprintf(stderr,"XML Parser: Error on line %llu: Invalid value for '" "type" "' attribute in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } while(0);
    do { if(!percent || !*percent || !ParseXML_IsFloating(percent)) { fprintf(stderr,"XML Parser: Error on line %llu: '" "percent" "' attribute must be a number in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0); p=atof(percent);
    loaded_profiles[nloaded_profiles-1]->props_yes[property]=p;
   }
 return(0);
}

variable_types:
type
char *

variable_types:
percent
char *

variable_types: enum _Property { Property_None=0, Property_Paved=1, Property_Multilane=2, Property_Bridge=3, Property_Tunnel=4, Property_FootRoute=5, Property_BicycleRoute=6, Property_Count=7 }

variable_types: p double


decompiled_code:
__int64 __fastcall preferenceType_function(const char *a1, int a2, __int64 a3, __int64 a4)
{
bool v7; // zf
const char *v8; // rsi
const char *v9; // rax
const char *v10; // rax
const char *v11; // rsi

v7 = a2 == 2;
v8 = "/";
if ( !v7 )
v8 = (const char *)&unk_1A79;
printf("<%s%s", v8, a1);
if ( a3 )
{
v9 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" highway=\"%s\"", v9);
}
if ( a4 )
{
v10 = (const char *)ParseXML_Encode_Safe_XML(a4);
printf(" percent=\"%s\"", v10);
}
v11 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v11 = (const char *)&unk_1A79;
printf("%s>\n", v11);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func12(const char *a1, int a2, __int64 a3, __int64 a4)
{
bool v7; // zf
const char *v8; // rsi
const char *v9; // rax
const char *v10; // rax
const char *v11; // rsi

v7 = a2 == 2;
v8 = "/";
if ( !v7 )
v8 = (const char *)&unk_1A79;
printf("<%s%s", v8, a1);
if ( a3 )
{
v9 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" highway=\"%s\"", v9);
}
if ( a4 )
{
v10 = (const char *)ParseXML_Encode_Safe_XML(a4);
printf(" percent=\"%s\"", v10);
}
v11 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v11 = (const char *)&unk_1A79;
printf("%s>\n", v11);
return 0LL;
}

original_code:
static int preferenceType_function(const char *_tag_,int _type_,const char *highway,const char *percent)
{
 if(_type_&1)
   {
    Highway highwaytype;
    double p;
    do { if(!highway) { fprintf(stderr,"XML Parser: Error on line %llu: '" "highway" "' attribute must be specified in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0);
    highwaytype=HighwayType(highway);
    if(highwaytype==Way_Count)
       do { fprintf(stderr,"XML Parser: Error on line %llu: Invalid value for '" "highway" "' attribute in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } while(0);
    do { if(!percent || !*percent || !ParseXML_IsFloating(percent)) { fprintf(stderr,"XML Parser: Error on line %llu: '" "percent" "' attribute must be a number in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0); p=atof(percent);
    loaded_profiles[nloaded_profiles-1]->highway[highwaytype]=p;
   }
 return(0);
}

canonical_original_code:
static int preferenceType_function(char *_tag_, int _type_, char *highway, char *percent)
{
 if(_type_&1)
   {
    enum _Highway highwaytype;
    double p;
    do { if(!highway) { fprintf(stderr,"XML Parser: Error on line %llu: '" "highway" "' attribute must be specified in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0);
    highwaytype=HighwayType(highway);
    if(highwaytype==Way_Count)
       do { fprintf(stderr,"XML Parser: Error on line %llu: Invalid value for '" "highway" "' attribute in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } while(0);
    do { if(!percent || !*percent || !ParseXML_IsFloating(percent)) { fprintf(stderr,"XML Parser: Error on line %llu: '" "percent" "' attribute must be a number in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0); p=atof(percent);
    loaded_profiles[nloaded_profiles-1]->highway[highwaytype]=p;
   }
 return(0);
}

variable_types:
highway
char *

variable_types: enum _Highway { Way_Motorway=1, Way_Trunk=2, Way_Primary=3, Way_Secondary=4, Way_Tertiary=5, Way_Unclassified=6, Way_Residential=7, Way_Service=8, Way_Track=9, Way_Cycleway=10, Way_Path=11, Way_Steps=12, Way_Ferry=13, Way_Count=14, Way_OneWay=32 }


decompiled_code:
__int64 __fastcall speedType_function(const char *a1, int a2, __int64 a3, __int64 a4)
{
bool v7; // zf
const char *v8; // rsi
const char *v9; // rax
const char *v10; // rax
const char *v11; // rsi

v7 = a2 == 2;
v8 = "/";
if ( !v7 )
v8 = (const char *)&unk_1A79;
printf("<%s%s", v8, a1);
if ( a3 )
{
v9 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" highway=\"%s\"", v9);
}
if ( a4 )
{
v10 = (const char *)ParseXML_Encode_Safe_XML(a4);
printf(" kph=\"%s\"", v10);
}
v11 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v11 = (const char *)&unk_1A79;
printf("%s>\n", v11);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func13(const char *a1, int a2, __int64 a3, __int64 a4)
{
bool v7; // zf
const char *v8; // rsi
const char *v9; // rax
const char *v10; // rax
const char *v11; // rsi

v7 = a2 == 2;
v8 = "/";
if ( !v7 )
v8 = (const char *)&unk_1A79;
printf("<%s%s", v8, a1);
if ( a3 )
{
v9 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" highway=\"%s\"", v9);
}
if ( a4 )
{
v10 = (const char *)ParseXML_Encode_Safe_XML(a4);
printf(" kph=\"%s\"", v10);
}
v11 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v11 = (const char *)&unk_1A79;
printf("%s>\n", v11);
return 0LL;
}

original_code:
static int speedType_function(const char *_tag_,int _type_,const char *highway,const char *kph)
{
 if(_type_&1)
   {
    double speed;
    Highway highwaytype;
    do { if(!highway) { fprintf(stderr,"XML Parser: Error on line %llu: '" "highway" "' attribute must be specified in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0);
    highwaytype=HighwayType(highway);
    if(highwaytype==Way_Count)
       do { fprintf(stderr,"XML Parser: Error on line %llu: Invalid value for '" "highway" "' attribute in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } while(0);
    do { if(!kph || !*kph || !ParseXML_IsFloating(kph)) { fprintf(stderr,"XML Parser: Error on line %llu: '" "kph" "' attribute must be a number in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0); speed=atof(kph);
    loaded_profiles[nloaded_profiles-1]->speed[highwaytype]=(speed_t)(speed);
   }
 return(0);
}

canonical_original_code:
static int speedType_function(char *_tag_, int _type_, char *highway, char *kph)
{
 if(_type_&1)
   {
    double speed;
    enum _Highway highwaytype;
    do { if(!highway) { fprintf(stderr,"XML Parser: Error on line %llu: '" "highway" "' attribute must be specified in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0);
    highwaytype=HighwayType(highway);
    if(highwaytype==Way_Count)
       do { fprintf(stderr,"XML Parser: Error on line %llu: Invalid value for '" "highway" "' attribute in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } while(0);
    do { if(!kph || !*kph || !ParseXML_IsFloating(kph)) { fprintf(stderr,"XML Parser: Error on line %llu: '" "kph" "' attribute must be a number in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0); speed=atof(kph);
    loaded_profiles[nloaded_profiles-1]->speed[highwaytype]=(speed_t)(speed);
   }
 return(0);
}

variable_types:
kph
char *

variable_types: speed double

user_defined_types: enum _Highway { Way_Motorway=1, Way_Trunk=2, Way_Primary=3, Way_Secondary=4, Way_Tertiary=5, Way_Unclassified=6, Way_Residential=7, Way_Service=8, Way_Track=9, Way_Cycleway=10, Way_Path=11, Way_Steps=12, Way_Ferry=13, Way_Count=14, Way_OneWay=32 }


decompiled_code:
__int64 __fastcall profileType_function(const char *a1, int a2, __int64 a3, __int64 a4)
{
bool v7; // zf
const char *v8; // rsi
const char *v9; // rax
const char *v10; // rax
const char *v11; // rsi

v7 = a2 == 2;
v8 = "/";
if ( !v7 )
v8 = (const char *)&unk_1A79;
printf("<%s%s", v8, a1);
if ( a3 )
{
v9 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" name=\"%s\"", v9);
}
if ( a4 )
{
v10 = (const char *)ParseXML_Encode_Safe_XML(a4);
printf(" transport=\"%s\"", v10);
}
v11 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v11 = (const char *)&unk_1A79;
printf("%s>\n", v11);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func14(const char *a1, int a2, __int64 a3, __int64 a4)
{
bool v7; // zf
const char *v8; // rsi
const char *v9; // rax
const char *v10; // rax
const char *v11; // rsi

v7 = a2 == 2;
v8 = "/";
if ( !v7 )
v8 = (const char *)&unk_1A79;
printf("<%s%s", v8, a1);
if ( a3 )
{
v9 = (const char *)ParseXML_Encode_Safe_XML(a3);
printf(" name=\"%s\"", v9);
}
if ( a4 )
{
v10 = (const char *)ParseXML_Encode_Safe_XML(a4);
printf(" transport=\"%s\"", v10);
}
v11 = (const char *)&unk_1A7A;
if ( a2 != 3 )
v11 = (const char *)&unk_1A79;
printf("%s>\n", v11);
return 0LL;
}

original_code:
static int profileType_function(const char *_tag_,int _type_,const char *name,const char *transport)
{
 if(_type_&1)
   {
    Transport transporttype;
    int i;
    do { if(!name) { fprintf(stderr,"XML Parser: Error on line %llu: '" "name" "' attribute must be specified in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0);
    do { if(!transport) { fprintf(stderr,"XML Parser: Error on line %llu: '" "transport" "' attribute must be specified in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0);
    for(i=0;i<nloaded_profiles;i++)
       if(!strcmp(name,loaded_profiles[i]->name))
          do { fprintf(stderr,"XML Parser: Error on line %llu: " "profile name must be unique" " in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } while(0);
    transporttype=TransportType(transport);
    if(transporttype==Transport_None)
       do { fprintf(stderr,"XML Parser: Error on line %llu: Invalid value for '" "transport" "' attribute in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } while(0);
    if((nloaded_profiles%16)==0)
       loaded_profiles=(Profile**)realloc((void*)loaded_profiles,(nloaded_profiles+16)*sizeof(Profile*));
    nloaded_profiles++;
    loaded_profiles[nloaded_profiles-1]=(Profile*)calloc(1,sizeof(Profile));
    loaded_profiles[nloaded_profiles-1]->name=strcpy(malloc(strlen(name)+1),name);
    loaded_profiles[nloaded_profiles-1]->transport=transporttype;
   }
 return(0);
}

canonical_original_code:
static int profileType_function(char *_tag_, int _type_, char *name, char *transport)
{
 if(_type_&1)
   {
    enum _Transport transporttype;
    int i;
    do { if(!name) { fprintf(stderr,"XML Parser: Error on line %llu: '" "name" "' attribute must be specified in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0);
    do { if(!transport) { fprintf(stderr,"XML Parser: Error on line %llu: '" "transport" "' attribute must be specified in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } } while(0);
    for(i=0;i<nloaded_profiles;i++)
       if(!strcmp(name,loaded_profiles[i]->name))
          do { fprintf(stderr,"XML Parser: Error on line %llu: " "profile name must be unique" " in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } while(0);
    transporttype=TransportType(transport);
    if(transporttype==Transport_None)
       do { fprintf(stderr,"XML Parser: Error on line %llu: Invalid value for '" "transport" "' attribute in <%s> tag.\n",ParseXML_LineNumber(),_tag_); return(1); } while(0);
    if((nloaded_profiles%16)==0)
       loaded_profiles=(struct _Profile **)realloc((void *)loaded_profiles,(nloaded_profiles+16)*sizeof(struct _Profile *));
    nloaded_profiles++;
    loaded_profiles[nloaded_profiles-1]=(struct _Profile *)calloc(1,sizeof(Profile));
    loaded_profiles[nloaded_profiles-1]->name=strcpy(malloc(strlen(name)+1),name);
    loaded_profiles[nloaded_profiles-1]->transport=transporttype;
   }
 return(0);
}

variable_types:
name
char *

variable_types:
transport
char *

variable_types: enum _Transport { Transport_None=0, Transport_Foot=1, Transport_Horse=2, Transport_Wheelchair=3, Transport_Bicycle=4, Transport_Moped=5, Transport_Motorbike=6, Transport_Motorcar=7, Transport_Goods=8, Transport_HGV=9, Transport_PSV=10, Transport_Count=11 }

variable_types: i int

user_defined_types: struct _Profile { char *name; enum _Transport transport; unsigned short allow; float highway[-1]; float max_pref; unsigned char speed[-1]; unsigned char max_speed; float props_yes[-1]; float props_no[-1]; int oneway; int turns; unsigned char weight; unsigned char height; unsigned char width; unsigned char length; }


FreeResultsList

decompiled_code:
void __fastcall FreeResultsList(void *ptr)
{
__int64 v1; // rbp
__int64 v2; // rbp

if ( *((_DWORD *)ptr + 8) )
{
v1 = 0LL;
do
free(*(void **)(*((_QWORD *)ptr + 5) + 8 * v1++));
while ( *((_DWORD *)ptr + 8) > (unsigned int)v1 );
}
free(*((void **)ptr + 5));
if ( *((_BYTE *)ptr + 12) )
{
v2 = 0LL;
do
free(*(void **)(*((_QWORD *)ptr + 3) + 8 * v2++));
while ( *((unsigned __int8 *)ptr + 12) > (int)v2 );
}
free(*((void **)ptr + 3));
free(*((void **)ptr + 2));
free(ptr);
}

canonical_decompiled_code:
void __fastcall func1(void *ptr)
{
__int64 v1; // rbp
__int64 v2; // rbp

if ( *((_DWORD *)ptr + 8) )
{
v1 = 0LL;
do
free(*(void **)(*((_QWORD *)ptr + 5) + 8 * v1++));
while ( *((_DWORD *)ptr + 8) > (unsigned int)v1 );
}
free(*((void **)ptr + 5));
if ( *((_BYTE *)ptr + 12) )
{
v2 = 0LL;
do
free(*(void **)(*((_QWORD *)ptr + 3) + 8 * v2++));
while ( *((unsigned __int8 *)ptr + 12) > (int)v2 );
}
free(*((void **)ptr + 3));
free(*((void **)ptr + 2));
free(ptr);
}

original_code:
void FreeResultsList(Results *results)
{
 int i;
 for(i=0;i<results->ndata1;i++)
    free(results->data[i]);
 free(results->data);
 for(i=0;i<results->npoint1;i++)
    free(results->point[i]);
 free(results->point);
 free(results->count);
 free(results);
}

canonical_original_code:
void FreeResultsList(struct _Results *results)
{
 int i;
 for(i=0;i<results->ndata1;i++)
    free(results->data[i]);
 free(results->data);
 for(i=0;i<results->npoint1;i++)
    free(results->point[i]);
 free(results->point);
 free(results->count);
 free(results);
}

variable_types: struct _Results { unsigned int nbins; unsigned int mask; unsigned int number; unsigned char npoint1; unsigned char *count; struct _Result { unsigned int node; unsigned int segment; struct _Result *prev; struct _Result *next; float score; float sortby; unsigned int queued; } ***point; unsigned int ndata1; unsigned int ndata2; struct _Result **data; unsigned int start_node; unsigned int prev_segment; unsigned int finish_node; unsigned int last_segment; } *

return_type: void

user_defined_types: struct _Results { unsigned int nbins; unsigned int mask; unsigned int number; unsigned char npoint1; unsigned char *count; struct _Result ***point; unsigned int ndata1; unsigned int ndata2; struct _Result **data; unsigned int start_node; unsigned int prev_segment; unsigned int finish_node; unsigned int last_segment; }


InsertResult

original_code:
Result *InsertResult(Results *results,index_t node,index_t segment)
{
 Result *result;
 int bin=node&results->mask;
 if(results->count[bin]>32 && results->count[bin]==results->npoint1)
   {
    int i,j,k;
    results->nbins<<=1;
    results->mask=(results->mask<<1)|1;
    results->count=(uint8_t*)realloc((void*)results->count,results->nbins*sizeof(uint8_t));
    for(i=0;i<results->npoint1;i++)
       results->point[i]=(Result**)realloc((void*)results->point[i],results->nbins*sizeof(Result*));
    for(i=0;i<results->nbins/2;i++)
      {
       int c=results->count[i];
       results->count[i+results->nbins/2]=0;
       for(j=0,k=0;j<c;j++)
         {
          int newbin=results->point[j][i]->node&results->mask;
          if(newbin==i)
            {
             if(k!=j)
                results->point[k][i]=results->point[j][i];
             k++;
            }
          else
            {
             results->point[results->count[newbin]][newbin]=results->point[j][i];
             results->count[newbin]++;
             results->count[i]--;
            }
         }
      }
    bin=node&results->mask;
   }
 if(results->count[bin]==results->npoint1)
   {
    ((results->npoint1<255) ? (void) (0) : __assert_fail ("results->npoint1<255", "results.c", 172, __extension__ __PRETTY_FUNCTION__));
    results->npoint1++;
    if(results->npoint1>32)
       results->point=(Result***)realloc((void*)results->point,results->npoint1*sizeof(Result**));
    results->point[results->npoint1-1]=(Result**)malloc(results->nbins*sizeof(Result*));
   }
 if((results->number%results->ndata2)==0)
   {
    results->ndata1++;
    results->data=(Result**)realloc((void*)results->data,results->ndata1*sizeof(Result*));
    results->data[results->ndata1-1]=(Result*)malloc(results->ndata2*sizeof(Result));
   }
 results->point[results->count[bin]][bin]=&results->data[results->ndata1-1][results->number%results->ndata2];
 results->number++;
 results->count[bin]++;
 result=results->point[results->count[bin]-1][bin];
 result->node=node;
 result->segment=segment;
 result->prev=((void *)0);
 result->next=((void *)0);
 result->score=0;
 result->sortby=0;
 result->queued=(uint32_t)(0);
 return(result);
}

canonical_original_code:
struct _Result *InsertResult(struct _Results *results, unsigned int node, unsigned int segment)
{
 struct _Result *result;
 int bin = node&results->mask;
 if(results->count[bin]>32 && results->count[bin]==results->npoint1)
   {
    int i; int j; int k;
    results->nbins<<=1;
    results->mask=(results->mask<<1)|1;
    results->count=(unsigned char *)realloc((void *)results->count,results->nbins*sizeof(unsigned char));
    for(i=0;i<results->npoint1;i++)
       results->point[i]=(struct _Result **)realloc((void *)results->point[i],results->nbins*sizeof(struct _Result *));
    for(i=0;i<results->nbins/2;i++)
      {
       int c = results->count[i];
       results->count[i+results->nbins/2]=0;
       for(j=0,k=0;j<c;j++)
         {
          int newbin = results->point[j][i]->node&results->mask;
          if(newbin==i)
            {
             if(k!=j)
                results->point[k][i]=results->point[j][i];
             k++;
            }
          else
            {
             results->point[results->count[newbin]][newbin]=results->point[j][i];
             results->count[newbin]++;
             results->count[i]--;
            }
         }
      }
    bin=node&results->mask;
   }
 if(results->count[bin]==results->npoint1)
   {
    ((results->npoint1<255) ? (void) (0) : __assert_fail ("results->npoint1<255", "results.c", 172, __extension__ __PRETTY_FUNCTION__));
    results->npoint1++;
    if(results->npoint1>32)
       results->point=(struct _Result ***)realloc((void *)results->point,results->npoint1*sizeof(struct _Result **));
    results->point[results->npoint1-1]=(struct _Result **)malloc(results->nbins*sizeof(struct _Result *));
   }
 if((results->number%results->ndata2)==0)
   {
    results->ndata1++;
    results->data=(struct _Result **)realloc((void *)results->data,results->ndata1*sizeof(struct _Result *));
    results->data[results->ndata1-1]=(struct _Result *)malloc(results->ndata2*sizeof(Result));
   }
 results->point[results->count[bin]][bin]=&results->data[results->ndata1-1][results->number%results->ndata2];
 results->number++;
 results->count[bin]++;
 result=results->point[results->count[bin]-1][bin];
 result->node=node;
 result->segment=segment;
 result->prev=((void *)0);
 result->next=((void *)0);
 result->score=0;
 result->sortby=0;
 result->queued=(unsigned int)(0);
 return(result);
}

variable_types: struct _Results { unsigned int nbins; unsigned int mask; unsigned int number; unsigned char npoint1; unsigned char *count; struct _Result ***point; unsigned int ndata1; unsigned int ndata2; struct _Result **data; unsigned int start_node; unsigned int prev_segment; unsigned int finish_node; unsigned int last_segment; } *

variable_types:
node
unsigned int

variable_types:
segment
unsigned int

variable_types: struct _Result { unsigned int node; unsigned int segment; struct _Result *prev; struct _Result *next; float score; float sortby; unsigned int queued; } *

variable_types: bin int

variable_types: j int

variable_types: k int

variable_types: c int

variable_types: newbin int


original_code:
Result *FindResult1(Results *results,index_t node)
{
 int bin=node&results->mask;
 score_t best_score=(score_t)1E30;
 Result *best_result=((void *)0);
 int i;
 for(i=results->count[bin]-1;i>=0;i--)
    if(results->point[i][bin]->node==node && results->point[i][bin]->score<best_score)
      {
       best_score=results->point[i][bin]->score;
       best_result=results->point[i][bin];
      }
 return(best_result);
}

canonical_original_code:
struct _Result *FindResult1(struct _Results *results, unsigned int node)
{
 int bin = node&results->mask;
 float best_score = (score_t)1E30;
 struct _Result *best_result = ((void *)0);
 int i;
 for(i=results->count[bin]-1;i>=0;i--)
    if(results->point[i][bin]->node==node && results->point[i][bin]->score<best_score)
      {
       best_score=results->point[i][bin]->score;
       best_result=results->point[i][bin];
      }
 return(best_result);
}

return_type: struct _Result { unsigned int node; unsigned int segment; struct _Result *prev; struct _Result *next; float score; float sortby; unsigned int queued; } *


FirstResult

decompiled_code:
__int64 __fastcall FirstResult(__int64 a1)
{
return **(_QWORD **)(a1 + 40);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
return **(_QWORD **)(a1 + 40);
}

original_code:
Result *FirstResult(Results *results)
{
 return(&results->data[0][0]);
}

canonical_original_code:
struct _Result *FirstResult(struct _Results *results)
{
 return(&results->data[0][0]);
}

user_defined_types: struct _Result { unsigned int node; unsigned int segment; struct _Result *prev; struct _Result *next; float score; float sortby; unsigned int queued; }


NextResult

decompiled_code:
__int64 __fastcall NextResult(__int64 a1, __int64 a2)
{
int v4; // esi
_QWORD *v5; // rdx
int v6; // ecx
unsigned __int64 v7; // rax
int v8; // edi
unsigned int v9; // edi
unsigned int v10; // eax
__int64 result; // rax

v4 = *(_DWORD *)(a1 + 32);
if ( v4 )
{
v5 = *(_QWORD **)(a1 + 40);
v6 = 0;
while ( 1 )
{
v7 = 0xCCCCCCCCCCCCCCCDLL * ((a2 - *v5) >> 3);
v8 = v7;
if ( (v7 & 0x80000000) == 0LL && *(_DWORD *)(a1 + 36) > (unsigned int)v7 )
break;
++v6;
++v5;
if ( v6 == v4 )
goto LABEL_7;
}
v4 = v6;
}
else
{
v4 = 0;
v8 = 0;
}
LABEL_7:
v9 = v8 + 1;
v10 = *(_DWORD *)(a1 + 36);
if ( v9 >= v10 )
{
++v4;
v9 = 0;
}
if ( v9 + v4 * v10 >= *(_DWORD *)(a1 + 8) )
result = 0LL;
else
result = *(_QWORD *)(*(_QWORD *)(a1 + 40) + 8LL * v4) + 40LL * (int)v9;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2)
{
int v4; // esi
_QWORD *v5; // rdx
int v6; // ecx
unsigned __int64 v7; // rax
int v8; // edi
unsigned int v9; // edi
unsigned int v10; // eax
__int64 result; // rax

v4 = *(_DWORD *)(a1 + 32);
if ( v4 )
{
v5 = *(_QWORD **)(a1 + 40);
v6 = 0;
while ( 1 )
{
v7 = 0xCCCCCCCCCCCCCCCDLL * ((a2 - *v5) >> 3);
v8 = v7;
if ( (v7 & 0x80000000) == 0LL && *(_DWORD *)(a1 + 36) > (unsigned int)v7 )
break;
++v6;
++v5;
if ( v6 == v4 )
goto LABEL_7;
}
v4 = v6;
}
else
{
v4 = 0;
v8 = 0;
}
LABEL_7:
v9 = v8 + 1;
v10 = *(_DWORD *)(a1 + 36);
if ( v9 >= v10 )
{
++v4;
v9 = 0;
}
if ( v9 + v4 * v10 >= *(_DWORD *)(a1 + 8) )
result = 0LL;
else
result = *(_QWORD *)(*(_QWORD *)(a1 + 40) + 8LL * v4) + 40LL * (int)v9;
return result;
}

original_code:
Result *NextResult(Results *results,Result *result)
{
 int i,j=0;
 for(i=0;i<results->ndata1;i++)
   {
    j=result-results->data[i];
    if(j>=0 && j<results->ndata2)
       break;
   }
 if(++j>=results->ndata2)
   {i++;j=0;}
 if((i*results->ndata2+j)>=results->number)
    return(((void *)0));
 return(&results->data[i][j]);
}

canonical_original_code:
struct _Result *NextResult(struct _Results *results, struct _Result *result)
{
 int i; int j = 0;
 for(i=0;i<results->ndata1;i++)
   {
    j=result-results->data[i];
    if(j>=0 && j<results->ndata2)
       break;
   }
 if(++j>=results->ndata2)
   {i++;j=0;}
 if((i*results->ndata2+j)>=results->number)
    return(((void *)0));
 return(&results->data[i][j]);
}

variable_types:
result
struct _Result *


IndexSegment

original_code:
static inline index_t IndexSegment(Segments *segments,Segment *segment)
{
 int position1=segment-&segments->cached[0];
 return(segments->incache[position1]);
}

canonical_original_code:
static inline unsigned int IndexSegment(struct _Segments *segments, struct _Segment *segment)
{
 int position1 = segment-&segments->cached[0];
 return(segments->incache[position1]);
}

variable_types: struct _Segments { struct _SegmentsFile { unsigned int number; unsigned int snumber; unsigned int nnumber; } file; int fd; struct _Segment { unsigned int node1; unsigned int node2; unsigned int next2; unsigned int way; unsigned int distance; } cached[3]; unsigned int incache[3]; } *

variable_types:
segment
struct _Segment *

return_type: unsigned int

user_defined_types: struct _Segments { struct _SegmentsFile file; int fd; struct _Segment cached[3]; unsigned int incache[3]; }


decompiled_code:
__int64 __fastcall FirstSegment_internal(__int64 a1, unsigned int a2)
{
return *(unsigned int *)LookupNode(a1, a2, 4);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, unsigned int a2)
{
return *(unsigned int *)func3(a1, a2, 4);
}

original_code:
static inline index_t FirstSegment_internal(Nodes *nodes,index_t index)
{
 Node *node;
 node=LookupNode(nodes,index,4);
 return(node->firstseg);
}

canonical_original_code:
static inline unsigned int FirstSegment_internal(struct _Nodes *nodes, unsigned int index)
{
 struct _Node *node;
 node=LookupNode(nodes,index,4);
 return(node->firstseg);
}

variable_types: struct _Nodes { struct _NodesFile { unsigned int number; unsigned int snumber; short latbins; short lonbins; short latzero; short lonzero; } file; int fd; long nodesoffset; struct _Node { unsigned int firstseg; unsigned short latoffset; unsigned short lonoffset; unsigned short allow; unsigned short flags; } cached[4]; unsigned int incache[4]; } *

variable_types:
index
unsigned int

variable_types: struct _Node { unsigned int firstseg; unsigned short latoffset; unsigned short lonoffset; unsigned short allow; unsigned short flags; } *

user_defined_types: struct _Nodes { struct _NodesFile file; int fd; long nodesoffset; struct _Node cached[4]; unsigned int incache[4]; }


LookupSegment

original_code:
static inline Segment *LookupSegment(Segments *segments,index_t index,int position)
{
 if(segments->incache[position-1]!=index)
   {
    SeekFile(segments->fd,sizeof(SegmentsFile)+(off_t)index*sizeof(Segment));
    ReadFile(segments->fd,&segments->cached[position-1],sizeof(Segment));
    segments->incache[position-1]=index;
   }
 return(&segments->cached[position-1]);
}

canonical_original_code:
static inline struct _Segment *LookupSegment(struct _Segments *segments, unsigned int index, int position)
{
 if(segments->incache[position-1]!=index)
   {
    SeekFile(segments->fd,sizeof(SegmentsFile)+(long)index*sizeof(Segment));
    ReadFile(segments->fd,&segments->cached[position-1],sizeof(Segment));
    segments->incache[position-1]=index;
   }
 return(&segments->cached[position-1]);
}

variable_types: struct _Segments { struct _SegmentsFile { unsigned int number; unsigned int snumber; unsigned int nnumber; } file; int fd; struct _Segment cached[3]; unsigned int incache[3]; } *

variable_types: position int

return_type: struct _Segment { unsigned int node1; unsigned int node2; unsigned int next2; unsigned int way; unsigned int distance; } *


Distance

original_code:
distance_t Distance(double lat1,double lon1,double lat2,double lon2)
{
 double dlon = lon1 - lon2;
 double dlat = lat1 - lat2;
 double a1,a2,a,sa,c,d;
 if(dlon==0 && dlat==0)
   return 0;
 a1 = sin (dlat / 2);
 a2 = sin (dlon / 2);
 a = (a1 * a1) + cos (lat1) * cos (lat2) * a2 * a2;
 sa = sqrt (a);
 if (sa <= 1.0)
   {c = 2 * asin (sa);}
 else
   {c = 2 * asin (1.0);}
 d = 6378.137 * c;
 return ((distance_t)((double)(d)*1000.0));
}

canonical_original_code:
unsigned int Distance(double lat1, double lon1, double lat2, double lon2)
{
 double dlon = lon1 - lon2;
 double dlat = lat1 - lat2;
 double a1; double a2; double a; double sa; double c; double d;
 if(dlon==0 && dlat==0)
   return 0;
 a1 = sin (dlat / 2);
 a2 = sin (dlon / 2);
 a = (a1 * a1) + cos (lat1) * cos (lat2) * a2 * a2;
 sa = sqrt (a);
 if (sa <= 1.0)
   {c = 2 * asin (sa);}
 else
   {c = 2 * asin (1.0);}
 d = 6378.137 * c;
 return ((distance_t)((double)(d)*1000.0));
}

variable_types: dlon double

variable_types: dlat double

variable_types: a double

variable_types: sa double

variable_types: c double

variable_types: d double


Duration

decompiled_code:
__int64 __fastcall Duration(__int64 a1, __int64 a2, __int64 a3)
{
unsigned __int8 v3; // cl
unsigned __int8 v4; // dl
int v5; // eax
unsigned int v6; // ecx
double v8; // xmm1_8

v3 = *(_BYTE *)(a2 + 8);
v4 = *(_BYTE *)((*(_BYTE *)(a2 + 6) & 0x1F) + a3 + 76);
v5 = *(_DWORD *)(a1 + 16) & 0xFFFFFFF;
if ( v3 )
{
if ( v4 )
{
if ( v3 > v4 )
v8 = (double)v4;
else
v8 = (double)v3;
v6 = (int)((double)v5 / v8 * 36.0);
}
else
{
v6 = (int)((double)v5 / (double)v3 * 36.0);
}
}
else
{
v6 = 360000;
if ( v4 )
v6 = (int)((double)v5 / (double)v4 * 36.0);
}
return v6;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 a2, __int64 a3)
{
unsigned __int8 v3; // cl
unsigned __int8 v4; // dl
int v5; // eax
unsigned int v6; // ecx
double v8; // xmm1_8

v3 = *(_BYTE *)(a2 + 8);
v4 = *(_BYTE *)((*(_BYTE *)(a2 + 6) & 0x1F) + a3 + 76);
v5 = *(_DWORD *)(a1 + 16) & 0xFFFFFFF;
if ( v3 )
{
if ( v4 )
{
if ( v3 > v4 )
v8 = (double)v4;
else
v8 = (double)v3;
v6 = (int)((double)v5 / v8 * 36.0);
}
else
{
v6 = (int)((double)v5 / (double)v3 * 36.0);
}
}
else
{
v6 = 360000;
if ( v4 )
v6 = (int)((double)v5 / (double)v4 * 36.0);
}
return v6;
}

original_code:
duration_t Duration(Segment *segment,Way *way,Profile *profile)
{
 speed_t speed1=way->speed;
 speed_t speed2=profile->speed[((way->type)&0x1f)];
 distance_t distance=((distance_t)((segment->distance)&(~(((distance_t)0x80000000)|((distance_t)0x40000000)|((distance_t)0x20000000)|((distance_t)0x10000000)))));
 if(speed1==0)
   {
    if(speed2==0)
       return(((duration_t)((double)(10)*36000.0)));
    else
       return ((duration_t)(((double)(distance)/(double)(speed2))*(36000.0/1000.0)));
   }
 else
   {
    if(speed2==0)
       return ((duration_t)(((double)(distance)/(double)(speed1))*(36000.0/1000.0)));
    else if(speed1<=speed2)
       return ((duration_t)(((double)(distance)/(double)(speed1))*(36000.0/1000.0)));
    else
       return ((duration_t)(((double)(distance)/(double)(speed2))*(36000.0/1000.0)));
   }
}

canonical_original_code:
unsigned int Duration(struct _Segment *segment, struct _Way *way, struct _Profile *profile)
{
 unsigned char speed1 = way->speed;
 unsigned char speed2 = profile->speed[((way->type)&0x1f)];
 unsigned int distance = ((distance_t)((segment->distance)&(~(((distance_t)0x80000000)|((distance_t)0x40000000)|((distance_t)0x20000000)|((distance_t)0x10000000)))));
 if(speed1==0)
   {
    if(speed2==0)
       return(((duration_t)((double)(10)*36000.0)));
    else
       return ((duration_t)(((double)(distance)/(double)(speed2))*(36000.0/1000.0)));
   }
 else
   {
    if(speed2==0)
       return ((duration_t)(((double)(distance)/(double)(speed1))*(36000.0/1000.0)));
    else if(speed1<=speed2)
       return ((duration_t)(((double)(distance)/(double)(speed1))*(36000.0/1000.0)));
    else
       return ((duration_t)(((double)(distance)/(double)(speed2))*(36000.0/1000.0)));
   }
}

variable_types: struct _Segment { unsigned int node1; unsigned int node2; unsigned int next2; unsigned int way; unsigned int distance; } *

variable_types: struct _Way { unsigned int name; unsigned short allow; unsigned char type; unsigned char props; unsigned char speed; unsigned char weight; unsigned char height; unsigned char width; unsigned char length; } *

variable_types: struct _Profile { char *name; enum _Transport { Transport_None=0, Transport_Foot=1, Transport_Horse=2, Transport_Wheelchair=3, Transport_Bicycle=4, Transport_Moped=5, Transport_Motorbike=6, Transport_Motorcar=7, Transport_Goods=8, Transport_HGV=9, Transport_PSV=10, Transport_Count=11 } transport; unsigned short allow; float highway[-1]; float max_pref; unsigned char speed[-1]; unsigned char max_speed; float props_yes[-1]; float props_no[-1]; int oneway; int turns; unsigned char weight; unsigned char height; unsigned char width; unsigned char length; } *

variable_types:
distance
unsigned int


TurnAngle

decompiled_code:
double __fastcall TurnAngle(__int64 a1, unsigned int *a2, unsigned int *a3, unsigned int a4)
{
__int64 v6; // rdi
unsigned int v7; // er12
double v8; // rbx
double v9; // xmm0_8
double v10; // rbx
double v11; // rbp
double v12; // xmm1_8
double result; // xmm0_8
double v14; // [rsp+0h] [rbp-48h] BYREF
double v15; // [rsp+8h] [rbp-40h] BYREF
double v16; // [rsp+10h] [rbp-38h] BYREF
double v17; // [rsp+18h] [rbp-30h] BYREF
double x; // [rsp+20h] [rbp-28h] BYREF
__int64 v19[4]; // [rsp+28h] [rbp-20h] BYREF

v6 = *a2;
if ( (_DWORD)v6 == a4 )
v6 = a2[1];
v7 = *a3;
if ( *a3 == a4 )
v7 = a3[1];
if ( (unsigned int)(v6 + 0x10000) > 0xFFFE )
GetLatLong(a1, (unsigned int)v6, v19, &v16);
else
GetFakeLatLong(v6, v19, &v16);
if ( a4 + 0x10000 > 0xFFFE )
GetLatLong(a1, a4, &x, &v15);
else
GetFakeLatLong(a4, &x, &v15);
if ( v7 + 0x10000 > 0xFFFE )
GetLatLong(a1, v7, &v17, &v14);
else
GetFakeLatLong(v7, &v17, &v14);
v8 = x;
v9 = cos(x);
v10 = atan2((v15 - v16) * v9, v8 - *(double *)v19);
v11 = x;
v12 = cos(x);
result = (atan2((v14 - v15) * v12, v17 - v11) - v10) * 57.29577951308232;
if ( result < -180.0 )
result = result + 360.0;
if ( result > 180.0 )
result = result - 360.0;
return result;
}

canonical_decompiled_code:
double __fastcall func9(__int64 a1, unsigned int *a2, unsigned int *a3, unsigned int a4)
{
__int64 v6; // rdi
unsigned int v7; // er12
double v8; // rbx
double v9; // xmm0_8
double v10; // rbx
double v11; // rbp
double v12; // xmm1_8
double result; // xmm0_8
double v14; // [rsp+0h] [rbp-48h] BYREF
double v15; // [rsp+8h] [rbp-40h] BYREF
double v16; // [rsp+10h] [rbp-38h] BYREF
double v17; // [rsp+18h] [rbp-30h] BYREF
double x; // [rsp+20h] [rbp-28h] BYREF
__int64 v19[4]; // [rsp+28h] [rbp-20h] BYREF

v6 = *a2;
if ( (_DWORD)v6 == a4 )
v6 = a2[1];
v7 = *a3;
if ( *a3 == a4 )
v7 = a3[1];
if ( (unsigned int)(v6 + 0x10000) > 0xFFFE )
GetLatLong(a1, (unsigned int)v6, v19, &v16);
else
GetFakeLatLong(v6, v19, &v16);
if ( a4 + 0x10000 > 0xFFFE )
GetLatLong(a1, a4, &x, &v15);
else
GetFakeLatLong(a4, &x, &v15);
if ( v7 + 0x10000 > 0xFFFE )
GetLatLong(a1, v7, &v17, &v14);
else
GetFakeLatLong(v7, &v17, &v14);
v8 = x;
v9 = cos(x);
v10 = atan2((v15 - v16) * v9, v8 - *(double *)v19);
v11 = x;
v12 = cos(x);
result = (atan2((v14 - v15) * v12, v17 - v11) - v10) * 57.29577951308232;
if ( result < -180.0 )
result = result + 360.0;
if ( result > 180.0 )
result = result - 360.0;
return result;
}

original_code:
double TurnAngle(Nodes *nodes,Segment *segment1,Segment *segment2,index_t node)
{
 double lat1,latm,lat2;
 double lon1,lonm,lon2;
 double angle1,angle2,angle;
 index_t node1,node2;
 node1=((segment1)->node1==(node)?(segment1)->node2:(segment1)->node1);
 node2=((segment2)->node1==(node)?(segment2)->node2:(segment2)->node1);
 if(((node1)>=((index_t)0xffff0000) && (node1)!=(~(index_t)0)))
    GetFakeLatLong(node1,&lat1,&lon1);
 else
    GetLatLong(nodes,node1,&lat1,&lon1);
 if(((node)>=((index_t)0xffff0000) && (node)!=(~(index_t)0)))
    GetFakeLatLong(node,&latm,&lonm);
 else
    GetLatLong(nodes,node,&latm,&lonm);
 if(((node2)>=((index_t)0xffff0000) && (node2)!=(~(index_t)0)))
    GetFakeLatLong(node2,&lat2,&lon2);
 else
    GetLatLong(nodes,node2,&lat2,&lon2);
 angle1=atan2((lonm-lon1)*cos(latm),(latm-lat1));
 angle2=atan2((lon2-lonm)*cos(latm),(lat2-latm));
 angle=angle2-angle1;
 angle=((angle)*(180.0/3.14159265358979323846));
 if(angle<-180) angle+=360;
 if(angle> 180) angle-=360;
 return(angle);
}

canonical_original_code:
double TurnAngle(struct _Nodes *nodes, struct _Segment *segment1, struct _Segment *segment2, unsigned int node)
{
 double lat1; double latm; double lat2;
 double lon1; double lonm; double lon2;
 double angle1; double angle2; double angle;
 unsigned int node1; unsigned int node2;
 node1=((segment1)->node1==(node)?(segment1)->node2:(segment1)->node1);
 node2=((segment2)->node1==(node)?(segment2)->node2:(segment2)->node1);
 if(((node1)>=((unsigned int)0xffff0000) && (node1)!=(~(unsigned int)0)))
    GetFakeLatLong(node1,&lat1,&lon1);
 else
    GetLatLong(nodes,node1,&lat1,&lon1);
 if(((node)>=((unsigned int)0xffff0000) && (node)!=(~(unsigned int)0)))
    GetFakeLatLong(node,&latm,&lonm);
 else
    GetLatLong(nodes,node,&latm,&lonm);
 if(((node2)>=((unsigned int)0xffff0000) && (node2)!=(~(unsigned int)0)))
    GetFakeLatLong(node2,&lat2,&lon2);
 else
    GetLatLong(nodes,node2,&lat2,&lon2);
 angle1=atan2((lonm-lon1)*cos(latm),(latm-lat1));
 angle2=atan2((lon2-lonm)*cos(latm),(lat2-latm));
 angle=angle2-angle1;
 angle=((angle)*(180.0/3.14159265358979323846));
 if(angle<-180) angle+=360;
 if(angle> 180) angle-=360;
 return(angle);
}

variable_types: struct _Nodes { struct _NodesFile { unsigned int number; unsigned int snumber; short latbins; short lonbins; short latzero; short lonzero; } file; void *data; unsigned int *offsets; struct _Node { unsigned int firstseg; unsigned short latoffset; unsigned short lonoffset; unsigned short allow; unsigned short flags; } *nodes; } *

variable_types:
node
unsigned int

variable_types: latm double

variable_types: lonm double

variable_types: angle double

return_type: double

user_defined_types: struct _Nodes { struct _NodesFile file; void *data; unsigned int *offsets; struct _Node *nodes; }

user_defined_types: struct _Segment { unsigned int node1; unsigned int node2; unsigned int next2; unsigned int way; unsigned int distance; }


BearingAngle

decompiled_code:
double __fastcall BearingAngle(__int64 a1, unsigned int *a2, unsigned int a3)
{
unsigned int v3; // ebx
double v4; // rbx
double v5; // xmm0_8
double result; // xmm0_8
double v7; // [rsp+0h] [rbp-38h] BYREF
double v8; // [rsp+8h] [rbp-30h] BYREF
double v9; // [rsp+10h] [rbp-28h] BYREF
double x[4]; // [rsp+18h] [rbp-20h] BYREF

v3 = *a2;
if ( *a2 == a3 )
v3 = a2[1];
if ( a3 + 0x10000 > 0xFFFE )
GetLatLong(a1, a3, x, &v8);
else
GetFakeLatLong(a3, x, &v8);
if ( v3 + 0x10000 > 0xFFFE )
GetLatLong(a1, v3, &v9, &v7);
else
GetFakeLatLong(v3, &v9, &v7);
v4 = x[0];
v5 = cos(x[0]);
result = 270.0 - atan2(v9 - v4, (v7 - v8) * v5) * 57.29577951308232;
if ( result < 0.0 )
result = result + 360.0;
if ( result > 360.0 )
result = result - 360.0;
return result;
}

canonical_decompiled_code:
double __fastcall func10(__int64 a1, unsigned int *a2, unsigned int a3)
{
unsigned int v3; // ebx
double v4; // rbx
double v5; // xmm0_8
double result; // xmm0_8
double v7; // [rsp+0h] [rbp-38h] BYREF
double v8; // [rsp+8h] [rbp-30h] BYREF
double v9; // [rsp+10h] [rbp-28h] BYREF
double x[4]; // [rsp+18h] [rbp-20h] BYREF

v3 = *a2;
if ( *a2 == a3 )
v3 = a2[1];
if ( a3 + 0x10000 > 0xFFFE )
GetLatLong(a1, a3, x, &v8);
else
GetFakeLatLong(a3, x, &v8);
if ( v3 + 0x10000 > 0xFFFE )
GetLatLong(a1, v3, &v9, &v7);
else
GetFakeLatLong(v3, &v9, &v7);
v4 = x[0];
v5 = cos(x[0]);
result = 270.0 - atan2(v9 - v4, (v7 - v8) * v5) * 57.29577951308232;
if ( result < 0.0 )
result = result + 360.0;
if ( result > 360.0 )
result = result - 360.0;
return result;
}

original_code:
double BearingAngle(Nodes *nodes,Segment *segment,index_t node)
{
 double lat1,lat2;
 double lon1,lon2;
 double angle;
 index_t node1,node2;
 node1=node;
 node2=((segment)->node1==(node)?(segment)->node2:(segment)->node1);
 if(((node1)>=((index_t)0xffff0000) && (node1)!=(~(index_t)0)))
    GetFakeLatLong(node1,&lat1,&lon1);
 else
    GetLatLong(nodes,node1,&lat1,&lon1);
 if(((node2)>=((index_t)0xffff0000) && (node2)!=(~(index_t)0)))
    GetFakeLatLong(node2,&lat2,&lon2);
 else
    GetLatLong(nodes,node2,&lat2,&lon2);
 angle=atan2((lat2-lat1),(lon2-lon1)*cos(lat1));
 angle=((angle)*(180.0/3.14159265358979323846));
 angle=270-angle;
 if(angle< 0) angle+=360;
 if(angle>360) angle-=360;
 return(angle);
}

canonical_original_code:
double BearingAngle(struct _Nodes *nodes, struct _Segment *segment, unsigned int node)
{
 double lat1; double lat2;
 double lon1; double lon2;
 double angle;
 unsigned int node1; unsigned int node2;
 node1=node;
 node2=((segment)->node1==(node)?(segment)->node2:(segment)->node1);
 if(((node1)>=((unsigned int)0xffff0000) && (node1)!=(~(unsigned int)0)))
    GetFakeLatLong(node1,&lat1,&lon1);
 else
    GetLatLong(nodes,node1,&lat1,&lon1);
 if(((node2)>=((unsigned int)0xffff0000) && (node2)!=(~(unsigned int)0)))
    GetFakeLatLong(node2,&lat2,&lon2);
 else
    GetLatLong(nodes,node2,&lat2,&lon2);
 angle=atan2((lat2-lat1),(lon2-lon1)*cos(lat1));
 angle=((angle)*(180.0/3.14159265358979323846));
 angle=270-angle;
 if(angle< 0) angle+=360;
 if(angle>360) angle-=360;
 return(angle);
}

user_defined_types: struct _NodesFile { unsigned int number; unsigned int snumber; short latbins; short lonbins; short latzero; short lonzero; }

user_defined_types: struct _Node { unsigned int firstseg; unsigned short latoffset; unsigned short lonoffset; unsigned short allow; unsigned short flags; }


WaysCompare

decompiled_code:
__int64 __fastcall WaysCompare(__int64 a1, __int64 a2)
{
unsigned __int8 v2; // al
unsigned __int8 v3; // dl
__int64 result; // rax
unsigned __int16 v5; // ax
unsigned __int16 v6; // dx
unsigned __int8 v7; // al
unsigned __int8 v8; // dl
unsigned __int8 v9; // al
unsigned __int8 v10; // dl
unsigned __int8 v11; // al
unsigned __int8 v12; // dl
unsigned __int8 v13; // al
unsigned __int8 v14; // dl
unsigned __int8 v15; // al
unsigned __int8 v16; // dl
unsigned __int8 v17; // cl
unsigned __int8 v18; // dl

if ( a1 == a2 )
return 0LL;
v2 = *(_BYTE *)(a1 + 6);
v3 = *(_BYTE *)(a2 + 6);
if ( v2 != v3 )
return v2 - (unsigned int)v3;
v5 = *(_WORD *)(a1 + 4);
v6 = *(_WORD *)(a2 + 4);
if ( v5 != v6 )
return v5 - (unsigned int)v6;
v7 = *(_BYTE *)(a1 + 7);
v8 = *(_BYTE *)(a2 + 7);
if ( v7 != v8 )
return v7 - (unsigned int)v8;
v9 = *(_BYTE *)(a1 + 8);
v10 = *(_BYTE *)(a2 + 8);
if ( v9 != v10 )
return v9 - (unsigned int)v10;
v11 = *(_BYTE *)(a1 + 9);
v12 = *(_BYTE *)(a2 + 9);
if ( v11 != v12 )
return v11 - (unsigned int)v12;
v13 = *(_BYTE *)(a1 + 10);
v14 = *(_BYTE *)(a2 + 10);
if ( v13 != v14 )
return v13 - (unsigned int)v14;
v15 = *(_BYTE *)(a1 + 11);
v16 = *(_BYTE *)(a2 + 11);
if ( v15 != v16 )
return v15 - (unsigned int)v16;
v17 = *(_BYTE *)(a1 + 12);
v18 = *(_BYTE *)(a2 + 12);
result = 0LL;
if ( v17 != v18 )
result = v17 - (unsigned int)v18;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
unsigned __int8 v2; // al
unsigned __int8 v3; // dl
__int64 result; // rax
unsigned __int16 v5; // ax
unsigned __int16 v6; // dx
unsigned __int8 v7; // al
unsigned __int8 v8; // dl
unsigned __int8 v9; // al
unsigned __int8 v10; // dl
unsigned __int8 v11; // al
unsigned __int8 v12; // dl
unsigned __int8 v13; // al
unsigned __int8 v14; // dl
unsigned __int8 v15; // al
unsigned __int8 v16; // dl
unsigned __int8 v17; // cl
unsigned __int8 v18; // dl

if ( a1 == a2 )
return 0LL;
v2 = *(_BYTE *)(a1 + 6);
v3 = *(_BYTE *)(a2 + 6);
if ( v2 != v3 )
return v2 - (unsigned int)v3;
v5 = *(_WORD *)(a1 + 4);
v6 = *(_WORD *)(a2 + 4);
if ( v5 != v6 )
return v5 - (unsigned int)v6;
v7 = *(_BYTE *)(a1 + 7);
v8 = *(_BYTE *)(a2 + 7);
if ( v7 != v8 )
return v7 - (unsigned int)v8;
v9 = *(_BYTE *)(a1 + 8);
v10 = *(_BYTE *)(a2 + 8);
if ( v9 != v10 )
return v9 - (unsigned int)v10;
v11 = *(_BYTE *)(a1 + 9);
v12 = *(_BYTE *)(a2 + 9);
if ( v11 != v12 )
return v11 - (unsigned int)v12;
v13 = *(_BYTE *)(a1 + 10);
v14 = *(_BYTE *)(a2 + 10);
if ( v13 != v14 )
return v13 - (unsigned int)v14;
v15 = *(_BYTE *)(a1 + 11);
v16 = *(_BYTE *)(a2 + 11);
if ( v15 != v16 )
return v15 - (unsigned int)v16;
v17 = *(_BYTE *)(a1 + 12);
v18 = *(_BYTE *)(a2 + 12);
result = 0LL;
if ( v17 != v18 )
result = v17 - (unsigned int)v18;
return result;
}

original_code:
int WaysCompare(Way *way1,Way *way2)
{
 if(way1==way2)
    return(0);
 if(way1->type!=way2->type)
    return((int)way1->type - (int)way2->type);
 if(way1->allow!=way2->allow)
    return((int)way1->allow - (int)way2->allow);
 if(way1->props!=way2->props)
    return((int)way1->props - (int)way2->props);
 if(way1->speed!=way2->speed)
    return((int)way1->speed - (int)way2->speed);
 if(way1->weight!=way2->weight)
    return((int)way1->weight - (int)way2->weight);
 if(way1->height!=way2->height)
    return((int)way1->height - (int)way2->height);
 if(way1->width!=way2->width)
    return((int)way1->width - (int)way2->width);
 if(way1->length!=way2->length)
    return((int)way1->length - (int)way2->length);
 return(0);
}

canonical_original_code:
int WaysCompare(struct _Way *way1, struct _Way *way2)
{
 if(way1==way2)
    return(0);
 if(way1->type!=way2->type)
    return((int)way1->type - (int)way2->type);
 if(way1->allow!=way2->allow)
    return((int)way1->allow - (int)way2->allow);
 if(way1->props!=way2->props)
    return((int)way1->props - (int)way2->props);
 if(way1->speed!=way2->speed)
    return((int)way1->speed - (int)way2->speed);
 if(way1->weight!=way2->weight)
    return((int)way1->weight - (int)way2->weight);
 if(way1->height!=way2->height)
    return((int)way1->height - (int)way2->height);
 if(way1->width!=way2->width)
    return((int)way1->width - (int)way2->width);
 if(way1->length!=way2->length)
    return((int)way1->length - (int)way2->length);
 return(0);
}

user_defined_types: struct _Way { unsigned int name; unsigned short allow; unsigned char type; unsigned char props; unsigned char speed; unsigned char weight; unsigned char height; unsigned char width; unsigned char length; }


FileName

decompiled_code:
char *__fastcall FileName(const char *a1, const char *a2, const char *a3)
{
const char *v3; // rbx
const char *v4; // rbp
size_t v6; // r12
size_t v7; // r14
size_t v8; // rax
char *v9; // r12
const char *v10; // r9
const char *v11; // rcx
size_t v13; // rax

v3 = a1;
v4 = a2;
v6 = 1LL;
if ( a1 )
v6 = strlen(a1) + 1;
if ( a2 )
{
v7 = strlen(a2);
v8 = strlen(a3);
v9 = (char *)malloc(v8 + v6 + v7 + 2);
v10 = (const char *)&unk_530;
}
else
{
v13 = strlen(a3);
v9 = (char *)malloc(v6 + v13 + 2);
v10 = (const char *)&unk_532;
v4 = (const char *)&unk_532;
}
v11 = (const char *)&unk_533;
if ( !a1 )
{
v11 = (const char *)&unk_532;
v3 = (const char *)&unk_532;
}
sprintf(v9, "%s%s%s%s%s", v3, v11, v4, v10, a3);
return v9;
}

canonical_decompiled_code:
char *__fastcall func0(const char *a1, const char *a2, const char *a3)
{
const char *v3; // rbx
const char *v4; // rbp
size_t v6; // r12
size_t v7; // r14
size_t v8; // rax
char *v9; // r12
const char *v10; // r9
const char *v11; // rcx
size_t v13; // rax

v3 = a1;
v4 = a2;
v6 = 1LL;
if ( a1 )
v6 = strlen(a1) + 1;
if ( a2 )
{
v7 = strlen(a2);
v8 = strlen(a3);
v9 = (char *)malloc(v8 + v6 + v7 + 2);
v10 = (const char *)&unk_530;
}
else
{
v13 = strlen(a3);
v9 = (char *)malloc(v6 + v13 + 2);
v10 = (const char *)&unk_532;
v4 = (const char *)&unk_532;
}
v11 = (const char *)&unk_533;
if ( !a1 )
{
v11 = (const char *)&unk_532;
v3 = (const char *)&unk_532;
}
sprintf(v9, "%s%s%s%s%s", v3, v11, v4, v10, a3);
return v9;
}

original_code:
char *FileName(const char *dirname,const char *prefix, const char *name)
{
 char *filename=(char*)malloc((dirname?strlen(dirname):0)+1+(prefix?strlen(prefix):0)+1+strlen(name)+1);
 sprintf(filename,"%s%s%s%s%s",dirname?dirname:"",dirname?"/":"",prefix?prefix:"",prefix?"-":"",name);
 return(filename);
}

canonical_original_code:
char *FileName(char *dirname, char *prefix, char *name)
{
 char *filename = (char*)malloc((dirname?strlen(dirname):0)+1+(prefix?strlen(prefix):0)+1+strlen(name)+1);
 sprintf(filename,"%s%s%s%s%s",dirname?dirname:"",dirname?"/":"",prefix?prefix:"",prefix?"-":"",name);
 return(filename);
}

variable_types:
dirname
char *

variable_types:
prefix
char *

variable_types:
name
char *

variable_types:
filename
char *

return_type: char *


UnmapFile

decompiled_code:
__int64 __fastcall UnmapFile(char *s2)
{
int v1; // er13
const char **v2; // rbp
int v3; // ebx
__int64 v4; // rbp
char *v5; // r13
char *v6; // r12
int v7; // eax

v1 = nmappedfiles;
if ( nmappedfiles <= 0 )
{
v3 = 0;
}
else
{
v2 = (const char **)mappedfiles;
v3 = 0;
while ( strcmp(*v2, s2) )
{
++v3;
v2 += 4;
if ( v1 == v3 )
goto LABEL_5;
}
}
if ( v1 == v3 )
{
LABEL_5:
fprintf(stderr, "The file '%s' was not mapped using MapFile().\n", s2);
exit(1);
}
v4 = 32LL * v3;
close(*(_DWORD *)((char *)mappedfiles + v4 + 8));
v5 = (char *)mappedfiles;
v6 = (char *)mappedfiles + v4;
munmap(*(void **)((char *)mappedfiles + v4 + 16), *(_QWORD *)((char *)mappedfiles + v4 + 24));
v7 = nmappedfiles - 1;
nmappedfiles = v7;
if ( v7 > v3 )
memmove(v6, &v5[v4 + 32], 32LL * (v7 - v3));
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(char *s2)
{
int v1; // er13
const char **v2; // rbp
int v3; // ebx
__int64 v4; // rbp
char *v5; // r13
char *v6; // r12
int v7; // eax

v1 = nmappedfiles;
if ( nmappedfiles <= 0 )
{
v3 = 0;
}
else
{
v2 = (const char **)mappedfiles;
v3 = 0;
while ( strcmp(*v2, s2) )
{
++v3;
v2 += 4;
if ( v1 == v3 )
goto LABEL_5;
}
}
if ( v1 == v3 )
{
LABEL_5:
fprintf(stderr, "The file '%s' was not mapped using MapFile().\n", s2);
exit(1);
}
v4 = 32LL * v3;
close(*(_DWORD *)((char *)mappedfiles + v4 + 8));
v5 = (char *)mappedfiles;
v6 = (char *)mappedfiles + v4;
munmap(*(void **)((char *)mappedfiles + v4 + 16), *(_QWORD *)((char *)mappedfiles + v4 + 24));
v7 = nmappedfiles - 1;
nmappedfiles = v7;
if ( v7 > v3 )
memmove(v6, &v5[v4 + 32], 32LL * (v7 - v3));
return 0LL;
}

original_code:
void *UnmapFile(const char *filename)
{
 int i;
 for(i=0;i<nmappedfiles;i++)
    if(!strcmp(mappedfiles[i].filename,filename))
       break;
 if(i==nmappedfiles)
   {
    fprintf(stderr,"The file '%s' was not mapped using MapFile().\n",filename);
    exit(1);
   }
 close(mappedfiles[i].fd);
 munmap(mappedfiles[i].address,mappedfiles[i].length);
 nmappedfiles--;
 if(nmappedfiles>i)
    memmove(&mappedfiles[i],&mappedfiles[i+1],(nmappedfiles-i)*sizeof(struct mmapinfo));
 return(((void *)0));
}

canonical_original_code:
void *UnmapFile(char *filename)
{
 int i;
 for(i=0;i<nmappedfiles;i++)
    if(!strcmp(mappedfiles[i].filename,filename))
       break;
 if(i==nmappedfiles)
   {
    fprintf(stderr,"The file '%s' was not mapped using MapFile().\n",filename);
    exit(1);
   }
 close(mappedfiles[i].fd);
 munmap(mappedfiles[i].address,mappedfiles[i].length);
 nmappedfiles--;
 if(nmappedfiles>i)
    memmove(&mappedfiles[i],&mappedfiles[i+1],(nmappedfiles-i)*sizeof(struct mmapinfo));
 return(((void *)0));
}

variable_types: i int

return_type: void *

user_defined_types: struct mmapinfo { char *filename; int fd; void *address; unsigned long length; }


OpenFileNew

decompiled_code:
int __fastcall OpenFileNew(const char *a1)
{
int result; // eax
int *v2; // rax
char *v3; // rax

result = open64(a1, 578, 420LL);
if ( result < 0 )
{
v2 = _errno_location();
v3 = strerror(*v2);
fprintf(stderr, "Cannot open file '%s' for writing [%s].\n", a1, v3);
exit(1);
}
return result;
}

canonical_decompiled_code:
int __fastcall func2(const char *a1)
{
int result; // eax
int *v2; // rax
char *v3; // rax

result = open64(a1, 578, 420LL);
if ( result < 0 )
{
v2 = _errno_location();
v3 = strerror(*v2);
fprintf(stderr, "Cannot open file '%s' for writing [%s].\n", a1, v3);
exit(1);
}
return result;
}

original_code:
int OpenFileNew(const char *filename)
{
 int fd;
 fd=open(filename,02|0100|01000,0400|0200|(0400 >> 3)|((0400 >> 3) >> 3));
 if(fd<0)
   {
    fprintf(stderr,"Cannot open file '%s' for writing [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 return(fd);
}

canonical_original_code:
int OpenFileNew(char *filename)
{
 int fd;
 fd=open(filename,02|0100|01000,0400|0200|(0400 >> 3)|((0400 >> 3) >> 3));
 if(fd<0)
   {
    fprintf(stderr,"Cannot open file '%s' for writing [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 return(fd);
}

variable_types: fd int


OpenFileAppend

decompiled_code:
int __fastcall OpenFileAppend(const char *a1)
{
int result; // eax
int *v2; // rax
char *v3; // rax

result = open64(a1, 1090, 420LL);
if ( result < 0 )
{
v2 = _errno_location();
v3 = strerror(*v2);
fprintf(stderr, "Cannot open file '%s' for appending [%s].\n", a1, v3);
exit(1);
}
return result;
}

canonical_decompiled_code:
int __fastcall func3(const char *a1)
{
int result; // eax
int *v2; // rax
char *v3; // rax

result = open64(a1, 1090, 420LL);
if ( result < 0 )
{
v2 = _errno_location();
v3 = strerror(*v2);
fprintf(stderr, "Cannot open file '%s' for appending [%s].\n", a1, v3);
exit(1);
}
return result;
}

original_code:
int OpenFileAppend(const char *filename)
{
 int fd;
 fd=open(filename,02|0100|02000,0400|0200|(0400 >> 3)|((0400 >> 3) >> 3));
 if(fd<0)
   {
    fprintf(stderr,"Cannot open file '%s' for appending [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 return(fd);
}

canonical_original_code:
int OpenFileAppend(char *filename)
{
 int fd;
 fd=open(filename,02|0100|02000,0400|0200|(0400 >> 3)|((0400 >> 3) >> 3));
 if(fd<0)
   {
    fprintf(stderr,"Cannot open file '%s' for appending [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 return(fd);
}


ReOpenFile

decompiled_code:
int __fastcall ReOpenFile(const char *a1)
{
int result; // eax
int *v2; // rax
char *v3; // rax

result = open64(a1, 0);
if ( result < 0 )
{
v2 = _errno_location();
v3 = strerror(*v2);
fprintf(stderr, "Cannot open file '%s' for reading [%s].\n", a1, v3);
exit(1);
}
return result;
}

canonical_decompiled_code:
int __fastcall func4(const char *a1)
{
int result; // eax
int *v2; // rax
char *v3; // rax

result = open64(a1, 0);
if ( result < 0 )
{
v2 = _errno_location();
v3 = strerror(*v2);
fprintf(stderr, "Cannot open file '%s' for reading [%s].\n", a1, v3);
exit(1);
}
return result;
}

original_code:
int ReOpenFile(const char *filename)
{
 int fd;
 fd=open(filename,00);
 if(fd<0)
   {
    fprintf(stderr,"Cannot open file '%s' for reading [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 return(fd);
}

canonical_original_code:
int ReOpenFile(char *filename)
{
 int fd;
 fd=open(filename,00);
 if(fd<0)
   {
    fprintf(stderr,"Cannot open file '%s' for reading [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 return(fd);
}


ReOpenFileWriteable

decompiled_code:
int __fastcall ReOpenFileWriteable(const char *a1)
{
int result; // eax
int *v2; // rax
char *v3; // rax

result = open64(a1, 2);
if ( result < 0 )
{
v2 = _errno_location();
v3 = strerror(*v2);
fprintf(stderr, "Cannot open file '%s' for reading and writing [%s].\n", a1, v3);
exit(1);
}
return result;
}

canonical_decompiled_code:
int __fastcall func5(const char *a1)
{
int result; // eax
int *v2; // rax
char *v3; // rax

result = open64(a1, 2);
if ( result < 0 )
{
v2 = _errno_location();
v3 = strerror(*v2);
fprintf(stderr, "Cannot open file '%s' for reading and writing [%s].\n", a1, v3);
exit(1);
}
return result;
}

original_code:
int ReOpenFileWriteable(const char *filename)
{
 int fd;
 fd=open(filename,02);
 if(fd<0)
   {
    fprintf(stderr,"Cannot open file '%s' for reading and writing [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 return(fd);
}

canonical_original_code:
int ReOpenFileWriteable(char *filename)
{
 int fd;
 fd=open(filename,02);
 if(fd<0)
   {
    fprintf(stderr,"Cannot open file '%s' for reading and writing [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 return(fd);
}


SizeFile

decompiled_code:
__off_t __fastcall SizeFile(const char *a1)
{
int *v2; // rax
char *v3; // rax
struct stat64 v4; // [rsp+0h] [rbp-98h] BYREF

if ( stat64(a1, &v4) )
{
v2 = _errno_location();
v3 = strerror(*v2);
fprintf(stderr, "Cannot stat file '%s' [%s].\n", a1, v3);
exit(1);
}
return v4.st_size;
}

canonical_decompiled_code:
__off_t __fastcall func6(const char *a1)
{
int *v2; // rax
char *v3; // rax
struct stat64 v4; // [rsp+0h] [rbp-98h] BYREF

if ( stat64(a1, &v4) )
{
v2 = _errno_location();
v3 = strerror(*v2);
fprintf(stderr, "Cannot stat file '%s' [%s].\n", a1, v3);
exit(1);
}
return v4.st_size;
}

original_code:
off_t SizeFile(const char *filename)
{
 struct stat buf;
 if(stat(filename,&buf))
   {
    fprintf(stderr,"Cannot stat file '%s' [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 return(buf.st_size);
}

canonical_original_code:
long SizeFile(char *filename)
{
 struct stat buf;
 if(stat(filename,&buf))
   {
    fprintf(stderr,"Cannot stat file '%s' [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 return(buf.st_size);
}

variable_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; long st_atime; unsigned long st_atimensec; long st_mtime; unsigned long st_mtimensec; long st_ctime; unsigned long st_ctimensec; long __glibc_reserved[3]; }

return_type: long


MapFile

decompiled_code:
void *__fastcall MapFile(const char *a1)
{
int v1; // er12
__off_t v2; // r13
void *v3; // rax
void *v4; // rbp
int v5; // er14
size_t v6; // r15
char *v7; // rax
int *v9; // rax
char *v10; // rax

v1 = ReOpenFile(a1);
v2 = SizeFile(a1);
v3 = mmap64(0LL, v2, 1, 1, v1, 0LL);
if ( v3 == (void *)-1LL )
{
close(v1);
v9 = _errno_location();
v10 = strerror(*v9);
fprintf(stderr, "Cannot mmap file '%s' for reading [%s].\n", a1, v10);
exit(1);
}
v4 = v3;
v5 = nmappedfiles + 1;
v6 = 32LL * (nmappedfiles + 1);
mappedfiles = realloc(mappedfiles, v6);
v7 = (char *)mappedfiles + v6 - 32;
*(_QWORD *)v7 = a1;
*((_DWORD *)v7 + 2) = v1;
*((_QWORD *)v7 + 2) = v4;
*((_QWORD *)v7 + 3) = v2;
nmappedfiles = v5;
return v4;
}

canonical_decompiled_code:
void *__fastcall func7(const char *a1)
{
int v1; // er12
__off_t v2; // r13
void *v3; // rax
void *v4; // rbp
int v5; // er14
size_t v6; // r15
char *v7; // rax
int *v9; // rax
char *v10; // rax

v1 = func4(a1);
v2 = func6(a1);
v3 = mmap64(0LL, v2, 1, 1, v1, 0LL);
if ( v3 == (void *)-1LL )
{
close(v1);
v9 = _errno_location();
v10 = strerror(*v9);
fprintf(stderr, "Cannot mmap file '%s' for reading [%s].\n", a1, v10);
exit(1);
}
v4 = v3;
v5 = nmappedfiles + 1;
v6 = 32LL * (nmappedfiles + 1);
mappedfiles = realloc(mappedfiles, v6);
v7 = (char *)mappedfiles + v6 - 32;
*(_QWORD *)v7 = a1;
*((_DWORD *)v7 + 2) = v1;
*((_QWORD *)v7 + 2) = v4;
*((_QWORD *)v7 + 3) = v2;
nmappedfiles = v5;
return v4;
}

original_code:
void *MapFile(const char *filename)
{
 int fd;
 off_t size;
 void *address;
 fd=ReOpenFile(filename);
 size=SizeFile(filename);
 address=mmap(((void *)0),size,0x1,0x01,fd,0);
 if(address==((void *) -1))
   {
    close(fd);
    fprintf(stderr,"Cannot mmap file '%s' for reading [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 mappedfiles=(struct mmapinfo*)realloc((void*)mappedfiles,(nmappedfiles+1)*sizeof(struct mmapinfo));
 mappedfiles[nmappedfiles].filename=filename;
 mappedfiles[nmappedfiles].fd=fd;
 mappedfiles[nmappedfiles].address=address;
 mappedfiles[nmappedfiles].length=size;
 nmappedfiles++;
 return(address);
}

canonical_original_code:
void *MapFile(char *filename)
{
 int fd;
 long size;
 void *address;
 fd=ReOpenFile(filename);
 size=SizeFile(filename);
 address=mmap(((void *)0),size,0x1,0x01,fd,0);
 if(address==((void *) -1))
   {
    close(fd);
    fprintf(stderr,"Cannot mmap file '%s' for reading [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 mappedfiles=(struct mmapinfo *)realloc((void *)mappedfiles,(nmappedfiles+1)*sizeof(struct mmapinfo));
 mappedfiles[nmappedfiles].filename=filename;
 mappedfiles[nmappedfiles].fd=fd;
 mappedfiles[nmappedfiles].address=address;
 mappedfiles[nmappedfiles].length=size;
 nmappedfiles++;
 return(address);
}

variable_types: size long

variable_types:
address
void *


MapFileWriteable

decompiled_code:
void *__fastcall MapFileWriteable(const char *a1)
{
int v1; // er12
__off_t v2; // r13
void *v3; // rax
void *v4; // rbp
int v5; // er14
size_t v6; // r15
char *v7; // rax
int *v9; // rax
char *v10; // rax

v1 = ReOpenFileWriteable(a1);
v2 = SizeFile(a1);
v3 = mmap64(0LL, v2, 3, 1, v1, 0LL);
if ( v3 == (void *)-1LL )
{
close(v1);
v9 = _errno_location();
v10 = strerror(*v9);
fprintf(stderr, "Cannot mmap file '%s' for reading and writing [%s].\n", a1, v10);
exit(1);
}
v4 = v3;
v5 = nmappedfiles + 1;
v6 = 32LL * (nmappedfiles + 1);
mappedfiles = realloc(mappedfiles, v6);
v7 = (char *)mappedfiles + v6 - 32;
*(_QWORD *)v7 = a1;
*((_DWORD *)v7 + 2) = v1;
*((_QWORD *)v7 + 2) = v4;
*((_QWORD *)v7 + 3) = v2;
nmappedfiles = v5;
return v4;
}

canonical_decompiled_code:
void *__fastcall func8(const char *a1)
{
int v1; // er12
__off_t v2; // r13
void *v3; // rax
void *v4; // rbp
int v5; // er14
size_t v6; // r15
char *v7; // rax
int *v9; // rax
char *v10; // rax

v1 = func5(a1);
v2 = func6(a1);
v3 = mmap64(0LL, v2, 3, 1, v1, 0LL);
if ( v3 == (void *)-1LL )
{
close(v1);
v9 = _errno_location();
v10 = strerror(*v9);
fprintf(stderr, "Cannot mmap file '%s' for reading and writing [%s].\n", a1, v10);
exit(1);
}
v4 = v3;
v5 = nmappedfiles + 1;
v6 = 32LL * (nmappedfiles + 1);
mappedfiles = realloc(mappedfiles, v6);
v7 = (char *)mappedfiles + v6 - 32;
*(_QWORD *)v7 = a1;
*((_DWORD *)v7 + 2) = v1;
*((_QWORD *)v7 + 2) = v4;
*((_QWORD *)v7 + 3) = v2;
nmappedfiles = v5;
return v4;
}

original_code:
void *MapFileWriteable(const char *filename)
{
 int fd;
 off_t size;
 void *address;
 fd=ReOpenFileWriteable(filename);
 size=SizeFile(filename);
 address=mmap(((void *)0),size,0x1|0x2,0x01,fd,0);
 if(address==((void *) -1))
   {
    close(fd);
    fprintf(stderr,"Cannot mmap file '%s' for reading and writing [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 mappedfiles=(struct mmapinfo*)realloc((void*)mappedfiles,(nmappedfiles+1)*sizeof(struct mmapinfo));
 mappedfiles[nmappedfiles].filename=filename;
 mappedfiles[nmappedfiles].fd=fd;
 mappedfiles[nmappedfiles].address=address;
 mappedfiles[nmappedfiles].length=size;
 nmappedfiles++;
 return(address);
}

canonical_original_code:
void *MapFileWriteable(char *filename)
{
 int fd;
 long size;
 void *address;
 fd=ReOpenFileWriteable(filename);
 size=SizeFile(filename);
 address=mmap(((void *)0),size,0x1|0x2,0x01,fd,0);
 if(address==((void *) -1))
   {
    close(fd);
    fprintf(stderr,"Cannot mmap file '%s' for reading and writing [%s].\n",filename,strerror((*__errno_location ())));
    exit(1);
   }
 mappedfiles=(struct mmapinfo *)realloc((void *)mappedfiles,(nmappedfiles+1)*sizeof(struct mmapinfo));
 mappedfiles[nmappedfiles].filename=filename;
 mappedfiles[nmappedfiles].fd=fd;
 mappedfiles[nmappedfiles].address=address;
 mappedfiles[nmappedfiles].length=size;
 nmappedfiles++;
 return(address);
}


ExistsFile

decompiled_code:
_BOOL8 __fastcall ExistsFile(const char *a1)
{
struct stat64 v2; // [rsp+0h] [rbp-98h] BYREF

return stat64(a1, &v2) == 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func9(const char *a1)
{
struct stat64 v2; // [rsp+0h] [rbp-98h] BYREF

return stat64(a1, &v2) == 0;
}

original_code:
int ExistsFile(const char *filename)
{
 struct stat buf;
 if(stat(filename,&buf))
    return(0);
 else
    return(1);
}

canonical_original_code:
int ExistsFile(char *filename)
{
 struct stat buf;
 if(stat(filename,&buf))
    return(0);
 else
    return(1);
}

user_defined_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; long st_atime; unsigned long st_atimensec; long st_mtime; unsigned long st_mtimensec; long st_ctime; unsigned long st_ctimensec; long __glibc_reserved[3]; }


CloseFile

decompiled_code:
__int64 __fastcall CloseFile(int a1)
{
close(a1);
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func10(int a1)
{
close(a1);
return 0xFFFFFFFFLL;
}

original_code:
int CloseFile(int fd)
{
 close(fd);
 return(-1);
}


DeleteFile

decompiled_code:
__int64 __fastcall DeleteFile(const char *a1)
{
unlink(a1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func11(const char *a1)
{
unlink(a1);
return 0LL;
}

original_code:
int DeleteFile(char *filename)
{
 unlink(filename);
 return(0);
}


NewQueueList

decompiled_code:
_DWORD *NewQueueList()
{
_DWORD *v0; // rbx

v0 = malloc(0x10uLL);
*v0 = 1024;
v0[1] = 0;
*((_QWORD *)v0 + 1) = malloc(0x2000uLL);
return v0;
}

original_code:
Queue *NewQueueList(void)
{
 Queue *queue;
 queue=(Queue*)malloc(sizeof(Queue));
 queue->nallocated=1024;
 queue->noccupied=0;
 queue->data=(Result**)malloc(queue->nallocated*sizeof(Result*));
 return(queue);
}

canonical_original_code:
struct _Queue *NewQueueList()
{
 struct _Queue *queue;
 queue=(struct _Queue *)malloc(sizeof(Queue));
 queue->nallocated=1024;
 queue->noccupied=0;
 queue->data=(struct _Result **)malloc(queue->nallocated*sizeof(struct _Result *));
 return(queue);
}

variable_types: struct _Queue { unsigned int nallocated; unsigned int noccupied; struct _Result { unsigned int node; unsigned int segment; struct _Result *prev; struct _Result *next; float score; float sortby; unsigned int queued; } **data; } *

user_defined_types: struct _Queue { unsigned int nallocated; unsigned int noccupied; struct _Result **data; }


FreeQueueList

decompiled_code:
void __fastcall FreeQueueList(void *ptr)
{
free(*((void **)ptr + 1));
free(ptr);
}

canonical_decompiled_code:
void __fastcall func1(void *ptr)
{
free(*((void **)ptr + 1));
free(ptr);
}

original_code:
void FreeQueueList(Queue *queue)
{
 free(queue->data);
 free(queue);
}

canonical_original_code:
void FreeQueueList(struct _Queue *queue)
{
 free(queue->data);
 free(queue);
}


InsertInQueue

original_code:
void InsertInQueue(Queue *queue,Result *result)
{
 uint32_t index;
 if(result->queued==(uint32_t)(0))
   {
    queue->noccupied++;
    index=queue->noccupied;
    if(queue->noccupied==queue->nallocated)
      {
       queue->nallocated=queue->nallocated+1024;
       queue->data=(Result**)realloc((void*)queue->data,queue->nallocated*sizeof(Result*));
      }
    queue->data[index]=result;
    queue->data[index]->queued=index;
   }
 else
   {
    index=result->queued;
   }
 while(index>1 &&
       queue->data[index]->sortby<queue->data[index/2]->sortby)
   {
    uint32_t newindex;
    Result *temp;
    newindex=index/2;
    temp=queue->data[index];
    queue->data[index]=queue->data[newindex];
    queue->data[newindex]=temp;
    queue->data[index]->queued=index;
    queue->data[newindex]->queued=newindex;
    index=newindex;
   }
}

canonical_original_code:
void InsertInQueue(struct _Queue *queue, struct _Result *result)
{
 unsigned int index;
 if(result->queued==(unsigned int)(0))
   {
    queue->noccupied++;
    index=queue->noccupied;
    if(queue->noccupied==queue->nallocated)
      {
       queue->nallocated=queue->nallocated+1024;
       queue->data=(struct _Result **)realloc((void *)queue->data,queue->nallocated*sizeof(struct _Result *));
      }
    queue->data[index]=result;
    queue->data[index]->queued=index;
   }
 else
   {
    index=result->queued;
   }
 while(index>1 &&
       queue->data[index]->sortby<queue->data[index/2]->sortby)
   {
    unsigned int newindex;
    struct _Result *temp;
    newindex=index/2;
    temp=queue->data[index];
    queue->data[index]=queue->data[newindex];
    queue->data[newindex]=temp;
    queue->data[index]->queued=index;
    queue->data[newindex]->queued=newindex;
    index=newindex;
   }
}

variable_types:
result
struct _Result *

variable_types:
index
unsigned int

variable_types:
newindex
unsigned int

variable_types: struct _Result { unsigned int node; unsigned int segment; struct _Result *prev; struct _Result *next; float score; float sortby; unsigned int queued; } *


PopFromQueue

original_code:
Result *PopFromQueue(Queue *queue)
{
 uint32_t index;
 Result *retval;
 if(queue->noccupied==0)
    return(((void *)0));
 retval=queue->data[1];
 retval->queued=(uint32_t)(0);
 index=1;
 queue->data[index]=queue->data[queue->noccupied];
 queue->noccupied--;
 while((2*index)<queue->noccupied &&
       (queue->data[index]->sortby>queue->data[2*index ]->sortby ||
        queue->data[index]->sortby>queue->data[2*index+1]->sortby))
   {
    uint32_t newindex;
    Result *temp;
    if(queue->data[2*index]->sortby<queue->data[2*index+1]->sortby)
       newindex=2*index;
    else
       newindex=2*index+1;
    temp=queue->data[newindex];
    queue->data[newindex]=queue->data[index];
    queue->data[index]=temp;
    queue->data[index]->queued=index;
    queue->data[newindex]->queued=newindex;
    index=newindex;
   }
 if((2*index)==queue->noccupied &&
    queue->data[index]->sortby>queue->data[2*index]->sortby)
   {
    uint32_t newindex;
    Result *temp;
    newindex=2*index;
    temp=queue->data[newindex];
    queue->data[newindex]=queue->data[index];
    queue->data[index]=temp;
    queue->data[index]->queued=index;
    queue->data[newindex]->queued=newindex;
   }
 return(retval);
}

canonical_original_code:
struct _Result *PopFromQueue(struct _Queue *queue)
{
 unsigned int index;
 struct _Result *retval;
 if(queue->noccupied==0)
    return(((void *)0));
 retval=queue->data[1];
 retval->queued=(unsigned int)(0);
 index=1;
 queue->data[index]=queue->data[queue->noccupied];
 queue->noccupied--;
 while((2*index)<queue->noccupied &&
       (queue->data[index]->sortby>queue->data[2*index ]->sortby ||
        queue->data[index]->sortby>queue->data[2*index+1]->sortby))
   {
    unsigned int newindex;
    struct _Result *temp;
    if(queue->data[2*index]->sortby<queue->data[2*index+1]->sortby)
       newindex=2*index;
    else
       newindex=2*index+1;
    temp=queue->data[newindex];
    queue->data[newindex]=queue->data[index];
    queue->data[index]=temp;
    queue->data[index]->queued=index;
    queue->data[newindex]->queued=newindex;
    index=newindex;
   }
 if((2*index)==queue->noccupied &&
    queue->data[index]->sortby>queue->data[2*index]->sortby)
   {
    unsigned int newindex;
    struct _Result *temp;
    newindex=2*index;
    temp=queue->data[newindex];
    queue->data[newindex]=queue->data[index];
    queue->data[index]=temp;
    queue->data[index]->queued=index;
    queue->data[newindex]->queued=newindex;
   }
 return(retval);
}

variable_types: struct _Queue { unsigned int nallocated; unsigned int noccupied; struct _Result **data; } *


IndexSegment

original_code:
static inline index_t IndexSegment(Segments *segments,Segment *segment)
{
 int position1=segment-&segments->cached[0];
 return(segments->incache[position1]);
}

canonical_original_code:
static inline unsigned int IndexSegment(struct _Segments *segments, struct _Segment *segment)
{
 int position1 = segment-&segments->cached[0];
 return(segments->incache[position1]);
}

variable_types: struct _Segments { struct _SegmentsFile { unsigned int number; unsigned int snumber; unsigned int nnumber; } file; int fd; struct _Segment { unsigned int node1; unsigned int node2; unsigned int next2; unsigned int way; unsigned int distance; } cached[3]; unsigned int incache[3]; } *

variable_types:
segment
struct _Segment *


GetFakeLatLong

decompiled_code:
__int64 __fastcall GetFakeLatLong(int a1, double *a2, double *a3)
{
__int64 result; // rax

result = (unsigned int)(a1 + 0x10000);
*a2 = fake_lat[result];
*a3 = fake_lon[result];
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(int a1, double *a2, double *a3)
{
__int64 result; // rax

result = (unsigned int)(a1 + 0x10000);
*a2 = fake_lat[result];
*a3 = fake_lon[result];
return result;
}

original_code:
void GetFakeLatLong(index_t fakenode, double *latitude,double *longitude)
{
 index_t whichnode=fakenode-((index_t)0xffff0000);
 *latitude =fake_lat[whichnode];
 *longitude=fake_lon[whichnode];
}

canonical_original_code:
void GetFakeLatLong(unsigned int fakenode, double *latitude, double *longitude)
{
 unsigned int whichnode = fakenode-((index_t)0xffff0000);
 *latitude =fake_lat[whichnode];
 *longitude=fake_lon[whichnode];
}

variable_types:
fakenode
unsigned int

variable_types:
latitude
double *

variable_types:
longitude
double *

variable_types:
whichnode
unsigned int


FirstFakeSegment

decompiled_code:
char *__fastcall FirstFakeSegment(int a1)
{
return (char *)&fake_segments + 20 * (unsigned int)(4 * a1 + 262140);
}

canonical_decompiled_code:
char *__fastcall func3(int a1)
{
return (char *)&fake_segments + 20 * (unsigned int)(4 * a1 + 262140);
}

original_code:
Segment *FirstFakeSegment(index_t fakenode)
{
 index_t whichnode=fakenode-((index_t)0xffff0000);
 return(&fake_segments[4*whichnode-4]);
}

canonical_original_code:
struct _Segment *FirstFakeSegment(unsigned int fakenode)
{
 unsigned int whichnode = fakenode-((index_t)0xffff0000);
 return(&fake_segments[4*whichnode-4]);
}


ExtraFakeSegment

decompiled_code:
char *__fastcall ExtraFakeSegment(int a1, int a2)
{
unsigned int v2; // eax
unsigned int v3; // eax
char *v4; // rdx

v2 = 4 * a2 + 262140;
if ( *((_DWORD *)&fake_segments + 5 * v2) == a1 || *((_DWORD *)&fake_segments + 5 * v2 + 1) == a1 )
return (char *)&fake_segments + 20 * v2;
v3 = 4 * a2 + 262141;
if ( *((_DWORD *)&fake_segments + 5 * v3) == a1 || (v4 = 0LL, *((_DWORD *)&fake_segments + 5 * v3 + 1) == a1) )
v4 = (char *)&fake_segments + 20 * v3;
return v4;
}

canonical_decompiled_code:
char *__fastcall func5(int a1, int a2)
{
unsigned int v2; // eax
unsigned int v3; // eax
char *v4; // rdx

v2 = 4 * a2 + 262140;
if ( *((_DWORD *)&fake_segments + 5 * v2) == a1 || *((_DWORD *)&fake_segments + 5 * v2 + 1) == a1 )
return (char *)&fake_segments + 20 * v2;
v3 = 4 * a2 + 262141;
if ( *((_DWORD *)&fake_segments + 5 * v3) == a1 || (v4 = 0LL, *((_DWORD *)&fake_segments + 5 * v3 + 1) == a1) )
v4 = (char *)&fake_segments + 20 * v3;
return v4;
}

original_code:
Segment *ExtraFakeSegment(index_t realnode,index_t fakenode)
{
 index_t whichnode=fakenode-((index_t)0xffff0000);
 if(fake_segments[4*whichnode-4].node1==realnode || fake_segments[4*whichnode-4].node2==realnode)
    return(&fake_segments[4*whichnode-4]);
 if(fake_segments[4*whichnode-3].node1==realnode || fake_segments[4*whichnode-3].node2==realnode)
    return(&fake_segments[4*whichnode-3]);
 return(((void *)0));
}

canonical_original_code:
struct _Segment *ExtraFakeSegment(unsigned int realnode, unsigned int fakenode)
{
 unsigned int whichnode = fakenode-((index_t)0xffff0000);
 if(fake_segments[4*whichnode-4].node1==realnode || fake_segments[4*whichnode-4].node2==realnode)
    return(&fake_segments[4*whichnode-4]);
 if(fake_segments[4*whichnode-3].node1==realnode || fake_segments[4*whichnode-3].node2==realnode)
    return(&fake_segments[4*whichnode-3]);
 return(((void *)0));
}

variable_types:
realnode
unsigned int


LookupFakeSegment

decompiled_code:
char *__fastcall LookupFakeSegment(int a1)
{
return (char *)&fake_segments + 20 * (unsigned int)(a1 + 0x10000);
}

canonical_decompiled_code:
char *__fastcall func6(int a1)
{
return (char *)&fake_segments + 20 * (unsigned int)(a1 + 0x10000);
}

original_code:
Segment *LookupFakeSegment(index_t fakesegment)
{
 index_t whichsegment=fakesegment-((index_t)0xffff0000);
 return(&fake_segments[whichsegment]);
}

canonical_original_code:
struct _Segment *LookupFakeSegment(unsigned int fakesegment)
{
 unsigned int whichsegment = fakesegment-((index_t)0xffff0000);
 return(&fake_segments[whichsegment]);
}

variable_types:
fakesegment
unsigned int

variable_types:
whichsegment
unsigned int


IndexFakeSegment

decompiled_code:
__int64 __fastcall IndexFakeSegment(__int64 a1)
{
return -858993459 * (unsigned int)((a1 - (__int64)&fake_segments) >> 2) - 0x10000;
}

original_code:
index_t IndexFakeSegment(Segment *fakesegment)
{
 index_t whichsegment=fakesegment-&fake_segments[0];
 return(whichsegment+((index_t)0xffff0000));
}

canonical_original_code:
unsigned int IndexFakeSegment(struct _Segment *fakesegment)
{
 unsigned int whichsegment = fakesegment-&fake_segments[0];
 return(whichsegment+((unsigned int)0xffff0000));
}

variable_types: struct _Segment { unsigned int node1; unsigned int node2; unsigned int next2; unsigned int way; unsigned int distance; } *


IndexRealSegment

decompiled_code:
__int64 __fastcall IndexRealSegment(int a1)
{
return (unsigned int)real_segments[a1 + 0x10000];
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1)
{
return (unsigned int)real_segments[a1 + 0x10000];
}

original_code:
index_t IndexRealSegment(index_t fakesegment)
{
 index_t whichsegment=fakesegment-((index_t)0xffff0000);
 return(real_segments[whichsegment]);
}

canonical_original_code:
unsigned int IndexRealSegment(unsigned int fakesegment)
{
 unsigned int whichsegment = fakesegment-((index_t)0xffff0000);
 return(real_segments[whichsegment]);
}


IsFakeUTurn

decompiled_code:
_BOOL8 __fastcall IsFakeUTurn(int a1, int a2)
{
unsigned int v2; // edi
unsigned int v3; // esi
_BOOL8 result; // rax

v2 = a1 + 0x10000;
v3 = a2 + 0x10000;
result = 1LL;
if ( *((_DWORD *)&fake_segments + 5 * v2) != *((_DWORD *)&fake_segments + 5 * v3) )
result = *((_DWORD *)&fake_segments + 5 * v2 + 1) == *((_DWORD *)&fake_segments + 5 * v3 + 1);
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func9(int a1, int a2)
{
unsigned int v2; // edi
unsigned int v3; // esi
_BOOL8 result; // rax

v2 = a1 + 0x10000;
v3 = a2 + 0x10000;
result = 1LL;
if ( *((_DWORD *)&fake_segments + 5 * v2) != *((_DWORD *)&fake_segments + 5 * v3) )
result = *((_DWORD *)&fake_segments + 5 * v2 + 1) == *((_DWORD *)&fake_segments + 5 * v3 + 1);
return result;
}

original_code:
int IsFakeUTurn(index_t fakesegment1,index_t fakesegment2)
{
 index_t whichsegment1=fakesegment1-((index_t)0xffff0000);
 index_t whichsegment2=fakesegment2-((index_t)0xffff0000);
 if(fake_segments[whichsegment1].node1==fake_segments[whichsegment2].node1)
    return(1);
 if(fake_segments[whichsegment1].node2==fake_segments[whichsegment2].node2)
    return(1);
 return(0);
}

canonical_original_code:
int IsFakeUTurn(unsigned int fakesegment1, unsigned int fakesegment2)
{
 unsigned int whichsegment1 = fakesegment1-((index_t)0xffff0000);
 unsigned int whichsegment2 = fakesegment2-((index_t)0xffff0000);
 if(fake_segments[whichsegment1].node1==fake_segments[whichsegment2].node1)
    return(1);
 if(fake_segments[whichsegment1].node2==fake_segments[whichsegment2].node2)
    return(1);
 return(0);
}


decompiled_code:
__int64 sequenceType_function()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
return 0LL;
}

original_code:
static int sequenceType_function(const char *_tag_,int _type_)
{
 return(0);
}

canonical_original_code:
static int sequenceType_function(char *_tag_, int _type_)
{
 return(0);
}


decompiled_code:
__int64 schemaType_function()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
return 0LL;
}

original_code:
static int schemaType_function(const char *_tag_,int _type_,const char *elementFormDefault,const char *xmlns_xsd)
{
 return(0);
}

canonical_original_code:
static int schemaType_function(char *_tag_, int _type_, char *elementFormDefault, char *xmlns_xsd)
{
 return(0);
}

variable_types:
elementFormDefault
char *


decompiled_code:
__int64 __fastcall complexType_function(__int64 a1, int a2, const char *a3)
{
size_t v4; // rax
char *v5; // rax

if ( a2 != 2 )
{
v4 = strlen(a3);
v5 = (char *)realloc(currenttype, v4 + 1);
currenttype = strcpy(v5, a3);
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, int a2, const char *a3)
{
size_t v4; // rax
char *v5; // rax

if ( a2 != 2 )
{
v4 = strlen(a3);
v5 = (char *)realloc(currenttype, v4 + 1);
currenttype = strcpy(v5, a3);
}
return 0LL;
}

original_code:
static int complexType_function(const char *_tag_,int _type_,const char *name)
{
 if(_type_==2)
    return(0);
 currenttype=strcpy(realloc(currenttype,strlen(name)+1),name);
 return(0);
}

canonical_original_code:
static int complexType_function(char *_tag_, int _type_, char *name)
{
 if(_type_==2)
    return(0);
 currenttype=strcpy(realloc(currenttype,strlen(name)+1),name);
 return(0);
}

variable_types:
name
char *


decompiled_code:
__int64 __fastcall elementType_function(__int64 a1, int a2, const char *a3, const char *a4)
{
const char ***v6; // rbx
const char ***v7; // r14
const char **v8; // r12
const char **v9; // rbp
const char *v10; // r13
int v11; // eax
char *v12; // rbx
char *v13; // r14
void **v14; // rbx
size_t v15; // rax
char *v16; // rax
char **v17; // rbx
size_t v18; // rax
char *v19; // rax
const char ***v20; // rbx
const char **v21; // rbp
__int64 v23; // rbp
int v24; // [rsp+0h] [rbp-3Ch]

if ( a2 != 2 )
{
v24 = ntagsx;
if ( ntagsx <= 0 )
goto LABEL_12;
v6 = (const char ***)tagsx;
v7 = (const char ***)((char *)tagsx + 8 * (unsigned int)(ntagsx - 1) + 8);
v8 = 0LL;
do
{
v9 = *v6;
if ( !strcmp(a4, (*v6)[1]) && !strcmp(a3, *v9) )
v8 = v9;
++v6;
}
while ( v6 != v7 );
if ( v8 )
{
v10 = currenttype;
v11 = ntagsx;
if ( currenttype )
goto LABEL_11;
}
else
{
LABEL_12:
ntagsx = v24 + 1;
tagsx = realloc(tagsx, 8LL * (v24 + 1));
v14 = (void **)((char *)tagsx + 8 * ntagsx - 8);
*v14 = calloc(1uLL, 0x120uLL);
v15 = strlen(a3);
v16 = (char *)malloc(v15 + 1);
v17 = (char **)*((_QWORD *)tagsx + ntagsx - 1);
*v17 = strcpy(v16, a3);
v18 = strlen(a4);
v19 = (char *)malloc(v18 + 1);
v20 = (const char ***)((char *)tagsx + 8 * ntagsx - 8);
v21 = *v20;
v21[1] = strcpy(v19, a4);
v8 = *v20;
v10 = currenttype;
if ( currenttype )
{
v11 = ntagsx;
if ( ntagsx > 0 )
{
LABEL_11:
v12 = (char *)tagsx;
v13 = (char *)tagsx + 8 * (unsigned int)(v11 - 1) + 8;
do
{
v23 = *(_QWORD *)v12;
if ( !strcmp(*(const char **)(*(_QWORD *)v12 + 8LL), v10) )
{
*(_QWORD *)(v23 + 8LL * *(int *)(v23 + 152) + 160) = v8;
if ( ++*(_DWORD *)(*(_QWORD *)v12 + 152LL) == 16 )
{
fprintf(stderr, "Too many subtags seen for type '%s'.\n", v10);
exit(1);
}
}
v12 += 8;
}
while ( v12 != v13 );
return 0LL;
}
}
}
return 0LL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, int a2, const char *a3, const char *a4)
{
const char ***v6; // rbx
const char ***v7; // r14
const char **v8; // r12
const char **v9; // rbp
const char *v10; // r13
int v11; // eax
char *v12; // rbx
char *v13; // r14
void **v14; // rbx
size_t v15; // rax
char *v16; // rax
char **v17; // rbx
size_t v18; // rax
char *v19; // rax
const char ***v20; // rbx
const char **v21; // rbp
__int64 v23; // rbp
int v24; // [rsp+0h] [rbp-3Ch]

if ( a2 != 2 )
{
v24 = ntagsx;
if ( ntagsx <= 0 )
goto LABEL_12;
v6 = (const char ***)tagsx;
v7 = (const char ***)((char *)tagsx + 8 * (unsigned int)(ntagsx - 1) + 8);
v8 = 0LL;
do
{
v9 = *v6;
if ( !strcmp(a4, (*v6)[1]) && !strcmp(a3, *v9) )
v8 = v9;
++v6;
}
while ( v6 != v7 );
if ( v8 )
{
v10 = currenttype;
v11 = ntagsx;
if ( currenttype )
goto LABEL_11;
}
else
{
LABEL_12:
ntagsx = v24 + 1;
tagsx = realloc(tagsx, 8LL * (v24 + 1));
v14 = (void **)((char *)tagsx + 8 * ntagsx - 8);
*v14 = calloc(1uLL, 0x120uLL);
v15 = strlen(a3);
v16 = (char *)malloc(v15 + 1);
v17 = (char **)*((_QWORD *)tagsx + ntagsx - 1);
*v17 = strcpy(v16, a3);
v18 = strlen(a4);
v19 = (char *)malloc(v18 + 1);
v20 = (const char ***)((char *)tagsx + 8 * ntagsx - 8);
v21 = *v20;
v21[1] = strcpy(v19, a4);
v8 = *v20;
v10 = currenttype;
if ( currenttype )
{
v11 = ntagsx;
if ( ntagsx > 0 )
{
LABEL_11:
v12 = (char *)tagsx;
v13 = (char *)tagsx + 8 * (unsigned int)(v11 - 1) + 8;
do
{
v23 = *(_QWORD *)v12;
if ( !strcmp(*(const char **)(*(_QWORD *)v12 + 8LL), v10) )
{
*(_QWORD *)(v23 + 8LL * *(int *)(v23 + 152) + 160) = v8;
if ( ++*(_DWORD *)(*(_QWORD *)v12 + 152LL) == 16 )
{
fprintf(stderr, "Too many subtags seen for type '%s'.\n", v10);
exit(1);
}
}
v12 += 8;
}
while ( v12 != v13 );
return 0LL;
}
}
}
return 0LL;
}
return 0LL;
}

original_code:
static int elementType_function(const char *_tag_,int _type_,const char *name,const char *type,const char *minOccurs,const char *maxOccurs)
{
 xmltagx *tagx=((void *)0);
 int i;
 if(_type_==2)
    return(0);
 for(i=0;i<ntagsx;i++)
    if(!strcmp(type,tagsx[i]->type) && !strcmp(name,tagsx[i]->name))
       tagx=tagsx[i];
 if(!tagx)
   {
    ntagsx++;
    tagsx=(xmltagx**)realloc((void*)tagsx,ntagsx*sizeof(xmltagx*));
    tagsx[ntagsx-1]=(xmltagx*)calloc(1,sizeof(xmltagx));
    tagsx[ntagsx-1]->name=strcpy(malloc(strlen(name)+1),name);
    tagsx[ntagsx-1]->type=strcpy(malloc(strlen(type)+1),type);
    tagx=tagsx[ntagsx-1];
   }
 if(!currenttype)
    return(0);
 for(i=0;i<ntagsx;i++)
    if(!strcmp(tagsx[i]->type,currenttype))
      {
       tagsx[i]->subtagsx[tagsx[i]->nsubtagsx]=tagx;
       tagsx[i]->nsubtagsx++;
       if(tagsx[i]->nsubtagsx==16)
         {fprintf(stderr,"Too many subtags seen for type '%s'.\n",currenttype); exit(1);}
      }
 return(0);
}

canonical_original_code:
static int elementType_function(char *_tag_, int _type_, char *name, char *type, char *minOccurs, char *maxOccurs)
{
 struct _xmltagx *tagx = ((void *)0);
 int i;
 if(_type_==2)
    return(0);
 for(i=0;i<ntagsx;i++)
    if(!strcmp(type,tagsx[i]->type) && !strcmp(name,tagsx[i]->name))
       tagx=tagsx[i];
 if(!tagx)
   {
    ntagsx++;
    tagsx=(struct _xmltagx **)realloc((void *)tagsx,ntagsx*sizeof(struct _xmltagx *));
    tagsx[ntagsx-1]=(struct _xmltagx *)calloc(1,sizeof(xmltagx));
    tagsx[ntagsx-1]->name=strcpy(malloc(strlen(name)+1),name);
    tagsx[ntagsx-1]->type=strcpy(malloc(strlen(type)+1),type);
    tagx=tagsx[ntagsx-1];
   }
 if(!currenttype)
    return(0);
 for(i=0;i<ntagsx;i++)
    if(!strcmp(tagsx[i]->type,currenttype))
      {
       tagsx[i]->subtagsx[tagsx[i]->nsubtagsx]=tagx;
       tagsx[i]->nsubtagsx++;
       if(tagsx[i]->nsubtagsx==16)
         {fprintf(stderr,"Too many subtags seen for type '%s'.\n",currenttype); exit(1);}
      }
 return(0);
}

variable_types:
type
char *

variable_types:
minOccurs
char *

variable_types:
maxOccurs
char *

variable_types: struct _xmltagx { char *name; char *type; int nattributes; char *attributes[16]; int nsubtagsx; struct _xmltagx *subtagsx[16]; } *

variable_types: i int


decompiled_code:
__int64 __fastcall attributeType_function(__int64 a1, int a2, const char *a3)
{
__int64 v3; // r14
__int64 v4; // rbx
const char *v5; // r13
char *v6; // rbp
__int64 v7; // r12
size_t v8; // rax
char *v9; // rax
int v10; // er15

if ( a2 != 2 && ntagsx > 0 )
{
v3 = 8LL * (unsigned int)ntagsx;
v4 = 0LL;
do
{
v5 = currenttype;
v6 = (char *)tagsx + v4;
v7 = *(_QWORD *)((char *)tagsx + v4);
if ( !strcmp(*(const char **)(v7 + 8), currenttype) )
{
v8 = strlen(a3);
v9 = (char *)malloc(v8 + 1);
v10 = *(_DWORD *)(v7 + 16);
*(_QWORD *)(v7 + 8LL * v10 + 24) = strcpy(v9, a3);
if ( ++*(_DWORD *)(*(_QWORD *)v6 + 16LL) == 16 )
{
fprintf(stderr, "Too many attributes seen for type '%s'.\n", v5);
exit(1);
}
}
v4 += 8LL;
}
while ( v4 != v3 );
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, int a2, const char *a3)
{
__int64 v3; // r14
__int64 v4; // rbx
const char *v5; // r13
char *v6; // rbp
__int64 v7; // r12
size_t v8; // rax
char *v9; // rax
int v10; // er15

if ( a2 != 2 && ntagsx > 0 )
{
v3 = 8LL * (unsigned int)ntagsx;
v4 = 0LL;
do
{
v5 = currenttype;
v6 = (char *)tagsx + v4;
v7 = *(_QWORD *)((char *)tagsx + v4);
if ( !strcmp(*(const char **)(v7 + 8), currenttype) )
{
v8 = strlen(a3);
v9 = (char *)malloc(v8 + 1);
v10 = *(_DWORD *)(v7 + 16);
*(_QWORD *)(v7 + 8LL * v10 + 24) = strcpy(v9, a3);
if ( ++*(_DWORD *)(*(_QWORD *)v6 + 16LL) == 16 )
{
fprintf(stderr, "Too many attributes seen for type '%s'.\n", v5);
exit(1);
}
}
v4 += 8LL;
}
while ( v4 != v3 );
}
return 0LL;
}

original_code:
static int attributeType_function(const char *_tag_,int _type_,const char *name,const char *type)
{
 int i;
 if(_type_==2)
    return(0);
 for(i=0;i<ntagsx;i++)
    if(!strcmp(tagsx[i]->type,currenttype))
      {
       tagsx[i]->attributes[tagsx[i]->nattributes]=strcpy(malloc(strlen(name)+1),name);
       tagsx[i]->nattributes++;
       if(tagsx[i]->nattributes==16)
         {fprintf(stderr,"Too many attributes seen for type '%s'.\n",currenttype); exit(1);}
      }
 return(0);
}

canonical_original_code:
static int attributeType_function(char *_tag_, int _type_, char *name, char *type)
{
 int i;
 if(_type_==2)
    return(0);
 for(i=0;i<ntagsx;i++)
    if(!strcmp(tagsx[i]->type,currenttype))
      {
       tagsx[i]->attributes[tagsx[i]->nattributes]=strcpy(malloc(strlen(name)+1),name);
       tagsx[i]->nattributes++;
       if(tagsx[i]->nattributes==16)
         {fprintf(stderr,"Too many attributes seen for type '%s'.\n",currenttype); exit(1);}
      }
 return(0);
}


decompiled_code:
__int64 __fastcall NodeType_function(__int64 a1, char a2)
{
if ( (a2 & 1) != 0 )
current_list = (__int64)&NodeRules;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, char a2)
{
if ( (a2 & 1) != 0 )
current_list = (__int64)&NodeRules;
return 0LL;
}

original_code:
static int NodeType_function(const char *_tag_,int _type_)
{
 if(_type_&1)
    current_list=&NodeRules;
 return(0);
}

canonical_original_code:
static int NodeType_function(char *_tag_, int _type_)
{
 if(_type_&1)
    current_list=&NodeRules;
 return(0);
}


decompiled_code:
__int64 __fastcall WayType_function(__int64 a1, char a2)
{
if ( (a2 & 1) != 0 )
current_list = (__int64)&WayRules;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, char a2)
{
if ( (a2 & 1) != 0 )
current_list = (__int64)&WayRules;
return 0LL;
}

original_code:
static int WayType_function(const char *_tag_,int _type_)
{
 if(_type_&1)
    current_list=&WayRules;
 return(0);
}

canonical_original_code:
static int WayType_function(char *_tag_, int _type_)
{
 if(_type_&1)
    current_list=&WayRules;
 return(0);
}


decompiled_code:
__int64 __fastcall RelationType_function(__int64 a1, char a2)
{
if ( (a2 & 1) != 0 )
current_list = (__int64)&RelationRules;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, char a2)
{
if ( (a2 & 1) != 0 )
current_list = (__int64)&RelationRules;
return 0LL;
}

original_code:
static int RelationType_function(const char *_tag_,int _type_)
{
 if(_type_&1)
    current_list=&RelationRules;
 return(0);
}

canonical_original_code:
static int RelationType_function(char *_tag_, int _type_)
{
 if(_type_&1)
    current_list=&RelationRules;
 return(0);
}