数据类型 -- char , unsigned char = BYTE, short, unsigned short = WORD, long, unsigned long = DWORD, int , unginged int = UINT

本文详细介绍了TurboC语言中的各种数据类型,包括整型、浮点型、字符型、指针型及无值型的特点与应用。通过具体实例展示了不同类型变量的定义方法以及数值与字符的表示形式。

数据类型



    在Turbo C语言中, 每个变量在使用之前必须定义其数据类型。Turbo C有以 
下几种类型: 整型(int)、浮点型(float)、字符型(char)、指针型(*)、无值型 
(void)以及结构(struct)和联合(union)。其中前五种是Turbo C的基本数据类型、 
后两种数据类型(结构和联合)将在第五章介绍。 

    2.1 整型(int) 

    一、整型数说明 
    加上不同的修饰符, 整型数有以下几种类型; 
    signed short int     有符号短整型数说明。简写为short或int, 字长为2 
                         字节共16位二进制数, 数的范围是-32768~32767。 
    signed long int      有符号长整型数说明。简写为long, 字长为4字节共 
                         32位二进制数, 数的范围是-2147483648~2147483647。 
    unsigned short int   无符号短整型数说明。简写为unsigned int,  字长 
                         为2字节共16位二进制数, 数的范围是0~65535。 
    unsigned long int    无符号长整型数说明。简写为unsigned long, 字长 
                         为4字节共32位二进制数, 数的范围是0~4294967295。

    WCHAR       typedef WORD  WCHAR  双字节 2个字节

 

    __int64       8个字节

 

 DWORD     typedef  DWORD  unsinged long  4个字节

 

 long            4个字节

 

    short          2个字节

    二、整型变量定义 
    可以用下列语句定义整型变量 
    int a, b;            /*a、b被定义为有符号短整型变量*/ 
    unsigned long c;     /*c被定义为无符号长整型变量*/ 

    三、整型常数表示 
    按不同的进制区分, 整型常数有三种表示方法: 
    十进制数:  以非0开始的数 
               如:220, -560, 45900 
    八进制数:  以0开始的数 
               如:06; 0106, 05788 
    十六进制数:以0X或0x开始的数 
               如:0X0D, 0XFF, 0x4e 
    另外, 可在整型常数后添加一个"L"或"l"字母表示该数为长整型数, 如22L, 
0773L, 0Xae4l。 

    2.2 浮点型(float) 
    一、浮点数说明 
    Turbo C中有以下两种类型的浮点数: 
    float      单浮点数。字长为4 个字节共32 位二进制数,   数的范围是 
               3.4x10-38E~3.4x10+38E。 
    double     双浮点数。字长为 8个字节共 64 位二进制数,  数的范围是 
               1.7x10-308E~1.7x10+308E。 
    说明: 
    浮点数均为有符号浮点数, 没有无符号浮点数。 

    二、浮点型变量定义 
    可以用下列语句定义浮点型变量: 
    float a, f;     /*a, f被定义为单浮点型变量*/ 
    double b;       /*b被定义为双浮点型变量*/ 

    三、浮点常数表示 
    例如:  +29.56, -56.33, -6.8e-18, 6.365 
    说明: 
    1. 浮点常数只有一种进制(十进制)。 
    2. 所有浮点常数都被默认为double。 
    3. 绝对值小于1的浮点数, 其小数点前面的零可以省略。如:0.22可写为.22, 
-0.0015E-3可写为-.0015E-3。 
    4. Turbo C默认格式输出浮点数时, 最多只保留小数点后六位。 

    2.3 字符型(char) 
    加上不同的修饰符, 可以定义有符号和无符号两种类型的字符型变量, 例如: 
    char a:              /*a被定义为有符号字符变量*/ 
    unsigned char l;     /*l被定义为无符号字符变量*/ 
    字符在计算机中以其ASCII码方式表示, 其长度为1个字节, 有符号字符型数 
取值范围为-128~127, 无符号字符型数到值范围是0~255。因此在Turbo C语言中, 
字符型数据在操作时将按整型数处理, 如果某个变量定义成char, 则表明该变量 
是有符号的, 即它将转换成有符号的整型数。 
    Turbo C中规定对ASCII码值大于0x80的字符将被认为是负数。例如ASCII 值 
为0x8c的字符, 定义成char时,   被转换成十六进制的整数0xff8c 。 这是因当 
ASCII码值大于0x80时, 该字节的最高位为1, 计算机会认为该数为负数,   对于 
0x8c表示的数实际上是-74(8c的各位取反再加1), 而-74 转换成两字节整型数并 
在计算机中表示时就是0xff8c(  对0074 各位取反再加1)  。  因此只有定义为 
unsigned char 0x8c转换成整型数时才是8c。这一点在处理大于0x80的ASCII码 
字符时(例如汉字码)要特别注意。一般汉字均定义为unsigned char(在以后的程 
序中会经常碰到)。 
    另外, 也可以定义一个字符型数组(关于数组后面再作详细介绍), 此时该数 
组表示一个字符串。 
    例如: 
        char str[10]; 
    计算机在编译时, 将留出连续10个字符的空间, 即str[0]到str[9]共10个变 
量, 但只有前9个供用户使用。第10个str[9]用来存放字符串终止符NULL即"/0", 
但终止符是编编译程序自动加上的, 这一点应特别注意。 

    二、字符常数表示 
    能用符号表示的字符可直接用单引号括起来表示, 如'a', '9', 'Z',  也可用 
该字符的ASCII码值表示, 例如十进制数85表示大写字母'U', 十六进制数0x5d表示 
']', 八进制数0102表示大写字母'B'。 
    一些不能用符号表示的控制符, 只能用ASCII码值来表示, 如十进制数10 表示 
换行, 下六进制数0x0d表示回车, 八进制数033表示Esc。Turbo C2.0中也有另外一 
种表示表示方法, 如'/033'表示Esc,  这里'/ 0' 符号后面的数字表示十六进制的 
ASCII值当然这种表示方法也适用于可睦接用符号表示的字符。 
    另外, Turbo C2.0中有些常用的字符用以下特殊规定来表示: 
          规定符            等价于           含义 
          '/f'               '/X0C'          换页 
          '/r'               '/X0D'          回车 
          '/t'               '/X09'          制表键 
          '/n'               '/X0A'          换行 
          '//'               '/X5C'          /符 
          '/''               '/X27'          '符 
          '/"'               '/X22'          "符 
    对于字符串常量, 一般用双引号括起来表示, 如"Hello Turbo C2.0"。 

    2.4  指针型(*) 
    指针是一种特殊的数据类型, 在其它语言中一般没有。指针是指向变量的地址, 
实质上指针就是存贮单元的地址。  根据所指的变量类型不同,   可以是整型指针 
(int *)、浮点型指针(float *)、字符型指针(char *)、结构指针(struct *)和联 
合指针(union *)(结构指针和联合指针将在第4节中介绍)。 
  
    2.5 无值型(void) 
    无值型字节长度为0, 主要有两个用途:  一是明确地表示一个函数不返回任何 
值; 一是产生一个同一类型指针(可根据需要动态分配给其内存)。 
    例如: 
             void *buffer;    /*buffer被定义为无值型指针*/ 

请仔细阅读分析下面函数,进行优化后,采用C/C++11标准,完整推导并重构可编译的全部代码 特别注意: 1.保持所有原始功能不变 2.提高执行效率,降低计算复杂度 3.已经给定的结构体名字元素不要更改,详细的中文注释 4.自动添加中文注释说明功能逻辑 5.不使用 auto,使用显式 for 循环 6.结构体采用32位定义 7.不要使用小函数,保持原始的函数定义 8.严格保持protobuf字段映射关系 函数中的 HDDMXng::Architecture::Architecture 映射为 message Architecture { optional string name = 1; repeated string intentcodes = 2; repeated string costcodes = 3; repeated string speednames = 4; optional uint32 numlbels = 5; optional uint32 numbeldefs = 6; optional uint32 numsitetypes = 7; optional uint32 numtiletypes = 8; optional uint32 flags = 9; } 将 _BYTE arch_msg[8] 映射为 HDDMXng::Architecture arch_msg; void __cdecl HDDMDevice::readarch_pb(HDDMDevice *this, const HSTString *archFilePath, unsigned __int16 nFileVersion) { int v3; // ebp int v4; // edi int v5; // esi int v6; // eax int j; // ebp int v8; // eax HDDMDevice *v9; // eax int *dword68; // esi int *v11; // ebp HDDMDevice *v12; // eax char *dword74; // esi void *v14; // edi int dword198; // ebp signed int v16; // edi HDDMSiteType *v17; // edi char *dword80; // esi int dword1B0; // esi int v20; // ebp void *v21; // edi signed int v22; // edi HDDMTileType *v23; // edi char *dword8C; // esi int dword180; // esi int v26; // ebp void *v27; // edi char *dword70; // ecx int v29; // eax unsigned int v30; // edx unsigned int v31; // eax char *v32; // edi int **v33; // edx int **v34; // eax _DWORD *v35; // esi HDDMDevice *v36; // eax void *ptr; // ecx char *src; // ecx size_t n; // ebp int v40; // eax unsigned int v41; // edx unsigned int v42; // eax char *v43; // edi HDDMTileType **v44; // edx HDDMTileType **v45; // eax _DWORD *v46; // esi HDDMDevice *v47; // eax void *dword7C; // ecx char *dword88; // ecx size_t v50; // ebp int v51; // eax unsigned int v52; // edx unsigned int v53; // eax char *v54; // edi HDDMTileType **v55; // edx HDDMTileType **v56; // eax _DWORD *v57; // esi HDDMDevice *v58; // eax void *v59; // ecx int v60; // edi int v61; // edi size_t v62; // esi int v63; // edi int i; // esi char *v65; // [esp+4h] [ebp-258h] char *srca; // [esp+4h] [ebp-258h] char *srcb; // [esp+4h] [ebp-258h] size_t v68; // [esp+8h] [ebp-254h] size_t v69; // [esp+18h] [ebp-244h] size_t v70; // [esp+18h] [ebp-244h] char *v71; // [esp+18h] [ebp-244h] char *v72; // [esp+18h] [ebp-244h] char *v73; // [esp+18h] [ebp-244h] size_t v74; // [esp+18h] [ebp-244h] size_t v75; // [esp+18h] [ebp-244h] size_t v76; // [esp+18h] [ebp-244h] size_t v77; // [esp+18h] [ebp-244h] size_t v78; // [esp+18h] [ebp-244h] size_t v79; // [esp+18h] [ebp-244h] size_t v80; // [esp+18h] [ebp-244h] HDDMTileType *p_dword64; // [esp+1Ch] [ebp-240h] HDDMTileType *k; // [esp+1Ch] [ebp-240h] HDDMTileType *v83; // [esp+1Ch] [ebp-240h] HDDMTileType *v84; // [esp+1Ch] [ebp-240h] int m; // [esp+24h] [ebp-238h] int *v86; // [esp+28h] [ebp-234h] int v87; // [esp+2Ch] [ebp-230h] int ii; // [esp+2Ch] [ebp-230h] signed int v89; // [esp+30h] [ebp-22Ch] unsigned int v90; // [esp+30h] [ebp-22Ch] unsigned int v91; // [esp+30h] [ebp-22Ch] char v92[16]; // [esp+40h] [ebp-21Ch] BYREF char *v93; // [esp+50h] [ebp-20Ch] char *v94; // [esp+60h] [ebp-1FCh] char *v95; // [esp+70h] [ebp-1ECh] char *v96; // [esp+7Ch] [ebp-1E0h] BYREF char *v97; // [esp+80h] [ebp-1DCh] BYREF char *v98; // [esp+84h] [ebp-1D8h] BYREF _BYTE v99[16]; // [esp+90h] [ebp-1CCh] BYREF int v100; // [esp+A0h] [ebp-1BCh] void *v101; // [esp+A4h] [ebp-1B8h] _BYTE v102[16]; // [esp+B0h] [ebp-1ACh] BYREF int v103; // [esp+C0h] [ebp-19Ch] void *v104; // [esp+C4h] [ebp-198h] _BYTE v105[24]; // [esp+C8h] [ebp-194h] BYREF _BYTE v106[24]; // [esp+E0h] [ebp-17Ch] BYREF int v107; // [esp+F8h] [ebp-164h] _BYTE v108[24]; // [esp+100h] [ebp-15Ch] BYREF int v109; // [esp+118h] [ebp-144h] int v110[10]; // [esp+120h] [ebp-13Ch] BYREF _BYTE v111[8]; // [esp+148h] [ebp-114h] BYREF int v112[24]; // [esp+150h] [ebp-10Ch] BYREF _BYTE arch_msg[8]; // [esp+1B0h] [ebp-ACh] BYREF int v114; // [esp+1B8h] [ebp-A4h] int v115; // [esp+1BCh] [ebp-A0h] int v116; // [esp+1C0h] [ebp-9Ch] int v117; // [esp+1DCh] [ebp-80h] size_t v118; // [esp+1E0h] [ebp-7Ch] int v119; // [esp+1FCh] [ebp-60h] size_t v120; // [esp+200h] [ebp-5Ch] int v121; // [esp+21Ch] [ebp-40h] unsigned int v122; // [esp+220h] [ebp-3Ch] unsigned int v123; // [esp+224h] [ebp-38h] unsigned int v124; // [esp+228h] [ebp-34h] isl::iostreams::filtering_stream<boost::iostreams::input,char,stlp_std::char_traits<char>,stlp_std::allocator<char>,boost::iostreams::public_>::filtering_stream( v111, *((_DWORD *)archFilePath + 5), 4, 0); this->byte1E0 = nFileVersion > 1u; this->nArchFileVersion = nFileVersion; sub_8D8DC4(); HDDMXng::Architecture::Architecture((HDDMXng::Architecture *)arch_msg); HDDMDevice::readMessage((int)v112, (google::protobuf::MessageLite *)arch_msg); this->word20 = v121; if ( (char *)v114 != &this->deviceFilePath ) stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::_M_assign( (int)&this->deviceFilePath, *(void **)(v114 + 20), *(_DWORD *)(v114 + 16)); HDDMDevice::setupArchSpecific(this); v3 = v116; if ( v116 ) { this->byte148 = 1; stlp_std::vector<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::allocator<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>>::reserve( &this->char13C, v3); if ( v3 > 0 ) { for ( i = 0; i != v3; ++i ) stlp_std::vector<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::allocator<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>>::push_back( &this->char13C, *(_DWORD *)(v115 + 4 * i)); } } v69 = v118; if ( v118 ) { v4 = v118; stlp_std::vector<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::allocator<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>>::reserve( &this->char58, v118); if ( v4 > 0 ) { v5 = 0; do { stlp_std::vector<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::allocator<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>>::push_back( &this->char58, *(_DWORD *)(v117 + 4 * v5)); *(_WORD *)stlp_std::map<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,unsigned short,stlp_std::less<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>,stlp_std::allocator<stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,unsigned short>>>::operator[]<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>( &this->char1C4, *(_DWORD *)(v117 + 4 * v5)) = v5; ++v5; } while ( v5 != v69 ); } } v70 = v120; p_dword64 = (HDDMTileType *)&this->dword64; stlp_std::vector<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::allocator<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>>::reserve( &this->dword64, v120); if ( v70 ) { v6 = 0; for ( j = 0; j != v70; v6 = j ) { stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::basic_string( v110, *(_DWORD *)(v119 + 4 * v6)); dword68 = (int *)this->dword68; if ( dword68 == (int *)this->dword6C ) { if ( this->dword64 > (unsigned int)v110 || dword68 <= v110 ) { stlp_std::vector<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::allocator<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>>::_M_insert_overflow_aux( p_dword64, dword68, v110, v92, 1, 1); v9 = this; } else { stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::basic_string( v105, (int)v110); stlp_std::vector<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::allocator<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>>::_M_insert_overflow_aux( p_dword64, dword68, v105, v108, 1, 1); stlp_std::priv::_String_base<char,stlp_std::allocator<char>>::_M_deallocate_block(v105); v9 = this; } } else { if ( dword68 ) { stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::basic_string( dword68, (int)v110); v8 = this->dword68; } else { v8 = 0; } this->dword68 = v8 + 24; v9 = this; } *(_WORD *)stlp_std::map<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,unsigned short,stlp_std::less<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>,stlp_std::allocator<stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,unsigned short>>>::operator[]<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>( &v9->char164, v110) = j; stlp_std::priv::_String_base<char,stlp_std::allocator<char>>::_M_deallocate_block(v110); ++j; } } v89 = v122; stlp_std::vector<HDDMBelDef *,stlp_std::allocator<HDDMBelDef *>>::reserve(&this->dword70, v122); if ( v89 > 0 ) { for ( k = 0; (HDDMTileType *)v89 != k; k = (HDDMTileType *)((char *)k + 1) ) { if ( (unsigned __int16)this->word20 <= (int)k ) { v11 = (int *)operator new(0x54u); HDDMBelDef::HDDMBelDef((HDDMBelDef *)v11); *v11 = (int)(&`vtable for'HDDMRbelDef + 2); *((_BYTE *)v11 + 8) |= 2u; v12 = this; dword74 = (char *)this->dword74; if ( dword74 != (char *)this->dword78 ) { LABEL_24: *(_DWORD *)dword74 = v11; v12->dword74 += 4; goto LABEL_25; } } else { v11 = (int *)operator new(0x54u); HDDMBelDef::HDDMBelDef((HDDMBelDef *)v11); *v11 = (int)(&`vtable for'HDDMLbelDef + 2); v12 = this; dword74 = (char *)this->dword74; if ( dword74 != (char *)this->dword78 ) goto LABEL_24; } dword70 = (char *)v12->dword70; v74 = dword74 - dword70; v29 = 1; v30 = (dword74 - dword70) >> 2; if ( v30 ) v29 = (dword74 - dword70) >> 2; v31 = v30 + v29; if ( v31 > 0x3FFFFFFF || v30 > v31 ) { v61 = -4; } else { if ( !v31 ) { v32 = 0; v33 = 0; v34 = 0; if ( v74 ) goto LABEL_97; goto LABEL_65; } v61 = 4 * v31; } v34 = (int **)stlp_std::__malloc_alloc::allocate((stlp_std::__malloc_alloc *)v61, (unsigned int)v65); v33 = v34; dword70 = (char *)this->dword70; v74 = dword74 - dword70; v32 = (char *)v34 + (v61 & 0xFFFFFFFC); if ( dword74 != dword70 ) { LABEL_97: v62 = v74; v68 = v74; v79 = (size_t)v33; v34 = (int **)((char *)memmove(v33, dword70, v68) + v62); v33 = (int **)v79; } LABEL_65: *v34 = v11; v35 = v34 + 1; v36 = this; ptr = (void *)this->dword70; if ( ptr ) { v75 = (size_t)v33; free(ptr); v33 = (int **)v75; v36 = this; } v36->dword70 = v33; v36->dword74 = v35; v36->dword78 = v32; LABEL_25: *((_WORD *)v11 + 5) = (16 * (_WORD)k) | *((_WORD *)v11 + 5) & 0xF; (*(void (__cdecl **)(int *, int *, HDDMDevice *, _DWORD))(*v11 + 16))(v11, v112, this, nFileVersion); if ( this->dword198 ) { v87 = v11[7]; v14 = (void *)v11[8]; v71 = &this->char194; v86 = v11; dword198 = this->dword198; do { while ( stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::_M_compare( *(void **)(dword198 + 36), *(_DWORD *)(dword198 + 32), v14, v87) >= 0 ) { v71 = (char *)dword198; dword198 = *(_DWORD *)(dword198 + 8); if ( !dword198 ) goto LABEL_30; } dword198 = *(_DWORD *)(dword198 + 12); } while ( dword198 ); LABEL_30: v11 = v86; if ( &this->char194 != v71 && stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::_M_compare( v14, v87, *((void **)v71 + 9), *((_DWORD *)v71 + 8)) >= 0 ) { goto LABEL_32; } } else { v71 = &this->char194; } stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::basic_string( v106, (int)(v11 + 3)); v107 = 0; v93 = v71; v65 = &this->char194; stlp_std::priv::_Rb_tree<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::less<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>,stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,HDDMBelDef *>,stlp_std::priv::_Select1st<stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,HDDMBelDef *>>,stlp_std::priv::_MapTraitsT<stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,HDDMBelDef *>>,stlp_std::allocator<stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,HDDMBelDef *>>>::insert_unique(&v96); v71 = v96; stlp_std::priv::_String_base<char,stlp_std::allocator<char>>::_M_deallocate_block(v106); LABEL_32: *((_DWORD *)v71 + 10) = v11; } } v16 = v123; v90 = v123; stlp_std::vector<HDDMSiteType *,stlp_std::allocator<HDDMSiteType *>>::reserve(&this->dword7C, v123); if ( v16 > 0 ) { for ( m = 0; v90 != m; ++m ) { v17 = (HDDMSiteType *)operator new(0xE4u); v83 = v17; HDDMSiteType::HDDMSiteType(v17); dword80 = (char *)this->dword80; if ( dword80 != (char *)this->dword84 ) { *(_DWORD *)dword80 = v17; this->dword80 += 4; goto LABEL_37; } src = (char *)this->dword7C; n = dword80 - src; v40 = 1; v41 = (dword80 - src) >> 2; if ( v41 ) v40 = (dword80 - src) >> 2; v42 = v41 + v40; if ( v42 > 0x3FFFFFFF || v41 > v42 ) { v60 = -4; } else { if ( !v42 ) { v43 = 0; v44 = 0; v45 = 0; if ( n ) goto LABEL_94; goto LABEL_80; } v60 = 4 * v42; } v45 = (HDDMTileType **)stlp_std::__malloc_alloc::allocate((stlp_std::__malloc_alloc *)v60, (unsigned int)srca); v44 = v45; src = (char *)this->dword7C; n = dword80 - src; v43 = (char *)v45 + (v60 & 0xFFFFFFFC); if ( dword80 != src ) { LABEL_94: v78 = (size_t)v44; v45 = (HDDMTileType **)((char *)memmove(v44, src, n) + n); v44 = (HDDMTileType **)v78; } LABEL_80: *v45 = v83; v46 = v45 + 1; v47 = this; dword7C = (void *)this->dword7C; if ( dword7C ) { v76 = (size_t)v44; free(dword7C); v44 = (HDDMTileType **)v76; v47 = this; } v47->dword7C = v44; v47->dword80 = v46; v47->dword84 = v43; LABEL_37: *((_WORD *)v83 + 3) = ((_WORD)m << 6) | *((_WORD *)v83 + 3) & 0x3F; HDDMSiteType::readme_pb(v83, (int)v112, this); stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::basic_string( v99, (int)v83 + 20); dword1B0 = this->dword1B0; if ( dword1B0 ) { v20 = v100; v21 = v101; v72 = &this->char1AC; do { while ( stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::_M_compare( *(void **)(dword1B0 + 36), *(_DWORD *)(dword1B0 + 32), v21, v20) >= 0 ) { v72 = (char *)dword1B0; dword1B0 = *(_DWORD *)(dword1B0 + 8); if ( !dword1B0 ) goto LABEL_42; } dword1B0 = *(_DWORD *)(dword1B0 + 12); } while ( dword1B0 ); LABEL_42: if ( v72 != &this->char1AC && stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::_M_compare( v21, v20, *((void **)v72 + 9), *((_DWORD *)v72 + 8)) >= 0 ) { goto LABEL_44; } } else { v72 = &this->char1AC; } stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::basic_string(v108, (int)v99); v109 = 0; v94 = v72; srca = &this->char1AC; stlp_std::priv::_Rb_tree<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::less<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>,stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,HDDMSiteType *>,stlp_std::priv::_Select1st<stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,HDDMSiteType *>>,stlp_std::priv::_MapTraitsT<stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,HDDMSiteType *>>,stlp_std::allocator<stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,HDDMSiteType *>>>::insert_unique(&v97); v72 = v97; stlp_std::priv::_String_base<char,stlp_std::allocator<char>>::_M_deallocate_block(v108); LABEL_44: *((_DWORD *)v72 + 10) = v83; stlp_std::priv::_String_base<char,stlp_std::allocator<char>>::_M_deallocate_block(v99); } } v22 = v124; v91 = v124; stlp_std::vector<HDDMTileType *,stlp_std::allocator<HDDMTileType *>>::reserve(&this->dword88, v124); if ( v22 > 0 ) { for ( ii = 0; v91 != ii; ++ii ) { v23 = (HDDMTileType *)operator new(0x188u); v84 = v23; HDDMTileType::HDDMTileType(v23); dword8C = (char *)this->dword8C; if ( dword8C != (char *)this->dword90 ) { *(_DWORD *)dword8C = v23; this->dword8C += 4; goto LABEL_49; } dword88 = (char *)this->dword88; v50 = dword8C - dword88; v51 = 1; v52 = (dword8C - dword88) >> 2; if ( v52 ) v51 = (dword8C - dword88) >> 2; v53 = v52 + v51; if ( v53 > 0x3FFFFFFF || v52 > v53 ) { v63 = -4; } else { if ( !v53 ) { v54 = 0; v55 = 0; v56 = 0; if ( v50 ) goto LABEL_100; goto LABEL_89; } v63 = 4 * v53; } v56 = (HDDMTileType **)stlp_std::__malloc_alloc::allocate((stlp_std::__malloc_alloc *)v63, (unsigned int)srcb); v55 = v56; dword88 = (char *)this->dword88; v50 = dword8C - dword88; v54 = (char *)v56 + (v63 & 0xFFFFFFFC); if ( dword8C != dword88 ) { LABEL_100: v80 = (size_t)v55; v56 = (HDDMTileType **)((char *)memmove(v55, dword88, v50) + v50); v55 = (HDDMTileType **)v80; } LABEL_89: *v56 = v84; v57 = v56 + 1; v58 = this; v59 = (void *)this->dword88; if ( v59 ) { v77 = (size_t)v55; free(v59); v55 = (HDDMTileType **)v77; v58 = this; } v58->dword88 = v55; v58->dword8C = v57; v58->dword90 = v54; LABEL_49: HDDMTileType::readme_pb(v84, (int)v112, this); HDDMTileType::getName((HDDMTileType *)v102); dword180 = this->dword180; if ( dword180 ) { v26 = v103; v27 = v104; v73 = &this->char17C; do { while ( stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::_M_compare( *(void **)(dword180 + 36), *(_DWORD *)(dword180 + 32), v27, v26) >= 0 ) { v73 = (char *)dword180; dword180 = *(_DWORD *)(dword180 + 8); if ( !dword180 ) goto LABEL_54; } dword180 = *(_DWORD *)(dword180 + 12); } while ( dword180 ); LABEL_54: if ( v73 != &this->char17C && stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::_M_compare( v27, v26, *((void **)v73 + 9), *((_DWORD *)v73 + 8)) >= 0 ) { goto LABEL_56; } } else { v73 = &this->char17C; } stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::basic_string(v110, (int)v102); v110[6] = 0; v95 = v73; srcb = &this->char17C; stlp_std::priv::_Rb_tree<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::less<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>,stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,HDDMTileType *>,stlp_std::priv::_Select1st<stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,HDDMTileType *>>,stlp_std::priv::_MapTraitsT<stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,HDDMTileType *>>,stlp_std::allocator<stlp_std::pair<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>> const,HDDMTileType *>>>::insert_unique(&v98); v73 = v98; stlp_std::priv::_String_base<char,stlp_std::allocator<char>>::_M_deallocate_block(v110); LABEL_56: *((_DWORD *)v73 + 10) = v84; stlp_std::priv::_String_base<char,stlp_std::allocator<char>>::_M_deallocate_block(v102); } } HDDMXng::Architecture::~Architecture((HDDMXng::Architecture *)arch_msg); isl::iostreams::filtering_stream<boost::iostreams::input,char,stlp_std::char_traits<char>,stlp_std::allocator<char>,boost::iostreams::public_>::~filtering_stream(v111); } void __cdecl HDDMDevice::writearch_pb(HDDMDevice *this, int ostream, unsigned __int16 nFileVersion) { int v3; // eax int v4; // edx int v5; // eax char v6; // al _DWORD *v7; // edx int v8; // edi int v9; // ebp int v10; // eax int v11; // edx int v12; // edx char v13; // al _DWORD *v14; // edx int v15; // edi int v16; // ebp int v17; // eax int v18; // edx int v19; // edx char v20; // al _DWORD *v21; // edx int v22; // edi int v23; // ebp int v24; // eax int v25; // edx int v26; // edx _DWORD *dword70; // esi _DWORD *i; // edi _DWORD *dword80; // edi _DWORD *j; // esi _DWORD *dword88; // esi _DWORD *k; // edi int v33; // eax int v34; // eax int v35; // eax int v36; // esi int v37; // esi int v38; // esi google::protobuf::internal::RepeatedPtrFieldBase *v39; // [esp+0h] [ebp-14Ch] google::protobuf::internal::RepeatedPtrFieldBase *v40; // [esp+0h] [ebp-14Ch] google::protobuf::internal::RepeatedPtrFieldBase *v41; // [esp+0h] [ebp-14Ch] __int16 v42; // [esp+2Ch] [ebp-120h] BYREF __int16 v43; // [esp+2Eh] [ebp-11Eh] BYREF char v44; // [esp+30h] [ebp-11Ch] _DWORD v45[3]; // [esp+34h] [ebp-118h] BYREF char v46; // [esp+40h] [ebp-10Ch] _DWORD v47[3]; // [esp+44h] [ebp-108h] BYREF char v48; // [esp+50h] [ebp-FCh] _DWORD v49[3]; // [esp+54h] [ebp-F8h] BYREF _BYTE v50[4]; // [esp+60h] [ebp-ECh] BYREF _DWORD *p_dword70; // [esp+64h] [ebp-E8h] _BYTE v52[4]; // [esp+70h] [ebp-DCh] BYREF _DWORD *p_dword7C; // [esp+74h] [ebp-D8h] _BYTE v54[4]; // [esp+80h] [ebp-CCh] BYREF _DWORD *p_dword88; // [esp+84h] [ebp-C8h] int v56; // [esp+90h] [ebp-BCh] void *v57; // [esp+94h] [ebp-B8h] _BYTE v58[8]; // [esp+A0h] [ebp-ACh] BYREF int v59; // [esp+A8h] [ebp-A4h] int v60; // [esp+ACh] [ebp-A0h] BYREF int v61; // [esp+B0h] [ebp-9Ch] int v62; // [esp+B4h] [ebp-98h] int v63; // [esp+B8h] [ebp-94h] int v64; // [esp+CCh] [ebp-80h] BYREF int v65; // [esp+D0h] [ebp-7Ch] int v66; // [esp+D4h] [ebp-78h] int v67; // [esp+D8h] [ebp-74h] int v68; // [esp+ECh] [ebp-60h] BYREF int v69; // [esp+F0h] [ebp-5Ch] int v70; // [esp+F4h] [ebp-58h] int v71; // [esp+F8h] [ebp-54h] int word20; // [esp+10Ch] [ebp-40h] int v73; // [esp+110h] [ebp-3Ch] int v74; // [esp+114h] [ebp-38h] int v75; // [esp+118h] [ebp-34h] int v76; // [esp+120h] [ebp-2Ch] if ( nFileVersion > 2u ) { v36 = stlp_std::endl<char,stlp_std::char_traits<char>>(&stlp_std::cerr); stlp_std::basic_ostream<char,stlp_std::char_traits<char>>::_M_put_nowiden(v36, "ERROR:"); stlp_std::basic_ostream<char,stlp_std::char_traits<char>>::_M_put_nowiden(v36, "device/devmodel/HDDMDevice.cxx"); stlp_std::basic_ostream<char,stlp_std::char_traits<char>>::_M_put_nowiden(v36, ":"); v37 = stlp_std::priv::__put_num<char,stlp_std::char_traits<char>,long>(v36, 2489); stlp_std::basic_ostream<char,stlp_std::char_traits<char>>::_M_put_nowiden(v37, ": "); stlp_std::basic_ostream<char,stlp_std::char_traits<char>>::_M_put_nowiden(v37, "Invalid version number "); v38 = stlp_std::priv::__put_num<char,stlp_std::char_traits<char>,unsigned long>(v37, nFileVersion); stlp_std::basic_ostream<char,stlp_std::char_traits<char>>::_M_put_nowiden(v38, ", expected 0, 1 or 2."); stlp_std::endl<char,stlp_std::char_traits<char>>(v38); } else { stlp_std::basic_ostream<char,stlp_std::char_traits<char>>::write(ostream, "xnga", 4); v42 = nFileVersion | 0x8000; v43 = 0; stlp_std::basic_ostream<char,stlp_std::char_traits<char>>::write(ostream, &v42, 2); stlp_std::basic_ostream<char,stlp_std::char_traits<char>>::write(ostream, &v43, 2); HDDMXng::Architecture::Architecture((HDDMXng::Architecture *)v58); v76 |= 1u; v3 = v59; if ( (_UNKNOWN *)v59 == &google::protobuf::internal::kEmptyString ) { v3 = operator new(0x18u); *(_DWORD *)(v3 + 16) = v3; *(_DWORD *)(v3 + 20) = v3; *(_BYTE *)v3 = 0; v59 = v3; } stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::_M_assign( v3, (void *)this->dword38, this->dword34); v4 = v76; word20 = (unsigned __int16)this->word20; v73 = (this->dword74 - this->dword70) >> 2; v74 = (this->dword80 - this->dword7C) >> 2; v5 = (this->dword8C - this->dword88) >> 2; LOBYTE(v4) = v76 | 0xF0; v76 = v4; v75 = v5; sub_8DB7FA(this, &this->char13C); v6 = v44; if ( v44 ) { v8 = v45[0]; v7 = v45; } else { v7 = (_DWORD *)v45[0]; v8 = *(_DWORD *)v45[0]; } v9 = v7[1]; if ( v8 != v9 ) { do { stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::basic_string(v54, v8); v12 = v61; v35 = v62; if ( v61 >= v62 ) { if ( v62 == v63 ) { google::protobuf::internal::RepeatedPtrFieldBase::Reserve( (google::protobuf::internal::RepeatedPtrFieldBase *)&v60, v62 + 1); v35 = v62; } v62 = v35 + 1; v10 = google::protobuf::internal::StringTypeHandlerBase::New(v41); v11 = v61++; *(_DWORD *)(v60 + 4 * v11) = v10; } else { ++v61; v10 = *(_DWORD *)(v60 + 4 * v12); } stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::_M_assign(v10, v57, v56); stlp_std::priv::_String_base<char,stlp_std::allocator<char>>::_M_deallocate_block(v54); v8 += 24; } while ( v9 != v8 ); v6 = v44; } if ( v6 ) stlp_std::vector<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::allocator<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>>::~vector(v45); sub_8DB7FA(this, &this->char58); v13 = v46; if ( v46 ) { v15 = v47[0]; v14 = v47; } else { v14 = (_DWORD *)v47[0]; v15 = *(_DWORD *)v47[0]; } v16 = v14[1]; if ( v16 != v15 ) { do { stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::basic_string(v54, v15); v19 = v65; v34 = v66; if ( v65 >= v66 ) { if ( v66 == v67 ) { google::protobuf::internal::RepeatedPtrFieldBase::Reserve( (google::protobuf::internal::RepeatedPtrFieldBase *)&v64, v66 + 1); v34 = v66; } v66 = v34 + 1; v17 = google::protobuf::internal::StringTypeHandlerBase::New(v40); v18 = v65++; *(_DWORD *)(v64 + 4 * v18) = v17; } else { ++v65; v17 = *(_DWORD *)(v64 + 4 * v19); } stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::_M_assign(v17, v57, v56); stlp_std::priv::_String_base<char,stlp_std::allocator<char>>::_M_deallocate_block(v54); v15 += 24; } while ( v16 != v15 ); v13 = v46; } if ( v13 ) stlp_std::vector<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::allocator<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>>::~vector(v47); sub_8DB7FA(this, &this->dword64); v20 = v48; if ( v48 ) { v22 = v49[0]; v21 = v49; } else { v21 = (_DWORD *)v49[0]; v22 = *(_DWORD *)v49[0]; } v23 = v21[1]; if ( v23 != v22 ) { do { stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::basic_string(v54, v22); v26 = v69; v33 = v70; if ( v69 >= v70 ) { if ( v70 == v71 ) { google::protobuf::internal::RepeatedPtrFieldBase::Reserve( (google::protobuf::internal::RepeatedPtrFieldBase *)&v68, v70 + 1); v33 = v70; } v70 = v33 + 1; v24 = google::protobuf::internal::StringTypeHandlerBase::New(v39); v25 = v69++; *(_DWORD *)(v68 + 4 * v25) = v24; } else { ++v69; v24 = *(_DWORD *)(v68 + 4 * v26); } stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>::_M_assign(v24, v57, v56); stlp_std::priv::_String_base<char,stlp_std::allocator<char>>::_M_deallocate_block(v54); v22 += 24; } while ( v23 != v22 ); v20 = v48; } if ( v20 ) stlp_std::vector<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>,stlp_std::allocator<stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::allocator<char>>>>::~vector(v49); HDDMDevice::writeMessage(ostream, v58); v50[0] = 0; p_dword70 = &this->dword70; dword70 = (_DWORD *)this->dword70; for ( i = (_DWORD *)this->dword74; i != dword70; ++dword70 ) (*(void (__cdecl **)(_DWORD, int, _DWORD))(*(_DWORD *)*dword70 + 12))(*dword70, ostream, nFileVersion); boost::foreach_detail_::simple_variant<stlp_std::vector<HDDMBelDef *,stlp_std::allocator<HDDMBelDef *>>>::~simple_variant(v50); v52[0] = 0; p_dword7C = &this->dword7C; dword80 = (_DWORD *)this->dword80; for ( j = (_DWORD *)this->dword7C; dword80 != j; ++j ) HDDMSiteType::writeme_pb(*j, ostream); boost::foreach_detail_::simple_variant<stlp_std::vector<HDDMSiteType *,stlp_std::allocator<HDDMSiteType *>>>::~simple_variant(v52); v54[0] = 0; p_dword88 = &this->dword88; dword88 = (_DWORD *)this->dword88; for ( k = (_DWORD *)this->dword8C; k != dword88; ++dword88 ) HDDMTileType::writeme_pb(*dword88, ostream, nFileVersion); boost::foreach_detail_::simple_variant<stlp_std::vector<HDDMTileType *,stlp_std::allocator<HDDMTileType *>>>::~simple_variant(v54); stlp_std::basic_ostream<char,stlp_std::char_traits<char>>::flush(ostream); HDDMXng::Architecture::~Architecture((HDDMXng::Architecture *)v58); } }
10-06
请仔细阅读分析下面函数,进行优化后,采用C/C++11标准,完整推导并重构可编译的全部代码 特别注意: 1.保持所有原始功能不变 2.提高执行效率,降低计算复杂度 3.已经给定的结构体名字元素不要更改,详细的中文注释 4.自动添加中文注释说明功能逻辑 5.不使用 auto,使用显式 for 循环 6.结构体采用32位定义 7.不要使用小函数,保持原始的函数定义 特别注意: 1. 函数中 HDDMXng::Architecture::Architecture 映射为 message Architecture { optional string name = 1; repeated string intentcodes = 2; repeated string costcodes = 3; repeated string speednames = 4; optional uint32 numlbels = 5; optional uint32 numbeldefs = 6; optional uint32 numsitetypes = 7; optional uint32 numtiletypes = 8; optional uint32 flags = 9; } 2. 将 arch_msg 映射为 HDDMXng::Architecture arch_msg; void __fastcall HDDMDevice::readarch_pb(HDDMDevice *this, const std::string *filePath, unsigned __int16 nFileVersion) { google::protobuf::Message *v5; // rdx const std::string *v6; // rsi int v7; // ebp int v8; // r13d __int64 v9; // rbp const std::string **v10; // rax __int64 qword50_1; // rdx __int64 v12; // r12 std::string *qword50; // rdi const std::string *v14; // rsi std::string *qword68; // rdi __int64 qword68_1; // rax HDDMDevice *qword230; // r14 char *s2_1; // rbp HDDMDevice *p_char228; // r12 size_t n_2; // r15 int n0x7FFFFFFF_1; // eax _QWORD *s1; // rdi size_t n; // rdx size_t n_3; // r13 __int64 n0x7FFFFFFF; // r13 int p_qword90_2; // r15d HDDMBelDef *v27; // rbp HDDMBelDef **qword80; // rax bool v29; // zf __int64 qword80_1; // rax HDDMTileType *v31; // rdi char *qword290; // r14 _QWORD *s2_2; // rbp char *p_char288; // r12 size_t n_5; // r15 int n0x7FFFFFFF_3; // eax _QWORD *s1_1; // rdi size_t n_4; // r13 size_t n_1; // rdx __int64 n0x7FFFFFFF_2; // r13 HDDMTileType *v41; // r14 int v42; // r15d char *p_char2B8; // r15 int v44; // r13d HDDMSiteType *s2_4; // rbp HDDMSiteType **qword98; // rax __int64 qword98_1; // rax HDDMSiteType *s2_5; // rdi char *qword2C0; // r14 char *p_char2B8_1; // rbp int v51; // r15d char *p_char258; // r14 int v53; // r15d HDDMTileType *v54; // rbp HDDMTileType **qwordB0; // rax __int64 qwordB0_1; // rax HDDMTileType *v57; // rdi HDDMTileType **qword260; // r13 HDDMTileType **p_char258_1; // rbp __int64 p_char258_2; // rax __int64 insert_hint_unique_posESt23_Rb_tree_const_iteratorIS4_ERS1_; // rax HDDMTileType **p_qword90a_1; // rdx __int64 v63; // rdi char *p_char2B8_2; // rax __int64 v65; // rax __int64 insert_hint_unique_pos; // rax char *p_char2B8_3; // rdx __int64 v68; // rdi __int64 p_char288_1; // rax __int64 p_char228_1; // rax unsigned int v71; // eax unsigned int v72; // eax __int64 v73; // r12 __int64 v74; // rbp __int64 qword1E0_1; // rax std::string *qword1E0; // rdi const std::string *v77; // rsi int v78; // [rsp+0h] [rbp-538h] int word28_1; // [rsp+8h] [rbp-530h] int word28_3; // [rsp+8h] [rbp-530h] _QWORD *v81; // [rsp+8h] [rbp-530h] void **p_s2; // [rsp+10h] [rbp-528h] std::string *v83; // [rsp+18h] [rbp-520h] std::string *s2_3; // [rsp+18h] [rbp-520h] int v85; // [rsp+18h] [rbp-520h] int dword154a; // [rsp+20h] [rbp-518h] int dword154b[2]; // [rsp+20h] [rbp-518h] int dword154c[2]; // [rsp+20h] [rbp-518h] int dword154d[2]; // [rsp+20h] [rbp-518h] unsigned int word28_2; // [rsp+28h] [rbp-510h] std::istream *v91; // [rsp+28h] [rbp-510h] std::istream *v92; // [rsp+28h] [rbp-510h] HUTMemWatcher *v93; // [rsp+30h] [rbp-508h] std::string *v94; // [rsp+38h] [rbp-500h] HDDMXng::TileType *v95; // [rsp+40h] [rbp-4F8h] int p_qword90; // [rsp+48h] [rbp-4F0h] HDDMTileType **p_qword90a; // [rsp+48h] [rbp-4F0h] HDDMTileType **p_qword60; // [rsp+50h] [rbp-4E8h] _QWORD *p_qwordA8; // [rsp+58h] [rbp-4E0h] int *v100; // [rsp+60h] [rbp-4D8h] _QWORD *p_qword78; // [rsp+68h] [rbp-4D0h] _QWORD *v102; // [rsp+70h] [rbp-4C8h] int v103; // [rsp+78h] [rbp-4C0h] HDDMXng::Architecture *v105; // [rsp+80h] [rbp-4B8h] HUTMemWatcher *v106; // [rsp+88h] [rbp-4B0h] char v107; // [rsp+9Eh] [rbp-49Ah] BYREF char v108; // [rsp+9Fh] [rbp-499h] BYREF char v109[16]; // [rsp+A0h] [rbp-498h] BYREF _QWORD v110[2]; // [rsp+B0h] [rbp-488h] BYREF _QWORD v111[2]; // [rsp+C0h] [rbp-478h] BYREF _QWORD v112[2]; // [rsp+D0h] [rbp-468h] BYREF _QWORD v113[2]; // [rsp+E0h] [rbp-458h] BYREF _QWORD v114[2]; // [rsp+F0h] [rbp-448h] BYREF _QWORD v115[2]; // [rsp+100h] [rbp-438h] BYREF int v116[2]; // [rsp+110h] [rbp-428h] BYREF _QWORD v117[2]; // [rsp+120h] [rbp-418h] BYREF _QWORD v118[2]; // [rsp+130h] [rbp-408h] BYREF HDDMTileType *v119[2]; // [rsp+140h] [rbp-3F8h] BYREF void *s2; // [rsp+150h] [rbp-3E8h] BYREF int v121; // [rsp+158h] [rbp-3E0h] BYREF __int64 v122; // [rsp+160h] [rbp-3D8h] int *v123; // [rsp+168h] [rbp-3D0h] int *v124; // [rsp+170h] [rbp-3C8h] __int64 v125; // [rsp+178h] [rbp-3C0h] _BYTE v126[176]; // [rsp+180h] [rbp-3B8h] BYREF _QWORD v127[22]; // [rsp+230h] [rbp-308h] BYREF _QWORD arch_msg[4]; // [rsp+2E0h] [rbp-258h] BYREF int v129; // [rsp+300h] [rbp-238h] __int64 v130; // [rsp+330h] [rbp-208h] int v131; // [rsp+338h] [rbp-200h] __int64 v132; // [rsp+368h] [rbp-1D0h] unsigned int word28_4; // [rsp+370h] [rbp-1C8h] int word28; // [rsp+3A0h] [rbp-198h] int p_qword90_1; // [rsp+3A4h] [rbp-194h] int v136; // [rsp+3A8h] [rbp-190h] int v137; // [rsp+3ACh] [rbp-18Ch] int v138; // [rsp+3B0h] [rbp-188h] _QWORD v139[2]; // [rsp+3C0h] [rbp-178h] BYREF _BYTE v140[360]; // [rsp+3D0h] [rbp-168h] BYREF p_s2 = &s2; v102 = v139; std::string::string(v139, "", &s2); v94 = (std::string *)v119; v105 = (HDDMXng::Architecture *)arch_msg; std::string::string(arch_msg, "device:readFamilyXng", v119); v106 = (HUTMemWatcher *)v126; HUTMemWatcher::HUTMemWatcher((HUTMemWatcher *)v126, (const std::string *)arch_msg, (const std::string *)v139); v93 = (HUTMemWatcher *)v127; std::string::_Rep::_M_dispose(arch_msg[0] - 24LL, v127); std::string::_Rep::_M_dispose(v139[0] - 24LL, arch_msg); sub_1F9A060(v139, *(_QWORD *)filePath, 4, 0); this->gap310[16] = nFileVersion > 1u; this->dword154 = nFileVersion; std::istream::read((std::istream *)v140, v109, 8); HDDMXng::Architecture::Architecture((HDDMXng::Architecture *)arch_msg); HDDMDevice::readMessage((HDDMDevice *)v140, (std::istream *)arch_msg, v5); v6 = (const std::string *)arch_msg[2]; this->word28 = word28; std::string::assign((std::string *)&this->qword30, v6); HDDMDevice::setupArchSpecific(this); v7 = v129; if ( v129 ) { this->byte1F0 = 1; std::vector<std::string>::reserve(&this->char1D8, v7); if ( v7 > 0 ) { v73 = 8LL * (unsigned int)(v7 - 1) + 8; v74 = 0; do { qword1E0 = (std::string *)this->qword1E0; v77 = *(const std::string **)(arch_msg[3] + v74); if ( qword1E0 == (std::string *)this->qword1E8 ) { std::vector<std::string>::_M_emplace_back_aux<std::string const&>(&this->char1D8, v77); } else { if ( qword1E0 ) { std::string::string(qword1E0, v77); qword1E0_1 = this->qword1E0; } else { qword1E0_1 = 0; } this->qword1E0 = qword1E0_1 + 8; } v74 += 8; } while ( v74 != v73 ); } } v8 = v131; if ( v131 ) { std::vector<std::string>::reserve(&this->char48, v131); if ( v8 > 0 ) { v9 = 0; do { v12 = 8 * v9; qword50 = (std::string *)this->qword50; v10 = (const std::string **)(v130 + 8 * v9); v14 = *v10; if ( qword50 == (std::string *)this->qword58 ) { std::vector<std::string>::_M_emplace_back_aux<std::string const&>(&this->char48, v14); v10 = (const std::string **)(v130 + v12); } else { if ( qword50 ) { std::string::string(qword50, v14); v10 = (const std::string **)(v130 + v12); qword50_1 = this->qword50; } else { qword50_1 = 0; } this->qword50 = qword50_1 + 8; } *(_WORD *)std::map<std::string,unsigned short>::operator[](this->gap2E0, *v10) = v9++; } while ( v8 > (int)v9 ); } } p_qword60 = (HDDMTileType **)&this->qword60; word28_2 = word28_4; std::vector<std::string>::reserve(&this->qword60, word28_4); v83 = 0; word28_1 = 0; if ( word28_2 ) { do { std::string::string((std::string *)&s2, *(const std::string **)((char *)v83 + v132)); qword68 = (std::string *)this->qword68; if ( qword68 == (std::string *)this->qword70 ) { std::vector<std::string>::_M_emplace_back_aux<std::string const&>(p_qword60, &s2); } else { if ( qword68 ) { std::string::string(qword68, (const std::string *)&s2); qword68_1 = this->qword68; } else { qword68_1 = 0; } this->qword68 = qword68_1 + 8; } qword230 = (HDDMDevice *)this->qword230; if ( !qword230 ) { p_char228 = (HDDMDevice *)&this->char228; LABEL_97: v127[0] = &s2; p_char228_1 = std::_Rb_tree<std::string,std::pair<std::string const,unsigned short>,std::_Select1st<std::pair<std::string const,unsigned short>>,std::less<std::string>,std::allocator<std::pair<std::string const,unsigned short>>>::_M_emplace_hint_unique<std::piecewise_construct_t const&,std::tuple<std::string const&>,std::tuple<>>( this->gap220, p_char228, &unk_7B5DE75, v127, &v107); s2_1 = (char *)s2; p_char228 = (HDDMDevice *)p_char228_1; goto LABEL_30; } s2_1 = (char *)s2; p_char228 = (HDDMDevice *)&this->char228; n_2 = *((_QWORD *)s2 - 3); do { while ( 1 ) { s1 = *(_QWORD **)&qword230->dword20; n = n_2; n_3 = *(s1 - 3); if ( n_3 <= n_2 ) n = *(s1 - 3); n0x7FFFFFFF_1 = memcmp(s1, s2_1, n); if ( !n0x7FFFFFFF_1 ) break; LABEL_20: if ( n0x7FFFFFFF_1 < 0 ) goto LABEL_27; LABEL_21: p_char228 = qword230; qword230 = *(HDDMDevice **)&qword230->word10; if ( !qword230 ) goto LABEL_28; } n0x7FFFFFFF = n_3 - n_2; if ( n0x7FFFFFFF > 0x7FFFFFFF ) goto LABEL_21; if ( n0x7FFFFFFF >= (__int64)0xFFFFFFFF80000000LL ) { n0x7FFFFFFF_1 = n0x7FFFFFFF; goto LABEL_20; } LABEL_27: qword230 = *(HDDMDevice **)&qword230->dword18; } while ( qword230 ); LABEL_28: if ( &this->char228 == (char *)p_char228 || (int)std::string::compare((std::string *)&s2, (const std::string *)&p_char228->dword20) < 0 ) { goto LABEL_97; } LABEL_30: p_char228->word28 = word28_1; std::string::_Rep::_M_dispose(s2_1 - 24, v127); ++word28_1; v83 = (std::string *)((char *)v83 + 8); } while ( word28_1 != word28_2 ); } std::string::string(v111, "", v119); v95 = (HDDMXng::TileType *)v118; std::string::string(v110, "device::ArchXngBelDefs", v118); HUTMemWatcher::HUTMemWatcher((HUTMemWatcher *)v127, (const std::string *)v110, (const std::string *)v111); std::string::_Rep::_M_dispose(v110[0] - 24LL, &s2); std::string::_Rep::_M_dispose(v111[0] - 24LL, &s2); p_qword78 = &this->hddmBelDefVec; p_qword90_2 = p_qword90_1; p_qword90 = p_qword90_1; std::vector<HDDMBelDef *>::reserve(&this->hddmBelDefVec, p_qword90_1); if ( p_qword90_2 <= 0 ) goto LABEL_54; word28_3 = 0; LODWORD(p_qword60) = nFileVersion; do { if ( (unsigned __int16)this->word28 <= word28_3 ) { v27 = (HDDMBelDef *)operator new(0x70u); HDDMBelDef::HDDMBelDef(v27); *((_BYTE *)v27 + 11) |= 0x20u; *(_QWORD *)v27 = off_96B67F0; } else { v27 = (HDDMBelDef *)operator new(0x70u); HDDMBelDef::HDDMBelDef(v27); *(_QWORD *)v27 = off_96B67B0; } qword80 = (HDDMBelDef **)this->qword80; v29 = qword80 == (HDDMBelDef **)this->qword88; v119[0] = v27; if ( v29 ) { std::vector<HDDMBelDef *>::_M_emplace_back_aux<HDDMBelDef * const&>(p_qword78, v119); v31 = v119[0]; } else { if ( qword80 ) { *qword80 = v27; qword80_1 = this->qword80; v31 = v119[0]; } else { v31 = v27; qword80_1 = 0; } this->qword80 = qword80_1 + 8; } *((_WORD *)v31 + 7) = (4 * (word28_3 & 0xFFF)) | *((_WORD *)v31 + 7) & 0xC003; (*(void (__fastcall **)(HDDMTileType *, _BYTE *, HDDMDevice *, _QWORD))(*(_QWORD *)v31 + 32LL))( v31, v140, this, nFileVersion); qword290 = (char *)this->qword290; v91 = v119[0]; s2_3 = (HDDMTileType *)((char *)v119[0] + 16); if ( !qword290 ) { p_char288 = &this->char288; goto LABEL_95; } s2_2 = (_QWORD *)*((_QWORD *)v119[0] + 2); p_char288 = &this->char288; n_5 = *(s2_2 - 3); do { while ( 1 ) { s1_1 = (_QWORD *)*((_QWORD *)qword290 + 4); n_4 = *(s1_1 - 3); n_1 = n_4; if ( n_5 <= n_4 ) n_1 = n_5; n0x7FFFFFFF_3 = memcmp(s1_1, s2_2, n_1); if ( !n0x7FFFFFFF_3 ) break; LABEL_42: if ( n0x7FFFFFFF_3 < 0 ) goto LABEL_49; LABEL_43: p_char288 = qword290; qword290 = (char *)*((_QWORD *)qword290 + 2); if ( !qword290 ) goto LABEL_50; } n0x7FFFFFFF_2 = n_4 - n_5; if ( n0x7FFFFFFF_2 > 0x7FFFFFFF ) goto LABEL_43; if ( n0x7FFFFFFF_2 >= (__int64)0xFFFFFFFF80000000LL ) { n0x7FFFFFFF_3 = n0x7FFFFFFF_2; goto LABEL_42; } LABEL_49: qword290 = (char *)*((_QWORD *)qword290 + 3); } while ( qword290 ); LABEL_50: if ( &this->char288 != p_char288 && (int)std::string::compare(s2_3, (const std::string *)(p_char288 + 32)) >= 0 ) { v41 = v91; goto LABEL_53; } LABEL_95: s2 = s2_3; p_char288_1 = std::_Rb_tree<std::string,std::pair<std::string const,HDDMBelDef *>,std::_Select1st<std::pair<std::string const,HDDMBelDef *>>,std::less<std::string>,std::allocator<std::pair<std::string const,HDDMBelDef *>>>::_M_emplace_hint_unique<std::piecewise_construct_t const&,std::tuple<std::string const&>,std::tuple<>>( this->gap280, p_char288, &unk_7B5DE75, &s2, &v108); v41 = v119[0]; p_char288 = (char *)p_char288_1; LABEL_53: ++word28_3; *((_QWORD *)p_char288 + 5) = v41; } while ( p_qword90 != word28_3 ); LABEL_54: HUTMemWatcher::~HUTMemWatcher((HUTMemWatcher *)v127); std::string::string(v113, "", v119); std::string::string(v112, "device::ArchXngSiteTypes", v118); HUTMemWatcher::HUTMemWatcher((HUTMemWatcher *)v127, (const std::string *)v112, (const std::string *)v113); std::string::_Rep::_M_dispose(v112[0] - 24LL, &s2); std::string::_Rep::_M_dispose(v113[0] - 24LL, &s2); p_qword90a = (HDDMTileType **)&this->qword90; v42 = v136; LODWORD(v81) = v136; std::vector<HDDMSiteType *>::reserve(&this->qword90, v136); if ( v42 > 0 ) { p_char2B8 = &this->char2B8; v44 = 0; do { s2_4 = (HDDMSiteType *)operator new(0x170u); HDDMSiteType::HDDMSiteType(s2_4); qword98 = (HDDMSiteType **)this->qword98; v29 = qword98 == (HDDMSiteType **)this->qwordA0; s2 = s2_4; if ( v29 ) { std::vector<HDDMSiteType *>::_M_emplace_back_aux<HDDMSiteType * const&>(p_qword90a, &s2); s2_5 = (HDDMSiteType *)s2; } else { if ( qword98 ) { *qword98 = s2_4; qword98_1 = this->qword98; s2_5 = (HDDMSiteType *)s2; } else { s2_5 = s2_4; qword98_1 = 0; } this->qword98 = qword98_1 + 8; } *((_WORD *)s2_5 + 5) = ((_WORD)v44 << 6) | *((_WORD *)s2_5 + 5) & 0x3F; HDDMSiteType::readme_pb(s2_5, (std::istream *)v140, this); std::string::string((std::string *)v114, (const std::string *)((char *)s2 + 32)); qword2C0 = (char *)this->qword2C0; p_char2B8_1 = &this->char2B8; if ( !qword2C0 ) goto LABEL_89; do { while ( (int)std::string::compare((std::string *)(qword2C0 + 32), (const std::string *)v114) >= 0 ) { p_char2B8_1 = qword2C0; qword2C0 = (char *)*((_QWORD *)qword2C0 + 2); if ( !qword2C0 ) goto LABEL_65; } qword2C0 = (char *)*((_QWORD *)qword2C0 + 3); } while ( qword2C0 ); LABEL_65: if ( p_char2B8_1 == p_char2B8 || (int)std::string::compare((std::string *)v114, (const std::string *)(p_char2B8_1 + 32)) < 0 ) { LABEL_89: *(_QWORD *)dword154b = p_char2B8_1; p_char2B8_2 = (char *)operator new(0x30u); p_char2B8_1 = p_char2B8_2; if ( p_char2B8_2 ) { *(_DWORD *)p_char2B8_2 = 0; v65 = v114[0]; *((_QWORD *)p_char2B8_1 + 1) = 0; *((_QWORD *)p_char2B8_1 + 2) = 0; *((_QWORD *)p_char2B8_1 + 3) = 0; *((_QWORD *)p_char2B8_1 + 5) = 0; *((_QWORD *)p_char2B8_1 + 4) = v65; v114[0] = (char *)&std::string::_Rep::_S_empty_rep_storage + 24; } insert_hint_unique_pos = std::_Rb_tree<std::string,std::pair<std::string const,HDDMSiteType *>,std::_Select1st<std::pair<std::string const,HDDMSiteType *>>,std::less<std::string>,std::allocator<std::pair<std::string const,HDDMSiteType *>>>::_M_get_insert_hint_unique_pos( this->gap2B0, *(_QWORD *)dword154b, p_char2B8_1 + 32); if ( p_char2B8_3 ) { v68 = 1; if ( !insert_hint_unique_pos && p_char2B8 != p_char2B8_3 ) { *(_QWORD *)dword154d = p_char2B8_3; v72 = std::string::compare((std::string *)(p_char2B8_1 + 32), (const std::string *)(p_char2B8_3 + 32)); p_char2B8_3 = *(char **)dword154d; v68 = v72 >> 31; } std::_Rb_tree_insert_and_rebalance(v68, p_char2B8_1, p_char2B8_3, &this->char2B8); ++this->qword2D8; } else { *(_QWORD *)dword154c = insert_hint_unique_pos; std::string::_Rep::_M_dispose(*((_QWORD *)p_char2B8_1 + 4) - 24LL, v119); operator delete(p_char2B8_1); p_char2B8_1 = *(char **)dword154c; } } ++v44; *((_QWORD *)p_char2B8_1 + 5) = s2; std::string::_Rep::_M_dispose(v114[0] - 24LL, v119); } while ( (_DWORD)v81 != v44 ); } HUTMemWatcher::~HUTMemWatcher((HUTMemWatcher *)v127); v100 = v116; std::string::string(v116, "", v119); std::string::string(v115, "device::ArchXngTileTypes", v118); HUTMemWatcher::HUTMemWatcher((HUTMemWatcher *)v127, (const std::string *)v115, (const std::string *)v116); std::string::_Rep::_M_dispose(v115[0] - 24LL, &s2); std::string::_Rep::_M_dispose(*(_QWORD *)v116 - 24LL, &s2); v121 = 0; v122 = 0; v125 = 0; v123 = &v121; v124 = &v121; p_qwordA8 = &this->qwordA8; v51 = v137; v85 = v137; std::vector<HDDMTileType *>::reserve(&this->qwordA8, v137); if ( v51 > 0 ) { p_char258 = &this->char258; v53 = 0; dword154a = nFileVersion; v92 = (std::istream *)v140; do { v54 = (HDDMTileType *)operator new(0x2A0u); HDDMTileType::HDDMTileType(v54); qwordB0 = (HDDMTileType **)this->qwordB0; v29 = qwordB0 == (HDDMTileType **)this->qwordB8; v119[0] = v54; if ( v29 ) { std::vector<HDDMTileType *>::_M_emplace_back_aux<HDDMTileType * const&>(p_qwordA8, v94); v57 = v119[0]; } else { if ( qwordB0 ) { *qwordB0 = v54; qwordB0_1 = this->qwordB0; v57 = v119[0]; } else { v57 = v54; qwordB0_1 = 0; } this->qwordB0 = qwordB0_1 + 8; } HDDMTileType::readme_pb( v57, v92, v78, (int)v81, (int)p_s2, v85, dword154a, (int)v92, (int)v93, (int)v94, v95, (int)p_qword90a, (int)p_qword60, p_qwordA8, (int)v100, p_qword78, (int)v102, v103, (int)v105, (__int64)v106); v81 = v117; HDDMTileType::getName((HDDMTileType *)v117); qword260 = (HDDMTileType **)this->qword260; p_char258_1 = (HDDMTileType **)&this->char258; if ( !qword260 ) goto LABEL_84; do { while ( (int)std::string::compare((std::string *)(qword260 + 4), (const std::string *)v117) >= 0 ) { p_char258_1 = qword260; qword260 = (HDDMTileType **)qword260[2]; if ( !qword260 ) goto LABEL_79; } qword260 = (HDDMTileType **)qword260[3]; } while ( qword260 ); LABEL_79: if ( p_char258_1 == (HDDMTileType **)p_char258 || (int)std::string::compare((std::string *)v117, (const std::string *)(p_char258_1 + 4)) < 0 ) { LABEL_84: p_qword60 = p_char258_1; p_qword90a = (HDDMTileType **)this->p_qword90; p_char258_2 = operator new(0x30u); p_char258_1 = (HDDMTileType **)p_char258_2; if ( p_char258_2 ) { *(_DWORD *)p_char258_2 = 0; *(_QWORD *)(p_char258_2 + 8) = 0; *(_QWORD *)(p_char258_2 + 16) = 0; *(_QWORD *)(p_char258_2 + 24) = 0; *(_QWORD *)(p_char258_2 + 32) = v117[0]; v117[0] = (char *)&std::string::_Rep::_S_empty_rep_storage + 24; *(_QWORD *)(p_char258_2 + 40) = 0; } insert_hint_unique_posESt23_Rb_tree_const_iteratorIS4_ERS1_ = std::_Rb_tree<std::string,std::pair<std::string const,HDDMTileType *>,std::_Select1st<std::pair<std::string const,HDDMTileType *>>,std::less<std::string>,std::allocator<std::pair<std::string const,HDDMTileType *>>>::_M_get_insert_hint_unique_pos( p_qword90a, p_qword60, p_char258_2 + 32); if ( p_qword90a_1 ) { v63 = 1; if ( !insert_hint_unique_posESt23_Rb_tree_const_iteratorIS4_ERS1_ && p_char258 != (char *)p_qword90a_1 ) { p_qword90a = p_qword90a_1; v71 = std::string::compare((std::string *)(p_char258_1 + 4), (const std::string *)(p_qword90a_1 + 4)); p_qword90a_1 = p_qword90a; v63 = v71 >> 31; } std::_Rb_tree_insert_and_rebalance(v63, p_char258_1, p_qword90a_1, &this->char258); ++this->qword278; } else { p_qword90a = (HDDMTileType **)insert_hint_unique_posESt23_Rb_tree_const_iteratorIS4_ERS1_; std::string::_Rep::_M_dispose((char *)p_char258_1[4] - 24, v95); operator delete(p_char258_1); p_char258_1 = p_qword90a; } } ++v53; p_char258_1[5] = v119[0]; std::string::_Rep::_M_dispose(v117[0] - 24LL, v95); } while ( v85 != v53 ); } std::_Rb_tree<std::string,std::string,std::_Identity<std::string>,std::less<std::string>,std::allocator<std::string>>::_M_erase( p_s2, v122); HUTMemWatcher::~HUTMemWatcher(v93); std::string::string(v94, "", v117); std::string::string(v95, "device::ArchXngFlags", v100); HUTMemWatcher::HUTMemWatcher(v93, v95, v94); std::string::_Rep::_M_dispose(v118[0] - 24LL, p_s2); std::string::_Rep::_M_dispose((char *)v119[0] - 24, p_s2); this->byte1F3 = v138 & 1; this->byte1F3 &= 1u; HUTMemWatcher::~HUTMemWatcher(v93); HDDMXng::Architecture::~Architecture(v105); sub_1F34A70(v102); HUTMemWatcher::~HUTMemWatcher(v106); } void __fastcall HDDMDevice::writearch_pb(HDDMDevice *this, std::ostream *stream, unsigned __int16 nFileVersion) { std::string *p__ZN6google8protobuf8internal12kEmptyStringE_1; // rdi const std::string *qword1E0; // r14 const std::string *qword1E0_1; // rbp const google::protobuf::Message *v8; // rdx __int64 v9; // rax std::string *v10; // rax __int64 v11; // rdx std::string *v12; // rdi __int64 v13; // rax google::protobuf::internal::StringTypeHandlerBase *v14; // rdi int v15; // esi const std::string *i_1; // r14 const std::string *i; // rbp std::string *v18; // rax __int64 v19; // rdx std::string *v20; // rdi __int64 v21; // rax google::protobuf::internal::StringTypeHandlerBase *v22; // rdi int v23; // esi const std::string *j_1; // r14 const std::string *j; // rbp std::string *v26; // rax __int64 v27; // rdx std::string *v28; // rdi __int64 v29; // rax google::protobuf::internal::StringTypeHandlerBase *v30; // rdi int v31; // esi int byte1F3; // eax _QWORD *k_1; // rbp _QWORD *k; // rbx _QWORD *m_1; // rbp _QWORD *m; // rbx _QWORD *n_1; // rbp _QWORD *n; // rbx __int64 v40; // rax __int64 v41; // rax __int64 v42; // rax __int64 v43; // rax __int64 v44; // rbp __int64 v45; // rax __int64 v46; // rax __int64 v47; // rax char v49; // [rsp+2Bh] [rbp-12Dh] BYREF char v50[2]; // [rsp+2Ch] [rbp-12Ch] BYREF char v51[2]; // [rsp+2Eh] [rbp-12Ah] BYREF _QWORD v52[2]; // [rsp+30h] [rbp-128h] BYREF _BYTE arch_msg[16]; // [rsp+40h] [rbp-118h] BYREF std::string *p__ZN6google8protobuf8internal12kEmptyStringE; // [rsp+50h] [rbp-108h] __int64 v55; // [rsp+58h] [rbp-100h] BYREF int v56; // [rsp+60h] [rbp-F8h] int v57; // [rsp+64h] [rbp-F4h] int v58; // [rsp+68h] [rbp-F0h] __int64 v59; // [rsp+90h] [rbp-C8h] BYREF int v60; // [rsp+98h] [rbp-C0h] int v61; // [rsp+9Ch] [rbp-BCh] int v62; // [rsp+A0h] [rbp-B8h] __int64 v63; // [rsp+C8h] [rbp-90h] BYREF int v64; // [rsp+D0h] [rbp-88h] int v65; // [rsp+D4h] [rbp-84h] int v66; // [rsp+D8h] [rbp-80h] int word28; // [rsp+100h] [rbp-58h] int v68; // [rsp+104h] [rbp-54h] int v69; // [rsp+108h] [rbp-50h] int v70; // [rsp+10Ch] [rbp-4Ch] int byte1F3_1; // [rsp+110h] [rbp-48h] unsigned int v72; // [rsp+118h] [rbp-40h] if ( nFileVersion > 2u ) { v40 = std::endl<char,std::char_traits<char>>(&std::cerr); v41 = std::operator<<<std::char_traits<char>>(v40, "ERROR:"); v42 = std::operator<<<std::char_traits<char>>( v41, "/proj/rdi-xco/wall/workspaces/wall287/sub/REL/2016.3/src/shared/device/devmodel/HDDMDevice.cxx"); v43 = std::operator<<<std::char_traits<char>>(v42, ":"); v44 = std::ostream::operator<<(v43, 3325); std::__ostream_insert<char,std::char_traits<char>>(v44, ": ", 2); v45 = std::operator<<<std::char_traits<char>>(v44, "Invalid version number "); v46 = std::ostream::_M_insert<unsigned long>(v45, nFileVersion); v47 = std::operator<<<std::char_traits<char>>(v46, ", expected 0, 1 or 2."); std::endl<char,std::char_traits<char>>(v47); } else { std::ostream::write(stream, "xnga", 4); *(_WORD *)v51 = 0; *(_WORD *)v50 = nFileVersion | 0x8000; std::ostream::write(stream, v50, 2); std::ostream::write(stream, v51, 2); HDDMXng::Architecture::Architecture((HDDMXng::Architecture *)arch_msg); v72 |= 1u; p__ZN6google8protobuf8internal12kEmptyStringE_1 = p__ZN6google8protobuf8internal12kEmptyStringE; if ( p__ZN6google8protobuf8internal12kEmptyStringE == (std::string *)&google::protobuf::internal::kEmptyString ) { p__ZN6google8protobuf8internal12kEmptyStringE_1 = (std::string *)operator new(8u); *(_QWORD *)p__ZN6google8protobuf8internal12kEmptyStringE_1 = (char *)&std::string::_Rep::_S_empty_rep_storage + 24; p__ZN6google8protobuf8internal12kEmptyStringE = p__ZN6google8protobuf8internal12kEmptyStringE_1; } std::string::assign(p__ZN6google8protobuf8internal12kEmptyStringE_1, (const std::string *)&this->qword30); v8 = (const google::protobuf::Message *)v72; qword1E0 = (const std::string *)this->qword1E0; qword1E0_1 = *(const std::string **)&this->char1D8; LOBYTE(v8) = v72 | 0xF0; word28 = (unsigned __int16)this->word28; v9 = this->qword80 - this->hddmBelDefVec; v72 = (unsigned int)v8; v68 = v9 >> 3; v69 = (__int64)(this->qword98 - this->qword90) >> 3; v70 = (__int64)(this->qwordB0 - this->qwordA8) >> 3; while ( qword1E0 != qword1E0_1 ) { v14 = (google::protobuf::internal::StringTypeHandlerBase *)v52; std::string::string((std::string *)v52, qword1E0_1); v13 = v56; v15 = v57; if ( v56 >= v57 ) { if ( v57 == v58 ) { v14 = (google::protobuf::internal::StringTypeHandlerBase *)&v55; google::protobuf::internal::RepeatedPtrFieldBase::Reserve( (google::protobuf::internal::RepeatedPtrFieldBase *)&v55, v57 + 1); v15 = v57; } v57 = v15 + 1; v10 = (std::string *)google::protobuf::internal::StringTypeHandlerBase::New(v14); v11 = v56; v12 = v10; ++v56; *(_QWORD *)(v55 + 8 * v11) = v10; } else { ++v56; v12 = *(std::string **)(v55 + 8 * v13); } std::string::assign(v12, (const std::string *)v52); qword1E0_1 = (const std::string *)((char *)qword1E0_1 + 8); std::string::_Rep::_M_dispose(v52[0] - 24LL, &v49); } i_1 = (const std::string *)this->qword50; for ( i = *(const std::string **)&this->char48; i_1 != i; i = (const std::string *)((char *)i + 8) ) { v22 = (google::protobuf::internal::StringTypeHandlerBase *)v52; std::string::string((std::string *)v52, i); v21 = v60; v23 = v61; if ( v60 >= v61 ) { if ( v61 == v62 ) { v22 = (google::protobuf::internal::StringTypeHandlerBase *)&v59; google::protobuf::internal::RepeatedPtrFieldBase::Reserve( (google::protobuf::internal::RepeatedPtrFieldBase *)&v59, v61 + 1); v23 = v61; } v61 = v23 + 1; v18 = (std::string *)google::protobuf::internal::StringTypeHandlerBase::New(v22); v19 = v60; v20 = v18; ++v60; *(_QWORD *)(v59 + 8 * v19) = v18; } else { ++v60; v20 = *(std::string **)(v59 + 8 * v21); } std::string::assign(v20, (const std::string *)v52); std::string::_Rep::_M_dispose(v52[0] - 24LL, &v49); } j_1 = (const std::string *)this->qword68; for ( j = (const std::string *)this->qword60; j_1 != j; j = (const std::string *)((char *)j + 8) ) { v30 = (google::protobuf::internal::StringTypeHandlerBase *)v52; std::string::string((std::string *)v52, j); v29 = v64; v31 = v65; if ( v64 >= v65 ) { if ( v65 == v66 ) { v30 = (google::protobuf::internal::StringTypeHandlerBase *)&v63; google::protobuf::internal::RepeatedPtrFieldBase::Reserve( (google::protobuf::internal::RepeatedPtrFieldBase *)&v63, v65 + 1); v31 = v65; } v65 = v31 + 1; v26 = (std::string *)google::protobuf::internal::StringTypeHandlerBase::New(v30); v27 = v64; v28 = v26; ++v64; *(_QWORD *)(v63 + 8 * v27) = v26; } else { ++v64; v28 = *(std::string **)(v63 + 8 * v29); } std::string::assign(v28, (const std::string *)v52); std::string::_Rep::_M_dispose(v52[0] - 24LL, &v49); } byte1F3 = (unsigned __int8)this->byte1F3; v72 |= 0x100u; byte1F3_1 = byte1F3; HDDMDevice::writeMessage((HDDMDevice *)stream, (std::ostream *)arch_msg, v8); k_1 = (_QWORD *)this->qword80; for ( k = (_QWORD *)this->hddmBelDefVec; k_1 != k; ++k ) (*(void (__fastcall **)(_QWORD, std::ostream *, _QWORD))(*(_QWORD *)*k + 24LL))(*k, stream, nFileVersion); m_1 = (_QWORD *)this->qword98; for ( m = (_QWORD *)this->qword90; m_1 != m; ++m ) HDDMSiteType::writeme_pb(*m, stream); n_1 = (_QWORD *)this->qwordB0; for ( n = (_QWORD *)this->qwordA8; n_1 != n; ++n ) HDDMTileType::writeme_pb(*n, stream, nFileVersion); std::ostream::flush(stream); HDDMXng::Architecture::~Architecture((HDDMXng::Architecture *)arch_msg); } } void __fastcall HDDMDevice::print(HDDMDevice *this, std::ostream *stream, const std::string *filename) { __int64 v5; // r14 __int64 v6; // rax __int64 v7; // r15 __int64 v8; // r14 __int64 v9; // rax __int64 word4; // r15 __int64 word6; // r14 __int64 v12; // r15 __int64 v13; // r14 __int64 v14; // r14 __int64 v15; // rax __int64 word28; // r15 __int64 word2A; // r14 __int64 v18; // r13 __int64 v19; // r13 __int64 v20; // rax __int64 qwordA8; // rax __int64 v22; // rdx __int64 v23; // r13 __int64 v24; // r14 HDDMTileType *v25; // rdi __int64 qword90; // rax __int64 v27; // rdx __int64 v28; // r13 __int64 v29; // r14 HDDMSiteType *v30; // rdi __int64 hddmBelDefVec; // rax __int64 v32; // rdx __int64 v33; // r13 __int64 v34; // r14 __int64 v35; // rdi __int64 v36; // r14 int v37; // r13d HDDMSite *v38; // rdi __int64 v39; // r14 int v40; // r13d HDDMTile *v41; // rdi unsigned __int8 v42; // [rsp+0h] [rbp-48h] __int64 v43; // [rsp+0h] [rbp-48h] __int64 word12; // [rsp+0h] [rbp-48h] __int64 word10; // [rsp+8h] [rbp-40h] std::__ostream_insert<char,std::char_traits<char>>(&std::cout, "DEVICE : ", 9); v5 = std::__ostream_insert<char,std::char_traits<char>>(&std::cout, this->qword30, *(_QWORD *)(this->qword30 - 24LL)); std::__ostream_insert<char,std::char_traits<char>>(v5, " ", 1); v6 = std::__ostream_insert<char,std::char_traits<char>>(v5, this->qword38, *(_QWORD *)(this->qword38 - 24LL)); std::endl<char,std::char_traits<char>>(v6); v42 = this->byte0 & 0xF; LODWORD(v5) = (*(_DWORD *)&this->byte0 >> 4) & 0x3FFFFF; v7 = this->byte3 >> 2; std::__ostream_insert<char,std::char_traits<char>>(&std::cout, "m_deviceid : ", 13); v43 = std::ostream::_M_insert<unsigned long>(&std::cout, v42); std::__ostream_insert<char,std::char_traits<char>>(v43, " m_numsites : ", 14); v8 = std::ostream::_M_insert<unsigned long>(v43, (unsigned int)v5); std::__ostream_insert<char,std::char_traits<char>>(v8, " m_wasted1 : ", 13); v9 = std::ostream::_M_insert<unsigned long>(v8, (unsigned __int8)v7); std::endl<char,std::char_traits<char>>(v9); word4 = (unsigned __int16)this->word4; word6 = (unsigned __int16)this->word6; word10 = (unsigned __int16)this->word10; word12 = (unsigned __int16)this->word12; std::__ostream_insert<char,std::char_traits<char>>(&std::cout, "m_numrows : ", 12); v12 = std::ostream::_M_insert<unsigned long>(&std::cout, word4); std::__ostream_insert<char,std::char_traits<char>>(v12, " m_numcols : ", 13); v13 = std::ostream::_M_insert<unsigned long>(v12, word6); std::__ostream_insert<char,std::char_traits<char>>(v13, " m_rpmgridx : ", 14); v14 = std::ostream::_M_insert<unsigned long>(v13, word10); std::__ostream_insert<char,std::char_traits<char>>(v14, " m_rpmgridy : ", 14); v15 = std::ostream::_M_insert<unsigned long>(v14, word12); std::endl<char,std::char_traits<char>>(v15); word28 = (unsigned __int16)this->word28; word2A = (unsigned __int16)this->word2A; std::__ostream_insert<char,std::char_traits<char>>(&std::cout, "m_numnodes : ", 13); v18 = std::ostream::operator<<(&std::cout, 0); std::__ostream_insert<char,std::char_traits<char>>(v18, " m_numlbels : ", 14); v19 = std::ostream::_M_insert<unsigned long>(v18, word28); std::__ostream_insert<char,std::char_traits<char>>(v19, " m_wasted0 : ", 13); v20 = std::ostream::_M_insert<unsigned long>(v19, word2A); std::endl<char,std::char_traits<char>>(v20); qwordA8 = this->qwordA8; v22 = (this->qwordB0 - qwordA8) >> 3; if ( (int)v22 > 0 ) { v23 = 0; v24 = 8LL * (unsigned int)(v22 - 1) + 8; while ( 1 ) { v25 = *(HDDMTileType **)(qwordA8 + v23); v23 += 8; HDDMTileType::print(v25, stream, filename); if ( v23 == v24 ) break; qwordA8 = this->qwordA8; } } qword90 = this->qword90; v27 = (this->qword98 - qword90) >> 3; if ( (int)v27 > 0 ) { v28 = 0; v29 = 8LL * (unsigned int)(v27 - 1) + 8; while ( 1 ) { v30 = *(HDDMSiteType **)(qword90 + v28); v28 += 8; HDDMSiteType::print(v30, stream, filename); if ( v28 == v29 ) break; qword90 = this->qword90; } } hddmBelDefVec = this->hddmBelDefVec; v32 = (this->qword80 - hddmBelDefVec) >> 3; if ( (int)v32 > 0 ) { v33 = 0; v34 = 8LL * (unsigned int)(v32 - 1) + 8; while ( 1 ) { v35 = *(_QWORD *)(hddmBelDefVec + v33); v33 += 8; (*(void (__fastcall **)(__int64, std::ostream *, const std::string *))(*(_QWORD *)v35 + 40LL))( v35, stream, filename); if ( v33 == v34 ) break; hddmBelDefVec = this->hddmBelDefVec; } } v36 = 0; v37 = 0; if ( (*(_DWORD *)&this->byte0 & 0x3FFFFF0) != 0 ) { do { v38 = (HDDMSite *)(this->qword100 + v36); ++v37; v36 += 24; HDDMSite::print(v38, stream, filename); } while ( ((*(_DWORD *)&this->byte0 >> 4) & 0x3FFFFF) > v37 ); } v39 = 0; v40 = 0; if ( (unsigned __int16)this->word6 * (unsigned __int16)this->word4 ) { do { v41 = (HDDMTile *)(this->qwordF0 + v39); ++v40; v39 += 48; HDDMTile::print(v41, stream, filename); } while ( (unsigned __int16)this->word6 * (unsigned __int16)this->word4 > v40 ); } }
最新发布
10-14
请仔细阅读分析下面函数,进行优化后,采用C/C++11标准,完整推导并重构可编译的全部代码 特别注意: 1.保持所有原始功能不变 2.提高执行效率,降低计算复杂度 3.详细的注释,使用中文 4.不使用auto,使用显式for循环 5.结构体采用32位定义 6.不拆分函数 7.严格保持protobuf字段映射关系 函数中的 HDDMXng::Wire::Wire 映射为 message Wire { optional uint32 flags = 1; optional uint32 graphid = 2; repeated sint32 intersects = 3 [packed = true]; optional uint32 speedidx = 4; optional uint32 tiedvalue = 5; optional uint32 wirebusmark = 6; optional uint32 costcode = 7; optional string name = 8; } 将 _BYTE wire_msg[20] 映射为 HDDMXng::Wire wire_msg; void __fastcall HDDMWire::HDDMWire(HDDMWire *this) { __int16 word0; // ax __int16 v2; // ax int v3; // eax word0 = this->wire_code; this->wire_code1 &= 0xE0u; this->wire_code4 &= 0xFCu; this->wire_code2 = -1; *(_WORD *)&this->wire_code4 &= 0xF003u; this->? = -1; this->? &= 0x80u; this->wire_code = word0 & 0xFC00; v2 = *(_WORD *)&this->wire_code1; HIBYTE(this->wire_code) = 0; *(_WORD *)&this->? &= 0x7Fu; this->ushortVec = 0; this->ushortVec_Begin = 0; this->ushortVec_End = 0; this->hddmTilePortVec = 0; this->hddmTilePortVec_Begin = 0; v2 &= 0xFC1Fu; this->hddmTilePortVec_End = 0; *(_WORD *)&this->wire_code1 = v2; this->? = HIBYTE(v2) & 0x83; *(_DWORD *)&this->wire_code1 &= 0xFFF87FFF; v3 = *(_DWORD *)&this->wire_code4; this->? = -16; this->? = -1; *(_DWORD *)&this->wire_code4 = v3 & 0xFFC00FFF; this->? = 0; this->wire_name = (char *)&std::string::_Rep::_S_empty_rep_storage + 24; this->interSectsVec = 0; } void __fastcall HDDMWire::addarc(HDDMWire *this, __int16 index, HDDMWire *hddmWire) { __int16 wire_code2_high; // ax _DWORD *ushortVec_Begin; // rax __int64 qword30_1; // rax int v6; // [rsp+0h] [rbp-18h] BYREF wire_code2_high = HIWORD(hddmWire->wire_code2); LOWORD(v6) = index; HIWORD(v6) = wire_code2_high; ushortVec_Begin = (_DWORD *)this->ushortVec_Begin; if ( ushortVec_Begin == (_DWORD *)this->ushortVec_End ) { std::vector<std::pair<unsigned short,unsigned short>>::_M_emplace_back_aux<std::pair<unsigned short,unsigned short>>( &this->ushortVec, &v6); } else { if ( ushortVec_Begin ) { *ushortVec_Begin = v6; qword30_1 = this->ushortVec_Begin; } else { qword30_1 = 0; } this->ushortVec_Begin = qword30_1 + 4; } } void __fastcall HDDMWire::readme_pb(HDDMWire *this, std::istream *stream, HDDMDevice *hddmDevice, _QWORD *a4) { google::protobuf::Message *v5; // rdx __int16 v6; // dx unsigned __int16 word0; // ax __int16 v8; // dx __int16 v9; // ax __int64 qword10; // rax unsigned __int8 v11; // dl __int64 v12; // rdx int v13; // ecx char v14; // al std::string *v15; // rsi size_t n_1; // rdx _QWORD *v17; // r15 size_t n_3; // r14 const void *s1_1; // rdi _QWORD *v20; // rax _QWORD *s1_2; // r12 size_t n_4; // r13 size_t n; // rbx signed __int64 v24; // rax __int64 v25; // rbx int v26; // eax const std::string *n32_1; // rsi char *v28; // rdi _QWORD *v29; // r12 _QWORD *s2; // rsi size_t n_5; // r15 size_t n_6; // rbx size_t n_2; // rdx int v34; // eax unsigned int v35; // r14d __int64 v36; // rax __int64 v37; // rbx __int64 n32; // r15 int v39; // eax int v40; // edx void *s1; // [rsp+8h] [rbp-E0h] _QWORD *v43; // [rsp+20h] [rbp-C8h] char v44; // [rsp+3Fh] [rbp-A9h] BYREF void *v45[2]; // [rsp+40h] [rbp-A8h] BYREF _BYTE v46[20]; // [rsp+50h] [rbp-98h] BYREF __int16 v47; // [rsp+64h] [rbp-84h] __int64 v48; // [rsp+68h] [rbp-80h] char v49; // [rsp+70h] [rbp-78h] int word8; // [rsp+8Ch] [rbp-5Ch] char v51; // [rsp+90h] [rbp-58h] char v52; // [rsp+94h] [rbp-54h] int byte7; // [rsp+98h] [rbp-50h] std::string *v54; // [rsp+A0h] [rbp-48h] int v55; // [rsp+ACh] [rbp-3Ch] if ( HDDMDeviceDump::useXngMarks ) std::istream::read(stream, HDDMDeviceDump::markBuffer, 4); HDDMXng::Wire::Wire((HDDMXng::Wire *)v46); HDDMDevice::readMessage((HDDMDevice *)stream, (std::istream *)v46, v5); v6 = v47; BYTE2(this->wire_code) = (8 * (v46[16] & 1)) | BYTE2(this->wire_code) & 0xF7; word0 = v6 & 0x3FF | this->wire_code & 0xFC00; LOBYTE(v6) = v49; LOWORD(this->wire_code) = word0; v8 = v6 & 0x3F; v9 = (4 * v8) | HIBYTE(word0) & 3; BYTE1(this->wire_code) = v9; if ( (v9 & 0xFC) != 0 ) { qword10 = operator new[](4LL * (unsigned __int8)v8); v11 = BYTE1(this->wire_code); this->interSectsVec = qword10; if ( v11 >> 2 ) { v12 = 0; v13 = 0; while ( 1 ) { ++v13; *(_DWORD *)(qword10 + v12) = *(_DWORD *)(v48 + v12); v12 += 4; if ( BYTE1(this->wire_code) >> 2 <= v13 ) break; qword10 = this->interSectsVec; } } } v14 = v55; if ( (v55 & 8) != 0 ) LOWORD(this->wire_code2) = word8; if ( (v14 & 0x10) != 0 ) BYTE2(this->wire_code) = (16 * (v51 & 3)) | BYTE2(this->wire_code) & 0xCB | 4; if ( (v14 & 0x20) != 0 ) BYTE2(this->wire_code1) = (16 * v52) | BYTE2(this->wire_code1) & 7 | 8; if ( (v14 & 0x40) != 0 ) HIBYTE(this->wire_code1) = byte7; v15 = v54; std::string::string((std::string *)v45, v54); v17 = (_QWORD *)a4[2]; v43 = a4 + 1; if ( !v17 ) { v17 = a4 + 1; goto LABEL_47; } s1 = v45[0]; n_3 = *((_QWORD *)v45[0] - 3); s1_1 = v45[0]; while ( 1 ) { s1_2 = (_QWORD *)v17[4]; n_4 = *(s1_2 - 3); n = n_4; if ( n_3 <= n_4 ) n = n_3; LODWORD(v24) = memcmp(s1_1, (const void *)v17[4], n); if ( !(_DWORD)v24 ) break; LABEL_19: if ( (int)v24 >= 0 ) goto LABEL_26; LABEL_20: v20 = (_QWORD *)v17[2]; v15 = (std::string *)(&dword_0 + 1); if ( !v20 ) goto LABEL_27; LABEL_21: s1_1 = s1; v17 = v20; } v24 = n_3 - n_4; if ( (__int64)(n_3 - n_4) <= 0x7FFFFFFF ) { if ( v24 < (__int64)0xFFFFFFFF80000000LL ) goto LABEL_20; goto LABEL_19; } LABEL_26: v20 = (_QWORD *)v17[3]; v15 = 0; if ( v20 ) goto LABEL_21; LABEL_27: n_1 = n; v25 = (__int64)v17; if ( !(_BYTE)v15 ) goto LABEL_28; LABEL_47: v29 = (_QWORD *)a4[3]; if ( v29 == v17 ) { LABEL_38: if ( v43 == v29 ) goto LABEL_54; s2 = (_QWORD *)v29[4]; n_5 = *((_QWORD *)v45[0] - 3); n_6 = *(s2 - 3); n_2 = n_5; if ( n_6 <= n_5 ) n_2 = *(s2 - 3); v34 = memcmp(v45[0], s2, n_2); if ( !v34 ) { v35 = 0; if ( (__int64)(n_5 - n_6) > 0x7FFFFFFF ) { LABEL_43: v36 = operator new(0x28u); v37 = v36; n32 = 32; if ( v36 ) { n32 = v36 + 32; *(_DWORD *)v36 = 0; *(_QWORD *)(v36 + 8) = 0; *(_QWORD *)(v36 + 16) = 0; *(_QWORD *)(v36 + 24) = 0; std::string::string((std::string *)(v36 + 32), (const std::string *)v45); } std::_Rb_tree_insert_and_rebalance(v35, v37, v29, v43); n32_1 = (const std::string *)n32; ++a4[5]; goto LABEL_31; } if ( (__int64)(n_5 - n_6) < (__int64)0xFFFFFFFF80000000LL ) { LABEL_54: v35 = 1; goto LABEL_43; } v34 = n_5 - n_6; } v35 = 0; if ( v34 >= 0 ) goto LABEL_43; goto LABEL_54; } v25 = std::_Rb_tree_decrement(v17, v15, n_1); s1_2 = *(_QWORD **)(v25 + 32); n_3 = *((_QWORD *)v45[0] - 3); s1 = v45[0]; n_4 = *(s1_2 - 3); n_1 = n_3; if ( n_4 <= n_3 ) n_1 = *(s1_2 - 3); LABEL_28: v26 = memcmp(s1_2, s1, n_1); if ( v26 ) { LABEL_35: if ( v26 < 0 ) goto LABEL_36; } else { if ( (__int64)(n_4 - n_3) > 0x7FFFFFFF ) goto LABEL_30; if ( (__int64)(n_4 - n_3) >= (__int64)0xFFFFFFFF80000000LL ) { v26 = n_4 - n_3; goto LABEL_35; } LABEL_36: if ( v17 ) { v29 = v17; goto LABEL_38; } v25 = 0; } LABEL_30: n32_1 = (const std::string *)(v25 + 32); LABEL_31: std::string::assign((std::string *)&this->wire_name, n32_1); v28 = (char *)v45[0] - 24; if ( (char *)v45[0] - 24 != (char *)&std::string::_Rep::_S_empty_rep_storage ) { if ( &_pthread_key_create ) { v39 = _InterlockedExchangeAdd((volatile signed __int32 *)v45[0] - 2, 0xFFFFFFFF); } else { v40 = *((_DWORD *)v45[0] - 2); *((_DWORD *)v45[0] - 2) = v40 - 1; v39 = v40; } if ( v39 <= 0 ) std::string::_Rep::_M_destroy(v28, &v44); } HDDMXng::Wire::~Wire((HDDMXng::Wire *)v46); } void __fastcall HDDMWire::writeme_pb(HDDMWire *this, std::ostream *stream) { unsigned __int8 v3; // dl int v4; // eax __int64 v5; // rbp int v6; // ebx int v7; // r13d __int64 v8; // rax int v9; // eax _DWORD *src_1; // r14 unsigned __int64 v11; // rdi unsigned __int8 v12; // cl const std::string *p_wire_name; // r12 std::string *p__ZN6google8protobuf8internal12kEmptyStringE_1; // rdi const google::protobuf::Message *v15; // rdx __int16 wire_code; // [rsp+0h] [rbp-A8h] _BYTE wire_msg[16]; // [rsp+10h] [rbp-98h] BYREF _BOOL4 v18; // [rsp+20h] [rbp-88h] int v19; // [rsp+24h] [rbp-84h] void *src; // [rsp+28h] [rbp-80h] int v21; // [rsp+30h] [rbp-78h] int v22; // [rsp+34h] [rbp-74h] _DWORD src_2[10]; // [rsp+38h] [rbp-70h] BYREF std::string *p__ZN6google8protobuf8internal12kEmptyStringE; // [rsp+60h] [rbp-48h] int v25; // [rsp+6Ch] [rbp-3Ch] if ( HDDMDeviceDump::useXngMarks ) std::ostream::write(stream, "WIRE", 4); HDDMXng::Wire::Wire((HDDMXng::Wire *)wire_msg); v3 = BYTE2(this->wire_code); wire_code = this->wire_code; v4 = v25 | 3; v25 |= 3u; v18 = (v3 & 8) != 0; v19 = wire_code & 0x3FF; if ( BYTE1(this->wire_code) >> 2 ) { v5 = 0; v6 = 0; do { v7 = *(_DWORD *)(this->interSectsVec + v5); v8 = v21; if ( v21 == v22 ) { v9 = v21 + 1; src_1 = src; if ( 2 * v21 >= v21 + 1 ) v9 = 2 * v21; v22 = v9; v11 = 4LL * v9; if ( (unsigned __int64)v9 > 0x1FC0000000000000LL ) v11 = -1; src = (void *)operator new[](v11); memcpy(src, src_1, 4LL * v21); if ( src_1 != src_2 && src_1 ) operator delete[](src_1); v8 = v21; } ++v6; v5 += 4; v21 = v8 + 1; *((_DWORD *)src + v8) = v7; } while ( BYTE1(this->wire_code) >> 2 > v6 ); v3 = BYTE2(this->wire_code); v4 = v25; } v12 = BYTE2(this->wire_code1); if ( (v12 & 8) != 0 ) { v4 |= 0x20u; src_2[7] = v12 >> 4; } if ( LOWORD(this->wire_code2) != 0xFFFF ) { src_2[5] = LOWORD(this->wire_code2); v4 |= 8u; } if ( HIBYTE(this->wire_code1) != 0xFF ) { src_2[8] = HIBYTE(this->wire_code1); v4 |= 0x40u; } if ( (v3 & 0x30) != 0 ) { v4 |= 0x10u; src_2[6] = (v3 >> 4) & 3; } LOBYTE(v4) = v4 | 0x80; p_wire_name = (const std::string *)&this->wire_name; p__ZN6google8protobuf8internal12kEmptyStringE_1 = p__ZN6google8protobuf8internal12kEmptyStringE; v25 = v4; if ( p__ZN6google8protobuf8internal12kEmptyStringE == (std::string *)&google::protobuf::internal::kEmptyString ) { p__ZN6google8protobuf8internal12kEmptyStringE_1 = (std::string *)operator new(8u); *(_QWORD *)p__ZN6google8protobuf8internal12kEmptyStringE_1 = (char *)&std::string::_Rep::_S_empty_rep_storage + 24; p__ZN6google8protobuf8internal12kEmptyStringE = p__ZN6google8protobuf8internal12kEmptyStringE_1; } std::string::assign(p__ZN6google8protobuf8internal12kEmptyStringE_1, p_wire_name); HDDMDevice::writeMessage((HDDMDevice *)stream, (std::ostream *)wire_msg, v15); HDDMXng::Wire::~Wire((HDDMXng::Wire *)wire_msg); } void __fastcall HDDMWire::print(HDDMWire *this, std::ostream *stream, const std::string *fileName) { __int64 v6; // rbp __int64 v7; // rbx __int64 v8; // rdi int v9; // ebx __int64 v10; // rax __int64 v11; // rsi __int64 v12; // rdx int v13; // eax unsigned int v14; // r15d int n2; // eax __int64 v16; // rax const char *_RX_; // rsi __int64 v18; // rcx __int64 wire_code1_high; // rbp __int64 v20; // rbx __int64 wire_code2_low; // rbp __int64 v22; // rbx __int64 v23; // rax __int64 v24; // [rsp+8h] [rbp-40h] v6 = 0; v7 = std::__ostream_insert<char,std::char_traits<char>>( stream, *(_QWORD *)fileName, *(_QWORD *)(*(_QWORD *)fileName - 24LL)); std::__ostream_insert<char,std::char_traits<char>>(v7, "WIRE : ", 7); v8 = v7; v9 = 0; v10 = std::__ostream_insert<char,std::char_traits<char>>(v8, this->wire_name, *(_QWORD *)(this->wire_name - 24LL)); std::__ostream_insert<char,std::char_traits<char>>(v10, " (", 2); if ( BYTE1(this->wire_code) >> 2 ) { do { v11 = *(_QWORD *)fileName; v12 = *(_QWORD *)(*(_QWORD *)fileName - 24LL); v13 = *(_DWORD *)(this->interSectsVec + v6); v14 = v13 & 0x3FFFF; n2 = (v13 >> 18) & 3; if ( n2 ) { if ( n2 == 1 ) { v18 = std::__ostream_insert<char,std::char_traits<char>>(stream, v11, v12); _RX_ = " RX="; } else if ( n2 == 2 ) { v18 = std::__ostream_insert<char,std::char_traits<char>>(stream, v11, v12); _RX_ = " BX="; } else { v16 = std::__ostream_insert<char,std::char_traits<char>>(stream, v11, v12); _RX_ = " LX="; v18 = v16; } } else { v18 = std::__ostream_insert<char,std::char_traits<char>>(stream, v11, v12); _RX_ = " TX="; } v24 = v18; ++v9; std::__ostream_insert<char,std::char_traits<char>>(v18, _RX_, 4); v6 += 4; std::ostream::operator<<(v24, v14); } while ( BYTE1(this->wire_code) >> 2 > v9 ); } wire_code1_high = HIBYTE(this->wire_code1); v20 = std::__ostream_insert<char,std::char_traits<char>>( stream, *(_QWORD *)fileName, *(_QWORD *)(*(_QWORD *)fileName - 24LL)); std::__ostream_insert<char,std::char_traits<char>>(v20, " CC=", 4); std::ostream::_M_insert<unsigned long>(v20, wire_code1_high); wire_code2_low = LOWORD(this->wire_code2); v22 = std::__ostream_insert<char,std::char_traits<char>>( stream, *(_QWORD *)fileName, *(_QWORD *)(*(_QWORD *)fileName - 24LL)); std::__ostream_insert<char,std::char_traits<char>>(v22, " SM=", 4); std::ostream::_M_insert<unsigned long>(v22, wire_code2_low); v23 = std::__ostream_insert<char,std::char_traits<char>>( stream, *(_QWORD *)fileName, *(_QWORD *)(*(_QWORD *)fileName - 24LL)); std::__ostream_insert<char,std::char_traits<char>>(v23, " )", 2); } HDDMTileEdge *__fastcall HDDMWire::addtileport(HDDMWire *this, HDDMTilePort *hddmTilePort) { _QWORD *hddmTilePortVec_Begin; // rax bool v3; // zf HDDMTilePort *hddmTilePort_2; // rdx __int64 qword48_1; // rax HDDMTileEdge *qword0; // rax HDDMTilePort *p_hddmTilePort; // [rsp+8h] [rbp-10h] BYREF hddmTilePortVec_Begin = (_QWORD *)this->hddmTilePortVec_Begin; v3 = hddmTilePortVec_Begin == (_QWORD *)this->hddmTilePortVec_End; p_hddmTilePort = hddmTilePort; if ( v3 ) { std::vector<HDDMTilePort *>::_M_emplace_back_aux<HDDMTilePort * const&>(&this->hddmTilePortVec, &p_hddmTilePort); hddmTilePort_2 = p_hddmTilePort; } else { hddmTilePort_2 = hddmTilePort; if ( hddmTilePortVec_Begin ) { *hddmTilePortVec_Begin = hddmTilePort; qword48_1 = this->hddmTilePortVec_Begin; hddmTilePort_2 = p_hddmTilePort; } else { qword48_1 = 0; } this->hddmTilePortVec_Begin = qword48_1 + 8; } qword0 = hddmTilePort_2->hddmTileFace->hddmTileEdge; if ( qword0->n4 == 4 ) BYTE2(this->wire_code) |= 0x40u; return qword0; }
10-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值