//
// sub_14003EFB0 from 0x14003efb0 to 0x14003f016 (102 bytes)
//
// 25 xrefs:
// > sub_1400537D0 @ 0x140053b29
// > GameToolbox::keepLastPathSegments @ 0x140070625
// > GameToolbox::keepLastPathSegments @ 0x140070685
// > ObjectManager::replaceAllOccurencesOfString @ 0x14007d230
// > AutoBackupPopup::buildRows @ 0x1400cad78
// > FriendPickerPopup::buildRows @ 0x1400e8302
// > sub_1400EB320 @ 0x1400eb531
// > sub_1400EB320 @ 0x1400eb56a
// > sub_1400EB320 @ 0x1400eb666
// > sub_1400EB320 @ 0x1400eb69e
// > InvitesPopup::buildRows @ 0x1400f7c79
// > InvitesPopup::buildRows @ 0x1400f7d43
// > FriendsProfilePage::filterUsersWithQuery @ 0x140216e19
// > IDNameBrowserPopup::rebuildList @ 0x1403c2ebd
// > IDNameInput::collectMatches @ 0x1403ca2d1
// > sub_1403E91C0 @ 0x1403e94d0
// > OptionsScrollLayer::getRelevantObjects @ 0x14047f558
// > sub_140480270 @ 0x1404802d5
// > sub_140480270 @ 0x140480417
// > MusicSearchResult::getFilesMatchingSearch @ 0x140498d0a
// > SFXSearchResult::updateObjects @ 0x14049b2c9
// > SecretLayer4::onSubmit @ 0x1405867f5
// > ??> @ 0x1408848a8
// > ??> @ 0x1408848b8
// > ??> @ 0x14090f23c
//
// 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:25:28 +0000
//
__int64 __fastcall sub_14003EFB0(__int64 a1, unsigned __int64 a2, unsigned __int64 a3, __int64 a4, unsigned __int64 a5)
{
__int64 v7; // rbx
__int64 v8; // rax
if ( a5 > a2 || a3 > a2 - a5 )
return -1;
if ( !a5 )
return a3;
v7 = a1 + a2;
v8 = sub_1406774C0(a3 + a1, a1 + a2, a4, a5);
if ( v8 == v7 )
return -1;
else
return v8 - a1;
}