//
// pugi::xpath_variable_set::add from 0xb63a08 to 0xb63c24 (540 bytes)
//
// 5 xrefs:
// > pugi::xpath_variable_set::set @ 0xb63c38
// > pugi::xpath_variable_set::set @ 0xb63c70
// > pugi::xpath_variable_set::set @ 0xb63ca4
// > pugi::xpath_variable_set::set @ 0xb63ce0
// > ??> @ 0x42978
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
pugi::xpath_variable *__fastcall pugi::xpath_variable_set::add(__int64 a1, char *a2, int a3)
{
unsigned int v6; // w22
pugi::xpath_variable *v7; // x19
const char *v8; // x0
pugi::xpath_variable *result; // x0
size_t v10; // x0
size_t v11; // x24
_QWORD *v12; // x0
_QWORD *v13; // x19
__int64 v14; // x1
size_t v15; // x0
size_t v16; // x0
size_t v17; // x24
_QWORD *v18; // x0
_QWORD *v19; // x19
size_t v20; // x0
size_t v21; // x24
char *v22; // x0
char *v23; // x19
v6 = sub_B4A53C(a2) & 0x3F;
v7 = *(pugi::xpath_variable **)(a1 + 8LL * v6);
if ( v7 )
{
while ( 1 )
{
v8 = (const char *)pugi::xpath_variable::name(v7);
if ( !strcmp(v8, a2) )
break;
v7 = *((pugi::xpath_variable **)v7 + 1);
if ( !v7 )
goto LABEL_10;
}
if ( (unsigned int)pugi::xpath_variable::type(v7) == a3 )
return v7;
else
return nullptr;
}
else
{
LABEL_10:
switch ( a3 )
{
case 1:
v16 = strlen(a2);
v17 = v16;
if ( !v16 )
goto LABEL_9;
v18 = off_1230F88(v16 + 64);
v19 = v18;
if ( !v18 )
goto LABEL_9;
*(_DWORD *)v18 = 0;
v18[1] = 0;
*((_DWORD *)v18 + 4) = 0;
v18[3] = 0;
v18[4] = 0;
v18[5] = 0;
v18[6] = 0;
*((_BYTE *)v18 + 56) = 0;
pugi::xpath_variable::xpath_variable((__int64)v18);
pugi::xpath_node_set::xpath_node_set((pugi::xpath_node_set *)(v19 + 2));
memcpy(v19 + 7, a2, v17 + 1);
result = (pugi::xpath_variable *)v19;
goto LABEL_14;
case 2:
v15 = strlen(a2);
v11 = v15;
if ( v15 )
{
v12 = off_1230F88(v15 + 32);
v13 = v12;
if ( v12 )
goto LABEL_13;
}
goto LABEL_9;
case 3:
v10 = strlen(a2);
v11 = v10;
if ( !v10 )
goto LABEL_9;
v12 = off_1230F88(v10 + 32);
v13 = v12;
if ( !v12 )
goto LABEL_9;
LABEL_13:
pugi::xpath_variable::xpath_variable((__int64)v12);
v13[2] = 0;
memcpy(v13 + 3, a2, v11 + 1);
result = (pugi::xpath_variable *)v13;
goto LABEL_14;
case 4:
v20 = strlen(a2);
v21 = v20;
if ( !v20 )
goto LABEL_9;
v22 = (char *)off_1230F88(v20 + 24);
v23 = v22;
if ( !v22 )
goto LABEL_9;
pugi::xpath_variable::xpath_variable((__int64)v22);
v23[16] = 0;
memcpy(v23 + 17, a2, v21 + 1);
result = (pugi::xpath_variable *)v23;
LABEL_14:
v14 = *(_QWORD *)(a1 + 8LL * v6);
*(_DWORD *)result = a3;
*((_QWORD *)result + 1) = v14;
*(_QWORD *)(a1 + 8LL * v6) = result;
break;
default:
LABEL_9:
result = nullptr;
break;
}
}
return result;
}