// // sub_B4FA04 from 0xb4fa04 to 0xb4ffd8 (1492 bytes) // // 3 xrefs: // > sub_B52594 @ 0xb52c40 // > sub_B52594 @ 0xb52c98 // > sub_B52594 @ 0xb52cb4 // // 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_B4FA04(uint16x8_t *a1, unsigned __int8 a2, unsigned __int8 a3) { unsigned __int64 v4; // x2 __int32 v8; // w22 uint16x8_t *v9; // x1 uint16x8_t *v10; // x23 __int64 v11; // x0 char *v12; // x0 int v13; // w3 bool v14; // zf __int16 v15; // w3 unsigned __int64 v16; // x2 unsigned __int64 v17; // x3 __int64 v18; // x1 uint16x8_t *v19; // x5 unsigned __int64 v20; // x4 __int64 v21; // x4 unsigned __int64 v22; // x1 unsigned __int8 v23; // w4 unsigned __int8 v24; // w4 unsigned __int8 v25; // w5 unsigned __int8 v26; // w4 unsigned __int8 v27; // w5 unsigned __int8 v28; // w6 int v29; // w4 unsigned __int8 *v30; // x0 int v31; // w3 unsigned __int8 v32; // w3 unsigned __int8 v33; // w4 unsigned __int8 v34; // w4 unsigned __int8 v35; // w7 int v36; // w3 __int64 v37; // x1 int v38; // w3 v4 = a1[640].n128_u64[1]; if ( v4 + 2 <= 0x800 ) { a1->n128_u8[v4] = a2; a1->n128_u8[v4 + 1] = a3; a1[640].n128_u64[1] = v4 + 2; return v4 + 1; } v8 = a1[641].n128_i32[0]; v9 = a1; if ( v8 == 1 ) { (*(void (__fastcall **)(unsigned __int64, uint16x8_t *))(*(_QWORD *)a1[640].n128_u64[0] + 16LL))( a1[640].n128_u64[0], a1); goto LABEL_8; } v10 = a1 + 128; if ( (unsigned int)(v8 - 2) > 1 ) { if ( (unsigned int)(v8 - 5) <= 1 ) { v11 = (char *)sub_B4A9BC((unsigned __int8 *)a1, a1[640].n128_u64[1], (int *)&a1[128]) - (char *)v10; if ( v8 != 5 && v11 >> 2 ) { v37 = 0; do { v10->n128_u32[v37] = bswap32(v10->n128_u32[v37]); ++v37; } while ( v11 >> 2 != v37 ); } goto LABEL_7; } v11 = 0; if ( v8 != 9 ) goto LABEL_7; v30 = (unsigned __int8 *)v10; while ( 1 ) { LABEL_49: while ( 1 ) { v31 = v9->n128_u8[0]; if ( (v31 & 0x80) == 0 ) break; if ( (unsigned int)(v31 - 192) > 0x1F || v4 == 1 ) { if ( (unsigned int)(v31 - 224) > 0xF || v4 <= 2 ) { if ( (unsigned int)(v31 - 240) <= 7 && v4 > 3 && (v9->n128_u8[1] & 0xC0) == 0x80 && (v9->n128_u8[2] & 0xC0) == 0x80 && (v9->n128_u8[3] & 0xC0) == 0x80 ) { *v30++ = 63; v9 = (uint16x8_t *)((char *)v9 + 4); v4 -= 4LL; goto LABEL_56; } } else { v34 = v9->n128_u8[1]; if ( (v34 & 0xC0) == 0x80 ) { v35 = v9->n128_u8[2]; if ( (v35 & 0xC0) == 0x80 ) { v36 = ((v31 & 0x1F) << 12) | ((v34 & 0x3F) << 6) | v35 & 0x3F; v9 = (uint16x8_t *)((char *)v9 + 3); v4 -= 3LL; if ( v36 > 255 ) LOBYTE(v36) = 63; *v30++ = v36; goto LABEL_56; } } } } else { v33 = v9->n128_u8[1]; if ( (v33 & 0xC0) == 0x80 ) { v38 = ((v31 & 0x3F) << 6) | v33 & 0x3F; v9 = (uint16x8_t *)((char *)v9 + 2); v4 -= 2LL; if ( v38 > 255 ) LOBYTE(v38) = 63; *v30++ = v38; goto LABEL_56; } } v9 = (uint16x8_t *)((char *)v9 + 1); --v4; LABEL_56: if ( !v4 ) { v11 = v30 - (unsigned __int8 *)v10; goto LABEL_7; } } *v30++ = v31; --v4; if ( (((unsigned __int64)v9->n128_u64 + 1) & 3) != 0 || v4 <= 3 ) { v9 = (uint16x8_t *)((char *)v9 + 1); goto LABEL_56; } v14 = (*(unsigned __int32 *)((_BYTE *)v9->n128_u32 + 1) & 0x80808080) == 0; v9 = (uint16x8_t *)((char *)v9 + 1); if ( v14 ) { while ( 1 ) { v32 = v9->n128_u8[0]; v9 = (uint16x8_t *)((char *)v9 + 4); *v30 = v32; v30 += 4; v4 -= 4LL; *(v30 - 3) = v9[-1].n128_u8[13]; *(v30 - 2) = v9[-1].n128_u8[14]; *(v30 - 1) = v9[-1].n128_u8[15]; if ( v4 <= 3 ) goto LABEL_56; if ( (v9->n128_u32[0] & 0x80808080) != 0 ) goto LABEL_49; } } } } v12 = (char *)&a1[128]; do { LABEL_10: while ( 1 ) { v13 = v9->n128_u8[0]; if ( (v13 & 0x80) != 0 ) break; *(_WORD *)v12 = v13; v12 += 2; --v4; if ( (((unsigned __int64)v9->n128_u64 + 1) & 3) != 0 || v4 <= 3 ) { v9 = (uint16x8_t *)((char *)v9 + 1); goto LABEL_17; } v14 = (*(unsigned __int32 *)((_BYTE *)v9->n128_u32 + 1) & 0x80808080) == 0; v9 = (uint16x8_t *)((char *)v9 + 1); if ( v14 ) { while ( 1 ) { v15 = v9->n128_u8[0]; v9 = (uint16x8_t *)((char *)v9 + 4); *(_WORD *)v12 = v15; v12 += 8; v4 -= 4LL; *((_WORD *)v12 - 3) = v9[-1].n128_u8[13]; *((_WORD *)v12 - 2) = v9[-1].n128_u8[14]; *((_WORD *)v12 - 1) = v9[-1].n128_u8[15]; if ( v4 <= 3 ) goto LABEL_17; if ( (v9->n128_u32[0] & 0x80808080) != 0 ) goto LABEL_10; } } } if ( (unsigned int)(v13 - 192) > 0x1F || v4 == 1 ) { if ( (unsigned int)(v13 - 224) > 0xF || v4 <= 2 ) { if ( (unsigned int)(v13 - 240) > 7 || v4 <= 3 || (v26 = v9->n128_u8[1], (v26 & 0xC0) != 0x80) || (v27 = v9->n128_u8[2], (v27 & 0xC0) != 0x80) || (v28 = v9->n128_u8[3], (v28 & 0xC0) != 0x80) ) { LABEL_35: v9 = (uint16x8_t *)((char *)v9 + 1); --v4; continue; } v29 = ((v13 & 0xF) << 18) | ((v27 & 0x3F) << 6) | v28 & 0x3F | ((v26 & 0x3F) << 12); v12 += 4; *((_WORD *)v12 - 1) = (v29 & 0x3FF) - 9216; *((_WORD *)v12 - 2) = ((unsigned int)(v29 - 0x10000) >> 10) - 10240; v9 = (uint16x8_t *)((char *)v9 + 4); v4 -= 4LL; } else { v24 = v9->n128_u8[1]; if ( (v24 & 0xC0) != 0x80 ) goto LABEL_35; v25 = v9->n128_u8[2]; if ( (v25 & 0xC0) != 0x80 ) goto LABEL_35; v9 = (uint16x8_t *)((char *)v9 + 3); *(_WORD *)v12 = ((v13 & 0x1F) << 12) | ((v24 & 0x3F) << 6) | v25 & 0x3F; v12 += 2; v4 -= 3LL; } } else { v23 = v9->n128_u8[1]; if ( (v23 & 0xC0) != 0x80 ) goto LABEL_35; v9 = (uint16x8_t *)((char *)v9 + 2); *(_WORD *)v12 = ((v13 & 0x3F) << 6) | v23 & 0x3F; v12 += 2; v4 -= 2LL; } LABEL_17: ; } while ( v4 ); v11 = v12 - (char *)v10; if ( v8 != 2 ) { v16 = v11 >> 1; if ( v11 >> 1 ) { v17 = ((v16 - 8) >> 3) + 1; v18 = 8 * v17; if ( v16 - 1 <= 6 ) { v18 = 0; LABEL_24: v10[(unsigned __int64)v18 / 8].n128_u16[0] = (unsigned __int8)HIBYTE(v10[(unsigned __int64)v18 / 8].n128_u16[0]) | (unsigned __int16)(v10[(unsigned __int64)v18 / 8].n128_u16[0] << 8); if ( v16 > v18 + 1 ) { v10[(unsigned __int64)v18 / 8].n128_u16[1] = (unsigned __int8)HIBYTE(v10[(unsigned __int64)v18 / 8].n128_u16[1]) | (unsigned __int16)(v10[(unsigned __int64)v18 / 8].n128_u16[1] << 8); if ( v16 > v18 + 2 ) { v10[(unsigned __int64)v18 / 8].n128_u16[2] = (unsigned __int8)HIBYTE(v10[(unsigned __int64)v18 / 8].n128_u16[2]) | (unsigned __int16)(v10[(unsigned __int64)v18 / 8].n128_u16[2] << 8); if ( v16 > v18 + 3 ) { v10[(unsigned __int64)v18 / 8].n128_u16[3] = (unsigned __int8)HIBYTE(v10[(unsigned __int64)v18 / 8].n128_u16[3]) | (unsigned __int16)(v10[(unsigned __int64)v18 / 8].n128_u16[3] << 8); if ( v16 > v18 + 4 ) { v21 = v18 + 5; v10[(unsigned __int64)v18 / 8].n128_u16[4] = (unsigned __int8)HIBYTE(v10[(unsigned __int64)v18 / 8].n128_u16[4]) | (unsigned __int16)(v10[(unsigned __int64)v18 / 8].n128_u16[4] << 8); if ( v16 > v18 + 5 ) { v22 = v18 + 6; v10->n128_u16[v21] = (unsigned __int8)HIBYTE(v10->n128_u16[v21]) | (unsigned __int16)(v10->n128_u16[v21] << 8); if ( v22 < v16 ) v10->n128_u16[v22] = (unsigned __int8)HIBYTE(v10->n128_u16[v22]) | (unsigned __int16)(v10->n128_u16[v22] << 8); } } } } } } else { v19 = v10; v20 = 0; do { ++v20; *v19 = vorrq_s8(vshlq_n_s16(*v19, 8u), vshrq_n_u16(*v19, 8u)); ++v19; } while ( v17 > v20 ); if ( v16 != v18 ) goto LABEL_24; } } } LABEL_7: (*(void (__fastcall **)(unsigned __int64, uint16x8_t *, __int64))(*(_QWORD *)a1[640].n128_u64[0] + 16LL))( a1[640].n128_u64[0], v10, v11); LABEL_8: a1->n128_u8[0] = a2; a1->n128_u8[1] = a3; a1[640].n128_u64[1] = 2; return 1; }
GD Web Decomp Icon

GD Web Decomp

Raw Source