{"type": "func", "start": 6443649168, "end": 6443649278, "name": "memchr", "pseudocode": "// \n// memchr from 0x180124890 to 0x1801248fe (110 bytes)\n// \n// 2 xrefs:\n// > sub_18004C1A0 @ 0x18004c312\n// > <???> @ 0x180202678\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nvoid *__cdecl memchr(const void *Buf, int Val, size_t MaxCount)\n{\n  __m128i v3; // xmm0\n  __m128i v4; // xmm1\n  __int64 v6; // rax\n  unsigned __int8 v7; // al\n\n  if ( MaxCount < 0x10 )\n  {\ntail_loop_start:\n    if ( MaxCount )\n    {\n      while ( 1 )\n      {\n        v7 = *(_BYTE *)Buf;\n        Buf = (char *)Buf + 1;\n        if ( (unsigned __int8)Val == v7 )\n          break;\n        if ( !--MaxCount )\n          return nullptr;\n      }\n      return (char *)Buf - 1;\n    }\n    else\n    {\n      return nullptr;\n    }\n  }\n  else\n  {\n    Val = 16843009 * (unsigned __int8)Val;\n    v3 = _mm_shuffle_epi32(_mm_cvtsi32_si128(Val), 0);\n    while ( 1 )\n    {\n      v4 = _mm_loadu_si128((const __m128i *)Buf);\n      Buf = (char *)Buf + 16;\n      MaxCount -= 16LL;\n      if ( _BitScanForward64((unsigned __int64 *)&v6, (unsigned int)_mm_movemask_epi8(_mm_cmpeq_epi8(v4, v3))) )\n        return (char *)Buf + v6 - 16;\n      if ( MaxCount < 0x10 )\n        goto tail_loop_start;\n    }\n  }\n}", "assembly": "; \n; memchr from 0x180124890 to 0x1801248fe (110 bytes)\n; \n; 2 xrefs:\n; > sub_18004C1A0 @ 0x18004c312\n; > <???> @ 0x180202678\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\ncmp     r8, 10h                                                        ; +0x0, 0x180124890\njb      short tail_loop_start                                          ; +0x4, 0x180124894\nmovzx   edx, dl                                                        ; +0x6, 0x180124896\nmov     eax, 1010101h                                                  ; +0x9, 0x180124899\nimul    edx, eax                                                       ; +0xe, 0x18012489e\nmovd    xmm0, edx                                                      ; +0x11, 0x1801248a1\npshufd  xmm0, xmm0, 0                                                  ; +0x15, 0x1801248a5\nnop     word ptr [rax+rax+00h]                                         ; +0x1a, 0x1801248aa\nmovdqu  xmm1, xmmword ptr [rcx]                                        ; +0x20, 0x1801248b0\nadd     rcx, 10h                                                       ; +0x24, 0x1801248b4\nsub     r8, 10h                                                        ; +0x28, 0x1801248b8\npcmpeqb xmm1, xmm0                                                     ; +0x2c, 0x1801248bc\npmovmskb eax, xmm1                                                     ; +0x30, 0x1801248c0\nbsf     rax, rax                                                       ; +0x35, 0x1801248c5\njnz     short found_16b                                                ; +0x39, 0x1801248c9\ncmp     r8, 10h                                                        ; +0x3b, 0x1801248cb\njnb     short main_loop                                                ; +0x3f, 0x1801248cf\ntest    r8, r8                                                         ; +0x41, 0x1801248d1\njz      short ret_null                                                 ; +0x44, 0x1801248d4\nnop     word ptr [rax+rax+00000000h]                                   ; +0x46, 0x1801248d6\nmov     al, [rcx]                                                      ; +0x50, 0x1801248e0\ninc     rcx                                                            ; +0x52, 0x1801248e2\nxor     al, dl                                                         ; +0x55, 0x1801248e5\njz      short found                                                    ; +0x57, 0x1801248e7\nsub     r8, 1                                                          ; +0x59, 0x1801248e9\njnz     short tail_loop                                                ; +0x5d, 0x1801248ed\nxor     rax, rax                                                       ; +0x5f, 0x1801248ef\nretn                                                                   ; +0x62, 0x1801248f2\nlea     rax, [rax+rcx-10h]                                             ; +0x63, 0x1801248f3\nretn                                                                   ; +0x68, 0x1801248f8\nlea     rax, [rcx-1]                                                   ; +0x69, 0x1801248f9\nretn                                                                   ; +0x6d, 0x1801248fd", "xrefs": ["sub_18004C1A0 @ 0x18004c312", "<???> @ 0x180202678"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}