//
// GJShaderState::tweenValue from 0x685eec to 0x68612e (578 bytes)
//
// 1 xrefs:
// > ShaderLayer::tweenValue @ 0x686138
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:56:05 +0000
//
_DWORD *__fastcall GJShaderState::tweenValue(
GJShaderState *this,
float a2,
float a3,
unsigned int a4,
float a5,
int a6,
float a7)
{
int v7; // r7
unsigned int v11; // r4
unsigned int v12; // r8
unsigned int v13; // r11
_DWORD *v14; // r2
_DWORD *i; // r5
unsigned int v16; // r0
int v17; // r1
int v18; // r0
int v19; // r5
float v20; // s13
float v21; // s15
bool v22; // r7
unsigned int prime; // r7
unsigned int v24; // r0
unsigned int v25; // r4
GJShaderState *v26; // r0
unsigned int v27; // r1
unsigned int v28; // s15
float v29; // s14
unsigned int v30; // r0
_DWORD *v31; // r3
unsigned int v32; // r0
int v33; // r1
_DWORD *result; // r0
float v35; // r0
int v36; // [sp+4h] [bp-8h] BYREF
v36 = a4;
GJShaderState::stopTweenAction(this, a4);
if ( a5 <= 0.0 )
return (_DWORD *)GJShaderState::updateTweenAction((int)this, a3, v36);
v11 = *((_DWORD *)this + 1);
v12 = v36;
if ( v11 )
{
v13 = v11 - 1;
v7 = ((v11 - 1) & v11) != 0 ? v36 % v11 : v13 & v36;
v14 = *(_DWORD **)(*(_DWORD *)this + 4 * v7);
if ( v14 )
{
for ( i = (_DWORD *)*v14; i; i = (_DWORD *)*i )
{
v16 = i[1];
v17 = ((v11 - 1) & v11) != 0 ? v16 % v11 : v13 & v16;
if ( v17 != v7 )
break;
if ( i[2] == v36 )
goto LABEL_44;
}
}
}
v18 = operator new(0x34u);
*(_DWORD *)(v18 + 8) = v36;
*(_DWORD *)(v18 + 24) = 0;
v19 = v18;
*(_DWORD *)(v18 + 28) = 0;
*(float *)(v18 + 20) = a5;
*(float *)(v18 + 12) = a2;
*(_DWORD *)(v18 + 32) = a6;
*(float *)(v18 + 16) = a3;
*(_DWORD *)(v18 + 44) = -1;
*(float *)(v18 + 36) = a7;
*(_DWORD *)(v18 + 48) = -1;
*(_BYTE *)(v18 + 40) = 0;
*(_BYTE *)(v18 + 41) = 0;
*(_DWORD *)v18 = 0;
*(_DWORD *)(v18 + 4) = v12;
v20 = *((float *)this + 4);
v21 = (float)(unsigned int)(*((_DWORD *)this + 3) + 1);
if ( v21 > (float)((float)v11 * v20) )
{
v22 = v11 > 2 && ((v11 - 1) & v11) == 0;
}
else
{
if ( v11 )
goto LABEL_36;
v22 = 0;
}
prime = 2 * v11 + !v22;
v24 = (unsigned int)ceilf(v21 / v20);
if ( prime < v24 )
prime = v24;
if ( prime == 1 )
{
prime = 2;
}
else if ( ((prime - 1) & prime) != 0 )
{
prime = std::__next_prime(prime);
}
v25 = *((_DWORD *)this + 1);
if ( prime <= v25 )
{
if ( prime >= v25 )
goto LABEL_25;
v28 = *((_DWORD *)this + 3);
v29 = *((float *)this + 4);
if ( v25 <= 2 || ((v25 - 1) & v25) != 0 )
{
v35 = ceilf((float)v28 / v29);
v30 = std::__next_prime((unsigned int)v35);
}
else
{
v30 = 1 << (32 - __clz((unsigned int)ceilf((float)v28 / v29) - 1));
}
v27 = v30;
if ( v30 < prime )
v27 = prime;
if ( v27 >= v25 )
goto LABEL_25;
v26 = this;
}
else
{
v26 = this;
v27 = prime;
}
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__rehash(
(int)v26,
v27);
LABEL_25:
v11 = *((_DWORD *)this + 1);
if ( ((v11 - 1) & v11) != 0 )
v7 = v12 % v11;
else
v7 = (v11 - 1) & v12;
LABEL_36:
v31 = *(_DWORD **)(*(_DWORD *)this + 4 * v7);
if ( v31 )
{
*(_DWORD *)v19 = *v31;
*v31 = v19;
}
else
{
*(_DWORD *)v19 = *((_DWORD *)this + 2);
*((_DWORD *)this + 2) = v19;
*(_DWORD *)(*(_DWORD *)this + 4 * v7) = (char *)this + 8;
if ( *(_DWORD *)v19 )
{
v32 = *(_DWORD *)(*(_DWORD *)v19 + 4);
if ( ((v11 - 1) & v11) != 0 )
v33 = v32 % v11;
else
v33 = (v11 - 1) & v32;
*(_DWORD *)(*(_DWORD *)this + 4 * v33) = v19;
}
}
++*((_DWORD *)this + 3);
LABEL_44:
result = std::unordered_map::operator[]((int)this + 20, (unsigned int *)&v36);
*(_QWORD *)result = *((_QWORD *)this + 5);
return result;
}