请仔细阅读和分析下面函数,保持函数原始逻辑功能不变, 不要遗漏逻辑细节,进行优化后,采用C/C++11标准,完整推导并重构可编译的全部代码
要求如下:
1.保持原始函数定义不变,不要拆分函数
2.保持所有原始逻辑功能不变
3.结构体采用32位定义
4.严格保持protobuf字段映射关系,不要遗漏protobuf字段内容
5.提高执行效率,降低计算复杂度
6.已经给定的结构体名字和元素不要更改,详细的中文注释
7.自动添加中文注释说明功能逻辑
8.不使用 auto,使用显式 for 循环
特别注意:
1.函数中的 HDDMXng::BelDef::BelDef 映射为
message BelDef
{
optional bool optinv = 1;
optional bool rbel = 2;
optional string belname = 3;
optional uint32 numoutputpins = 4;
optional uint32 numinputpins = 5;
optional uint32 numpins = 6;
optional uint32 numsrcs = 7;
optional uint32 numprims = 8;
repeated uint32 srcgnds = 9 [packed = true];
repeated BelDefPip pips = 10;
optional bool hasusagedef = 11;
}
其中,依赖消息有:
message BelDefPip
{
optional uint32 pin1 = 1;
optional uint32 pin2 = 2;
repeated AttrSetting attrsettings = 3;
}
message AttrSetting
{
optional string attrname = 1;
optional string attrvalue = 2;
}
2.将函数中 _BYTE beldef_msg[16] 映射为 HDDMXng::BelDef beldef_msg
void HDDMBelDef::HDDMBelDef(HDDMBelDef *this)
{
int beldef_code; // eax
unsigned int v2; // eax
LOWORD(this->beldef_code) &= 0xC000u;
LOBYTE(this->beldef_code1) &= 0xF0u;
LODWORD(this->char40) = 0;
this->qword48 = 0LL;
this->qword60 = 0LL;
this->hddmPrimitive = 0LL;
this->vtable = &`vtable for'HDDMBelDef + 2;
beldef_code = this->beldef_code;
this->qword30 = 0LL;
this->pipsMatrixVec = 0LL;
this->hddmBelPinDefArray = 0LL;
this->hddmBelUsageDef = 0LL;
beldef_code &= 0xF0003FFF;
this->beldef_code = beldef_code;
HIBYTE(this->beldef_code) = HIBYTE(beldef_code) & 0xCF;
v2 = this->beldef_code1 & 0xFFFC000F;
this->beldef_code1 = v2;
HIWORD(this->beldef_code1) = HIWORD(v2) | 0x3FFC;
this->belDef_name = (std::string *)((char *)&std::string::_Rep::_S_empty_rep_storage + 24);
this->qword50 = &this->char40;
this->qword58 = &this->char40;
}
void __fastcall HDDMBelDef::~HDDMBelDef(HDDMBelDef *this)
{
HDDMPrimitive *hddmPrimitive; // rbp
_QWORD *vtable; // rbx
_QWORD *v4; // rax
void *v5; // rdi
_QWORD *qword20; // rsi
unsigned __int16 v7; // ax
__int64 v8; // rbx
void *v9; // rdi
HDDMBelPinDef *v10; // rdi
HDDMBelPinDef *v11; // rbx
HDDMBelPinDef *v12; // rbx
HDDMBelPinDef *v13; // rdi
HDDMBelPinDef *v14; // rbp
_QWORD *qword30; // rbx
HDDMBelUsageDef *hddmBelUsageDef; // rbx
HDDMBelDef *i; // r14
HDDMBelPinDef *hddmBelPinDefArray; // r13
char *pindef_name; // r8
char *v20; // r15
char *v21; // rbx
_QWORD *v22; // r9
__int64 v23; // rdx
void *v24; // rdi
void *v25; // rdi
__int64 v26; // rdx
__int64 v27; // rdx
void *v28; // rdi
int v29; // ecx
int v30; // ecx
char *v31; // [rsp+10h] [rbp-58h]
char *v32; // [rsp+10h] [rbp-58h]
char *v33; // [rsp+10h] [rbp-58h]
char *v34; // [rsp+10h] [rbp-58h]
_QWORD *v35; // [rsp+18h] [rbp-50h]
_QWORD *v36; // [rsp+18h] [rbp-50h]
_QWORD *v37; // [rsp+18h] [rbp-50h]
_QWORD *v38; // [rsp+18h] [rbp-50h]
_BYTE v39[57]; // [rsp+2Fh] [rbp-39h] BYREF
hddmPrimitive = this->hddmPrimitive;
this->vtable = &`vtable for'HDDMBelDef + 2;
if ( hddmPrimitive )
{
vtable = (_QWORD *)hddmPrimitive->vtable;
v4 = *(_QWORD **)&hddmPrimitive->numPrimType;
if ( (_QWORD *)hddmPrimitive->vtable == v4 )
{
v5 = (void *)hddmPrimitive->vtable;
}
else
{
do
{
if ( *vtable )
{
(*(void (__fastcall **)(_QWORD))(*(_QWORD *)*vtable + 24LL))(*vtable);
hddmPrimitive = this->hddmPrimitive;
v4 = *(_QWORD **)&hddmPrimitive->numPrimType;
}
++vtable;
}
while ( vtable != v4 );
v5 = (void *)hddmPrimitive->vtable;
}
if ( v5 )
operator delete(v5);
operator delete(hddmPrimitive);
this->hddmPrimitive = 0LL;
}
qword20 = (_QWORD *)this->pipsMatrixVec;
if ( qword20 )
{
v7 = (this->beldef_code >> 14) & 0x3FFF;
if ( !v7 )
goto LABEL_17;
v8 = 0LL;
do
{
v9 = (void *)qword20[v8];
if ( v9 )
{
operator delete[](v9);
*(_QWORD *)(this->pipsMatrixVec + 8 * v8) = 0LL;
qword20 = (_QWORD *)this->pipsMatrixVec;
v7 = (this->beldef_code >> 14) & 0x3FFF;
}
++v8;
}
while ( v7 > (int)v8 );
if ( qword20 )
LABEL_17:
operator delete[](qword20);
this->pipsMatrixVec = 0LL;
}
if ( this->qword60 )
{
for ( i = (HDDMBelDef *)this->qword50; i != (HDDMBelDef *)&this->char40; i = (HDDMBelDef *)std::_Rb_tree_increment(i) )
{
hddmBelPinDefArray = i->hddmBelPinDefArray;
if ( hddmBelPinDefArray )
{
pindef_name = (char *)hddmBelPinDefArray->pindef_name;
v20 = *(char **)&hddmBelPinDefArray->pindef_code;
if ( pindef_name == *(char **)&hddmBelPinDefArray->pindef_code )
{
v25 = (void *)hddmBelPinDefArray->pindef_name;
}
else
{
v21 = *(char **)&hddmBelPinDefArray->pindef_code;
v22 = v20 + 8;
if ( &_pthread_key_create )
{
do
{
v23 = *(_QWORD *)((char *)v22 + v21 - v20);
if ( (_UNKNOWN *)(v23 - 24) != &std::string::_Rep::_S_empty_rep_storage
&& _InterlockedExchangeAdd((volatile signed __int32 *)(v23 - 8), 0xFFFFFFFF) <= 0 )
{
v36 = v22;
v32 = pindef_name;
std::string::_Rep::_M_destroy(v23 - 24, v39);
v22 = v36;
pindef_name = v32;
}
v24 = (void *)(*(_QWORD *)v21 - 24LL);
if ( v24 != &std::string::_Rep::_S_empty_rep_storage
&& _InterlockedExchangeAdd((volatile signed __int32 *)(*(_QWORD *)v21 - 8LL), 0xFFFFFFFF) <= 0 )
{
v35 = v22;
v31 = pindef_name;
std::string::_Rep::_M_destroy(v24, v39);
v22 = v35;
pindef_name = v31;
}
v21 += 16;
}
while ( pindef_name != v21 );
}
else
{
do
{
v26 = *(_QWORD *)((char *)v22 + v21 - v20);
if ( (_UNKNOWN *)(v26 - 24) != &std::string::_Rep::_S_empty_rep_storage )
{
v29 = *(_DWORD *)(v26 - 8);
*(_DWORD *)(v26 - 8) = v29 - 1;
if ( v29 <= 0 )
{
v37 = v22;
v33 = pindef_name;
std::string::_Rep::_M_destroy(v26 - 24, v39);
v22 = v37;
pindef_name = v33;
}
}
v27 = *(_QWORD *)v21;
v28 = (void *)(*(_QWORD *)v21 - 24LL);
if ( v28 != &std::string::_Rep::_S_empty_rep_storage )
{
v30 = *(_DWORD *)(v27 - 8);
*(_DWORD *)(v27 - 8) = v30 - 1;
if ( v30 <= 0 )
{
v38 = v22;
v34 = pindef_name;
std::string::_Rep::_M_destroy(v28, v39);
v22 = v38;
pindef_name = v34;
}
}
v21 += 16;
}
while ( pindef_name != v21 );
}
v25 = *(void **)&hddmBelPinDefArray->pindef_code;
}
if ( v25 )
operator delete(v25);
operator delete(hddmBelPinDefArray);
}
}
}
v10 = this->hddmBelPinDefArray;
if ( v10 )
{
v11 = &v10[v10[-1].pindef_name];
if ( v10 != v11 )
{
v12 = v11 - 1;
do
{
v13 = v12;
v14 = v12--;
HDDMBelPinDef::~HDDMBelPinDef(v13);
v10 = this->hddmBelPinDefArray;
}
while ( v10 != v14 );
}
operator delete[](&v10[-1].pindef_name);
this->hddmBelPinDefArray = 0LL;
}
qword30 = (_QWORD *)this->qword30;
if ( qword30 )
{
std::_Rb_tree<std::string,std::pair<std::string const,HDDMBelPinDef *>,std::_Select1st<std::pair<std::string const,HDDMBelPinDef *>>,std::less<std::string>,std::allocator<std::pair<std::string const,HDDMBelPinDef *>>>::_M_erase(
this->qword30,
qword30[2]);
operator delete(qword30);
this->qword30 = 0LL;
}
hddmBelUsageDef = this->hddmBelUsageDef;
if ( hddmBelUsageDef )
{
HDDMBelUsageDef::~HDDMBelUsageDef(this->hddmBelUsageDef);
operator delete(hddmBelUsageDef);
}
this->hddmBelUsageDef = 0LL;
sub_21726B0(this);
std::_Rb_tree<std::pair<unsigned short,unsigned short>,std::pair<std::pair<unsigned short,unsigned short> const,std::vector<std::pair<std::string,std::string>> *>,std::_Select1st<std::pair<std::pair<unsigned short,unsigned short> const,std::vector<std::pair<std::string,std::string>> *>>,std::less<std::pair<unsigned short,unsigned short>>,std::allocator<std::pair<std::pair<unsigned short,unsigned short> const,std::vector<std::pair<std::string,std::string>> *>>>::_M_erase(
&this->field_38,
this->qword48);
std::string::_Rep::_M_dispose((char *)this->belDef_name - 24, v39);
}
void __fastcall HDDMBelDef::addpindefs(HDDMBelDef *this, __int16 index)
{
HDDMBelPinDef *hddmBelPinDefArray; // rbx
unsigned __int16 v3; // r12
unsigned __int64 v4; // r14
__int64 v5; // r12
HDDMBelPinDef *v6; // rax
HDDMBelPinDef *v7; // rdx
char v8; // cl
char v9; // cl
char v10; // cl
char v11; // cl
char v12; // cl
char v13; // cl
char v14; // cl
char v15; // cl
char v16; // cl
char v17; // cl
char v18; // cl
char v19; // cl
char v20; // cl
const std::string *p_pindef_name; // rsi
HDDMBelPinDef *i; // rbp
hddmBelPinDefArray = this->hddmBelPinDefArray;
v3 = this->beldef_code & 0x3FFF;
HDDMBelDef::allocatepindefs(this, v3 + index);
if ( v3 )
{
v4 = 0LL;
v5 = 16 * ((unsigned int)v3 - 1 + 1LL);
do
{
v6 = &this->hddmBelPinDefArray[v4 / 0x10];
v7 = &hddmBelPinDefArray[v4 / 0x10];
v8 = hddmBelPinDefArray[v4 / 0x10].pindef_code & 1 | v6->pindef_code & 0xFE;
LOBYTE(v6->pindef_code) = v8;
v9 = hddmBelPinDefArray[v4 / 0x10].pindef_code & 2 | v8 & 0xFD;
LOBYTE(v6->pindef_code) = v9;
v10 = hddmBelPinDefArray[v4 / 0x10].pindef_code & 4 | v9 & 0xFB;
LOBYTE(v6->pindef_code) = v10;
v11 = hddmBelPinDefArray[v4 / 0x10].pindef_code & 8 | v10 & 0xF7;
LOBYTE(v6->pindef_code) = v11;
v12 = hddmBelPinDefArray[v4 / 0x10].pindef_code & 0x10 | v11 & 0xEF;
LOBYTE(v6->pindef_code) = v12;
LOBYTE(v6->pindef_code) = hddmBelPinDefArray[v4 / 0x10].pindef_code & 0x20 | v12 & 0xDF;
v6->pindef_code = hddmBelPinDefArray[v4 / 0x10].pindef_code & 0xFFFC0 | v6->pindef_code & 0xFFF0003F;
BYTE2(v6->pindef_code) = BYTE2(hddmBelPinDefArray[v4 / 0x10].pindef_code) & 0xF0 | BYTE2(v6->pindef_code) & 0xF;
v13 = HIBYTE(hddmBelPinDefArray[v4 / 0x10].pindef_code) & 1 | HIBYTE(v6->pindef_code) & 0xFE;
HIBYTE(v6->pindef_code) = v13;
v14 = HIBYTE(hddmBelPinDefArray[v4 / 0x10].pindef_code) & 2 | v13 & 0xFD;
HIBYTE(v6->pindef_code) = v14;
v15 = HIBYTE(hddmBelPinDefArray[v4 / 0x10].pindef_code) & 4 | v14 & 0xFB;
HIBYTE(v6->pindef_code) = v15;
v16 = HIBYTE(hddmBelPinDefArray[v4 / 0x10].pindef_code) & 8 | v15 & 0xF7;
HIBYTE(v6->pindef_code) = v16;
v17 = HIBYTE(hddmBelPinDefArray[v4 / 0x10].pindef_code) & 0x10 | v16 & 0xEF;
HIBYTE(v6->pindef_code) = v17;
v18 = HIBYTE(hddmBelPinDefArray[v4 / 0x10].pindef_code) & 0x20 | v17 & 0xDF;
HIBYTE(v6->pindef_code) = v18;
v19 = HIBYTE(hddmBelPinDefArray[v4 / 0x10].pindef_code) & 0x40 | v18 & 0xBF;
HIBYTE(v6->pindef_code) = v19;
HIBYTE(v6->pindef_code) = HIBYTE(hddmBelPinDefArray[v4 / 0x10].pindef_code) & 0x80 | v19 & 0x7F;
LOBYTE(v6->pindef_code1) = hddmBelPinDefArray[v4 / 0x10].pindef_code1 & 0xF | v6->pindef_code1 & 0xF0;
LOWORD(v6->pindef_code1) = hddmBelPinDefArray[v4 / 0x10].pindef_code1 & 0xFFF0 | v6->pindef_code1 & 0xF;
HIWORD(v6->pindef_code1) = HIWORD(hddmBelPinDefArray[v4 / 0x10].pindef_code1) & 0x3FF | HIWORD(v6->pindef_code1) & 0xFC00;
v20 = HIBYTE(hddmBelPinDefArray[v4 / 0x10].pindef_code1) & 0x3C | HIBYTE(v6->pindef_code1) & 0xC3;
p_pindef_name = (const std::string *)&hddmBelPinDefArray[v4 / 0x10].pindef_name;
v4 += 16LL;
HIBYTE(v6->pindef_code1) = v20;
HIBYTE(v6->pindef_code1) = HIBYTE(v7->pindef_code1) & 0xC0 | v20 & 0x3F;
std::string::assign((std::string *)&v6->pindef_name, p_pindef_name);
}
while ( v4 != v5 );
}
if ( hddmBelPinDefArray )
{
for ( i = &hddmBelPinDefArray[hddmBelPinDefArray[-1].pindef_name];
hddmBelPinDefArray != i;
HDDMBelPinDef::~HDDMBelPinDef(i) )
{
--i;
}
operator delete[](&hddmBelPinDefArray[-1].pindef_name);
}
}
__int64 __fastcall HDDMBelDef::addpipattrsetting(
HDDMBelDef *this,
unsigned __int16 a2,
unsigned __int16 a3,
const std::string *a4,
const std::string *a5)
{
const std::string *v5; // r10
_QWORD *p_char40; // r14
__int64 qword48; // rax
_QWORD *v10; // r9
_QWORD *v11; // rbp
__int64 v12; // rax
_QWORD *v13; // r8
_QWORD *v14; // rbx
__int64 v15; // rax
__int64 insert_hint_unique_pos; // rax
__int64 v17; // rdx
_QWORD *v18; // rbx
__int64 v19; // rdi
_QWORD *v20; // rax
__int64 v21; // rax
char *v22; // rdi
__int64 result; // rax
char *v24; // rdi
unsigned __int16 v25; // ax
int v26; // eax
int v27; // edx
unsigned int v28; // edx
_WORD *v30; // [rsp+8h] [rbp-70h]
char v33; // [rsp+2Fh] [rbp-49h] BYREF
char *v34; // [rsp+30h] [rbp-48h] BYREF
char *v35; // [rsp+38h] [rbp-40h] BYREF
v5 = a4;
p_char40 = &this->char40;
qword48 = this->qword48;
if ( !qword48 )
goto LABEL_10;
v10 = &this->char40;
do
{
while ( a2 <= *(_WORD *)(qword48 + 32) && (a2 < *(_WORD *)(qword48 + 32) || a3 <= *(_WORD *)(qword48 + 34)) )
{
v10 = (_QWORD *)qword48;
qword48 = *(_QWORD *)(qword48 + 16);
if ( !qword48 )
goto LABEL_8;
}
qword48 = *(_QWORD *)(qword48 + 24);
}
while ( qword48 );
LABEL_8:
if ( p_char40 == v10 || a2 < *((_WORD *)v10 + 16) || a2 <= *((_WORD *)v10 + 16) && a3 < *((_WORD *)v10 + 17) )
{
LABEL_10:
v11 = (_QWORD *)operator new(0x18uLL);
*v11 = 0LL;
v11[1] = 0LL;
v11[2] = 0LL;
v12 = this->qword48;
v13 = &this->char40;
v5 = a4;
if ( !v12 )
goto LABEL_16;
do
{
if ( a2 > *(_WORD *)(v12 + 32) || a2 >= *(_WORD *)(v12 + 32) && a3 > *(_WORD *)(v12 + 34) )
{
v12 = *(_QWORD *)(v12 + 24);
}
else
{
v13 = (_QWORD *)v12;
v12 = *(_QWORD *)(v12 + 16);
}
}
while ( v12 );
if ( p_char40 == v13 || a2 < *((_WORD *)v13 + 16) || a2 <= *((_WORD *)v13 + 16) && a3 < *((_WORD *)v13 + 17) )
{
LABEL_16:
v14 = v13;
v15 = operator new(0x30uLL);
if ( v15 )
{
*(_DWORD *)v15 = 0;
*(_QWORD *)(v15 + 8) = 0LL;
*(_QWORD *)(v15 + 16) = 0LL;
*(_QWORD *)(v15 + 24) = 0LL;
*(_WORD *)(v15 + 32) = a2;
*(_WORD *)(v15 + 34) = a3;
*(_QWORD *)(v15 + 40) = 0LL;
}
v30 = (_WORD *)v15;
insert_hint_unique_pos = std::_Rb_tree<std::pair<unsigned short,unsigned short>,std::pair<std::pair<unsigned short,unsigned short> const,std::vector<std::pair<std::string,std::string>> *>,std::_Select1st<std::pair<std::pair<unsigned short,unsigned short> const,std::vector<std::pair<std::string,std::string>> *>>,std::less<std::pair<unsigned short,unsigned short>>,std::allocator<std::pair<std::pair<unsigned short,unsigned short> const,std::vector<std::pair<std::string,std::string>> *>>>::_M_get_insert_hint_unique_pos(
&this->field_38,
v14,
v15 + 32);
v18 = (_QWORD *)insert_hint_unique_pos;
if ( v17 )
{
v19 = 1LL;
if ( !insert_hint_unique_pos && p_char40 != (_QWORD *)v17 )
{
v25 = *(_WORD *)(v17 + 32);
if ( v30[16] >= v25 && (v30[16] > v25 || v30[17] >= *(_WORD *)(v17 + 34)) )
v19 = 0LL;
}
std::_Rb_tree_insert_and_rebalance(v19, v30, v17, p_char40);
++this->qword60;
v13 = v30;
v5 = a4;
}
else
{
operator delete(v30);
v13 = v18;
v5 = a4;
}
}
v13[5] = v11;
}
else
{
v11 = (_QWORD *)v10[5];
}
std::string::string((std::string *)&v34, v5);
std::string::string((std::string *)&v35, a5);
v20 = (_QWORD *)v11[1];
if ( v20 == (_QWORD *)v11[2] )
{
std::vector<std::pair<std::string,std::string>>::_M_emplace_back_aux<std::pair<std::string,std::string>>(v11, &v34);
}
else
{
if ( v20 )
{
*v20 = v34;
v34 = (char *)&std::string::_Rep::_S_empty_rep_storage + 24;
v20[1] = v35;
v35 = (char *)&std::string::_Rep::_S_empty_rep_storage + 24;
v21 = v11[1];
}
else
{
v21 = 0LL;
}
v11[1] = v21 + 16;
}
v22 = v35 - 24;
if ( v35 - 24 != (char *)&std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
v26 = _InterlockedExchangeAdd((volatile signed __int32 *)v22 + 4, 0xFFFFFFFF);
}
else
{
v27 = *((_DWORD *)v35 - 2);
*((_DWORD *)v35 - 2) = v27 - 1;
v26 = v27;
}
if ( v26 <= 0 )
std::string::_Rep::_M_destroy(v22, &v33);
}
result = (__int64)v34;
v24 = v34 - 24;
if ( v34 - 24 != (char *)&std::string::_Rep::_S_empty_rep_storage )
{
if ( &_pthread_key_create )
{
result = (unsigned int)_InterlockedExchangeAdd((volatile signed __int32 *)v24 + 4, 0xFFFFFFFF);
}
else
{
v28 = *((_DWORD *)v34 - 2);
*((_DWORD *)v34 - 2) = v28 - 1;
result = v28;
}
if ( (int)result <= 0 )
return std::string::_Rep::_M_destroy(v24, &v33);
}
return result;
}
void __fastcall HDDMBelDef::addprimitive(HDDMBelDef *this, HDDMPrimitive *pHddmPrimitive)
{
HDDMPrimitive *hddmPrimitive; // rdi
HDDMPrimitive **v4; // rdx
__int64 v5; // rdx
HDDMPrimitive *v6; // rax
HDDMPrimitive *v7; // [rsp+8h] [rbp-10h] BYREF
hddmPrimitive = this->hddmPrimitive;
v7 = pHddmPrimitive;
if ( !hddmPrimitive )
{
v6 = (HDDMPrimitive *)operator new(0x18uLL);
v6->vtable = 0LL;
*(_QWORD *)&v6->numPrimType = 0LL;
hddmPrimitive = v6;
v6->hddmBelDef = 0LL;
this->hddmPrimitive = v6;
}
v4 = *(HDDMPrimitive ***)&hddmPrimitive->numPrimType;
if ( v4 == (HDDMPrimitive **)hddmPrimitive->hddmBelDef )
{
std::vector<HDDMPrimitive *>::_M_emplace_back_aux<HDDMPrimitive * const&>(hddmPrimitive, &v7);
}
else
{
if ( v4 )
{
*v4 = v7;
v5 = *(_QWORD *)&hddmPrimitive->numPrimType;
}
else
{
v5 = 0LL;
}
*(_QWORD *)&hddmPrimitive->numPrimType = v5 + 8;
}
}
__int64 __fastcall HDDMBelDef::allocatepindefs(HDDMBelDef *this, unsigned __int16 nIndex)
{
__int64 v2; // rbx
_QWORD *v3; // rax
HDDMBelPinDef *v4; // r14
HDDMBelPinDef *v5; // rbp
unsigned int beldef_code_low; // eax
__int64 result; // rax
v2 = nIndex - 1LL;
v3 = (_QWORD *)operator new[](16LL * nIndex + 8);
v4 = (HDDMBelPinDef *)(v3 + 1);
*v3 = nIndex;
v5 = (HDDMBelPinDef *)(v3 + 1);
if ( nIndex )
{
do
{
HDDMBelPinDef::HDDMBelPinDef(v5);
--v2;
++v5;
}
while ( v2 != -1 );
}
beldef_code_low = LOWORD(this->beldef_code);
this->hddmBelPinDefArray = v4;
LOWORD(beldef_code_low) = beldef_code_low & 0xC000;
result = nIndex & 0x3FFF | beldef_code_low;
LOWORD(this->beldef_code) = result;
return result;
}
void __fastcall HDDMBelDef::buildReservedBelTypes(HDDMBelDef *this, HDDMDevice *hddmDevice)
{
_QWORD *v2; // rax
__int64 v3; // rax
__int64 Site; // rbx
int i; // ebp
HDDMElement *Element; // rax
__int64 BelDef; // rax
_WORD *v8; // rax
_QWORD *v9; // [rsp+8h] [rbp-90h]
char v10; // [rsp+2Fh] [rbp-69h] BYREF
HDDMSite v11; // [rsp+30h] [rbp-68h] BYREF
_QWORD v12[9]; // [rsp+50h] [rbp-48h] BYREF
v2 = (_QWORD *)operator new(0x18uLL);
*v2 = 0LL;
v2[1] = 0LL;
v2[2] = 0LL;
v9 = v2;
v3 = (__int64)(this->field_80 - this->field_78) >> 3;
if ( (_WORD)v3 )
std::vector<unsigned char>::_M_fill_insert(v9, 0LL, (unsigned __int16)v3, &unk_7B5CA98);
std::string::string(v12, "CFG_IO_ACCESS", &v11);
sub_2165630(this, v9, v12, 2LL);
std::string::_Rep::_M_dispose(v12[0] - 24LL, &v11.qword10);
std::string::string(v12, "USR_ACCESS", &v11);
sub_2165630(this, v9, v12, 3LL);
std::string::_Rep::_M_dispose(v12[0] - 24LL, &v11.qword10);
std::string::string(v12, "EFUSE_USR", &v11);
sub_2165630(this, v9, v12, 3LL);
std::string::_Rep::_M_dispose(v12[0] - 24LL, &v11.qword10);
std::string::string(v12, "DCIRESET", &v11);
sub_2165630(this, v9, v12, 3LL);
std::string::_Rep::_M_dispose(v12[0] - 24LL, &v11.qword10);
std::string::string(v12, "ICAP_TOP", &v11);
sub_2165630(this, v9, v12, 4LL);
std::string::_Rep::_M_dispose(v12[0] - 24LL, &v11.qword10);
std::string::string(v12, "ICAP_BOT", &v11);
sub_2165630(this, v9, v12, 4LL);
std::string::_Rep::_M_dispose(v12[0] - 24LL, &v11.qword10);
std::string::string(v12, "STARTUP", &v11);
sub_2165630(this, v9, v12, 4LL);
std::string::_Rep::_M_dispose(v12[0] - 24LL, &v11.qword10);
std::string::string(v12, "FRAME_ECC", &v11);
sub_2165630(this, v9, v12, 4LL);
std::string::_Rep::_M_dispose(v12[0] - 24LL, &v11.qword10);
std::string::string(v12, "PS8_X0Y0", &v11);
Site = HDDMDevice::getSite((HDDMDevice *)this, (const std::string *)v12);
std::string::_Rep::_M_dispose(v12[0] - 24LL, &v11.qword10);
if ( Site )
{
for ( i = 0; ; ++i )
{
v8 = (_WORD *)(*(_QWORD *)(HDDMDeviceCache::m_devcache[(*(_BYTE *)(Site + 8) >> 2) & 0xF] + 240LL)
+ 48LL * ((*(_DWORD *)Site >> 2) & 0x3FFFFF));
if ( i >= ((*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(HDDMDeviceCache::m_devcache[(*v8 >> 6) & 0xF]
+ 168LL)
+ 8LL * (v8[2] & 0x3FF))
+ 120LL)
+ 8LL * *(unsigned __int8 *)(Site + 3))
+ 12LL) >> 6) & 0x1FFF) )
break;
HDDMSite::getBel(&v11, Site);
if ( (unsigned __int8)HDDMBel::isBad((HDDMBel *)&v11) )
{
HDDMBel::~HDDMBel((HDDMBel *)&v11);
}
else
{
Element = (HDDMElement *)HDDMBel::getElement((HDDMBel *)&v11);
BelDef = HDDMElement::getBelDef(Element);
std::string::string((std::string *)&v11.qword10, (const std::string *)(BelDef + 16));
if ( !strcmp((const char *)v11.qword10, "PSS_ALTO_CORE")
|| !strcmp((const char *)v11.qword10, "PSS_ALTO_CORE_PAD_CLK") )
{
std::string::_Rep::_M_dispose(v11.qword10 - 24LL, v12);
HDDMBel::~HDDMBel((HDDMBel *)&v11);
}
else
{
std::string::string((std::string *)v12, (const std::string *)&v11.qword10);
sub_2165630(this, v9, v12, 1LL);
std::string::_Rep::_M_dispose(v12[0] - 24LL, &v10);
std::string::_Rep::_M_dispose(v11.qword10 - 24LL, v12);
HDDMBel::~HDDMBel((HDDMBel *)&v11);
}
}
}
}
}
void __fastcall HDDMBelDef::createpindefsmap(HDDMBelDef *this)
{
__int64 v1; // rax
HDDMBelPinDef *v2; // r12
_QWORD *v3; // r14
_QWORD *pindef_name; // rbx
__int64 v5; // rbp
size_t v6; // r13
int v7; // eax
_QWORD *v8; // rdi
size_t v9; // r15
size_t v10; // rdx
_QWORD *v11; // rsi
size_t v12; // rdx
int v13; // eax
unsigned __int16 v14; // [rsp+6h] [rbp-82h]
__int64 v15; // [rsp+8h] [rbp-80h]
size_t v16; // [rsp+8h] [rbp-80h]
__int64 qword30; // [rsp+10h] [rbp-78h]
char v19; // [rsp+3Fh] [rbp-49h] BYREF
_QWORD *p_pindef_name; // [rsp+40h] [rbp-48h] BYREF
v1 = operator new(0x30uLL);
*(_DWORD *)(v1 + 8) = 0;
*(_QWORD *)(v1 + 16) = 0LL;
*(_QWORD *)(v1 + 40) = 0LL;
qword30 = v1;
*(_QWORD *)(v1 + 24) = v1 + 8;
*(_QWORD *)(v1 + 32) = v1 + 8;
this->qword30 = v1;
v15 = v1 + 8;
v14 = 0;
if ( (this->beldef_code & 0x3FFF) == 0 )
return;
while ( 2 )
{
v2 = &this->hddmBelPinDefArray[v14];
v3 = *(_QWORD **)(qword30 + 16);
if ( !v3 )
{
v5 = v15;
goto LABEL_24;
}
pindef_name = (_QWORD *)v2->pindef_name;
v5 = v15;
v6 = *(pindef_name - 3);
do
{
while ( 1 )
{
v8 = (_QWORD *)v3[4];
v9 = *(v8 - 3);
v10 = v9;
if ( v6 <= v9 )
v10 = v6;
v7 = memcmp(v8, pindef_name, v10);
if ( !v7 )
break;
LABEL_5:
if ( v7 < 0 )
goto LABEL_12;
LABEL_6:
v5 = (__int64)v3;
v3 = (_QWORD *)v3[2];
if ( !v3 )
goto LABEL_13;
}
if ( (__int64)(v9 - v6) > 0x7FFFFFFF )
goto LABEL_6;
if ( (__int64)(v9 - v6) >= (__int64)0xFFFFFFFF80000000LL )
{
v7 = v9 - v6;
goto LABEL_5;
}
LABEL_12:
v3 = (_QWORD *)v3[3];
}
while ( v3 );
LABEL_13:
if ( v15 == v5 )
goto LABEL_24;
v11 = *(_QWORD **)(v5 + 32);
v12 = *(v11 - 3);
v16 = v12;
if ( v6 <= v12 )
v12 = v6;
v13 = memcmp(pindef_name, v11, v12);
if ( v13 )
{
LABEL_20:
if ( v13 < 0 )
goto LABEL_24;
}
else if ( (__int64)(v6 - v16) <= 0x7FFFFFFF )
{
if ( (__int64)(v6 - v16) >= (__int64)0xFFFFFFFF80000000LL )
{
v13 = v6 - v16;
goto LABEL_20;
}
LABEL_24:
p_pindef_name = &v2->pindef_name;
v5 = std::_Rb_tree<std::string,std::pair<std::string const,HDDMBelPinDef *>,std::_Select1st<std::pair<std::string const,HDDMBelPinDef *>>,std::less<std::string>,std::allocator<std::pair<std::string const,HDDMBelPinDef *>>>::_M_emplace_hint_unique<std::piecewise_construct_t const&,std::tuple<std::string const&>,std::tuple<>>(
qword30,
v5,
&unk_7B5CA99,
&p_pindef_name,
&v19);
}
*(_QWORD *)(v5 + 40) = v2;
if ( ++v14 < (this->beldef_code & 0x3FFF) )
{
qword30 = this->qword30;
v15 = qword30 + 8;
continue;
}
break;
}
}
请 __int64 ushortVec 映射为 std::vector <uint16_t> ushortVec
void __fastcall HDDMBelDef::getDrivenPins(HDDMBelDef *this, __int64 ushortVec, unsigned __int16 nIndex)
{
__int64 qword20; // rax
int v6; // esi
unsigned __int16 v7; // di
int v8; // r13d
__int64 v9; // rbx
__int64 v10; // r14
_WORD *v11; // rcx
__int16 v12; // ax
bool v13; // zf
__int64 v14; // rax
_WORD v15[36]; // [rsp+0h] [rbp-48h] BYREF
qword20 = this->pipsMatrixVec;
if ( qword20 )
{
v6 = this->beldef_code >> 14;
v7 = (this->beldef_code1 >> 4) & 0x3FFF;
v8 = (unsigned __int16)((this->beldef_code & 0x3FFF) - ((v6 & 0x3FFF) + v7)) + v7;
if ( v8 )
{
v9 = 0LL;
v10 = 8LL * nIndex;
while ( 1 )
{
if ( !*(_BYTE *)(*(_QWORD *)(qword20 + v10) + v9) )
goto LABEL_4;
v11 = *(_WORD **)(ushortVec + 8);
v12 = v9 + ((this->beldef_code >> 14) & 0x3FFF);
v13 = v11 == *(_WORD **)(ushortVec + 16);
v15[0] = v12;
if ( v13 )
break;
if ( v11 )
{
*v11 = v12;
v14 = *(_QWORD *)(ushortVec + 8);
}
else
{
v14 = 0LL;
}
++v9;
*(_QWORD *)(ushortVec + 8) = v14 + 2;
if ( v8 <= (int)v9 )
return;
LABEL_5:
qword20 = this->pipsMatrixVec;
}
std::vector<unsigned short>::_M_emplace_back_aux<unsigned short>(ushortVec, v15);
LABEL_4:
if ( v8 <= (int)++v9 )
return;
goto LABEL_5;
}
}
}
void __fastcall HDDMBelDef::getDrivingPins(HDDMBelDef *this, __int64 ushortVec, unsigned __int16 nIndex)
{
__int64 qword20; // rax
unsigned __int16 v4; // r8
int v5; // r14d
int v6; // r13d
__int64 v7; // rbx
_WORD *v8; // rax
bool v9; // zf
__int64 v10; // rax
_WORD v11[36]; // [rsp+0h] [rbp-48h] BYREF
qword20 = this->pipsMatrixVec;
if ( qword20 )
{
v4 = (this->beldef_code >> 14) & 0x3FFF;
v5 = nIndex - ((this->beldef_code >> 14) & 0x3FFF);
v6 = v4 + (unsigned __int16)((this->beldef_code & 0x3FFF) - (((this->beldef_code1 >> 4) & 0x3FFF) + v4));
if ( v6 )
{
v7 = 0LL;
while ( 1 )
{
if ( !*(_BYTE *)(*(_QWORD *)(qword20 + 8 * v7) + v5) )
goto LABEL_4;
v8 = *(_WORD **)(ushortVec + 8);
v9 = v8 == *(_WORD **)(ushortVec + 16);
v11[0] = v7;
if ( v9 )
break;
if ( v8 )
{
*v8 = v7;
v10 = *(_QWORD *)(ushortVec + 8);
}
else
{
v10 = 0LL;
}
++v7;
*(_QWORD *)(ushortVec + 8) = v10 + 2;
if ( v6 <= (int)v7 )
return;
LABEL_5:
qword20 = this->pipsMatrixVec;
}
std::vector<unsigned short>::_M_emplace_back_aux<unsigned short>(ushortVec, v11);
LABEL_4:
if ( v6 <= (int)++v7 )
return;
goto LABEL_5;
}
}
}
void __fastcall HDDMBelDef::getNextDrivenPin(HDDMBelDef *this, unsigned __int16 a2, int index)
{
__int64 qword20; // r8
unsigned __int16 v4; // cx
__int16 v5; // r9
unsigned __int16 v6; // di
__int16 v7; // dx
__int64 v8; // rdx
qword20 = this->pipsMatrixVec;
if ( qword20 )
{
v4 = 0;
v5 = (this->beldef_code >> 14) & 0x3FFF;
v6 = (this->beldef_code & 0x3FFF) - v5;
v7 = index - v5 + 1;
if ( v7 >= 0 )
v4 = v7;
if ( v6 > v4 )
{
v8 = *(_QWORD *)(qword20 + 8LL * a2);
if ( !*(_BYTE *)(v8 + v4) )
{
do
++v4;
while ( v6 > v4 && !*(_BYTE *)(v8 + v4) );
}
}
}
}
void __fastcall HDDMBelDef::getNextDrivingPin(HDDMBelDef *this, __int16 a2, unsigned int index)
{
__int64 qword20; // r9
unsigned __int16 v4; // si
unsigned __int16 v5; // r8
unsigned __int16 v6; // cx
__int16 v7; // dx
qword20 = this->pipsMatrixVec;
if ( qword20 )
{
v4 = a2 - ((this->beldef_code >> 14) & 0x3FFF);
v5 = (this->beldef_code & 0x3FFF) - ((this->beldef_code1 >> 4) & 0x3FFF);
v6 = 0;
v7 = index + 1;
if ( v7 >= 0 )
v6 = v7;
for ( ; v5 > v6 && !*(_BYTE *)(*(_QWORD *)(qword20 + 8LL * v6) + v4); ++v6 )
;
}
}
__int64 __fastcall HDDMBelDef::getNumArcs(HDDMBelDef *this, unsigned __int16 a2)
{
int v2; // eax
int NumFwdArcs; // r12d
v2 = *(_BYTE *)(HDDMBelDef::getPinDef(this, a2) + 7) & 0xC0;
if ( !v2 )
return HDDMBelDef::getNumFwdArcs(this, a2);
if ( (_BYTE)v2 == 0x80 )
return HDDMBelDef::getNumReverseArcs(this, a2);
NumFwdArcs = HDDMBelDef::getNumFwdArcs(this, a2);
return NumFwdArcs + (unsigned int)HDDMBelDef::getNumReverseArcs(this, a2);
}
__int64 __fastcall HDDMBelDef::getNumFwdArcs(HDDMBelDef *this, unsigned __int16 a2)
{
__int64 qword20; // rcx
unsigned __int16 v3; // r9
int v4; // eax
int v5; // edi
__int64 v6; // rdx
__int64 result; // rax
__int64 v8; // rsi
qword20 = this->pipsMatrixVec;
if ( !qword20 )
return 0LL;
v3 = (this->beldef_code1 >> 4) & 0x3FFF;
v4 = (unsigned __int16)((this->beldef_code & 0x3FFF) - (((this->beldef_code >> 14) & 0x3FFF) + v3));
v5 = v4 + ((this->beldef_code1 >> 4) & 0x3FFF);
if ( !(v4 + v3) )
return 0LL;
v6 = 0LL;
result = 0LL;
v8 = *(_QWORD *)(qword20 + 8LL * a2);
do
{
if ( *(_BYTE *)(v8 + v6) )
result = (unsigned int)(result + 1);
++v6;
}
while ( v5 > (int)v6 );
return result;
}
__int64 __fastcall HDDMBelDef::getNumPips(HDDMBelDef *this)
{
__int64 qword20; // r9
int v2; // eax
int v3; // r10d
int v4; // esi
__int64 v5; // r8
__int64 result; // rax
__int64 v7; // rdx
qword20 = this->pipsMatrixVec;
if ( !qword20 )
return 0LL;
v2 = (unsigned __int16)((this->beldef_code & 0x3FFF)
- (((this->beldef_code1 >> 4) & 0x3FFF)
+ ((this->beldef_code >> 14) & 0x3FFF)));
v3 = v2 + ((this->beldef_code >> 14) & 0x3FFF);
v4 = v2 + ((this->beldef_code1 >> 4) & 0x3FFF);
if ( !v3 )
return 0LL;
v5 = 0LL;
result = 0LL;
do
{
if ( v4 )
{
v7 = 0LL;
do
{
if ( *(_BYTE *)(*(_QWORD *)(qword20 + 8 * v5) + v7) )
result = (unsigned int)(result + 1);
++v7;
}
while ( v4 > (int)v7 );
}
++v5;
}
while ( v3 > (int)v5 );
return result;
}
__int64 __fastcall HDDMBelDef::getNumReverseArcs(HDDMBelDef *this, __int16 a2)
{
__int64 qword20; // r8
unsigned __int16 v3; // dx
unsigned __int16 v4; // si
int v5; // r9d
__int64 v6; // rdx
__int64 result; // rax
qword20 = this->pipsMatrixVec;
if ( !qword20 )
return 0LL;
v3 = (this->beldef_code >> 14) & 0x3FFF;
v4 = a2 - v3;
v5 = (unsigned __int16)((this->beldef_code & 0x3FFF) - (((this->beldef_code1 >> 4) & 0x3FFF) + v3)) + v3;
if ( !v5 )
return 0LL;
v6 = 0LL;
result = 0LL;
do
{
if ( *(_BYTE *)(*(_QWORD *)(qword20 + 8 * v6) + v4) )
result = (unsigned int)(result + 1);
++v6;
}
while ( v5 > (int)v6 );
return result;
}
__int64 __fastcall HDDMBelDef::getPinByName(HDDMBelDef *this, const void **a2)
{
__int64 qword30; // rax
_QWORD *v3; // rbx
_QWORD *v4; // r14
const void *v5; // r12
_QWORD *v6; // r13
size_t v7; // r15
int v8; // eax
_QWORD *v9; // rdi
size_t v10; // rdx
size_t v11; // rbp
__int64 v12; // rbp
_QWORD *v13; // rsi
size_t v14; // rdx
size_t v15; // rbx
int v16; // eax
__int64 v17; // r15
__int64 result; // rax
qword30 = this->qword30;
v3 = *(_QWORD **)(qword30 + 16);
v4 = (_QWORD *)(qword30 + 8);
if ( !v3 )
return 0LL;
v5 = *a2;
v6 = (_QWORD *)(qword30 + 8);
v7 = *((_QWORD *)*a2 - 3);
do
{
while ( 1 )
{
v9 = (_QWORD *)v3[4];
v10 = v7;
v11 = *(v9 - 3);
if ( v11 <= v7 )
v10 = *(v9 - 3);
v8 = memcmp(v9, v5, v10);
if ( !v8 )
break;
LABEL_4:
if ( v8 < 0 )
goto LABEL_11;
LABEL_5:
v6 = v3;
v3 = (_QWORD *)v3[2];
if ( !v3 )
goto LABEL_12;
}
v12 = v11 - v7;
if ( v12 > 0x7FFFFFFF )
goto LABEL_5;
if ( v12 >= (__int64)0xFFFFFFFF80000000LL )
{
v8 = v12;
goto LABEL_4;
}
LABEL_11:
v3 = (_QWORD *)v3[3];
}
while ( v3 );
LABEL_12:
if ( v4 == v6 )
return 0LL;
v13 = (_QWORD *)v6[4];
v14 = v7;
v15 = *(v13 - 3);
if ( v15 <= v7 )
v14 = *(v13 - 3);
v16 = memcmp(v5, v13, v14);
if ( v16 )
{
LABEL_21:
if ( v16 >= 0 )
return v6[5];
return 0LL;
}
v17 = v7 - v15;
if ( v17 > 0x7FFFFFFF )
return v6[5];
result = 0LL;
if ( v17 >= (__int64)0xFFFFFFFF80000000LL )
{
v16 = v17;
goto LABEL_21;
}
return result;
}
__int64 __fastcall HDDMBelDef::getRouteThruSettings(HDDMBelDef *this, unsigned int a2, int a3, __int64 **a4)
{
__int64 result; // rax
int v6; // r8d
unsigned __int16 v7; // r14
__int64 *v8; // rbp
__int64 *v9; // r12
__int64 *v10; // r9
_BYTE *v11; // r11
__int64 v12; // rsi
void *v13; // rdi
__int64 qword20; // r9
__int64 qword48; // rsi
_QWORD *p_char40; // rdi
__int64 *v17; // r14
__int64 v18; // rax
__int64 v19; // rax
void *v20; // rdi
int v21; // edx
int v22; // edx
_BYTE *v23; // [rsp+8h] [rbp-70h]
_BYTE *v24; // [rsp+8h] [rbp-70h]
__int64 *v25; // [rsp+10h] [rbp-68h]
__int64 *v26; // [rsp+10h] [rbp-68h]
unsigned int v27; // [rsp+1Ch] [rbp-5Ch]
unsigned int v28; // [rsp+1Ch] [rbp-5Ch]
int v29; // [rsp+20h] [rbp-58h]
int v30; // [rsp+20h] [rbp-58h]
__int16 v31; // [rsp+20h] [rbp-58h]
int v32; // [rsp+24h] [rbp-54h]
int v33; // [rsp+24h] [rbp-54h]
__int16 v34; // [rsp+24h] [rbp-54h]
__int64 **v35; // [rsp+28h] [rbp-50h]
__int64 **v36; // [rsp+28h] [rbp-50h]
__int64 **v37; // [rsp+28h] [rbp-50h]
_BYTE v38[57]; // [rsp+3Fh] [rbp-39h] BYREF
result = a2;
v6 = a3;
v7 = a2;
v8 = *a4;
v9 = a4[1];
if ( *a4 != v9 )
{
v10 = *a4;
if ( &_pthread_key_create )
{
v11 = v38;
do
{
v12 = v10[1];
if ( (_UNKNOWN *)(v12 - 24) != &std::string::_Rep::_S_empty_rep_storage
&& _InterlockedExchangeAdd((volatile signed __int32 *)(v12 - 8), 0xFFFFFFFF) <= 0 )
{
v35 = a4;
v32 = a3;
v29 = v6;
v27 = result;
v25 = v10;
v23 = v11;
std::string::_Rep::_M_destroy(v12 - 24, v11);
a4 = v35;
a3 = v32;
v6 = v29;
result = v27;
v10 = v25;
v11 = v23;
}
v13 = (void *)(*v10 - 24);
if ( v13 != &std::string::_Rep::_S_empty_rep_storage
&& _InterlockedExchangeAdd((volatile signed __int32 *)(*v10 - 8), 0xFFFFFFFF) <= 0 )
{
v36 = a4;
v33 = a3;
v30 = v6;
v28 = result;
v26 = v10;
v24 = v11;
std::string::_Rep::_M_destroy(v13, v11);
a4 = v36;
a3 = v33;
v6 = v30;
result = v28;
v10 = v26;
v11 = v24;
}
v10 += 2;
}
while ( v9 != v10 );
}
else
{
v17 = *a4;
v31 = a3;
v34 = a3;
v37 = a4;
do
{
v18 = v17[1];
if ( (_UNKNOWN *)(v18 - 24) != &std::string::_Rep::_S_empty_rep_storage )
{
v21 = *(_DWORD *)(v18 - 8);
*(_DWORD *)(v18 - 8) = v21 - 1;
if ( v21 <= 0 )
std::string::_Rep::_M_destroy(v18 - 24, v38);
}
v19 = *v17;
v20 = (void *)(*v17 - 24);
if ( v20 != &std::string::_Rep::_S_empty_rep_storage )
{
v22 = *(_DWORD *)(v19 - 8);
*(_DWORD *)(v19 - 8) = v22 - 1;
if ( v22 <= 0 )
std::string::_Rep::_M_destroy(v20, v38);
}
v17 += 2;
}
while ( v9 != v17 );
v7 = a2;
result = a2;
LOWORD(v6) = v31;
LOWORD(a3) = v34;
a4 = v37;
}
}
a4[1] = v8;
qword20 = this->pipsMatrixVec;
if ( qword20 )
{
if ( *(_BYTE *)(*(_QWORD *)(qword20 + 8LL * v7) + (unsigned __int16)a3 - ((this->beldef_code >> 14) & 0x3FFF)) )
{
qword48 = this->qword48;
if ( qword48 )
{
p_char40 = &this->char40;
do
{
while ( v7 <= *(_WORD *)(qword48 + 32)
&& (v7 < *(_WORD *)(qword48 + 32) || (unsigned __int16)v6 <= *(_WORD *)(qword48 + 34)) )
{
p_char40 = (_QWORD *)qword48;
qword48 = *(_QWORD *)(qword48 + 16);
if ( !qword48 )
goto LABEL_17;
}
qword48 = *(_QWORD *)(qword48 + 24);
}
while ( qword48 );
LABEL_17:
if ( &this->char40 != p_char40
&& (unsigned __int16)result >= *((_WORD *)p_char40 + 16)
&& ((unsigned __int16)result > *((_WORD *)p_char40 + 16) || (unsigned __int16)a3 >= *((_WORD *)p_char40 + 17)) )
{
return std::vector<std::pair<std::string,std::string>>::_M_assign_aux<__gnu_cxx::__normal_iterator<std::pair<std::string,std::string>*,std::vector<std::pair<std::string,std::string>>>>(
a4,
*(_QWORD *)p_char40[5],
*(_QWORD *)(p_char40[5] + 8LL));
}
}
}
}
return result;
}
__int64 __fastcall HDDMBelDef::setrecursivedeviceid(HDDMBelDef *this, unsigned __int16 a2)
{
__int64 v2; // rdx
int v3; // r9d
int v4; // ecx
__int64 result; // rax
char v6; // r9
bool v7; // zf
HDDMBelUsageDef *hddmBelUsageDef; // rdi
v2 = 0LL;
v3 = a2 & 0xF;
v4 = 0;
result = v3 | this->beldef_code1 & 0xF0u;
v6 = 16 * v3;
v7 = (this->beldef_code & 0x3FFF) == 0;
LOBYTE(this->beldef_code1) = result;
if ( !v7 )
{
do
{
++v4;
BYTE2(this->hddmBelPinDefArray[v2].pindef_code) = v6 | BYTE2(this->hddmBelPinDefArray[v2].pindef_code) & 0xF;
++v2;
result = this->beldef_code & 0x3FFF;
}
while ( (int)result > v4 );
}
hddmBelUsageDef = this->hddmBelUsageDef;
if ( hddmBelUsageDef )
return HDDMBelUsageDef::setrecursivedeviceid(hddmBelUsageDef, a2);
return result;
}
最新发布