Skip to content

Instantly share code, notes, and snippets.

@pinksawtooth
Created May 20, 2019 06:01
Show Gist options
  • Select an option

  • Save pinksawtooth/7cea65d3188e37ac8af3fa35188e81e1 to your computer and use it in GitHub Desktop.

Select an option

Save pinksawtooth/7cea65d3188e37ac8af3fa35188e81e1 to your computer and use it in GitHub Desktop.
sub_401090@<eax>(const char *a1@<ecx>, _DWORD *a2@<edi>)
int __usercall sub_401090@<eax>(const char *a1@<ecx>, _DWORD *a2@<edi>)
{
const char *v2; // esi
int v3; // edx
signed int v4; // esi
unsigned int v5; // eax
double v6; // st7
double v7; // st7
void *v8; // eax
void *v9; // ebx
unsigned int v10; // eax
double v11; // st7
double v12; // st7
void *v13; // eax
int v14; // edx
int v15; // edx
int v16; // eax
int v18; // [esp+10h] [ebp-1D0h]
char v19; // [esp+20h] [ebp-1C0h]
char v20; // [esp+78h] [ebp-168h]
__int64 v21; // [esp+C0h] [ebp-120h]
float v22; // [esp+CCh] [ebp-114h]
char v23; // [esp+D0h] [ebp-110h]
int v24; // [esp+1DCh] [ebp-4h]
v2 = a1;
sub_401750((int)&v18);
v24 = 0;
strcpy(&v23, v2);
if ( sub_4024A0(&v23, (int)&v19, (std::locale::facet *)0x23) )
std::basic_ios<char,std::char_traits<char>>::clear((char *)&v18 + *(_DWORD *)(v18 + 4), 0, 0);
else
std::basic_ios<char,std::char_traits<char>>::setstate((char *)&v18 + *(_DWORD *)(v18 + 4), 2, 0);
std::basic_istream<char,std::char_traits<char>>::read(&v18, *a2, 14, 0);
std::basic_istream<char,std::char_traits<char>>::read(&v18, a2[1], 40, 0);
v3 = a2[1];
v4 = *(unsigned __int16 *)(v3 + 14);
if ( v4 == 2 || v4 == 4 || v4 == 8 )
{
v5 = *(unsigned __int16 *)(v3 + 14);
*((float *)&v21 + 1) = 2.0;
if ( v4 < 0 )
v5 = -v4;
v22 = 1.0;
while ( 1 )
{
v6 = *((float *)&v21 + 1);
if ( v5 & 1 )
v22 = v22 * v6;
v5 >>= 1;
if ( !v5 )
break;
*((float *)&v21 + 1) = v6 * v6;
}
v7 = v22;
if ( v4 < 0 )
v7 = 1.0 / v7;
*((float *)&v21 + 1) = v7;
v21 = (__int64)*((float *)&v21 + 1);
v8 = operator new[](4 * v21);
v9 = v8;
*((float *)&v21 + 1) = 2.0;
a2[2] = v8;
v10 = v4;
if ( v4 < 0 )
v10 = -v4;
v22 = 1.0;
while ( 1 )
{
v11 = *((float *)&v21 + 1);
if ( v10 & 1 )
v22 = v22 * v11;
v10 >>= 1;
if ( !v10 )
break;
*((float *)&v21 + 1) = v11 * v11;
}
v12 = v22;
if ( v4 < 0 )
v12 = 1.0 / v12;
*((float *)&v21 + 1) = v12;
std::basic_istream<char,std::char_traits<char>>::read(
&v18,
v9,
(unsigned __int64)(*((float *)&v21 + 1) * 4.0),
(unsigned __int64)(*((float *)&v21 + 1) * 4.0) >> 32);
}
v13 = operator new[](*(_DWORD *)(a2[1] + 20) + 1);
v14 = a2[1];
a2[3] = v13;
std::basic_istream<char,std::char_traits<char>>::read(&v18, v13, *(_DWORD *)(v14 + 20), 0);
v15 = v18;
a2[4] = *(_DWORD *)(a2[1] + 20) >> 3;
v16 = *(_DWORD *)(v15 + 4);
HIDWORD(v21) = &v20;
*(int *)((char *)&v18 + v16) = (int)&std::basic_ifstream<char,std::char_traits<char>>::`vftable';
v24 = 1;
sub_401810(&v19);
v24 = -1;
*(int *)((char *)&v18 + *(_DWORD *)(v18 + 4)) = (int)std::basic_istream<char,std::char_traits<char>>::`vftable';
return std::basic_ios<char,std::char_traits<char>>::~basic_ios<char,std::char_traits<char>>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment