{"type": "func", "start": 6443666272, "end": 6443666626, "name": "strncpy", "pseudocode": "// \n// strncpy from 0x180128b60 to 0x180128cc2 (354 bytes)\n// \n// 22 xrefs:\n// > sub_180020140 @ 0x180020337\n// > sub_1800F6380 @ 0x1800f63db\n// > sub_1800F6380 @ 0x1800f63f7\n// > sub_1800F6380 @ 0x1800f6458\n// > sub_1800F6380 @ 0x1800f646f\n// > sub_1800F6380 @ 0x1800f64ea\n// > sub_1800F6380 @ 0x1800f6501\n// > sub_1800F6380 @ 0x1800f6589\n// > sub_1800F6380 @ 0x1800f659c\n// > sub_180107A40 @ 0x180107a95\n// > sub_180107A40 @ 0x180107aae\n// > sub_180109650 @ 0x1801096ab\n// > sub_180109650 @ 0x1801096c4\n// > sub_180109650 @ 0x18010973a\n// > sub_180109650 @ 0x180109751\n// > sub_180109650 @ 0x1801097e4\n// > sub_180109650 @ 0x1801097fb\n// > sub_180109650 @ 0x180109872\n// > sub_180109650 @ 0x180109889\n// > sub_180109650 @ 0x18010990e\n// > sub_180109650 @ 0x180109925\n// > <???> @ 0x180202a20\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\nchar *__cdecl strncpy(char *Destination, const char *Source, size_t Count)\n{\n  signed __int64 v4; // rcx\n  bool v5; // zf\n  unsigned __int64 v7; // rax\n  bool v8; // cc\n  unsigned __int64 v9; // rax\n  unsigned __int64 v10; // rax\n  unsigned int v11; // eax\n  const char *v12; // rcx\n  bool v13; // cf\n  size_t i; // r8\n  unsigned __int64 v15; // r8\n\n  if ( !Count )\n    return Destination;\n  v4 = Destination - Source;\n  if ( ((unsigned __int8)Source & 7) != 0 )\n  {\n    while ( 1 )\n    {\n      v5 = *Source == 0;\n      Source[v4] = *Source;\n      if ( v5 )\n        break;\n      ++Source;\n      if ( !--Count )\n        return Destination;\n      if ( ((unsigned __int8)Source & 7) == 0 )\n        goto _qword_loop_entrance;\n    }\nfiller:\n    v12 = &Source[v4];\n    if ( Count >= 0x10 )\n    {\n      while ( ((unsigned __int8)v12 & 7) != 0 )\n      {\n        *++v12 = 0;\n        --Count;\n      }\n      v13 = Count < 0x20;\n      for ( i = Count - 32; !v13; i -= 32LL )\n      {\n        *(_QWORD *)v12 = 0;\n        *((_QWORD *)v12 + 1) = 0;\n        *((_QWORD *)v12 + 2) = 0;\n        *((_QWORD *)v12 + 3) = 0;\n        v12 += 32;\n        v13 = i < 0x20;\n      }\n      v15 = i + 32;\n      while ( 1 )\n      {\n        v13 = v15 < 8;\n        v15 -= 8LL;\n        if ( v13 )\n          break;\n        *(_QWORD *)v12 = 0;\n        v12 += 8;\n      }\n      Count = v15 + 8;\n    }\n    while ( 1 )\n    {\n      v13 = Count-- == 0;\n      if ( v13 )\n        break;\n      *v12++ = 0;\n    }\n    return Destination;\n  }\n  else\n  {\n    do\n    {\n_qword_loop_entrance:\n      while ( 1 )\n      {\n        v7 = *(_QWORD *)Source;\n        v8 = Count <= 8;\n        Count -= 8LL;\n        if ( v8 || (((v7 + 0x7EFEFEFEFEFEFEFFLL) ^ ~v7) & 0x8101010101010100uLL) != 0 )\n          break;\n        *(_QWORD *)&Source[v4] = v7;\n        Source += 8;\n      }\n      Count += 8LL;\n      if ( !Count )\n        break;\n      Source[v4] = v7;\n      if ( !(_BYTE)v7 )\n        goto filler;\n      ++Source;\n      if ( !--Count )\n        break;\n      Source[v4] = BYTE1(v7);\n      if ( !BYTE1(v7) )\n        goto filler;\n      ++Source;\n      if ( !--Count )\n        break;\n      v9 = v7 >> 16;\n      Source[v4] = v9;\n      if ( !(_BYTE)v9 )\n        goto filler;\n      ++Source;\n      if ( !--Count )\n        break;\n      Source[v4] = BYTE1(v9);\n      if ( !BYTE1(v9) )\n        goto filler;\n      ++Source;\n      if ( !--Count )\n        break;\n      v10 = v9 >> 16;\n      Source[v4] = v10;\n      if ( !(_BYTE)v10 )\n        goto filler;\n      ++Source;\n      if ( !--Count )\n        break;\n      Source[v4] = BYTE1(v10);\n      if ( !BYTE1(v10) )\n        goto filler;\n      ++Source;\n      if ( !--Count )\n        break;\n      v11 = WORD1(v10);\n      Source[v4] = v11;\n      if ( !(_BYTE)v11 )\n        goto filler;\n      ++Source;\n      if ( !--Count )\n        break;\n      Source[v4] = BYTE1(v11);\n      if ( !BYTE1(v11) )\n        goto filler;\n      ++Source;\n      --Count;\n    }\n    while ( Count );\n    return Destination;\n  }\n}", "assembly": "; \n; strncpy from 0x180128b60 to 0x180128cc2 (354 bytes)\n; \n; 22 xrefs:\n; > sub_180020140 @ 0x180020337\n; > sub_1800F6380 @ 0x1800f63db\n; > sub_1800F6380 @ 0x1800f63f7\n; > sub_1800F6380 @ 0x1800f6458\n; > sub_1800F6380 @ 0x1800f646f\n; > sub_1800F6380 @ 0x1800f64ea\n; > sub_1800F6380 @ 0x1800f6501\n; > sub_1800F6380 @ 0x1800f6589\n; > sub_1800F6380 @ 0x1800f659c\n; > sub_180107A40 @ 0x180107a95\n; > sub_180107A40 @ 0x180107aae\n; > sub_180109650 @ 0x1801096ab\n; > sub_180109650 @ 0x1801096c4\n; > sub_180109650 @ 0x18010973a\n; > sub_180109650 @ 0x180109751\n; > sub_180109650 @ 0x1801097e4\n; > sub_180109650 @ 0x1801097fb\n; > sub_180109650 @ 0x180109872\n; > sub_180109650 @ 0x180109889\n; > sub_180109650 @ 0x18010990e\n; > sub_180109650 @ 0x180109925\n; > <???> @ 0x180202a20\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\nmov     r11, rcx                                                       ; +0x0, 0x180128b60\nor      r8, r8                                                         ; +0x3, 0x180128b63\njz      short strncpy_exit                                             ; +0x6, 0x180128b66\nsub     rcx, rdx                                                       ; +0x8, 0x180128b68\ntest    dl, 7                                                          ; +0xb, 0x180128b6b\njz      short _qword_loop_entrance                                     ; +0xe, 0x180128b6e\nmov     al, [rdx]                                                      ; +0x10, 0x180128b70\ntest    al, al                                                         ; +0x12, 0x180128b72\nmov     [rdx+rcx], al                                                  ; +0x14, 0x180128b74\njz      filler                                                         ; +0x17, 0x180128b77\ninc     rdx                                                            ; +0x1d, 0x180128b7d\ndec     r8                                                             ; +0x20, 0x180128b80\njz      short strncpy_exit                                             ; +0x23, 0x180128b83\ntest    dl, 7                                                          ; +0x25, 0x180128b85\njnz     short copy_head_loop_begin                                     ; +0x28, 0x180128b88\njmp     short _qword_loop_entrance                                     ; +0x2a, 0x180128b8a\nmov     rax, r11                                                       ; +0x2c, 0x180128b8c\nretn                                                                   ; +0x2f, 0x180128b8f\nmov     [rdx+rcx], rax                                                 ; +0x30, 0x180128b90\nadd     rdx, 8                                                         ; +0x34, 0x180128b94\nmov     rax, [rdx]                                                     ; +0x38, 0x180128b98\nsub     r8, 8                                                          ; +0x3b, 0x180128b9b\njbe     short _qword_loop_end                                          ; +0x3f, 0x180128b9f\nmov     r9, 7EFEFEFEFEFEFEFFh                                          ; +0x41, 0x180128ba1\nadd     r9, rax                                                        ; +0x4b, 0x180128bab\nmov     r10, rax                                                       ; +0x4e, 0x180128bae\nxor     r10, 0FFFFFFFFFFFFFFFFh                                        ; +0x51, 0x180128bb1\nxor     r10, r9                                                        ; +0x55, 0x180128bb5\nmov     r9, 8101010101010100h                                          ; +0x58, 0x180128bb8\ntest    r9, r10                                                        ; +0x62, 0x180128bc2\njz      short _qword_loop_begin                                        ; +0x65, 0x180128bc5\nadd     r8, 8                                                          ; +0x67, 0x180128bc7\njz      strncpy_exit_2                                                 ; +0x6b, 0x180128bcb\ntest    al, al                                                         ; +0x71, 0x180128bd1\nmov     [rdx+rcx], al                                                  ; +0x73, 0x180128bd3\njz      filler                                                         ; +0x76, 0x180128bd6\ninc     rdx                                                            ; +0x7c, 0x180128bdc\ndec     r8                                                             ; +0x7f, 0x180128bdf\njz      short strncpy_exit_2                                           ; +0x82, 0x180128be2\ntest    ah, ah                                                         ; +0x84, 0x180128be4\nmov     [rdx+rcx], ah                                                  ; +0x86, 0x180128be6\njz      short filler                                                   ; +0x89, 0x180128be9\ninc     rdx                                                            ; +0x8b, 0x180128beb\ndec     r8                                                             ; +0x8e, 0x180128bee\njz      short strncpy_exit_2                                           ; +0x91, 0x180128bf1\nshr     rax, 10h                                                       ; +0x93, 0x180128bf3\ntest    al, al                                                         ; +0x97, 0x180128bf7\nmov     [rdx+rcx], al                                                  ; +0x99, 0x180128bf9\njz      short filler                                                   ; +0x9c, 0x180128bfc\ninc     rdx                                                            ; +0x9e, 0x180128bfe\ndec     r8                                                             ; +0xa1, 0x180128c01\njz      short strncpy_exit_2                                           ; +0xa4, 0x180128c04\ntest    ah, ah                                                         ; +0xa6, 0x180128c06\nmov     [rdx+rcx], ah                                                  ; +0xa8, 0x180128c08\njz      short filler                                                   ; +0xab, 0x180128c0b\ninc     rdx                                                            ; +0xad, 0x180128c0d\ndec     r8                                                             ; +0xb0, 0x180128c10\njz      short strncpy_exit_2                                           ; +0xb3, 0x180128c13\nshr     rax, 10h                                                       ; +0xb5, 0x180128c15\ntest    al, al                                                         ; +0xb9, 0x180128c19\nmov     [rdx+rcx], al                                                  ; +0xbb, 0x180128c1b\njz      short filler                                                   ; +0xbe, 0x180128c1e\ninc     rdx                                                            ; +0xc0, 0x180128c20\ndec     r8                                                             ; +0xc3, 0x180128c23\njz      short strncpy_exit_2                                           ; +0xc6, 0x180128c26\ntest    ah, ah                                                         ; +0xc8, 0x180128c28\nmov     [rdx+rcx], ah                                                  ; +0xca, 0x180128c2a\njz      short filler                                                   ; +0xcd, 0x180128c2d\ninc     rdx                                                            ; +0xcf, 0x180128c2f\ndec     r8                                                             ; +0xd2, 0x180128c32\njz      short strncpy_exit_2                                           ; +0xd5, 0x180128c35\nshr     eax, 10h                                                       ; +0xd7, 0x180128c37\ntest    al, al                                                         ; +0xda, 0x180128c3a\nmov     [rdx+rcx], al                                                  ; +0xdc, 0x180128c3c\njz      short filler                                                   ; +0xdf, 0x180128c3f\ninc     rdx                                                            ; +0xe1, 0x180128c41\ndec     r8                                                             ; +0xe4, 0x180128c44\njz      short strncpy_exit_2                                           ; +0xe7, 0x180128c47\ntest    ah, ah                                                         ; +0xe9, 0x180128c49\nmov     [rdx+rcx], ah                                                  ; +0xeb, 0x180128c4b\njz      short filler                                                   ; +0xee, 0x180128c4e\ninc     rdx                                                            ; +0xf0, 0x180128c50\ndec     r8                                                             ; +0xf3, 0x180128c53\njnz     _qword_loop_entrance                                           ; +0xf6, 0x180128c56\nmov     rax, r11                                                       ; +0xfc, 0x180128c5c\nretn                                                                   ; +0xff, 0x180128c5f\nadd     rcx, rdx                                                       ; +0x100, 0x180128c60\nxor     rdx, rdx                                                       ; +0x103, 0x180128c63\ncmp     r8, 10h                                                        ; +0x106, 0x180128c66\njb      short tail                                                     ; +0x10a, 0x180128c6a\ntest    cl, 7                                                          ; +0x10c, 0x180128c6c\njz      short aligned                                                  ; +0x10f, 0x180128c6f\ninc     rcx                                                            ; +0x111, 0x180128c71\nmov     [rcx], dl                                                      ; +0x114, 0x180128c74\ndec     r8                                                             ; +0x116, 0x180128c76\njmp     short aligner1                                                 ; +0x119, 0x180128c79\nsub     r8, 20h ; ' '                                                  ; +0x11b, 0x180128c7b\njb      short tail_8_enter                                             ; +0x11f, 0x180128c7f\nmov     [rcx], rdx                                                     ; +0x121, 0x180128c81\nmov     [rcx+8], rdx                                                   ; +0x124, 0x180128c84\nmov     [rcx+10h], rdx                                                 ; +0x128, 0x180128c88\nmov     [rcx+18h], rdx                                                 ; +0x12c, 0x180128c8c\nadd     rcx, 20h ; ' '                                                 ; +0x130, 0x180128c90\nsub     r8, 20h ; ' '                                                  ; +0x134, 0x180128c94\njnb     short loop32                                                   ; +0x138, 0x180128c98\nadd     r8, 20h ; ' '                                                  ; +0x13a, 0x180128c9a\nsub     r8, 8                                                          ; +0x13e, 0x180128c9e\njb      short tail_enter                                               ; +0x142, 0x180128ca2\nmov     [rcx], rdx                                                     ; +0x144, 0x180128ca4\nadd     rcx, 8                                                         ; +0x147, 0x180128ca7\njmp     short tail_8_begin                                             ; +0x14b, 0x180128cab\nadd     r8, 8                                                          ; +0x14d, 0x180128cad\nsub     r8, 1                                                          ; +0x151, 0x180128cb1\njb      short tail_finish                                              ; +0x155, 0x180128cb5\nmov     [rcx], dl                                                      ; +0x157, 0x180128cb7\ninc     rcx                                                            ; +0x159, 0x180128cb9\njmp     short tail                                                     ; +0x15c, 0x180128cbc\nmov     rax, r11                                                       ; +0x15e, 0x180128cbe\nretn                                                                   ; +0x161, 0x180128cc1", "xrefs": ["sub_180020140 @ 0x180020337", "sub_1800F6380 @ 0x1800f63db", "sub_1800F6380 @ 0x1800f63f7", "sub_1800F6380 @ 0x1800f6458", "sub_1800F6380 @ 0x1800f646f", "sub_1800F6380 @ 0x1800f64ea", "sub_1800F6380 @ 0x1800f6501", "sub_1800F6380 @ 0x1800f6589", "sub_1800F6380 @ 0x1800f659c", "sub_180107A40 @ 0x180107a95", "sub_180107A40 @ 0x180107aae", "sub_180109650 @ 0x1801096ab", "sub_180109650 @ 0x1801096c4", "sub_180109650 @ 0x18010973a", "sub_180109650 @ 0x180109751", "sub_180109650 @ 0x1801097e4", "sub_180109650 @ 0x1801097fb", "sub_180109650 @ 0x180109872", "sub_180109650 @ 0x180109889", "sub_180109650 @ 0x18010990e", "sub_180109650 @ 0x180109925", "<???> @ 0x180202a20"], "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"}