You can do this with the OpenSSL command line tool:

    openssl zlib -d < $IN > $OUT

Unfortunately, at least on Ubuntu, the `zlib` subcommand is disabled in the default build configuration (`--no-zlib` `--no-zlib-dynamic`), so you would need to compile `openssl` from source to use it. But it is enabled by default on Arch, for example.