// // sub_626658 from 0x626658 to 0x626f9a (2370 bytes) // // 4 xrefs: // > sub_6270E4 @ 0x6270fc // > sub_627110 @ 0x627120 // > sub_62714C @ 0x62715a // > sub_627164 @ 0x627164 // // 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 // int __fastcall sub_626658(FILE *a1, char *a2, int *a3) { char *v3; // r5 unsigned int v5; // r11 int v6; // r0 int v7; // t1 bool v8; // zf int v10; // r1 unsigned __int8 *v11; // r4 int v12; // r2 int v13; // r3 int v14; // r1 int v15; // t1 int v16; // r9 _QWORD *v17; // r3 unsigned int v18; // r8 int v19; // r5 int v20; // r3 int v21; // r7 int v22; // r3 int v23; // r3 int v24; // r5 char *v25; // r4 int v26; // r1 int v27; // r0 double v28; // d16 int i; // r3 int v30; // r3 _BYTE *v31; // r2 char v32; // r3 char *v33; // r4 int v34; // r0 int v35; // t1 unsigned int *v36; // r3 __int64 v37; // r6 const char *v38; // r3 unsigned int v39; // r3 int v40; // r2 unsigned __int64 v41; // d8 char *v42; // r4 int v43; // r2 int v44; // r5 int v45; // r3 int v46; // r2 int v47; // r6 char *v48; // r8 int v49; // t1 _QWORD *v50; // r3 const char *v51; // r4 signed int v52; // r6 int v53; // r3 int v54; // r5 int v55; // r3 int v56; // r0 const char *v57; // r6 int v58; // t1 unsigned int v59; // r5 int v60; // r3 char v61; // r3 bool v62; // cc bool v63; // cf int v64; // r4 int v65; // r5 _BOOL4 v66; // r2 int v67; // r0 const char *v68; // r5 int v69; // t1 unsigned int v70; // r4 int v71; // [sp+Ch] [bp-FA8h] char **v72; // [sp+10h] [bp-FA4h] int v73; // [sp+14h] [bp-FA0h] int v74; // [sp+14h] [bp-FA0h] int v75; // [sp+18h] [bp-F9Ch] const char *v76; // [sp+1Ch] [bp-F98h] int v77; // [sp+38h] [bp-F7Ch] int v78; // [sp+3Ch] [bp-F78h] int format; // [sp+48h] [bp-F6Ch] BYREF int v80; // [sp+4Ch] [bp-F68h] int v81; // [sp+50h] [bp-F64h] int v82; // [sp+54h] [bp-F60h] int v83; // [sp+58h] [bp-F5Ch] int v84; // [sp+5Ch] [bp-F58h] int v85; // [sp+60h] [bp-F54h] int v86; // [sp+64h] [bp-F50h] char s[324]; // [sp+68h] [bp-F4Ch] BYREF char v88; // [sp+1ACh] [bp-E08h] BYREF _DWORD v89[128]; // [sp+1B0h] [bp-E04h] BYREF _DWORD v90[769]; // [sp+3B0h] [bp-C04h] BYREF v3 = a2; if ( sub_624034(a2, (int)v90, v89, a3) ) return -1; v5 = 0; v71 = 0; v76 = "0123456789abcdefghijklmnopqrstuvwxyz"; v6 = (unsigned __int8)*v3; v72 = (char **)v89; while ( 1 ) { while ( 1 ) { LABEL_3: if ( !v6 ) return v5; if ( v6 == 37 ) break; if ( fputc((unsigned __int8)*v3, a1) == -1 ) return v5; while ( 1 ) { v7 = (unsigned __int8)*++v3; v6 = v7; ++v5; v8 = v7 == 0; if ( v7 ) v8 = v6 == 37; if ( v8 ) break; if ( fputc((unsigned __int8)*v3, a1) == -1 ) return v5; } } v10 = (unsigned __int8)v3[1]; v11 = (unsigned __int8 *)(v3 + 1); if ( v10 != 37 ) break; if ( fputc(37, a1) == -1 ) return v5; v6 = (unsigned __int8)v3[2]; ++v5; v3 += 2; } v12 = v10 - 48; if ( (unsigned int)(v10 - 48) > 9 ) goto LABEL_19; v13 = 0; do { v15 = *++v11; v14 = v15; v13 = v12 + 10 * v13; v12 = v15 - 48; } while ( (unsigned int)(v15 - 48) <= 9 ); if ( v13 && v14 == 36 ) v16 = v13 - 1; else LABEL_19: v16 = v71; v17 = &v90[6 * v16]; v18 = *((_DWORD *)v17 + 1); if ( (v18 & 0x4000) != 0 ) { v71 += 2; v19 = v90[6 * *((_DWORD *)v17 + 2) + 4]; if ( v19 < 0 ) { v19 = -v19; v18 = v18 & 0xFFFFFEFB | 4; *((_DWORD *)v17 + 1) = v18; } } else { v19 = *((_DWORD *)v17 + 2); ++v71; } if ( (v18 & 0x10000) != 0 ) { ++v71; v20 = v90[6 * v90[6 * v16 + 3] + 4]; v73 = v20 | (v20 >> 31); } else { if ( (v18 & 0x8000) != 0 ) v22 = 2 * v16; else v22 = -1; if ( (v18 & 0x8000) != 0 ) v22 = v90[2 * v22 + 3 + 2 * v16]; v73 = v22; } v75 = (v18 >> 3) & 1; v21 = v18 & 8; switch ( v90[6 * v16] ) { case 1: v50 = &v90[6 * v16]; v51 = *((const char **)v50 + 4); if ( v51 ) { v52 = v73; if ( v73 == -1 ) v52 = strlen(v51); if ( v52 < 0 ) v53 = 0x7FFFFFFF; else v53 = v52; } else { v66 = v73 == -1; if ( v73 > 4 ) v66 = 1; if ( v66 ) { *((_DWORD *)v50 + 1) = v18 & 0xFFFFFFF7; v21 = 0; LOBYTE(v18) = v18 & 0xF7; v52 = 5; v53 = 5; v51 = "(nil)"; } else { v52 = *((_DWORD *)v50 + 4); v53 = v52; v51 = &byte_9B1912; } } v54 = v19 - v53; if ( v21 ) { if ( fputc(34, a1) == -1 ) return v5; ++v5; v18 = v90[6 * v16 + 1]; } if ( (v18 & 4) != 0 ) { v55 = v52 - 1; if ( !v52 ) goto LABEL_153; } else if ( v54 <= 0 ) { v55 = v52 - 1; --v54; if ( !v52 ) goto LABEL_27; } else { --v54; do { --v54; if ( fputc(32, a1) == -1 ) return v5; ++v5; } while ( v54 != -1 ); v55 = v52 - 1; if ( !v52 ) { LABEL_152: v18 = v90[6 * v16 + 1]; if ( (v18 & 4) != 0 ) { LABEL_153: if ( v54 > 0 ) { v59 = v54 + v5; do { if ( fputc(32, a1) == -1 ) return v5; ++v5; } while ( v5 != v59 ); v18 = v90[6 * v16 + 1]; } } LABEL_27: if ( (v18 & 8) == 0 ) goto LABEL_30; if ( fputc(34, a1) != -1 ) { ++v5; goto LABEL_30; } return v5; } } v56 = *(unsigned __int8 *)v51; v57 = &v51[v55]; if ( *v51 ) { do { if ( fputc(v56, a1) == -1 ) return v5; ++v5; if ( v51 == v57 ) break; v58 = *(unsigned __int8 *)++v51; v56 = v58; } while ( v58 ); } goto LABEL_152; case 2: LODWORD(v37) = v90[6 * v16 + 4]; if ( !(_DWORD)v37 ) { v64 = v19 - 5; if ( (v18 & 4) != 0 ) { v65 = v19 - 6; if ( v64 > 0 ) { do { --v65; if ( fputc(32, a1) == -1 ) return v5; ++v5; } while ( v65 != -1 ); } v64 = v65; } v67 = 40; v68 = "(nil)"; do { if ( fputc(v67, a1) == -1 ) return v5; v69 = *(unsigned __int8 *)++v68; v67 = v69; ++v5; } while ( v69 ); if ( (v90[6 * v16 + 1] & 4) == 0 && v64 > 0 ) { v70 = v64 + v5; while ( fputc(32, a1) != -1 ) { if ( ++v5 == v70 ) goto LABEL_30; } return v5; } LABEL_30: v3 = *v72++; v6 = (unsigned __int8)*v3; goto LABEL_3; } HIDWORD(v37) = 0; v38 = "0123456789abcdefghijklmnopqrstuvwxyz"; if ( (v18 & 0x1000) != 0 ) v38 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; v76 = v38; v75 = 0; v77 = 0; v78 = 1; v39 = 16; LABEL_96: v40 = v73; if ( v73 == -1 ) v40 = 1; v74 = v40; if ( v37 ) { v41 = vshrd_n_s64(vdup_n_s32(v39).n64_i64[0], 0x20u); v42 = &v88; do { *v42-- = v76[v37 % v41]; v37 /= v41; } while ( v37 ); v43 = v42 - &v88; } else { v43 = 0; v42 = &v88; } v44 = v19 + v43; v45 = v74 + v43; if ( v75 ) { if ( v45 > 0 ) goto LABEL_104; --v44; *v42-- = 48; } else if ( v45 > 0 ) { LABEL_104: v44 -= v45; v46 = v45 - (_DWORD)v42; do *v42-- = 48; while ( (int)&v42[v46] > 0 ); } if ( v78 ) v44 -= 2; if ( v77 ) { v47 = v44 - 1; if ( (v90[6 * v16 + 1] & 0x104) != 0 ) goto LABEL_110; LABEL_161: v44 = v47 - 1; if ( v47 > 0 ) goto LABEL_164; LABEL_166: if ( !v77 ) goto LABEL_167; v47 = v44; LABEL_110: if ( fputc(45, a1) == -1 ) return v5; ++v5; v44 = v47; } else { v60 = v90[6 * v16 + 1]; if ( v60 << 30 ) { v47 = v44 - 1; if ( (v60 & 0x104) == 0 ) goto LABEL_161; --v44; LABEL_167: v18 = v90[6 * v16 + 1]; } else if ( (v60 & 0x104) == 0 ) { v62 = v44-- <= 0; if ( !v62 ) { LABEL_164: while ( 1 ) { --v44; if ( fputc(32, a1) == -1 ) return v5; ++v5; if ( v44 == -1 ) goto LABEL_166; } } goto LABEL_167; } if ( (v18 & 2) != 0 ) { if ( fputc(43, a1) == -1 ) return v5; } else { if ( (v18 & 1) == 0 ) goto LABEL_112; if ( fputc(32, a1) == -1 ) return v5; } ++v5; } LABEL_112: if ( v78 ) { if ( fputc(48, a1) == -1 ) return v5; v48 = (char *)(v5 + 1); if ( (v90[6 * v16 + 1] & 0x1000) != 0 ) { if ( fputc(88, a1) == -1 ) return (int)v48; } else if ( fputc(120, a1) == -1 ) { return v5 + 1; } v5 += 2; } if ( (v90[6 * v16 + 1] & 0x104) == 0x100 ) { v62 = v44-- <= 0; if ( !v62 ) { do { --v44; if ( fputc(48, a1) == -1 ) return v5; ++v5; } while ( v44 != -1 ); } } if ( &v88 >= v42 + 1 ) { v48 = &s[324 - (_DWORD)v42 + v5]; while ( 1 ) { v49 = (unsigned __int8)*++v42; if ( fputc(v49, a1) == -1 ) return v5; if ( (char *)++v5 == v48 ) goto LABEL_178; } } v48 = (char *)v5; LABEL_178: if ( (v90[6 * v16 + 1] & 4) == 0 || v44 <= 0 ) { LABEL_186: v5 = (unsigned int)v48; goto LABEL_30; } v5 = (unsigned int)&v48[v44]; while ( fputc(32, a1) != -1 ) { if ( ++v48 == (char *)v5 ) goto LABEL_30; } return (int)v48; case 3: v37 = *(_QWORD *)&v90[6 * v16 + 4]; if ( (v18 & 0x20000) == 0 ) { if ( (v18 & 0x400) != 0 ) { v78 = v18 & 0x20000; v77 = v18 & 0x20000; v39 = 8; } else if ( (v18 & 0x800) != 0 ) { if ( (v18 & 0x1000) != 0 ) { v75 = v18 & 0x400; v77 = v75; v78 = (v18 >> 3) & 1; v39 = 16; v76 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; } else { v77 = 0; v75 = 0; v39 = 16; v78 = (v18 >> 3) & 1; v76 = "0123456789abcdefghijklmnopqrstuvwxyz"; } } else if ( (v18 & 0x200) != 0 ) { v75 = v18 & 0x800; v78 = v75; v39 = 10; v77 = v75; } else if ( v37 >= 0 ) { v75 = v18 & 0x200; v39 = 10; v78 = v75; v77 = v75; } else { v63 = (_DWORD)v37 == 0; LODWORD(v37) = -(int)v37; v75 = v18 & 0x200; v78 = v75; HIDWORD(v37) -= 2 * HIDWORD(v37) + !v63; v39 = 10; v77 = 1; } goto LABEL_96; } if ( (v18 & 4) == 0 && --v19 > 0 ) { while ( fputc(32, a1) != -1 ) { --v19; ++v5; if ( !v19 ) goto LABEL_184; } return v5; } LABEL_184: if ( fputc((unsigned __int8)v37, a1) == -1 ) return v5; v48 = (char *)(v5 + 1); if ( (v90[6 * v16 + 1] & 4) != 0 && v19 > 1 ) { v5 += v19; while ( fputc(32, a1) != -1 ) { if ( ++v48 == (char *)v5 ) goto LABEL_30; } return (int)v48; } goto LABEL_186; case 4: if ( (v18 & 0x40) != 0 ) { *(_QWORD *)v90[6 * v16 + 4] = vshrd_n_s64(vdup_n_s32(v5).n64_i64[0], 0x20u); } else { v36 = (unsigned int *)v90[6 * v16 + 4]; if ( (v18 & 0x20) != 0 || (v18 & 0x10) == 0 ) *v36 = v5; else *(_WORD *)v36 = v5; } goto LABEL_30; case 7: v80 = 0; v81 = 0; v82 = 0; v83 = 0; v84 = 0; v85 = 0; v86 = 0; format = 37; if ( (v18 & 0x2000) != 0 ) { v23 = v90[6 * v16 + 2]; if ( (v18 & 0x8000) != 0 ) goto LABEL_45; } else { if ( (v18 & 0x4000) != 0 ) v23 = 2 * v16; else v23 = -1; if ( (v18 & 0x4000) != 0 ) v23 = v90[6 * v90[2 * v23 + 2 + 2 * v16] + 4]; if ( (v18 & 0x8000) != 0 ) { LABEL_45: v24 = v90[6 * v16 + 3]; goto LABEL_46; } } v24 = -1; if ( (v18 & 0x10000) != 0 ) v24 = v90[6 * v90[6 * v16 + 3] + 4]; LABEL_46: if ( (v18 & 4) != 0 ) v25 = (char *)&format + 2; else v25 = (char *)&format + 1; if ( (v18 & 4) != 0 ) BYTE1(format) = 45; if ( (v18 & 2) != 0 ) *v25++ = 43; if ( (v18 & 1) != 0 ) *v25++ = 32; if ( v75 ) *v25++ = 35; *v25 = 0; if ( v23 >= 0 ) { if ( v23 >= 325 ) v23 = 325; v27 = sub_624640(v25, 31, "%ld", v23); v25 += v27; v26 = 31 - v27; } else { v26 = 31; } if ( v24 >= 0 ) { v28 = *(double *)&v90[6 * v16 + 4]; for ( i = 324; v28 >= 10.0; --i ) v28 = v28 / 10.0; if ( v24 > i ) v24 = i - 1; v25 += sub_624640(v25, v26, ".%ld", v24); } v30 = v90[6 * v16 + 1]; if ( (v30 & 0x20) != 0 ) *v25++ = 108; if ( (v30 & 0x40000) != 0 ) { v31 = v25 + 1; if ( (v30 & 0x1000) != 0 ) v32 = 69; else v32 = 101; *v25 = v32; } else if ( (v30 & 0x80000) != 0 ) { v31 = v25 + 1; if ( (v30 & 0x1000) != 0 ) v61 = 71; else v61 = 103; *v25 = v61; } else { v31 = v25 + 1; *v25 = 102; } v33 = s; *v31 = 0; sprintf(s, (const char *)&format, v90[6 * v16 + 4], v90[6 * v16 + 5]); v34 = (unsigned __int8)s[0]; if ( !s[0] ) goto LABEL_30; while ( fputc(v34, a1) != -1 ) { v35 = (unsigned __int8)*++v33; v34 = v35; ++v5; if ( !v35 ) goto LABEL_30; } return v5; default: goto LABEL_30; } }
GD Web Decomp Icon

GD Web Decomp

Raw Source