weird_memory.c
unknown
c_cpp
2 years ago
7.8 kB
168
Indexable
Never
/* This file was generated by the Hex-Rays decompiler. Copyright (c) 2007-2020 Hex-Rays <info@hex-rays.com> Detected compiler: Visual C++ */ #include <windows.h> #include <defs.h> //------------------------------------------------------------------------- // Function declarations _QWORD *__fastcall weird_memory(unsigned __int64, int); char *__fastcall sub_unknown(__int64, unsigned __int64, unsigned __int64); //----- (00000001400971B0) ---------------------------------------------------- _QWORD *__fastcall sub_1400971B0(unsigned __int64 a1, int a2) { unsigned __int64 v5; // rbx unsigned int v6; // edx unsigned int v7; // er10 __int64 v8; // rdx __int64 v9; // r8 int *v10; // rdx unsigned __int64 v11; // rax _QWORD *v12; // rdi __int64 v13; // rcx unsigned __int64 v14; // r8 int v15; // edx int *v16; // r8 __int64 v17; // rcx unsigned __int64 v18; // rax unsigned int v19; // eax unsigned __int64 v20; // rdx unsigned __int64 *v21; // r10 int v22; // ecx __int64 v23; // r8 int *v24; // rax int *v25; // r11 _QWORD *v26; // rax __int64 v27; // rdi unsigned __int64 v28; // rdx unsigned __int64 *v29; // rcx __int64 v30; // rax __int64 v31; // rdx unsigned __int64 *v32; // rcx __int64 v33; // rax unsigned __int64 v34; // rdx if ( !qword_142D46470 ) sub_140098090(); if ( a1 >= 0x40000000 ) { if ( a2 ) __int2c(); return 0i64; } if ( (dword_142D46838 & 2) != 0 ) EnterCriticalSection(&CriticalSection); if ( a1 > 0xE0 ) { v5 = (a1 + 31) & 0xFFFFFFFFFFFFFFF0ui64; if ( !dword_142D464A4 ) { LABEL_44: v14 = qword_142D464A8; LABEL_45: if ( v5 > v14 ) { v30 = qword_142D464B0; if ( v5 >= qword_142D464B0 ) { v12 = sub_14009A0F0((__int64)dword_142D464A0, v5); } else { qword_142D464B0 -= v5; v31 = qword_142D464F0; v32 = (unsigned __int64 *)(v5 + qword_142D464F0); qword_142D464F0 = (__int64)v32; v12 = (_QWORD *)(v31 + 16); v32[1] = (v30 - v5) | 1; *(_QWORD *)(v31 + 8) = v5 | 3; *v32 = (unsigned __int64)dword_142D464A0 ^ qword_142D46470; } goto LABEL_53; } goto LABEL_46; } v26 = sub_14009A6C0((__int64)dword_142D464A0, (a1 + 31) & 0xFFFFFFFFFFFFFFF0ui64); LABEL_43: v12 = v26; if ( v26 ) { LABEL_54: v33 = qword_142D46440; v34 = *(v12 - 1) & 0xFFFFFFFFFFFFFFF8ui64; if ( (unsigned __int64)v12 > qword_142D46440 ) v33 = (__int64)v12; qword_142D46440 = v33; if ( !qword_142D46438 || (unsigned __int64)v12 < qword_142D46438 ) qword_142D46438 = (__int64)v12; qword_142D464B8 += v34; ++qword_142D464C0; goto LABEL_60; } goto LABEL_44; } if ( a1 >= 0xF ) v5 = (a1 + 31) & 0xFFFFFFFFFFFFFFF0ui64; else v5 = 32i64; v6 = (unsigned int)dword_142D464A0[0] >> (v5 >> 3); if ( (v6 & 3) != 0 ) { v7 = ((v6 & 1) == 0) + (unsigned int)(v5 >> 3); v8 = 2 * v7 + 14i64; v9 = *(_QWORD *)&dword_142D464A0[2 * v8 + 4]; v10 = &dword_142D464A0[2 * v8]; v11 = *(_QWORD *)(v9 + 16); v12 = (_QWORD *)(v9 + 16); if ( v10 == (int *)v11 ) { dword_142D464A0[0] &= ~(1 << v7); } else if ( v11 >= qword_142D464E0 && *(_QWORD *)(v11 + 24) == v9 ) { *(_QWORD *)(v11 + 24) = v10; *((_QWORD *)v10 + 2) = v11; } else { __int2c(); } v13 = 8 * v7; *(_QWORD *)(v9 + 8) = v13 | 3; *(_QWORD *)(v13 + v9 + 8) |= 1ui64; *(_QWORD *)(v13 + v9) = (unsigned __int64)dword_142D464A0 ^ qword_142D46470; goto LABEL_53; } v14 = qword_142D464A8; if ( v5 <= qword_142D464A8 ) { LABEL_46: v27 = qword_142D464E8; v28 = v14 - v5; if ( v14 - v5 < 0x20 ) { qword_142D464A8 = 0i64; qword_142D464E8 = 0i64; *(_QWORD *)(v27 + 8) = v14 | 3; *(_QWORD *)(v14 + v27 + 8) |= 1ui64; *(_QWORD *)(v14 + v27) = (unsigned __int64)dword_142D464A0 ^ qword_142D46470; } else { v29 = (unsigned __int64 *)(qword_142D464E8 + v5); qword_142D464A8 = v14 - v5; qword_142D464E8 = (__int64)v29; v29[1] = v28 | 1; *(unsigned __int64 *)((char *)v29 + v28) = v28; *(_QWORD *)(v27 + 8) = v5 | 3; *v29 = (unsigned __int64)dword_142D464A0 ^ qword_142D46470; } v12 = (_QWORD *)(v27 + 16); goto LABEL_53; } if ( !v6 ) { if ( !dword_142D464A4 ) goto LABEL_45; v26 = sub_14009AB60((__int64)dword_142D464A0, v5); goto LABEL_43; } _BitScanForward(&v6, ((v6 & 0xFFFFFFFE) << (v5 >> 3)) & -((v6 & 0xFFFFFFFE) << (v5 >> 3))); v15 = v6 & 0x1F; v16 = &dword_142D464A0[4 * v15 + 28]; v17 = *((_QWORD *)v16 + 2); v18 = *(_QWORD *)(v17 + 16); v12 = (_QWORD *)(v17 + 16); if ( v16 == (int *)v18 ) { dword_142D464A0[0] &= ~(1 << v15); } else if ( v18 >= qword_142D464E0 && *(_QWORD *)(v18 + 24) == v17 ) { *(_QWORD *)(v18 + 24) = v16; *((_QWORD *)v16 + 2) = v18; } else { __int2c(); } v19 = 8 * v15; v20 = (unsigned int)(8 * v15) - v5; if ( v20 >= 0x20 ) { v21 = (unsigned __int64 *)(v17 + v5); *(_QWORD *)(v17 + 8) = v5 | 3; *v21 = (unsigned __int64)dword_142D464A0 ^ qword_142D46470; v21[1] = v20 | 1; *(unsigned __int64 *)((char *)v21 + v20) = v20; if ( qword_142D464A8 ) { v22 = dword_142D464A0[0]; v23 = qword_142D464E8; v24 = &dword_142D464A0[4 * (unsigned int)((unsigned __int64)qword_142D464A8 >> 3) + 28]; v25 = v24; if ( _bittest(&v22, (unsigned __int64)qword_142D464A8 >> 3) ) { if ( *((_QWORD *)v24 + 2) < (unsigned __int64)qword_142D464E0 ) __int2c(); else v25 = (int *)*((_QWORD *)v24 + 2); } else { dword_142D464A0[0] |= 1 << ((unsigned __int64)qword_142D464A8 >> 3); } *((_QWORD *)v24 + 2) = qword_142D464E8; *((_QWORD *)v25 + 3) = v23; *(_QWORD *)(v23 + 16) = v25; *(_QWORD *)(v23 + 24) = v24; } qword_142D464A8 = v20; qword_142D464E8 = (__int64)v21; } else { *(_QWORD *)(v17 + 8) = v19 | 3i64; *(_QWORD *)(v19 + v17 + 8) |= 1ui64; *(_QWORD *)(v19 + v17) = (unsigned __int64)dword_142D464A0 ^ qword_142D46470; } LABEL_53: if ( v12 ) goto LABEL_54; LABEL_60: if ( (dword_142D46838 & 2) != 0 ) LeaveCriticalSection(&CriticalSection); if ( !v12 && a2 ) off_142C221B8("Internal", a1); return v12; } // 142C221B8: using guessed type __int64 (__fastcall *off_142C221B8)(_QWORD, _QWORD); // 142D46438: using guessed type __int64 qword_142D46438; // 142D46440: using guessed type __int64 qword_142D46440; // 142D46470: using guessed type __int64 qword_142D46470; // 142D464A0: using guessed type int dword_142D464A0[]; // 142D464A4: using guessed type int dword_142D464A4; // 142D464A8: using guessed type __int64 qword_142D464A8; // 142D464B0: using guessed type __int64 qword_142D464B0; // 142D464B8: using guessed type __int64 qword_142D464B8; // 142D464C0: using guessed type __int64 qword_142D464C0; // 142D464E0: using guessed type __int64 qword_142D464E0; // 142D464E8: using guessed type __int64 qword_142D464E8; // 142D464F0: using guessed type __int64 qword_142D464F0; // 142D46838: using guessed type int dword_142D46838; // nfuncs=197655 queued=1 decompiled=1 lumina nreq=0 worse=0 better=0 // ALL OK, 1 function(s) have been successfully decompiled