//
// SearchButton::init from 0x100055198 to 0x1000553b4 (540 bytes)
//
// 1 xrefs:
// > SearchButton::create @ 0x100053808
//
// 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
//
bool __fastcall SearchButton::init(SearchButton *a1, const char *a2, const char *a3, float a4, const char *a5)
{
_BOOL4 v9; // w19
__n128 v10; // q0
__n128 v11; // q1
double *v12; // x0
cocos2d::CCLabelBMFont *v13; // x0
__n128 v14; // q0
cocos2d::CCLabelBMFont *m_label; // x22
__n128 v16; // q1
cocos2d::CCSprite *v17; // x0
cocos2d::CCSprite *m_icon; // x0
float width; // s8
float v20; // s8
float v21; // s9
__n128 v22; // q0
float v23; // s8
float v24; // s10
cocos2d::CCLabelBMFont *v25; // x21
__n128 v26; // q1
__n128 v27; // q0
cocos2d::CCSprite *v28; // x20
__n128 v29; // q1
int v31; // [xsp+8h] [xbp-58h] BYREF
__int64 v32; // [xsp+10h] [xbp-50h] BYREF
float v33; // [xsp+18h] [xbp-48h] BYREF
float v34; // [xsp+1Ch] [xbp-44h]
v9 = cocos2d::CCSprite::initWithSpriteFrameName(a1, a2);
if ( v9 )
{
v10.n128_u32[0] = -1.0;
v11.n128_u32[0] = 1.0;
sub_100022980(v10, v11, &v33);
v12 = (double *)((__int64 (__fastcall *)(SearchButton *))a1->getContentSize)(a1);
sub_100022AFC(&v32, v12);
v13 = cocos2d::CCLabelBMFont::create_1(a3, "bigFont.fnt");
a1->m_label = v13;
v14 = ((__n128 (__fastcall *)(SearchButton *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v13, 1);
m_label = a1->m_label;
v14.n128_f32[0] = (float)(*(float *)&v32 * 0.5) + v33;
v16.n128_f32[0] = (float)(*((float *)&v32 + 1) * 0.5) + v34;
sub_100022980(v14, v16, &v31);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int *))m_label->setPosition)(m_label, &v31);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_label->setScale)(a1->m_label, a4);
if ( a5 )
{
if ( *a5 )
{
v17 = cocos2d::CCSprite::createWithSpriteFrameName(a5);
a1->m_icon = v17;
((void (__fastcall *)(SearchButton *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v17, 1);
((void (__fastcall *)(cocos2d::CCSprite *, float))a1->m_icon->setScale)(a1->m_icon, 1.1);
m_icon = a1->m_icon;
width = m_icon->m_obRect.size.width;
v20 = width * ((float (__fastcall *)(cocos2d::CCSprite *))m_icon->getScale)(m_icon);
v21 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getContentSize)(a1->m_label);
v22.n128_f64[0] = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_label->getScale)(a1->m_label);
v22.n128_f32[0] = (float)(v21 * v22.n128_f32[0]) + 5.0;
v23 = v20 * 0.5;
v24 = (float)((float)(v23 + v22.n128_f32[0]) + 10.0) * 0.5;
v22.n128_f32[0] = v33 + (float)((float)(v22.n128_f32[0] * 0.5) + (float)((float)(*(float *)&v32 * 0.5) - v24));
v25 = a1->m_label;
v26.n128_f32[0] = (float)(*((float *)&v32 + 1) * 0.5) + v34;
sub_100022980(v22, v26, &v31);
v27 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, int *))v25->setPosition)(v25, &v31);
v28 = a1->m_icon;
v27.n128_f32[0] = (float)(v24 + (float)(*(float *)&v32 * 0.5)) - v23;
v29.n128_f32[0] = *((float *)&v32 + 1) * 0.5;
sub_100022980(v27, v29, &v31);
((void (__fastcall *)(cocos2d::CCSprite *, int *))v28->setPosition)(v28, &v31);
}
}
}
return v9;
}