// // sub_857B8C from 0x857b8c to 0x857cdc (336 bytes) // // 7 xrefs: // > sub_856B30 @ 0x856bd0 // > sub_856B30 @ 0x856eb6 // > sub_857130 @ 0x857196 // > sub_857130 @ 0x857204 // > lws_write @ 0x857dfa // > lws_serve_http_file_fragment @ 0x858176 // > sub_85C7F8 @ 0x85c8b2 // // This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False! // // 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 12:02:37 +0000 // int __fastcall sub_857B8C(int a1, char *a2, size_t a3) { int v5; // r3 int v6; // r0 size_t v7; // r8 int v8; // r6 ssize_t v9; // r0 ssize_t v10; // r7 int v12; // r3 int v13; // r2 int v14; // r3 unsigned int v15; // r0 int v16; // r7 void *v17; // r0 size_t v18; // r6 char *v19; // r1 char *v20; // [sp+4h] [bp-4h] BYREF v20 = a2; lws_get_context(a1); if ( !a3 ) return a3; v5 = *(_DWORD *)(a1 + 256); if ( *(_BYTE *)(a1 + 264) == 9 ) { if ( !v5 ) return a3; } else if ( !v5 ) { goto LABEL_4; } v15 = *(_DWORD *)(a1 + 200); if ( v15 > (unsigned int)v20 || (unsigned int)v20 > v5 + *(_DWORD *)(a1 + 252) + v15 ) lws_log(1, "****** %x Sending new, pending truncated ...\n", a1); LABEL_4: v6 = sub_85C730(a1, 13, &v20, a3); v7 = a3; v8 = v6; if ( v6 < 0 ) return -1; if ( v6 ) { LABEL_14: v12 = *(_DWORD *)(a1 + 256); if ( v12 ) { v13 = *(_DWORD *)(a1 + 252); v14 = v12 - v8; *(_DWORD *)(a1 + 256) = v14; *(_DWORD *)(a1 + 252) = v13 + v8; if ( !v14 ) { if ( *(_BYTE *)(a1 + 264) != 9 ) { LABEL_17: lws_callback_on_writable((_DWORD *)a1); return v7; } return -1; } LABEL_27: v7 = v8; goto LABEL_17; } v16 = v8; if ( a3 != v8 ) goto LABEL_22; return a3; } if ( *(int *)(a1 + 228) < 0 ) lws_log(2, "** error invalid sock but expected to send\n"); v9 = lws_ssl_capable_write_no_ssl(a1, v20, a3); v10 = v9; if ( v9 != -2 ) { if ( v9 == -1 ) { lws_log(1, "%s: wsi %p: LWS_SSL_CAPABLE_ERROR\n", "lws_issue_raw", (const void *)a1); *(_BYTE *)(a1 + 260) |= 4u; return v10; } v8 = v9; goto LABEL_14; } v16 = *(_DWORD *)(a1 + 256); if ( v16 ) goto LABEL_27; LABEL_22: v17 = *(void **)(a1 + 200); v18 = a3 - v16; if ( v17 && (v18 = a3 - v16, a3 - v16 <= *(_DWORD *)(a1 + 248)) || (sub_8597C4(v17, 0), *(_DWORD *)(a1 + 248) = v18, v17 = (void *)sub_8597C4(0, v18), (*(_DWORD *)(a1 + 200) = v17) != 0) ) { v19 = v20; *(_DWORD *)(a1 + 252) = 0; *(_DWORD *)(a1 + 256) = v18; memcpy(v17, &v19[v16], v18); lws_callback_on_writable((_DWORD *)a1); return a3; } lws_log(1, "truncated send: unable to malloc %d\n", v18); return -1; }
GD Web Decomp Icon

GD Web Decomp

Raw Source