// // sub_B4F450 from 0xb4f450 to 0xb4fa04 (1460 bytes) // // 2 xrefs: // > sub_B52594 @ 0xb53028 // > sub_B52594 @ 0xb530ac // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // __int64 __fastcall sub_B4F450(__int64 result, char a2) { unsigned __int64 v2; // x3 __int64 v4; // x19 int v5; // w21 char *v6; // x1 uint16x8_t *v7; // x22 char *v8; // x2 int v9; // w0 int v10; // w0 __int16 v11; // w0 __int64 v12; // x2 unsigned __int64 v13; // x1 unsigned __int64 v14; // x3 __int64 v15; // x0 uint16x8_t *v16; // x5 unsigned __int64 v17; // x4 __int64 v18; // x4 unsigned __int64 v19; // x0 unsigned __int8 v20; // w4 unsigned __int8 v21; // w4 unsigned __int8 v22; // w5 unsigned __int8 v23; // w4 unsigned __int8 v24; // w5 unsigned __int8 v25; // w6 int v26; // w4 _BYTE *v27; // x0 int v28; // w2 char v30; // w2 unsigned __int8 v31; // w4 unsigned __int8 v32; // w4 unsigned __int8 v33; // w5 int v34; // w2 __int64 v35; // x2 __int64 v36; // x0 int v37; // w2 v2 = *(_QWORD *)(result + 10248); v4 = result; if ( v2 + 1 <= 0x800 ) { *(_BYTE *)(result + v2) = a2; *(_QWORD *)(result + 10248) = v2 + 1; return result; } v5 = *(_DWORD *)(result + 10256); v6 = (char *)result; if ( v5 == 1 ) { result = (*(__int64 (__fastcall **)(_QWORD, __int64, unsigned __int64))(**(_QWORD **)(result + 10240) + 16LL))( *(_QWORD *)(result + 10240), result, v2); goto LABEL_8; } v7 = (uint16x8_t *)(result + 2048); if ( (unsigned int)(v5 - 2) > 1 ) { if ( (unsigned int)(v5 - 5) <= 1 ) { v35 = (char *)sub_B4A9BC((unsigned __int8 *)result, *(_QWORD *)(result + 10248), (int *)(result + 2048)) - (char *)v7; if ( v5 != 5 && v35 >> 2 ) { v36 = 0; do { v7->n128_u32[v36] = bswap32(v7->n128_u32[v36]); ++v36; } while ( v35 >> 2 != v36 ); } goto LABEL_7; } if ( v5 != 9 ) goto LABEL_7; v27 = (_BYTE *)(result + 2048); while ( 1 ) { LABEL_49: while ( 1 ) { v28 = (unsigned __int8)*v6; if ( (v28 & 0x80) == 0 ) break; if ( (unsigned int)(v28 - 192) > 0x1F || v2 == 1 ) { if ( (unsigned int)(v28 - 224) > 0xF || v2 <= 2 ) { if ( (unsigned int)(v28 - 240) <= 7 && v2 > 3 && (v6[1] & 0xC0) == 0x80 && (v6[2] & 0xC0) == 0x80 && (v6[3] & 0xC0) == 0x80 ) { *v27++ = 63; v6 += 4; v2 -= 4LL; goto LABEL_56; } } else { v32 = v6[1]; if ( (v32 & 0xC0) == 0x80 ) { v33 = v6[2]; if ( (v33 & 0xC0) == 0x80 ) { v34 = ((v28 & 0x1F) << 12) | ((v32 & 0x3F) << 6) | v33 & 0x3F; v6 += 3; v2 -= 3LL; if ( v34 > 255 ) LOBYTE(v34) = 63; *v27++ = v34; goto LABEL_56; } } } } else { v31 = v6[1]; if ( (v31 & 0xC0) == 0x80 ) { v37 = ((v28 & 0x3F) << 6) | v31 & 0x3F; v6 += 2; v2 -= 2LL; if ( v37 > 255 ) LOBYTE(v37) = 63; *v27++ = v37; goto LABEL_56; } } ++v6; --v2; LABEL_56: if ( !v2 ) goto LABEL_7; } *v27++ = v28; --v2; if ( ((unsigned __int64)(v6 + 1) & 3) != 0 || v2 <= 3 ) { ++v6; goto LABEL_56; } if ( (*(_DWORD *)++v6 & 0x80808080) == 0 ) { while ( 1 ) { v30 = *v6; v6 += 4; *v27 = v30; v27 += 4; v2 -= 4LL; *(v27 - 3) = *(v6 - 3); *(v27 - 2) = *(v6 - 2); *(v27 - 1) = *(v6 - 1); if ( v2 <= 3 ) goto LABEL_56; if ( (*(_DWORD *)v6 & 0x80808080) != 0 ) goto LABEL_49; } } } } v8 = (char *)(result + 2048); do { LABEL_10: while ( 1 ) { v9 = (unsigned __int8)*v6; if ( (v9 & 0x80) != 0 ) break; *(_WORD *)v8 = v9; v8 += 2; --v2; if ( ((unsigned __int64)(v6 + 1) & 3) != 0 || v2 <= 3 ) { ++v6; goto LABEL_17; } v10 = *(_DWORD *)++v6; if ( (v10 & 0x80808080) == 0 ) { while ( 1 ) { v11 = (unsigned __int8)*v6; v6 += 4; *(_WORD *)v8 = v11; v8 += 8; v2 -= 4LL; *((_WORD *)v8 - 3) = (unsigned __int8)*(v6 - 3); *((_WORD *)v8 - 2) = (unsigned __int8)*(v6 - 2); *((_WORD *)v8 - 1) = (unsigned __int8)*(v6 - 1); if ( v2 <= 3 ) goto LABEL_17; if ( (*(_DWORD *)v6 & 0x80808080) != 0 ) goto LABEL_10; } } } if ( (unsigned int)(v9 - 192) > 0x1F || v2 == 1 ) { if ( (unsigned int)(v9 - 224) > 0xF || v2 <= 2 ) { if ( (unsigned int)(v9 - 240) > 7 || v2 <= 3 || (v23 = v6[1], (v23 & 0xC0) != 0x80) || (v24 = v6[2], (v24 & 0xC0) != 0x80) || (v25 = v6[3], (v25 & 0xC0) != 0x80) ) { LABEL_35: ++v6; --v2; continue; } v26 = ((v9 & 0xF) << 18) | ((v24 & 0x3F) << 6) | v25 & 0x3F | ((v23 & 0x3F) << 12); v8 += 4; *((_WORD *)v8 - 1) = (v26 & 0x3FF) - 9216; *((_WORD *)v8 - 2) = ((unsigned int)(v26 - 0x10000) >> 10) - 10240; v6 += 4; v2 -= 4LL; } else { v21 = v6[1]; if ( (v21 & 0xC0) != 0x80 ) goto LABEL_35; v22 = v6[2]; if ( (v22 & 0xC0) != 0x80 ) goto LABEL_35; v6 += 3; *(_WORD *)v8 = ((v9 & 0x1F) << 12) | ((v21 & 0x3F) << 6) | v22 & 0x3F; v8 += 2; v2 -= 3LL; } } else { v20 = v6[1]; if ( (v20 & 0xC0) != 0x80 ) goto LABEL_35; v6 += 2; *(_WORD *)v8 = ((v9 & 0x3F) << 6) | v20 & 0x3F; v8 += 2; v2 -= 2LL; } LABEL_17: ; } while ( v2 ); v12 = v8 - (char *)v7; if ( v5 != 2 ) { v13 = v12 >> 1; if ( v12 >> 1 ) { v14 = ((v13 - 8) >> 3) + 1; v15 = 8 * v14; if ( v13 - 1 <= 6 ) { v15 = 0; LABEL_24: v7[(unsigned __int64)v15 / 8].n128_u16[0] = (unsigned __int8)HIBYTE(v7[(unsigned __int64)v15 / 8].n128_u16[0]) | (unsigned __int16)(v7[(unsigned __int64)v15 / 8].n128_u16[0] << 8); if ( v13 > v15 + 1 ) { v7[(unsigned __int64)v15 / 8].n128_u16[1] = (unsigned __int8)HIBYTE(v7[(unsigned __int64)v15 / 8].n128_u16[1]) | (unsigned __int16)(v7[(unsigned __int64)v15 / 8].n128_u16[1] << 8); if ( v13 > v15 + 2 ) { v7[(unsigned __int64)v15 / 8].n128_u16[2] = (unsigned __int8)HIBYTE(v7[(unsigned __int64)v15 / 8].n128_u16[2]) | (unsigned __int16)(v7[(unsigned __int64)v15 / 8].n128_u16[2] << 8); if ( v13 > v15 + 3 ) { v7[(unsigned __int64)v15 / 8].n128_u16[3] = (unsigned __int8)HIBYTE(v7[(unsigned __int64)v15 / 8].n128_u16[3]) | (unsigned __int16)(v7[(unsigned __int64)v15 / 8].n128_u16[3] << 8); if ( v13 > v15 + 4 ) { v18 = v15 + 5; v7[(unsigned __int64)v15 / 8].n128_u16[4] = (unsigned __int8)HIBYTE(v7[(unsigned __int64)v15 / 8].n128_u16[4]) | (unsigned __int16)(v7[(unsigned __int64)v15 / 8].n128_u16[4] << 8); if ( v13 > v15 + 5 ) { v19 = v15 + 6; v7->n128_u16[v18] = (unsigned __int8)HIBYTE(v7->n128_u16[v18]) | (unsigned __int16)(v7->n128_u16[v18] << 8); if ( v13 > v19 ) v7->n128_u16[v19] = (unsigned __int8)HIBYTE(v7->n128_u16[v19]) | (unsigned __int16)(v7->n128_u16[v19] << 8); } } } } } } else { v16 = v7; v17 = 0; do { ++v17; *v16 = vorrq_s8(vshlq_n_s16(*v16, 8u), vshrq_n_u16(*v16, 8u)); ++v16; } while ( v14 > v17 ); if ( v13 != v15 ) goto LABEL_24; } } } LABEL_7: result = (*(__int64 (__fastcall **)(_QWORD, uint16x8_t *))(**(_QWORD **)(v4 + 10240) + 16LL))( *(_QWORD *)(v4 + 10240), v7); LABEL_8: *(_BYTE *)v4 = a2; *(_QWORD *)(v4 + 10248) = 1; return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source