// // wcsnlen from 0x180134234 to 0x18013440a (470 bytes) // // 6 xrefs: // > unknown_libname_53 @ 0x18012ebac // > unknown_libname_54 @ 0x18012ec37 // > unknown_libname_55 @ 0x18012ecff // > __crtCompareStringW @ 0x18013b8af // > __crtCompareStringW @ 0x18013b8d1 // > __crtLCMapStringW @ 0x1801411f2 // // This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True! // // 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 10:54:59 +0000 // size_t __cdecl wcsnlen(const wchar_t *Source, size_t MaxCount) { const wchar_t *v5; // rax const wchar_t *i; // rdx const wchar_t *v7; // rdx size_t v8; // r11 const wchar_t *v9; // rax size_t v10; // rdx __m128i *v11; // r9 const wchar_t *j; // rdx const wchar_t *v14; // rax const wchar_t *v15; // rdx size_t v16; // r11 const wchar_t *v17; // rax const wchar_t *v18; // rdx const wchar_t *v19; // rax if ( dword_1801B1700 < 5 ) { if ( dword_1801B1700 < 1 ) { v19 = &Source[MaxCount]; for ( i = Source; i != v19; ++i ) { if ( !*i ) break; } return i - Source; } if ( ((unsigned __int8)Source & 1) != 0 ) { v14 = &Source[MaxCount]; for ( i = Source; i != v14; ++i ) { if ( !*i ) break; } return i - Source; } v15 = Source; v16 = ((16LL - ((unsigned __int8)Source & 0xF)) & (unsigned __int64)-(__int64)(((unsigned __int8)Source & 0xF) != 0)) >> 1; if ( MaxCount < v16 ) v16 = MaxCount; v17 = &Source[v16]; if ( Source != v17 ) { do { if ( !*v15 ) break; ++v15; } while ( v15 != v17 ); } v10 = v15 - Source; if ( v10 == v16 ) { v11 = (__m128i *)&Source[v10]; v18 = &Source[v10 + ((MaxCount - v16) & 0xFFFFFFFFFFFFFFF0uLL)]; while ( v11 != (__m128i *)v18 && !_mm_movemask_epi8(_mm_cmpeq_epi16((__m128i)0LL, *v11)) ) ++v11; while ( v11 != (__m128i *)&Source[MaxCount] && v11->m128i_i16[0] ) v11 = (__m128i *)((char *)v11 + 2); LABEL_20: i = (const wchar_t *)v11; return i - Source; } } else { if ( ((unsigned __int8)Source & 1) != 0 ) { v5 = &Source[MaxCount]; for ( i = Source; i != v5; ++i ) { if ( !*i ) break; } return i - Source; } v7 = Source; v8 = ((32LL - ((unsigned __int8)Source & 0x1F)) & (unsigned __int64)-(__int64)(((unsigned __int8)Source & 0x1F) != 0)) >> 1; if ( MaxCount < v8 ) v8 = MaxCount; v9 = &Source[v8]; if ( Source != v9 ) { do { if ( !*v7 ) break; ++v7; } while ( v7 != v9 ); } v10 = v7 - Source; if ( v10 == v8 ) { v11 = (__m128i *)&Source[v10]; for ( j = &Source[v10 + ((MaxCount - v8) & 0xFFFFFFFFFFFFFFE0uLL)]; v11 != (__m128i *)j; v11 += 2 ) { __asm { vpxor xmm1, xmm1, xmm1 vpcmpeqw ymm1, ymm1, ymmword ptr [r9] vpmovmskb eax, ymm1 } __asm { vzeroupper } if ( _EAX ) break; } while ( v11 != (__m128i *)&Source[MaxCount] && v11->m128i_i16[0] ) v11 = (__m128i *)((char *)v11 + 2); goto LABEL_20; } } return v10; }
GD Web Decomp Icon

GD Web Decomp

Raw Source