请仔细阅读和分析下面函数,进行优化后,采用C/C++11标准,完整推导并重构可编译的全部代码
特别注意:
1.保持所有原始功能不变
2.提高执行效率,降低计算复杂度
3.已经给定的结构体名字和元素不要更改,详细的中文注释
4.自动添加中文注释说明功能逻辑
5.不使用 auto,使用显式 for 循环
6.结构体采用32位定义
7.不要使用小函数,保持原始的函数定义
8.严格保持protobuf字段映射关系
函数中的 HDDMXng::Arc::Arc 映射为
message Arc
{
optional uint32 flags = 1;
optional uint32 sitetype = 2;
optional uint32 element = 3;
optional uint32 indexinelement = 4;
optional uint32 frompin = 5;
optional uint32 topin = 6;
optional uint32 graphid = 7;
optional uint32 speedidx = 8;
optional uint32 wire0 = 9;
optional uint32 wire1 = 10;
}
将 _BYTE arc_msg[8] 映射为 HDDMXng::Arc arc_msg;
void __fastcall HDDMArc::readme_pb(HDDMArc *this, std::istream *stream, HDDMDevice *hddmDevice)
{
google::protobuf::Message *v3; // rdx
unsigned int v4; // ecx
int v5; // eax
unsigned int v6; // eax
bool v7; // zf
__int16 v8; // dx
__int16 v9; // ax
__int16 v10; // dx
_BYTE arc_msg[16]; // [rsp+0h] [rbp-58h] BYREF
unsigned int v12; // [rsp+10h] [rbp-48h]
__int16 v13; // [rsp+14h] [rbp-44h]
__int16 v14; // [rsp+18h] [rbp-40h]
__int16 v15; // [rsp+1Ch] [rbp-3Ch]
__int16 v16; // [rsp+20h] [rbp-38h]
__int16 v17; // [rsp+24h] [rbp-34h]
__int16 v18; // [rsp+28h] [rbp-30h]
int v19; // [rsp+2Ch] [rbp-2Ch]
int v20; // [rsp+30h] [rbp-28h]
int v21; // [rsp+34h] [rbp-24h]
char v22; // [rsp+3Ch] [rbp-1Ch]
if ( HDDMDeviceDump::useXngMarks )
std::istream::read(stream, HDDMDeviceDump::markBuffer, 3);
HDDMXng::Arc::Arc((HDDMXng::Arc *)arc_msg);
HDDMDevice::readMessage((HDDMDevice *)stream, (std::istream *)arc_msg, v3);
v4 = v12;
v5 = (8 * ((v12 >> 4) & 1))
| (v12 >> 3 << 7)
| (((v12 >> 2) & 1) << 6)
| (32 * ((v12 & 2) != 0)) & 0x27
| (4 * (v12 & 1)) & 0x27
| BYTE1(this->arc_code) & 3;
BYTE2(this->arc_code) = (8 * (BYTE1(v12) & 1))
| (4 * ((v12 & 0x80) != 0))
| (2 * ((v12 & 0x40) != 0)) & 0xF3
| ((v12 & 0x20) != 0)
| BYTE2(this->arc_code) & 0xF0;
v6 = (2 * ((v4 >> 10) & 1)) | (16 * ((v4 >> 9) & 1)) | v5 & 0xFFFFFFFD;
BYTE1(this->arc_code) = v6;
if ( (v6 & 4) != 0 )
{
v7 = v22 >= 0;
HIWORD(this->arc_code) = (v18 << 6) | HIWORD(this->arc_code) & 0x3F;
LOWORD(this->arc_code2) = v20;
HIWORD(this->arc_code2) = v21;
if ( !v7 )
LOWORD(this->arc_code1) = v19;
}
else
{
this->arc_code4 = ((v13 & 0x3FF) << 9) | this->arc_code4 & 0xFFF801FF;
v8 = v15;
HIWORD(this->arc_code4) = (8 * v14) | HIWORD(this->arc_code4) & 7;
v9 = (4 * (v8 & 0xFFF)) | this->arc_code5 & 0xC003;
v10 = v16;
LOWORD(this->arc_code5) = v9;
this->arc_code3 = (16 * (v10 & 0x3FFF)) | this->arc_code3 & 0xFFFC000F;
HIWORD(this->arc_code3) = (4 * v17) | HIWORD(this->arc_code3) & 3;
}
HDDMXng::Arc::~Arc((HDDMXng::Arc *)arc_msg);
}
void __fastcall HDDMArc::writeme_pb(HDDMArc *this, std::ostream *stream)
{
char v4; // dl
bool v5; // cl
int v6; // eax
char v7; // si
int v8; // edi
bool v9; // zf
unsigned __int64 v10; // rdx
unsigned __int16 word0_high; // ax
unsigned int word10; // eax
_DWORD arc_msg[15]; // [rsp+0h] [rbp-58h] BYREF
unsigned int v14; // [rsp+3Ch] [rbp-1Ch]
if ( HDDMDeviceDump::useXngMarks )
std::ostream::write(stream, "ARC", 3);
HDDMXng::Arc::Arc((HDDMXng::Arc *)arc_msg);
v4 = BYTE1(this->arc_code);
v5 = (v4 & 4) != 0;
v6 = v5;
if ( (v4 & 0x20) != 0 )
v6 = v5 | 2;
if ( (v4 & 0x40) != 0 )
v6 |= 4u;
if ( v4 < 0 )
v6 |= 8u;
if ( (v4 & 8) != 0 )
v6 |= 0x10u;
v7 = BYTE2(this->arc_code);
if ( (v7 & 1) != 0 )
v6 |= 0x20u;
if ( (v7 & 2) != 0 )
v6 |= 0x40u;
v8 = v6;
if ( (v7 & 4) != 0 )
{
LOBYTE(v8) = v6 | 0x80;
v6 = v8;
}
if ( (v7 & 8) != 0 )
v6 |= 0x100u;
if ( (v4 & 0x10) != 0 )
v6 |= 0x200u;
v9 = (v4 & 2) == 0;
v10 = v14;
if ( !v9 )
v6 |= 0x400u;
arc_msg[4] = v6;
if ( v5 )
{
word0_high = HIWORD(this->arc_code);
v14 |= 0x341u;
arc_msg[10] = word0_high >> 6;
arc_msg[12] = LOWORD(this->arc_code2);
arc_msg[13] = HIWORD(this->arc_code2);
if ( LOWORD(this->arc_code1) != 0xFFFF )
{
v10 = (unsigned int)v10 | 0x3C1;
arc_msg[11] = LOWORD(this->arc_code1);
v14 = v10;
}
}
else
{
word10 = this->arc_code4;
v10 = v14 | 0x3F;
v14 |= 0x3Fu;
arc_msg[5] = (word10 >> 9) & 0x3FF;
arc_msg[6] = HIWORD(this->arc_code4) >> 3;
arc_msg[7] = (LOWORD(this->arc_code5) >> 2) & 0xFFF;
arc_msg[8] = ((unsigned int)this->arc_code3 >> 4) & 0x3FFF;
arc_msg[9] = HIWORD(this->arc_code3) >> 2;
}
HDDMDevice::writeMessage((HDDMDevice *)stream, (std::ostream *)arc_msg, (const google::protobuf::Message *)v10);
HDDMXng::Arc::~Arc((HDDMXng::Arc *)arc_msg);
}
void __fastcall HDDMArc::print(HDDMArc *this, std::ostream *stream, const std::string *stdFileName)
{
__int64 word4_high; // r15
__int64 v5; // r13
__int64 v6; // r14
__int64 v7; // r15
__int64 v8; // r14
__int64 v9; // r14
__int64 v10; // r14
std::ostream *v11; // r14
__int64 v12; // rax
_BYTE *v13; // r13
char v14; // al
std::ostream *v15; // rax
unsigned __int8 v16; // r10
char v17; // r14
__int64 v18; // r13
__int64 v19; // r15
__int64 v20; // r15
__int64 v21; // r15
__int64 v22; // r15
__int64 v23; // r15
__int64 v24; // r15
__int64 v25; // r15
__int64 v26; // r14
std::ostream *v27; // r14
__int64 v28; // rax
_BYTE *v29; // r13
char v30; // al
std::ostream *v31; // rax
char v32; // r13
char v33; // r14
__int64 v34; // r13
__int64 v35; // r13
__int64 v36; // r13
__int64 v37; // r13
std::ostream *v38; // r14
__int64 v39; // rax
_BYTE *v40; // r13
char v41; // al
std::ostream *v42; // rax
__int64 v43; // r14
__int64 v44; // r13
__int64 v45; // r15
__int64 v46; // r14
__int64 v47; // r14
std::ostream *v48; // r14
__int64 v49; // rax
_BYTE *v50; // r13
char v51; // al
std::ostream *v52; // rax
unsigned __int16 v53; // r14
__int64 v54; // r13
std::ostream *v55; // r14
__int64 v56; // rax
_BYTE *v57; // r13
char v58; // al
std::ostream *v59; // rax
unsigned int v60; // r14d
unsigned __int8 v61; // r13
__int64 v62; // rbx
__int64 v63; // rbp
__int64 v64; // rbx
__int64 v65; // rbx
std::ostream *v66; // rbp
__int64 v67; // rax
_BYTE *v68; // rbx
char v69; // al
std::ostream *v70; // rax
__int64 word4_low; // [rsp+8h] [rbp-60h]
__int64 word8_high; // [rsp+8h] [rbp-60h]
unsigned __int16 v73; // [rsp+8h] [rbp-60h]
unsigned __int8 v74; // [rsp+10h] [rbp-58h]
unsigned __int8 v75; // [rsp+10h] [rbp-58h]
__int64 word8_low; // [rsp+10h] [rbp-58h]
unsigned __int16 v77; // [rsp+18h] [rbp-50h]
bool v78; // [rsp+18h] [rbp-50h]
__int64 v79; // [rsp+18h] [rbp-50h]
bool v80; // [rsp+24h] [rbp-44h]
bool v81; // [rsp+28h] [rbp-40h]
bool v82; // [rsp+2Ch] [rbp-3Ch]
word4_high = HIWORD(this->arc_code1);
v77 = HIWORD(this->arc_code) >> 6;
word4_low = LOWORD(this->arc_code1);
v74 = HIBYTE(this->arc_code5) >> 4;
v5 = BYTE1(this->arc_code) >> 5;
v6 = std::__ostream_insert<char,std::char_traits<char>>(
stream,
*(_QWORD *)stdFileName,
*(_QWORD *)(*(_QWORD *)stdFileName - 24LL));
std::__ostream_insert<char,std::char_traits<char>>(v6, "ARC m_arcIndex : ", 17);
v7 = std::ostream::_M_insert<unsigned long>(v6, word4_high);
std::__ostream_insert<char,std::char_traits<char>>(v7, "m_speedidx : ", 13);
v8 = std::ostream::_M_insert<unsigned long>(v7, word4_low);
std::__ostream_insert<char,std::char_traits<char>>(v8, " m_deviceid : ", 14);
v9 = std::ostream::_M_insert<unsigned long>(v8, v74);
std::__ostream_insert<char,std::char_traits<char>>(v9, " m_graphid : ", 13);
v10 = std::ostream::_M_insert<unsigned long>(v9, v77);
std::__ostream_insert<char,std::char_traits<char>>(v10, " m_directional : ", 17);
v11 = (std::ostream *)std::ostream::_M_insert<unsigned long>(v10, v5 & 1);
v12 = *(_QWORD *)(*(_QWORD *)v11 - 24LL);
v13 = *(_BYTE **)((char *)v11 + v12 + 240);
if ( !v13 )
goto LABEL_26;
if ( v13[56] )
{
v14 = v13[67];
}
else
{
std::ctype<char>::_M_widen_init(*(_QWORD *)((char *)v11 + v12 + 240));
v14 = (*(__int64 (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v13 + 48LL))(v13, 10);
}
v15 = (std::ostream *)std::ostream::put(v11, v14);
std::ostream::flush(v15);
v16 = BYTE1(this->arc_code);
v82 = (this->arc_code & 0x20000) != 0;
v17 = BYTE2(this->arc_code);
v75 = v16 >> 7;
v81 = (v16 & 0x10) != 0;
v80 = (v16 & 8) != 0;
v78 = (v16 & 0x40) != 0;
v18 = v16 >> 1;
v19 = std::__ostream_insert<char,std::char_traits<char>>(
stream,
*(_QWORD *)stdFileName,
*(_QWORD *)(*(_QWORD *)stdFileName - 24LL));
std::__ostream_insert<char,std::char_traits<char>>(v19, "m_buffered21 : ", 15);
v20 = std::ostream::_M_insert<unsigned long>(v19, v78);
std::__ostream_insert<char,std::char_traits<char>>(v20, " m_buffered20 ", 14);
v21 = std::ostream::_M_insert<unsigned long>(v20, v75);
std::__ostream_insert<char,std::char_traits<char>>(v21, " m_pseudo : ", 12);
v22 = std::ostream::_M_insert<unsigned long>(v21, v80);
std::__ostream_insert<char,std::char_traits<char>>(v22, " m_latePseudo ", 14);
v23 = std::ostream::_M_insert<unsigned long>(v22, v81);
std::__ostream_insert<char,std::char_traits<char>>(v23, " m_excluded ", 12);
v24 = std::ostream::_M_insert<unsigned long>(v23, v17 & 1);
std::__ostream_insert<char,std::char_traits<char>>(v24, " m_test : ", 10);
v25 = std::ostream::_M_insert<unsigned long>(v24, v82);
std::__ostream_insert<char,std::char_traits<char>>(v25, " m_removed : ", 13);
v26 = std::ostream::_M_insert<unsigned long>(v25, (v17 & 4) != 0);
std::__ostream_insert<char,std::char_traits<char>>(v26, " m_fake : ", 10);
v27 = (std::ostream *)std::ostream::_M_insert<unsigned long>(v26, v18 & 1);
v28 = *(_QWORD *)(*(_QWORD *)v27 - 24LL);
v29 = *(_BYTE **)((char *)v27 + v28 + 240);
if ( !v29 )
goto LABEL_26;
if ( v29[56] )
{
v30 = v29[67];
}
else
{
std::ctype<char>::_M_widen_init(*(_QWORD *)((char *)v27 + v28 + 240));
v30 = (*(__int64 (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v29 + 48LL))(v29, 10);
}
v31 = (std::ostream *)std::ostream::put(v27, v30);
std::ostream::flush(v31);
v32 = BYTE1(this->arc_code);
v33 = BYTE2(this->arc_code);
word8_low = LOWORD(this->arc_code2);
word8_high = HIWORD(this->arc_code2);
v79 = std::__ostream_insert<char,std::char_traits<char>>(
stream,
*(_QWORD *)stdFileName,
*(_QWORD *)(*(_QWORD *)stdFileName - 24LL));
std::__ostream_insert<char,std::char_traits<char>>(v79, "m_wire2wire : ", 14);
v34 = std::ostream::_M_insert<unsigned long>(v79, (v32 & 4) != 0);
std::__ostream_insert<char,std::char_traits<char>>(v34, " m_inverts ", 11);
v35 = std::ostream::_M_insert<unsigned long>(v34, (v33 & 8) != 0);
std::__ostream_insert<char,std::char_traits<char>>(v35, " m_caninvert ", 13);
v36 = std::ostream::_M_insert<unsigned long>(v35, (v33 & 0x10) != 0);
std::__ostream_insert<char,std::char_traits<char>>(v36, " m_wire0 : ", 11);
v37 = std::ostream::_M_insert<unsigned long>(v36, word8_low);
std::__ostream_insert<char,std::char_traits<char>>(v37, " m_wire1 ", 9);
v38 = (std::ostream *)std::ostream::_M_insert<unsigned long>(v37, word8_high);
v39 = *(_QWORD *)(*(_QWORD *)v38 - 24LL);
v40 = *(_BYTE **)((char *)v38 + v39 + 240);
if ( !v40 )
goto LABEL_26;
if ( v40[56] )
{
v41 = v40[67];
}
else
{
std::ctype<char>::_M_widen_init(*(_QWORD *)((char *)v38 + v39 + 240));
v41 = (*(__int64 (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v40 + 48LL))(v40, 10);
}
v42 = (std::ostream *)std::ostream::put(v38, v41);
std::ostream::flush(v42);
v43 = HIWORD(this->arc_code4) >> 3;
v44 = HIWORD(this->arc_code3) >> 2;
v73 = ((unsigned int)this->arc_code3 >> 4) & 0x3FFF;
v45 = std::__ostream_insert<char,std::char_traits<char>>(
stream,
*(_QWORD *)stdFileName,
*(_QWORD *)(*(_QWORD *)stdFileName - 24LL));
std::__ostream_insert<char,std::char_traits<char>>(v45, " m_element ", 11);
v46 = std::ostream::_M_insert<unsigned long>(v45, (unsigned __int16)v43);
std::__ostream_insert<char,std::char_traits<char>>(v46, " m_frompin ", 11);
v47 = std::ostream::_M_insert<unsigned long>(v46, v73);
std::__ostream_insert<char,std::char_traits<char>>(v47, " m_topin ", 9);
v48 = (std::ostream *)std::ostream::_M_insert<unsigned long>(v47, (unsigned __int16)v44);
v49 = *(_QWORD *)(*(_QWORD *)v48 - 24LL);
v50 = *(_BYTE **)((char *)v48 + v49 + 240);
if ( !v50 )
goto LABEL_26;
if ( v50[56] )
{
v51 = v50[67];
}
else
{
std::ctype<char>::_M_widen_init(*(_QWORD *)((char *)v48 + v49 + 240));
v51 = (*(__int64 (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v50 + 48LL))(v50, 10);
}
v52 = (std::ostream *)std::ostream::put(v48, v51);
std::ostream::flush(v52);
v53 = ((unsigned int)this->arc_code4 >> 9) & 0x3FF;
v54 = std::__ostream_insert<char,std::char_traits<char>>(
stream,
*(_QWORD *)stdFileName,
*(_QWORD *)(*(_QWORD *)stdFileName - 24LL));
std::__ostream_insert<char,std::char_traits<char>>(v54, " m_sitetype : ", 14);
v55 = (std::ostream *)std::ostream::_M_insert<unsigned long>(v54, v53);
v56 = *(_QWORD *)(*(_QWORD *)v55 - 24LL);
v57 = *(_BYTE **)((char *)v55 + v56 + 240);
if ( !v57 )
goto LABEL_26;
if ( v57[56] )
{
v58 = v57[67];
}
else
{
std::ctype<char>::_M_widen_init(*(_QWORD *)((char *)v55 + v56 + 240));
v58 = (*(__int64 (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v57 + 48LL))(v57, 10);
}
v59 = (std::ostream *)std::ostream::put(v55, v58);
std::ostream::flush(v59);
v60 = (unsigned int)this->arc_code5 >> 14;
v61 = this->arc_code3 & 0xF;
v62 = this->arc_code4 & 0x1FF;
v63 = std::__ostream_insert<char,std::char_traits<char>>(
stream,
*(_QWORD *)stdFileName,
*(_QWORD *)(*(_QWORD *)stdFileName - 24LL));
std::__ostream_insert<char,std::char_traits<char>>(v63, " m_wasted1: ", 12);
v64 = std::ostream::_M_insert<unsigned long>(v63, (unsigned __int16)v62);
std::__ostream_insert<char,std::char_traits<char>>(v64, " m_wasted2 : ", 13);
v65 = std::ostream::_M_insert<unsigned long>(v64, v61);
std::__ostream_insert<char,std::char_traits<char>>(v65, "m_wastedFlag : ", 15);
v66 = (std::ostream *)std::ostream::_M_insert<unsigned long>(v65, v60 & 0x3FFF);
v67 = *(_QWORD *)(*(_QWORD *)v66 - 24LL);
v68 = *(_BYTE **)((char *)v66 + v67 + 240);
if ( !v68 )
LABEL_26:
std::__throw_bad_cast();
if ( v68[56] )
{
v69 = v68[67];
}
else
{
std::ctype<char>::_M_widen_init(*(_QWORD *)((char *)v66 + v67 + 240));
v69 = (*(__int64 (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v68 + 48LL))(v68, 10);
}
v70 = (std::ostream *)std::ostream::put(v66, v69);
std::ostream::flush(v70);
}
__int16 __fastcall HDDMArc::getArcIndexInElement(HDDMArc *this)
{
return (LOWORD(this->arc_code5) >> 2) & 0xFFF;
}
__int64 __fastcall HDDMArc::getElement(HDDMArc *this)
{
__int64 v1; // rdx
__int64 v2; // rdx
v1 = HDDMDeviceCache::m_devcache[(HIBYTE(this->arc_code5) >> 4) & 0xF];
if ( v1 && (v2 = *(_QWORD *)(*(_QWORD *)(v1 + 144) + 8LL * (((unsigned int)this->arc_code4 >> 9) & 0x3FF))) != 0 )
return *(_QWORD *)(*(_QWORD *)(v2 + 56) + 8LL * (HIWORD(this->arc_code4) >> 3));
else
return 0;
}
__int64 __fastcall HDDMArc::getFromElementPin(HDDMArc *this)
{
__int64 Element; // rax
Element = HDDMArc::getElement(this);
if ( Element )
return *(_QWORD *)(*(_QWORD *)(Element + 16) + 8LL * (((unsigned int)this->arc_code3 >> 4) & 0x3FFF));
else
return 0;
}
__int64 __fastcall HDDMArc::getIndex(HDDMArc *this)
{
return HIWORD(this->arc_code1);
}
void __fastcall HDDMArc::getName(HDDMArc *this, __int64 a2)
{
bool v4; // zf
__int64 Element; // rax
__int64 v6; // rdi
HDDMElementPin *FromElementPinEv; // r12
HDDMElementPin *ToElementPinEv; // r14
const std::string *Name; // rax
__int64 v10; // rdi
const std::string *NameEv; // rax
__int64 v12; // rax
__int64 v13; // rdi
int v14; // eax
__int64 v15; // rdi
__int64 v16; // rcx
__int64 v17; // rsi
__int64 v18; // rax
unsigned __int16 v19; // dx
__int64 v20; // rcx
__int64 v21; // r14
__int64 v22; // rdi
char v23; // al
char *v24; // rdx
__int64 *v25; // rax
__int64 v26; // rdi
_QWORD *v27; // rax
_QWORD *v28; // rax
_QWORD *v29; // rax
__int64 v30; // rdi
__int64 v31; // rdi
__int64 v32; // rdi
__int64 v33; // rdi
__int64 v34; // rdi
__int64 v35; // rdi
__int64 v36; // rdi
__int64 v37; // rdi
__int64 v38; // rdi
int v39; // eax
int v40; // eax
int v41; // eax
int v42; // eax
int v43; // eax
int v44; // eax
int v45; // eax
int v46; // eax
int v47; // eax
int v48; // eax
int v49; // eax
int v50; // eax
int v51; // eax
int v52; // eax
int v53; // edx
int v54; // edx
int v55; // edx
int v56; // edx
int v57; // edx
int v58; // edx
int v59; // edx
int v60; // edx
int v61; // edx
int v62; // edx
int v63; // edx
int v64; // edx
int v65; // edx
int v66; // edx
int v67; // edx
char v68; // [rsp+27h] [rbp-121h] BYREF
char v69; // [rsp+28h] [rbp-120h] BYREF
char v70; // [rsp+29h] [rbp-11Fh] BYREF
char v71; // [rsp+2Ah] [rbp-11Eh] BYREF
char v72; // [rsp+2Bh] [rbp-11Dh] BYREF
_BYTE v73[4]; // [rsp+2Ch] [rbp-11Ch] BYREF
_QWORD v74[2]; // [rsp+30h] [rbp-118h] BYREF
_QWORD v75[2]; // [rsp+40h] [rbp-108h] BYREF
_QWORD v76[2]; // [rsp+50h] [rbp-F8h] BYREF
_QWORD v77[2]; // [rsp+60h] [rbp-E8h] BYREF
_QWORD v78[2]; // [rsp+70h] [rbp-D8h] BYREF
_QWORD v79[2]; // [rsp+80h] [rbp-C8h] BYREF
_QWORD v80[2]; // [rsp+90h] [rbp-B8h] BYREF
_QWORD v81[2]; // [rsp+A0h] [rbp-A8h] BYREF
_QWORD v82[2]; // [rsp+B0h] [rbp-98h] BYREF
_QWORD v83[2]; // [rsp+C0h] [rbp-88h] BYREF
__int64 v84; // [rsp+D0h] [rbp-78h] BYREF
_QWORD v85[2]; // [rsp+E0h] [rbp-68h] BYREF
_QWORD v86[2]; // [rsp+F0h] [rbp-58h] BYREF
_QWORD v87[9]; // [rsp+100h] [rbp-48h] BYREF
v4 = (*(_BYTE *)(a2 + 1) & 4) == 0;
v74[0] = (char *)&std::string::_Rep::_S_empty_rep_storage + 24;
v75[0] = (char *)&std::string::_Rep::_S_empty_rep_storage + 24;
v76[0] = (char *)&std::string::_Rep::_S_empty_rep_storage + 24;
if ( v4 )
{
Element = HDDMArc::getElement((HDDMArc *)a2);
if ( Element )
std::string::string((std::string *)v80, (const std::string *)(Element + 8));
else
std::string::string(v80, "noElement", &v71);
std::string::assign((std::string *)v74, (const std::string *)v80);
v6 = v80[0] - 24LL;
if ( (_UNKNOWN *)(v80[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v52 = _InterlockedExchangeAdd((volatile signed __int32 *)(v80[0] - 8LL), 0xFFFFFFFF);
}
else
{
v53 = *(_DWORD *)(v80[0] - 8LL);
*(_DWORD *)(v80[0] - 8LL) = v53 - 1;
v52 = v53;
}
if ( v52 <= 0 )
std::string::_Rep::_M_destroy(v6, v87);
}
FromElementPinEv = (HDDMElementPin *)HDDMArc::getFromElementPin((HDDMArc *)a2);
ToElementPinEv = (HDDMElementPin *)HDDMArc::getToElementPin((HDDMArc *)a2);
if ( FromElementPinEv )
{
Name = (const std::string *)HDDMElementPin::getName(FromElementPinEv);
std::string::string((std::string *)v81, Name);
}
else
{
std::string::string(v81, "noPin0", &v72);
}
std::string::assign((std::string *)v75, (const std::string *)v81);
v10 = v81[0] - 24LL;
if ( (_UNKNOWN *)(v81[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v51 = _InterlockedExchangeAdd((volatile signed __int32 *)(v81[0] - 8LL), 0xFFFFFFFF);
}
else
{
v67 = *(_DWORD *)(v81[0] - 8LL);
*(_DWORD *)(v81[0] - 8LL) = v67 - 1;
v51 = v67;
}
if ( v51 <= 0 )
std::string::_Rep::_M_destroy(v10, v87);
}
if ( ToElementPinEv )
{
NameEv = (const std::string *)HDDMElementPin::getName(ToElementPinEv);
std::string::string((std::string *)v86, NameEv);
}
else
{
std::string::string(v86, "noPin1", v73);
}
std::string::assign((std::string *)v76, (const std::string *)v86);
v12 = v86[0];
v13 = v86[0] - 24LL;
if ( (_UNKNOWN *)(v86[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
LABEL_11:
if ( &_pthread_key_create )
{
v14 = _InterlockedExchangeAdd((volatile signed __int32 *)(v13 + 16), 0xFFFFFFFF);
}
else
{
v54 = *(_DWORD *)(v12 - 8);
*(_DWORD *)(v12 - 8) = v54 - 1;
v14 = v54;
}
if ( v14 <= 0 )
std::string::_Rep::_M_destroy(v13, v87);
}
}
else
{
if ( *(_QWORD *)(*(_QWORD *)(HDDMDeviceCache::m_devcache[(*(_BYTE *)(a2 + 23) >> 4) & 0xF] + 168LL)
+ 8LL * (*(_WORD *)(a2 + 2) >> 6)) )
HDDMTileType::getName((HDDMTileType *)v77);
else
std::string::string(v77, "noTileType", &v68);
std::string::swap((std::string *)v74, (std::string *)v77);
v15 = v77[0] - 24LL;
if ( (_UNKNOWN *)(v77[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v49 = _InterlockedExchangeAdd((volatile signed __int32 *)(v77[0] - 8LL), 0xFFFFFFFF);
}
else
{
v65 = *(_DWORD *)(v77[0] - 8LL);
*(_DWORD *)(v77[0] - 8LL) = v65 - 1;
v49 = v65;
}
if ( v49 <= 0 )
std::string::_Rep::_M_destroy(v15, v87);
}
v16 = *(unsigned __int16 *)(a2 + 8);
v17 = 0;
v18 = *(_QWORD *)(*(_QWORD *)(HDDMDeviceCache::m_devcache[(*(_BYTE *)(a2 + 23) >> 4) & 0xF] + 168LL)
+ 8LL * (*(_WORD *)(a2 + 2) >> 6));
v19 = *(_WORD *)(v18 + 28);
if ( (unsigned __int16)v16 < v19 )
v17 = *(_QWORD *)(v18 + 224) + 88 * v16;
v20 = *(unsigned __int16 *)(a2 + 10);
v21 = 0;
if ( v19 > (unsigned __int16)v20 )
v21 = *(_QWORD *)(v18 + 224) + 88 * v20;
if ( v17 )
std::string::string((std::string *)v78, (const std::string *)(v17 + 32));
else
std::string::string(v78, "noWire0", &v69);
std::string::swap((std::string *)v75, (std::string *)v78);
v22 = v78[0] - 24LL;
if ( (_UNKNOWN *)(v78[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v50 = _InterlockedExchangeAdd((volatile signed __int32 *)(v78[0] - 8LL), 0xFFFFFFFF);
}
else
{
v66 = *(_DWORD *)(v78[0] - 8LL);
*(_DWORD *)(v78[0] - 8LL) = v66 - 1;
v50 = v66;
}
if ( v50 <= 0 )
std::string::_Rep::_M_destroy(v22, v87);
}
if ( v21 )
std::string::string((std::string *)v79, (const std::string *)(v21 + 32));
else
std::string::string(v79, "noWire1", &v70);
std::string::swap((std::string *)v76, (std::string *)v79);
v12 = v79[0];
v13 = v79[0] - 24LL;
if ( (_UNKNOWN *)(v79[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
goto LABEL_11;
}
std::string::string(v82, ">", v87);
v23 = *(_BYTE *)(a2 + 1);
if ( (v23 & 0x40) != 0 )
{
std::string::append((std::string *)v82, ">", 1u);
v23 = *(_BYTE *)(a2 + 1);
}
v24 = (char *)&std::string::_Rep::_S_empty_rep_storage + 24;
v83[0] = (char *)&std::string::_Rep::_S_empty_rep_storage + 24;
if ( (v23 & 0x20) == 0 )
{
std::string::assign((std::string *)v83, "<", 1u);
if ( *(char *)(a2 + 1) < 0 )
std::string::append((std::string *)v83, "<", 1u);
v24 = (char *)v83[0];
}
v87[0] = (char *)&std::string::_Rep::_S_empty_rep_storage + 24;
std::string::reserve((std::string *)v87, *((_QWORD *)v24 - 3) + 1LL);
std::string::append((std::string *)v87, (const std::string *)v83);
std::string::replace((std::string *)v87, *(_QWORD *)(v87[0] - 24LL), 0, "-", 1u);
v25 = (__int64 *)std::string::append((std::string *)v87, (const std::string *)v82);
v84 = *v25;
*v25 = (__int64)&std::string::_Rep::_S_empty_rep_storage + 24;
v26 = v87[0] - 24LL;
if ( (_UNKNOWN *)(v87[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v46 = _InterlockedExchangeAdd((volatile signed __int32 *)(v87[0] - 8LL), 0xFFFFFFFF);
}
else
{
v63 = *(_DWORD *)(v87[0] - 8LL);
*(_DWORD *)(v87[0] - 8LL) = v63 - 1;
v46 = v63;
}
if ( v46 <= 0 )
std::string::_Rep::_M_destroy(v26, v86);
}
v85[0] = (char *)&std::string::_Rep::_S_empty_rep_storage + 24;
std::string::reserve((std::string *)v85, *(_QWORD *)(v74[0] - 24LL) + 1LL);
std::string::append((std::string *)v85, (const std::string *)v74);
std::string::replace((std::string *)v85, *(_QWORD *)(v85[0] - 24LL), 0, ".", 1u);
v27 = (_QWORD *)std::string::append((std::string *)v85, (const std::string *)v75);
v86[0] = *v27;
*v27 = (char *)&std::string::_Rep::_S_empty_rep_storage + 24;
v28 = (_QWORD *)std::string::append((std::string *)v86, (const std::string *)&v84);
v87[0] = *v28;
*v28 = (char *)&std::string::_Rep::_S_empty_rep_storage + 24;
v29 = (_QWORD *)std::string::append((std::string *)v87, (const std::string *)v76);
*(_QWORD *)&this->arc_code = *v29;
*v29 = (char *)&std::string::_Rep::_S_empty_rep_storage + 24;
v30 = v87[0] - 24LL;
if ( (_UNKNOWN *)(v87[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v44 = _InterlockedExchangeAdd((volatile signed __int32 *)(v87[0] - 8LL), 0xFFFFFFFF);
}
else
{
v61 = *(_DWORD *)(v87[0] - 8LL);
*(_DWORD *)(v87[0] - 8LL) = v61 - 1;
v44 = v61;
}
if ( v44 <= 0 )
std::string::_Rep::_M_destroy(v30, v81);
}
v31 = v86[0] - 24LL;
if ( (_UNKNOWN *)(v86[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v48 = _InterlockedExchangeAdd((volatile signed __int32 *)(v86[0] - 8LL), 0xFFFFFFFF);
}
else
{
v64 = *(_DWORD *)(v86[0] - 8LL);
*(_DWORD *)(v86[0] - 8LL) = v64 - 1;
v48 = v64;
}
if ( v48 <= 0 )
std::string::_Rep::_M_destroy(v31, v87);
}
v32 = v85[0] - 24LL;
if ( (_UNKNOWN *)(v85[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v42 = _InterlockedExchangeAdd((volatile signed __int32 *)(v85[0] - 8LL), 0xFFFFFFFF);
}
else
{
v62 = *(_DWORD *)(v85[0] - 8LL);
*(_DWORD *)(v85[0] - 8LL) = v62 - 1;
v42 = v62;
}
if ( v42 <= 0 )
std::string::_Rep::_M_destroy(v32, v87);
}
v33 = v84 - 24;
if ( (_UNKNOWN *)(v84 - 24) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v39 = _InterlockedExchangeAdd((volatile signed __int32 *)(v84 - 8), 0xFFFFFFFF);
}
else
{
v56 = *(_DWORD *)(v84 - 8);
*(_DWORD *)(v84 - 8) = v56 - 1;
v39 = v56;
}
if ( v39 <= 0 )
std::string::_Rep::_M_destroy(v33, v87);
}
v34 = v83[0] - 24LL;
if ( (_UNKNOWN *)(v83[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v41 = _InterlockedExchangeAdd((volatile signed __int32 *)(v83[0] - 8LL), 0xFFFFFFFF);
}
else
{
v55 = *(_DWORD *)(v83[0] - 8LL);
*(_DWORD *)(v83[0] - 8LL) = v55 - 1;
v41 = v55;
}
if ( v41 <= 0 )
std::string::_Rep::_M_destroy(v34, v87);
}
v35 = v82[0] - 24LL;
if ( (_UNKNOWN *)(v82[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v45 = _InterlockedExchangeAdd((volatile signed __int32 *)(v82[0] - 8LL), 0xFFFFFFFF);
}
else
{
v57 = *(_DWORD *)(v82[0] - 8LL);
*(_DWORD *)(v82[0] - 8LL) = v57 - 1;
v45 = v57;
}
if ( v45 <= 0 )
std::string::_Rep::_M_destroy(v35, v87);
}
v36 = v76[0] - 24LL;
if ( (_UNKNOWN *)(v76[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v43 = _InterlockedExchangeAdd((volatile signed __int32 *)(v76[0] - 8LL), 0xFFFFFFFF);
}
else
{
v58 = *(_DWORD *)(v76[0] - 8LL);
*(_DWORD *)(v76[0] - 8LL) = v58 - 1;
v43 = v58;
}
if ( v43 <= 0 )
std::string::_Rep::_M_destroy(v36, v87);
}
v37 = v75[0] - 24LL;
if ( (_UNKNOWN *)(v75[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v47 = _InterlockedExchangeAdd((volatile signed __int32 *)(v75[0] - 8LL), 0xFFFFFFFF);
}
else
{
v59 = *(_DWORD *)(v75[0] - 8LL);
*(_DWORD *)(v75[0] - 8LL) = v59 - 1;
v47 = v59;
}
if ( v47 <= 0 )
std::string::_Rep::_M_destroy(v37, v87);
}
v38 = v74[0] - 24LL;
if ( (_UNKNOWN *)(v74[0] - 24LL) != &std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v40 = _InterlockedExchangeAdd((volatile signed __int32 *)(v74[0] - 8LL), 0xFFFFFFFF);
}
else
{
v60 = *(_DWORD *)(v74[0] - 8LL);
*(_DWORD *)(v74[0] - 8LL) = v60 - 1;
v40 = v60;
}
if ( v40 <= 0 )
std::string::_Rep::_M_destroy(v38, v87);
}
}
const HDDMWire *__fastcall HDDMArc::getOtherWire(HDDMArc *this, const HDDMWire *a2)
{
__int64 arc_code2_low; // r8
__int64 v3; // rax
const HDDMWire *v4; // rdx
unsigned __int16 arc_code2_low_1; // cx
__int64 arc_code2_high; // rdi
const HDDMWire *v7; // r8
const HDDMWire *result; // rax
arc_code2_low = LOWORD(this->arc_code2);
v3 = *(_QWORD *)(*(_QWORD *)(HDDMDeviceCache::m_devcache[(HIBYTE(this->arc_code5) >> 4) & 0xF] + 168LL)
+ 8LL * (HIWORD(this->arc_code) >> 6));
v4 = 0;
arc_code2_low_1 = *(_WORD *)(v3 + 28);
if ( (unsigned __int16)arc_code2_low < arc_code2_low_1 )
v4 = (const HDDMWire *)(*(_QWORD *)(v3 + 224) + 88 * arc_code2_low);
arc_code2_high = HIWORD(this->arc_code2);
v7 = 0;
if ( arc_code2_low_1 > (unsigned __int16)arc_code2_high )
v7 = (const HDDMWire *)(*(_QWORD *)(v3 + 224) + 88 * arc_code2_high);
if ( a2 == v4 )
return v7;
result = 0;
if ( a2 == v7 )
return v4;
return result;
}
__int64 __fastcall HDDMArc::getSiteType(HDDMArc *this)
{
__int64 v1; // rdx
v1 = HDDMDeviceCache::m_devcache[(HIBYTE(this->arc_code5) >> 4) & 0xF];
if ( v1 )
return *(_QWORD *)(*(_QWORD *)(v1 + 144) + 8LL * (((unsigned int)this->arc_code4 >> 9) & 0x3FF));
else
return 0;
}
__int64 __fastcall HDDMArc::getToElementPin(HDDMArc *this)
{
__int64 Element; // rax
Element = HDDMArc::getElement(this);
if ( Element )
return *(_QWORD *)(*(_QWORD *)(Element + 16) + 8LL * (HIWORD(this->arc_code3) >> 2));
else
return 0;
}
最新发布