//
// WriteArchive::process_1 from 0x140521e70 to 0x14052208d (541 bytes)
//
// 14 xrefs:
// > sub_140522B40 @ 0x140522c1e
// > WriteArchive::process_3 @ 0x1405270f6
// > sub_140527240 @ 0x14052750c
// > WriteArchive::process_4 @ 0x14052787d
// > sub_1405324A0 @ 0x1405325bd
// > sub_1405325D0 @ 0x14053285d
// > sub_140535A70 @ 0x140535c9b
// > sub_140536070 @ 0x1405362eb
// > sub_140536320 @ 0x1405378bc
// > sub_1405379E0 @ 0x140537ca3
// > sub_140537D10 @ 0x140537f3f
// > sub_140543730 @ 0x1405454c3
// > sub_140543730 @ 0x1405454d2
// > ??> @ 0x14092b478
//
// 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 11:33:38 +0000
//
// Hidden C++ exception states: #wind=3
__int64 __fastcall WriteArchive::process_1(__int64 a1, _QWORD *a2)
{
__int64 v4; // rbx
__int64 v5; // rsi
__int64 v6; // rbx
_BYTE *v7; // rax
size_t v8; // r8
void *v9; // rcx
__int128 v11; // [rsp+30h] [rbp-D0h] BYREF
_BYTE v12[16]; // [rsp+48h] [rbp-B8h] BYREF
void *Block[2]; // [rsp+58h] [rbp-A8h] BYREF
__m128i si128; // [rsp+68h] [rbp-98h]
_BYTE v15[528]; // [rsp+80h] [rbp-80h] BYREF
_OWORD v16[2]; // [rsp+290h] [rbp+190h] BYREF
fmt::BasicWriter::BasicWriter(v15);
v16[0] = 0;
v16[1] = _mm_load_si128((const __m128i *)&xmmword_140836520);
LOWORD(v16[0]) = 124;
v4 = (__int64)(a2[1] - *a2) >> 2;
fmt::BasicWriter::operator<<(v15, (unsigned int)v4);
v11 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v12, v16);
fmt::BasicWriter::operator<<(v15, &v11);
v5 = (int)v4;
if ( (int)v4 > 0 )
{
v6 = 0;
do
{
fmt::BasicWriter::operator<<(v15, *(unsigned int *)(*a2 + 4 * v6));
v11 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v12, v16);
fmt::BasicWriter::operator<<(v15, &v11);
++v6;
}
while ( v6 < v5 );
}
v7 = (_BYTE *)fmt::BasicWriter::c_str(v15);
*(_OWORD *)Block = 0;
si128 = 0;
v8 = -1;
do
++v8;
while ( v7[v8] );
sub_14003D230(Block, v7, v8);
v11 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v12, Block);
fmt::BasicWriter::operator<<(a1, &v11);
v11 = *(_OWORD *)fmt::BasicStringRef::BasicStringRef(v12, a1 + 528);
fmt::BasicWriter::operator<<(a1, &v11);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v9 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v9);
}
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[0]) = 0;
sub_14003D310((__int64)v16);
return fmt::BasicWriter::~BasicWriter(v15);
}