For the following program if the BLOCK_SIZE > the length of the uncompressed data then I get the wrong size returned from LZSSE2_Decompress(). If I set BLOCK_SIZE == the uncompressed data size then I get the expected result. The header indicates any block size >= the uncompressed data size is acceptable.
#include <cstddef>
#include "lzsse2/lzsse2.h"
#include <iostream>
#include <cstring>
using namespace std;
#define STARTING_DATA_SIZE 2580
#define BLOCK_SIZE (STARTING_DATA_SIZE * 2)
unsigned char starting_data[] = {
0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xc0,
0x01, 0x00, 0x50, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04,
0x80, 0x00, 0x00, 0x40, 0x03, 0x00, 0x00, 0x04, 0x00, 0x10, 0x08, 0x01,
0x20, 0x04, 0x20, 0x28, 0x90, 0x10, 0x44, 0x04, 0x00, 0x00, 0x08, 0x08,
0x00, 0x80, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
0x01, 0x00, 0x00, 0x40, 0x00, 0x62, 0x01, 0x04, 0x00, 0x00, 0x08, 0x08,
0x10, 0x04, 0x00, 0x0c, 0x80, 0x04, 0x00, 0x80, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00, 0x02, 0x04, 0x80, 0x02, 0x01,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x08, 0x00,
0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00,
0x00, 0x90, 0x08, 0x00, 0x21, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x88, 0x00, 0x00, 0x00, 0x80, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x40,
0x00, 0x00, 0x10, 0x10, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01,
0x00, 0x00, 0x10, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x06, 0x00, 0x40, 0x42, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x09,
0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x40, 0x18, 0x00, 0x00, 0x20, 0x00, 0x80, 0x00, 0x04,
0x80, 0x01, 0x04, 0x00, 0x00, 0x04, 0x02, 0x04, 0x00, 0x20, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x40, 0x01, 0x02,
0x00, 0x00, 0x00, 0x02, 0x08, 0x04, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x20, 0x04, 0x00, 0x08, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x01, 0x05, 0x00, 0x00, 0x80, 0x62,
0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x00, 0x00, 0x04,
0x00, 0x00, 0x08, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
0x00, 0x20, 0x00, 0x80, 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08,
0x04, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x10, 0x00, 0x00, 0x88, 0x10,
0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x02, 0x24, 0x00,
0x40, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x42, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00,
0x20, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x00, 0x01, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04,
0x80, 0x00, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01,
0x20, 0x04, 0x20, 0x28, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x08,
0x00, 0x80, 0x00, 0x80, 0x00, 0x10, 0x00, 0x40, 0x00, 0x00, 0x80, 0x00,
0x01, 0x00, 0x00, 0x10, 0x00, 0x62, 0x00, 0x04, 0x00, 0x00, 0x08, 0x00,
0x10, 0x00, 0x10, 0x00, 0x00, 0x04, 0x40, 0x02, 0x08, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x02, 0x10, 0x00,
0x00, 0x00, 0x40, 0x00, 0x20, 0x08, 0x00, 0x02, 0x04, 0x82, 0x02, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x08, 0x00,
0x00, 0x04, 0x00, 0x00, 0x08, 0x84, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x48, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04,
0x00, 0x00, 0x10, 0x00, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x03,
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x42, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x02, 0x20, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20,
0x00, 0x00, 0x00, 0x04, 0x18, 0x00, 0x00, 0x20, 0x00, 0x90, 0x80, 0x00,
0x00, 0x01, 0x04, 0x20, 0x00, 0x04, 0x12, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0x08, 0x84, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x20, 0x04, 0x00, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x62,
0x00, 0x04, 0x80, 0x00, 0x08, 0x00, 0x10, 0x00, 0x00, 0x40, 0x00, 0x04,
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08,
0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x40, 0x00, 0x20, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x42, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00,
0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04,
0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x01,
0x28, 0x04, 0x00, 0x28, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x00, 0x80, 0x09, 0x10, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
0x01, 0x00, 0x01, 0x00, 0x00, 0x62, 0x00, 0x04, 0x00, 0x00, 0x08, 0x80,
0x10, 0x00, 0x00, 0x80, 0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x04, 0x10, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x10, 0x00, 0x08, 0x00,
0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00,
0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00,
0x08, 0x00, 0x00, 0x02, 0x80, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00,
0x04, 0x00, 0x10, 0x00, 0x40, 0x00, 0x40, 0x00, 0x10, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
0x00, 0x04, 0x00, 0x01, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00,
0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x40, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x80, 0x00, 0x40, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x08, 0x08, 0x01, 0x20, 0x04, 0x00, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x62,
0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x04,
0x00, 0x00, 0x09, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x80,
0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08,
0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x10, 0x00, 0x02, 0x00, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00,
0x00, 0x00, 0x10, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x80, 0x00, 0x00, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x08, 0x02, 0x00,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x42, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80,
0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04,
0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01,
0x20, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00,
0x00, 0x80, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x62, 0x00, 0x0c, 0x00, 0x00, 0x08, 0x00,
0x10, 0x00, 0x40, 0x04, 0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x06, 0x00, 0x02, 0x00,
0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08,
0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x80, 0x01,
0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x08, 0x00, 0x10, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x00, 0x10, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x80, 0x10, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x82,
0x00, 0x00, 0x00, 0x02, 0x08, 0x04, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x08, 0x00, 0x00, 0x08, 0x01, 0x20, 0x04, 0x00, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x80, 0x00, 0x80, 0x08, 0x10,
0x00, 0x00, 0x20, 0x00, 0x80, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x62,
0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x14, 0x00, 0x00, 0x00, 0x00, 0x04,
0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
0x00, 0x21, 0x04, 0x00, 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08,
0x04, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x02, 0x00, 0x04, 0x00, 0x02, 0x08, 0x80, 0x01, 0x40,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x80, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x00, 0x04, 0x04,
0x40, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x30,
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x42, 0x00,
0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x80,
0x20, 0x00, 0x00, 0x20, 0x02, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x80, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x08, 0x04,
0x80, 0x00, 0x00, 0x00, 0x03, 0x40, 0x00, 0x08, 0x00, 0x01, 0x08, 0x01,
0x60, 0x0c, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x00, 0x80, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00,
0x01, 0x04, 0x00, 0x00, 0x00, 0x62, 0x00, 0x04, 0x80, 0x00, 0x08, 0x00,
0x14, 0x00, 0x00, 0x40, 0x00, 0x04, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x21, 0x00, 0x00, 0x10, 0x00,
0x00, 0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00,
0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x00,
0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00,
0x20, 0x02, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x20, 0x00,
0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40,
0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x40, 0x00, 0x20, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00, 0x00, 0x30, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x04, 0x00, 0x00, 0x42, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x02, 0x00, 0x00, 0x00, 0x40,
0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x20, 0x20, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x80, 0x00, 0x00,
0x80, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0x08, 0x04, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00,
0x00, 0x11, 0x00, 0x01, 0x0a, 0x01, 0x20, 0x04, 0x00, 0x08, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x04, 0x10,
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x62,
0x00, 0x04, 0x84, 0x00, 0x08, 0x00, 0x10, 0x00, 0x00, 0x40, 0x00, 0x04,
0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x20, 0x00,
0x00, 0x20, 0x00, 0x00, 0x12, 0x00, 0x02, 0x08, 0x00, 0x02, 0x20, 0x08,
0x00, 0x02, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10,
0x08, 0x00, 0x10, 0x02, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x20, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00,
0x04, 0x00, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x40, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x30, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x42, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x10, 0x04, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00
};
int main(int argc, char *argv[]) {
char *buffer = (char*) malloc(BLOCK_SIZE);
char *compressed_buffer = (char*) malloc(BLOCK_SIZE);
LZSSE2_OptimalParseState *state = LZSSE2_MakeOptimalParseState(static_cast< size_t >( BLOCK_SIZE));
const auto size = static_cast<const uint32_t>(LZSSE2_CompressOptimalParse(state, starting_data, STARTING_DATA_SIZE, compressed_buffer, BLOCK_SIZE, 16));
cerr << "compressed size = " << size << endl;
char *uncompressed_buffer = (char*) malloc(BLOCK_SIZE);
const size_t uncompressed_size = LZSSE2_Decompress(compressed_buffer, size, uncompressed_buffer, BLOCK_SIZE);
cerr << "uncompressed_size = " << uncompressed_size << endl;
if(uncompressed_size != STARTING_DATA_SIZE) {
cerr << "sizes don't match" << endl;
}
LZSSE2_FreeOptimalParseState(state);
}