#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <squash/squash.h>
int main (int argc, char** argv) {
  char* codec_name;
  const char* uncompressed;
  size_t uncompressed_length;
  size_t compressed_length;
  uint8_t* compressed;
  size_t decompressed_length;
  char* decompressed;
  if (argc != 3) {
    fprintf (stderr, "USAGE: %s ALGORITHM STRING\n", argv[0]);
    exit (-1);
  }
  codec_name = argv[1];
  uncompressed = argv[2];
  uncompressed_length = strlen (uncompressed);
  compressed = (uint8_t*) malloc (compressed_length);
  decompressed_length = uncompressed_length + 1;
  decompressed = (char*) malloc (uncompressed_length + 1);
                     &compressed_length, compressed,
                     uncompressed_length, (const uint8_t*) uncompressed,
                     NULL);
    fprintf (stderr, "Unable to compress data [%d]: %s\n",
    exit (res);
  }
  fprintf (stdout, "Compressed a %u byte buffer to %u bytes.\n",
           (unsigned int) uncompressed_length, (unsigned int) compressed_length);
                           &decompressed_length, (uint8_t*) decompressed,
                           compressed_length, compressed, NULL);
    fprintf (stderr, "Unable to decompress data [%d]: %s\n",
    exit (res);
  }
  
  decompressed[decompressed_length] = '\0';
  if (strcmp (decompressed, uncompressed) != 0) {
    fprintf (stderr, "Bad decompressed data.\n");
    exit (-1);
  }
  fprintf (stdout, "Successfully decompressed.\n");
  return 0;
}