// File: jimmiebergmann[P]fbx-file/fbx.cpp
// Function: void Fbx::(anonymous namespace)::writeArray<int>(std::vector<unsigned char, std::allocator<unsigned char>>&, std::vector<Fbx::Property::Value, std::allocator<Fbx::Property::Value>> const&)
void writeArray(std::vector<uint8_t> & data, const std::vector<Property::Value> & array)
        {
            const uint32_t arrayLength = static_cast<uint32_t>(array.size());
            const uint32_t arraySize = arrayLength * sizeof(T);
            const uint8_t * pArrayLength = reinterpret_cast<const uint8_t*>(&arrayLength);
 
            data.insert(data.end(), pArrayLength, pArrayLength + 4);
            data.insert(data.end(), 4, 0);
            data.insert(data.end(), 4, 0);

            if (arraySize != 0)
            {
                std::vector<uint8_t> * pBytes = new std::vector<uint8_t>();
                for (uint32_t i = 0; i < arrayLength; i++)
                {
                    const uint8_t * pValue = reinterpret_cast<const uint8_t*> (&array[i].boolean);
                    pBytes->insert(pBytes->end(), pValue, pValue + sizeof(T));
                }

                uint32_t compressedLength = static_cast<uint32_t>(pBytes->size());
                uint32_t encoding = 0;
                if (arraySize > 127)
                {
                    std::vector<uint8_t> * pCompressedBytes = new std::vector<uint8_t>(pBytes->begin(), pBytes->end());

                    mz_ulong destLength = static_cast<mz_ulong>(pBytes->size());
                    int status = 0;
                    if ((status = compress(&(*pCompressedBytes)[0], &destLength, &(*pBytes)[0], destLength)) == MZ_OK)
                    {
                        delete pBytes;
                        pBytes = pCompressedBytes;
                        compressedLength = static_cast<uint32_t>(destLength);
                        encoding = 1;
                    }
                    else
                    {
                        delete pCompressedBytes;
                    }
                }

                const uint8_t * pCompressedLength = reinterpret_cast<const uint8_t*>(&compressedLength);
                const uint8_t * pArrayLength = reinterpret_cast<const uint8_t*>(&arrayLength);
                const uint8_t * pEncoding = reinterpret_cast<const uint8_t*>(&encoding);

                memcpy(&data[data.size() - 8], pEncoding, 4);
                memcpy(&data[data.size() - 4], pCompressedLength, 4);
                data.insert(data.end(), &(*pBytes)[0], &(*pBytes)[0] + compressedLength);

                delete pBytes;
            }
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x28020
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
shlq $0x2, %rax
movl %eax, -0x18(%rbp)
leaq -0x14(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28cb0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x28ce0
movq -0x138(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x20(%rbp), %rcx
addq $0x4, %rcx
movq -0x28(%rbp), %rsi
callq 0x28c10
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28cb0
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x28ce0
movq -0x130(%rbp), %rdi
movb $0x0, -0x49(%rbp)
movq -0x40(%rbp), %rsi
movl $0x4, %edx
leaq -0x49(%rbp), %rcx
callq 0x28fa0
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28cb0
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x28ce0
movq -0x128(%rbp), %rdi
movb $0x0, -0x69(%rbp)
movq -0x60(%rbp), %rsi
movl $0x4, %edx
leaq -0x69(%rbp), %rcx
callq 0x28fa0
movq %rax, -0x78(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x2494e
movl $0x18, %edi
callq 0x3310
movq %rax, %rdi
movq %rdi, -0x140(%rbp)
xorl %esi, %esi
movl $0x18, %edx
callq 0x3190
movq -0x140(%rbp), %rdi
callq 0x27d90
movq -0x140(%rbp), %rax
movq %rax, -0x80(%rbp)
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x24642
movq -0x10(%rbp), %rdi
movl -0x84(%rbp), %eax
movl %eax, %esi
callq 0x329a0
movq %rax, -0x90(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x80(%rbp), %rdi
callq 0x28cb0
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x28ce0
movq -0x148(%rbp), %rdi
movq -0x90(%rbp), %rdx
movq -0x90(%rbp), %rcx
addq $0x4, %rcx
movq -0x98(%rbp), %rsi
callq 0x28c10
movq %rax, -0xa8(%rbp)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x245ad
movq -0x80(%rbp), %rdi
callq 0x28040
movl %eax, -0xac(%rbp)
movl $0x0, -0xb0(%rbp)
cmpl $0x7f, -0x18(%rbp)
jbe 0x2481c
movl $0x18, %edi
callq 0x3310
movq %rax, -0x158(%rbp)
movq %rax, -0x160(%rbp)
movb $0x1, -0xdd(%rbp)
movq -0x80(%rbp), %rdi
callq 0x2d0f0
movq %rax, -0xc0(%rbp)
movq -0x80(%rbp), %rdi
callq 0x28cb0
movq %rax, -0xc8(%rbp)
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x27ee0
movq -0x158(%rbp), %rdi
movq -0x150(%rbp), %rcx
movq -0xc0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
callq 0x329c0
jmp 0x246da
movb $0x0, -0xdd(%rbp)
leaq -0xc9(%rbp), %rdi
callq 0x27f80
movq -0x160(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x80(%rbp), %rdi
callq 0x28040
movq %rax, -0xe8(%rbp)
movl $0x0, -0xec(%rbp)
movq -0xb8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x28f50
movq %rax, -0x168(%rbp)
movq -0x80(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x28f50
movq -0x168(%rbp), %rdi
movq %rax, %rdx
movq -0xe8(%rbp), %rcx
leaq -0xe8(%rbp), %rsi
callq 0x48b0
movl %eax, -0xec(%rbp)
cmpl $0x0, %eax
jne 0x247ec
movq -0x80(%rbp), %rax
movq %rax, -0x170(%rbp)
cmpq $0x0, %rax
je 0x2478e
movq -0x170(%rbp), %rdi
callq 0x27e20
movq -0x170(%rbp), %rdi
callq 0x32e0
movq -0xb8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0xe8(%rbp), %rax
movl %eax, -0xac(%rbp)
movl $0x1, -0xb0(%rbp)
jmp 0x2481a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0xc9(%rbp), %rdi
callq 0x27f80
testb $0x1, -0xdd(%rbp)
jne 0x247db
jmp 0x247e7
movq -0x160(%rbp), %rdi
callq 0x32e0
jmp 0x24957
movq -0xb8(%rbp), %rax
movq %rax, -0x178(%rbp)
cmpq $0x0, %rax
je 0x24818
movq -0x178(%rbp), %rdi
callq 0x27e20
movq -0x178(%rbp), %rdi
callq 0x32e0
jmp 0x2481a
jmp 0x2481c
leaq -0xac(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq -0x14(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq -0xb0(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28040
movq -0x1a0(%rbp), %rdi
movq %rax, %rsi
subq $0x8, %rsi
callq 0x28f50
movq -0x108(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28040
movq -0x198(%rbp), %rdi
movq %rax, %rsi
subq $0x4, %rsi
callq 0x28f50
movq -0xf8(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x8(%rbp), %rdi
callq 0x28cb0
movq %rax, -0x118(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x28ce0
movq -0x80(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x28f50
movq %rax, -0x188(%rbp)
movq -0x80(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x28f50
movq -0x190(%rbp), %rdi
movq -0x188(%rbp), %rdx
movq %rax, %rcx
movl -0xac(%rbp), %eax
addq %rax, %rcx
movq -0x110(%rbp), %rsi
callq 0x32a40
movq %rax, -0x120(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x180(%rbp)
cmpq $0x0, %rax
je 0x2494c
movq -0x180(%rbp), %rdi
callq 0x27e20
movq -0x180(%rbp), %rdi
callq 0x32e0
jmp 0x2494e
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq -0xd8(%rbp), %rdi
callq 0x3560
nopw %cs:(%rax,%rax)