//
// ThreadSearchPopup::fieldValue from 0x1400fb9e0 to 0x1400fbaf2 (274 bytes)
//
// 8 xrefs:
// > ThreadSearchPopup::clampDayField @ 0x1400fbb58
// > ThreadSearchPopup::clampDayField @ 0x1400fbb6b
// > ThreadSearchPopup::onGoToDate @ 0x1400fc61a
// > ThreadSearchPopup::onGoToDate @ 0x1400fc634
// > ThreadSearchPopup::onGoToDate @ 0x1400fc654
// > ??> @ 0x140894e28
// > ??> @ 0x140894e38
// > ??> @ 0x1409154a0
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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:26:40 +0000
//
__int64 __fastcall ThreadSearchPopup::fieldValue(__int64 a1, __int64 a2, unsigned int a3, int a4)
{
_BYTE *v7; // rax
size_t v8; // r8
const char *v9; // rcx
int v10; // ebx
char *v11; // rax
char *String[2]; // [rsp+38h] [rbp-30h] BYREF
__int128 v13; // [rsp+48h] [rbp-20h]
if ( !a2 )
return a3;
v7 = (_BYTE *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*(_QWORD *)(a2 + 592) + 600LL) + 8LL))(*(_QWORD *)(a2 + 592) + 600LL);
*(_OWORD *)String = 0;
v8 = -1;
v13 = 0;
do
++v8;
while ( v7[v8] );
sub_14003D230(String, v7, v8);
v9 = (const char *)String;
if ( *((_QWORD *)&v13 + 1) > 0xFu )
v9 = String[0];
v10 = atoi(v9);
if ( *((_QWORD *)&v13 + 1) > 0xFu )
{
v11 = String[0];
if ( (unsigned __int64)(*((_QWORD *)&v13 + 1) + 1LL) >= 0x1000 )
{
v11 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v11 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v11);
}
if ( a4 < v10 )
v10 = a4;
if ( (int)a3 > v10 )
return a3;
return (unsigned int)v10;
}