//
// sub_100461458 from 0x100461458 to 0x1004616fc (676 bytes)
//
// 1 xrefs:
// > sub_100460F1C @ 0x100460fb0
//
// This function is hookable on this platform (idp: arm, 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:05:30 +0000
//
void __fastcall sub_100461458(_DWORD *a1, __int64 a2)
{
char *v4; // x1
int v5; // w8
const std::string::value_type *v6; // x1
int v7; // w20
char *v8; // x0
__int64 v9; // x20
std::string *v10; // x0
std::string::size_type v11; // x20
char v12; // w21
std::string *v13; // x0
std::string::size_type v14; // x20
char v15; // w21
std::string __p; // [xsp+0h] [xbp-B0h] BYREF
void *v17[2]; // [xsp+18h] [xbp-98h] BYREF
char v18; // [xsp+2Fh] [xbp-81h]
std::string v19; // [xsp+30h] [xbp-80h] BYREF
void *v20[2]; // [xsp+48h] [xbp-68h] BYREF
char v21; // [xsp+5Fh] [xbp-51h]
std::string v22; // [xsp+60h] [xbp-50h] BYREF
_QWORD v23[2]; // [xsp+78h] [xbp-38h]
sub_100009900(&v22, "");
if ( *(_DWORD *)(a2 + 364) == 4 )
v4 = "Diamond Shards";
else
v4 = "Mana Orbs";
sub_100009900(v20, v4);
v5 = a1[174];
if ( v5 >= 3 )
{
a1[174] = 0;
goto LABEL_6;
}
if ( v5 != 2 )
{
if ( v5 == 1 )
{
std::operator+(&v19, "Collect more ", v20);
v10 = std::string::append(&v19, ".");
v11 = v10->__r_.__value_.__r.__words[0];
v23[0] = v10->__r_.__value_.__l.__size_;
*(_QWORD *)((char *)v23 + 7) = *(std::string::size_type *)((char *)&v10->__r_.__value_.__r.__words[1] + 7);
v12 = HIBYTE(v10->__r_.__value_.__r.__words[2]);
v10->__r_.__value_.__l.__size_ = 0;
v10->__r_.__value_.__r.__words[2] = 0;
v10->__r_.__value_.__r.__words[0] = 0;
if ( SHIBYTE(v22.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v22.__r_.__value_.__l.__data_);
v22.__r_.__value_.__r.__words[0] = v11;
v22.__r_.__value_.__l.__size_ = v23[0];
*(std::string::size_type *)((char *)&v22.__r_.__value_.__r.__words[1] + 7) = *(_QWORD *)((char *)v23 + 7);
*((_BYTE *)&v22.__r_.__value_.__s + 23) = v12;
if ( SHIBYTE(v19.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v19.__r_.__value_.__l.__data_);
goto LABEL_8;
}
if ( v5 )
{
v6 = " ";
goto LABEL_7;
}
LABEL_6:
v6 = "You cannot afford that path.";
LABEL_7:
std::string::assign(&v22, v6);
LABEL_8:
v7 = 5;
goto LABEL_9;
}
std::operator+(&v19, "You do not have enough ", v20);
v13 = std::string::append(&v19, ".");
v14 = v13->__r_.__value_.__r.__words[0];
v23[0] = v13->__r_.__value_.__l.__size_;
*(_QWORD *)((char *)v23 + 7) = *(std::string::size_type *)((char *)&v13->__r_.__value_.__r.__words[1] + 7);
v15 = HIBYTE(v13->__r_.__value_.__r.__words[2]);
v13->__r_.__value_.__l.__size_ = 0;
v13->__r_.__value_.__r.__words[2] = 0;
v13->__r_.__value_.__r.__words[0] = 0;
if ( SHIBYTE(v22.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v22.__r_.__value_.__l.__data_);
v22.__r_.__value_.__r.__words[0] = v14;
v22.__r_.__value_.__l.__size_ = v23[0];
*(std::string::size_type *)((char *)&v22.__r_.__value_.__r.__words[1] + 7) = *(_QWORD *)((char *)v23 + 7);
*((_BYTE *)&v22.__r_.__value_.__s + 23) = v15;
if ( SHIBYTE(v19.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v19.__r_.__value_.__l.__data_);
v7 = 6;
LABEL_9:
sub_100009900(v17, "The Shopkeeper");
if ( SHIBYTE(v22.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__p, v22.__r_.__value_.__l.__data_, v22.__r_.__value_.__l.__size_);
else
__p = v22;
v8 = DialogObject::create((__int64)v17, (__int64)&__p, v7, 0, 0xFFFFFF, 1.0);
v9 = DialogLayer::create((__int64)v8, 2);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
if ( v18 < 0 )
operator delete(v17[0]);
(*(void (__fastcall **)(_DWORD *, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v9, 100);
DialogLayer::updateChatPlacement(v9, 0);
sub_1000909DC(v9, 1);
++a1[174];
if ( v21 < 0 )
operator delete(v20[0]);
if ( SHIBYTE(v22.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v22.__r_.__value_.__l.__data_);
}