mz_crypt_crc32_update:
   35|  63.9M|uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size) {
   36|  63.9M|#if defined(HAVE_ZLIB)
   37|       |#  ifndef ZLIB_VERNUM
   38|       |    /* HAVE_ZLIB but no ZLIB_VERNUM? */
   39|       |    typedef uint32_t z_crc_t;
   40|       |#  elif (ZLIB_VERNUM & 0xf != 0xf) && (ZLIB_VERNUM < 0x1270)
   41|       |    /* Define z_crc_t in zlib 1.2.6 and less */
   42|       |    typedef unsigned long z_crc_t;
   43|       |#  elif (ZLIB_VERNUM & 0xf == 0xf) && (ZLIB_VERNUM < 0x12df)
   44|       |    /* Define z_crc_t in zlib-ng 2.0.7 and less */
   45|       |    typedef unsigned int z_crc_t;
   46|       |#  endif
   47|  63.9M|    return (uint32_t)ZLIB_PREFIX(crc32)((z_crc_t)value, buf, (uInt)size);
  ------------------
  |  |   21|  63.9M|#    define ZLIB_PREFIX(x) x
  ------------------
   48|       |#elif defined(HAVE_LZMA)
   49|       |    return (uint32_t)lzma_crc32(buf, (size_t)size, (uint32_t)value);
   50|       |#else
   51|       |    static uint32_t crc32_table[256] = {
   52|       |        0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832,
   53|       |        0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
   54|       |        0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a,
   55|       |        0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
   56|       |        0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
   57|       |        0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
   58|       |        0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab,
   59|       |        0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
   60|       |        0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4,
   61|       |        0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
   62|       |        0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074,
   63|       |        0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
   64|       |        0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525,
   65|       |        0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
   66|       |        0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
   67|       |        0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
   68|       |        0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76,
   69|       |        0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
   70|       |        0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6,
   71|       |        0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
   72|       |        0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7,
   73|       |        0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
   74|       |        0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7,
   75|       |        0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
   76|       |        0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
   77|       |        0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
   78|       |        0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330,
   79|       |        0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
   80|       |        0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d};
   81|       |    value = ~value;
   82|       |
   83|       |    while (size > 0) {
   84|       |        value = (value >> 8) ^ crc32_table[(value ^ *buf) & 0xFF];
   85|       |
   86|       |        buf += 1;
   87|       |        size -= 1;
   88|       |    }
   89|       |
   90|       |    return ~value;
   91|       |#endif
   92|  63.9M|}

mz_crypt_rand:
   48|    250|int32_t mz_crypt_rand(uint8_t *buf, int32_t size) {
   49|    250|    if (!RAND_bytes(buf, size))
  ------------------
  |  Branch (49:9): [True: 0, False: 250]
  ------------------
   50|      0|        return MZ_CRYPT_ERROR;
  ------------------
  |  |   35|      0|#define MZ_CRYPT_ERROR    (-106)
  ------------------
   51|       |
   52|    250|    return size;
   53|    250|}

mz_stream_open:
   20|  4.84k|int32_t mz_stream_open(void *stream, const char *path, int32_t mode) {
   21|  4.84k|    mz_stream *strm = (mz_stream *)stream;
   22|  4.84k|    if (!strm || !strm->vtbl || !strm->vtbl->open)
  ------------------
  |  Branch (22:9): [True: 0, False: 4.84k]
  |  Branch (22:18): [True: 0, False: 4.84k]
  |  Branch (22:33): [True: 0, False: 4.84k]
  ------------------
   23|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
   24|  4.84k|    return strm->vtbl->open(strm, path, mode);
   25|  4.84k|}
mz_stream_is_open:
   27|   202k|int32_t mz_stream_is_open(void *stream) {
   28|   202k|    mz_stream *strm = (mz_stream *)stream;
   29|   202k|    if (!strm || !strm->vtbl || !strm->vtbl->is_open)
  ------------------
  |  Branch (29:9): [True: 0, False: 202k]
  |  Branch (29:18): [True: 0, False: 202k]
  |  Branch (29:33): [True: 0, False: 202k]
  ------------------
   30|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
   31|   202k|    return strm->vtbl->is_open(strm);
   32|   202k|}
mz_stream_read:
   34|  18.6k|int32_t mz_stream_read(void *stream, void *buf, int32_t size) {
   35|  18.6k|    mz_stream *strm = (mz_stream *)stream;
   36|  18.6k|    if (!strm || !strm->vtbl || !strm->vtbl->read)
  ------------------
  |  Branch (36:9): [True: 0, False: 18.6k]
  |  Branch (36:18): [True: 0, False: 18.6k]
  |  Branch (36:33): [True: 0, False: 18.6k]
  ------------------
   37|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
   38|  18.6k|    if (mz_stream_is_open(strm) != MZ_OK)
  ------------------
  |  |   21|  18.6k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (38:9): [True: 0, False: 18.6k]
  ------------------
   39|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
   40|  18.6k|    return strm->vtbl->read(strm, buf, size);
   41|  18.6k|}
mz_stream_read_uint8:
   60|  12.1k|int32_t mz_stream_read_uint8(void *stream, uint8_t *value) {
   61|  12.1k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  12.1k|#define MZ_OK             (0)  /* zlib */
  ------------------
   62|  12.1k|    uint64_t value64 = 0;
   63|       |
   64|  12.1k|    *value = 0;
   65|  12.1k|    err = mz_stream_read_value(stream, &value64, sizeof(uint8_t));
   66|  12.1k|    if (err == MZ_OK)
  ------------------
  |  |   21|  12.1k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (66:9): [True: 11.9k, False: 269]
  ------------------
   67|  11.9k|        *value = (uint8_t)value64;
   68|  12.1k|    return err;
   69|  12.1k|}
mz_stream_read_uint16:
   71|  4.15k|int32_t mz_stream_read_uint16(void *stream, uint16_t *value) {
   72|  4.15k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  4.15k|#define MZ_OK             (0)  /* zlib */
  ------------------
   73|  4.15k|    uint64_t value64 = 0;
   74|       |
   75|  4.15k|    *value = 0;
   76|  4.15k|    err = mz_stream_read_value(stream, &value64, sizeof(uint16_t));
   77|  4.15k|    if (err == MZ_OK)
  ------------------
  |  |   21|  4.15k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (77:9): [True: 4.13k, False: 21]
  ------------------
   78|  4.13k|        *value = (uint16_t)value64;
   79|  4.15k|    return err;
   80|  4.15k|}
mz_stream_write:
  101|   147k|int32_t mz_stream_write(void *stream, const void *buf, int32_t size) {
  102|   147k|    mz_stream *strm = (mz_stream *)stream;
  103|   147k|    if (size == 0)
  ------------------
  |  Branch (103:9): [True: 4.95k, False: 142k]
  ------------------
  104|  4.95k|        return size;
  105|   142k|    if (!strm || !strm->vtbl || !strm->vtbl->write)
  ------------------
  |  Branch (105:9): [True: 0, False: 142k]
  |  Branch (105:18): [True: 0, False: 142k]
  |  Branch (105:33): [True: 0, False: 142k]
  ------------------
  106|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  107|   142k|    if (mz_stream_is_open(strm) != MZ_OK)
  ------------------
  |  |   21|   142k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (107:9): [True: 0, False: 142k]
  ------------------
  108|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  109|   142k|    return strm->vtbl->write(strm, buf, size);
  110|   142k|}
mz_stream_write_uint8:
  136|  9.88k|int32_t mz_stream_write_uint8(void *stream, uint8_t value) {
  137|  9.88k|    return mz_stream_write_value(stream, value, sizeof(uint8_t));
  138|  9.88k|}
mz_stream_write_uint16:
  140|  50.0k|int32_t mz_stream_write_uint16(void *stream, uint16_t value) {
  141|  50.0k|    return mz_stream_write_value(stream, value, sizeof(uint16_t));
  142|  50.0k|}
mz_stream_write_uint32:
  144|  41.5k|int32_t mz_stream_write_uint32(void *stream, uint32_t value) {
  145|  41.5k|    return mz_stream_write_value(stream, value, sizeof(uint32_t));
  146|  41.5k|}
mz_stream_write_int64:
  148|  8.27k|int32_t mz_stream_write_int64(void *stream, int64_t value) {
  149|  8.27k|    return mz_stream_write_value(stream, (uint64_t)value, sizeof(uint64_t));
  150|  8.27k|}
mz_stream_copy:
  156|  2.47k|int32_t mz_stream_copy(void *target, void *source, int32_t len) {
  157|  2.47k|    return mz_stream_copy_stream(target, NULL, source, NULL, len);
  158|  2.47k|}
mz_stream_copy_stream:
  165|  2.47k|                              int32_t len) {
  166|  2.47k|    uint8_t buf[16384];
  167|  2.47k|    int32_t bytes_to_copy = 0;
  168|  2.47k|    int32_t read = 0;
  169|  2.47k|    int32_t written = 0;
  170|       |
  171|  2.47k|    if (!write_cb)
  ------------------
  |  Branch (171:9): [True: 2.47k, False: 0]
  ------------------
  172|  2.47k|        write_cb = mz_stream_write;
  173|  2.47k|    if (!read_cb)
  ------------------
  |  Branch (173:9): [True: 2.47k, False: 0]
  ------------------
  174|  2.47k|        read_cb = mz_stream_read;
  175|       |
  176|  4.81k|    while (len > 0) {
  ------------------
  |  Branch (176:12): [True: 2.34k, False: 2.47k]
  ------------------
  177|  2.34k|        bytes_to_copy = len;
  178|  2.34k|        if (bytes_to_copy > (int32_t)sizeof(buf))
  ------------------
  |  Branch (178:13): [True: 0, False: 2.34k]
  ------------------
  179|      0|            bytes_to_copy = sizeof(buf);
  180|  2.34k|        read = read_cb(source, buf, bytes_to_copy);
  181|  2.34k|        if (read <= 0)
  ------------------
  |  Branch (181:13): [True: 0, False: 2.34k]
  ------------------
  182|      0|            return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  183|  2.34k|        written = write_cb(target, buf, read);
  184|  2.34k|        if (written != read)
  ------------------
  |  Branch (184:13): [True: 0, False: 2.34k]
  ------------------
  185|      0|            return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  186|  2.34k|        len -= read;
  187|  2.34k|    }
  188|       |
  189|  2.47k|    return MZ_OK;
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  190|  2.47k|}
mz_stream_tell:
  217|  19.6k|int64_t mz_stream_tell(void *stream) {
  218|  19.6k|    mz_stream *strm = (mz_stream *)stream;
  219|  19.6k|    if (!strm || !strm->vtbl || !strm->vtbl->tell)
  ------------------
  |  Branch (219:9): [True: 0, False: 19.6k]
  |  Branch (219:18): [True: 0, False: 19.6k]
  |  Branch (219:33): [True: 0, False: 19.6k]
  ------------------
  220|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  221|  19.6k|    if (mz_stream_is_open(strm) != MZ_OK)
  ------------------
  |  |   21|  19.6k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (221:9): [True: 0, False: 19.6k]
  ------------------
  222|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  223|  19.6k|    return strm->vtbl->tell(strm);
  224|  19.6k|}
mz_stream_seek:
  226|  7.41k|int32_t mz_stream_seek(void *stream, int64_t offset, int32_t origin) {
  227|  7.41k|    mz_stream *strm = (mz_stream *)stream;
  228|  7.41k|    if (!strm || !strm->vtbl || !strm->vtbl->seek)
  ------------------
  |  Branch (228:9): [True: 0, False: 7.41k]
  |  Branch (228:18): [True: 0, False: 7.41k]
  |  Branch (228:33): [True: 0, False: 7.41k]
  ------------------
  229|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  230|  7.41k|    if (mz_stream_is_open(strm) != MZ_OK)
  ------------------
  |  |   21|  7.41k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (230:9): [True: 0, False: 7.41k]
  ------------------
  231|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  232|  7.41k|    if (origin == MZ_SEEK_SET && offset < 0)
  ------------------
  |  |   59|  14.8k|#define MZ_SEEK_SET (0)
  ------------------
  |  Branch (232:9): [True: 4.94k, False: 2.47k]
  |  Branch (232:34): [True: 0, False: 4.94k]
  ------------------
  233|      0|        return MZ_SEEK_ERROR;
  ------------------
  |  |   42|      0|#define MZ_SEEK_ERROR     (-113)
  ------------------
  234|  7.41k|    return strm->vtbl->seek(strm, offset, origin);
  235|  7.41k|}
mz_stream_close:
  362|  5.06k|int32_t mz_stream_close(void *stream) {
  363|  5.06k|    mz_stream *strm = (mz_stream *)stream;
  364|  5.06k|    if (!strm || !strm->vtbl || !strm->vtbl->close)
  ------------------
  |  Branch (364:9): [True: 0, False: 5.06k]
  |  Branch (364:18): [True: 0, False: 5.06k]
  |  Branch (364:33): [True: 0, False: 5.06k]
  ------------------
  365|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  366|  5.06k|    if (mz_stream_is_open(stream) != MZ_OK)
  ------------------
  |  |   21|  5.06k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (366:9): [True: 0, False: 5.06k]
  ------------------
  367|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  368|  5.06k|    return strm->vtbl->close(strm);
  369|  5.06k|}
mz_stream_error:
  371|    290|int32_t mz_stream_error(void *stream) {
  372|    290|    mz_stream *strm = (mz_stream *)stream;
  373|    290|    if (!strm || !strm->vtbl || !strm->vtbl->error)
  ------------------
  |  Branch (373:9): [True: 0, False: 290]
  |  Branch (373:18): [True: 0, False: 290]
  |  Branch (373:33): [True: 0, False: 290]
  ------------------
  374|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  375|    290|    return strm->vtbl->error(strm);
  376|    290|}
mz_stream_set_base:
  378|  5.09k|int32_t mz_stream_set_base(void *stream, void *base) {
  379|  5.09k|    mz_stream *strm = (mz_stream *)stream;
  380|  5.09k|    strm->base = (mz_stream *)base;
  381|  5.09k|    return MZ_OK;
  ------------------
  |  |   21|  5.09k|#define MZ_OK             (0)  /* zlib */
  ------------------
  382|  5.09k|}
mz_stream_get_prop_int64:
  391|  12.3k|int32_t mz_stream_get_prop_int64(void *stream, int32_t prop, int64_t *value) {
  392|  12.3k|    mz_stream *strm = (mz_stream *)stream;
  393|  12.3k|    if (!strm || !strm->vtbl || !strm->vtbl->get_prop_int64)
  ------------------
  |  Branch (393:9): [True: 0, False: 12.3k]
  |  Branch (393:18): [True: 0, False: 12.3k]
  |  Branch (393:33): [True: 7.41k, False: 4.93k]
  ------------------
  394|  7.41k|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|  7.41k|#define MZ_PARAM_ERROR    (-102)
  ------------------
  395|  4.93k|    return strm->vtbl->get_prop_int64(strm, prop, value);
  396|  12.3k|}
mz_stream_set_prop_int64:
  398|  6.96k|int32_t mz_stream_set_prop_int64(void *stream, int32_t prop, int64_t value) {
  399|  6.96k|    mz_stream *strm = (mz_stream *)stream;
  400|  6.96k|    if (!strm || !strm->vtbl || !strm->vtbl->set_prop_int64)
  ------------------
  |  Branch (400:9): [True: 0, False: 6.96k]
  |  Branch (400:18): [True: 0, False: 6.96k]
  |  Branch (400:33): [True: 2.47k, False: 4.49k]
  ------------------
  401|  2.47k|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|  2.47k|#define MZ_PARAM_ERROR    (-102)
  ------------------
  402|  4.49k|    return strm->vtbl->set_prop_int64(strm, prop, value);
  403|  6.96k|}
mz_stream_delete:
  411|  7.31k|void mz_stream_delete(void **stream) {
  412|  7.31k|    mz_stream *strm = NULL;
  413|  7.31k|    if (!stream)
  ------------------
  |  Branch (413:9): [True: 0, False: 7.31k]
  ------------------
  414|      0|        return;
  415|  7.31k|    strm = (mz_stream *)*stream;
  416|  7.31k|    if (strm && strm->vtbl && strm->vtbl->destroy)
  ------------------
  |  Branch (416:9): [True: 7.31k, False: 0]
  |  Branch (416:17): [True: 7.31k, False: 0]
  |  Branch (416:31): [True: 7.31k, False: 0]
  ------------------
  417|  7.31k|        strm->vtbl->destroy(stream);
  418|       |    *stream = NULL;
  419|  7.31k|}
mz_stream_raw_open:
  432|  2.38k|int32_t mz_stream_raw_open(void *stream, const char *path, int32_t mode) {
  433|  2.38k|    MZ_UNUSED(stream);
  ------------------
  |  |  149|  2.38k|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  434|  2.38k|    MZ_UNUSED(path);
  ------------------
  |  |  149|  2.38k|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  435|  2.38k|    MZ_UNUSED(mode);
  ------------------
  |  |  149|  2.38k|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  436|       |
  437|  2.38k|    return MZ_OK;
  ------------------
  |  |   21|  2.38k|#define MZ_OK             (0)  /* zlib */
  ------------------
  438|  2.38k|}
mz_stream_raw_is_open:
  440|  8.66k|int32_t mz_stream_raw_is_open(void *stream) {
  441|  8.66k|    mz_stream_raw *raw = (mz_stream_raw *)stream;
  442|  8.66k|    return mz_stream_is_open(raw->stream.base);
  443|  8.66k|}
mz_stream_raw_write:
  465|  8.26k|int32_t mz_stream_raw_write(void *stream, const void *buf, int32_t size) {
  466|  8.26k|    mz_stream_raw *raw = (mz_stream_raw *)stream;
  467|  8.26k|    int32_t written = 0;
  468|       |
  469|  8.26k|    written = mz_stream_write(raw->stream.base, buf, size);
  470|       |
  471|  8.26k|    if (written > 0) {
  ------------------
  |  Branch (471:9): [True: 8.26k, False: 0]
  ------------------
  472|  8.26k|        raw->total_out += written;
  473|  8.26k|        raw->total_in += written;
  474|  8.26k|    }
  475|       |
  476|  8.26k|    return written;
  477|  8.26k|}
mz_stream_raw_close:
  489|    210|int32_t mz_stream_raw_close(void *stream) {
  490|    210|    MZ_UNUSED(stream);
  ------------------
  |  |  149|    210|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  491|    210|    return MZ_OK;
  ------------------
  |  |   21|    210|#define MZ_OK             (0)  /* zlib */
  ------------------
  492|    210|}
mz_stream_raw_get_prop_int64:
  499|    420|int32_t mz_stream_raw_get_prop_int64(void *stream, int32_t prop, int64_t *value) {
  500|    420|    mz_stream_raw *raw = (mz_stream_raw *)stream;
  501|    420|    switch (prop) {
  ------------------
  |  Branch (501:13): [True: 420, False: 0]
  ------------------
  502|    210|    case MZ_STREAM_PROP_TOTAL_IN:
  ------------------
  |  |   20|    210|#define MZ_STREAM_PROP_TOTAL_IN         (1)
  ------------------
  |  Branch (502:5): [True: 210, False: 210]
  ------------------
  503|    210|        *value = raw->total_in;
  504|    210|        return MZ_OK;
  ------------------
  |  |   21|    210|#define MZ_OK             (0)  /* zlib */
  ------------------
  505|    210|    case MZ_STREAM_PROP_TOTAL_OUT:
  ------------------
  |  |   22|    210|#define MZ_STREAM_PROP_TOTAL_OUT        (3)
  ------------------
  |  Branch (505:5): [True: 210, False: 210]
  ------------------
  506|    210|        *value = raw->total_out;
  507|    210|        return MZ_OK;
  ------------------
  |  |   21|    210|#define MZ_OK             (0)  /* zlib */
  ------------------
  508|    420|    }
  509|      0|    return MZ_EXIST_ERROR;
  ------------------
  |  |   36|      0|#define MZ_EXIST_ERROR    (-107)
  ------------------
  510|    420|}
mz_stream_raw_set_prop_int64:
  512|    210|int32_t mz_stream_raw_set_prop_int64(void *stream, int32_t prop, int64_t value) {
  513|    210|    mz_stream_raw *raw = (mz_stream_raw *)stream;
  514|    210|    switch (prop) {
  ------------------
  |  Branch (514:13): [True: 0, False: 210]
  ------------------
  515|      0|    case MZ_STREAM_PROP_TOTAL_IN_MAX:
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX     (2)
  ------------------
  |  Branch (515:5): [True: 0, False: 210]
  ------------------
  516|      0|        raw->max_total_in = value;
  517|      0|        return MZ_OK;
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  518|    210|    }
  519|    210|    return MZ_EXIST_ERROR;
  ------------------
  |  |   36|    210|#define MZ_EXIST_ERROR    (-107)
  ------------------
  520|    210|}
mz_stream_raw_create:
  531|  2.38k|void *mz_stream_raw_create(void) {
  532|  2.38k|    mz_stream_raw *raw = (mz_stream_raw *)calloc(1, sizeof(mz_stream_raw));
  533|  2.38k|    if (raw)
  ------------------
  |  Branch (533:9): [True: 2.38k, False: 0]
  ------------------
  534|  2.38k|        raw->stream.vtbl = &mz_stream_raw_vtbl;
  535|  2.38k|    return raw;
  536|  2.38k|}
mz_stream_raw_delete:
  538|  2.38k|void mz_stream_raw_delete(void **stream) {
  539|  2.38k|    mz_stream_raw *raw = NULL;
  540|  2.38k|    if (!stream)
  ------------------
  |  Branch (540:9): [True: 0, False: 2.38k]
  ------------------
  541|      0|        return;
  542|  2.38k|    raw = (mz_stream_raw *)*stream;
  543|  2.38k|    free(raw);
  544|       |    *stream = NULL;
  545|  2.38k|}
mz_strm.c:mz_stream_read_value:
   43|  16.3k|static int32_t mz_stream_read_value(void *stream, uint64_t *value, int32_t len) {
   44|  16.3k|    uint8_t buf[8];
   45|  16.3k|    int32_t n = 0;
   46|  16.3k|    int32_t i = 0;
   47|       |
   48|  16.3k|    *value = 0;
   49|  16.3k|    if (mz_stream_read(stream, buf, len) == len) {
  ------------------
  |  Branch (49:9): [True: 16.0k, False: 290]
  ------------------
   50|  36.2k|        for (n = 0; n < len; n += 1, i += 8)
  ------------------
  |  Branch (50:21): [True: 20.1k, False: 16.0k]
  ------------------
   51|  20.1k|            *value += ((uint64_t)buf[n]) << i;
   52|  16.0k|    } else if (mz_stream_error(stream))
  ------------------
  |  Branch (52:16): [True: 0, False: 290]
  ------------------
   53|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
   54|    290|    else
   55|    290|        return MZ_END_OF_STREAM;
  ------------------
  |  |   29|    290|#define MZ_END_OF_STREAM  (-101)
  ------------------
   56|       |
   57|  16.0k|    return MZ_OK;
  ------------------
  |  |   21|  16.0k|#define MZ_OK             (0)  /* zlib */
  ------------------
   58|  16.3k|}
mz_strm.c:mz_stream_write_value:
  112|   109k|static int32_t mz_stream_write_value(void *stream, uint64_t value, int32_t len) {
  113|   109k|    mz_stream *strm = (mz_stream *)stream;
  114|   109k|    uint8_t buf[8];
  115|   109k|    int32_t n = 0;
  116|       |
  117|   109k|    if (!strm)
  ------------------
  |  Branch (117:9): [True: 0, False: 109k]
  ------------------
  118|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  119|   452k|    for (n = 0; n < len; n += 1) {
  ------------------
  |  Branch (119:17): [True: 342k, False: 109k]
  ------------------
  120|   342k|        buf[n] = (uint8_t)(value & 0xff);
  121|   342k|        value >>= 8;
  122|   342k|    }
  123|       |
  124|   109k|    if (value != 0) {
  ------------------
  |  Branch (124:9): [True: 0, False: 109k]
  ------------------
  125|       |        /* Data overflow - hack for ZIP64 (X Roche) */
  126|      0|        for (n = 0; n < len; n += 1)
  ------------------
  |  Branch (126:21): [True: 0, False: 0]
  ------------------
  127|      0|            buf[n] = 0xff;
  128|      0|    }
  129|       |
  130|   109k|    if (mz_stream_write(strm, buf, len) != len)
  ------------------
  |  Branch (130:9): [True: 0, False: 109k]
  ------------------
  131|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  132|       |
  133|   109k|    return MZ_OK;
  ------------------
  |  |   21|   109k|#define MZ_OK             (0)  /* zlib */
  ------------------
  134|   109k|}

mz_stream_mem_open:
   71|  9.88k|int32_t mz_stream_mem_open(void *stream, const char *path, int32_t mode) {
   72|  9.88k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
   73|  9.88k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  9.88k|#define MZ_OK             (0)  /* zlib */
  ------------------
   74|       |
   75|  9.88k|    MZ_UNUSED(path);
  ------------------
  |  |  149|  9.88k|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
   76|       |
   77|  9.88k|    mem->mode = mode;
   78|  9.88k|    mem->limit = 0;
   79|  9.88k|    mem->position = 0;
   80|       |
   81|  9.88k|    if (mem->mode & MZ_OPEN_MODE_CREATE)
  ------------------
  |  |   54|  9.88k|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
  |  Branch (81:9): [True: 9.88k, False: 0]
  ------------------
   82|  9.88k|        err = mz_stream_mem_set_size(stream, mem->grow_size);
   83|      0|    else
   84|      0|        mem->limit = mem->size;
   85|       |
   86|  9.88k|    return err;
   87|  9.88k|}
mz_stream_mem_is_open:
   89|   188k|int32_t mz_stream_mem_is_open(void *stream) {
   90|   188k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
   91|   188k|    if (!mem->buffer)
  ------------------
  |  Branch (91:9): [True: 0, False: 188k]
  ------------------
   92|      0|        return MZ_OPEN_ERROR;
  ------------------
  |  |   40|      0|#define MZ_OPEN_ERROR     (-111)
  ------------------
   93|   188k|    return MZ_OK;
  ------------------
  |  |   21|   188k|#define MZ_OK             (0)  /* zlib */
  ------------------
   94|   188k|}
mz_stream_mem_read:
   96|  18.6k|int32_t mz_stream_mem_read(void *stream, void *buf, int32_t size) {
   97|  18.6k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
   98|       |
   99|  18.6k|    if (size > mem->size - mem->position)
  ------------------
  |  Branch (99:9): [True: 290, False: 18.3k]
  ------------------
  100|    290|        size = mem->size - mem->position;
  101|  18.6k|    if (mem->position + size > mem->limit)
  ------------------
  |  Branch (101:9): [True: 0, False: 18.6k]
  ------------------
  102|      0|        size = mem->limit - mem->position;
  103|       |
  104|  18.6k|    if (size <= 0)
  ------------------
  |  Branch (104:9): [True: 288, False: 18.3k]
  ------------------
  105|    288|        return 0;
  106|       |
  107|  18.3k|    memcpy(buf, mem->buffer + mem->position, size);
  108|  18.3k|    mem->position += size;
  109|       |
  110|  18.3k|    return size;
  111|  18.6k|}
mz_stream_mem_write:
  113|   131k|int32_t mz_stream_mem_write(void *stream, const void *buf, int32_t size) {
  114|   131k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  115|   131k|    int32_t new_size = 0;
  116|   131k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|   131k|#define MZ_OK             (0)  /* zlib */
  ------------------
  117|       |
  118|   131k|    if (!size)
  ------------------
  |  Branch (118:9): [True: 0, False: 131k]
  ------------------
  119|      0|        return size;
  120|       |
  121|   131k|    if (size > mem->size - mem->position) {
  ------------------
  |  Branch (121:9): [True: 3.53k, False: 127k]
  ------------------
  122|  3.53k|        if (mem->mode & MZ_OPEN_MODE_CREATE) {
  ------------------
  |  |   54|  3.53k|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
  |  Branch (122:13): [True: 3.53k, False: 0]
  ------------------
  123|  3.53k|            new_size = mem->size;
  124|  3.53k|            if (size < mem->grow_size)
  ------------------
  |  Branch (124:17): [True: 29, False: 3.50k]
  ------------------
  125|     29|                new_size += mem->grow_size;
  126|  3.50k|            else
  127|  3.50k|                new_size += size;
  128|       |
  129|  3.53k|            err = mz_stream_mem_set_size(stream, new_size);
  130|  3.53k|            if (err != MZ_OK)
  ------------------
  |  |   21|  3.53k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (130:17): [True: 0, False: 3.53k]
  ------------------
  131|      0|                return err;
  132|  3.53k|        } else {
  133|      0|            size = mem->size - mem->position;
  134|      0|        }
  135|  3.53k|    }
  136|       |
  137|   131k|    memcpy(mem->buffer + mem->position, buf, size);
  138|       |
  139|   131k|    mem->position += size;
  140|   131k|    if (mem->position > mem->limit)
  ------------------
  |  Branch (140:9): [True: 131k, False: 0]
  ------------------
  141|   131k|        mem->limit = mem->position;
  142|       |
  143|   131k|    return size;
  144|   131k|}
mz_stream_mem_tell:
  146|  19.6k|int64_t mz_stream_mem_tell(void *stream) {
  147|  19.6k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  148|  19.6k|    return mem->position;
  149|  19.6k|}
mz_stream_mem_seek:
  151|  7.41k|int32_t mz_stream_mem_seek(void *stream, int64_t offset, int32_t origin) {
  152|  7.41k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  153|  7.41k|    int64_t new_pos = 0;
  154|  7.41k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  7.41k|#define MZ_OK             (0)  /* zlib */
  ------------------
  155|       |
  156|  7.41k|    switch (origin) {
  157|      0|    case MZ_SEEK_CUR:
  ------------------
  |  |   60|      0|#define MZ_SEEK_CUR (1)
  ------------------
  |  Branch (157:5): [True: 0, False: 7.41k]
  ------------------
  158|      0|        new_pos = mem->position + offset;
  159|      0|        break;
  160|  2.47k|    case MZ_SEEK_END:
  ------------------
  |  |   61|  2.47k|#define MZ_SEEK_END (2)
  ------------------
  |  Branch (160:5): [True: 2.47k, False: 4.94k]
  ------------------
  161|  2.47k|        new_pos = mem->limit + offset;
  162|  2.47k|        break;
  163|  4.94k|    case MZ_SEEK_SET:
  ------------------
  |  |   59|  4.94k|#define MZ_SEEK_SET (0)
  ------------------
  |  Branch (163:5): [True: 4.94k, False: 2.47k]
  ------------------
  164|  4.94k|        new_pos = offset;
  165|  4.94k|        break;
  166|      0|    default:
  ------------------
  |  Branch (166:5): [True: 0, False: 7.41k]
  ------------------
  167|      0|        return MZ_SEEK_ERROR;
  ------------------
  |  |   42|      0|#define MZ_SEEK_ERROR     (-113)
  ------------------
  168|  7.41k|    }
  169|       |
  170|       |    // While `malloc` accepts a size_t, mz_stream_mem_s.size only supports an int32_t
  171|  7.41k|    if (new_pos < 0 || new_pos > INT32_MAX) {
  ------------------
  |  Branch (171:9): [True: 0, False: 7.41k]
  |  Branch (171:24): [True: 0, False: 7.41k]
  ------------------
  172|      0|        return MZ_SEEK_ERROR;
  ------------------
  |  |   42|      0|#define MZ_SEEK_ERROR     (-113)
  ------------------
  173|      0|    }
  174|       |
  175|  7.41k|    if (new_pos > mem->size) {
  ------------------
  |  Branch (175:9): [True: 0, False: 7.41k]
  ------------------
  176|      0|        if ((mem->mode & MZ_OPEN_MODE_CREATE) == 0)
  ------------------
  |  |   54|      0|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
  |  Branch (176:13): [True: 0, False: 0]
  ------------------
  177|      0|            return MZ_SEEK_ERROR;
  ------------------
  |  |   42|      0|#define MZ_SEEK_ERROR     (-113)
  ------------------
  178|       |
  179|      0|        err = mz_stream_mem_set_size(stream, (int32_t)new_pos);
  180|      0|        if (err != MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (180:13): [True: 0, False: 0]
  ------------------
  181|      0|            return err;
  182|      0|    }
  183|       |
  184|  7.41k|    mem->position = (int32_t)new_pos;
  185|  7.41k|    return MZ_OK;
  ------------------
  |  |   21|  7.41k|#define MZ_OK             (0)  /* zlib */
  ------------------
  186|  7.41k|}
mz_stream_mem_close:
  188|  7.41k|int32_t mz_stream_mem_close(void *stream) {
  189|  7.41k|    MZ_UNUSED(stream);
  ------------------
  |  |  149|  7.41k|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  190|       |
  191|       |    /* We never return errors */
  192|  7.41k|    return MZ_OK;
  ------------------
  |  |   21|  7.41k|#define MZ_OK             (0)  /* zlib */
  ------------------
  193|  7.41k|}
mz_stream_mem_error:
  195|    290|int32_t mz_stream_mem_error(void *stream) {
  196|    290|    MZ_UNUSED(stream);
  ------------------
  |  |  149|    290|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  197|       |
  198|       |    /* We never return errors */
  199|    290|    return MZ_OK;
  ------------------
  |  |   21|    290|#define MZ_OK             (0)  /* zlib */
  ------------------
  200|    290|}
mz_stream_mem_set_buffer:
  202|  2.47k|void mz_stream_mem_set_buffer(void *stream, void *buf, int32_t size) {
  203|  2.47k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  204|  2.47k|    mem->buffer = (uint8_t *)buf;
  205|  2.47k|    mem->size = size;
  206|  2.47k|    mem->limit = size;
  207|  2.47k|}
mz_stream_mem_get_buffer_at:
  213|  12.2k|int32_t mz_stream_mem_get_buffer_at(void *stream, int64_t position, const void **buf) {
  214|  12.2k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  215|  12.2k|    if (!buf || position < 0 || !mem->buffer || mem->size < position)
  ------------------
  |  Branch (215:9): [True: 0, False: 12.2k]
  |  Branch (215:17): [True: 0, False: 12.2k]
  |  Branch (215:33): [True: 0, False: 12.2k]
  |  Branch (215:49): [True: 0, False: 12.2k]
  ------------------
  216|      0|        return MZ_SEEK_ERROR;
  ------------------
  |  |   42|      0|#define MZ_SEEK_ERROR     (-113)
  ------------------
  217|  12.2k|    *buf = mem->buffer + position;
  218|  12.2k|    return MZ_OK;
  ------------------
  |  |   21|  12.2k|#define MZ_OK             (0)  /* zlib */
  ------------------
  219|  12.2k|}
mz_stream_mem_get_buffer_at_current:
  221|  2.34k|int32_t mz_stream_mem_get_buffer_at_current(void *stream, const void **buf) {
  222|  2.34k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  223|  2.34k|    return mz_stream_mem_get_buffer_at(stream, mem->position, buf);
  224|  2.34k|}
mz_stream_mem_get_buffer_length:
  226|  2.34k|void mz_stream_mem_get_buffer_length(void *stream, int32_t *length) {
  227|  2.34k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  228|  2.34k|    *length = mem->limit;
  229|  2.34k|}
mz_stream_mem_create:
  241|  12.3k|void *mz_stream_mem_create(void) {
  242|  12.3k|    mz_stream_mem *mem = (mz_stream_mem *)calloc(1, sizeof(mz_stream_mem));
  243|  12.3k|    if (mem) {
  ------------------
  |  Branch (243:9): [True: 12.3k, False: 0]
  ------------------
  244|  12.3k|        mem->stream.vtbl = &mz_stream_mem_vtbl;
  245|  12.3k|        mem->grow_size = 4096;
  246|  12.3k|    }
  247|  12.3k|    return mem;
  248|  12.3k|}
mz_stream_mem_delete:
  250|  12.3k|void mz_stream_mem_delete(void **stream) {
  251|  12.3k|    mz_stream_mem *mem = NULL;
  252|  12.3k|    if (!stream)
  ------------------
  |  Branch (252:9): [True: 0, False: 12.3k]
  ------------------
  253|      0|        return;
  254|  12.3k|    mem = (mz_stream_mem *)*stream;
  255|  12.3k|    if (mem) {
  ------------------
  |  Branch (255:9): [True: 12.3k, False: 0]
  ------------------
  256|  12.3k|        if ((mem->mode & MZ_OPEN_MODE_CREATE) && (mem->buffer))
  ------------------
  |  |   54|  12.3k|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
  |  Branch (256:13): [True: 9.88k, False: 2.47k]
  |  Branch (256:50): [True: 9.88k, False: 0]
  ------------------
  257|  9.88k|            free(mem->buffer);
  258|  12.3k|        free(mem);
  259|  12.3k|    }
  260|       |    *stream = NULL;
  261|  12.3k|}
mz_strm_mem.c:mz_stream_mem_set_size:
   52|  13.4k|static int32_t mz_stream_mem_set_size(void *stream, int32_t size) {
   53|  13.4k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
   54|  13.4k|    int32_t new_size = size;
   55|  13.4k|    uint8_t *new_buf = NULL;
   56|       |
   57|  13.4k|    new_buf = (uint8_t *)malloc((uint32_t)new_size);
   58|  13.4k|    if (!new_buf)
  ------------------
  |  Branch (58:9): [True: 0, False: 13.4k]
  ------------------
   59|      0|        return MZ_BUF_ERROR;
  ------------------
  |  |   25|      0|#define MZ_BUF_ERROR      (-5) /* zlib */
  ------------------
   60|       |
   61|  13.4k|    if (mem->buffer) {
  ------------------
  |  Branch (61:9): [True: 3.53k, False: 9.88k]
  ------------------
   62|  3.53k|        memcpy(new_buf, mem->buffer, mem->size);
   63|  3.53k|        free(mem->buffer);
   64|  3.53k|    }
   65|       |
   66|  13.4k|    mem->buffer = new_buf;
   67|  13.4k|    mem->size = new_size;
   68|  13.4k|    return MZ_OK;
  ------------------
  |  |   21|  13.4k|#define MZ_OK             (0)  /* zlib */
  ------------------
   69|  13.4k|}

mz_stream_pkcrypt_open:
  106|    250|int32_t mz_stream_pkcrypt_open(void *stream, const char *path, int32_t mode) {
  107|    250|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  108|    250|    uint16_t t = 0;
  109|    250|    int16_t i = 0;
  110|    250|    uint8_t verify1 = 0;
  111|    250|    uint8_t verify2 = 0;
  112|    250|    uint8_t header[MZ_PKCRYPT_HEADER_SIZE];
  113|    250|    const char *password = path;
  114|       |
  115|    250|    pkcrypt->total_in = 0;
  116|    250|    pkcrypt->total_out = 0;
  117|    250|    pkcrypt->initialized = 0;
  118|       |
  119|    250|    if (mz_stream_is_open(pkcrypt->stream.base) != MZ_OK)
  ------------------
  |  |   21|    250|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (119:9): [True: 0, False: 250]
  ------------------
  120|      0|        return MZ_OPEN_ERROR;
  ------------------
  |  |   40|      0|#define MZ_OPEN_ERROR     (-111)
  ------------------
  121|       |
  122|    250|    if (!password)
  ------------------
  |  Branch (122:9): [True: 250, False: 0]
  ------------------
  123|    250|        password = pkcrypt->password;
  124|    250|    if (!password)
  ------------------
  |  Branch (124:9): [True: 0, False: 250]
  ------------------
  125|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  126|       |
  127|    250|    mz_stream_pkcrypt_init_keys(stream, password);
  128|       |
  129|    250|    if (mode & MZ_OPEN_MODE_WRITE) {
  ------------------
  |  |   51|    250|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (129:9): [True: 250, False: 0]
  ------------------
  130|       |        /* First generate RAND_HEAD_LEN - 2 random bytes. */
  131|    250|        mz_crypt_rand(header, MZ_PKCRYPT_HEADER_SIZE - 2);
  ------------------
  |  |  112|    250|#define MZ_PKCRYPT_HEADER_SIZE (12)
  ------------------
  132|       |
  133|       |        /* Encrypt random header (last two bytes is high word of crc) */
  134|  2.75k|        for (i = 0; i < MZ_PKCRYPT_HEADER_SIZE - 2; i++)
  ------------------
  |  |  112|  2.75k|#define MZ_PKCRYPT_HEADER_SIZE (12)
  ------------------
  |  Branch (134:21): [True: 2.50k, False: 250]
  ------------------
  135|  2.50k|            header[i] = mz_stream_pkcrypt_encode(stream, header[i], t);
  ------------------
  |  |   60|  2.50k|    (t = mz_stream_pkcrypt_decrypt_byte(strm), mz_stream_pkcrypt_update_keys(strm, (uint8_t)c), (uint8_t)(t ^ (c)))
  ------------------
  136|       |
  137|    250|        header[i++] = mz_stream_pkcrypt_encode(stream, pkcrypt->verify1, t);
  ------------------
  |  |   60|    250|    (t = mz_stream_pkcrypt_decrypt_byte(strm), mz_stream_pkcrypt_update_keys(strm, (uint8_t)c), (uint8_t)(t ^ (c)))
  ------------------
  138|    250|        header[i++] = mz_stream_pkcrypt_encode(stream, pkcrypt->verify2, t);
  ------------------
  |  |   60|    250|    (t = mz_stream_pkcrypt_decrypt_byte(strm), mz_stream_pkcrypt_update_keys(strm, (uint8_t)c), (uint8_t)(t ^ (c)))
  ------------------
  139|       |
  140|    250|        if (mz_stream_write(pkcrypt->stream.base, header, sizeof(header)) != sizeof(header))
  ------------------
  |  Branch (140:13): [True: 0, False: 250]
  ------------------
  141|      0|            return MZ_WRITE_ERROR;
  ------------------
  |  |   45|      0|#define MZ_WRITE_ERROR    (-116)
  ------------------
  142|       |
  143|    250|        pkcrypt->total_out += MZ_PKCRYPT_HEADER_SIZE;
  ------------------
  |  |  112|    250|#define MZ_PKCRYPT_HEADER_SIZE (12)
  ------------------
  144|    250|    } else if (mode & MZ_OPEN_MODE_READ) {
  ------------------
  |  |   50|      0|#define MZ_OPEN_MODE_READ      (0x01)
  ------------------
  |  Branch (144:16): [True: 0, False: 0]
  ------------------
  145|      0|        if (mz_stream_read(pkcrypt->stream.base, header, sizeof(header)) != sizeof(header))
  ------------------
  |  Branch (145:13): [True: 0, False: 0]
  ------------------
  146|      0|            return MZ_READ_ERROR;
  ------------------
  |  |   44|      0|#define MZ_READ_ERROR     (-115)
  ------------------
  147|       |
  148|      0|        for (i = 0; i < MZ_PKCRYPT_HEADER_SIZE - 2; i++)
  ------------------
  |  |  112|      0|#define MZ_PKCRYPT_HEADER_SIZE (12)
  ------------------
  |  Branch (148:21): [True: 0, False: 0]
  ------------------
  149|      0|            header[i] = mz_stream_pkcrypt_decode(stream, header[i]);
  ------------------
  |  |   57|      0|    (mz_stream_pkcrypt_update_keys(strm, c ^= mz_stream_pkcrypt_decrypt_byte(strm)))
  ------------------
  150|       |
  151|      0|        verify1 = mz_stream_pkcrypt_decode(stream, header[i++]);
  ------------------
  |  |   57|      0|    (mz_stream_pkcrypt_update_keys(strm, c ^= mz_stream_pkcrypt_decrypt_byte(strm)))
  ------------------
  152|      0|        verify2 = mz_stream_pkcrypt_decode(stream, header[i++]);
  ------------------
  |  |   57|      0|    (mz_stream_pkcrypt_update_keys(strm, c ^= mz_stream_pkcrypt_decrypt_byte(strm)))
  ------------------
  153|       |
  154|       |        /* PKZIP 2.0 and higher use 1 byte check, older versions used 2 byte check.
  155|       |           See app note section 6.1.6. */
  156|      0|        if (verify2 != pkcrypt->verify2)
  ------------------
  |  Branch (156:13): [True: 0, False: 0]
  ------------------
  157|      0|            return MZ_PASSWORD_ERROR;
  ------------------
  |  |   37|      0|#define MZ_PASSWORD_ERROR (-108)
  ------------------
  158|      0|        if (pkcrypt->verify_version < 2) {
  ------------------
  |  Branch (158:13): [True: 0, False: 0]
  ------------------
  159|      0|            if (verify1 != pkcrypt->verify1)
  ------------------
  |  Branch (159:17): [True: 0, False: 0]
  ------------------
  160|      0|                return MZ_PASSWORD_ERROR;
  ------------------
  |  |   37|      0|#define MZ_PASSWORD_ERROR (-108)
  ------------------
  161|      0|        }
  162|       |
  163|      0|        pkcrypt->total_in += MZ_PKCRYPT_HEADER_SIZE;
  ------------------
  |  |  112|      0|#define MZ_PKCRYPT_HEADER_SIZE (12)
  ------------------
  164|      0|    }
  165|       |
  166|    250|    pkcrypt->initialized = 1;
  167|    250|    return MZ_OK;
  ------------------
  |  |   21|    250|#define MZ_OK             (0)  /* zlib */
  ------------------
  168|    250|}
mz_stream_pkcrypt_is_open:
  170|  1.32k|int32_t mz_stream_pkcrypt_is_open(void *stream) {
  171|  1.32k|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  172|  1.32k|    if (!pkcrypt->initialized)
  ------------------
  |  Branch (172:9): [True: 0, False: 1.32k]
  ------------------
  173|      0|        return MZ_OPEN_ERROR;
  ------------------
  |  |   40|      0|#define MZ_OPEN_ERROR     (-111)
  ------------------
  174|  1.32k|    return MZ_OK;
  ------------------
  |  |   21|  1.32k|#define MZ_OK             (0)  /* zlib */
  ------------------
  175|  1.32k|}
mz_stream_pkcrypt_write:
  198|    910|int32_t mz_stream_pkcrypt_write(void *stream, const void *buf, int32_t size) {
  199|    910|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  200|    910|    const uint8_t *buf_ptr = (const uint8_t *)buf;
  201|    910|    int32_t bytes_to_write = sizeof(pkcrypt->buffer);
  202|    910|    int32_t total_written = 0;
  203|    910|    int32_t written = 0;
  204|    910|    int32_t i = 0;
  205|    910|    uint16_t t = 0;
  206|       |
  207|    910|    if (size < 0)
  ------------------
  |  Branch (207:9): [True: 0, False: 910]
  ------------------
  208|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  209|       |
  210|  1.16k|    do {
  211|  1.16k|        if (bytes_to_write > (size - total_written))
  ------------------
  |  Branch (211:13): [True: 905, False: 259]
  ------------------
  212|    905|            bytes_to_write = (size - total_written);
  213|       |
  214|  31.9M|        for (i = 0; i < bytes_to_write; i += 1) {
  ------------------
  |  Branch (214:21): [True: 31.9M, False: 1.16k]
  ------------------
  215|  31.9M|            pkcrypt->buffer[i] = mz_stream_pkcrypt_encode(stream, *buf_ptr, t);
  ------------------
  |  |   60|  31.9M|    (t = mz_stream_pkcrypt_decrypt_byte(strm), mz_stream_pkcrypt_update_keys(strm, (uint8_t)c), (uint8_t)(t ^ (c)))
  ------------------
  216|  31.9M|            buf_ptr += 1;
  217|  31.9M|        }
  218|       |
  219|  1.16k|        written = mz_stream_write(pkcrypt->stream.base, pkcrypt->buffer, bytes_to_write);
  220|  1.16k|        if (written < 0)
  ------------------
  |  Branch (220:13): [True: 0, False: 1.16k]
  ------------------
  221|      0|            return written;
  222|       |
  223|  1.16k|        total_written += written;
  224|  1.16k|    } while (total_written < size && written > 0);
  ------------------
  |  Branch (224:14): [True: 254, False: 910]
  |  Branch (224:38): [True: 254, False: 0]
  ------------------
  225|       |
  226|    910|    pkcrypt->total_out += total_written;
  227|    910|    return total_written;
  228|    910|}
mz_stream_pkcrypt_close:
  240|    250|int32_t mz_stream_pkcrypt_close(void *stream) {
  241|    250|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  242|    250|    pkcrypt->initialized = 0;
  243|    250|    return MZ_OK;
  ------------------
  |  |   21|    250|#define MZ_OK             (0)  /* zlib */
  ------------------
  244|    250|}
mz_stream_pkcrypt_set_password:
  251|    250|void mz_stream_pkcrypt_set_password(void *stream, const char *password) {
  252|    250|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  253|    250|    pkcrypt->password = password;
  254|    250|}
mz_stream_pkcrypt_set_verify:
  256|    250|void mz_stream_pkcrypt_set_verify(void *stream, uint8_t verify1, uint8_t verify2, uint16_t version) {
  257|    250|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  258|    250|    pkcrypt->verify1 = verify1;
  259|    250|    pkcrypt->verify2 = verify2;
  260|    250|    pkcrypt->verify_version = version;
  261|    250|}
mz_stream_pkcrypt_get_prop_int64:
  270|    250|int32_t mz_stream_pkcrypt_get_prop_int64(void *stream, int32_t prop, int64_t *value) {
  271|    250|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  272|    250|    switch (prop) {
  273|      0|    case MZ_STREAM_PROP_TOTAL_IN:
  ------------------
  |  |   20|      0|#define MZ_STREAM_PROP_TOTAL_IN         (1)
  ------------------
  |  Branch (273:5): [True: 0, False: 250]
  ------------------
  274|      0|        *value = pkcrypt->total_in;
  275|      0|        break;
  276|    250|    case MZ_STREAM_PROP_TOTAL_OUT:
  ------------------
  |  |   22|    250|#define MZ_STREAM_PROP_TOTAL_OUT        (3)
  ------------------
  |  Branch (276:5): [True: 250, False: 0]
  ------------------
  277|    250|        *value = pkcrypt->total_out;
  278|    250|        break;
  279|      0|    case MZ_STREAM_PROP_TOTAL_IN_MAX:
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX     (2)
  ------------------
  |  Branch (279:5): [True: 0, False: 250]
  ------------------
  280|      0|        *value = pkcrypt->max_total_in;
  281|      0|        break;
  282|      0|    case MZ_STREAM_PROP_HEADER_SIZE:
  ------------------
  |  |   24|      0|#define MZ_STREAM_PROP_HEADER_SIZE      (5)
  ------------------
  |  Branch (282:5): [True: 0, False: 250]
  ------------------
  283|      0|        *value = MZ_PKCRYPT_HEADER_SIZE;
  ------------------
  |  |  112|      0|#define MZ_PKCRYPT_HEADER_SIZE (12)
  ------------------
  284|      0|        break;
  285|      0|    case MZ_STREAM_PROP_FOOTER_SIZE:
  ------------------
  |  |   25|      0|#define MZ_STREAM_PROP_FOOTER_SIZE      (6)
  ------------------
  |  Branch (285:5): [True: 0, False: 250]
  ------------------
  286|      0|        *value = 0;
  287|      0|        break;
  288|      0|    default:
  ------------------
  |  Branch (288:5): [True: 0, False: 250]
  ------------------
  289|      0|        return MZ_EXIST_ERROR;
  ------------------
  |  |   36|      0|#define MZ_EXIST_ERROR    (-107)
  ------------------
  290|    250|    }
  291|    250|    return MZ_OK;
  ------------------
  |  |   21|    250|#define MZ_OK             (0)  /* zlib */
  ------------------
  292|    250|}
mz_stream_pkcrypt_create:
  306|    250|void *mz_stream_pkcrypt_create(void) {
  307|    250|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)calloc(1, sizeof(mz_stream_pkcrypt));
  308|    250|    if (pkcrypt)
  ------------------
  |  Branch (308:9): [True: 250, False: 0]
  ------------------
  309|    250|        pkcrypt->stream.vtbl = &mz_stream_pkcrypt_vtbl;
  310|    250|    return pkcrypt;
  311|    250|}
mz_stream_pkcrypt_delete:
  313|    250|void mz_stream_pkcrypt_delete(void **stream) {
  314|    250|    mz_stream_pkcrypt *pkcrypt = NULL;
  315|    250|    if (!stream)
  ------------------
  |  Branch (315:9): [True: 0, False: 250]
  ------------------
  316|      0|        return;
  317|    250|    pkcrypt = (mz_stream_pkcrypt *)*stream;
  318|    250|    free(pkcrypt);
  319|       |    *stream = NULL;
  320|    250|}
mz_strm_pkcrypt.c:mz_stream_pkcrypt_init_keys:
   91|    250|static void mz_stream_pkcrypt_init_keys(void *stream, const char *password) {
   92|    250|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
   93|       |
   94|    250|    pkcrypt->keys[0] = 305419896L;
   95|    250|    pkcrypt->keys[1] = 591751049L;
   96|    250|    pkcrypt->keys[2] = 878082192L;
   97|       |
   98|  2.00k|    while (*password != 0) {
  ------------------
  |  Branch (98:12): [True: 1.75k, False: 250]
  ------------------
   99|  1.75k|        mz_stream_pkcrypt_update_keys(stream, (uint8_t)*password);
  100|  1.75k|        password += 1;
  101|  1.75k|    }
  102|    250|}
mz_strm_pkcrypt.c:mz_stream_pkcrypt_decrypt_byte:
   64|  31.9M|static uint8_t mz_stream_pkcrypt_decrypt_byte(void *stream) {
   65|  31.9M|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
   66|       |
   67|  31.9M|    unsigned temp; /* POTENTIAL BUG:  temp*(temp^1) may overflow in an */
   68|       |                   /* unpredictable manner on 16-bit systems; not a problem */
   69|       |                   /* with any known compiler so far, though. */
   70|       |
   71|  31.9M|    temp = pkcrypt->keys[2] | 2;
   72|  31.9M|    return (uint8_t)(((temp * (temp ^ 1)) >> 8) & 0xff);
   73|  31.9M|}
mz_strm_pkcrypt.c:mz_stream_pkcrypt_update_keys:
   75|  31.9M|static uint8_t mz_stream_pkcrypt_update_keys(void *stream, uint8_t c) {
   76|  31.9M|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
   77|  31.9M|    uint8_t buf = c;
   78|       |
   79|  31.9M|    pkcrypt->keys[0] = (uint32_t)~mz_crypt_crc32_update(~pkcrypt->keys[0], &buf, 1);
   80|       |
   81|  31.9M|    pkcrypt->keys[1] += pkcrypt->keys[0] & 0xff;
   82|  31.9M|    pkcrypt->keys[1] *= 134775813L;
   83|  31.9M|    pkcrypt->keys[1] += 1;
   84|       |
   85|  31.9M|    buf = (uint8_t)(pkcrypt->keys[1] >> 24);
   86|  31.9M|    pkcrypt->keys[2] = (uint32_t)~mz_crypt_crc32_update(~pkcrypt->keys[2], &buf, 1);
   87|       |
   88|  31.9M|    return (uint8_t)c;
   89|  31.9M|}

mz_stream_ppmd_open:
  181|  2.07k|int32_t mz_stream_ppmd_open(void *stream, const char *path, int32_t mode) {
  182|  2.07k|    mz_stream_ppmd *ppmd = (mz_stream_ppmd *)stream;
  183|       |
  184|  2.07k|    MZ_UNUSED(path);
  ------------------
  |  |  149|  2.07k|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  185|       |
  186|  2.07k|    Ppmd8_Construct(&ppmd->ppmd8);
  187|       |
  188|  2.07k|    if (mode & MZ_OPEN_MODE_WRITE) {
  ------------------
  |  |   51|  2.07k|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (188:9): [True: 2.07k, False: 0]
  ------------------
  189|       |#ifdef MZ_ZIP_NO_COMPRESSION
  190|       |        MZ_UNUSED(stream);
  191|       |        return MZ_SUPPORT_ERROR;
  192|       |#else
  193|       |        /* PPMD8_MIN_ORDER (= 2) <= order <= PPMD8_MAX_ORDER (= 16)
  194|       |         * 2MB (= 2^ 1) <= memSize <= 128MB (= 2^ 7)   (M = 2^ 20)
  195|       |         * restor = 0 (PPMD8_RESTORE_METHOD_RESTART),
  196|       |         *          1 (PPMD8_RESTORE_METHOD_CUT_OFF)
  197|       |         *
  198|       |         * Currently using 7-Zip-compatible values:
  199|       |         *    order = 3 + level
  200|       |         *    memory size = 2^ (level- 1) (MB)  (level 9 treated as level 8.)
  201|       |         *    restoration method = 0 for level <= 6, 1 for level >= 7.
  202|       |         *
  203|       |         */
  204|       |
  205|       |        /* PPMd parameters. */
  206|  2.07k|        unsigned order = ppmd->preset; /* 2, 3, ..., 16. */
  207|  2.07k|        uint32_t mem_size;
  208|  2.07k|        unsigned restor;
  209|  2.07k|        uint16_t ppmd_param_word;
  210|       |
  211|  2.07k|        if (order < PPMD8_MIN_ORDER || order > PPMD8_MAX_ORDER)
  ------------------
  |  |   14|  4.14k|#define PPMD8_MIN_ORDER 2
  ------------------
                      if (order < PPMD8_MIN_ORDER || order > PPMD8_MAX_ORDER)
  ------------------
  |  |   15|  2.07k|#define PPMD8_MAX_ORDER 16
  ------------------
  |  Branch (211:13): [True: 1, False: 2.07k]
  |  Branch (211:40): [True: 47, False: 2.02k]
  ------------------
  212|     48|            return MZ_OPEN_ERROR;
  ------------------
  |  |   40|     48|#define MZ_OPEN_ERROR     (-111)
  ------------------
  213|       |
  214|  2.02k|        mz_setup_buffered_writer(ppmd);
  215|       |
  216|  2.02k|        mem_size = 1 << ((order < 8 ? order : 8) - 1); /* 2MB, 4MB, ..., 128MB. */
  ------------------
  |  Branch (216:27): [True: 903, False: 1.12k]
  ------------------
  217|       |
  218|  2.02k|        restor = (order <= 6 ? 0 : 1);
  ------------------
  |  Branch (218:19): [True: 889, False: 1.13k]
  ------------------
  219|       |
  220|  2.02k|        mem_size <<= 20; /* Convert B to MB. */
  221|       |
  222|  2.02k|        if (!Ppmd8_Alloc(&ppmd->ppmd8, mem_size, &ppmd->allocator)) {
  ------------------
  |  Branch (222:13): [True: 0, False: 2.02k]
  ------------------
  223|      0|            return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
  224|      0|        }
  225|       |
  226|  2.02k|        Ppmd8_Init_RangeEnc(&ppmd->ppmd8);
  ------------------
  |  |  174|  2.02k|#define Ppmd8_Init_RangeEnc(p) { (p)->Low = 0; (p)->Range = 0xFFFFFFFF; }
  ------------------
  227|  2.02k|        Ppmd8_Init(&ppmd->ppmd8, order, restor);
  228|       |
  229|       |        /* wPPMd = (Model order - 1) +
  230|       |         *         ((Sub-allocator size - 1) << 4) +
  231|       |         *         (Model restoration method << 12)
  232|       |         *
  233|       |         *  15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
  234|       |         *  Mdl_Res_Mth ___Sub-allocator_size-1 Mdl_Order-1
  235|       |         */
  236|       |
  237|       |        /* Form the PPMd properties word.  Put out the bytes. */
  238|  2.02k|        ppmd_param_word = ((order - 1) & 0xf) + ((((mem_size >> 20) - 1) & 0xff) << 4) + ((restor & 0xf) << 12);
  239|       |
  240|       |        // write header bytes directly to output buffer, bypassing the compression code
  241|       |        // These bytes will be included in the compressed size stored in the zip metadata.
  242|       |
  243|  2.02k|        ((uint8_t *)ppmd->out.dst)[0] = (uint8_t)(ppmd_param_word & 0xff);
  244|  2.02k|        ((uint8_t *)ppmd->out.dst)[1] = (uint8_t)(ppmd_param_word >> 8);
  245|  2.02k|        ppmd->out.pos += 2;
  246|  2.02k|        mz_stream_ppmd_flush(ppmd);
  247|  2.02k|#endif
  248|  2.02k|    } else if (mode & MZ_OPEN_MODE_READ) {
  ------------------
  |  |   50|      0|#define MZ_OPEN_MODE_READ      (0x01)
  ------------------
  |  Branch (248:16): [True: 0, False: 0]
  ------------------
  249|       |#ifdef MZ_ZIP_NO_DECOMPRESSION
  250|       |        MZ_UNUSED(stream);
  251|       |        return MZ_SUPPORT_ERROR;
  252|       |#else
  253|       |
  254|      0|        uint8_t ppmd_props[2];   /* PPMd properties. */
  255|      0|        uint16_t ppmd_prop_word; /* PPMd properties. */
  256|       |
  257|       |        /* Initialize the 7-Zip I/O structure. */
  258|      0|        mz_setup_buffered_reader(ppmd);
  259|       |
  260|       |        /* Read & parse the 2 PPMD header bytes into a 16-bit word */
  261|      0|        if (mz_stream_read_uint8(ppmd->stream.base, &ppmd_props[0]) != MZ_OK ||
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (261:13): [True: 0, False: 0]
  ------------------
  262|      0|            mz_stream_read_uint8(ppmd->stream.base, &ppmd_props[1]) != MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (262:13): [True: 0, False: 0]
  ------------------
  263|      0|            return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  264|      0|        ppmd_prop_word = ppmd_props[0] | (ppmd_props[1] << 8);
  265|      0|        ppmd->total_in += 2;
  266|       |
  267|       |        /* wPPMd = (Model order - 1) +
  268|       |         *         ((Sub-allocator size - 1) << 4) +
  269|       |         *         (Model restoration method << 12)
  270|       |         *
  271|       |         *  15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
  272|       |         *  Mdl_Res_Mth ___Sub-allocator_size-1 Mdl_Order-1
  273|       |         */
  274|      0|        unsigned order = (ppmd_prop_word & 0xf) + 1;
  275|      0|        uint32_t mem_size = ((ppmd_prop_word >> 4) & 0xff) + 1;
  276|      0|        unsigned restor = (ppmd_prop_word >> 12);
  277|       |
  278|       |        /* Convert archive MB value into raw byte value. */
  279|      0|        mem_size <<= 20;
  280|       |
  281|      0|        if ((order < PPMD8_MIN_ORDER) || (order > PPMD8_MAX_ORDER))
  ------------------
  |  |   14|      0|#define PPMD8_MIN_ORDER 2
  ------------------
                      if ((order < PPMD8_MIN_ORDER) || (order > PPMD8_MAX_ORDER))
  ------------------
  |  |   15|      0|#define PPMD8_MAX_ORDER 16
  ------------------
  |  Branch (281:13): [True: 0, False: 0]
  |  Branch (281:42): [True: 0, False: 0]
  ------------------
  282|      0|            return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  283|       |
  284|      0|        if (!Ppmd8_Alloc(&ppmd->ppmd8, mem_size, &ppmd->allocator))
  ------------------
  |  Branch (284:13): [True: 0, False: 0]
  ------------------
  285|      0|            return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  286|       |
  287|      0|        if (!Ppmd8_Init_RangeDec(&ppmd->ppmd8))
  ------------------
  |  Branch (287:13): [True: 0, False: 0]
  ------------------
  288|      0|            return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  289|       |
  290|      0|        Ppmd8_Init(&ppmd->ppmd8, order, restor);
  291|      0|#endif
  292|      0|    }
  293|       |
  294|  2.02k|    ppmd->initialized = 1;
  295|  2.02k|    ppmd->mode = mode;
  296|       |
  297|  2.02k|    return MZ_OK;
  ------------------
  |  |   21|  2.02k|#define MZ_OK             (0)  /* zlib */
  ------------------
  298|  2.07k|}
mz_stream_ppmd_is_open:
  300|  4.04k|int32_t mz_stream_ppmd_is_open(void *stream) {
  301|  4.04k|    mz_stream_ppmd *ppmd = (mz_stream_ppmd *)stream;
  302|  4.04k|    if (ppmd->initialized != 1)
  ------------------
  |  Branch (302:9): [True: 0, False: 4.04k]
  ------------------
  303|      0|        return MZ_OPEN_ERROR;
  ------------------
  |  |   40|      0|#define MZ_OPEN_ERROR     (-111)
  ------------------
  304|  4.04k|    return MZ_OK;
  ------------------
  |  |   21|  4.04k|#define MZ_OK             (0)  /* zlib */
  ------------------
  305|  4.04k|}
mz_stream_ppmd_write:
  359|  2.01k|int32_t mz_stream_ppmd_write(void *stream, const void *buf, int32_t size) {
  360|       |#ifdef MZ_ZIP_NO_COMPRESSION
  361|       |    MZ_UNUSED(stream);
  362|       |    MZ_UNUSED(buf);
  363|       |    MZ_UNUSED(size);
  364|       |    return MZ_SUPPORT_ERROR;
  365|       |#else
  366|  2.01k|    mz_stream_ppmd *ppmd = (mz_stream_ppmd *)stream;
  367|  2.01k|    const uint8_t *buf_ptr = (const uint8_t *)buf;
  368|  2.01k|    int32_t bytes_written = 0;
  369|       |
  370|  2.01k|    mz_setup_buffered_writer(ppmd);
  371|   108M|    for (bytes_written = 0; bytes_written < size; bytes_written++) {
  ------------------
  |  Branch (371:29): [True: 108M, False: 2.01k]
  ------------------
  372|   108M|        if (ppmd->out.pos == ppmd->out.size) {
  ------------------
  |  Branch (372:13): [True: 2.54k, False: 108M]
  ------------------
  373|  2.54k|            if (mz_stream_ppmd_flush(ppmd) != MZ_OK)
  ------------------
  |  |   21|  2.54k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (373:17): [True: 0, False: 2.54k]
  ------------------
  374|      0|                return MZ_WRITE_ERROR;
  ------------------
  |  |   45|      0|#define MZ_WRITE_ERROR    (-116)
  ------------------
  375|  2.54k|        }
  376|       |
  377|   108M|        Ppmd8_EncodeSymbol(&ppmd->ppmd8, buf_ptr[bytes_written]);
  378|   108M|    }
  379|  2.01k|    ppmd->total_in += size;
  380|       |
  381|  2.01k|    if (mz_stream_ppmd_flush(stream) != MZ_OK)
  ------------------
  |  |   21|  2.01k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (381:9): [True: 0, False: 2.01k]
  ------------------
  382|      0|        return MZ_WRITE_ERROR;
  ------------------
  |  |   45|      0|#define MZ_WRITE_ERROR    (-116)
  ------------------
  383|       |
  384|  2.01k|    return size;
  385|  2.01k|#endif
  386|  2.01k|}
mz_stream_ppmd_close:
  401|  2.02k|int32_t mz_stream_ppmd_close(void *stream) {
  402|  2.02k|    mz_stream_ppmd *ppmd = (mz_stream_ppmd *)stream;
  403|       |
  404|  2.02k|#ifndef MZ_ZIP_NO_COMPRESSION
  405|  2.02k|    if (ppmd->mode & MZ_OPEN_MODE_WRITE) {
  ------------------
  |  |   51|  2.02k|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (405:9): [True: 2.02k, False: 0]
  ------------------
  406|  2.02k|        mz_setup_buffered_writer(ppmd);
  407|       |
  408|       |        /* Encode end marker */
  409|  2.02k|        Ppmd8_EncodeSymbol(&ppmd->ppmd8, -1);
  410|       |
  411|  2.02k|        Ppmd8_Flush_RangeEnc(&ppmd->ppmd8);
  412|       |
  413|       |        /* Flush any remaining buffered output */
  414|  2.02k|        mz_stream_ppmd_flush(stream);
  415|  2.02k|    }
  416|  2.02k|#endif
  417|       |
  418|  2.02k|    Ppmd8_Free(&ppmd->ppmd8, &ppmd->allocator);
  419|       |
  420|  2.02k|    ppmd->initialized = 0;
  421|       |
  422|  2.02k|    return MZ_OK;
  ------------------
  |  |   21|  2.02k|#define MZ_OK             (0)  /* zlib */
  ------------------
  423|  2.02k|}
mz_stream_ppmd_get_prop_int64:
  430|  4.05k|int32_t mz_stream_ppmd_get_prop_int64(void *stream, int32_t prop, int64_t *value) {
  431|  4.05k|    mz_stream_ppmd *ppmd = (mz_stream_ppmd *)stream;
  432|       |
  433|  4.05k|    switch (prop) {
  ------------------
  |  Branch (433:13): [True: 4.05k, False: 0]
  ------------------
  434|  2.02k|    case MZ_STREAM_PROP_TOTAL_IN:
  ------------------
  |  |   20|  2.02k|#define MZ_STREAM_PROP_TOTAL_IN         (1)
  ------------------
  |  Branch (434:5): [True: 2.02k, False: 2.02k]
  ------------------
  435|  2.02k|        *value = ppmd->total_in;
  436|  2.02k|        return MZ_OK;
  ------------------
  |  |   21|  2.02k|#define MZ_OK             (0)  /* zlib */
  ------------------
  437|  2.02k|    case MZ_STREAM_PROP_TOTAL_OUT:
  ------------------
  |  |   22|  2.02k|#define MZ_STREAM_PROP_TOTAL_OUT        (3)
  ------------------
  |  Branch (437:5): [True: 2.02k, False: 2.02k]
  ------------------
  438|  2.02k|        *value = ppmd->total_out;
  439|  2.02k|        return MZ_OK;
  ------------------
  |  |   21|  2.02k|#define MZ_OK             (0)  /* zlib */
  ------------------
  440|      0|    case MZ_STREAM_PROP_TOTAL_IN_MAX:
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX     (2)
  ------------------
  |  Branch (440:5): [True: 0, False: 4.05k]
  ------------------
  441|      0|        *value = ppmd->max_total_in;
  442|      0|        return MZ_OK;
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  443|  4.05k|    }
  444|       |
  445|      0|    return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  446|  4.05k|}
mz_stream_ppmd_set_prop_int64:
  448|  4.14k|int32_t mz_stream_ppmd_set_prop_int64(void *stream, int32_t prop, int64_t value) {
  449|  4.14k|    mz_stream_ppmd *ppmd = (mz_stream_ppmd *)stream;
  450|       |
  451|  4.14k|    switch (prop) {
  ------------------
  |  Branch (451:13): [True: 4.14k, False: 0]
  ------------------
  452|  2.07k|    case MZ_STREAM_PROP_TOTAL_IN_MAX:
  ------------------
  |  |   21|  2.07k|#define MZ_STREAM_PROP_TOTAL_IN_MAX     (2)
  ------------------
  |  Branch (452:5): [True: 2.07k, False: 2.07k]
  ------------------
  453|  2.07k|        ppmd->max_total_in = value;
  454|  2.07k|        return MZ_OK;
  ------------------
  |  |   21|  2.07k|#define MZ_OK             (0)  /* zlib */
  ------------------
  455|  2.07k|    case MZ_STREAM_PROP_COMPRESS_LEVEL:
  ------------------
  |  |   28|  2.07k|#define MZ_STREAM_PROP_COMPRESS_LEVEL   (9)
  ------------------
  |  Branch (455:5): [True: 2.07k, False: 2.07k]
  ------------------
  456|  2.07k|        if (value == MZ_COMPRESS_LEVEL_DEFAULT)
  ------------------
  |  |   73|  2.07k|#define MZ_COMPRESS_LEVEL_DEFAULT  (-1)
  ------------------
  |  Branch (456:13): [True: 1.07k, False: 996]
  ------------------
  457|  1.07k|            ppmd->preset = PPMD_PRESET_DEFAULT;
  ------------------
  |  |   29|  1.07k|#define PPMD_PRESET_DEFAULT 9  // Should match default in 7-Zip
  ------------------
  458|    996|        else
  459|    996|            ppmd->preset = (int16_t)value;
  460|  2.07k|        return MZ_OK;
  ------------------
  |  |   21|  2.07k|#define MZ_OK             (0)  /* zlib */
  ------------------
  461|  4.14k|    }
  462|       |
  463|      0|    return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  464|  4.14k|}
mz_stream_ppmd_create:
  466|  2.07k|void *mz_stream_ppmd_create(void) {
  467|  2.07k|    mz_stream_ppmd *ppmd = (mz_stream_ppmd *)calloc(1, sizeof(mz_stream_ppmd));
  468|  2.07k|    if (ppmd) {
  ------------------
  |  Branch (468:9): [True: 2.07k, False: 0]
  ------------------
  469|  2.07k|        ppmd->stream.vtbl = &mz_stream_ppmd_vtbl;
  470|  2.07k|        ppmd->allocator.Alloc = mz_ppmd_alloc_func;
  471|  2.07k|        ppmd->allocator.Free = mz_ppmd_free_func;
  472|  2.07k|        ppmd->preset = PPMD_PRESET_DEFAULT;
  ------------------
  |  |   29|  2.07k|#define PPMD_PRESET_DEFAULT 9  // Should match default in 7-Zip
  ------------------
  473|  2.07k|    }
  474|  2.07k|    return ppmd;
  475|  2.07k|}
mz_stream_ppmd_delete:
  477|  2.07k|void mz_stream_ppmd_delete(void **stream) {
  478|  2.07k|    mz_stream_ppmd *ppmd = NULL;
  479|  2.07k|    if (!stream)
  ------------------
  |  Branch (479:9): [True: 0, False: 2.07k]
  ------------------
  480|      0|        return;
  481|  2.07k|    ppmd = (mz_stream_ppmd *)*stream;
  482|  2.07k|    free(ppmd);
  483|       |    *stream = NULL;
  484|  2.07k|}
mz_strm_ppmd.c:mz_setup_buffered_writer:
  134|  6.06k|static void mz_setup_buffered_writer(mz_stream_ppmd *ppmd) {
  135|  6.06k|    ppmd->out.dst = ppmd->buffer;
  136|  6.06k|    ppmd->out.size = sizeof(ppmd->buffer);  // INT16_MAX;
  137|  6.06k|    ppmd->out.pos = 0;
  138|       |
  139|  6.06k|    ppmd->writer.write = writer;
  140|  6.06k|    ppmd->writer.out_buffer = &ppmd->out;
  141|  6.06k|    ppmd->ppmd8.Stream.Out = (IByteOut *)&ppmd->writer;
  142|  6.06k|}
mz_strm_ppmd.c:writer:
  113|  90.7M|static void writer(void *p, Byte b) {
  114|  90.7M|    mz_buffer_writer *buffer_writer = (mz_buffer_writer *)p;
  115|  90.7M|    if (buffer_writer->out_buffer->size == buffer_writer->out_buffer->pos) {
  ------------------
  |  Branch (115:9): [True: 282, False: 90.7M]
  ------------------
  116|    282|        return;
  117|    282|    }
  118|  90.7M|    *((Byte *)buffer_writer->out_buffer->dst + buffer_writer->out_buffer->pos++) = b;
  119|  90.7M|}
mz_strm_ppmd.c:mz_stream_ppmd_flush:
  121|  8.61k|static int32_t mz_stream_ppmd_flush(void *stream) {
  122|  8.61k|    mz_stream_ppmd *ppmd = (mz_stream_ppmd *)stream;
  123|       |
  124|  8.61k|    if (ppmd->out.pos) {
  ------------------
  |  Branch (124:9): [True: 8.56k, False: 44]
  ------------------
  125|  8.56k|        if (mz_stream_write(ppmd->stream.base, ppmd->out.dst, ppmd->out.pos) != ppmd->out.pos)
  ------------------
  |  Branch (125:13): [True: 0, False: 8.56k]
  ------------------
  126|      0|            return MZ_WRITE_ERROR;
  ------------------
  |  |   45|      0|#define MZ_WRITE_ERROR    (-116)
  ------------------
  127|  8.56k|        ppmd->total_out += ppmd->out.pos;
  128|  8.56k|        ppmd->out.pos = 0;
  129|  8.56k|    }
  130|       |
  131|  8.61k|    return MZ_OK;
  ------------------
  |  |   21|  8.61k|#define MZ_OK             (0)  /* zlib */
  ------------------
  132|  8.61k|}
mz_strm_ppmd.c:mz_ppmd_alloc_func:
  100|  2.02k|static void *mz_ppmd_alloc_func(const ISzAlloc *p, size_t size) {
  101|  2.02k|    MZ_UNUSED(p);
  ------------------
  |  |  149|  2.02k|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  102|  2.02k|    return malloc(size);
  103|  2.02k|}
mz_strm_ppmd.c:mz_ppmd_free_func:
  106|  4.05k|static void mz_ppmd_free_func(const ISzAlloc *p, void *address) {
  107|  4.05k|    MZ_UNUSED(p);
  ------------------
  |  |  149|  4.05k|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  108|  4.05k|    free(address);
  109|  4.05k|}

mz_stream_zlib_open:
   65|    137|int32_t mz_stream_zlib_open(void *stream, const char *path, int32_t mode) {
   66|    137|    mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
   67|       |
   68|    137|    MZ_UNUSED(path);
  ------------------
  |  |  149|    137|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
   69|       |
   70|    137|    zlib->zstream.data_type = Z_BINARY;
   71|    137|    zlib->zstream.zalloc = Z_NULL;
   72|    137|    zlib->zstream.zfree = Z_NULL;
   73|    137|    zlib->zstream.opaque = Z_NULL;
   74|    137|    zlib->zstream.total_in = 0;
   75|    137|    zlib->zstream.total_out = 0;
   76|       |
   77|    137|    zlib->total_in = 0;
   78|    137|    zlib->total_out = 0;
   79|       |
   80|    137|    if (mode & MZ_OPEN_MODE_WRITE) {
  ------------------
  |  |   51|    137|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (80:9): [True: 137, False: 0]
  ------------------
   81|       |#ifdef MZ_ZIP_NO_COMPRESSION
   82|       |        return MZ_SUPPORT_ERROR;
   83|       |#else
   84|    137|        zlib->zstream.next_out = zlib->buffer;
   85|    137|        zlib->zstream.avail_out = sizeof(zlib->buffer);
   86|       |
   87|    137|        zlib->error = ZLIB_PREFIX(deflateInit2)(&zlib->zstream, (int8_t)zlib->level, Z_DEFLATED, zlib->window_bits,
  ------------------
  |  |   27|    137|#  define ZLIB_PREFIX(x) x
  |  |  ------------------
  |  |  |  |   87|    137|        zlib->error = ZLIB_PREFIX(deflateInit2)(&zlib->zstream, (int8_t)zlib->level, Z_DEFLATED, zlib->window_bits,
  |  |  ------------------
  ------------------
   88|    137|                                                DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
   89|    137|#endif
   90|    137|    } else if (mode & MZ_OPEN_MODE_READ) {
  ------------------
  |  |   50|      0|#define MZ_OPEN_MODE_READ      (0x01)
  ------------------
  |  Branch (90:16): [True: 0, False: 0]
  ------------------
   91|       |#ifdef MZ_ZIP_NO_DECOMPRESSION
   92|       |        return MZ_SUPPORT_ERROR;
   93|       |#else
   94|      0|        zlib->zstream.next_in = zlib->buffer;
   95|      0|        zlib->zstream.avail_in = 0;
   96|       |
   97|      0|        zlib->error = ZLIB_PREFIX(inflateInit2)(&zlib->zstream, zlib->window_bits);
  ------------------
  |  |   27|      0|#  define ZLIB_PREFIX(x) x
  |  |  ------------------
  |  |  |  |   97|      0|        zlib->error = ZLIB_PREFIX(inflateInit2)(&zlib->zstream, zlib->window_bits);
  |  |  ------------------
  ------------------
   98|      0|#endif
   99|      0|    }
  100|       |
  101|    137|    if (zlib->error != Z_OK)
  ------------------
  |  Branch (101:9): [True: 31, False: 106]
  ------------------
  102|     31|        return MZ_OPEN_ERROR;
  ------------------
  |  |   40|     31|#define MZ_OPEN_ERROR     (-111)
  ------------------
  103|       |
  104|    106|    zlib->initialized = 1;
  105|    106|    zlib->mode = mode;
  106|    106|    return MZ_OK;
  ------------------
  |  |   21|    106|#define MZ_OK             (0)  /* zlib */
  ------------------
  107|    137|}
mz_stream_zlib_is_open:
  109|    153|int32_t mz_stream_zlib_is_open(void *stream) {
  110|    153|    mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
  111|    153|    if (zlib->initialized != 1)
  ------------------
  |  Branch (111:9): [True: 0, False: 153]
  ------------------
  112|      0|        return MZ_OPEN_ERROR;
  ------------------
  |  |   40|      0|#define MZ_OPEN_ERROR     (-111)
  ------------------
  113|    153|    return MZ_OK;
  ------------------
  |  |   21|    153|#define MZ_OK             (0)  /* zlib */
  ------------------
  114|    153|}
mz_stream_zlib_write:
  243|     47|int32_t mz_stream_zlib_write(void *stream, const void *buf, int32_t size) {
  244|       |#ifdef MZ_ZIP_NO_COMPRESSION
  245|       |    MZ_UNUSED(stream);
  246|       |    MZ_UNUSED(buf);
  247|       |    MZ_UNUSED(size);
  248|       |    return MZ_SUPPORT_ERROR;
  249|       |#else
  250|     47|    mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
  251|     47|    int32_t err = MZ_OK;
  ------------------
  |  |   21|     47|#define MZ_OK             (0)  /* zlib */
  ------------------
  252|       |
  253|     47|    zlib->zstream.next_in = (Bytef *)(intptr_t)buf;
  254|     47|    zlib->zstream.avail_in = (uInt)size;
  255|       |
  256|     47|    err = mz_stream_zlib_deflate(stream, Z_NO_FLUSH);
  257|     47|    if (err != MZ_OK) {
  ------------------
  |  |   21|     47|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (257:9): [True: 0, False: 47]
  ------------------
  258|      0|        return err;
  259|      0|    }
  260|       |
  261|     47|    zlib->total_in += size;
  262|     47|    return size;
  263|     47|#endif
  264|     47|}
mz_stream_zlib_close:
  280|    106|int32_t mz_stream_zlib_close(void *stream) {
  281|    106|    mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
  282|       |
  283|    106|    if (zlib->mode & MZ_OPEN_MODE_WRITE) {
  ------------------
  |  |   51|    106|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (283:9): [True: 106, False: 0]
  ------------------
  284|       |#ifdef MZ_ZIP_NO_COMPRESSION
  285|       |        return MZ_SUPPORT_ERROR;
  286|       |#else
  287|    106|        mz_stream_zlib_deflate(stream, Z_FINISH);
  288|    106|        mz_stream_zlib_flush(stream);
  289|       |
  290|    106|        ZLIB_PREFIX(deflateEnd)(&zlib->zstream);
  ------------------
  |  |   27|    106|#  define ZLIB_PREFIX(x) x
  ------------------
  291|    106|#endif
  292|    106|    } else if (zlib->mode & MZ_OPEN_MODE_READ) {
  ------------------
  |  |   50|      0|#define MZ_OPEN_MODE_READ      (0x01)
  ------------------
  |  Branch (292:16): [True: 0, False: 0]
  ------------------
  293|       |#ifdef MZ_ZIP_NO_DECOMPRESSION
  294|       |        return MZ_SUPPORT_ERROR;
  295|       |#else
  296|      0|        ZLIB_PREFIX(inflateEnd)(&zlib->zstream);
  ------------------
  |  |   27|      0|#  define ZLIB_PREFIX(x) x
  ------------------
  297|      0|#endif
  298|      0|    }
  299|       |
  300|    106|    zlib->initialized = 0;
  301|       |
  302|    106|    if (zlib->error != Z_OK)
  ------------------
  |  Branch (302:9): [True: 0, False: 106]
  ------------------
  303|      0|        return MZ_CLOSE_ERROR;
  ------------------
  |  |   41|      0|#define MZ_CLOSE_ERROR    (-112)
  ------------------
  304|    106|    return MZ_OK;
  ------------------
  |  |   21|    106|#define MZ_OK             (0)  /* zlib */
  ------------------
  305|    106|}
mz_stream_zlib_get_prop_int64:
  312|    212|int32_t mz_stream_zlib_get_prop_int64(void *stream, int32_t prop, int64_t *value) {
  313|    212|    mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
  314|    212|    switch (prop) {
  315|    106|    case MZ_STREAM_PROP_TOTAL_IN:
  ------------------
  |  |   20|    106|#define MZ_STREAM_PROP_TOTAL_IN         (1)
  ------------------
  |  Branch (315:5): [True: 106, False: 106]
  ------------------
  316|    106|        *value = zlib->total_in;
  317|    106|        break;
  318|      0|    case MZ_STREAM_PROP_TOTAL_IN_MAX:
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX     (2)
  ------------------
  |  Branch (318:5): [True: 0, False: 212]
  ------------------
  319|      0|        *value = zlib->max_total_in;
  320|      0|        break;
  321|    106|    case MZ_STREAM_PROP_TOTAL_OUT:
  ------------------
  |  |   22|    106|#define MZ_STREAM_PROP_TOTAL_OUT        (3)
  ------------------
  |  Branch (321:5): [True: 106, False: 106]
  ------------------
  322|    106|        *value = zlib->total_out;
  323|    106|        break;
  324|      0|    case MZ_STREAM_PROP_HEADER_SIZE:
  ------------------
  |  |   24|      0|#define MZ_STREAM_PROP_HEADER_SIZE      (5)
  ------------------
  |  Branch (324:5): [True: 0, False: 212]
  ------------------
  325|      0|        *value = 0;
  326|      0|        break;
  327|      0|    case MZ_STREAM_PROP_COMPRESS_WINDOW:
  ------------------
  |  |   30|      0|#define MZ_STREAM_PROP_COMPRESS_WINDOW  (11)
  ------------------
  |  Branch (327:5): [True: 0, False: 212]
  ------------------
  328|      0|        *value = zlib->window_bits;
  329|      0|        break;
  330|      0|    default:
  ------------------
  |  Branch (330:5): [True: 0, False: 212]
  ------------------
  331|      0|        return MZ_EXIST_ERROR;
  ------------------
  |  |   36|      0|#define MZ_EXIST_ERROR    (-107)
  ------------------
  332|    212|    }
  333|    212|    return MZ_OK;
  ------------------
  |  |   21|    212|#define MZ_OK             (0)  /* zlib */
  ------------------
  334|    212|}
mz_stream_zlib_set_prop_int64:
  336|    137|int32_t mz_stream_zlib_set_prop_int64(void *stream, int32_t prop, int64_t value) {
  337|    137|    mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
  338|    137|    switch (prop) {
  339|    137|    case MZ_STREAM_PROP_COMPRESS_LEVEL:
  ------------------
  |  |   28|    137|#define MZ_STREAM_PROP_COMPRESS_LEVEL   (9)
  ------------------
  |  Branch (339:5): [True: 137, False: 0]
  ------------------
  340|    137|        if (value == MZ_COMPRESS_LEVEL_DEFAULT)
  ------------------
  |  |   73|    137|#define MZ_COMPRESS_LEVEL_DEFAULT  (-1)
  ------------------
  |  Branch (340:13): [True: 74, False: 63]
  ------------------
  341|     74|            zlib->level = Z_DEFAULT_COMPRESSION;
  342|     63|        else
  343|     63|            zlib->level = (int16_t)value;
  344|    137|        break;
  345|      0|    case MZ_STREAM_PROP_TOTAL_IN_MAX:
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX     (2)
  ------------------
  |  Branch (345:5): [True: 0, False: 137]
  ------------------
  346|      0|        zlib->max_total_in = value;
  347|      0|        break;
  348|      0|    case MZ_STREAM_PROP_COMPRESS_WINDOW:
  ------------------
  |  |   30|      0|#define MZ_STREAM_PROP_COMPRESS_WINDOW  (11)
  ------------------
  |  Branch (348:5): [True: 0, False: 137]
  ------------------
  349|      0|        zlib->window_bits = (int32_t)value;
  350|      0|        break;
  351|      0|    default:
  ------------------
  |  Branch (351:5): [True: 0, False: 137]
  ------------------
  352|      0|        return MZ_EXIST_ERROR;
  ------------------
  |  |   36|      0|#define MZ_EXIST_ERROR    (-107)
  ------------------
  353|    137|    }
  354|    137|    return MZ_OK;
  ------------------
  |  |   21|    137|#define MZ_OK             (0)  /* zlib */
  ------------------
  355|    137|}
mz_stream_zlib_create:
  357|    137|void *mz_stream_zlib_create(void) {
  358|    137|    mz_stream_zlib *zlib = (mz_stream_zlib *)calloc(1, sizeof(mz_stream_zlib));
  359|    137|    if (zlib) {
  ------------------
  |  Branch (359:9): [True: 137, False: 0]
  ------------------
  360|    137|        zlib->stream.vtbl = &mz_stream_zlib_vtbl;
  361|    137|        zlib->level = Z_DEFAULT_COMPRESSION;
  362|       |        zlib->window_bits = -MAX_WBITS;
  363|    137|    }
  364|    137|    return zlib;
  365|    137|}
mz_stream_zlib_delete:
  367|    137|void mz_stream_zlib_delete(void **stream) {
  368|    137|    mz_stream_zlib *zlib = NULL;
  369|    137|    if (!stream)
  ------------------
  |  Branch (369:9): [True: 0, False: 137]
  ------------------
  370|      0|        return;
  371|    137|    zlib = (mz_stream_zlib *)*stream;
  372|    137|    free(zlib);
  373|       |    *stream = NULL;
  374|    137|}
mz_strm_zlib.c:mz_stream_zlib_deflate:
  203|    153|static int32_t mz_stream_zlib_deflate(void *stream, int flush) {
  204|    153|    mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
  205|    153|    uint64_t total_out_before = 0;
  206|    153|    uint64_t total_out_after = 0;
  207|    153|    int32_t out_bytes = 0;
  208|    153|    int32_t err = Z_OK;
  209|       |
  210|    368|    do {
  211|    368|        if (zlib->zstream.avail_out == 0) {
  ------------------
  |  Branch (211:13): [True: 220, False: 148]
  ------------------
  212|    220|            err = mz_stream_zlib_flush(zlib);
  213|    220|            if (err != MZ_OK)
  ------------------
  |  |   21|    220|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (213:17): [True: 0, False: 220]
  ------------------
  214|      0|                return err;
  215|       |
  216|    220|            zlib->zstream.avail_out = sizeof(zlib->buffer);
  217|    220|            zlib->zstream.next_out = zlib->buffer;
  218|       |
  219|    220|            zlib->buffer_len = 0;
  220|    220|        }
  221|       |
  222|    368|        total_out_before = zlib->zstream.total_out;
  223|    368|        err = ZLIB_PREFIX(deflate)(&zlib->zstream, flush);
  ------------------
  |  |   27|    368|#  define ZLIB_PREFIX(x) x
  ------------------
  224|    368|        total_out_after = zlib->zstream.total_out;
  225|       |
  226|    368|        out_bytes = (uint32_t)(total_out_after - total_out_before);
  227|       |
  228|    368|        zlib->buffer_len += out_bytes;
  229|    368|        zlib->total_out += out_bytes;
  230|       |
  231|    368|        if (err == Z_STREAM_END)
  ------------------
  |  Branch (231:13): [True: 106, False: 262]
  ------------------
  232|    106|            break;
  233|    262|        if (err != Z_OK) {
  ------------------
  |  Branch (233:13): [True: 0, False: 262]
  ------------------
  234|      0|            zlib->error = err;
  235|      0|            return MZ_DATA_ERROR;
  ------------------
  |  |   23|      0|#define MZ_DATA_ERROR     (-3) /* zlib */
  ------------------
  236|      0|        }
  237|    262|    } while ((zlib->zstream.avail_in > 0) || (flush == Z_FINISH && err == Z_OK));
  ------------------
  |  Branch (237:14): [True: 210, False: 52]
  |  Branch (237:47): [True: 5, False: 47]
  |  Branch (237:68): [True: 5, False: 0]
  ------------------
  238|       |
  239|    153|    return MZ_OK;
  ------------------
  |  |   21|    153|#define MZ_OK             (0)  /* zlib */
  ------------------
  240|    153|}
mz_strm_zlib.c:mz_stream_zlib_flush:
  196|    326|static int32_t mz_stream_zlib_flush(void *stream) {
  197|    326|    mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
  198|    326|    if (mz_stream_write(zlib->stream.base, zlib->buffer, zlib->buffer_len) != zlib->buffer_len)
  ------------------
  |  Branch (198:9): [True: 0, False: 326]
  ------------------
  199|      0|        return MZ_WRITE_ERROR;
  ------------------
  |  |   45|      0|#define MZ_WRITE_ERROR    (-116)
  ------------------
  200|    326|    return MZ_OK;
  ------------------
  |  |   21|    326|#define MZ_OK             (0)  /* zlib */
  ------------------
  201|    326|}

mz_zip_create:
 1413|  2.47k|void *mz_zip_create(void) {
 1414|  2.47k|    mz_zip *zip = (mz_zip *)calloc(1, sizeof(mz_zip));
 1415|  2.47k|    if (zip)
  ------------------
  |  Branch (1415:9): [True: 2.47k, False: 0]
  ------------------
 1416|  2.47k|        zip->data_descriptor = 1;
 1417|  2.47k|    return zip;
 1418|  2.47k|}
mz_zip_delete:
 1420|  2.47k|void mz_zip_delete(void **handle) {
 1421|  2.47k|    mz_zip *zip = NULL;
 1422|  2.47k|    if (!handle)
  ------------------
  |  Branch (1422:9): [True: 0, False: 2.47k]
  ------------------
 1423|      0|        return;
 1424|  2.47k|    zip = (mz_zip *)*handle;
 1425|  2.47k|    free(zip);
 1426|       |    *handle = NULL;
 1427|  2.47k|}
mz_zip_open:
 1429|  2.47k|int32_t mz_zip_open(void *handle, void *stream, int32_t mode) {
 1430|  2.47k|    mz_zip *zip = (mz_zip *)handle;
 1431|  2.47k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
 1432|       |
 1433|  2.47k|    if (!zip)
  ------------------
  |  Branch (1433:9): [True: 0, False: 2.47k]
  ------------------
 1434|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1435|       |
 1436|  2.47k|    mz_zip_print("Zip - Open\n");
 1437|       |
 1438|  2.47k|    zip->stream = stream;
 1439|  2.47k|    zip->cd_mem_stream = mz_stream_mem_create();
 1440|  2.47k|    if (!zip->cd_mem_stream)
  ------------------
  |  Branch (1440:9): [True: 0, False: 2.47k]
  ------------------
 1441|      0|        return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1442|       |
 1443|  2.47k|    if (mode & MZ_OPEN_MODE_WRITE) {
  ------------------
  |  |   51|  2.47k|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (1443:9): [True: 2.47k, False: 0]
  ------------------
 1444|  2.47k|        mz_stream_mem_open(zip->cd_mem_stream, NULL, MZ_OPEN_MODE_CREATE);
  ------------------
  |  |   54|  2.47k|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
 1445|  2.47k|        zip->cd_stream = zip->cd_mem_stream;
 1446|  2.47k|    } else {
 1447|      0|        zip->cd_stream = stream;
 1448|      0|    }
 1449|       |
 1450|  2.47k|    if ((mode & MZ_OPEN_MODE_READ) || (mode & MZ_OPEN_MODE_APPEND)) {
  ------------------
  |  |   50|  2.47k|#define MZ_OPEN_MODE_READ      (0x01)
  ------------------
                  if ((mode & MZ_OPEN_MODE_READ) || (mode & MZ_OPEN_MODE_APPEND)) {
  ------------------
  |  |   53|  2.47k|#define MZ_OPEN_MODE_APPEND    (0x04)
  ------------------
  |  Branch (1450:9): [True: 0, False: 2.47k]
  |  Branch (1450:39): [True: 0, False: 2.47k]
  ------------------
 1451|      0|        if ((mode & MZ_OPEN_MODE_CREATE) == 0) {
  ------------------
  |  |   54|      0|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
  |  Branch (1451:13): [True: 0, False: 0]
  ------------------
 1452|      0|            err = mz_zip_read_cd(zip);
 1453|      0|            if (err != MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1453:17): [True: 0, False: 0]
  ------------------
 1454|      0|                mz_zip_print("Zip - Error detected reading cd (%" PRId32 ")\n", err);
 1455|      0|                if (zip->recover && mz_zip_recover_cd(zip) == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1455:21): [True: 0, False: 0]
  |  Branch (1455:37): [True: 0, False: 0]
  ------------------
 1456|      0|                    err = MZ_OK;
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
 1457|      0|            }
 1458|      0|        }
 1459|       |
 1460|      0|        if ((err == MZ_OK) && (mode & MZ_OPEN_MODE_APPEND)) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
                      if ((err == MZ_OK) && (mode & MZ_OPEN_MODE_APPEND)) {
  ------------------
  |  |   53|      0|#define MZ_OPEN_MODE_APPEND    (0x04)
  ------------------
  |  Branch (1460:13): [True: 0, False: 0]
  |  Branch (1460:31): [True: 0, False: 0]
  ------------------
 1461|      0|            if (zip->cd_size > 0) {
  ------------------
  |  Branch (1461:17): [True: 0, False: 0]
  ------------------
 1462|       |                /* Store central directory in memory */
 1463|      0|                err = mz_stream_seek(zip->stream, zip->cd_offset, MZ_SEEK_SET);
  ------------------
  |  |   59|      0|#define MZ_SEEK_SET (0)
  ------------------
 1464|      0|                if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1464:21): [True: 0, False: 0]
  ------------------
 1465|      0|                    err = mz_stream_copy(zip->cd_mem_stream, zip->stream, (int32_t)zip->cd_size);
 1466|      0|                if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1466:21): [True: 0, False: 0]
  ------------------
 1467|      0|                    err = mz_stream_seek(zip->stream, zip->cd_offset, MZ_SEEK_SET);
  ------------------
  |  |   59|      0|#define MZ_SEEK_SET (0)
  ------------------
 1468|      0|            } else {
 1469|      0|                if (zip->cd_signature == MZ_ZIP_MAGIC_ENDHEADER) {
  ------------------
  |  |   65|      0|#define MZ_ZIP_MAGIC_ENDHEADER          (0x06054b50)
  ------------------
  |  Branch (1469:21): [True: 0, False: 0]
  ------------------
 1470|       |                    /* If tiny zip then overwrite end header */
 1471|      0|                    err = mz_stream_seek(zip->stream, zip->cd_offset, MZ_SEEK_SET);
  ------------------
  |  |   59|      0|#define MZ_SEEK_SET (0)
  ------------------
 1472|      0|                } else {
 1473|       |                    /* If no central directory, append new zip to end of file */
 1474|      0|                    err = mz_stream_seek(zip->stream, 0, MZ_SEEK_END);
  ------------------
  |  |   61|      0|#define MZ_SEEK_END (2)
  ------------------
 1475|      0|                }
 1476|      0|            }
 1477|       |
 1478|      0|            if (zip->disk_number_with_cd > 0) {
  ------------------
  |  Branch (1478:17): [True: 0, False: 0]
  ------------------
 1479|       |                /* Move to last disk to begin appending */
 1480|      0|                mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, zip->disk_number_with_cd - 1);
  ------------------
  |  |   27|      0|#define MZ_STREAM_PROP_DISK_NUMBER      (8)
  ------------------
 1481|      0|            }
 1482|      0|        } else {
 1483|      0|            zip->cd_start_pos = zip->cd_offset;
 1484|      0|        }
 1485|      0|    }
 1486|       |
 1487|  2.47k|    if (err != MZ_OK) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1487:9): [True: 0, False: 2.47k]
  ------------------
 1488|      0|        mz_zip_close(zip);
 1489|      0|        return err;
 1490|      0|    }
 1491|       |
 1492|       |    /* Memory streams used to store variable length file info data */
 1493|  2.47k|    zip->file_info_stream = mz_stream_mem_create();
 1494|  2.47k|    if (!zip->file_info_stream)
  ------------------
  |  Branch (1494:9): [True: 0, False: 2.47k]
  ------------------
 1495|      0|        return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1496|       |
 1497|  2.47k|    mz_stream_mem_open(zip->file_info_stream, NULL, MZ_OPEN_MODE_CREATE);
  ------------------
  |  |   54|  2.47k|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
 1498|       |
 1499|  2.47k|    zip->local_file_info_stream = mz_stream_mem_create();
 1500|  2.47k|    if (!zip->local_file_info_stream) {
  ------------------
  |  Branch (1500:9): [True: 0, False: 2.47k]
  ------------------
 1501|      0|        mz_stream_delete(&zip->file_info_stream);
 1502|      0|        return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1503|      0|    }
 1504|       |
 1505|  2.47k|    mz_stream_mem_open(zip->local_file_info_stream, NULL, MZ_OPEN_MODE_CREATE);
  ------------------
  |  |   54|  2.47k|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
 1506|       |
 1507|  2.47k|    zip->open_mode = mode;
 1508|       |
 1509|  2.47k|    return err;
 1510|  2.47k|}
mz_zip_close:
 1512|  2.47k|int32_t mz_zip_close(void *handle) {
 1513|  2.47k|    mz_zip *zip = (mz_zip *)handle;
 1514|  2.47k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
 1515|       |
 1516|  2.47k|    if (!zip)
  ------------------
  |  Branch (1516:9): [True: 0, False: 2.47k]
  ------------------
 1517|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1518|       |
 1519|  2.47k|    mz_zip_print("Zip - Close\n");
 1520|       |
 1521|  2.47k|    if (mz_zip_entry_is_open(zip) == MZ_OK)
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1521:9): [True: 0, False: 2.47k]
  ------------------
 1522|      0|        err = mz_zip_entry_close(zip);
 1523|       |
 1524|  2.47k|    if ((err == MZ_OK) && (zip->open_mode & MZ_OPEN_MODE_WRITE))
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
                  if ((err == MZ_OK) && (zip->open_mode & MZ_OPEN_MODE_WRITE))
  ------------------
  |  |   51|  2.47k|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (1524:9): [True: 2.47k, False: 0]
  |  Branch (1524:27): [True: 2.47k, False: 0]
  ------------------
 1525|  2.47k|        err = mz_zip_write_cd(zip);
 1526|       |
 1527|  2.47k|    if (zip->cd_mem_stream) {
  ------------------
  |  Branch (1527:9): [True: 2.47k, False: 0]
  ------------------
 1528|  2.47k|        mz_stream_close(zip->cd_mem_stream);
 1529|  2.47k|        mz_stream_delete(&zip->cd_mem_stream);
 1530|  2.47k|    }
 1531|       |
 1532|  2.47k|    if (zip->file_info_stream) {
  ------------------
  |  Branch (1532:9): [True: 2.47k, False: 0]
  ------------------
 1533|  2.47k|        mz_stream_mem_close(zip->file_info_stream);
 1534|  2.47k|        mz_stream_mem_delete(&zip->file_info_stream);
 1535|  2.47k|    }
 1536|  2.47k|    if (zip->local_file_info_stream) {
  ------------------
  |  Branch (1536:9): [True: 2.47k, False: 0]
  ------------------
 1537|  2.47k|        mz_stream_mem_close(zip->local_file_info_stream);
 1538|  2.47k|        mz_stream_mem_delete(&zip->local_file_info_stream);
 1539|  2.47k|    }
 1540|       |
 1541|  2.47k|    if (zip->comment) {
  ------------------
  |  Branch (1541:9): [True: 0, False: 2.47k]
  ------------------
 1542|      0|        free(zip->comment);
 1543|      0|        zip->comment = NULL;
 1544|      0|    }
 1545|       |
 1546|  2.47k|    zip->stream = NULL;
 1547|  2.47k|    zip->cd_stream = NULL;
 1548|       |
 1549|  2.47k|    return err;
 1550|  2.47k|}
mz_zip_entry_is_open:
 1882|  11.9k|int32_t mz_zip_entry_is_open(void *handle) {
 1883|  11.9k|    mz_zip *zip = (mz_zip *)handle;
 1884|  11.9k|    if (!zip)
  ------------------
  |  Branch (1884:9): [True: 0, False: 11.9k]
  ------------------
 1885|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1886|  11.9k|    if (zip->entry_opened == 0)
  ------------------
  |  Branch (1886:9): [True: 4.94k, False: 7.02k]
  ------------------
 1887|  4.94k|        return MZ_EXIST_ERROR;
  ------------------
  |  |   36|  4.94k|#define MZ_EXIST_ERROR    (-107)
  ------------------
 1888|  7.02k|    return MZ_OK;
  ------------------
  |  |   21|  7.02k|#define MZ_OK             (0)  /* zlib */
  ------------------
 1889|  11.9k|}
mz_zip_entry_write_open:
 1933|  2.47k|                                const char *password) {
 1934|  2.47k|    mz_zip *zip = (mz_zip *)handle;
 1935|  2.47k|    int64_t filename_pos = -1;
 1936|  2.47k|    int64_t extrafield_pos = 0;
 1937|  2.47k|    int64_t comment_pos = 0;
 1938|  2.47k|    int64_t linkname_pos = 0;
 1939|  2.47k|    int64_t disk_number = 0;
 1940|  2.47k|    uint8_t is_dir = 0;
 1941|  2.47k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
 1942|       |
 1943|       |#if defined(MZ_ZIP_NO_ENCRYPTION)
 1944|       |    if (password)
 1945|       |        return MZ_SUPPORT_ERROR;
 1946|       |#endif
 1947|  2.47k|    if (!zip || !file_info || !file_info->filename)
  ------------------
  |  Branch (1947:9): [True: 0, False: 2.47k]
  |  Branch (1947:17): [True: 0, False: 2.47k]
  |  Branch (1947:31): [True: 0, False: 2.47k]
  ------------------
 1948|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1949|       |
 1950|  2.47k|    if (mz_zip_entry_is_open(zip) == MZ_OK) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1950:9): [True: 0, False: 2.47k]
  ------------------
 1951|      0|        err = mz_zip_entry_close(zip);
 1952|      0|        if (err != MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1952:13): [True: 0, False: 0]
  ------------------
 1953|      0|            return err;
 1954|      0|    }
 1955|       |
 1956|  2.47k|    memcpy(&zip->file_info, file_info, sizeof(mz_zip_file));
 1957|       |
 1958|  2.47k|    mz_zip_print("Zip - Entry - Write open - %s (level %" PRId16 " raw %" PRId8 ")\n", zip->file_info.filename,
 1959|  2.47k|                 compress_level, raw);
 1960|       |
 1961|  2.47k|    mz_stream_seek(zip->file_info_stream, 0, MZ_SEEK_SET);
  ------------------
  |  |   59|  2.47k|#define MZ_SEEK_SET (0)
  ------------------
 1962|  2.47k|    mz_stream_write(zip->file_info_stream, file_info, sizeof(mz_zip_file));
 1963|       |
 1964|       |    /* Copy filename, extrafield, and comment internally */
 1965|  2.47k|    filename_pos = mz_stream_tell(zip->file_info_stream);
 1966|  2.47k|    if (file_info->filename)
  ------------------
  |  Branch (1966:9): [True: 2.47k, False: 0]
  ------------------
 1967|  2.47k|        mz_stream_write(zip->file_info_stream, file_info->filename, (int32_t)strlen(file_info->filename));
 1968|  2.47k|    mz_stream_write_uint8(zip->file_info_stream, 0);
 1969|       |
 1970|  2.47k|    extrafield_pos = mz_stream_tell(zip->file_info_stream);
 1971|  2.47k|    if (file_info->extrafield)
  ------------------
  |  Branch (1971:9): [True: 0, False: 2.47k]
  ------------------
 1972|      0|        mz_stream_write(zip->file_info_stream, file_info->extrafield, file_info->extrafield_size);
 1973|  2.47k|    mz_stream_write_uint8(zip->file_info_stream, 0);
 1974|       |
 1975|  2.47k|    comment_pos = mz_stream_tell(zip->file_info_stream);
 1976|  2.47k|    if (file_info->comment)
  ------------------
  |  Branch (1976:9): [True: 0, False: 2.47k]
  ------------------
 1977|      0|        mz_stream_write(zip->file_info_stream, file_info->comment, file_info->comment_size);
 1978|  2.47k|    mz_stream_write_uint8(zip->file_info_stream, 0);
 1979|       |
 1980|  2.47k|    linkname_pos = mz_stream_tell(zip->file_info_stream);
 1981|  2.47k|    if (file_info->linkname)
  ------------------
  |  Branch (1981:9): [True: 0, False: 2.47k]
  ------------------
 1982|      0|        mz_stream_write(zip->file_info_stream, file_info->linkname, (int32_t)strlen(file_info->linkname));
 1983|  2.47k|    mz_stream_write_uint8(zip->file_info_stream, 0);
 1984|       |
 1985|  2.47k|    mz_stream_mem_get_buffer_at(zip->file_info_stream, filename_pos, (const void **)&zip->file_info.filename);
 1986|  2.47k|    mz_stream_mem_get_buffer_at(zip->file_info_stream, extrafield_pos, (const void **)&zip->file_info.extrafield);
 1987|  2.47k|    mz_stream_mem_get_buffer_at(zip->file_info_stream, comment_pos, (const void **)&zip->file_info.comment);
 1988|  2.47k|    mz_stream_mem_get_buffer_at(zip->file_info_stream, linkname_pos, (const void **)&zip->file_info.linkname);
 1989|       |
 1990|  2.47k|    if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_DEFLATE) {
  ------------------
  |  |   65|  2.47k|#define MZ_COMPRESS_METHOD_DEFLATE (8)
  ------------------
  |  Branch (1990:9): [True: 139, False: 2.33k]
  ------------------
 1991|    139|        if ((compress_level == 8) || (compress_level == 9))
  ------------------
  |  Branch (1991:13): [True: 1, False: 138]
  |  Branch (1991:38): [True: 1, False: 137]
  ------------------
 1992|      2|            zip->file_info.flag |= MZ_ZIP_FLAG_DEFLATE_MAX;
  ------------------
  |  |   81|      2|#define MZ_ZIP_FLAG_DEFLATE_MAX        (1 << 1)
  ------------------
 1993|    139|        if (compress_level == 2)
  ------------------
  |  Branch (1993:13): [True: 2, False: 137]
  ------------------
 1994|      2|            zip->file_info.flag |= MZ_ZIP_FLAG_DEFLATE_FAST;
  ------------------
  |  |   83|      2|#define MZ_ZIP_FLAG_DEFLATE_FAST       (1 << 2)
  ------------------
 1995|    139|        if (compress_level == 1)
  ------------------
  |  Branch (1995:13): [True: 1, False: 138]
  ------------------
 1996|      1|            zip->file_info.flag |= MZ_ZIP_FLAG_DEFLATE_SUPER_FAST;
  ------------------
  |  |   84|      1|#define MZ_ZIP_FLAG_DEFLATE_SUPER_FAST (MZ_ZIP_FLAG_DEFLATE_FAST | MZ_ZIP_FLAG_DEFLATE_MAX)
  |  |  ------------------
  |  |  |  |   83|      1|#define MZ_ZIP_FLAG_DEFLATE_FAST       (1 << 2)
  |  |  ------------------
  |  |               #define MZ_ZIP_FLAG_DEFLATE_SUPER_FAST (MZ_ZIP_FLAG_DEFLATE_FAST | MZ_ZIP_FLAG_DEFLATE_MAX)
  |  |  ------------------
  |  |  |  |   81|      1|#define MZ_ZIP_FLAG_DEFLATE_MAX        (1 << 1)
  |  |  ------------------
  ------------------
 1997|    139|    }
 1998|       |#if defined(HAVE_LZMA) || defined(HAVE_LIBCOMP)
 1999|       |    else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_LZMA ||
 2000|       |             zip->file_info.compression_method == MZ_COMPRESS_METHOD_XZ)
 2001|       |        zip->file_info.flag |= MZ_ZIP_FLAG_LZMA_EOS_MARKER;
 2002|       |#endif
 2003|       |
 2004|  2.47k|    if (mz_zip_attrib_is_dir(zip->file_info.external_fa, zip->file_info.version_madeby) == MZ_OK)
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2004:9): [True: 0, False: 2.47k]
  ------------------
 2005|      0|        is_dir = 1;
 2006|       |
 2007|  2.47k|    if (!raw && !is_dir) {
  ------------------
  |  Branch (2007:9): [True: 2.47k, False: 0]
  |  Branch (2007:17): [True: 2.47k, False: 0]
  ------------------
 2008|  2.47k|        if (zip->data_descriptor)
  ------------------
  |  Branch (2008:13): [True: 2.47k, False: 0]
  ------------------
 2009|  2.47k|            zip->file_info.flag |= MZ_ZIP_FLAG_DATA_DESCRIPTOR;
  ------------------
  |  |   85|  2.47k|#define MZ_ZIP_FLAG_DATA_DESCRIPTOR    (1 << 3)
  ------------------
 2010|  2.47k|        if (password)
  ------------------
  |  Branch (2010:13): [True: 252, False: 2.22k]
  ------------------
 2011|    252|            zip->file_info.flag |= MZ_ZIP_FLAG_ENCRYPTED;
  ------------------
  |  |   79|    252|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
 2012|  2.47k|    }
 2013|       |
 2014|  2.47k|    mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, &disk_number);
  ------------------
  |  |   27|  2.47k|#define MZ_STREAM_PROP_DISK_NUMBER      (8)
  ------------------
 2015|  2.47k|    zip->file_info.disk_number = (uint32_t)disk_number;
 2016|  2.47k|    zip->file_info.disk_offset = mz_stream_tell(zip->stream);
 2017|       |
 2018|  2.47k|    if (zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED) {
  ------------------
  |  |   79|  2.47k|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (2018:9): [True: 252, False: 2.22k]
  ------------------
 2019|    252|#ifdef HAVE_PKCRYPT
 2020|       |        /* Pre-calculated CRC value is required for PKWARE traditional encryption */
 2021|    252|        uint32_t dos_date = mz_zip_time_t_to_dos_date(zip->file_info.modified_date);
 2022|    252|        zip->file_info.pk_verify = mz_zip_get_pk_verify(dos_date, zip->file_info.crc, zip->file_info.flag);
 2023|    252|#endif
 2024|    252|#ifdef HAVE_WZAES
 2025|    252|        if (zip->file_info.aes_version && zip->file_info.aes_strength == 0)
  ------------------
  |  Branch (2025:13): [True: 0, False: 252]
  |  Branch (2025:43): [True: 0, False: 0]
  ------------------
 2026|      0|            zip->file_info.aes_strength = MZ_AES_STRENGTH_256;
  ------------------
  |  |  121|      0|#define MZ_AES_STRENGTH_256   (3)
  ------------------
 2027|    252|#endif
 2028|    252|    }
 2029|       |
 2030|  2.47k|    zip->file_info.crc = 0;
 2031|  2.47k|    zip->file_info.compressed_size = 0;
 2032|       |
 2033|  2.47k|    if ((compress_level == 0) || (is_dir))
  ------------------
  |  Branch (2033:9): [True: 35, False: 2.43k]
  |  Branch (2033:34): [True: 0, False: 2.43k]
  ------------------
 2034|     35|        zip->file_info.compression_method = MZ_COMPRESS_METHOD_STORE;
  ------------------
  |  |   64|     35|#define MZ_COMPRESS_METHOD_STORE   (0)
  ------------------
 2035|       |
 2036|       |#ifdef MZ_ZIP_NO_COMPRESSION
 2037|       |    if (zip->file_info.compression_method != MZ_COMPRESS_METHOD_STORE)
 2038|       |        err = MZ_SUPPORT_ERROR;
 2039|       |#endif
 2040|  2.47k|    if (err == MZ_OK)
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2040:9): [True: 2.47k, False: 0]
  ------------------
 2041|  2.47k|        err = mz_zip_entry_write_header(zip->stream, 1, &zip->file_info);
 2042|  2.47k|    if (err == MZ_OK)
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2042:9): [True: 2.47k, False: 0]
  ------------------
 2043|  2.47k|        err = mz_zip_entry_open_int(zip, raw, compress_level, password);
 2044|       |
 2045|  2.47k|    return err;
 2046|  2.47k|}
mz_zip_entry_write:
 2073|  2.34k|int32_t mz_zip_entry_write(void *handle, const void *buf, int32_t len) {
 2074|  2.34k|    mz_zip *zip = (mz_zip *)handle;
 2075|  2.34k|    int32_t written = 0;
 2076|       |
 2077|  2.34k|    if (!zip || mz_zip_entry_is_open(zip) != MZ_OK)
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2077:9): [True: 0, False: 2.34k]
  |  Branch (2077:17): [True: 0, False: 2.34k]
  ------------------
 2078|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 2079|  2.34k|    written = mz_stream_write(zip->compress_stream, buf, len);
 2080|  2.34k|    if (written > 0)
  ------------------
  |  Branch (2080:9): [True: 2.20k, False: 140]
  ------------------
 2081|  2.20k|        zip->entry_crc32 = mz_crypt_crc32_update(zip->entry_crc32, buf, written);
 2082|       |
 2083|  2.34k|    mz_zip_print("Zip - Entry - Write - %" PRId32 " (max %" PRId32 ")\n", written, len);
 2084|  2.34k|    return written;
 2085|  2.34k|}
mz_zip_entry_write_close:
 2153|  2.34k|int32_t mz_zip_entry_write_close(void *handle, uint32_t crc32, int64_t compressed_size, int64_t uncompressed_size) {
 2154|  2.34k|    mz_zip *zip = (mz_zip *)handle;
 2155|  2.34k|    int64_t end_disk_number = 0;
 2156|  2.34k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
 2157|  2.34k|    uint8_t zip64 = 0;
 2158|       |
 2159|  2.34k|    if (!zip || mz_zip_entry_is_open(zip) != MZ_OK)
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2159:9): [True: 0, False: 2.34k]
  |  Branch (2159:17): [True: 0, False: 2.34k]
  ------------------
 2160|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 2161|       |
 2162|  2.34k|    mz_stream_close(zip->compress_stream);
 2163|       |
 2164|  2.34k|    if (!zip->entry_raw)
  ------------------
  |  Branch (2164:9): [True: 2.34k, False: 0]
  ------------------
 2165|  2.34k|        crc32 = zip->entry_crc32;
 2166|       |
 2167|  2.34k|    mz_zip_print("Zip - Entry - Write Close (crc 0x%08" PRIx32 " cs %" PRId64 " ucs %" PRId64 ")\n", crc32,
 2168|  2.34k|                 compressed_size, uncompressed_size);
 2169|       |
 2170|       |    /* If sizes are not set, then read them from the compression stream */
 2171|  2.34k|    if (compressed_size < 0)
  ------------------
  |  Branch (2171:9): [True: 2.34k, False: 0]
  ------------------
 2172|  2.34k|        mz_stream_get_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_OUT, &compressed_size);
  ------------------
  |  |   22|  2.34k|#define MZ_STREAM_PROP_TOTAL_OUT        (3)
  ------------------
 2173|  2.34k|    if (uncompressed_size < 0)
  ------------------
  |  Branch (2173:9): [True: 2.34k, False: 0]
  ------------------
 2174|  2.34k|        mz_stream_get_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_IN, &uncompressed_size);
  ------------------
  |  |   20|  2.34k|#define MZ_STREAM_PROP_TOTAL_IN         (1)
  ------------------
 2175|       |
 2176|  2.34k|    if (zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED) {
  ------------------
  |  |   79|  2.34k|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (2176:9): [True: 250, False: 2.09k]
  ------------------
 2177|    250|        mz_stream_set_base(zip->crypt_stream, zip->stream);
 2178|    250|        err = mz_stream_close(zip->crypt_stream);
 2179|       |
 2180|    250|        mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_TOTAL_OUT, &compressed_size);
  ------------------
  |  |   22|    250|#define MZ_STREAM_PROP_TOTAL_OUT        (3)
  ------------------
 2181|    250|    }
 2182|       |
 2183|  2.34k|    mz_zip_entry_needs_zip64(&zip->file_info, 1, &zip64);
 2184|       |
 2185|  2.34k|    if ((err == MZ_OK) && (zip->file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR)) {
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
                  if ((err == MZ_OK) && (zip->file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR)) {
  ------------------
  |  |   85|  2.34k|#define MZ_ZIP_FLAG_DATA_DESCRIPTOR    (1 << 3)
  ------------------
  |  Branch (2185:9): [True: 2.34k, False: 0]
  |  Branch (2185:27): [True: 2.34k, False: 0]
  ------------------
 2186|       |        /* Determine if we need to write data descriptor in zip64 format,
 2187|       |           if local extrafield was saved with zip64 extrafield */
 2188|       |
 2189|  2.34k|        if (zip->file_info.flag & MZ_ZIP_FLAG_MASK_LOCAL_INFO)
  ------------------
  |  |   87|  2.34k|#define MZ_ZIP_FLAG_MASK_LOCAL_INFO    (1 << 13)
  ------------------
  |  Branch (2189:13): [True: 170, False: 2.17k]
  ------------------
 2190|    170|            err = mz_zip_entry_write_descriptor(zip->stream, zip64, 0, compressed_size, 0);
 2191|  2.17k|        else
 2192|  2.17k|            err = mz_zip_entry_write_descriptor(zip->stream, zip64, crc32, compressed_size, uncompressed_size);
 2193|  2.34k|    }
 2194|       |
 2195|       |    /* Write file info to central directory */
 2196|       |
 2197|  2.34k|    mz_zip_print("Zip - Entry - Write cd (ucs %" PRId64 " cs %" PRId64 " crc 0x%08" PRIx32 ")\n", uncompressed_size,
 2198|  2.34k|                 compressed_size, crc32);
 2199|       |
 2200|  2.34k|    zip->file_info.crc = crc32;
 2201|  2.34k|    zip->file_info.compressed_size = compressed_size;
 2202|  2.34k|    zip->file_info.uncompressed_size = uncompressed_size;
 2203|       |
 2204|  2.34k|    if (err == MZ_OK)
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2204:9): [True: 2.34k, False: 0]
  ------------------
 2205|  2.34k|        err = mz_zip_entry_write_header(zip->cd_mem_stream, 0, &zip->file_info);
 2206|       |
 2207|       |    /* Update local header with crc32 and sizes */
 2208|  2.34k|    if ((err == MZ_OK) && ((zip->file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR) == 0) &&
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
                  if ((err == MZ_OK) && ((zip->file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR) == 0) &&
  ------------------
  |  |   85|  2.34k|#define MZ_ZIP_FLAG_DATA_DESCRIPTOR    (1 << 3)
  ------------------
  |  Branch (2208:9): [True: 2.34k, False: 0]
  |  Branch (2208:27): [True: 0, False: 2.34k]
  ------------------
 2209|      0|        ((zip->file_info.flag & MZ_ZIP_FLAG_MASK_LOCAL_INFO) == 0)) {
  ------------------
  |  |   87|      0|#define MZ_ZIP_FLAG_MASK_LOCAL_INFO    (1 << 13)
  ------------------
  |  Branch (2209:9): [True: 0, False: 0]
  ------------------
 2210|       |        /* Save the disk number and position we are to seek back after updating local header */
 2211|      0|        int64_t end_pos = mz_stream_tell(zip->stream);
 2212|      0|        mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, &end_disk_number);
  ------------------
  |  |   27|      0|#define MZ_STREAM_PROP_DISK_NUMBER      (8)
  ------------------
 2213|       |
 2214|      0|        err = mz_zip_entry_seek_local_header(zip);
 2215|       |
 2216|      0|        if (err == MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2216:13): [True: 0, False: 0]
  ------------------
 2217|       |            /* Seek to crc32 and sizes offset in local header */
 2218|      0|            mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, zip->file_info.disk_number);
  ------------------
  |  |   27|      0|#define MZ_STREAM_PROP_DISK_NUMBER      (8)
  ------------------
 2219|      0|            err = mz_stream_seek(zip->stream, zip->file_info.disk_offset + MZ_ZIP_OFFSET_CRC_SIZES, MZ_SEEK_SET);
  ------------------
  |  |   77|      0|#define MZ_ZIP_OFFSET_CRC_SIZES         (14)
  ------------------
                          err = mz_stream_seek(zip->stream, zip->file_info.disk_offset + MZ_ZIP_OFFSET_CRC_SIZES, MZ_SEEK_SET);
  ------------------
  |  |   59|      0|#define MZ_SEEK_SET (0)
  ------------------
 2220|      0|        }
 2221|       |
 2222|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2222:13): [True: 0, False: 0]
  ------------------
 2223|      0|            err = mz_zip_entry_write_crc_sizes(zip->stream, zip64, 0, &zip->file_info);
 2224|       |
 2225|       |        /* Seek to and update zip64 extension sizes */
 2226|      0|        if ((err == MZ_OK) && (zip64)) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2226:13): [True: 0, False: 0]
  |  Branch (2226:31): [True: 0, False: 0]
  ------------------
 2227|      0|            int64_t filename_size = zip->file_info.filename_size;
 2228|       |
 2229|      0|            if (filename_size == 0)
  ------------------
  |  Branch (2229:17): [True: 0, False: 0]
  ------------------
 2230|      0|                filename_size = strlen(zip->file_info.filename);
 2231|       |
 2232|       |            /* Since we write zip64 extension first we know its offset */
 2233|      0|            err = mz_stream_seek(zip->stream, 2 + 2 + filename_size + 4, MZ_SEEK_CUR);
  ------------------
  |  |   60|      0|#define MZ_SEEK_CUR (1)
  ------------------
 2234|       |
 2235|      0|            if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2235:17): [True: 0, False: 0]
  ------------------
 2236|      0|                err = mz_stream_write_uint64(zip->stream, zip->file_info.uncompressed_size);
 2237|      0|            if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2237:17): [True: 0, False: 0]
  ------------------
 2238|      0|                err = mz_stream_write_uint64(zip->stream, zip->file_info.compressed_size);
 2239|      0|        }
 2240|       |
 2241|      0|        mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, end_disk_number);
  ------------------
  |  |   27|      0|#define MZ_STREAM_PROP_DISK_NUMBER      (8)
  ------------------
 2242|      0|        mz_stream_seek(zip->stream, end_pos, MZ_SEEK_SET);
  ------------------
  |  |   59|      0|#define MZ_SEEK_SET (0)
  ------------------
 2243|      0|    }
 2244|       |
 2245|  2.34k|    zip->number_entry += 1;
 2246|       |
 2247|  2.34k|    mz_zip_entry_close_int(zip);
 2248|       |
 2249|  2.34k|    return err;
 2250|  2.34k|}
mz_zip_entry_close:
 2288|  2.34k|int32_t mz_zip_entry_close(void *handle) {
 2289|       |    return mz_zip_entry_close_raw(handle, UINT64_MAX, 0);
 2290|  2.34k|}
mz_zip_entry_close_raw:
 2292|  2.34k|int32_t mz_zip_entry_close_raw(void *handle, int64_t uncompressed_size, uint32_t crc32) {
 2293|  2.34k|    mz_zip *zip = (mz_zip *)handle;
 2294|  2.34k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
 2295|       |
 2296|  2.34k|    if (!zip || mz_zip_entry_is_open(zip) != MZ_OK)
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2296:9): [True: 0, False: 2.34k]
  |  Branch (2296:17): [True: 0, False: 2.34k]
  ------------------
 2297|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 2298|       |
 2299|  2.34k|    if (zip->open_mode & MZ_OPEN_MODE_WRITE)
  ------------------
  |  |   51|  2.34k|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (2299:9): [True: 2.34k, False: 0]
  ------------------
 2300|  2.34k|        err = mz_zip_entry_write_close(zip, crc32, UINT64_MAX, uncompressed_size);
 2301|      0|    else
 2302|      0|        err = mz_zip_entry_read_close(zip, NULL, NULL, NULL);
 2303|       |
 2304|  2.34k|    return err;
 2305|  2.34k|}
mz_zip_attrib_is_dir:
 2499|  11.4k|int32_t mz_zip_attrib_is_dir(uint32_t attrib, int32_t version_madeby) {
 2500|  11.4k|    uint32_t posix_attrib = 0;
 2501|  11.4k|    uint8_t system = MZ_HOST_SYSTEM(version_madeby);
  ------------------
  |  |  104|  11.4k|#define MZ_HOST_SYSTEM(VERSION_MADEBY) ((uint8_t)(VERSION_MADEBY >> 8))
  ------------------
 2502|  11.4k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  11.4k|#define MZ_OK             (0)  /* zlib */
  ------------------
 2503|       |
 2504|  11.4k|    err = mz_zip_attrib_convert(system, attrib, MZ_HOST_SYSTEM_UNIX, &posix_attrib);
  ------------------
  |  |  106|  11.4k|#define MZ_HOST_SYSTEM_UNIX            (3)
  ------------------
 2505|  11.4k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  11.4k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2505:9): [True: 11.4k, False: 0]
  ------------------
 2506|  11.4k|        if ((posix_attrib & 0170000) == 0040000) /* S_ISDIR */
  ------------------
  |  Branch (2506:13): [True: 0, False: 11.4k]
  ------------------
 2507|      0|            return MZ_OK;
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
 2508|  11.4k|    }
 2509|       |
 2510|  11.4k|    return MZ_EXIST_ERROR;
  ------------------
  |  |   36|  11.4k|#define MZ_EXIST_ERROR    (-107)
  ------------------
 2511|  11.4k|}
mz_zip_attrib_convert:
 2527|  11.4k|int32_t mz_zip_attrib_convert(uint8_t src_sys, uint32_t src_attrib, uint8_t target_sys, uint32_t *target_attrib) {
 2528|  11.4k|    if (!target_attrib)
  ------------------
  |  Branch (2528:9): [True: 0, False: 11.4k]
  ------------------
 2529|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 2530|       |
 2531|  11.4k|    *target_attrib = 0;
 2532|       |
 2533|  11.4k|    if ((src_sys == MZ_HOST_SYSTEM_MSDOS) || (src_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS)) {
  ------------------
  |  |  105|  11.4k|#define MZ_HOST_SYSTEM_MSDOS           (0)
  ------------------
                  if ((src_sys == MZ_HOST_SYSTEM_MSDOS) || (src_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS)) {
  ------------------
  |  |  107|      0|#define MZ_HOST_SYSTEM_WINDOWS_NTFS    (10)
  ------------------
  |  Branch (2533:9): [True: 11.4k, False: 0]
  |  Branch (2533:46): [True: 0, False: 0]
  ------------------
 2534|  11.4k|        if ((target_sys == MZ_HOST_SYSTEM_MSDOS) || (target_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS)) {
  ------------------
  |  |  105|  11.4k|#define MZ_HOST_SYSTEM_MSDOS           (0)
  ------------------
                      if ((target_sys == MZ_HOST_SYSTEM_MSDOS) || (target_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS)) {
  ------------------
  |  |  107|  11.4k|#define MZ_HOST_SYSTEM_WINDOWS_NTFS    (10)
  ------------------
  |  Branch (2534:13): [True: 0, False: 11.4k]
  |  Branch (2534:53): [True: 0, False: 11.4k]
  ------------------
 2535|      0|            *target_attrib = src_attrib;
 2536|      0|            return MZ_OK;
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
 2537|      0|        }
 2538|  11.4k|        if ((target_sys == MZ_HOST_SYSTEM_UNIX) || (target_sys == MZ_HOST_SYSTEM_OSX_DARWIN) ||
  ------------------
  |  |  106|  11.4k|#define MZ_HOST_SYSTEM_UNIX            (3)
  ------------------
                      if ((target_sys == MZ_HOST_SYSTEM_UNIX) || (target_sys == MZ_HOST_SYSTEM_OSX_DARWIN) ||
  ------------------
  |  |  109|      0|#define MZ_HOST_SYSTEM_OSX_DARWIN      (19)
  ------------------
  |  Branch (2538:13): [True: 11.4k, False: 0]
  |  Branch (2538:52): [True: 0, False: 0]
  ------------------
 2539|      0|            (target_sys == MZ_HOST_SYSTEM_RISCOS))
  ------------------
  |  |  108|      0|#define MZ_HOST_SYSTEM_RISCOS          (13)
  ------------------
  |  Branch (2539:13): [True: 0, False: 0]
  ------------------
 2540|  11.4k|            return mz_zip_attrib_win32_to_posix(src_attrib, target_attrib);
 2541|  11.4k|    } else if ((src_sys == MZ_HOST_SYSTEM_UNIX) || (src_sys == MZ_HOST_SYSTEM_OSX_DARWIN) ||
  ------------------
  |  |  106|      0|#define MZ_HOST_SYSTEM_UNIX            (3)
  ------------------
                  } else if ((src_sys == MZ_HOST_SYSTEM_UNIX) || (src_sys == MZ_HOST_SYSTEM_OSX_DARWIN) ||
  ------------------
  |  |  109|      0|#define MZ_HOST_SYSTEM_OSX_DARWIN      (19)
  ------------------
  |  Branch (2541:16): [True: 0, False: 0]
  |  Branch (2541:52): [True: 0, False: 0]
  ------------------
 2542|      0|               (src_sys == MZ_HOST_SYSTEM_RISCOS)) {
  ------------------
  |  |  108|      0|#define MZ_HOST_SYSTEM_RISCOS          (13)
  ------------------
  |  Branch (2542:16): [True: 0, False: 0]
  ------------------
 2543|       |        /* If high bytes are set, it contains unix specific attributes */
 2544|      0|        if ((src_attrib >> 16) != 0)
  ------------------
  |  Branch (2544:13): [True: 0, False: 0]
  ------------------
 2545|      0|            src_attrib >>= 16;
 2546|       |
 2547|      0|        if ((target_sys == MZ_HOST_SYSTEM_UNIX) || (target_sys == MZ_HOST_SYSTEM_OSX_DARWIN) ||
  ------------------
  |  |  106|      0|#define MZ_HOST_SYSTEM_UNIX            (3)
  ------------------
                      if ((target_sys == MZ_HOST_SYSTEM_UNIX) || (target_sys == MZ_HOST_SYSTEM_OSX_DARWIN) ||
  ------------------
  |  |  109|      0|#define MZ_HOST_SYSTEM_OSX_DARWIN      (19)
  ------------------
  |  Branch (2547:13): [True: 0, False: 0]
  |  Branch (2547:52): [True: 0, False: 0]
  ------------------
 2548|      0|            (target_sys == MZ_HOST_SYSTEM_RISCOS)) {
  ------------------
  |  |  108|      0|#define MZ_HOST_SYSTEM_RISCOS          (13)
  ------------------
  |  Branch (2548:13): [True: 0, False: 0]
  ------------------
 2549|      0|            *target_attrib = src_attrib;
 2550|      0|            return MZ_OK;
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
 2551|      0|        }
 2552|      0|        if ((target_sys == MZ_HOST_SYSTEM_MSDOS) || (target_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS))
  ------------------
  |  |  105|      0|#define MZ_HOST_SYSTEM_MSDOS           (0)
  ------------------
                      if ((target_sys == MZ_HOST_SYSTEM_MSDOS) || (target_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS))
  ------------------
  |  |  107|      0|#define MZ_HOST_SYSTEM_WINDOWS_NTFS    (10)
  ------------------
  |  Branch (2552:13): [True: 0, False: 0]
  |  Branch (2552:53): [True: 0, False: 0]
  ------------------
 2553|      0|            return mz_zip_attrib_posix_to_win32(src_attrib, target_attrib);
 2554|      0|    }
 2555|       |
 2556|      0|    return MZ_SUPPORT_ERROR;
  ------------------
  |  |   38|      0|#define MZ_SUPPORT_ERROR  (-109)
  ------------------
 2557|  11.4k|}
mz_zip_attrib_win32_to_posix:
 2581|  11.4k|int32_t mz_zip_attrib_win32_to_posix(uint32_t win32_attrib, uint32_t *posix_attrib) {
 2582|  11.4k|    if (!posix_attrib)
  ------------------
  |  Branch (2582:9): [True: 0, False: 11.4k]
  ------------------
 2583|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 2584|       |
 2585|  11.4k|    *posix_attrib = 0000444; /* S_IRUSR | S_IRGRP | S_IROTH */
 2586|       |    /* FILE_ATTRIBUTE_READONLY */
 2587|  11.4k|    if ((win32_attrib & 0x01) == 0)
  ------------------
  |  Branch (2587:9): [True: 11.4k, False: 0]
  ------------------
 2588|  11.4k|        *posix_attrib |= 0000222; /* S_IWUSR | S_IWGRP | S_IWOTH */
 2589|       |    /* FILE_ATTRIBUTE_REPARSE_POINT */
 2590|  11.4k|    if ((win32_attrib & 0x400) == 0x400)
  ------------------
  |  Branch (2590:9): [True: 0, False: 11.4k]
  ------------------
 2591|      0|        *posix_attrib |= 0120000; /* S_IFLNK */
 2592|       |    /* FILE_ATTRIBUTE_DIRECTORY */
 2593|  11.4k|    else if ((win32_attrib & 0x10) == 0x10)
  ------------------
  |  Branch (2593:14): [True: 0, False: 11.4k]
  ------------------
 2594|      0|        *posix_attrib |= 0040111; /* S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH */
 2595|  11.4k|    else
 2596|  11.4k|        *posix_attrib |= 0100000; /* S_IFREG */
 2597|       |
 2598|  11.4k|    return MZ_OK;
  ------------------
  |  |   21|  11.4k|#define MZ_OK             (0)  /* zlib */
  ------------------
 2599|  11.4k|}
mz_zip_extrafield_write:
 2662|  2.13k|int32_t mz_zip_extrafield_write(void *stream, uint16_t type, uint16_t length) {
 2663|  2.13k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  2.13k|#define MZ_OK             (0)  /* zlib */
  ------------------
 2664|  2.13k|    err = mz_stream_write_uint16(stream, type);
 2665|  2.13k|    if (err == MZ_OK)
  ------------------
  |  |   21|  2.13k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2665:9): [True: 2.13k, False: 0]
  ------------------
 2666|  2.13k|        err = mz_stream_write_uint16(stream, length);
 2667|  2.13k|    return err;
 2668|  2.13k|}
mz_zip_time_t_to_tm:
 2729|    252|int32_t mz_zip_time_t_to_tm(time_t unix_time, struct tm *ptm) {
 2730|    252|    struct tm ltm;
 2731|    252|    if (!ptm)
  ------------------
  |  Branch (2731:9): [True: 0, False: 252]
  ------------------
 2732|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 2733|    252|    if (!localtime_r(&unix_time, &ltm)) { /* Returns a 1900-based year */
  ------------------
  |  Branch (2733:9): [True: 0, False: 252]
  ------------------
 2734|       |        /* Invalid date stored, so don't return it */
 2735|      0|        memset(ptm, 0, sizeof(struct tm));
 2736|      0|        return MZ_INTERNAL_ERROR;
  ------------------
  |  |   33|      0|#define MZ_INTERNAL_ERROR (-104)
  ------------------
 2737|      0|    }
 2738|    252|    memcpy(ptm, &ltm, sizeof(struct tm));
 2739|    252|    return MZ_OK;
  ------------------
  |  |   21|    252|#define MZ_OK             (0)  /* zlib */
  ------------------
 2740|    252|}
mz_zip_time_t_to_dos_date:
 2742|    252|uint32_t mz_zip_time_t_to_dos_date(time_t unix_time) {
 2743|    252|    struct tm ptm;
 2744|    252|    mz_zip_time_t_to_tm(unix_time, &ptm);
 2745|    252|    return mz_zip_tm_to_dosdate((const struct tm *)&ptm);
 2746|    252|}
mz_zip_tm_to_dosdate:
 2748|    252|uint32_t mz_zip_tm_to_dosdate(const struct tm *ptm) {
 2749|    252|    struct tm fixed_tm;
 2750|       |
 2751|       |    /* Years supported: */
 2752|       |
 2753|       |    /* [00, 79]      (assumed to be between 2000 and 2079) */
 2754|       |    /* [80, 207]     (assumed to be between 1980 and 2107, typical output of old */
 2755|       |    /*                software that does 'year-1900' to get a double digit year) */
 2756|       |    /* [1980, 2107]  (due to format limitations, only years 1980-2107 can be stored.) */
 2757|       |
 2758|    252|    memcpy(&fixed_tm, ptm, sizeof(struct tm));
 2759|    252|    if (fixed_tm.tm_year >= 1980) /* range [1980, 2107] */
  ------------------
  |  Branch (2759:9): [True: 0, False: 252]
  ------------------
 2760|      0|        fixed_tm.tm_year -= 1980;
 2761|    252|    else if (fixed_tm.tm_year >= 80) /* range [80, 207] */
  ------------------
  |  Branch (2761:14): [True: 0, False: 252]
  ------------------
 2762|      0|        fixed_tm.tm_year -= 80;
 2763|    252|    else /* range [00, 79] */
 2764|    252|        fixed_tm.tm_year += 20;
 2765|       |
 2766|    252|    if (mz_zip_invalid_date(&fixed_tm))
  ------------------
  |  Branch (2766:9): [True: 0, False: 252]
  ------------------
 2767|      0|        return 0;
 2768|       |
 2769|    252|    return (((uint32_t)fixed_tm.tm_mday + (32 * ((uint32_t)fixed_tm.tm_mon + 1)) + (512 * (uint32_t)fixed_tm.tm_year))
 2770|    252|            << 16) |
 2771|    252|        (((uint32_t)fixed_tm.tm_sec / 2) + (32 * (uint32_t)fixed_tm.tm_min) + (2048 * (uint32_t)fixed_tm.tm_hour));
 2772|    252|}
mz_zip.c:mz_zip_write_cd:
 1105|  2.47k|static int32_t mz_zip_write_cd(void *handle) {
 1106|  2.47k|    mz_zip *zip = (mz_zip *)handle;
 1107|  2.47k|    int64_t zip64_eocd_pos_inzip = 0;
 1108|  2.47k|    int64_t disk_number = 0;
 1109|  2.47k|    int64_t disk_size = 0;
 1110|  2.47k|    int32_t comment_size = 0;
 1111|  2.47k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
 1112|       |
 1113|  2.47k|    if (!zip)
  ------------------
  |  Branch (1113:9): [True: 0, False: 2.47k]
  ------------------
 1114|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1115|       |
 1116|  2.47k|    if (mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, &disk_number) == MZ_OK)
  ------------------
  |  |   27|  2.47k|#define MZ_STREAM_PROP_DISK_NUMBER      (8)
  ------------------
                  if (mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, &disk_number) == MZ_OK)
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1116:9): [True: 0, False: 2.47k]
  ------------------
 1117|      0|        zip->disk_number_with_cd = (uint32_t)disk_number;
 1118|  2.47k|    if (mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_SIZE, &disk_size) == MZ_OK && disk_size > 0)
  ------------------
  |  |   26|  2.47k|#define MZ_STREAM_PROP_DISK_SIZE        (7)
  ------------------
                  if (mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_SIZE, &disk_size) == MZ_OK && disk_size > 0)
  ------------------
  |  |   21|  4.94k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1118:9): [True: 0, False: 2.47k]
  |  Branch (1118:97): [True: 0, False: 0]
  ------------------
 1119|      0|        zip->disk_number_with_cd += 1;
 1120|  2.47k|    mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, -1);
  ------------------
  |  |   27|  2.47k|#define MZ_STREAM_PROP_DISK_NUMBER      (8)
  ------------------
 1121|  2.47k|    if ((zip->disk_number_with_cd > 0) && (zip->open_mode & MZ_OPEN_MODE_APPEND)) {
  ------------------
  |  |   53|      0|#define MZ_OPEN_MODE_APPEND    (0x04)
  ------------------
  |  Branch (1121:9): [True: 0, False: 2.47k]
  |  Branch (1121:43): [True: 0, False: 0]
  ------------------
 1122|       |        /* Overwrite existing central directory if using split disks */
 1123|      0|        mz_stream_seek(zip->stream, 0, MZ_SEEK_SET);
  ------------------
  |  |   59|      0|#define MZ_SEEK_SET (0)
  ------------------
 1124|      0|    }
 1125|       |
 1126|  2.47k|    zip->cd_offset = mz_stream_tell(zip->stream);
 1127|  2.47k|    mz_stream_seek(zip->cd_mem_stream, 0, MZ_SEEK_END);
  ------------------
  |  |   61|  2.47k|#define MZ_SEEK_END (2)
  ------------------
 1128|  2.47k|    zip->cd_size = (uint32_t)mz_stream_tell(zip->cd_mem_stream);
 1129|  2.47k|    mz_stream_seek(zip->cd_mem_stream, 0, MZ_SEEK_SET);
  ------------------
  |  |   59|  2.47k|#define MZ_SEEK_SET (0)
  ------------------
 1130|       |
 1131|  2.47k|    err = mz_stream_copy(zip->stream, zip->cd_mem_stream, (int32_t)zip->cd_size);
 1132|       |
 1133|  2.47k|    mz_zip_print("Zip - Write cd (disk %" PRId32 " entries %" PRId64 " offset %" PRId64 " size %" PRId64 ")\n",
 1134|  2.47k|                 zip->disk_number_with_cd, zip->number_entry, zip->cd_offset, zip->cd_size);
 1135|       |
 1136|  2.47k|    if (zip->cd_size == 0 && zip->number_entry > 0) {
  ------------------
  |  Branch (1136:9): [True: 130, False: 2.34k]
  |  Branch (1136:30): [True: 0, False: 130]
  ------------------
 1137|       |        /* Zip does not contain central directory, open with recovery option */
 1138|      0|        return MZ_FORMAT_ERROR;
  ------------------
  |  |   32|      0|#define MZ_FORMAT_ERROR   (-103)
  ------------------
 1139|      0|    }
 1140|       |
 1141|       |    /* Write the ZIP64 central directory header */
 1142|  2.47k|    if (zip->cd_offset >= UINT32_MAX || zip->number_entry >= UINT16_MAX) {
  ------------------
  |  Branch (1142:9): [True: 0, False: 2.47k]
  |  Branch (1142:41): [True: 0, False: 2.47k]
  ------------------
 1143|      0|        zip64_eocd_pos_inzip = mz_stream_tell(zip->stream);
 1144|       |
 1145|      0|        err = mz_stream_write_uint32(zip->stream, MZ_ZIP_MAGIC_ENDHEADER64);
  ------------------
  |  |   67|      0|#define MZ_ZIP_MAGIC_ENDHEADER64        (0x06064b50)
  ------------------
 1146|       |
 1147|       |        /* Size of this 'zip64 end of central directory' */
 1148|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1148:13): [True: 0, False: 0]
  ------------------
 1149|      0|            err = mz_stream_write_uint64(zip->stream, (uint64_t)44);
 1150|       |        /* Version made by */
 1151|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1151:13): [True: 0, False: 0]
  ------------------
 1152|      0|            err = mz_stream_write_uint16(zip->stream, zip->version_madeby);
 1153|       |        /* Version needed */
 1154|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1154:13): [True: 0, False: 0]
  ------------------
 1155|      0|            err = mz_stream_write_uint16(zip->stream, (uint16_t)45);
 1156|       |        /* Number of this disk */
 1157|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1157:13): [True: 0, False: 0]
  ------------------
 1158|      0|            err = mz_stream_write_uint32(zip->stream, zip->disk_number_with_cd);
 1159|       |        /* Number of the disk with the start of the central directory */
 1160|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1160:13): [True: 0, False: 0]
  ------------------
 1161|      0|            err = mz_stream_write_uint32(zip->stream, zip->disk_number_with_cd);
 1162|       |        /* Total number of entries in the central dir on this disk */
 1163|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1163:13): [True: 0, False: 0]
  ------------------
 1164|      0|            err = mz_stream_write_uint64(zip->stream, zip->number_entry);
 1165|       |        /* Total number of entries in the central dir */
 1166|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1166:13): [True: 0, False: 0]
  ------------------
 1167|      0|            err = mz_stream_write_uint64(zip->stream, zip->number_entry);
 1168|       |        /* Size of the central directory */
 1169|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1169:13): [True: 0, False: 0]
  ------------------
 1170|      0|            err = mz_stream_write_int64(zip->stream, zip->cd_size);
 1171|       |        /* Offset of start of central directory with respect to the starting disk number */
 1172|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1172:13): [True: 0, False: 0]
  ------------------
 1173|      0|            err = mz_stream_write_int64(zip->stream, zip->cd_offset);
 1174|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1174:13): [True: 0, False: 0]
  ------------------
 1175|      0|            err = mz_stream_write_uint32(zip->stream, MZ_ZIP_MAGIC_ENDLOCHEADER64);
  ------------------
  |  |   68|      0|#define MZ_ZIP_MAGIC_ENDLOCHEADER64     (0x07064b50)
  ------------------
 1176|       |
 1177|       |        /* Number of the disk with the start of the central directory */
 1178|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1178:13): [True: 0, False: 0]
  ------------------
 1179|      0|            err = mz_stream_write_uint32(zip->stream, zip->disk_number_with_cd);
 1180|       |        /* Relative offset to the end of zip64 central directory */
 1181|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1181:13): [True: 0, False: 0]
  ------------------
 1182|      0|            err = mz_stream_write_int64(zip->stream, zip64_eocd_pos_inzip);
 1183|       |        /* Number of the disk with the start of the central directory */
 1184|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1184:13): [True: 0, False: 0]
  ------------------
 1185|      0|            err = mz_stream_write_uint32(zip->stream, zip->disk_number_with_cd + 1);
 1186|      0|    }
 1187|       |
 1188|       |    /* Write the central directory header */
 1189|       |
 1190|       |    /* Signature */
 1191|  2.47k|    if (err == MZ_OK)
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1191:9): [True: 2.47k, False: 0]
  ------------------
 1192|  2.47k|        err = mz_stream_write_uint32(zip->stream, MZ_ZIP_MAGIC_ENDHEADER);
  ------------------
  |  |   65|  2.47k|#define MZ_ZIP_MAGIC_ENDHEADER          (0x06054b50)
  ------------------
 1193|       |    /* Number of this disk */
 1194|  2.47k|    if (err == MZ_OK)
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1194:9): [True: 2.47k, False: 0]
  ------------------
 1195|  2.47k|        err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->disk_number_with_cd);
 1196|       |    /* Number of the disk with the start of the central directory */
 1197|  2.47k|    if (err == MZ_OK)
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1197:9): [True: 2.47k, False: 0]
  ------------------
 1198|  2.47k|        err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->disk_number_with_cd);
 1199|       |    /* Total number of entries in the central dir on this disk */
 1200|  2.47k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1200:9): [True: 2.47k, False: 0]
  ------------------
 1201|  2.47k|        if (zip->number_entry >= UINT16_MAX)
  ------------------
  |  Branch (1201:13): [True: 0, False: 2.47k]
  ------------------
 1202|      0|            err = mz_stream_write_uint16(zip->stream, UINT16_MAX);
 1203|  2.47k|        else
 1204|  2.47k|            err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->number_entry);
 1205|  2.47k|    }
 1206|       |    /* Total number of entries in the central dir */
 1207|  2.47k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1207:9): [True: 2.47k, False: 0]
  ------------------
 1208|  2.47k|        if (zip->number_entry >= UINT16_MAX)
  ------------------
  |  Branch (1208:13): [True: 0, False: 2.47k]
  ------------------
 1209|      0|            err = mz_stream_write_uint16(zip->stream, UINT16_MAX);
 1210|  2.47k|        else
 1211|  2.47k|            err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->number_entry);
 1212|  2.47k|    }
 1213|       |    /* Size of the central directory */
 1214|  2.47k|    if (err == MZ_OK)
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1214:9): [True: 2.47k, False: 0]
  ------------------
 1215|  2.47k|        err = mz_stream_write_uint32(zip->stream, (uint32_t)zip->cd_size);
 1216|       |    /* Offset of start of central directory with respect to the starting disk number */
 1217|  2.47k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1217:9): [True: 2.47k, False: 0]
  ------------------
 1218|  2.47k|        if (zip->cd_offset >= UINT32_MAX)
  ------------------
  |  Branch (1218:13): [True: 0, False: 2.47k]
  ------------------
 1219|      0|            err = mz_stream_write_uint32(zip->stream, UINT32_MAX);
 1220|  2.47k|        else
 1221|  2.47k|            err = mz_stream_write_uint32(zip->stream, (uint32_t)zip->cd_offset);
 1222|  2.47k|    }
 1223|       |
 1224|       |    /* Write global comment */
 1225|  2.47k|    if (zip->comment) {
  ------------------
  |  Branch (1225:9): [True: 0, False: 2.47k]
  ------------------
 1226|      0|        comment_size = (int32_t)strlen(zip->comment);
 1227|      0|        if (comment_size > UINT16_MAX)
  ------------------
  |  Branch (1227:13): [True: 0, False: 0]
  ------------------
 1228|      0|            comment_size = UINT16_MAX;
 1229|      0|    }
 1230|  2.47k|    if (err == MZ_OK)
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1230:9): [True: 2.47k, False: 0]
  ------------------
 1231|  2.47k|        err = mz_stream_write_uint16(zip->stream, (uint16_t)comment_size);
 1232|  2.47k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1232:9): [True: 2.47k, False: 0]
  ------------------
 1233|  2.47k|        if (mz_stream_write(zip->stream, zip->comment, comment_size) != comment_size)
  ------------------
  |  Branch (1233:13): [True: 0, False: 2.47k]
  ------------------
 1234|      0|            err = MZ_READ_ERROR;
  ------------------
  |  |   44|      0|#define MZ_READ_ERROR     (-115)
  ------------------
 1235|  2.47k|    }
 1236|  2.47k|    return err;
 1237|  2.47k|}
mz_zip.c:mz_zip_entry_open_int:
 1687|  2.47k|static int32_t mz_zip_entry_open_int(void *handle, uint8_t raw, int16_t compress_level, const char *password) {
 1688|  2.47k|    mz_zip *zip = (mz_zip *)handle;
 1689|  2.47k|    int64_t max_total_in = 0;
 1690|  2.47k|    int64_t header_size = 0;
 1691|  2.47k|    int64_t footer_size = 0;
 1692|  2.47k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
 1693|  2.47k|    uint8_t use_crypt = 0;
 1694|       |
 1695|  2.47k|    if (!zip)
  ------------------
  |  Branch (1695:9): [True: 0, False: 2.47k]
  ------------------
 1696|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1697|       |
 1698|  2.47k|    switch (zip->file_info.compression_method) {
 1699|    210|    case MZ_COMPRESS_METHOD_STORE:
  ------------------
  |  |   64|    210|#define MZ_COMPRESS_METHOD_STORE   (0)
  ------------------
  |  Branch (1699:5): [True: 210, False: 2.26k]
  ------------------
 1700|    347|    case MZ_COMPRESS_METHOD_DEFLATE:
  ------------------
  |  |   65|    347|#define MZ_COMPRESS_METHOD_DEFLATE (8)
  ------------------
  |  Branch (1700:5): [True: 137, False: 2.33k]
  ------------------
 1701|       |#ifdef HAVE_BZIP2
 1702|       |    case MZ_COMPRESS_METHOD_BZIP2:
 1703|       |#endif
 1704|       |#ifdef HAVE_LZMA
 1705|       |    case MZ_COMPRESS_METHOD_LZMA:
 1706|       |#endif
 1707|       |#if defined(HAVE_LZMA) || defined(HAVE_LIBCOMP)
 1708|       |    case MZ_COMPRESS_METHOD_XZ:
 1709|       |#endif
 1710|    347|#ifdef HAVE_PPMD
 1711|  2.42k|    case MZ_COMPRESS_METHOD_PPMD:
  ------------------
  |  |   70|  2.42k|#define MZ_COMPRESS_METHOD_PPMD    (98)
  ------------------
  |  Branch (1711:5): [True: 2.07k, False: 398]
  ------------------
 1712|  2.42k|#endif
 1713|       |#ifdef HAVE_ZSTD
 1714|       |    case MZ_COMPRESS_METHOD_ZSTD:
 1715|       |#endif
 1716|  2.42k|        err = MZ_OK;
  ------------------
  |  |   21|  2.42k|#define MZ_OK             (0)  /* zlib */
  ------------------
 1717|  2.42k|        break;
 1718|     51|    default:
  ------------------
  |  Branch (1718:5): [True: 51, False: 2.42k]
  ------------------
 1719|     51|        return MZ_SUPPORT_ERROR;
  ------------------
  |  |   38|     51|#define MZ_SUPPORT_ERROR  (-109)
  ------------------
 1720|  2.47k|    }
 1721|       |
 1722|       |#ifndef HAVE_WZAES
 1723|       |    if (zip->file_info.aes_version)
 1724|       |        return MZ_SUPPORT_ERROR;
 1725|       |#endif
 1726|       |
 1727|  2.42k|    zip->entry_raw = raw;
 1728|       |
 1729|  2.42k|    if ((zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED) && (password)) {
  ------------------
  |  |   79|  2.42k|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (1729:9): [True: 250, False: 2.17k]
  |  Branch (1729:58): [True: 250, False: 0]
  ------------------
 1730|    250|        if (zip->open_mode & MZ_OPEN_MODE_WRITE) {
  ------------------
  |  |   51|    250|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (1730:13): [True: 250, False: 0]
  ------------------
 1731|       |            /* Encrypt only when we are not trying to write raw and password is supplied. */
 1732|    250|            if (!zip->entry_raw)
  ------------------
  |  Branch (1732:17): [True: 250, False: 0]
  ------------------
 1733|    250|                use_crypt = 1;
 1734|    250|        } else if (zip->open_mode & MZ_OPEN_MODE_READ) {
  ------------------
  |  |   50|      0|#define MZ_OPEN_MODE_READ      (0x01)
  ------------------
  |  Branch (1734:20): [True: 0, False: 0]
  ------------------
 1735|       |            /* Decrypt only when password is supplied. Don't error when password */
 1736|       |            /* is not supplied as we may want to read the raw encrypted data. */
 1737|      0|            use_crypt = 1;
 1738|      0|        }
 1739|    250|    }
 1740|       |
 1741|  2.42k|    if ((err == MZ_OK) && (use_crypt)) {
  ------------------
  |  |   21|  2.42k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1741:9): [True: 2.42k, False: 0]
  |  Branch (1741:27): [True: 250, False: 2.17k]
  ------------------
 1742|    250|#ifdef HAVE_WZAES
 1743|    250|        if (zip->file_info.aes_version) {
  ------------------
  |  Branch (1743:13): [True: 0, False: 250]
  ------------------
 1744|      0|            zip->crypt_stream = mz_stream_wzaes_create();
 1745|      0|            if (!zip->crypt_stream)
  ------------------
  |  Branch (1745:17): [True: 0, False: 0]
  ------------------
 1746|      0|                return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1747|      0|            mz_stream_wzaes_set_password(zip->crypt_stream, password);
 1748|      0|            mz_stream_wzaes_set_strength(zip->crypt_stream, zip->file_info.aes_strength);
 1749|      0|        } else
 1750|    250|#endif
 1751|    250|        {
 1752|    250|#ifdef HAVE_PKCRYPT
 1753|    250|            uint8_t verify1 = (uint8_t)((zip->file_info.pk_verify >> 8) & 0xff);
 1754|    250|            uint8_t verify2 = (uint8_t)((zip->file_info.pk_verify) & 0xff);
 1755|       |
 1756|    250|            zip->crypt_stream = mz_stream_pkcrypt_create();
 1757|    250|            if (!zip->crypt_stream)
  ------------------
  |  Branch (1757:17): [True: 0, False: 250]
  ------------------
 1758|      0|                return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1759|    250|            mz_stream_pkcrypt_set_password(zip->crypt_stream, password);
 1760|    250|            mz_stream_pkcrypt_set_verify(zip->crypt_stream, verify1, verify2, zip->file_info.version_needed);
 1761|    250|#endif
 1762|    250|        }
 1763|    250|    }
 1764|       |
 1765|  2.42k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  2.42k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1765:9): [True: 2.42k, False: 0]
  ------------------
 1766|  2.42k|        if (!zip->crypt_stream)
  ------------------
  |  Branch (1766:13): [True: 2.17k, False: 250]
  ------------------
 1767|  2.17k|            zip->crypt_stream = mz_stream_raw_create();
 1768|  2.42k|        if (!zip->crypt_stream)
  ------------------
  |  Branch (1768:13): [True: 0, False: 2.42k]
  ------------------
 1769|      0|            return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1770|       |
 1771|  2.42k|        mz_stream_set_base(zip->crypt_stream, zip->stream);
 1772|       |
 1773|  2.42k|        err = mz_stream_open(zip->crypt_stream, NULL, zip->open_mode);
 1774|  2.42k|    }
 1775|       |
 1776|  2.42k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  2.42k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1776:9): [True: 2.42k, False: 0]
  ------------------
 1777|  2.42k|        if (zip->entry_raw || zip->file_info.compression_method == MZ_COMPRESS_METHOD_STORE)
  ------------------
  |  |   64|  2.42k|#define MZ_COMPRESS_METHOD_STORE   (0)
  ------------------
  |  Branch (1777:13): [True: 0, False: 2.42k]
  |  Branch (1777:31): [True: 210, False: 2.21k]
  ------------------
 1778|    210|            zip->compress_stream = mz_stream_raw_create();
 1779|  2.21k|#ifdef HAVE_ZLIB
 1780|  2.21k|        else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_DEFLATE)
  ------------------
  |  |   65|  2.21k|#define MZ_COMPRESS_METHOD_DEFLATE (8)
  ------------------
  |  Branch (1780:18): [True: 137, False: 2.07k]
  ------------------
 1781|    137|            zip->compress_stream = mz_stream_zlib_create();
 1782|  2.07k|#endif
 1783|       |#ifdef HAVE_BZIP2
 1784|       |        else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_BZIP2)
 1785|       |            zip->compress_stream = mz_stream_bzip_create();
 1786|       |#endif
 1787|       |#ifdef HAVE_LIBCOMP
 1788|       |        else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_DEFLATE ||
 1789|       |                 zip->file_info.compression_method == MZ_COMPRESS_METHOD_XZ) {
 1790|       |            zip->compress_stream = mz_stream_libcomp_create();
 1791|       |            if (zip->compress_stream) {
 1792|       |                mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_COMPRESS_METHOD,
 1793|       |                                         zip->file_info.compression_method);
 1794|       |            }
 1795|       |        }
 1796|       |#endif
 1797|       |#ifdef HAVE_LZMA
 1798|       |        else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_LZMA ||
 1799|       |                 zip->file_info.compression_method == MZ_COMPRESS_METHOD_XZ) {
 1800|       |            zip->compress_stream = mz_stream_lzma_create();
 1801|       |            if (zip->compress_stream) {
 1802|       |                mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_COMPRESS_METHOD,
 1803|       |                                         zip->file_info.compression_method);
 1804|       |            }
 1805|       |        }
 1806|       |#endif
 1807|  2.07k|#ifdef HAVE_PPMD
 1808|  2.07k|        else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_PPMD) {
  ------------------
  |  |   70|  2.07k|#define MZ_COMPRESS_METHOD_PPMD    (98)
  ------------------
  |  Branch (1808:18): [True: 2.07k, False: 0]
  ------------------
 1809|  2.07k|            zip->compress_stream = mz_stream_ppmd_create();
 1810|  2.07k|            if (zip->compress_stream) {
  ------------------
  |  Branch (1810:17): [True: 2.07k, False: 0]
  ------------------
 1811|  2.07k|                mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_IN_MAX,
  ------------------
  |  |   21|  2.07k|#define MZ_STREAM_PROP_TOTAL_IN_MAX     (2)
  ------------------
 1812|  2.07k|                                         zip->file_info.compressed_size);
 1813|  2.07k|            }
 1814|  2.07k|        }
 1815|      0|#endif
 1816|       |#ifdef HAVE_ZSTD
 1817|       |        else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_ZSTD)
 1818|       |            zip->compress_stream = mz_stream_zstd_create();
 1819|       |#endif
 1820|      0|        else
 1821|      0|            err = MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1822|  2.42k|    }
 1823|       |
 1824|  2.42k|    if (err == MZ_OK && !zip->compress_stream)
  ------------------
  |  |   21|  4.84k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1824:9): [True: 2.42k, False: 0]
  |  Branch (1824:25): [True: 0, False: 2.42k]
  ------------------
 1825|      0|        err = MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1826|       |
 1827|  2.42k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  2.42k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1827:9): [True: 2.42k, False: 0]
  ------------------
 1828|  2.42k|        if (zip->open_mode & MZ_OPEN_MODE_WRITE) {
  ------------------
  |  |   51|  2.42k|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (1828:13): [True: 2.42k, False: 0]
  ------------------
 1829|  2.42k|            mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_COMPRESS_LEVEL, compress_level);
  ------------------
  |  |   28|  2.42k|#define MZ_STREAM_PROP_COMPRESS_LEVEL   (9)
  ------------------
 1830|  2.42k|        } else {
 1831|      0|            int32_t set_end_of_stream = 0;
 1832|       |
 1833|      0|#ifndef HAVE_LIBCOMP
 1834|      0|            if (zip->entry_raw || zip->file_info.compression_method == MZ_COMPRESS_METHOD_STORE ||
  ------------------
  |  |   64|      0|#define MZ_COMPRESS_METHOD_STORE   (0)
  ------------------
  |  Branch (1834:17): [True: 0, False: 0]
  |  Branch (1834:35): [True: 0, False: 0]
  ------------------
 1835|      0|                zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED)
  ------------------
  |  |   79|      0|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (1835:17): [True: 0, False: 0]
  ------------------
 1836|      0|#endif
 1837|      0|            {
 1838|      0|                max_total_in = zip->file_info.compressed_size;
 1839|      0|                mz_stream_set_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_TOTAL_IN_MAX, max_total_in);
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX     (2)
  ------------------
 1840|       |
 1841|      0|                if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_HEADER_SIZE, &header_size) == MZ_OK)
  ------------------
  |  |   24|      0|#define MZ_STREAM_PROP_HEADER_SIZE      (5)
  ------------------
                              if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_HEADER_SIZE, &header_size) == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1841:21): [True: 0, False: 0]
  ------------------
 1842|      0|                    max_total_in -= header_size;
 1843|      0|                if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_FOOTER_SIZE, &footer_size) == MZ_OK)
  ------------------
  |  |   25|      0|#define MZ_STREAM_PROP_FOOTER_SIZE      (6)
  ------------------
                              if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_FOOTER_SIZE, &footer_size) == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1843:21): [True: 0, False: 0]
  ------------------
 1844|      0|                    max_total_in -= footer_size;
 1845|       |
 1846|      0|                mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_IN_MAX, max_total_in);
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX     (2)
  ------------------
 1847|      0|            }
 1848|       |
 1849|      0|            switch (zip->file_info.compression_method) {
  ------------------
  |  Branch (1849:21): [True: 0, False: 0]
  ------------------
 1850|      0|            case MZ_COMPRESS_METHOD_LZMA:
  ------------------
  |  |   67|      0|#define MZ_COMPRESS_METHOD_LZMA    (14)
  ------------------
  |  Branch (1850:13): [True: 0, False: 0]
  ------------------
 1851|      0|            case MZ_COMPRESS_METHOD_XZ:
  ------------------
  |  |   69|      0|#define MZ_COMPRESS_METHOD_XZ      (95)
  ------------------
  |  Branch (1851:13): [True: 0, False: 0]
  ------------------
 1852|      0|                set_end_of_stream = (zip->file_info.flag & MZ_ZIP_FLAG_LZMA_EOS_MARKER);
  ------------------
  |  |   80|      0|#define MZ_ZIP_FLAG_LZMA_EOS_MARKER    (1 << 1)
  ------------------
 1853|      0|                break;
 1854|      0|            case MZ_COMPRESS_METHOD_ZSTD:
  ------------------
  |  |   68|      0|#define MZ_COMPRESS_METHOD_ZSTD    (93)
  ------------------
  |  Branch (1854:13): [True: 0, False: 0]
  ------------------
 1855|      0|                set_end_of_stream = 1;
 1856|      0|                break;
 1857|      0|            }
 1858|       |
 1859|      0|            if (set_end_of_stream) {
  ------------------
  |  Branch (1859:17): [True: 0, False: 0]
  ------------------
 1860|      0|                mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_IN_MAX,
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX     (2)
  ------------------
 1861|      0|                                         zip->file_info.compressed_size);
 1862|      0|                mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_OUT_MAX,
  ------------------
  |  |   23|      0|#define MZ_STREAM_PROP_TOTAL_OUT_MAX    (4)
  ------------------
 1863|      0|                                         zip->file_info.uncompressed_size);
 1864|      0|            }
 1865|      0|        }
 1866|       |
 1867|  2.42k|        mz_stream_set_base(zip->compress_stream, zip->crypt_stream);
 1868|       |
 1869|  2.42k|        err = mz_stream_open(zip->compress_stream, NULL, zip->open_mode);
 1870|  2.42k|    }
 1871|       |
 1872|  2.42k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  2.42k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1872:9): [True: 2.34k, False: 79]
  ------------------
 1873|  2.34k|        zip->entry_opened = 1;
 1874|  2.34k|        zip->entry_crc32 = 0;
 1875|  2.34k|    } else {
 1876|     79|        mz_zip_entry_close_int(zip);
 1877|     79|    }
 1878|       |
 1879|  2.42k|    return err;
 1880|  2.42k|}
mz_zip.c:mz_zip_get_pk_verify:
  194|    252|static uint16_t mz_zip_get_pk_verify(uint32_t dos_date, uint64_t crc, uint16_t flag) {
  195|       |    /* Info-ZIP modification to ZipCrypto format: if bit 3 of the general
  196|       |     * purpose bit flag is set, it uses high byte of 16-bit File Time. */
  197|    252|    if (flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR)
  ------------------
  |  |   85|    252|#define MZ_ZIP_FLAG_DATA_DESCRIPTOR    (1 << 3)
  ------------------
  |  Branch (197:9): [True: 252, False: 0]
  ------------------
  198|    252|        return ((dos_date >> 16) & 0xff) << 8 | ((dos_date >> 8) & 0xff);
  199|      0|    return ((crc >> 16) & 0xff) << 8 | ((crc >> 24) & 0xff);
  200|    252|}
mz_zip.c:mz_zip_entry_write_header:
  596|  4.81k|static int32_t mz_zip_entry_write_header(void *stream, uint8_t local, mz_zip_file *file_info) {
  597|  4.81k|    uint64_t ntfs_time = 0;
  598|  4.81k|    uint32_t reserved = 0;
  599|  4.81k|    uint32_t dos_date = 0;
  600|  4.81k|    uint16_t extrafield_size = 0;
  601|  4.81k|    uint16_t field_type = 0;
  602|  4.81k|    uint16_t field_length = 0;
  603|  4.81k|    uint16_t field_length_zip64 = 0;
  604|  4.81k|    uint16_t field_length_ntfs = 0;
  605|  4.81k|    uint16_t field_length_aes = 0;
  606|  4.81k|    uint16_t field_length_unix1 = 0;
  607|  4.81k|    uint16_t filename_size = 0;
  608|  4.81k|    uint16_t filename_length = 0;
  609|  4.81k|    uint16_t linkname_size = 0;
  610|  4.81k|    uint16_t version_needed = 0;
  611|  4.81k|    int32_t comment_size = 0;
  612|  4.81k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  613|  4.81k|    int32_t err_mem = MZ_OK;
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  614|  4.81k|    uint8_t zip64 = 0;
  615|  4.81k|    uint8_t skip_aes = 0;
  616|  4.81k|    uint8_t mask = 0;
  617|  4.81k|    uint8_t write_end_slash = 0;
  618|  4.81k|    const char *filename = NULL;
  619|  4.81k|    char masked_name[64];
  620|  4.81k|    void *file_extra_stream = NULL;
  621|       |
  622|  4.81k|    if (!file_info)
  ------------------
  |  Branch (622:9): [True: 0, False: 4.81k]
  ------------------
  623|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  624|       |
  625|  4.81k|    if ((local) && (file_info->flag & MZ_ZIP_FLAG_MASK_LOCAL_INFO))
  ------------------
  |  |   87|  2.47k|#define MZ_ZIP_FLAG_MASK_LOCAL_INFO    (1 << 13)
  ------------------
  |  Branch (625:9): [True: 2.47k, False: 2.34k]
  |  Branch (625:20): [True: 174, False: 2.29k]
  ------------------
  626|    174|        mask = 1;
  627|       |
  628|       |    /* Determine if zip64 extra field is necessary */
  629|  4.81k|    err = mz_zip_entry_needs_zip64(file_info, local, &zip64);
  630|  4.81k|    if (err != MZ_OK)
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (630:9): [True: 0, False: 4.81k]
  ------------------
  631|      0|        return err;
  632|       |
  633|       |    /* Start calculating extra field sizes */
  634|  4.81k|    if (zip64) {
  ------------------
  |  Branch (634:9): [True: 2.13k, False: 2.68k]
  ------------------
  635|       |        /* Both compressed and uncompressed sizes must be included (at least in local header) */
  636|  2.13k|        field_length_zip64 = 8 + 8;
  637|  2.13k|        if ((!local) && (file_info->disk_offset >= UINT32_MAX))
  ------------------
  |  Branch (637:13): [True: 5, False: 2.12k]
  |  Branch (637:25): [True: 0, False: 5]
  ------------------
  638|      0|            field_length_zip64 += 8;
  639|       |
  640|  2.13k|        extrafield_size += 4;
  641|  2.13k|        extrafield_size += field_length_zip64;
  642|  2.13k|    }
  643|       |
  644|       |    /* Calculate extra field size and check for duplicates */
  645|  4.81k|    if (file_info->extrafield_size > 0) {
  ------------------
  |  Branch (645:9): [True: 0, False: 4.81k]
  ------------------
  646|      0|        file_extra_stream = mz_stream_mem_create();
  647|      0|        if (!file_extra_stream)
  ------------------
  |  Branch (647:13): [True: 0, False: 0]
  ------------------
  648|      0|            return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
  649|      0|        mz_stream_mem_set_buffer(file_extra_stream, (void *)file_info->extrafield, file_info->extrafield_size);
  650|       |
  651|      0|        do {
  652|      0|            err_mem = mz_stream_read_uint16(file_extra_stream, &field_type);
  653|      0|            if (err_mem == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (653:17): [True: 0, False: 0]
  ------------------
  654|      0|                err_mem = mz_stream_read_uint16(file_extra_stream, &field_length);
  655|      0|            if (err_mem != MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (655:17): [True: 0, False: 0]
  ------------------
  656|      0|                break;
  657|       |
  658|       |            /* Prefer incoming aes extensions over ours */
  659|      0|            if (field_type == MZ_ZIP_EXTENSION_AES)
  ------------------
  |  |   92|      0|#define MZ_ZIP_EXTENSION_AES   (0x9901)
  ------------------
  |  Branch (659:17): [True: 0, False: 0]
  ------------------
  660|      0|                skip_aes = 1;
  661|       |
  662|       |            /* Prefer our zip64, ntfs, unix1 extension over incoming */
  663|      0|            if (field_type != MZ_ZIP_EXTENSION_ZIP64 && field_type != MZ_ZIP_EXTENSION_NTFS &&
  ------------------
  |  |   90|      0|#define MZ_ZIP_EXTENSION_ZIP64 (0x0001)
  ------------------
                          if (field_type != MZ_ZIP_EXTENSION_ZIP64 && field_type != MZ_ZIP_EXTENSION_NTFS &&
  ------------------
  |  |   91|      0|#define MZ_ZIP_EXTENSION_NTFS  (0x000a)
  ------------------
  |  Branch (663:17): [True: 0, False: 0]
  |  Branch (663:57): [True: 0, False: 0]
  ------------------
  664|      0|                field_type != MZ_ZIP_EXTENSION_UNIX1)
  ------------------
  |  |   93|      0|#define MZ_ZIP_EXTENSION_UNIX1 (0x000d)
  ------------------
  |  Branch (664:17): [True: 0, False: 0]
  ------------------
  665|      0|                extrafield_size += 4 + field_length;
  666|       |
  667|      0|            if (err_mem == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (667:17): [True: 0, False: 0]
  ------------------
  668|      0|                err_mem = mz_stream_seek(file_extra_stream, field_length, MZ_SEEK_CUR);
  ------------------
  |  |   60|      0|#define MZ_SEEK_CUR (1)
  ------------------
  669|      0|        } while (err_mem == MZ_OK);
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (669:18): [True: 0, False: 0]
  ------------------
  670|      0|    }
  671|       |
  672|  4.81k|#ifdef HAVE_WZAES
  673|  4.81k|    if (!skip_aes) {
  ------------------
  |  Branch (673:9): [True: 4.81k, False: 0]
  ------------------
  674|  4.81k|        if ((file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version)) {
  ------------------
  |  |   79|  4.81k|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (674:13): [True: 502, False: 4.31k]
  |  Branch (674:58): [True: 0, False: 502]
  ------------------
  675|      0|            field_length_aes = 1 + 1 + 1 + 2 + 2;
  676|      0|            extrafield_size += 4 + field_length_aes;
  677|      0|        }
  678|  4.81k|    }
  679|       |#else
  680|       |    MZ_UNUSED(field_length_aes);
  681|       |    MZ_UNUSED(skip_aes);
  682|       |#endif
  683|       |    /* NTFS timestamps */
  684|  4.81k|    if ((file_info->modified_date != 0) && (file_info->accessed_date != 0) && (file_info->creation_date != 0) &&
  ------------------
  |  Branch (684:9): [True: 0, False: 4.81k]
  |  Branch (684:44): [True: 0, False: 0]
  |  Branch (684:79): [True: 0, False: 0]
  ------------------
  685|      0|        (!mask)) {
  ------------------
  |  Branch (685:9): [True: 0, False: 0]
  ------------------
  686|      0|        field_length_ntfs = 8 + 8 + 8 + 4 + 2 + 2;
  687|      0|        extrafield_size += 4 + field_length_ntfs;
  688|      0|    }
  689|       |
  690|       |    /* Unix1 symbolic links */
  691|  4.81k|    if (file_info->linkname && *file_info->linkname != 0) {
  ------------------
  |  Branch (691:9): [True: 4.81k, False: 0]
  |  Branch (691:32): [True: 0, False: 4.81k]
  ------------------
  692|      0|        linkname_size = (uint16_t)strlen(file_info->linkname);
  693|      0|        field_length_unix1 = 12 + linkname_size;
  694|      0|        extrafield_size += 4 + field_length_unix1;
  695|      0|    }
  696|       |
  697|  4.81k|    if (local)
  ------------------
  |  Branch (697:9): [True: 2.47k, False: 2.34k]
  ------------------
  698|  2.47k|        err = mz_stream_write_uint32(stream, MZ_ZIP_MAGIC_LOCALHEADER);
  ------------------
  |  |   61|  2.47k|#define MZ_ZIP_MAGIC_LOCALHEADER        (0x04034b50)
  ------------------
  699|  2.34k|    else {
  700|  2.34k|        err = mz_stream_write_uint32(stream, MZ_ZIP_MAGIC_CENTRALHEADER);
  ------------------
  |  |   63|  2.34k|#define MZ_ZIP_MAGIC_CENTRALHEADER      (0x02014b50)
  ------------------
  701|  2.34k|        if (err == MZ_OK)
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (701:13): [True: 2.34k, False: 0]
  ------------------
  702|  2.34k|            err = mz_stream_write_uint16(stream, file_info->version_madeby);
  703|  2.34k|    }
  704|       |
  705|       |    /* Calculate version needed to extract */
  706|  4.81k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (706:9): [True: 4.81k, False: 0]
  ------------------
  707|  4.81k|        version_needed = file_info->version_needed;
  708|  4.81k|        if (version_needed == 0) {
  ------------------
  |  Branch (708:13): [True: 4.81k, False: 0]
  ------------------
  709|  4.81k|            version_needed = 20;
  710|  4.81k|            if (zip64)
  ------------------
  |  Branch (710:17): [True: 2.13k, False: 2.68k]
  ------------------
  711|  2.13k|                version_needed = 45;
  712|       |#ifdef HAVE_BZIP2
  713|       |            if (file_info->compression_method == MZ_COMPRESS_METHOD_BZIP2)
  714|       |                version_needed = 46;
  715|       |#endif
  716|  4.81k|#ifdef HAVE_WZAES
  717|  4.81k|            if ((file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version))
  ------------------
  |  |   79|  4.81k|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (717:17): [True: 502, False: 4.31k]
  |  Branch (717:62): [True: 0, False: 502]
  ------------------
  718|      0|                version_needed = 51;
  719|  4.81k|#endif
  720|  4.81k|#if defined(HAVE_LZMA) || defined(HAVE_LIBCOMP) || defined(HAVE_PPMD)
  721|  4.81k|            if ((file_info->compression_method == MZ_COMPRESS_METHOD_LZMA) ||
  ------------------
  |  |   67|  4.81k|#define MZ_COMPRESS_METHOD_LZMA    (14)
  ------------------
  |  Branch (721:17): [True: 5, False: 4.80k]
  ------------------
  722|  4.80k|                (file_info->compression_method == MZ_COMPRESS_METHOD_PPMD) ||
  ------------------
  |  |   70|  4.80k|#define MZ_COMPRESS_METHOD_PPMD    (98)
  ------------------
  |  Branch (722:17): [True: 4.10k, False: 709]
  ------------------
  723|    709|                (file_info->compression_method == MZ_COMPRESS_METHOD_XZ))
  ------------------
  |  |   69|    709|#define MZ_COMPRESS_METHOD_XZ      (95)
  ------------------
  |  Branch (723:17): [True: 2, False: 707]
  ------------------
  724|  4.10k|                version_needed = 63;
  725|  4.81k|#endif
  726|  4.81k|        }
  727|  4.81k|        err = mz_stream_write_uint16(stream, version_needed);
  728|  4.81k|    }
  729|  4.81k|    if (err == MZ_OK)
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (729:9): [True: 4.81k, False: 0]
  ------------------
  730|  4.81k|        err = mz_stream_write_uint16(stream, file_info->flag);
  731|  4.81k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (731:9): [True: 4.81k, False: 0]
  ------------------
  732|  4.81k|#ifdef HAVE_WZAES
  733|  4.81k|        if ((file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version))
  ------------------
  |  |   79|  4.81k|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (733:13): [True: 502, False: 4.31k]
  |  Branch (733:58): [True: 0, False: 502]
  ------------------
  734|      0|            err = mz_stream_write_uint16(stream, MZ_COMPRESS_METHOD_AES);
  ------------------
  |  |   71|      0|#define MZ_COMPRESS_METHOD_AES     (99)
  ------------------
  735|  4.81k|        else
  736|  4.81k|#endif
  737|  4.81k|            err = mz_stream_write_uint16(stream, file_info->compression_method);
  738|  4.81k|    }
  739|  4.81k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (739:9): [True: 4.81k, False: 0]
  ------------------
  740|  4.81k|        if (file_info->modified_date != 0 && !mask)
  ------------------
  |  Branch (740:13): [True: 0, False: 4.81k]
  |  Branch (740:46): [True: 0, False: 0]
  ------------------
  741|      0|            dos_date = mz_zip_time_t_to_dos_date(file_info->modified_date);
  742|  4.81k|        err = mz_stream_write_uint32(stream, dos_date);
  743|  4.81k|    }
  744|       |
  745|  4.81k|    if (err == MZ_OK)
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (745:9): [True: 4.81k, False: 0]
  ------------------
  746|  4.81k|        err = mz_zip_entry_write_crc_sizes(stream, zip64, mask, file_info);
  747|       |
  748|  4.81k|    if (mask) {
  ------------------
  |  Branch (748:9): [True: 174, False: 4.64k]
  ------------------
  749|    174|        snprintf(masked_name, sizeof(masked_name), "%" PRIx32 "_%" PRIx64, file_info->disk_number,
  750|    174|                 file_info->disk_offset);
  751|    174|        filename = masked_name;
  752|  4.64k|    } else {
  753|  4.64k|        filename = file_info->filename;
  754|  4.64k|    }
  755|       |
  756|  4.81k|    filename_length = (uint16_t)strlen(filename);
  757|  4.81k|    filename_size += filename_length;
  758|       |
  759|  4.81k|    if ((mz_zip_attrib_is_dir(file_info->external_fa, file_info->version_madeby) == MZ_OK) &&
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (759:9): [True: 0, False: 4.81k]
  ------------------
  760|      0|        ((filename[filename_length - 1] != '/') && (filename[filename_length - 1] != '\\'))) {
  ------------------
  |  Branch (760:10): [True: 0, False: 0]
  |  Branch (760:52): [True: 0, False: 0]
  ------------------
  761|      0|        filename_size += 1;
  762|      0|        write_end_slash = 1;
  763|      0|    }
  764|       |
  765|  4.81k|    if (err == MZ_OK)
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (765:9): [True: 4.81k, False: 0]
  ------------------
  766|  4.81k|        err = mz_stream_write_uint16(stream, filename_size);
  767|  4.81k|    if (err == MZ_OK)
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (767:9): [True: 4.81k, False: 0]
  ------------------
  768|  4.81k|        err = mz_stream_write_uint16(stream, extrafield_size);
  769|       |
  770|  4.81k|    if (!local) {
  ------------------
  |  Branch (770:9): [True: 2.34k, False: 2.47k]
  ------------------
  771|  2.34k|        if (file_info->comment) {
  ------------------
  |  Branch (771:13): [True: 2.34k, False: 0]
  ------------------
  772|  2.34k|            comment_size = (int32_t)strlen(file_info->comment);
  773|  2.34k|            if (comment_size > UINT16_MAX)
  ------------------
  |  Branch (773:17): [True: 0, False: 2.34k]
  ------------------
  774|      0|                comment_size = UINT16_MAX;
  775|  2.34k|        }
  776|  2.34k|        if (err == MZ_OK)
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (776:13): [True: 2.34k, False: 0]
  ------------------
  777|  2.34k|            err = mz_stream_write_uint16(stream, (uint16_t)comment_size);
  778|  2.34k|        if (err == MZ_OK)
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (778:13): [True: 2.34k, False: 0]
  ------------------
  779|  2.34k|            err = mz_stream_write_uint16(stream, (uint16_t)file_info->disk_number);
  780|  2.34k|        if (err == MZ_OK)
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (780:13): [True: 2.34k, False: 0]
  ------------------
  781|  2.34k|            err = mz_stream_write_uint16(stream, file_info->internal_fa);
  782|  2.34k|        if (err == MZ_OK)
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (782:13): [True: 2.34k, False: 0]
  ------------------
  783|  2.34k|            err = mz_stream_write_uint32(stream, file_info->external_fa);
  784|  2.34k|        if (err == MZ_OK) {
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (784:13): [True: 2.34k, False: 0]
  ------------------
  785|  2.34k|            if (file_info->disk_offset >= UINT32_MAX)
  ------------------
  |  Branch (785:17): [True: 0, False: 2.34k]
  ------------------
  786|      0|                err = mz_stream_write_uint32(stream, UINT32_MAX);
  787|  2.34k|            else
  788|  2.34k|                err = mz_stream_write_uint32(stream, (uint32_t)file_info->disk_offset);
  789|  2.34k|        }
  790|  2.34k|    }
  791|       |
  792|  4.81k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (792:9): [True: 4.81k, False: 0]
  ------------------
  793|  4.81k|        const char *next = filename;
  794|  4.81k|        int32_t left = filename_length;
  795|       |#if defined(_WIN32)
  796|       |        const char *backslash = NULL;
  797|       |
  798|       |        /* Ensure all slashes are written as forward slashes according to 4.4.17.1 */
  799|       |        while ((err == MZ_OK) && (backslash = strchr(next, '\\'))) {
  800|       |            int32_t part_length = (int32_t)(backslash - next);
  801|       |
  802|       |            if (mz_stream_write(stream, next, part_length) != part_length || mz_stream_write(stream, "/", 1) != 1)
  803|       |                err = MZ_WRITE_ERROR;
  804|       |
  805|       |            left -= part_length + 1;
  806|       |            next = backslash + 1;
  807|       |        }
  808|       |#endif
  809|  4.81k|        if (err == MZ_OK && left > 0) {
  ------------------
  |  |   21|  9.62k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (809:13): [True: 4.81k, False: 0]
  |  Branch (809:29): [True: 4.81k, False: 0]
  ------------------
  810|  4.81k|            if (mz_stream_write(stream, next, left) != left)
  ------------------
  |  Branch (810:17): [True: 0, False: 4.81k]
  ------------------
  811|      0|                err = MZ_WRITE_ERROR;
  ------------------
  |  |   45|      0|#define MZ_WRITE_ERROR    (-116)
  ------------------
  812|  4.81k|        }
  813|       |
  814|       |        /* Ensure that directories have a slash appended to them for compatibility */
  815|  4.81k|        if (err == MZ_OK && write_end_slash)
  ------------------
  |  |   21|  9.62k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (815:13): [True: 4.81k, False: 0]
  |  Branch (815:29): [True: 0, False: 4.81k]
  ------------------
  816|      0|            err = mz_stream_write_uint8(stream, '/');
  817|  4.81k|    }
  818|       |
  819|       |    /* Write ZIP64 extra field first so we can update sizes later if data descriptor not used */
  820|  4.81k|    if ((err == MZ_OK) && (zip64)) {
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (820:9): [True: 4.81k, False: 0]
  |  Branch (820:27): [True: 2.13k, False: 2.68k]
  ------------------
  821|  2.13k|        err = mz_zip_extrafield_write(stream, MZ_ZIP_EXTENSION_ZIP64, field_length_zip64);
  ------------------
  |  |   90|  2.13k|#define MZ_ZIP_EXTENSION_ZIP64 (0x0001)
  ------------------
  822|  2.13k|        if (err == MZ_OK) {
  ------------------
  |  |   21|  2.13k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (822:13): [True: 2.13k, False: 0]
  ------------------
  823|  2.13k|            if (mask)
  ------------------
  |  Branch (823:17): [True: 163, False: 1.96k]
  ------------------
  824|    163|                err = mz_stream_write_int64(stream, 0);
  825|  1.96k|            else
  826|  1.96k|                err = mz_stream_write_int64(stream, file_info->uncompressed_size);
  827|  2.13k|        }
  828|  2.13k|        if (err == MZ_OK)
  ------------------
  |  |   21|  2.13k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (828:13): [True: 2.13k, False: 0]
  ------------------
  829|  2.13k|            err = mz_stream_write_int64(stream, file_info->compressed_size);
  830|  2.13k|        if ((err == MZ_OK) && (!local) && (file_info->disk_offset >= UINT32_MAX))
  ------------------
  |  |   21|  2.13k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (830:13): [True: 2.13k, False: 0]
  |  Branch (830:31): [True: 5, False: 2.12k]
  |  Branch (830:43): [True: 0, False: 5]
  ------------------
  831|      0|            err = mz_stream_write_int64(stream, file_info->disk_offset);
  832|  2.13k|        if ((err == MZ_OK) && (!local) && (file_info->disk_number >= UINT16_MAX))
  ------------------
  |  |   21|  2.13k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (832:13): [True: 2.13k, False: 0]
  |  Branch (832:31): [True: 5, False: 2.12k]
  |  Branch (832:43): [True: 0, False: 5]
  ------------------
  833|      0|            err = mz_stream_write_uint32(stream, file_info->disk_number);
  834|  2.13k|    }
  835|       |    /* Write NTFS extra field */
  836|  4.81k|    if ((err == MZ_OK) && (field_length_ntfs > 0)) {
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (836:9): [True: 4.81k, False: 0]
  |  Branch (836:27): [True: 0, False: 4.81k]
  ------------------
  837|      0|        err = mz_zip_extrafield_write(stream, MZ_ZIP_EXTENSION_NTFS, field_length_ntfs);
  ------------------
  |  |   91|      0|#define MZ_ZIP_EXTENSION_NTFS  (0x000a)
  ------------------
  838|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (838:13): [True: 0, False: 0]
  ------------------
  839|      0|            err = mz_stream_write_uint32(stream, reserved);
  840|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (840:13): [True: 0, False: 0]
  ------------------
  841|      0|            err = mz_stream_write_uint16(stream, 0x01);
  842|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (842:13): [True: 0, False: 0]
  ------------------
  843|      0|            err = mz_stream_write_uint16(stream, field_length_ntfs - 8);
  844|      0|        if (err == MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (844:13): [True: 0, False: 0]
  ------------------
  845|      0|            mz_zip_unix_to_ntfs_time(file_info->modified_date, &ntfs_time);
  846|      0|            err = mz_stream_write_uint64(stream, ntfs_time);
  847|      0|        }
  848|      0|        if (err == MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (848:13): [True: 0, False: 0]
  ------------------
  849|      0|            mz_zip_unix_to_ntfs_time(file_info->accessed_date, &ntfs_time);
  850|      0|            err = mz_stream_write_uint64(stream, ntfs_time);
  851|      0|        }
  852|      0|        if (err == MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (852:13): [True: 0, False: 0]
  ------------------
  853|      0|            mz_zip_unix_to_ntfs_time(file_info->creation_date, &ntfs_time);
  854|      0|            err = mz_stream_write_uint64(stream, ntfs_time);
  855|      0|        }
  856|      0|    }
  857|       |    /* Write UNIX extra block extra field */
  858|  4.81k|    if ((err == MZ_OK) && (field_length_unix1 > 0)) {
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (858:9): [True: 4.81k, False: 0]
  |  Branch (858:27): [True: 0, False: 4.81k]
  ------------------
  859|      0|        err = mz_zip_extrafield_write(stream, MZ_ZIP_EXTENSION_UNIX1, field_length_unix1);
  ------------------
  |  |   93|      0|#define MZ_ZIP_EXTENSION_UNIX1 (0x000d)
  ------------------
  860|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (860:13): [True: 0, False: 0]
  ------------------
  861|      0|            err = mz_stream_write_uint32(stream, (uint32_t)file_info->accessed_date);
  862|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (862:13): [True: 0, False: 0]
  ------------------
  863|      0|            err = mz_stream_write_uint32(stream, (uint32_t)file_info->modified_date);
  864|      0|        if (err == MZ_OK) /* User id */
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (864:13): [True: 0, False: 0]
  ------------------
  865|      0|            err = mz_stream_write_uint16(stream, 0);
  866|      0|        if (err == MZ_OK) /* Group id */
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (866:13): [True: 0, False: 0]
  ------------------
  867|      0|            err = mz_stream_write_uint16(stream, 0);
  868|      0|        if (err == MZ_OK && linkname_size > 0) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (868:13): [True: 0, False: 0]
  |  Branch (868:29): [True: 0, False: 0]
  ------------------
  869|      0|            if (mz_stream_write(stream, file_info->linkname, linkname_size) != linkname_size)
  ------------------
  |  Branch (869:17): [True: 0, False: 0]
  ------------------
  870|      0|                err = MZ_WRITE_ERROR;
  ------------------
  |  |   45|      0|#define MZ_WRITE_ERROR    (-116)
  ------------------
  871|      0|        }
  872|      0|    }
  873|  4.81k|#ifdef HAVE_WZAES
  874|       |    /* Write AES extra field */
  875|  4.81k|    if ((err == MZ_OK) && (!skip_aes) && (file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version)) {
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
                  if ((err == MZ_OK) && (!skip_aes) && (file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version)) {
  ------------------
  |  |   79|  4.81k|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (875:9): [True: 4.81k, False: 0]
  |  Branch (875:27): [True: 4.81k, False: 0]
  |  Branch (875:42): [True: 502, False: 4.31k]
  |  Branch (875:87): [True: 0, False: 502]
  ------------------
  876|      0|        err = mz_zip_extrafield_write(stream, MZ_ZIP_EXTENSION_AES, field_length_aes);
  ------------------
  |  |   92|      0|#define MZ_ZIP_EXTENSION_AES   (0x9901)
  ------------------
  877|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (877:13): [True: 0, False: 0]
  ------------------
  878|      0|            err = mz_stream_write_uint16(stream, file_info->aes_version);
  879|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (879:13): [True: 0, False: 0]
  ------------------
  880|      0|            err = mz_stream_write_uint8(stream, 'A');
  881|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (881:13): [True: 0, False: 0]
  ------------------
  882|      0|            err = mz_stream_write_uint8(stream, 'E');
  883|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (883:13): [True: 0, False: 0]
  ------------------
  884|      0|            err = mz_stream_write_uint8(stream, file_info->aes_strength);
  885|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (885:13): [True: 0, False: 0]
  ------------------
  886|      0|            err = mz_stream_write_uint16(stream, file_info->compression_method);
  887|      0|    }
  888|  4.81k|#endif
  889|       |
  890|  4.81k|    if (file_info->extrafield_size > 0) {
  ------------------
  |  Branch (890:9): [True: 0, False: 4.81k]
  ------------------
  891|      0|        err_mem = mz_stream_mem_seek(file_extra_stream, 0, MZ_SEEK_SET);
  ------------------
  |  |   59|      0|#define MZ_SEEK_SET (0)
  ------------------
  892|      0|        while (err == MZ_OK && err_mem == MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
                      while (err == MZ_OK && err_mem == MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (892:16): [True: 0, False: 0]
  |  Branch (892:32): [True: 0, False: 0]
  ------------------
  893|      0|            err_mem = mz_stream_read_uint16(file_extra_stream, &field_type);
  894|      0|            if (err_mem == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (894:17): [True: 0, False: 0]
  ------------------
  895|      0|                err_mem = mz_stream_read_uint16(file_extra_stream, &field_length);
  896|      0|            if (err_mem != MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (896:17): [True: 0, False: 0]
  ------------------
  897|      0|                break;
  898|       |
  899|       |            /* Prefer our zip 64, ntfs, unix1 extensions over incoming */
  900|      0|            if (field_type == MZ_ZIP_EXTENSION_ZIP64 || field_type == MZ_ZIP_EXTENSION_NTFS ||
  ------------------
  |  |   90|      0|#define MZ_ZIP_EXTENSION_ZIP64 (0x0001)
  ------------------
                          if (field_type == MZ_ZIP_EXTENSION_ZIP64 || field_type == MZ_ZIP_EXTENSION_NTFS ||
  ------------------
  |  |   91|      0|#define MZ_ZIP_EXTENSION_NTFS  (0x000a)
  ------------------
  |  Branch (900:17): [True: 0, False: 0]
  |  Branch (900:57): [True: 0, False: 0]
  ------------------
  901|      0|                field_type == MZ_ZIP_EXTENSION_UNIX1) {
  ------------------
  |  |   93|      0|#define MZ_ZIP_EXTENSION_UNIX1 (0x000d)
  ------------------
  |  Branch (901:17): [True: 0, False: 0]
  ------------------
  902|      0|                err_mem = mz_stream_seek(file_extra_stream, field_length, MZ_SEEK_CUR);
  ------------------
  |  |   60|      0|#define MZ_SEEK_CUR (1)
  ------------------
  903|      0|                continue;
  904|      0|            }
  905|       |
  906|      0|            err = mz_stream_write_uint16(stream, field_type);
  907|      0|            if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (907:17): [True: 0, False: 0]
  ------------------
  908|      0|                err = mz_stream_write_uint16(stream, field_length);
  909|      0|            if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (909:17): [True: 0, False: 0]
  ------------------
  910|      0|                err = mz_stream_copy(stream, file_extra_stream, field_length);
  911|      0|        }
  912|       |
  913|      0|        mz_stream_mem_delete(&file_extra_stream);
  914|      0|    }
  915|       |
  916|  4.81k|    if (err == MZ_OK && !local && file_info->comment) {
  ------------------
  |  |   21|  9.62k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (916:9): [True: 4.81k, False: 0]
  |  Branch (916:25): [True: 2.34k, False: 2.47k]
  |  Branch (916:35): [True: 2.34k, False: 0]
  ------------------
  917|  2.34k|        if (mz_stream_write(stream, file_info->comment, file_info->comment_size) != file_info->comment_size)
  ------------------
  |  Branch (917:13): [True: 0, False: 2.34k]
  ------------------
  918|      0|            err = MZ_WRITE_ERROR;
  ------------------
  |  |   45|      0|#define MZ_WRITE_ERROR    (-116)
  ------------------
  919|  2.34k|    }
  920|       |
  921|  4.81k|    return err;
  922|  4.81k|}
mz_zip.c:mz_zip_entry_close_int:
 1672|  2.42k|static int32_t mz_zip_entry_close_int(void *handle) {
 1673|  2.42k|    mz_zip *zip = (mz_zip *)handle;
 1674|       |
 1675|  2.42k|    if (zip->crypt_stream)
  ------------------
  |  Branch (1675:9): [True: 2.42k, False: 0]
  ------------------
 1676|  2.42k|        mz_stream_delete(&zip->crypt_stream);
 1677|  2.42k|    zip->crypt_stream = NULL;
 1678|  2.42k|    if (zip->compress_stream)
  ------------------
  |  Branch (1678:9): [True: 2.42k, False: 0]
  ------------------
 1679|  2.42k|        mz_stream_delete(&zip->compress_stream);
 1680|  2.42k|    zip->compress_stream = NULL;
 1681|       |
 1682|  2.42k|    zip->entry_opened = 0;
 1683|       |
 1684|  2.42k|    return MZ_OK;
  ------------------
  |  |   21|  2.42k|#define MZ_OK             (0)  /* zlib */
  ------------------
 1685|  2.42k|}
mz_zip.c:mz_zip_entry_needs_zip64:
  553|  7.15k|static int32_t mz_zip_entry_needs_zip64(mz_zip_file *file_info, uint8_t local, uint8_t *zip64) {
  554|  7.15k|    uint32_t max_uncompressed_size = UINT32_MAX;
  555|  7.15k|    uint8_t needs_zip64 = 0;
  556|       |
  557|  7.15k|    if (!zip64)
  ------------------
  |  Branch (557:9): [True: 0, False: 7.15k]
  ------------------
  558|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  559|       |
  560|  7.15k|    *zip64 = 0;
  561|       |
  562|  7.15k|    if (local) {
  ------------------
  |  Branch (562:9): [True: 4.81k, False: 2.34k]
  ------------------
  563|       |        /* At local header we might not know yet whether compressed size will overflow unsigned
  564|       |           32-bit integer which might happen for high entropy data so we give it some cushion */
  565|       |
  566|  4.81k|        max_uncompressed_size -= MZ_ZIP_UNCOMPR_SIZE64_CUSHION;
  ------------------
  |  |   78|  4.81k|#define MZ_ZIP_UNCOMPR_SIZE64_CUSHION   (2 * 1024 * 1024)
  ------------------
  567|  4.81k|    }
  568|       |
  569|  7.15k|    needs_zip64 = (file_info->uncompressed_size >= max_uncompressed_size) || (file_info->compressed_size >= UINT32_MAX);
  ------------------
  |  Branch (569:19): [True: 0, False: 7.15k]
  |  Branch (569:78): [True: 0, False: 7.15k]
  ------------------
  570|       |
  571|  7.15k|    if (!local) {
  ------------------
  |  Branch (571:9): [True: 2.34k, False: 4.81k]
  ------------------
  572|       |        /* Disk offset and number only used in central directory header */
  573|  2.34k|        needs_zip64 |= (file_info->disk_offset >= UINT32_MAX) || (file_info->disk_number >= UINT16_MAX);
  ------------------
  |  Branch (573:24): [True: 0, False: 2.34k]
  |  Branch (573:66): [True: 0, False: 2.34k]
  ------------------
  574|  2.34k|    }
  575|       |
  576|  7.15k|    if (file_info->zip64 == MZ_ZIP64_AUTO) {
  ------------------
  |  |   99|  7.15k|#define MZ_ZIP64_AUTO    (0)
  ------------------
  |  Branch (576:9): [True: 6.11k, False: 1.03k]
  ------------------
  577|       |        /* If uncompressed size is unknown, assume zip64 for 64-bit data descriptors */
  578|  6.11k|        if (local && file_info->uncompressed_size == 0) {
  ------------------
  |  Branch (578:13): [True: 4.11k, False: 1.99k]
  |  Branch (578:22): [True: 4.11k, False: 0]
  ------------------
  579|       |            /* Don't use zip64 for local header directory entries */
  580|  4.11k|            if (mz_zip_attrib_is_dir(file_info->external_fa, file_info->version_madeby) != MZ_OK) {
  ------------------
  |  |   21|  4.11k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (580:17): [True: 4.11k, False: 0]
  ------------------
  581|  4.11k|                *zip64 = 1;
  582|  4.11k|            }
  583|  4.11k|        }
  584|  6.11k|        *zip64 |= needs_zip64;
  585|  6.11k|    } else if (file_info->zip64 == MZ_ZIP64_FORCE) {
  ------------------
  |  |  100|  1.03k|#define MZ_ZIP64_FORCE   (1)
  ------------------
  |  Branch (585:16): [True: 16, False: 1.02k]
  ------------------
  586|     16|        *zip64 = 1;
  587|  1.02k|    } else if (file_info->zip64 == MZ_ZIP64_DISABLE) {
  ------------------
  |  |  101|  1.02k|#define MZ_ZIP64_DISABLE (2)
  ------------------
  |  Branch (587:16): [True: 7, False: 1.01k]
  ------------------
  588|       |        /* Zip64 extension is required to zip file */
  589|      7|        if (needs_zip64)
  ------------------
  |  Branch (589:13): [True: 0, False: 7]
  ------------------
  590|      0|            return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  591|      7|    }
  592|       |
  593|  7.15k|    return MZ_OK;
  ------------------
  |  |   21|  7.15k|#define MZ_OK             (0)  /* zlib */
  ------------------
  594|  7.15k|}
mz_zip.c:mz_zip_entry_write_descriptor:
  925|  2.34k|                                             int64_t uncompressed_size) {
  926|  2.34k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  927|       |
  928|  2.34k|    err = mz_stream_write_uint32(stream, MZ_ZIP_MAGIC_DATADESCRIPTOR);
  ------------------
  |  |   69|  2.34k|#define MZ_ZIP_MAGIC_DATADESCRIPTOR     (0x08074b50)
  ------------------
  929|  2.34k|    if (err == MZ_OK)
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (929:9): [True: 2.34k, False: 0]
  ------------------
  930|  2.34k|        err = mz_stream_write_uint32(stream, crc32);
  931|       |
  932|       |    /* Store data descriptor as 8 bytes if zip 64 extension enabled */
  933|  2.34k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (933:9): [True: 2.34k, False: 0]
  ------------------
  934|       |        /* Zip 64 extension is enabled when uncompressed size is > UINT32_MAX */
  935|  2.34k|        if (!zip64)
  ------------------
  |  Branch (935:13): [True: 338, False: 2.00k]
  ------------------
  936|    338|            err = mz_stream_write_uint32(stream, (uint32_t)compressed_size);
  937|  2.00k|        else
  938|  2.00k|            err = mz_stream_write_int64(stream, compressed_size);
  939|  2.34k|    }
  940|  2.34k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  2.34k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (940:9): [True: 2.34k, False: 0]
  ------------------
  941|  2.34k|        if (!zip64)
  ------------------
  |  Branch (941:13): [True: 338, False: 2.00k]
  ------------------
  942|    338|            err = mz_stream_write_uint32(stream, (uint32_t)uncompressed_size);
  943|  2.00k|        else
  944|  2.00k|            err = mz_stream_write_int64(stream, uncompressed_size);
  945|  2.34k|    }
  946|       |
  947|  2.34k|    return err;
  948|  2.34k|}
mz_zip.c:mz_zip_entry_write_crc_sizes:
  525|  4.81k|static int32_t mz_zip_entry_write_crc_sizes(void *stream, uint8_t zip64, uint8_t mask, mz_zip_file *file_info) {
  526|  4.81k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  527|       |
  528|  4.81k|    if (mask)
  ------------------
  |  Branch (528:9): [True: 174, False: 4.64k]
  ------------------
  529|    174|        err = mz_stream_write_uint32(stream, 0);
  530|  4.64k|    else
  531|  4.64k|        err = mz_stream_write_uint32(stream, file_info->crc); /* crc */
  532|       |
  533|       |    /* For backwards-compatibility with older zip applications we set all sizes to UINT32_MAX
  534|       |     * when zip64 is needed, instead of only setting sizes larger than UINT32_MAX. */
  535|       |
  536|  4.81k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (536:9): [True: 4.81k, False: 0]
  ------------------
  537|  4.81k|        if (zip64) /* compr size */
  ------------------
  |  Branch (537:13): [True: 2.13k, False: 2.68k]
  ------------------
  538|  2.13k|            err = mz_stream_write_uint32(stream, UINT32_MAX);
  539|  2.68k|        else
  540|  2.68k|            err = mz_stream_write_uint32(stream, (uint32_t)file_info->compressed_size);
  541|  4.81k|    }
  542|  4.81k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  4.81k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (542:9): [True: 4.81k, False: 0]
  ------------------
  543|  4.81k|        if (mask) /* uncompr size */
  ------------------
  |  Branch (543:13): [True: 174, False: 4.64k]
  ------------------
  544|    174|            err = mz_stream_write_uint32(stream, 0);
  545|  4.64k|        else if (zip64)
  ------------------
  |  Branch (545:18): [True: 1.96k, False: 2.67k]
  ------------------
  546|  1.96k|            err = mz_stream_write_uint32(stream, UINT32_MAX);
  547|  2.67k|        else
  548|  2.67k|            err = mz_stream_write_uint32(stream, (uint32_t)file_info->uncompressed_size);
  549|  4.81k|    }
  550|  4.81k|    return err;
  551|  4.81k|}
mz_zip.c:mz_zip_invalid_date:
 2676|    252|static int32_t mz_zip_invalid_date(const struct tm *ptm) {
 2677|    252|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
 2678|    252|    return (!datevalue_in_range(0, 127 + 80, ptm->tm_year) || /* 1980-based year, allow 80 extra */
  ------------------
  |  | 2677|    504|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
  |  |  ------------------
  |  |  |  Branch (2677:46): [True: 252, False: 0]
  |  |  |  Branch (2677:66): [True: 252, False: 0]
  |  |  ------------------
  ------------------
 2679|    252|            !datevalue_in_range(0, 11, ptm->tm_mon) ||        /* allowing months 0-11 in a year */
  ------------------
  |  | 2677|    504|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
  |  |  ------------------
  |  |  |  Branch (2677:46): [True: 252, False: 0]
  |  |  |  Branch (2677:66): [True: 252, False: 0]
  |  |  ------------------
  ------------------
 2680|    252|            !datevalue_in_range(1, 31, ptm->tm_mday) ||       /* allowing days 1-31 in a month */
  ------------------
  |  | 2677|    504|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
  |  |  ------------------
  |  |  |  Branch (2677:46): [True: 252, False: 0]
  |  |  |  Branch (2677:66): [True: 252, False: 0]
  |  |  ------------------
  ------------------
 2681|    252|            !datevalue_in_range(0, 23, ptm->tm_hour) ||       /* allowing hours 0-23 in a day */
  ------------------
  |  | 2677|    504|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
  |  |  ------------------
  |  |  |  Branch (2677:46): [True: 252, False: 0]
  |  |  |  Branch (2677:66): [True: 252, False: 0]
  |  |  ------------------
  ------------------
 2682|    252|            !datevalue_in_range(0, 59, ptm->tm_min) ||        /* allowing minutes 0-59 in an hour */
  ------------------
  |  | 2677|    504|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
  |  |  ------------------
  |  |  |  Branch (2677:46): [True: 252, False: 0]
  |  |  |  Branch (2677:66): [True: 252, False: 0]
  |  |  ------------------
  ------------------
 2683|    252|            !datevalue_in_range(0, 59, ptm->tm_sec));         /* allowing seconds 0-59 in a minute */
  ------------------
  |  | 2677|    252|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
  |  |  ------------------
  |  |  |  Branch (2677:46): [True: 252, False: 0]
  |  |  |  Branch (2677:66): [True: 252, False: 0]
  |  |  ------------------
  ------------------
 2684|    252|#undef datevalue_in_range
 2685|    252|}

LLVMFuzzerTestOneInput:
   29|  2.47k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   30|  2.47k|    mz_zip_file file_info;
   31|  2.47k|    void *fuzz_stream = NULL;
   32|  2.47k|    void *stream = NULL;
   33|  2.47k|    void *handle = NULL;
   34|  2.47k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
   35|  2.47k|    uint16_t value16 = 0;
   36|  2.47k|    uint8_t value8 = 0;
   37|  2.47k|    int16_t compress_level = 0;
   38|  2.47k|    int64_t fuzz_pos = 0;
   39|  2.47k|    int32_t fuzz_length = 0;
   40|  2.47k|    uint8_t *fuzz_buf = NULL;
   41|  2.47k|    const char *password = NULL;
   42|       |
   43|  2.47k|    fuzz_stream = mz_stream_mem_create();
   44|  2.47k|    if (!fuzz_stream)
  ------------------
  |  Branch (44:9): [True: 0, False: 2.47k]
  ------------------
   45|      0|        return 1;
   46|  2.47k|    mz_stream_mem_set_buffer(fuzz_stream, (void *)data, (int32_t)size);
   47|       |
   48|  2.47k|    memset(&file_info, 0, sizeof(file_info));
   49|       |
   50|  2.47k|    file_info.flag = MZ_ZIP_FLAG_UTF8;
  ------------------
  |  |   86|  2.47k|#define MZ_ZIP_FLAG_UTF8               (1 << 11)
  ------------------
   51|  2.47k|    if ((mz_stream_read_uint8(fuzz_stream, &value8) == MZ_OK) && (value8 < 0x08)) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (51:9): [True: 2.47k, False: 0]
  |  Branch (51:66): [True: 312, False: 2.16k]
  ------------------
   52|    312|        if (mz_stream_read_uint16(fuzz_stream, &value16) == MZ_OK)
  ------------------
  |  |   21|    312|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (52:13): [True: 308, False: 4]
  ------------------
   53|    308|            file_info.flag = value16;
   54|    312|    }
   55|  2.47k|    file_info.compression_method = MZ_COMPRESS_METHOD_DEFLATE;
  ------------------
  |  |   65|  2.47k|#define MZ_COMPRESS_METHOD_DEFLATE (8)
  ------------------
   56|  2.47k|    if ((mz_stream_read_uint8(fuzz_stream, &value8) == MZ_OK) && (value8 < 0x08)) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (56:9): [True: 2.44k, False: 23]
  |  Branch (56:66): [True: 190, False: 2.25k]
  ------------------
   57|    190|        file_info.compression_method = MZ_COMPRESS_METHOD_STORE;
  ------------------
  |  |   64|    190|#define MZ_COMPRESS_METHOD_STORE   (0)
  ------------------
   58|  2.28k|    } else if ((mz_stream_read_uint8(fuzz_stream, &value8) == MZ_OK) && (value8 < 0x08)) {
  ------------------
  |  |   21|  2.28k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (58:16): [True: 2.25k, False: 30]
  |  Branch (58:73): [True: 2.14k, False: 104]
  ------------------
   59|  2.14k|        if (mz_stream_read_uint16(fuzz_stream, &value16) == MZ_OK)
  ------------------
  |  |   21|  2.14k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (59:13): [True: 2.14k, False: 5]
  ------------------
   60|  2.14k|            file_info.compression_method = value16;
   61|  2.14k|    }
   62|       |
   63|  2.47k|    if ((mz_stream_read_uint8(fuzz_stream, &value8) == MZ_OK) && (value8 < 0x08)) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (63:9): [True: 2.38k, False: 87]
  |  Branch (63:66): [True: 574, False: 1.81k]
  ------------------
   64|    574|        if (mz_stream_read_uint16(fuzz_stream, &value16) == MZ_OK)
  ------------------
  |  |   21|    574|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (64:13): [True: 568, False: 6]
  ------------------
   65|    568|            file_info.zip64 = value16;
   66|    574|    }
   67|       |
   68|  2.47k|    file_info.filename = MZ_FUZZ_TEST_FILENAME;
  ------------------
  |  |   24|  2.47k|#define MZ_FUZZ_TEST_FILENAME "foo"
  ------------------
   69|  2.47k|    file_info.filename_size = (uint16_t)strlen(MZ_FUZZ_TEST_FILENAME);
  ------------------
  |  |   24|  2.47k|#define MZ_FUZZ_TEST_FILENAME "foo"
  ------------------
   70|       |
   71|  2.47k|    compress_level = MZ_COMPRESS_LEVEL_DEFAULT;
  ------------------
  |  |   73|  2.47k|#define MZ_COMPRESS_LEVEL_DEFAULT  (-1)
  ------------------
   72|  2.47k|    if ((mz_stream_read_uint8(fuzz_stream, &value8) == MZ_OK) && (value8 < 0x08)) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (72:9): [True: 2.34k, False: 129]
  |  Branch (72:66): [True: 1.12k, False: 1.21k]
  ------------------
   73|  1.12k|        if (mz_stream_read_uint16(fuzz_stream, &value16) == MZ_OK)
  ------------------
  |  |   21|  1.12k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (73:13): [True: 1.11k, False: 6]
  ------------------
   74|  1.11k|            compress_level = value16;
   75|  1.12k|    }
   76|       |
   77|  2.47k|    stream = mz_stream_mem_create();
   78|  2.47k|    if (!stream) {
  ------------------
  |  Branch (78:9): [True: 0, False: 2.47k]
  ------------------
   79|      0|        mz_stream_mem_delete(&fuzz_stream);
   80|      0|        return 1;
   81|      0|    }
   82|       |
   83|  2.47k|    err = mz_stream_mem_open(stream, MZ_FUZZ_TEST_FILENAME, MZ_OPEN_MODE_CREATE | MZ_OPEN_MODE_WRITE);
  ------------------
  |  |   24|  2.47k|#define MZ_FUZZ_TEST_FILENAME "foo"
  ------------------
                  err = mz_stream_mem_open(stream, MZ_FUZZ_TEST_FILENAME, MZ_OPEN_MODE_CREATE | MZ_OPEN_MODE_WRITE);
  ------------------
  |  |   54|  2.47k|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
                  err = mz_stream_mem_open(stream, MZ_FUZZ_TEST_FILENAME, MZ_OPEN_MODE_CREATE | MZ_OPEN_MODE_WRITE);
  ------------------
  |  |   51|  2.47k|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
   84|  2.47k|    if (err != MZ_OK) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (84:9): [True: 0, False: 2.47k]
  ------------------
   85|      0|        mz_stream_mem_delete(&stream);
   86|      0|        mz_stream_mem_delete(&fuzz_stream);
   87|      0|        return 1;
   88|      0|    }
   89|       |
   90|  2.47k|    handle = mz_zip_create();
   91|  2.47k|    if (!handle) {
  ------------------
  |  Branch (91:9): [True: 0, False: 2.47k]
  ------------------
   92|      0|        mz_stream_mem_delete(&stream);
   93|      0|        mz_stream_mem_delete(&fuzz_stream);
   94|      0|        return 1;
   95|      0|    }
   96|       |
   97|  2.47k|    err = mz_zip_open(handle, stream, MZ_OPEN_MODE_CREATE | MZ_OPEN_MODE_WRITE);
  ------------------
  |  |   54|  2.47k|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
                  err = mz_zip_open(handle, stream, MZ_OPEN_MODE_CREATE | MZ_OPEN_MODE_WRITE);
  ------------------
  |  |   51|  2.47k|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
   98|  2.47k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (98:9): [True: 2.47k, False: 0]
  ------------------
   99|  2.47k|        password = file_info.flag & MZ_ZIP_FLAG_ENCRYPTED ? MZ_FUZZ_TEST_PWD : NULL;
  ------------------
  |  |   79|  2.47k|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
                      password = file_info.flag & MZ_ZIP_FLAG_ENCRYPTED ? MZ_FUZZ_TEST_PWD : NULL;
  ------------------
  |  |   25|    252|#define MZ_FUZZ_TEST_PWD      "test123"
  ------------------
  |  Branch (99:20): [True: 252, False: 2.22k]
  ------------------
  100|  2.47k|        err = mz_zip_entry_write_open(handle, &file_info, compress_level, 0, password);
  101|  2.47k|        if (err == MZ_OK) {
  ------------------
  |  |   21|  2.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (101:13): [True: 2.34k, False: 130]
  ------------------
  102|  2.34k|            mz_stream_mem_get_buffer_at_current(fuzz_stream, (const void **)&fuzz_buf);
  103|  2.34k|            fuzz_pos = mz_stream_tell(fuzz_stream);
  104|  2.34k|            mz_stream_mem_get_buffer_length(fuzz_stream, &fuzz_length);
  105|       |
  106|  2.34k|            err = mz_zip_entry_write(handle, fuzz_buf, (fuzz_length - (int32_t)fuzz_pos));
  107|       |
  108|  2.34k|            mz_zip_entry_close(handle);
  109|  2.34k|        }
  110|       |
  111|  2.47k|        mz_zip_close(handle);
  112|  2.47k|    }
  113|       |
  114|  2.47k|    mz_zip_delete(&handle);
  115|  2.47k|    mz_stream_mem_delete(&stream);
  116|       |
  117|  2.47k|    mz_stream_mem_delete(&fuzz_stream);
  118|       |
  119|  2.47k|    return 0;
  120|  2.47k|}

Ppmd8_Construct:
   53|  2.07k|{
   54|  2.07k|  unsigned i, k, m;
   55|       |
   56|  2.07k|  p->Base = NULL;
   57|       |
   58|  80.8k|  for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++)
  ------------------
  |  |   38|  80.8k|#define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   34|  80.8k|#define PPMD_N1 4
  |  |  ------------------
  |  |               #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   35|  80.8k|#define PPMD_N2 4
  |  |  ------------------
  |  |               #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   36|  80.8k|#define PPMD_N3 4
  |  |  ------------------
  |  |               #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   37|  80.8k|#define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  80.8k|#define PPMD_N1 4
  |  |  |  |  ------------------
  |  |  |  |               #define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  80.8k|#define PPMD_N2 4
  |  |  |  |  ------------------
  |  |  |  |               #define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  80.8k|#define PPMD_N3 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (58:22): [True: 78.8k, False: 2.07k]
  ------------------
   59|  78.8k|  {
   60|  78.8k|    unsigned step = (i >= 12 ? 4 : (i >> 2) + 1);
  ------------------
  |  Branch (60:22): [True: 53.9k, False: 24.8k]
  ------------------
   61|   265k|    do { p->Units2Indx[k++] = (Byte)i; } while (--step);
  ------------------
  |  Branch (61:49): [True: 186k, False: 78.8k]
  ------------------
   62|  78.8k|    p->Indx2Units[i] = (Byte)k;
   63|  78.8k|  }
   64|       |
   65|  2.07k|  p->NS2BSIndx[0] = (0 << 1);
   66|  2.07k|  p->NS2BSIndx[1] = (1 << 1);
   67|  2.07k|  memset(p->NS2BSIndx + 2, (2 << 1), 9);
   68|  2.07k|  memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11);
   69|       |
   70|  12.4k|  for (i = 0; i < 5; i++)
  ------------------
  |  Branch (70:15): [True: 10.3k, False: 2.07k]
  ------------------
   71|  10.3k|    p->NS2Indx[i] = (Byte)i;
   72|       |  
   73|   530k|  for (m = i, k = 1; i < 260; i++)
  ------------------
  |  Branch (73:22): [True: 528k, False: 2.07k]
  ------------------
   74|   528k|  {
   75|   528k|    p->NS2Indx[i] = (Byte)m;
   76|   528k|    if (--k == 0)
  ------------------
  |  Branch (76:9): [True: 45.6k, False: 483k]
  ------------------
   77|  45.6k|      k = (++m) - 4;
   78|   528k|  }
   79|       |
   80|  2.07k|  memcpy(p->ExpEscape, PPMD8_kExpEscape, 16);
   81|  2.07k|}
Ppmd8_Free:
   85|  4.05k|{
   86|  4.05k|  ISzAlloc_Free(alloc, p->Base);
  ------------------
  |  |  466|  4.05k|#define ISzAlloc_Free(p, a) (p)->Free(p, a)
  ------------------
   87|  4.05k|  p->Size = 0;
   88|       |  p->Base = NULL;
   89|  4.05k|}
Ppmd8_Alloc:
   93|  2.02k|{
   94|  2.02k|  if (!p->Base || p->Size != size)
  ------------------
  |  Branch (94:7): [True: 2.02k, False: 0]
  |  Branch (94:19): [True: 0, False: 0]
  ------------------
   95|  2.02k|  {
   96|  2.02k|    Ppmd8_Free(p, alloc);
   97|  2.02k|    p->AlignOffset = (4 - size) & 3;
   98|  2.02k|    if ((p->Base = (Byte *)ISzAlloc_Alloc(alloc, p->AlignOffset + size)) == NULL)
  ------------------
  |  |  465|  2.02k|#define ISzAlloc_Alloc(p, size) (p)->Alloc(p, size)
  ------------------
  |  Branch (98:9): [True: 0, False: 2.02k]
  ------------------
   99|      0|      return False;
  ------------------
  |  |  262|      0|#define False 0
  ------------------
  100|  2.02k|    p->Size = size;
  101|  2.02k|  }
  102|  2.02k|  return True;
  ------------------
  |  |  261|  2.02k|#define True 1
  ------------------
  103|  2.02k|}
Ppmd8_Init:
  516|  2.02k|{
  517|  2.02k|  p->MaxOrder = maxOrder;
  518|  2.02k|  p->RestoreMethod = restoreMethod;
  519|  2.02k|  Ppmd8_RestartModel(p);
  520|  2.02k|}
Ppmd8_UpdateModel:
 1073|  98.5M|{
 1074|  98.5M|  CPpmd_Void_Ref maxSuccessor, minSuccessor = SUCCESSOR(p->FoundState);
  ------------------
  |  |  422|  98.5M|#define SUCCESSOR(p) Ppmd_GET_SUCCESSOR(p)
  |  |  ------------------
  |  |  |  |  152|  98.5M|    ( (CPpmd_Void_Ref) ((p)->Successor_0 | ((UInt32)(p)->Successor_1 << 16)) )
  |  |  ------------------
  ------------------
 1075|  98.5M|  PPMD8_CTX_PTR c;
 1076|  98.5M|  unsigned s0, ns, fFreq = p->FoundState->Freq;
 1077|  98.5M|  Byte flag, fSymbol = p->FoundState->Symbol;
 1078|  98.5M|  {
 1079|  98.5M|  CPpmd_State *s = NULL;
 1080|  98.5M|  if (p->FoundState->Freq < MAX_FREQ / 4 && p->MinContext->Suffix != 0)
  ------------------
  |  |   19|  98.5M|#define MAX_FREQ 124
  ------------------
  |  Branch (1080:7): [True: 57.1M, False: 41.4M]
  |  Branch (1080:45): [True: 53.4M, False: 3.67M]
  ------------------
 1081|  53.4M|  {
 1082|       |    /* Update Freqs in Suffix Context */
 1083|       |
 1084|  53.4M|    c = SUFFIX(p->MinContext);
  ------------------
  |  |   34|  53.4M|#define SUFFIX(ctx) CTX((ctx)->Suffix)
  |  |  ------------------
  |  |  |  |   31|  53.4M|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  53.4M|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  53.4M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  114|  53.4M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1085|       |    
 1086|  53.4M|    if (c->NumStats == 0)
  ------------------
  |  Branch (1086:9): [True: 6.61M, False: 46.8M]
  ------------------
 1087|  6.61M|    {
 1088|  6.61M|      s = ONE_STATE(c);
  ------------------
  |  |   33|  6.61M|#define ONE_STATE(ctx) Ppmd8Context_OneState(ctx)
  |  |  ------------------
  |  |  |  |   48|  6.61M|#define Ppmd8Context_OneState(p) ((CPpmd_State *)&(p)->Union2)
  |  |  ------------------
  ------------------
 1089|  6.61M|      if (s->Freq < 32)
  ------------------
  |  Branch (1089:11): [True: 6.61M, False: 3.67k]
  ------------------
 1090|  6.61M|        s->Freq++;
 1091|  6.61M|    }
 1092|  46.8M|    else
 1093|  46.8M|    {
 1094|  46.8M|      Byte sym = p->FoundState->Symbol;
 1095|  46.8M|      s = STATS(c);
  ------------------
  |  |   32|  46.8M|#define STATS(ctx) Ppmd8_GetStats(p, ctx)
  |  |  ------------------
  |  |  |  |  117|  46.8M|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  46.8M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  46.8M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1096|       |
 1097|  46.8M|      if (s->Symbol != sym)
  ------------------
  |  Branch (1097:11): [True: 44.6M, False: 2.18M]
  ------------------
 1098|  44.6M|      {
 1099|  44.6M|        do
 1100|  5.06G|        {
 1101|       |        
 1102|  5.06G|          s++;
 1103|  5.06G|        }
 1104|  5.06G|        while (s->Symbol != sym);
  ------------------
  |  Branch (1104:16): [True: 5.02G, False: 44.6M]
  ------------------
 1105|       |        
 1106|  44.6M|        if (s[0].Freq >= s[-1].Freq)
  ------------------
  |  Branch (1106:13): [True: 22.8M, False: 21.8M]
  ------------------
 1107|  22.8M|        {
 1108|  22.8M|          SWAP_STATES(&s[0], &s[-1]);
 1109|  22.8M|          s--;
 1110|  22.8M|        }
 1111|  44.6M|      }
 1112|       |      
 1113|  46.8M|      if (s->Freq < MAX_FREQ - 9)
  ------------------
  |  |   19|  46.8M|#define MAX_FREQ 124
  ------------------
  |  Branch (1113:11): [True: 43.8M, False: 3.02M]
  ------------------
 1114|  43.8M|      {
 1115|  43.8M|        s->Freq = (Byte)(s->Freq + 2);
 1116|  43.8M|        c->Union2.SummFreq = (UInt16)(c->Union2.SummFreq + 2);
 1117|  43.8M|      }
 1118|  46.8M|    }
 1119|  53.4M|  }
 1120|       |  
 1121|  98.5M|  c = p->MaxContext;
 1122|  98.5M|  if (p->OrderFall == 0 && minSuccessor)
  ------------------
  |  Branch (1122:7): [True: 9.52M, False: 89.0M]
  |  Branch (1122:28): [True: 9.52M, False: 0]
  ------------------
 1123|  9.52M|  {
 1124|  9.52M|    PPMD8_CTX_PTR cs = Ppmd8_CreateSuccessors(p, True, s, p->MinContext);
  ------------------
  |  |  261|  9.52M|#define True 1
  ------------------
 1125|  9.52M|    if (!cs)
  ------------------
  |  Branch (1125:9): [True: 5, False: 9.52M]
  ------------------
 1126|      5|    {
 1127|      5|      Ppmd8State_SetSuccessor(p->FoundState, 0);
 1128|      5|      RESTORE_MODEL(c, CTX(minSuccessor));
  ------------------
  |  |  775|      5|  #define RESTORE_MODEL(c1, fSuccessor) RestoreModel(p, c1)
  ------------------
 1129|      5|      return;
 1130|      5|    }
 1131|  9.52M|    Ppmd8State_SetSuccessor(p->FoundState, REF(cs));
  ------------------
  |  |   27|  9.52M|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  ------------------
  |  |  |  |  113|  9.52M|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  ------------------
  ------------------
 1132|  9.52M|    p->MinContext = p->MaxContext = cs;
 1133|  9.52M|    return;
 1134|  9.52M|  }
 1135|       |  
 1136|       |
 1137|       |
 1138|       |
 1139|  89.0M|  {
 1140|  89.0M|    Byte *text = p->Text;
 1141|  89.0M|    *text++ = p->FoundState->Symbol;
 1142|  89.0M|    p->Text = text;
 1143|  89.0M|    if (text >= p->UnitsStart)
  ------------------
  |  Branch (1143:9): [True: 60, False: 89.0M]
  ------------------
 1144|     60|    {
 1145|     60|      RESTORE_MODEL(c, CTX(minSuccessor)); /* check it */
  ------------------
  |  |  775|     60|  #define RESTORE_MODEL(c1, fSuccessor) RestoreModel(p, c1)
  ------------------
 1146|     60|      return;
 1147|     60|    }
 1148|  89.0M|    maxSuccessor = REF(text);
  ------------------
  |  |   27|  89.0M|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  ------------------
  |  |  |  |  113|  89.0M|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  ------------------
  ------------------
 1149|  89.0M|  }
 1150|       |
 1151|  89.0M|  if (!minSuccessor)
  ------------------
  |  Branch (1151:7): [True: 320k, False: 88.7M]
  ------------------
 1152|   320k|  {
 1153|   320k|    PPMD8_CTX_PTR cs = ReduceOrder(p, s, p->MinContext);
 1154|   320k|    if (!cs)
  ------------------
  |  Branch (1154:9): [True: 0, False: 320k]
  ------------------
 1155|      0|    {
 1156|      0|      RESTORE_MODEL(c, NULL);
  ------------------
  |  |  775|      0|  #define RESTORE_MODEL(c1, fSuccessor) RestoreModel(p, c1)
  ------------------
 1157|      0|      return;
 1158|      0|    }
 1159|   320k|    minSuccessor = REF(cs);
  ------------------
  |  |   27|   320k|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  ------------------
  |  |  |  |  113|   320k|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  ------------------
  ------------------
 1160|   320k|  }
 1161|  88.7M|  else if ((Byte *)Ppmd8_GetPtr(p, minSuccessor) < p->UnitsStart)
  ------------------
  |  |  115|  88.7M|#define Ppmd8_GetPtr(p, ptr)     Ppmd_GetPtr(p, ptr)
  |  |  ------------------
  |  |  |  |  114|  88.7M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  ------------------
  ------------------
  |  Branch (1161:12): [True: 22.2M, False: 66.4M]
  ------------------
 1162|  22.2M|  {
 1163|  22.2M|    PPMD8_CTX_PTR cs = Ppmd8_CreateSuccessors(p, False, s, p->MinContext);
  ------------------
  |  |  262|  22.2M|#define False 0
  ------------------
 1164|  22.2M|    if (!cs)
  ------------------
  |  Branch (1164:9): [True: 2, False: 22.2M]
  ------------------
 1165|      2|    {
 1166|      2|      RESTORE_MODEL(c, NULL);
  ------------------
  |  |  775|      2|  #define RESTORE_MODEL(c1, fSuccessor) RestoreModel(p, c1)
  ------------------
 1167|      2|      return;
 1168|      2|    }
 1169|  22.2M|    minSuccessor = REF(cs);
  ------------------
  |  |   27|  22.2M|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  ------------------
  |  |  |  |  113|  22.2M|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  ------------------
  ------------------
 1170|  22.2M|  }
 1171|       |  
 1172|  89.0M|  if (--p->OrderFall == 0)
  ------------------
  |  Branch (1172:7): [True: 27.4M, False: 61.6M]
  ------------------
 1173|  27.4M|  {
 1174|  27.4M|    maxSuccessor = minSuccessor;
 1175|  27.4M|    p->Text -= (p->MaxContext != p->MinContext);
 1176|  27.4M|  }
 1177|       |  #ifdef PPMD8_FREEZE_SUPPORT
 1178|       |  else if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
 1179|       |  {
 1180|       |    maxSuccessor = minSuccessor;
 1181|       |    RESET_TEXT(0)
 1182|       |    p->OrderFall = 0;
 1183|       |  }
 1184|       |  #endif
 1185|  89.0M|  }
 1186|       |  
 1187|       |  
 1188|       |  
 1189|       |  
 1190|       |  
 1191|       |  
 1192|       |  
 1193|       |  
 1194|       |  
 1195|       |  
 1196|       |  
 1197|       |  
 1198|       |  
 1199|       |  
 1200|       |  
 1201|       |  
 1202|       |  
 1203|       |  
 1204|       |  
 1205|       |  
 1206|       |  
 1207|       |  
 1208|       |  
 1209|       |  
 1210|       |  
 1211|       |
 1212|       |  
 1213|       |  
 1214|  89.0M|  flag = (Byte)(PPMD8_HiBitsFlag_3(fSymbol));
  ------------------
  |  |  532|  89.0M|#define PPMD8_HiBitsFlag_3(sym) HiBits_Convert_3(HiBits_Prepare(sym))
  |  |  ------------------
  |  |  |  |  529|  89.0M|#define HiBits_Convert_3(flags) (((flags) >> (8 - 3)) & (1 << 3))
  |  |  ------------------
  ------------------
 1215|  89.0M|  s0 = p->MinContext->Union2.SummFreq - (ns = p->MinContext->NumStats) - fFreq;
 1216|       |  
 1217|   177M|  for (; c != p->MinContext; c = SUFFIX(c))
  ------------------
  |  |   34|  88.7M|#define SUFFIX(ctx) CTX((ctx)->Suffix)
  |  |  ------------------
  |  |  |  |   31|  88.7M|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  88.7M|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  88.7M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  114|  88.7M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1217:10): [True: 88.7M, False: 89.0M]
  ------------------
 1218|  88.7M|  {
 1219|  88.7M|    unsigned ns1;
 1220|  88.7M|    UInt32 sum;
 1221|       |    
 1222|  88.7M|    if ((ns1 = c->NumStats) != 0)
  ------------------
  |  Branch (1222:9): [True: 65.7M, False: 22.9M]
  ------------------
 1223|  65.7M|    {
 1224|  65.7M|      if ((ns1 & 1) != 0)
  ------------------
  |  Branch (1224:11): [True: 36.3M, False: 29.3M]
  ------------------
 1225|  36.3M|      {
 1226|       |        /* Expand for one UNIT */
 1227|  36.3M|        const unsigned oldNU = (ns1 + 1) >> 1;
 1228|  36.3M|        const unsigned i = U2I(oldNU);
  ------------------
  |  |   23|  36.3M|#define U2I(nu) (p->Units2Indx[(size_t)(nu) - 1])
  ------------------
 1229|  36.3M|        if (i != U2I((size_t)oldNU + 1))
  ------------------
  |  |   23|  36.3M|#define U2I(nu) (p->Units2Indx[(size_t)(nu) - 1])
  ------------------
  |  Branch (1229:13): [True: 21.6M, False: 14.7M]
  ------------------
 1230|  21.6M|        {
 1231|  21.6M|          void *ptr = Ppmd8_AllocUnits(p, i + 1);
 1232|  21.6M|          void *oldPtr;
 1233|  21.6M|          if (!ptr)
  ------------------
  |  Branch (1233:15): [True: 444, False: 21.6M]
  ------------------
 1234|    444|          {
 1235|    444|            RESTORE_MODEL(c, CTX(minSuccessor));
  ------------------
  |  |  775|    444|  #define RESTORE_MODEL(c1, fSuccessor) RestoreModel(p, c1)
  ------------------
 1236|    444|            return;
 1237|    444|          }
 1238|  21.6M|          oldPtr = STATS(c);
  ------------------
  |  |   32|  21.6M|#define STATS(ctx) Ppmd8_GetStats(p, ctx)
  |  |  ------------------
  |  |  |  |  117|  21.6M|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  21.6M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  21.6M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1239|  21.6M|          MEM_12_CPY(ptr, oldPtr, oldNU)
  ------------------
  |  |  305|  21.6M|  { UInt32 *d = (UInt32 *)(dest); \
  |  |  306|  21.6M|    const UInt32 *z = (const UInt32 *)(src); \
  |  |  307|  21.6M|    unsigned n = (num); \
  |  |  308|   266M|    do { \
  |  |  309|   266M|      d[0] = z[0]; \
  |  |  310|   266M|      d[1] = z[1]; \
  |  |  311|   266M|      d[2] = z[2]; \
  |  |  312|   266M|      z += 3; \
  |  |  313|   266M|      d += 3; \
  |  |  314|   266M|    } while (--n); \
  |  |  ------------------
  |  |  |  Branch (314:14): [True: 244M, False: 21.6M]
  |  |  ------------------
  |  |  315|  21.6M|  }
  ------------------
 1240|  21.6M|          Ppmd8_InsertNode(p, oldPtr, i);
 1241|  21.6M|          c->Union4.Stats = STATS_REF(ptr);
  ------------------
  |  |   29|  21.6M|#define STATS_REF(ptr) ((CPpmd_State_Ref)REF(ptr))
  |  |  ------------------
  |  |  |  |   27|  21.6M|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|  21.6M|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1242|  21.6M|        }
 1243|  36.3M|      }
 1244|  65.7M|      sum = c->Union2.SummFreq;
 1245|       |      /* max increase of Escape_Freq is 1 here.
 1246|       |         an average increase is 1/3 per symbol */
 1247|  65.7M|      sum += (UInt32)(unsigned)(3 * ns1 + 1 < ns);
 1248|       |      /* original PPMdH uses 16-bit variable for (sum) here.
 1249|       |         But (sum < ???). Do we need to truncate (sum) to 16-bit */
 1250|       |      // sum = (UInt16)sum;
 1251|  65.7M|    }
 1252|  22.9M|    else
 1253|  22.9M|    {
 1254|       |      
 1255|  22.9M|      CPpmd_State *s = (CPpmd_State*)Ppmd8_AllocUnits(p, 0);
 1256|  22.9M|      if (!s)
  ------------------
  |  Branch (1256:11): [True: 2, False: 22.9M]
  ------------------
 1257|      2|      {
 1258|      2|        RESTORE_MODEL(c, CTX(minSuccessor));
  ------------------
  |  |  775|      2|  #define RESTORE_MODEL(c1, fSuccessor) RestoreModel(p, c1)
  ------------------
 1259|      2|        return;
 1260|      2|      }
 1261|  22.9M|      {
 1262|  22.9M|        unsigned freq = c->Union2.State2.Freq;
 1263|       |        // s = *ONE_STATE(c);
 1264|  22.9M|        s->Symbol = c->Union2.State2.Symbol;
 1265|  22.9M|        s->Successor_0 = c->Union4.State4.Successor_0;
 1266|  22.9M|        s->Successor_1 = c->Union4.State4.Successor_1;
 1267|       |        // Ppmd8State_SetSuccessor(s, c->Union4.Stats);  // call it only for debug purposes to check the order of
 1268|       |                                              // (Successor_0 and Successor_1) in LE/BE.
 1269|  22.9M|        c->Union4.Stats = REF(s);
  ------------------
  |  |   27|  22.9M|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  ------------------
  |  |  |  |  113|  22.9M|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  ------------------
  ------------------
 1270|  22.9M|        if (freq < MAX_FREQ / 4 - 1)
  ------------------
  |  |   19|  22.9M|#define MAX_FREQ 124
  ------------------
  |  Branch (1270:13): [True: 22.9M, False: 8.92k]
  ------------------
 1271|  22.9M|          freq <<= 1;
 1272|  8.92k|        else
 1273|  8.92k|          freq = MAX_FREQ - 4;
  ------------------
  |  |   19|  8.92k|#define MAX_FREQ 124
  ------------------
 1274|       |
 1275|  22.9M|        s->Freq = (Byte)freq;
 1276|       |
 1277|  22.9M|        sum = (UInt32)(freq + p->InitEsc + (ns > 2));   // Ppmd8 (> 2)
 1278|  22.9M|      }
 1279|  22.9M|    }
 1280|       |
 1281|  88.7M|    {
 1282|  88.7M|      CPpmd_State *s = STATS(c) + ns1 + 1;
  ------------------
  |  |   32|  88.7M|#define STATS(ctx) Ppmd8_GetStats(p, ctx)
  |  |  ------------------
  |  |  |  |  117|  88.7M|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  88.7M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  88.7M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1283|  88.7M|      UInt32 cf = 2 * (sum + 6) * (UInt32)fFreq;
 1284|  88.7M|      UInt32 sf = (UInt32)s0 + sum;
 1285|  88.7M|      s->Symbol = fSymbol;
 1286|  88.7M|      c->NumStats = (Byte)(ns1 + 1);
 1287|  88.7M|      Ppmd8State_SetSuccessor(s, maxSuccessor);
 1288|  88.7M|      c->Flags |= flag;
 1289|  88.7M|      if (cf < 6 * sf)
  ------------------
  |  Branch (1289:11): [True: 72.7M, False: 15.9M]
  ------------------
 1290|  72.7M|      {
 1291|  72.7M|        cf = (unsigned)1 + (cf > sf) + (cf >= 4 * sf);
 1292|  72.7M|        sum += 4;
 1293|       |        /* It can add (1, 2, 3) to Escape_Freq */
 1294|  72.7M|      }
 1295|  15.9M|      else
 1296|  15.9M|      {
 1297|  15.9M|        cf = (unsigned)4 + (cf > 9 * sf) + (cf > 12 * sf) + (cf > 15 * sf);
 1298|  15.9M|        sum += cf;
 1299|  15.9M|      }
 1300|       |
 1301|  88.7M|      c->Union2.SummFreq = (UInt16)sum;
 1302|  88.7M|      s->Freq = (Byte)cf;
 1303|  88.7M|    }
 1304|       |
 1305|  88.7M|  }
 1306|  89.0M|  p->MaxContext = p->MinContext = CTX(minSuccessor);
  ------------------
  |  |   31|  89.0M|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  ------------------
  |  |  |  |  116|  89.0M|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  89.0M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  89.0M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1307|  89.0M|}
Ppmd8_MakeEscFreq:
 1435|  87.6M|{
 1436|  87.6M|  CPpmd_See *see;
 1437|  87.6M|  const CPpmd8_Context *mc = p->MinContext;
 1438|  87.6M|  unsigned numStats = mc->NumStats;
 1439|  87.6M|  if (numStats != 0xFF)
  ------------------
  |  Branch (1439:7): [True: 44.2M, False: 43.3M]
  ------------------
 1440|  44.2M|  {
 1441|       |    // (3 <= numStats + 2 <= 256)   (3 <= NS2Indx[3] and NS2Indx[256] === 26)
 1442|  44.2M|    see = p->See[(size_t)(unsigned)p->NS2Indx[(size_t)numStats + 2] - 3]
 1443|  44.2M|        + (mc->Union2.SummFreq > 11 * (numStats + 1))
 1444|  44.2M|        + 2 * (unsigned)(2 * numStats < ((unsigned)SUFFIX(mc)->NumStats + numMasked1))
  ------------------
  |  |   34|  44.2M|#define SUFFIX(ctx) CTX((ctx)->Suffix)
  |  |  ------------------
  |  |  |  |   31|  44.2M|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  44.2M|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  44.2M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  114|  44.2M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1445|  44.2M|        + mc->Flags;
 1446|       |
 1447|  44.2M|    {
 1448|       |      // if (see->Summ) field is larger than 16-bit, we need only low 16 bits of Summ
 1449|  44.2M|      const unsigned summ = (UInt16)see->Summ; // & 0xFFFF
 1450|  44.2M|      const unsigned r = (summ >> see->Shift);
 1451|  44.2M|      see->Summ = (UInt16)(summ - r);
 1452|  44.2M|      *escFreq = (UInt32)(r + (r == 0));
 1453|  44.2M|    }
 1454|  44.2M|  }
 1455|  43.3M|  else
 1456|  43.3M|  {
 1457|  43.3M|    see = &p->DummySee;
 1458|  43.3M|    *escFreq = 1;
 1459|  43.3M|  }
 1460|  87.6M|  return see;
 1461|  87.6M|}
Ppmd8_Update1:
 1475|  19.0M|{
 1476|  19.0M|  CPpmd_State *s = p->FoundState;
 1477|  19.0M|  unsigned freq = s->Freq;
 1478|  19.0M|  freq += 4;
 1479|  19.0M|  p->MinContext->Union2.SummFreq = (UInt16)(p->MinContext->Union2.SummFreq + 4);
 1480|  19.0M|  s->Freq = (Byte)freq;
 1481|  19.0M|  if (freq > s[-1].Freq)
  ------------------
  |  Branch (1481:7): [True: 14.8M, False: 4.22M]
  ------------------
 1482|  14.8M|  {
 1483|  14.8M|    SWAP_STATES(s, &s[-1]);
 1484|  14.8M|    p->FoundState = --s;
 1485|  14.8M|    if (freq > MAX_FREQ)
  ------------------
  |  |   19|  14.8M|#define MAX_FREQ 124
  ------------------
  |  Branch (1485:9): [True: 1.85k, False: 14.8M]
  ------------------
 1486|  1.85k|      Ppmd8_Rescale(p);
 1487|  14.8M|  }
 1488|  19.0M|  Ppmd8_NextContext(p);
 1489|  19.0M|}
Ppmd8_Update1_0:
 1493|  3.46M|{
 1494|  3.46M|  CPpmd_State *s = p->FoundState;
 1495|  3.46M|  CPpmd8_Context *mc = p->MinContext;
 1496|  3.46M|  unsigned freq = s->Freq;
 1497|  3.46M|  const unsigned summFreq = mc->Union2.SummFreq;
 1498|  3.46M|  p->PrevSuccess = (2 * freq >= summFreq); // Ppmd8 (>=)
 1499|  3.46M|  p->RunLength += (Int32)p->PrevSuccess;
 1500|  3.46M|  mc->Union2.SummFreq = (UInt16)(summFreq + 4);
 1501|  3.46M|  freq += 4;
 1502|  3.46M|  s->Freq = (Byte)freq;
 1503|  3.46M|  if (freq > MAX_FREQ)
  ------------------
  |  |   19|  3.46M|#define MAX_FREQ 124
  ------------------
  |  Branch (1503:7): [True: 91.2k, False: 3.37M]
  ------------------
 1504|  91.2k|    Ppmd8_Rescale(p);
 1505|  3.46M|  Ppmd8_NextContext(p);
 1506|  3.46M|}
Ppmd8_Update2:
 1521|  71.2M|{
 1522|  71.2M|  CPpmd_State *s = p->FoundState;
 1523|  71.2M|  unsigned freq = s->Freq;
 1524|  71.2M|  freq += 4;
 1525|  71.2M|  p->RunLength = p->InitRL;
 1526|  71.2M|  p->MinContext->Union2.SummFreq = (UInt16)(p->MinContext->Union2.SummFreq + 4);
 1527|  71.2M|  s->Freq = (Byte)freq;
 1528|  71.2M|  if (freq > MAX_FREQ)
  ------------------
  |  |   19|  71.2M|#define MAX_FREQ 124
  ------------------
  |  Branch (1528:7): [True: 84.1k, False: 71.1M]
  ------------------
 1529|  84.1k|    Ppmd8_Rescale(p);
 1530|  71.2M|  Ppmd8_UpdateModel(p);
 1531|  71.2M|}
Ppmd8.c:Ppmd8_RestartModel:
  433|  2.53k|{
  434|  2.53k|  unsigned i, k, m;
  435|       |
  436|  2.53k|  memset(p->FreeList, 0, sizeof(p->FreeList));
  437|  2.53k|  memset(p->Stamps, 0, sizeof(p->Stamps));
  438|  2.53k|  RESET_TEXT(0)
  ------------------
  |  |  428|  2.53k|#define RESET_TEXT(offs) { p->Text = p->Base + p->AlignOffset + (offs); }
  ------------------
  439|  2.53k|  p->HiUnit = p->Text + p->Size;
  440|  2.53k|  p->LoUnit = p->UnitsStart = p->HiUnit - p->Size / 8 / UNIT_SIZE * 7 * UNIT_SIZE;
  ------------------
  |  |   20|  2.53k|#define UNIT_SIZE 12
  ------------------
                p->LoUnit = p->UnitsStart = p->HiUnit - p->Size / 8 / UNIT_SIZE * 7 * UNIT_SIZE;
  ------------------
  |  |   20|  2.53k|#define UNIT_SIZE 12
  ------------------
  441|  2.53k|  p->GlueCount = 0;
  442|       |
  443|  2.53k|  p->OrderFall = p->MaxOrder;
  444|  2.53k|  p->RunLength = p->InitRL = -(Int32)((p->MaxOrder < 12) ? p->MaxOrder : 12) - 1;
  ------------------
  |  Branch (444:39): [True: 2.49k, False: 41]
  ------------------
  445|  2.53k|  p->PrevSuccess = 0;
  446|       |
  447|  2.53k|  {
  448|  2.53k|    CPpmd8_Context *mc = (PPMD8_CTX_PTR)(void *)(p->HiUnit -= UNIT_SIZE); /* AllocContext(p); */
  ------------------
  |  |   20|  2.53k|#define UNIT_SIZE 12
  ------------------
  449|  2.53k|    CPpmd_State *s = (CPpmd_State *)p->LoUnit; /* Ppmd8_AllocUnits(p, PPMD_NUM_INDEXES - 1); */
  450|       |    
  451|  2.53k|    p->LoUnit += U2B(256 / 2);
  ------------------
  |  |   22|  2.53k|#define U2B(nu) ((UInt32)(nu) * UNIT_SIZE)
  |  |  ------------------
  |  |  |  |   20|  2.53k|#define UNIT_SIZE 12
  |  |  ------------------
  ------------------
  452|  2.53k|    p->MaxContext = p->MinContext = mc;
  453|  2.53k|    p->FoundState = s;
  454|  2.53k|    mc->Flags = 0;
  455|  2.53k|    mc->NumStats = 256 - 1;
  456|  2.53k|    mc->Union2.SummFreq = 256 + 1;
  457|  2.53k|    mc->Union4.Stats = REF(s);
  ------------------
  |  |   27|  2.53k|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  ------------------
  |  |  |  |  113|  2.53k|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  ------------------
  ------------------
  458|  2.53k|    mc->Suffix = 0;
  459|       |
  460|   652k|    for (i = 0; i < 256; i++, s++)
  ------------------
  |  Branch (460:17): [True: 649k, False: 2.53k]
  ------------------
  461|   649k|    {
  462|   649k|      s->Symbol = (Byte)i;
  463|   649k|      s->Freq = 1;
  464|   649k|      Ppmd8State_SetSuccessor(s, 0);
  465|   649k|    }
  466|  2.53k|  }
  467|       |
  468|       |  
  469|       |  
  470|       |  
  471|       |  
  472|       |  
  473|       |  
  474|       |  
  475|       |  
  476|       |  
  477|       |  
  478|       |  
  479|  66.0k|  for (i = m = 0; m < 25; m++)
  ------------------
  |  Branch (479:19): [True: 63.4k, False: 2.53k]
  ------------------
  480|  63.4k|  {
  481|   609k|    while (p->NS2Indx[i] == m)
  ------------------
  |  Branch (481:12): [True: 545k, False: 63.4k]
  ------------------
  482|   545k|      i++;
  483|   571k|    for (k = 0; k < 8; k++)
  ------------------
  |  Branch (483:17): [True: 507k, False: 63.4k]
  ------------------
  484|   507k|    {
  485|   507k|      unsigned r;
  486|   507k|      UInt16 *dest = p->BinSumm[m] + k;
  487|   507k|      const UInt16 val = (UInt16)(PPMD_BIN_SCALE - PPMD8_kInitBinEsc[k] / (i + 1));
  ------------------
  |  |   27|   507k|#define PPMD_BIN_SCALE (1 << (PPMD_INT_BITS + PPMD_PERIOD_BITS))
  |  |  ------------------
  |  |  |  |   25|   507k|#define PPMD_INT_BITS 7
  |  |  ------------------
  |  |               #define PPMD_BIN_SCALE (1 << (PPMD_INT_BITS + PPMD_PERIOD_BITS))
  |  |  ------------------
  |  |  |  |   26|   507k|#define PPMD_PERIOD_BITS 7
  |  |  ------------------
  ------------------
  488|  4.57M|      for (r = 0; r < 64; r += 8)
  ------------------
  |  Branch (488:19): [True: 4.06M, False: 507k]
  ------------------
  489|  4.06M|        dest[r] = val;
  490|   507k|    }
  491|  63.4k|  }
  492|       |
  493|  63.4k|  for (i = m = 0; m < 24; m++)
  ------------------
  |  Branch (493:19): [True: 60.9k, False: 2.53k]
  ------------------
  494|  60.9k|  {
  495|  60.9k|    unsigned summ;
  496|  60.9k|    CPpmd_See *s;
  497|   708k|    while (p->NS2Indx[(size_t)i + 3] == m + 3)
  ------------------
  |  Branch (497:12): [True: 647k, False: 60.9k]
  ------------------
  498|   647k|      i++;
  499|  60.9k|    s = p->See[m];
  500|  60.9k|    summ = ((2 * i + 5) << (PPMD_PERIOD_BITS - 4));
  ------------------
  |  |   26|  60.9k|#define PPMD_PERIOD_BITS 7
  ------------------
  501|  2.01M|    for (k = 0; k < 32; k++, s++)
  ------------------
  |  Branch (501:17): [True: 1.94M, False: 60.9k]
  ------------------
  502|  1.94M|    {
  503|  1.94M|      s->Summ = (UInt16)summ;
  504|  1.94M|      s->Shift = (PPMD_PERIOD_BITS - 4);
  ------------------
  |  |   26|  1.94M|#define PPMD_PERIOD_BITS 7
  ------------------
  505|  1.94M|      s->Count = 7;
  506|  1.94M|    }
  507|  60.9k|  }
  508|       |
  509|  2.53k|  p->DummySee.Summ = 0; /* unused */
  510|  2.53k|  p->DummySee.Shift = PPMD_PERIOD_BITS;
  ------------------
  |  |   26|  2.53k|#define PPMD_PERIOD_BITS 7
  ------------------
  511|  2.53k|  p->DummySee.Count = 64; /* unused */
  512|  2.53k|}
Ppmd8.c:SWAP_STATES:
  594|  37.6M|{
  595|  37.6M|  CPpmd_State tmp = *t1;
  596|  37.6M|  *t1 = *t2;
  597|  37.6M|  *t2 = tmp;
  598|  37.6M|}
Ppmd8.c:Ppmd8_CreateSuccessors:
  864|  31.7M|{
  865|       |
  866|  31.7M|  CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState);
  ------------------
  |  |  422|  31.7M|#define SUCCESSOR(p) Ppmd_GET_SUCCESSOR(p)
  |  |  ------------------
  |  |  |  |  152|  31.7M|    ( (CPpmd_Void_Ref) ((p)->Successor_0 | ((UInt32)(p)->Successor_1 << 16)) )
  |  |  ------------------
  ------------------
  867|  31.7M|  Byte newSym, newFreq, flags;
  868|  31.7M|  unsigned numPs = 0;
  869|  31.7M|  CPpmd_State *ps[PPMD8_MAX_ORDER + 1]; /* fixed over Shkarin's code. Maybe it could work without + 1 too. */
  870|       |  
  871|  31.7M|  if (!skip)
  ------------------
  |  Branch (871:7): [True: 22.2M, False: 9.52M]
  ------------------
  872|  22.2M|    ps[numPs++] = p->FoundState;
  873|       |  
  874|  59.3M|  while (c->Suffix)
  ------------------
  |  Branch (874:10): [True: 59.0M, False: 293k]
  ------------------
  875|  59.0M|  {
  876|  59.0M|    CPpmd_Void_Ref successor;
  877|  59.0M|    CPpmd_State *s;
  878|  59.0M|    c = SUFFIX(c);
  ------------------
  |  |   34|  59.0M|#define SUFFIX(ctx) CTX((ctx)->Suffix)
  |  |  ------------------
  |  |  |  |   31|  59.0M|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  59.0M|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  59.0M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  114|  59.0M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  879|       |    
  880|  59.0M|    if (s1) { s = s1; s1 = NULL; }
  ------------------
  |  Branch (880:9): [True: 31.4M, False: 27.6M]
  ------------------
  881|  27.6M|    else if (c->NumStats != 0)
  ------------------
  |  Branch (881:14): [True: 15.0M, False: 12.6M]
  ------------------
  882|  15.0M|    {
  883|  15.0M|      Byte sym = p->FoundState->Symbol;
  884|   926M|      for (s = STATS(c); s->Symbol != sym; s++);
  ------------------
  |  |   32|  15.0M|#define STATS(ctx) Ppmd8_GetStats(p, ctx)
  |  |  ------------------
  |  |  |  |  117|  15.0M|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  15.0M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  15.0M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (884:26): [True: 911M, False: 15.0M]
  ------------------
  885|  15.0M|      if (s->Freq < MAX_FREQ - 9) { s->Freq++; c->Union2.SummFreq++; }
  ------------------
  |  |   19|  15.0M|#define MAX_FREQ 124
  ------------------
  |  Branch (885:11): [True: 14.7M, False: 221k]
  ------------------
  886|  15.0M|    }
  887|  12.6M|    else
  888|  12.6M|    {
  889|  12.6M|      s = ONE_STATE(c);
  ------------------
  |  |   33|  12.6M|#define ONE_STATE(ctx) Ppmd8Context_OneState(ctx)
  |  |  ------------------
  |  |  |  |   48|  12.6M|#define Ppmd8Context_OneState(p) ((CPpmd_State *)&(p)->Union2)
  |  |  ------------------
  ------------------
  890|  12.6M|      s->Freq = (Byte)(s->Freq + (!SUFFIX(c)->NumStats & (s->Freq < 24)));
  ------------------
  |  |   34|  12.6M|#define SUFFIX(ctx) CTX((ctx)->Suffix)
  |  |  ------------------
  |  |  |  |   31|  12.6M|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  12.6M|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|  12.6M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  114|  12.6M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  891|  12.6M|    }
  892|  59.0M|    successor = SUCCESSOR(s);
  ------------------
  |  |  422|  59.0M|#define SUCCESSOR(p) Ppmd_GET_SUCCESSOR(p)
  |  |  ------------------
  |  |  |  |  152|  59.0M|    ( (CPpmd_Void_Ref) ((p)->Successor_0 | ((UInt32)(p)->Successor_1 << 16)) )
  |  |  ------------------
  ------------------
  893|  59.0M|    if (successor != upBranch)
  ------------------
  |  Branch (893:9): [True: 31.4M, False: 27.6M]
  ------------------
  894|  31.4M|    {
  895|       |
  896|  31.4M|      c = CTX(successor);
  ------------------
  |  |   31|  31.4M|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  ------------------
  |  |  |  |  116|  31.4M|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  31.4M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  31.4M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  897|  31.4M|      if (numPs == 0)
  ------------------
  |  Branch (897:11): [True: 1.07M, False: 30.4M]
  ------------------
  898|  1.07M|      {
  899|       |        
  900|       |       
  901|  1.07M|        return c;
  902|  1.07M|      }
  903|  30.4M|      break;
  904|  31.4M|    }
  905|  27.6M|    ps[numPs++] = s;
  906|  27.6M|  }
  907|       |  
  908|       |  
  909|       |  
  910|       |  
  911|       |  
  912|  30.7M|  newSym = *(const Byte *)Ppmd8_GetPtr(p, upBranch);
  ------------------
  |  |  115|  30.7M|#define Ppmd8_GetPtr(p, ptr)     Ppmd_GetPtr(p, ptr)
  |  |  ------------------
  |  |  |  |  114|  30.7M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  ------------------
  ------------------
  913|  30.7M|  upBranch++;
  914|  30.7M|  flags = (Byte)(PPMD8_HiBitsFlag_4(p->FoundState->Symbol) + PPMD8_HiBitsFlag_3(newSym));
  ------------------
  |  |  533|  30.7M|#define PPMD8_HiBitsFlag_4(sym) HiBits_Convert_4(HiBits_Prepare(sym))
  |  |  ------------------
  |  |  |  |  530|  30.7M|#define HiBits_Convert_4(flags) (((flags) >> (8 - 4)) & (1 << 4))
  |  |  ------------------
  ------------------
                flags = (Byte)(PPMD8_HiBitsFlag_4(p->FoundState->Symbol) + PPMD8_HiBitsFlag_3(newSym));
  ------------------
  |  |  532|  30.7M|#define PPMD8_HiBitsFlag_3(sym) HiBits_Convert_3(HiBits_Prepare(sym))
  |  |  ------------------
  |  |  |  |  529|  30.7M|#define HiBits_Convert_3(flags) (((flags) >> (8 - 3)) & (1 << 3))
  |  |  ------------------
  ------------------
  915|       |  
  916|  30.7M|  if (c->NumStats == 0)
  ------------------
  |  Branch (916:7): [True: 361k, False: 30.3M]
  ------------------
  917|   361k|    newFreq = c->Union2.State2.Freq;
  918|  30.3M|  else
  919|  30.3M|  {
  920|  30.3M|    UInt32 cf, s0;
  921|  30.3M|    CPpmd_State *s;
  922|  1.38G|    for (s = STATS(c); s->Symbol != newSym; s++);
  ------------------
  |  |   32|  30.3M|#define STATS(ctx) Ppmd8_GetStats(p, ctx)
  |  |  ------------------
  |  |  |  |  117|  30.3M|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  30.3M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  30.3M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (922:24): [True: 1.35G, False: 30.3M]
  ------------------
  923|  30.3M|    cf = (UInt32)s->Freq - 1;
  924|  30.3M|    s0 = (UInt32)c->Union2.SummFreq - c->NumStats - cf;
  925|       |    /*
  926|       |    
  927|       |
  928|       |      max(newFreq)= (s->Freq - 1), when (s0 == 1)
  929|       |
  930|       |
  931|       |    */
  932|  30.3M|    newFreq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((cf + 2 * s0 - 3) / s0)));
  ------------------
  |  Branch (932:27): [True: 29.9M, False: 409k]
  ------------------
  933|  30.3M|  }
  934|       |
  935|       |
  936|       |
  937|  30.7M|  do
  938|  49.8M|  {
  939|  49.8M|    PPMD8_CTX_PTR c1;
  940|       |    /* = AllocContext(p); */
  941|  49.8M|    if (p->HiUnit != p->LoUnit)
  ------------------
  |  Branch (941:9): [True: 40.9M, False: 8.94M]
  ------------------
  942|  40.9M|      c1 = (PPMD8_CTX_PTR)(void *)(p->HiUnit -= UNIT_SIZE);
  ------------------
  |  |   20|  40.9M|#define UNIT_SIZE 12
  ------------------
  943|  8.94M|    else if (p->FreeList[0] != 0)
  ------------------
  |  Branch (943:14): [True: 3.79M, False: 5.15M]
  ------------------
  944|  3.79M|      c1 = (PPMD8_CTX_PTR)Ppmd8_RemoveNode(p, 0);
  945|  5.15M|    else
  946|  5.15M|    {
  947|  5.15M|      c1 = (PPMD8_CTX_PTR)Ppmd8_AllocUnitsRare(p, 0);
  948|  5.15M|      if (!c1)
  ------------------
  |  Branch (948:11): [True: 7, False: 5.15M]
  ------------------
  949|      7|        return NULL;
  950|  5.15M|    }
  951|  49.8M|    c1->Flags = flags;
  952|  49.8M|    c1->NumStats = 0;
  953|  49.8M|    c1->Union2.State2.Symbol = newSym;
  954|  49.8M|    c1->Union2.State2.Freq = newFreq;
  955|  49.8M|    Ppmd8State_SetSuccessor(ONE_STATE(c1), upBranch);
  ------------------
  |  |   33|  49.8M|#define ONE_STATE(ctx) Ppmd8Context_OneState(ctx)
  |  |  ------------------
  |  |  |  |   48|  49.8M|#define Ppmd8Context_OneState(p) ((CPpmd_State *)&(p)->Union2)
  |  |  ------------------
  ------------------
  956|  49.8M|    c1->Suffix = REF(c);
  ------------------
  |  |   27|  49.8M|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  ------------------
  |  |  |  |  113|  49.8M|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  ------------------
  ------------------
  957|  49.8M|    Ppmd8State_SetSuccessor(ps[--numPs], REF(c1));
  ------------------
  |  |   27|  49.8M|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  ------------------
  |  |  |  |  113|  49.8M|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  ------------------
  ------------------
  958|  49.8M|    c = c1;
  959|  49.8M|  }
  960|  49.8M|  while (numPs != 0);
  ------------------
  |  Branch (960:10): [True: 19.1M, False: 30.7M]
  ------------------
  961|       |  
  962|  30.7M|  return c;
  963|  30.7M|}
Ppmd8.c:Ppmd8_RemoveNode:
  128|  30.4M|{
  129|  30.4M|  CPpmd8_Node *node = NODE((CPpmd8_Node_Ref)p->FreeList[indx]);
  ------------------
  |  |   50|  30.4M|#define NODE(r)  Ppmd_GetPtr_Type(p, r, CPpmd8_Node)
  |  |  ------------------
  |  |  |  |  115|  30.4M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  30.4M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  130|  30.4M|  p->FreeList[indx] = node->Next;
  131|  30.4M|  p->Stamps[indx]--;
  132|       |
  133|  30.4M|  return node;
  134|  30.4M|}
Ppmd8.c:Ppmd8_AllocUnitsRare:
  255|  8.78M|{
  256|  8.78M|  unsigned i;
  257|       |  
  258|  8.78M|  if (p->GlueCount == 0)
  ------------------
  |  Branch (258:7): [True: 853, False: 8.78M]
  ------------------
  259|    853|  {
  260|    853|    Ppmd8_GlueFreeBlocks(p);
  261|    853|    if (p->FreeList[indx] != 0)
  ------------------
  |  Branch (261:9): [True: 741, False: 112]
  ------------------
  262|    741|      return Ppmd8_RemoveNode(p, indx);
  263|    853|  }
  264|       |  
  265|  8.78M|  i = indx;
  266|       |  
  267|  8.78M|  do
  268|  80.7M|  {
  269|  80.7M|    if (++i == PPMD_NUM_INDEXES)
  ------------------
  |  |   38|  80.7M|#define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   34|  80.7M|#define PPMD_N1 4
  |  |  ------------------
  |  |               #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   35|  80.7M|#define PPMD_N2 4
  |  |  ------------------
  |  |               #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   36|  80.7M|#define PPMD_N3 4
  |  |  ------------------
  |  |               #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   37|  80.7M|#define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  80.7M|#define PPMD_N1 4
  |  |  |  |  ------------------
  |  |  |  |               #define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  80.7M|#define PPMD_N2 4
  |  |  |  |  ------------------
  |  |  |  |               #define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  80.7M|#define PPMD_N3 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (269:9): [True: 1.00M, False: 79.7M]
  ------------------
  270|  1.00M|    {
  271|  1.00M|      UInt32 numBytes = U2B(I2U(indx));
  ------------------
  |  |   22|  1.00M|#define U2B(nu) ((UInt32)(nu) * UNIT_SIZE)
  |  |  ------------------
  |  |  |  |   20|  1.00M|#define UNIT_SIZE 12
  |  |  ------------------
  ------------------
  272|  1.00M|      Byte *us = p->UnitsStart;
  273|  1.00M|      p->GlueCount--;
  274|  1.00M|      return ((UInt32)(us - p->Text) > numBytes) ? (p->UnitsStart = us - numBytes) : (NULL);
  ------------------
  |  Branch (274:14): [True: 1.00M, False: 453]
  ------------------
  275|  1.00M|    }
  276|  80.7M|  }
  277|  79.7M|  while (p->FreeList[i] == 0);
  ------------------
  |  Branch (277:10): [True: 71.9M, False: 7.77M]
  ------------------
  278|       |  
  279|  7.77M|  {
  280|  7.77M|    void *block = Ppmd8_RemoveNode(p, i);
  281|  7.77M|    Ppmd8_SplitBlock(p, block, i, indx);
  282|  7.77M|    return block;
  283|  8.78M|  }
  284|  8.78M|}
Ppmd8.c:Ppmd8_GlueFreeBlocks:
  163|    853|{
  164|       |  /*
  165|       |  we use first UInt32 field of 12-bytes UNITs as record type stamp
  166|       |    CPpmd_State    { Byte Symbol; Byte Freq; : Freq != 0xFF
  167|       |    CPpmd8_Context { Byte NumStats; Byte Flags; UInt16 SummFreq;  : Flags != 0xFF ???
  168|       |    CPpmd8_Node    { UInt32 Stamp            : Stamp == 0xFFFFFFFF for free record
  169|       |                                             : Stamp == 0 for guard
  170|       |    Last 12-bytes UNIT in array is always contains 12-bytes order-0 CPpmd8_Context record
  171|       |  */
  172|    853|  CPpmd8_Node_Ref n;
  173|       |
  174|    853|  p->GlueCount = 1 << 13;
  175|    853|  memset(p->Stamps, 0, sizeof(p->Stamps));
  176|       |  
  177|       |  /* we set guard NODE at LoUnit */
  178|    853|  if (p->LoUnit != p->HiUnit)
  ------------------
  |  Branch (178:7): [True: 511, False: 342]
  ------------------
  179|    511|    ((CPpmd8_Node *)(void *)p->LoUnit)->Stamp = 0;
  180|       |
  181|    853|  {
  182|       |    /* Glue free blocks */
  183|    853|    CPpmd8_Node_Ref *prev = &n;
  184|    853|    unsigned i;
  185|  33.2k|    for (i = 0; i < PPMD_NUM_INDEXES; i++)
  ------------------
  |  |   38|  33.2k|#define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   34|  33.2k|#define PPMD_N1 4
  |  |  ------------------
  |  |               #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   35|  33.2k|#define PPMD_N2 4
  |  |  ------------------
  |  |               #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   36|  33.2k|#define PPMD_N3 4
  |  |  ------------------
  |  |               #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   37|  33.2k|#define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  33.2k|#define PPMD_N1 4
  |  |  |  |  ------------------
  |  |  |  |               #define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  33.2k|#define PPMD_N2 4
  |  |  |  |  ------------------
  |  |  |  |               #define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  33.2k|#define PPMD_N3 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (185:17): [True: 32.4k, False: 853]
  ------------------
  186|  32.4k|    {
  187|       |
  188|  32.4k|      CPpmd8_Node_Ref next = (CPpmd8_Node_Ref)p->FreeList[i];
  189|  32.4k|      p->FreeList[i] = 0;
  190|  2.01M|      while (next != 0)
  ------------------
  |  Branch (190:14): [True: 1.98M, False: 32.4k]
  ------------------
  191|  1.98M|      {
  192|  1.98M|        CPpmd8_Node *node = NODE(next);
  ------------------
  |  |   50|  1.98M|#define NODE(r)  Ppmd_GetPtr_Type(p, r, CPpmd8_Node)
  |  |  ------------------
  |  |  |  |  115|  1.98M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  1.98M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  193|  1.98M|        UInt32 nu = node->NU;
  194|  1.98M|        *prev = next;
  195|  1.98M|        next = node->Next;
  196|  1.98M|        if (nu != 0)
  ------------------
  |  Branch (196:13): [True: 1.52M, False: 459k]
  ------------------
  197|  1.52M|        {
  198|  1.52M|          CPpmd8_Node *node2;
  199|  1.52M|          prev = &(node->Next);
  200|  2.16M|          while ((node2 = node + nu)->Stamp == EMPTY_NODE)
  ------------------
  |  |  114|  2.16M|#define EMPTY_NODE 0xFFFFFFFF
  ------------------
  |  Branch (200:18): [True: 639k, False: 1.52M]
  ------------------
  201|   639k|          {
  202|   639k|            nu += node2->NU;
  203|   639k|            node2->NU = 0;
  204|   639k|            node->NU = nu;
  205|   639k|          }
  206|  1.52M|        }
  207|  1.98M|      }
  208|  32.4k|    }
  209|       |
  210|    853|    *prev = 0;
  211|    853|  }
  212|       |
  213|       |
  214|       |
  215|       |  
  216|       |
  217|       |
  218|       |
  219|       |
  220|       |
  221|       |
  222|       |  
  223|       |
  224|       |  
  225|       |  
  226|       |  
  227|       |  
  228|       |  
  229|       |  
  230|       |  
  231|       |  
  232|       |  /* Fill lists of free blocks */
  233|  1.52M|  while (n != 0)
  ------------------
  |  Branch (233:10): [True: 1.52M, False: 853]
  ------------------
  234|  1.52M|  {
  235|  1.52M|    CPpmd8_Node *node = NODE(n);
  ------------------
  |  |   50|  1.52M|#define NODE(r)  Ppmd_GetPtr_Type(p, r, CPpmd8_Node)
  |  |  ------------------
  |  |  |  |  115|  1.52M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  1.52M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  236|  1.52M|    UInt32 nu = node->NU;
  237|  1.52M|    unsigned i;
  238|  1.52M|    n = node->Next;
  239|  1.52M|    if (nu == 0)
  ------------------
  |  Branch (239:9): [True: 179k, False: 1.34M]
  ------------------
  240|   179k|      continue;
  241|  1.37M|    for (; nu > 128; nu -= 128, node += 128)
  ------------------
  |  Branch (241:12): [True: 34.0k, False: 1.34M]
  ------------------
  242|  34.0k|      Ppmd8_InsertNode(p, node, PPMD_NUM_INDEXES - 1);
  ------------------
  |  |   38|  34.0k|#define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   34|  34.0k|#define PPMD_N1 4
  |  |  ------------------
  |  |               #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   35|  34.0k|#define PPMD_N2 4
  |  |  ------------------
  |  |               #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   36|  34.0k|#define PPMD_N3 4
  |  |  ------------------
  |  |               #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
  |  |  ------------------
  |  |  |  |   37|  34.0k|#define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |   34|  34.0k|#define PPMD_N1 4
  |  |  |  |  ------------------
  |  |  |  |               #define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|  34.0k|#define PPMD_N2 4
  |  |  |  |  ------------------
  |  |  |  |               #define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  34.0k|#define PPMD_N3 4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  243|  1.34M|    if (I2U(i = U2I(nu)) != nu)
  ------------------
  |  |   24|  1.34M|#define I2U(indx) ((unsigned)p->Indx2Units[indx])
  ------------------
  |  Branch (243:9): [True: 92.0k, False: 1.25M]
  ------------------
  244|  92.0k|    {
  245|  92.0k|      unsigned k = I2U(--i);
  ------------------
  |  |   24|  92.0k|#define I2U(indx) ((unsigned)p->Indx2Units[indx])
  ------------------
  246|  92.0k|      Ppmd8_InsertNode(p, node + k, (unsigned)nu - k - 1);
  247|  92.0k|    }
  248|  1.34M|    Ppmd8_InsertNode(p, node, i);
  249|  1.34M|  }
  250|    853|}
Ppmd8.c:Ppmd8_SplitBlock:
  138|  7.78M|{
  139|  7.78M|  unsigned i, nu = I2U(oldIndx) - I2U(newIndx);
  ------------------
  |  |   24|  7.78M|#define I2U(indx) ((unsigned)p->Indx2Units[indx])
  ------------------
                unsigned i, nu = I2U(oldIndx) - I2U(newIndx);
  ------------------
  |  |   24|  7.78M|#define I2U(indx) ((unsigned)p->Indx2Units[indx])
  ------------------
  140|  7.78M|  ptr = (Byte *)ptr + U2B(I2U(newIndx));
  ------------------
  |  |   22|  7.78M|#define U2B(nu) ((UInt32)(nu) * UNIT_SIZE)
  |  |  ------------------
  |  |  |  |   20|  7.78M|#define UNIT_SIZE 12
  |  |  ------------------
  ------------------
  141|  7.78M|  if (I2U(i = U2I(nu)) != nu)
  ------------------
  |  |   24|  7.78M|#define I2U(indx) ((unsigned)p->Indx2Units[indx])
  ------------------
  |  Branch (141:7): [True: 3.23M, False: 4.54M]
  ------------------
  142|  3.23M|  {
  143|  3.23M|    unsigned k = I2U(--i);
  ------------------
  |  |   24|  3.23M|#define I2U(indx) ((unsigned)p->Indx2Units[indx])
  ------------------
  144|  3.23M|    Ppmd8_InsertNode(p, ((Byte *)ptr) + U2B(k), nu - k - 1);
  ------------------
  |  |   22|  3.23M|#define U2B(nu) ((UInt32)(nu) * UNIT_SIZE)
  |  |  ------------------
  |  |  |  |   20|  3.23M|#define UNIT_SIZE 12
  |  |  ------------------
  ------------------
  145|  3.23M|  }
  146|  7.78M|  Ppmd8_InsertNode(p, ptr, i);
  147|  7.78M|}
Ppmd8.c:Ppmd8State_SetSuccessor:
  424|   198M|{
  425|   198M|  Ppmd_SET_SUCCESSOR(p, v)
  ------------------
  |  |  154|   198M|  #define Ppmd_SET_SUCCESSOR(p, v) { \
  |  |  155|   198M|    (p)->Successor_0 = (UInt16)((UInt32)(v) /* & 0xFFFF */); \
  |  |  156|   198M|    (p)->Successor_1 = (UInt16)(((UInt32)(v) >> 16) /* & 0xFFFF */); }
  ------------------
  426|   198M|}
Ppmd8.c:RestoreModel:
  784|    513|{
  785|    513|  PPMD8_CTX_PTR c;
  786|    513|  CPpmd_State *s;
  787|    513|  RESET_TEXT(0)
  ------------------
  |  |  428|    513|#define RESET_TEXT(offs) { p->Text = p->Base + p->AlignOffset + (offs); }
  ------------------
  788|       |
  789|       |  // we go here in cases of error of allocation for context (c1)
  790|       |  // Order(MinContext) < Order(ctxError) <= Order(MaxContext)
  791|       |  
  792|       |  // We remove last symbol from each of contexts [p->MaxContext ... ctxError) contexts
  793|       |  // So we rollback all created (symbols) before error.
  794|    850|  for (c = p->MaxContext; c != ctxError; c = SUFFIX(c))
  ------------------
  |  |   34|    337|#define SUFFIX(ctx) CTX((ctx)->Suffix)
  |  |  ------------------
  |  |  |  |   31|    337|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|    337|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|    337|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  114|    337|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (794:27): [True: 337, False: 513]
  ------------------
  795|    337|    if (--(c->NumStats) == 0)
  ------------------
  |  Branch (795:9): [True: 150, False: 187]
  ------------------
  796|    150|    {
  797|    150|      s = STATS(c);
  ------------------
  |  |   32|    150|#define STATS(ctx) Ppmd8_GetStats(p, ctx)
  |  |  ------------------
  |  |  |  |  117|    150|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    150|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|    150|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  798|    150|      c->Flags = (Byte)((c->Flags & FLAG_PREV_HIGH) + PPMD8_HiBitsFlag_3(s->Symbol));
  ------------------
  |  |  525|    150|#define FLAG_PREV_HIGH (1 << 4)
  ------------------
                    c->Flags = (Byte)((c->Flags & FLAG_PREV_HIGH) + PPMD8_HiBitsFlag_3(s->Symbol));
  ------------------
  |  |  532|    150|#define PPMD8_HiBitsFlag_3(sym) HiBits_Convert_3(HiBits_Prepare(sym))
  |  |  ------------------
  |  |  |  |  529|    150|#define HiBits_Convert_3(flags) (((flags) >> (8 - 3)) & (1 << 3))
  |  |  ------------------
  ------------------
  799|       |      // *ONE_STATE(c) = *s;
  800|    150|      c->Union2.State2.Symbol = s->Symbol;
  801|    150|      c->Union2.State2.Freq = (Byte)(((unsigned)s->Freq + 11) >> 3);
  802|    150|      c->Union4.State4.Successor_0 = s->Successor_0;
  803|    150|      c->Union4.State4.Successor_1 = s->Successor_1;
  804|       |
  805|    150|      SpecialFreeUnit(p, s);
  806|    150|    }
  807|    187|    else
  808|    187|    {
  809|       |      /* Refresh() can increase Escape_Freq on value of Freq of last symbol, that was added before error.
  810|       |         so the largest possible increase for Escape_Freq is (8) from value before ModelUpoadet() */
  811|    187|      Refresh(p, c, ((unsigned)c->NumStats + 3) >> 1, 0);
  812|    187|    }
  813|       | 
  814|       |  // increase Escape Freq for context [ctxError ... p->MinContext)
  815|  1.01k|  for (; c != p->MinContext; c = SUFFIX(c))
  ------------------
  |  |   34|    504|#define SUFFIX(ctx) CTX((ctx)->Suffix)
  |  |  ------------------
  |  |  |  |   31|    504|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|    504|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|    504|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  114|    504|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (815:10): [True: 504, False: 513]
  ------------------
  816|    504|    if (c->NumStats == 0)
  ------------------
  |  Branch (816:9): [True: 21, False: 483]
  ------------------
  817|     21|    {
  818|       |      // ONE_STATE(c)
  819|     21|      c->Union2.State2.Freq = (Byte)(((unsigned)c->Union2.State2.Freq + 1) >> 1);
  820|     21|    }
  821|    483|    else if ((c->Union2.SummFreq = (UInt16)(c->Union2.SummFreq + 4)) > 128 + 4 * c->NumStats)
  ------------------
  |  Branch (821:14): [True: 448, False: 35]
  ------------------
  822|    448|      Refresh(p, c, ((unsigned)c->NumStats + 2) >> 1, 1);
  823|       |
  824|       |  #ifdef PPMD8_FREEZE_SUPPORT
  825|       |  if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
  826|       |  {
  827|       |    p->MaxContext = fSuccessor;
  828|       |    p->GlueCount += !(p->Stamps[1] & 1); // why?
  829|       |  }
  830|       |  else if (p->RestoreMethod == PPMD8_RESTORE_METHOD_FREEZE)
  831|       |  {
  832|       |    while (p->MaxContext->Suffix)
  833|       |      p->MaxContext = SUFFIX(p->MaxContext);
  834|       |    RemoveBinContexts(p, p->MaxContext, 0);
  835|       |    // we change the current mode to (PPMD8_RESTORE_METHOD_FREEZE + 1)
  836|       |    p->RestoreMethod = PPMD8_RESTORE_METHOD_FREEZE + 1;
  837|       |    p->GlueCount = 0;
  838|       |    p->OrderFall = p->MaxOrder;
  839|       |  }
  840|       |  else
  841|       |  #endif
  842|    513|  if (p->RestoreMethod == PPMD8_RESTORE_METHOD_RESTART || GetUsedMemory(p) < (p->Size >> 1))
  ------------------
  |  Branch (842:7): [True: 513, False: 0]
  |  Branch (842:59): [True: 0, False: 0]
  ------------------
  843|    513|    Ppmd8_RestartModel(p);
  844|      0|  else
  845|      0|  {
  846|      0|    while (p->MaxContext->Suffix)
  ------------------
  |  Branch (846:12): [True: 0, False: 0]
  ------------------
  847|      0|      p->MaxContext = SUFFIX(p->MaxContext);
  ------------------
  |  |   34|      0|#define SUFFIX(ctx) CTX((ctx)->Suffix)
  |  |  ------------------
  |  |  |  |   31|      0|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|      0|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  114|      0|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  848|      0|    do
  849|      0|    {
  850|      0|      CutOff(p, p->MaxContext, 0);
  851|      0|      ExpandTextArea(p);
  852|      0|    }
  853|      0|    while (GetUsedMemory(p) > 3 * (p->Size >> 2));
  ------------------
  |  Branch (853:12): [True: 0, False: 0]
  ------------------
  854|      0|    p->GlueCount = 0;
  855|      0|    p->OrderFall = p->MaxOrder;
  856|      0|  }
  857|    513|  p->MinContext = p->MaxContext;
  858|    513|}
Ppmd8.c:SpecialFreeUnit:
  344|    150|{
  345|    150|  if ((Byte *)ptr != p->UnitsStart)
  ------------------
  |  Branch (345:7): [True: 148, False: 2]
  ------------------
  346|    148|    Ppmd8_InsertNode(p, ptr, 0);
  347|      2|  else
  348|      2|  {
  349|       |    #ifdef PPMD8_FREEZE_SUPPORT
  350|       |    *(UInt32 *)ptr = EMPTY_NODE; /* it's used for (Flags == 0xFF) check in RemoveBinContexts() */
  351|       |    #endif
  352|      2|    p->UnitsStart += UNIT_SIZE;
  ------------------
  |  |   20|      2|#define UNIT_SIZE 12
  ------------------
  353|      2|  }
  354|    150|}
Ppmd8.c:Refresh:
  544|    635|{
  545|    635|  unsigned i = ctx->NumStats, escFreq, sumFreq, flags;
  546|    635|  CPpmd_State *s = (CPpmd_State *)ShrinkUnits(p, STATS(ctx), oldNU, (i + 2) >> 1);
  ------------------
  |  |   32|    635|#define STATS(ctx) Ppmd8_GetStats(p, ctx)
  |  |  ------------------
  |  |  |  |  117|    635|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    635|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|    635|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  547|    635|  ctx->Union4.Stats = REF(s);
  ------------------
  |  |   27|    635|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  ------------------
  |  |  |  |  113|    635|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  ------------------
  ------------------
  548|       |
  549|       |  // #ifdef PPMD8_FREEZE_SUPPORT
  550|       |  /*
  551|       |    (ctx->Union2.SummFreq >= ((UInt32)1 << 15)) can be in FREEZE mode for some files.
  552|       |    It's not good for range coder. So new versions of support fix:
  553|       |       -   original PPMdI code rev.1
  554|       |       +   original PPMdI code rev.2
  555|       |       -   7-Zip default ((PPMD8_FREEZE_SUPPORT is not defined)
  556|       |       +   7-Zip (p->RestoreMethod >= PPMD8_RESTORE_METHOD_FREEZE)
  557|       |    if we       use that fixed line, we can lose compatibility with some files created before fix
  558|       |    if we don't use that fixed line, the program can work incorrectly in FREEZE mode in rare case.
  559|       |  */
  560|       |  // if (p->RestoreMethod >= PPMD8_RESTORE_METHOD_FREEZE)
  561|    635|  {
  562|    635|    scale |= (ctx->Union2.SummFreq >= ((UInt32)1 << 15));
  563|    635|  }
  564|       |  // #endif
  565|       |
  566|       |
  567|       |
  568|    635|  flags = HiBits_Prepare(s->Symbol);
  ------------------
  |  |  527|    635|#define HiBits_Prepare(sym) ((unsigned)(sym) + 0xC0)
  ------------------
  569|    635|  {
  570|    635|    unsigned freq = s->Freq;
  571|    635|    escFreq = ctx->Union2.SummFreq - freq;
  572|    635|    freq = (freq + scale) >> scale;
  573|    635|    sumFreq = freq;
  574|    635|    s->Freq = (Byte)freq;
  575|    635|  }
  576|       | 
  577|    635|  do
  578|  85.7k|  {
  579|  85.7k|    unsigned freq = (++s)->Freq;
  580|  85.7k|    escFreq -= freq;
  581|  85.7k|    freq = (freq + scale) >> scale;
  582|  85.7k|    sumFreq += freq;
  583|  85.7k|    s->Freq = (Byte)freq;
  584|  85.7k|    flags |= HiBits_Prepare(s->Symbol);
  ------------------
  |  |  527|  85.7k|#define HiBits_Prepare(sym) ((unsigned)(sym) + 0xC0)
  ------------------
  585|  85.7k|  }
  586|  85.7k|  while (--i);
  ------------------
  |  Branch (586:10): [True: 85.0k, False: 635]
  ------------------
  587|       |  
  588|    635|  ctx->Union2.SummFreq = (UInt16)(sumFreq + ((escFreq + scale) >> scale));
  589|    635|  ctx->Flags = (Byte)((ctx->Flags & (FLAG_PREV_HIGH + FLAG_RESCALED * scale)) + HiBits_Convert_3(flags));
  ------------------
  |  |  525|    635|#define FLAG_PREV_HIGH (1 << 4)
  ------------------
                ctx->Flags = (Byte)((ctx->Flags & (FLAG_PREV_HIGH + FLAG_RESCALED * scale)) + HiBits_Convert_3(flags));
  ------------------
  |  |  523|    635|#define FLAG_RESCALED  (1 << 2)
  ------------------
                ctx->Flags = (Byte)((ctx->Flags & (FLAG_PREV_HIGH + FLAG_RESCALED * scale)) + HiBits_Convert_3(flags));
  ------------------
  |  |  529|    635|#define HiBits_Convert_3(flags) (((flags) >> (8 - 3)) & (1 << 3))
  ------------------
  590|    635|}
Ppmd8.c:ShrinkUnits:
  320|  31.7k|{
  321|  31.7k|  unsigned i0 = U2I(oldNU);
  ------------------
  |  |   23|  31.7k|#define U2I(nu) (p->Units2Indx[(size_t)(nu) - 1])
  ------------------
  322|  31.7k|  unsigned i1 = U2I(newNU);
  ------------------
  |  |   23|  31.7k|#define U2I(nu) (p->Units2Indx[(size_t)(nu) - 1])
  ------------------
  323|  31.7k|  if (i0 == i1)
  ------------------
  |  Branch (323:7): [True: 2.97k, False: 28.7k]
  ------------------
  324|  2.97k|    return oldPtr;
  325|  28.7k|  if (p->FreeList[i1] != 0)
  ------------------
  |  Branch (325:7): [True: 22.4k, False: 6.33k]
  ------------------
  326|  22.4k|  {
  327|  22.4k|    void *ptr = Ppmd8_RemoveNode(p, i1);
  328|  22.4k|    MEM_12_CPY(ptr, oldPtr, newNU)
  ------------------
  |  |  305|  22.4k|  { UInt32 *d = (UInt32 *)(dest); \
  |  |  306|  22.4k|    const UInt32 *z = (const UInt32 *)(src); \
  |  |  307|  22.4k|    unsigned n = (num); \
  |  |  308|   223k|    do { \
  |  |  309|   223k|      d[0] = z[0]; \
  |  |  310|   223k|      d[1] = z[1]; \
  |  |  311|   223k|      d[2] = z[2]; \
  |  |  312|   223k|      z += 3; \
  |  |  313|   223k|      d += 3; \
  |  |  314|   223k|    } while (--n); \
  |  |  ------------------
  |  |  |  Branch (314:14): [True: 201k, False: 22.4k]
  |  |  ------------------
  |  |  315|  22.4k|  }
  ------------------
  329|  22.4k|    Ppmd8_InsertNode(p, oldPtr, i0);
  330|  22.4k|    return ptr;
  331|  22.4k|  }
  332|  6.33k|  Ppmd8_SplitBlock(p, oldPtr, i0, i1);
  333|  6.33k|  return oldPtr;
  334|  28.7k|}
Ppmd8.c:ReduceOrder:
  967|   320k|{
  968|   320k|  CPpmd_State *s = NULL;
  969|   320k|  PPMD8_CTX_PTR c1 = c;
  970|   320k|  CPpmd_Void_Ref upBranch = REF(p->Text);
  ------------------
  |  |   27|   320k|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  ------------------
  |  |  |  |  113|   320k|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  ------------------
  ------------------
  971|       |  
  972|       |  #ifdef PPMD8_FREEZE_SUPPORT
  973|       |  /* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */
  974|       |  CPpmd_State *ps[PPMD8_MAX_ORDER + 1];
  975|       |  unsigned numPs = 0;
  976|       |  ps[numPs++] = p->FoundState;
  977|       |  #endif
  978|       |
  979|   320k|  Ppmd8State_SetSuccessor(p->FoundState, upBranch);
  980|   320k|  p->OrderFall++;
  981|       |
  982|   320k|  for (;;)
  983|   320k|  {
  984|   320k|    if (s1)
  ------------------
  |  Branch (984:9): [True: 0, False: 320k]
  ------------------
  985|      0|    {
  986|      0|      c = SUFFIX(c);
  ------------------
  |  |   34|      0|#define SUFFIX(ctx) CTX((ctx)->Suffix)
  |  |  ------------------
  |  |  |  |   31|      0|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|      0|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  114|      0|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  987|      0|      s = s1;
  988|      0|      s1 = NULL;
  989|      0|    }
  990|   320k|    else
  991|   320k|    {
  992|   320k|      if (!c->Suffix)
  ------------------
  |  Branch (992:11): [True: 320k, False: 0]
  ------------------
  993|   320k|      {
  994|       |        #ifdef PPMD8_FREEZE_SUPPORT
  995|       |        if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
  996|       |        {
  997|       |          do { Ppmd8State_SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
  998|       |          RESET_TEXT(1)
  999|       |          p->OrderFall = 1;
 1000|       |        }
 1001|       |        #endif
 1002|   320k|        return c;
 1003|   320k|      }
 1004|      0|      c = SUFFIX(c);
  ------------------
  |  |   34|      0|#define SUFFIX(ctx) CTX((ctx)->Suffix)
  |  |  ------------------
  |  |  |  |   31|      0|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|      0|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  115|      0|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  114|      0|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1005|      0|      if (c->NumStats)
  ------------------
  |  Branch (1005:11): [True: 0, False: 0]
  ------------------
 1006|      0|      {
 1007|      0|        if ((s = STATS(c))->Symbol != p->FoundState->Symbol)
  ------------------
  |  |   32|      0|#define STATS(ctx) Ppmd8_GetStats(p, ctx)
  |  |  ------------------
  |  |  |  |  117|      0|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|      0|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|      0|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1007:13): [True: 0, False: 0]
  ------------------
 1008|      0|          do { s++; } while (s->Symbol != p->FoundState->Symbol);
  ------------------
  |  Branch (1008:30): [True: 0, False: 0]
  ------------------
 1009|      0|        if (s->Freq < MAX_FREQ - 9)
  ------------------
  |  |   19|      0|#define MAX_FREQ 124
  ------------------
  |  Branch (1009:13): [True: 0, False: 0]
  ------------------
 1010|      0|        {
 1011|      0|          s->Freq = (Byte)(s->Freq + 2);
 1012|      0|          c->Union2.SummFreq = (UInt16)(c->Union2.SummFreq + 2);
 1013|      0|        }
 1014|      0|      }
 1015|      0|      else
 1016|      0|      {
 1017|      0|        s = ONE_STATE(c);
  ------------------
  |  |   33|      0|#define ONE_STATE(ctx) Ppmd8Context_OneState(ctx)
  |  |  ------------------
  |  |  |  |   48|      0|#define Ppmd8Context_OneState(p) ((CPpmd_State *)&(p)->Union2)
  |  |  ------------------
  ------------------
 1018|      0|        s->Freq = (Byte)(s->Freq + (s->Freq < 32));
 1019|      0|      }
 1020|      0|    }
 1021|      0|    if (SUCCESSOR(s))
  ------------------
  |  |  422|      0|#define SUCCESSOR(p) Ppmd_GET_SUCCESSOR(p)
  |  |  ------------------
  |  |  |  |  152|      0|    ( (CPpmd_Void_Ref) ((p)->Successor_0 | ((UInt32)(p)->Successor_1 << 16)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (152:5): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1022|      0|      break;
 1023|       |    #ifdef PPMD8_FREEZE_SUPPORT
 1024|       |    ps[numPs++] = s;
 1025|       |    #endif
 1026|      0|    Ppmd8State_SetSuccessor(s, upBranch);
 1027|      0|    p->OrderFall++;
 1028|      0|  }
 1029|       |  
 1030|       |  #ifdef PPMD8_FREEZE_SUPPORT
 1031|       |  if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
 1032|       |  {
 1033|       |    c = CTX(SUCCESSOR(s));
 1034|       |    do { Ppmd8State_SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
 1035|       |    RESET_TEXT(1)
 1036|       |    p->OrderFall = 1;
 1037|       |    return c;
 1038|       |  }
 1039|       |  else
 1040|       |  #endif
 1041|      0|  if (SUCCESSOR(s) <= upBranch)
  ------------------
  |  |  422|      0|#define SUCCESSOR(p) Ppmd_GET_SUCCESSOR(p)
  |  |  ------------------
  |  |  |  |  152|      0|    ( (CPpmd_Void_Ref) ((p)->Successor_0 | ((UInt32)(p)->Successor_1 << 16)) )
  |  |  ------------------
  ------------------
  |  Branch (1041:7): [True: 0, False: 0]
  ------------------
 1042|      0|  {
 1043|      0|    PPMD8_CTX_PTR successor;
 1044|      0|    CPpmd_State *s2 = p->FoundState;
 1045|      0|    p->FoundState = s;
 1046|       |
 1047|      0|    successor = Ppmd8_CreateSuccessors(p, False, NULL, c);
  ------------------
  |  |  262|      0|#define False 0
  ------------------
 1048|      0|    if (!successor)
  ------------------
  |  Branch (1048:9): [True: 0, False: 0]
  ------------------
 1049|      0|      Ppmd8State_SetSuccessor(s, 0);
 1050|      0|    else
 1051|      0|      Ppmd8State_SetSuccessor(s, REF(successor));
  ------------------
  |  |   27|      0|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  ------------------
  |  |  |  |  113|      0|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  ------------------
  ------------------
 1052|      0|    p->FoundState = s2;
 1053|      0|  }
 1054|       |  
 1055|      0|  {
 1056|      0|    CPpmd_Void_Ref successor = SUCCESSOR(s);
  ------------------
  |  |  422|      0|#define SUCCESSOR(p) Ppmd_GET_SUCCESSOR(p)
  |  |  ------------------
  |  |  |  |  152|      0|    ( (CPpmd_Void_Ref) ((p)->Successor_0 | ((UInt32)(p)->Successor_1 << 16)) )
  |  |  ------------------
  ------------------
 1057|      0|    if (p->OrderFall == 1 && c1 == p->MaxContext)
  ------------------
  |  Branch (1057:9): [True: 0, False: 0]
  |  Branch (1057:30): [True: 0, False: 0]
  ------------------
 1058|      0|    {
 1059|      0|      Ppmd8State_SetSuccessor(p->FoundState, successor);
 1060|      0|      p->Text--;
 1061|      0|    }
 1062|      0|    if (successor == 0)
  ------------------
  |  Branch (1062:9): [True: 0, False: 0]
  ------------------
 1063|      0|      return NULL;
 1064|      0|    return CTX(successor);
  ------------------
  |  |   31|      0|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  ------------------
  |  |  |  |  116|      0|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|      0|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|      0|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1065|      0|  }
 1066|      0|}
Ppmd8.c:Ppmd8_AllocUnits:
  288|  44.6M|{
  289|  44.6M|  if (p->FreeList[indx] != 0)
  ------------------
  |  Branch (289:7): [True: 18.8M, False: 25.8M]
  ------------------
  290|  18.8M|    return Ppmd8_RemoveNode(p, indx);
  291|  25.8M|  {
  292|  25.8M|    UInt32 numBytes = U2B(I2U(indx));
  ------------------
  |  |   22|  25.8M|#define U2B(nu) ((UInt32)(nu) * UNIT_SIZE)
  |  |  ------------------
  |  |  |  |   20|  25.8M|#define UNIT_SIZE 12
  |  |  ------------------
  ------------------
  293|  25.8M|    Byte *lo = p->LoUnit;
  294|  25.8M|    if ((UInt32)(p->HiUnit - lo) >= numBytes)
  ------------------
  |  Branch (294:9): [True: 22.2M, False: 3.63M]
  ------------------
  295|  22.2M|    {
  296|  22.2M|      p->LoUnit = lo + numBytes;
  297|  22.2M|      return lo;
  298|  22.2M|    }
  299|  25.8M|  }
  300|  3.63M|  return Ppmd8_AllocUnitsRare(p, indx);
  301|  25.8M|}
Ppmd8.c:Ppmd8_InsertNode:
  118|  34.2M|{
  119|  34.2M|  ((CPpmd8_Node *)node)->Stamp = EMPTY_NODE;
  ------------------
  |  |  114|  34.2M|#define EMPTY_NODE 0xFFFFFFFF
  ------------------
  120|  34.2M|  ((CPpmd8_Node *)node)->Next = (CPpmd8_Node_Ref)p->FreeList[indx];
  121|  34.2M|  ((CPpmd8_Node *)node)->NU = I2U(indx);
  ------------------
  |  |   24|  34.2M|#define I2U(indx) ((unsigned)p->Indx2Units[indx])
  ------------------
  122|  34.2M|  p->FreeList[indx] = REF(node);
  ------------------
  |  |   27|  34.2M|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  ------------------
  |  |  |  |  113|  34.2M|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  ------------------
  ------------------
  123|  34.2M|  p->Stamps[indx]++;
  124|  34.2M|}
Ppmd8.c:Ppmd8_Rescale:
 1313|   177k|{
 1314|   177k|  unsigned i, adder, sumFreq, escFreq;
 1315|   177k|  CPpmd_State *stats = STATS(p->MinContext);
  ------------------
  |  |   32|   177k|#define STATS(ctx) Ppmd8_GetStats(p, ctx)
  |  |  ------------------
  |  |  |  |  117|   177k|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|   177k|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|   177k|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1316|   177k|  CPpmd_State *s = p->FoundState;
 1317|       |
 1318|       |  /* Sort the list by Freq */
 1319|   177k|  if (s != stats)
  ------------------
  |  Branch (1319:7): [True: 24.0k, False: 153k]
  ------------------
 1320|  24.0k|  {
 1321|  24.0k|    CPpmd_State tmp = *s;
 1322|  24.0k|    do
 1323|  1.54M|      s[0] = s[-1];
 1324|  1.54M|    while (--s != stats);
  ------------------
  |  Branch (1324:12): [True: 1.52M, False: 24.0k]
  ------------------
 1325|  24.0k|    *s = tmp;
 1326|  24.0k|  }
 1327|       |
 1328|   177k|  sumFreq = s->Freq;
 1329|   177k|  escFreq = p->MinContext->Union2.SummFreq - sumFreq;
 1330|       |
 1331|       |
 1332|       |  
 1333|       |  
 1334|       |  
 1335|       |  
 1336|   177k|  adder = (p->OrderFall != 0);
 1337|       |  
 1338|       |  #ifdef PPMD8_FREEZE_SUPPORT
 1339|       |  adder |= (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE);
 1340|       |  #endif
 1341|       |  
 1342|   177k|  sumFreq = (sumFreq + 4 + adder) >> 1;
 1343|   177k|  i = p->MinContext->NumStats;
 1344|   177k|  s->Freq = (Byte)sumFreq;
 1345|       |  
 1346|   177k|  do
 1347|  23.0M|  {
 1348|  23.0M|    unsigned freq = (++s)->Freq;
 1349|  23.0M|    escFreq -= freq;
 1350|  23.0M|    freq = (freq + adder) >> 1;
 1351|  23.0M|    sumFreq += freq;
 1352|  23.0M|    s->Freq = (Byte)freq;
 1353|  23.0M|    if (freq > s[-1].Freq)
  ------------------
  |  Branch (1353:9): [True: 9.74M, False: 13.3M]
  ------------------
 1354|  9.74M|    {
 1355|  9.74M|      CPpmd_State tmp = *s;
 1356|  9.74M|      CPpmd_State *s1 = s;
 1357|  9.74M|      do
 1358|   537M|      {
 1359|   537M|        s1[0] = s1[-1];
 1360|   537M|      }
 1361|   537M|      while (--s1 != stats && freq > s1[-1].Freq);
  ------------------
  |  Branch (1361:14): [True: 537M, False: 0]
  |  Branch (1361:31): [True: 527M, False: 9.74M]
  ------------------
 1362|  9.74M|      *s1 = tmp;
 1363|  9.74M|    }
 1364|  23.0M|  }
 1365|  23.0M|  while (--i);
  ------------------
  |  Branch (1365:10): [True: 22.9M, False: 177k]
  ------------------
 1366|       |  
 1367|   177k|  if (s->Freq == 0)
  ------------------
  |  Branch (1367:7): [True: 41.6k, False: 135k]
  ------------------
 1368|  41.6k|  {
 1369|       |    /* Remove all items with Freq == 0 */
 1370|  41.6k|    CPpmd8_Context *mc;
 1371|  41.6k|    unsigned numStats, numStatsNew, n0, n1;
 1372|       |    
 1373|   312k|    i = 0; do { i++; } while ((--s)->Freq == 0);
  ------------------
  |  Branch (1373:31): [True: 270k, False: 41.6k]
  ------------------
 1374|       |    
 1375|       |    
 1376|       |
 1377|       |    
 1378|  41.6k|    escFreq += i;
 1379|  41.6k|    mc = p->MinContext;
 1380|  41.6k|    numStats = mc->NumStats;
 1381|  41.6k|    numStatsNew = numStats - i;
 1382|  41.6k|    mc->NumStats = (Byte)(numStatsNew);
 1383|  41.6k|    n0 = (numStats + 2) >> 1;
 1384|       |    
 1385|  41.6k|    if (numStatsNew == 0)
  ------------------
  |  Branch (1385:9): [True: 7.20k, False: 34.4k]
  ------------------
 1386|  7.20k|    {
 1387|       |    
 1388|  7.20k|      unsigned freq = (2 * (unsigned)stats->Freq + escFreq - 1) / escFreq;
 1389|  7.20k|      if (freq > MAX_FREQ / 3)
  ------------------
  |  |   19|  7.20k|#define MAX_FREQ 124
  ------------------
  |  Branch (1389:11): [True: 1.66k, False: 5.54k]
  ------------------
 1390|  1.66k|        freq = MAX_FREQ / 3;
  ------------------
  |  |   19|  1.66k|#define MAX_FREQ 124
  ------------------
 1391|  7.20k|      mc->Flags = (Byte)((mc->Flags & FLAG_PREV_HIGH) + PPMD8_HiBitsFlag_3(stats->Symbol));
  ------------------
  |  |  525|  7.20k|#define FLAG_PREV_HIGH (1 << 4)
  ------------------
                    mc->Flags = (Byte)((mc->Flags & FLAG_PREV_HIGH) + PPMD8_HiBitsFlag_3(stats->Symbol));
  ------------------
  |  |  532|  7.20k|#define PPMD8_HiBitsFlag_3(sym) HiBits_Convert_3(HiBits_Prepare(sym))
  |  |  ------------------
  |  |  |  |  529|  7.20k|#define HiBits_Convert_3(flags) (((flags) >> (8 - 3)) & (1 << 3))
  |  |  ------------------
  ------------------
 1392|       |      
 1393|       |      
 1394|       |      
 1395|       |      
 1396|       |      
 1397|  7.20k|      s = ONE_STATE(mc);
  ------------------
  |  |   33|  7.20k|#define ONE_STATE(ctx) Ppmd8Context_OneState(ctx)
  |  |  ------------------
  |  |  |  |   48|  7.20k|#define Ppmd8Context_OneState(p) ((CPpmd_State *)&(p)->Union2)
  |  |  ------------------
  ------------------
 1398|  7.20k|      *s = *stats;
 1399|  7.20k|      s->Freq = (Byte)freq;
 1400|  7.20k|      p->FoundState = s;
 1401|  7.20k|      Ppmd8_InsertNode(p, stats, U2I(n0));
  ------------------
  |  |   23|  7.20k|#define U2I(nu) (p->Units2Indx[(size_t)(nu) - 1])
  ------------------
 1402|  7.20k|      return;
 1403|  7.20k|    }
 1404|       |
 1405|  34.4k|    n1 = (numStatsNew + 2) >> 1;
 1406|  34.4k|    if (n0 != n1)
  ------------------
  |  Branch (1406:9): [True: 31.1k, False: 3.29k]
  ------------------
 1407|  31.1k|      mc->Union4.Stats = STATS_REF(ShrinkUnits(p, stats, n0, n1));
  ------------------
  |  |   29|  31.1k|#define STATS_REF(ptr) ((CPpmd_State_Ref)REF(ptr))
  |  |  ------------------
  |  |  |  |   27|  31.1k|#define REF(ptr) Ppmd_GetRef(p, ptr)
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|  31.1k|  #define Ppmd_GetRef(p, ptr)   ((UInt32)((Byte *)(ptr) - (p)->Base))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1408|  34.4k|    {
 1409|       |      // here we are for max order only. So Ppmd8_MakeEscFreq() doesn't use mc->Flags
 1410|       |      // but we still need current (Flags & FLAG_PREV_HIGH), if we will convert context to 1-symbol context later.
 1411|       |      /*
 1412|       |      unsigned flags = HiBits_Prepare((s = STATS(mc))->Symbol);
 1413|       |      i = mc->NumStats;
 1414|       |      do { flags |= HiBits_Prepare((++s)->Symbol); } while (--i);
 1415|       |      mc->Flags = (Byte)((mc->Flags & ~FLAG_SYM_HIGH) + HiBits_Convert_3(flags));
 1416|       |      */
 1417|  34.4k|    }
 1418|  34.4k|  }
 1419|       |
 1420|       |
 1421|       |
 1422|       |  
 1423|       |
 1424|       |
 1425|   170k|  {
 1426|   170k|    CPpmd8_Context *mc = p->MinContext;
 1427|   170k|    mc->Union2.SummFreq = (UInt16)(sumFreq + escFreq - (escFreq >> 1));
 1428|   170k|    mc->Flags |= FLAG_RESCALED;
  ------------------
  |  |  523|   170k|#define FLAG_RESCALED  (1 << 2)
  ------------------
 1429|   170k|    p->FoundState = STATS(mc);
  ------------------
  |  |   32|   170k|#define STATS(ctx) Ppmd8_GetStats(p, ctx)
  |  |  ------------------
  |  |  |  |  117|   170k|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|   170k|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|   170k|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1430|   170k|  }
 1431|   170k|}
Ppmd8.c:Ppmd8_NextContext:
 1465|  22.5M|{
 1466|  22.5M|  PPMD8_CTX_PTR c = CTX(SUCCESSOR(p->FoundState));
  ------------------
  |  |   31|  22.5M|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  ------------------
  |  |  |  |  116|  22.5M|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  22.5M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  22.5M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1467|  22.5M|  if (p->OrderFall == 0 && (const Byte *)c >= p->UnitsStart)
  ------------------
  |  Branch (1467:7): [True: 5.77M, False: 16.7M]
  |  Branch (1467:28): [True: 4.72M, False: 1.04M]
  ------------------
 1468|  4.72M|    p->MaxContext = p->MinContext = c;
 1469|  17.8M|  else
 1470|  17.8M|    Ppmd8_UpdateModel(p);
 1471|  22.5M|}

Ppmd8_Flush_RangeEnc:
   17|  2.02k|{
   18|  2.02k|  unsigned i;
   19|  10.1k|  for (i = 0; i < 4; i++, p->Low <<= 8 )
  ------------------
  |  Branch (19:15): [True: 8.10k, False: 2.02k]
  ------------------
   20|  8.10k|    WRITE_BYTE(p);
  ------------------
  |  |   14|  8.10k|#define WRITE_BYTE(p) IByteOut_Write(p->Stream.Out, (Byte)(p->Low >> 24))
  |  |  ------------------
  |  |  |  |  337|  8.10k|#define IByteOut_Write(p, b) (p)->Write(p, b)
  |  |  ------------------
  ------------------
   21|  2.02k|}
Ppmd8_EncodeSymbol:
   90|   108M|{
   91|   108M|  size_t charMask[256 / sizeof(size_t)];
   92|       |  
   93|   108M|  if (p->MinContext->NumStats != 0)
  ------------------
  |  Branch (93:7): [True: 71.2M, False: 37.5M]
  ------------------
   94|  71.2M|  {
   95|  71.2M|    CPpmd_State *s = Ppmd8_GetStats(p, p->MinContext);
  ------------------
  |  |  117|  71.2M|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  ------------------
  |  |  |  |  115|  71.2M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  71.2M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   96|  71.2M|    UInt32 sum;
   97|  71.2M|    unsigned i;
   98|  71.2M|    UInt32 summFreq = p->MinContext->Union2.SummFreq;
   99|       |    
  100|  71.2M|    PPMD8_CORRECT_SUM_RANGE(p, summFreq)
  ------------------
  |  |  142|  71.2M|#define PPMD8_CORRECT_SUM_RANGE(p, _sum_) if (_sum_ > p->Range /* /1 */) _sum_ = p->Range;
  |  |  ------------------
  |  |  |  Branch (142:47): [True: 0, False: 71.2M]
  |  |  ------------------
  ------------------
  101|       |
  102|       |    // RC_PRE(summFreq);
  103|       |
  104|  71.2M|    if (s->Symbol == symbol)
  ------------------
  |  Branch (104:9): [True: 3.46M, False: 67.8M]
  ------------------
  105|  3.46M|    {
  106|       |
  107|  3.46M|      RC_EncodeFinal(0, s->Freq, summFreq)
  ------------------
  |  |   76|  3.46M|#define RC_EncodeFinal(start, size, total)  RC_Encode(start, size, total)  RC_NORM_REMOTE(p)
  |  |  ------------------
  |  |  |  |   75|  3.46M|#define RC_Encode(start, size, total)  Ppmd8_RangeEnc_Encode(p, start, size, total);
  |  |  ------------------
  |  |               #define RC_EncodeFinal(start, size, total)  RC_Encode(start, size, total)  RC_NORM_REMOTE(p)
  |  |  ------------------
  |  |  |  |   47|  3.46M|#define RC_NORM_REMOTE(p)   RC_NORM(p)
  |  |  |  |  ------------------
  |  |  |  |  |  |   29|  4.36M|  while ((p->Low ^ (p->Low + p->Range)) < kTop \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   11|  8.73M|#define kTop ((UInt32)1 << 24)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (29:10): [True: 904k, False: 3.46M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   30|  4.36M|    || (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1))) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   12|  6.92M|#define kBot ((UInt32)1 << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   || (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1))) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   12|    758|#define kBot ((UInt32)1 << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (30:9): [True: 758, False: 3.46M]
  |  |  |  |  |  |  |  Branch (30:28): [True: 758, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  3.46M|    { WRITE_BYTE(p); p->Range <<= 8; p->Low <<= 8; }
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   14|   905k|#define WRITE_BYTE(p) IByteOut_Write(p->Stream.Out, (Byte)(p->Low >> 24))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  337|   905k|#define IByteOut_Write(p, b) (p)->Write(p, b)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  108|  3.46M|      p->FoundState = s;
  109|  3.46M|      Ppmd8_Update1_0(p);
  110|  3.46M|      return;
  111|  3.46M|    }
  112|  67.8M|    p->PrevSuccess = 0;
  113|  67.8M|    sum = s->Freq;
  114|  67.8M|    i = p->MinContext->NumStats;
  115|  67.8M|    do
  116|  2.88G|    {
  117|  2.88G|      if ((++s)->Symbol == symbol)
  ------------------
  |  Branch (117:11): [True: 19.0M, False: 2.86G]
  ------------------
  118|  19.0M|      {
  119|       |
  120|  19.0M|        RC_EncodeFinal(sum, s->Freq, summFreq)
  ------------------
  |  |   76|  19.0M|#define RC_EncodeFinal(start, size, total)  RC_Encode(start, size, total)  RC_NORM_REMOTE(p)
  |  |  ------------------
  |  |  |  |   75|  19.0M|#define RC_Encode(start, size, total)  Ppmd8_RangeEnc_Encode(p, start, size, total);
  |  |  ------------------
  |  |               #define RC_EncodeFinal(start, size, total)  RC_Encode(start, size, total)  RC_NORM_REMOTE(p)
  |  |  ------------------
  |  |  |  |   47|  19.0M|#define RC_NORM_REMOTE(p)   RC_NORM(p)
  |  |  |  |  ------------------
  |  |  |  |  |  |   29|  35.7M|  while ((p->Low ^ (p->Low + p->Range)) < kTop \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   11|  71.5M|#define kTop ((UInt32)1 << 24)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (29:10): [True: 16.6M, False: 19.0M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   30|  35.7M|    || (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1))) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   12|  38.1M|#define kBot ((UInt32)1 << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   || (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1))) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   12|  6.70k|#define kBot ((UInt32)1 << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (30:9): [True: 6.70k, False: 19.0M]
  |  |  |  |  |  |  |  Branch (30:28): [True: 6.70k, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  19.0M|    { WRITE_BYTE(p); p->Range <<= 8; p->Low <<= 8; }
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   14|  16.7M|#define WRITE_BYTE(p) IByteOut_Write(p->Stream.Out, (Byte)(p->Low >> 24))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  337|  16.7M|#define IByteOut_Write(p, b) (p)->Write(p, b)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  121|  19.0M|        p->FoundState = s;
  122|  19.0M|        Ppmd8_Update1(p);
  123|  19.0M|        return;
  124|  19.0M|      }
  125|  2.86G|      sum += s->Freq;
  126|  2.86G|    }
  127|  2.86G|    while (--i);
  ------------------
  |  Branch (127:12): [True: 2.81G, False: 48.7M]
  ------------------
  128|       |    
  129|       |    
  130|  48.7M|    RC_Encode(sum, summFreq - sum, summFreq)
  ------------------
  |  |   75|  48.7M|#define RC_Encode(start, size, total)  Ppmd8_RangeEnc_Encode(p, start, size, total);
  ------------------
  131|       |    
  132|       |    
  133|  48.7M|    PPMD_SetAllBitsIn256Bytes(charMask)
  ------------------
  |  |  164|   243M|  { size_t z; for (z = 0; z < 256 / sizeof(p[0]); z += 8) { \
  |  |  ------------------
  |  |  |  Branch (164:27): [True: 194M, False: 48.7M]
  |  |  ------------------
  |  |  165|   194M|  p[z+7] = p[z+6] = p[z+5] = p[z+4] = p[z+3] = p[z+2] = p[z+1] = p[z+0] = ~(size_t)0; }}
  ------------------
  134|       |    // MASK(s->Symbol) = 0;
  135|       |    // i = p->MinContext->NumStats;
  136|       |    // do { MASK((--s)->Symbol) = 0; } while (--i);
  137|  48.7M|    {
  138|  48.7M|      CPpmd_State *s2 = Ppmd8_GetStats(p, p->MinContext);
  ------------------
  |  |  117|  48.7M|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  ------------------
  |  |  |  |  115|  48.7M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  48.7M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  139|  48.7M|      MASK(s->Symbol) = 0;
  ------------------
  |  |   85|  48.7M|#define MASK(sym)  ((Byte *)charMask)[sym]
  ------------------
  140|  48.7M|      do
  141|   989M|      {
  142|   989M|        const unsigned sym0 = s2[0].Symbol;
  143|   989M|        const unsigned sym1 = s2[1].Symbol;
  144|   989M|        s2 += 2;
  145|   989M|        MASK(sym0) = 0;
  ------------------
  |  |   85|   989M|#define MASK(sym)  ((Byte *)charMask)[sym]
  ------------------
  146|   989M|        MASK(sym1) = 0;
  ------------------
  |  |   85|   989M|#define MASK(sym)  ((Byte *)charMask)[sym]
  ------------------
  147|   989M|      }
  148|   989M|      while (s2 < s);
  ------------------
  |  Branch (148:14): [True: 940M, False: 48.7M]
  ------------------
  149|  48.7M|    }
  150|  48.7M|  }
  151|  37.5M|  else
  152|  37.5M|  {
  153|  37.5M|    UInt16 *prob = Ppmd8_GetBinSumm(p);
  ------------------
  |  |  129|  37.5M|    &p->BinSumm[p->NS2Indx[(size_t)Ppmd8Context_OneState(p->MinContext)->Freq - 1]] \
  |  |  ------------------
  |  |  |  |   48|  37.5M|#define Ppmd8Context_OneState(p) ((CPpmd_State *)&(p)->Union2)
  |  |  ------------------
  |  |  130|  37.5M|    [ p->PrevSuccess + ((p->RunLength >> 26) & 0x20) \
  |  |  131|  37.5M|    + p->NS2BSIndx[Ppmd8_GetContext(p, p->MinContext->Suffix)->NumStats] + \
  |  |  ------------------
  |  |  |  |  116|  37.5M|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  37.5M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  37.5M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  132|  37.5M|    + p->MinContext->Flags ]
  ------------------
  154|  37.5M|    CPpmd_State *s = Ppmd8Context_OneState(p->MinContext);
  ------------------
  |  |   48|  37.5M|#define Ppmd8Context_OneState(p) ((CPpmd_State *)&(p)->Union2)
  ------------------
  155|  37.5M|    UInt32 pr = *prob;
  156|  37.5M|    const UInt32 bound = (R->Range >> 14) * pr;
  ------------------
  |  |   52|  37.5M|#define R p
  ------------------
  157|  37.5M|    pr = PPMD_UPDATE_PROB_1(pr);
  ------------------
  |  |   32|  37.5M|#define PPMD_UPDATE_PROB_1(prob) ((prob) - PPMD_GET_MEAN(prob))
  |  |  ------------------
  |  |  |  |   30|  37.5M|#define PPMD_GET_MEAN(summ) PPMD_GET_MEAN_SPEC((summ), PPMD_PERIOD_BITS, 2)
  |  |  |  |  ------------------
  |  |  |  |  |  |   29|  37.5M|#define PPMD_GET_MEAN_SPEC(summ, shift, round) (((summ) + (1 << ((shift) - (round)))) >> (shift))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  158|  37.5M|    if (s->Symbol == symbol)
  ------------------
  |  Branch (158:9): [True: 14.9M, False: 22.5M]
  ------------------
  159|  14.9M|    {
  160|  14.9M|      *prob = (UInt16)(pr + (1 << PPMD_INT_BITS));
  ------------------
  |  |   25|  14.9M|#define PPMD_INT_BITS 7
  ------------------
  161|       |      // RangeEnc_EncodeBit_0(p, bound);
  162|  14.9M|      R->Range = bound;
  ------------------
  |  |   52|  14.9M|#define R p
  ------------------
  163|  14.9M|      RC_NORM(R)
  ------------------
  |  |   29|  15.2M|  while ((p->Low ^ (p->Low + p->Range)) < kTop \
  |  |  ------------------
  |  |  |  |   11|  30.4M|#define kTop ((UInt32)1 << 24)
  |  |  ------------------
  |  |  |  Branch (29:10): [True: 249k, False: 14.9M]
  |  |  ------------------
  |  |   30|  15.2M|    || (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1))) \
  |  |  ------------------
  |  |  |  |   12|  29.9M|#define kBot ((UInt32)1 << 15)
  |  |  ------------------
  |  |                   || (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1))) \
  |  |  ------------------
  |  |  |  |   12|    678|#define kBot ((UInt32)1 << 15)
  |  |  ------------------
  |  |  |  Branch (30:9): [True: 678, False: 14.9M]
  |  |  |  Branch (30:28): [True: 678, False: 0]
  |  |  ------------------
  |  |   31|  14.9M|    { WRITE_BYTE(p); p->Range <<= 8; p->Low <<= 8; }
  |  |  ------------------
  |  |  |  |   14|   250k|#define WRITE_BYTE(p) IByteOut_Write(p->Stream.Out, (Byte)(p->Low >> 24))
  |  |  |  |  ------------------
  |  |  |  |  |  |  337|   250k|#define IByteOut_Write(p, b) (p)->Write(p, b)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  164|       |
  165|       |      // p->FoundState = s;
  166|       |      // Ppmd8_UpdateBin(p);
  167|  14.9M|      {
  168|  14.9M|        const unsigned freq = s->Freq;
  169|  14.9M|        CPpmd8_Context *c = CTX(SUCCESSOR(s));
  ------------------
  |  |   78|  14.9M|#define CTX(ref) ((CPpmd8_Context *)Ppmd8_GetContext(p, ref))
  |  |  ------------------
  |  |  |  |  116|  14.9M|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  |  |  ------------------
  |  |  |  |  |  |  115|  14.9M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  114|  14.9M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  170|  14.9M|        p->FoundState = s;
  171|  14.9M|        p->PrevSuccess = 1;
  172|  14.9M|        p->RunLength++;
  173|  14.9M|        s->Freq = (Byte)(freq + (freq < 196)); // Ppmd8 (196)
  174|       |        // NextContext(p);
  175|  14.9M|        if (p->OrderFall == 0 && (const Byte *)c >= p->UnitsStart)
  ------------------
  |  Branch (175:13): [True: 13.9M, False: 1.01M]
  |  Branch (175:34): [True: 5.49M, False: 8.47M]
  ------------------
  176|  5.49M|          p->MaxContext = p->MinContext = c;
  177|  9.48M|        else
  178|  9.48M|          Ppmd8_UpdateModel(p);
  179|  14.9M|      }
  180|  14.9M|      return;
  181|  14.9M|    }
  182|       |
  183|  22.5M|    *prob = (UInt16)pr;
  184|  22.5M|    p->InitEsc = p->ExpEscape[pr >> 10];
  185|       |    // RangeEnc_EncodeBit_1(p, bound);
  186|  22.5M|    R->Low += bound;
  ------------------
  |  |   52|  22.5M|#define R p
  ------------------
  187|  22.5M|    R->Range = (R->Range & ~((UInt32)PPMD_BIN_SCALE - 1)) - bound;
  ------------------
  |  |   52|  22.5M|#define R p
  ------------------
                  R->Range = (R->Range & ~((UInt32)PPMD_BIN_SCALE - 1)) - bound;
  ------------------
  |  |   52|  22.5M|#define R p
  ------------------
                  R->Range = (R->Range & ~((UInt32)PPMD_BIN_SCALE - 1)) - bound;
  ------------------
  |  |   27|  22.5M|#define PPMD_BIN_SCALE (1 << (PPMD_INT_BITS + PPMD_PERIOD_BITS))
  |  |  ------------------
  |  |  |  |   25|  22.5M|#define PPMD_INT_BITS 7
  |  |  ------------------
  |  |               #define PPMD_BIN_SCALE (1 << (PPMD_INT_BITS + PPMD_PERIOD_BITS))
  |  |  ------------------
  |  |  |  |   26|  22.5M|#define PPMD_PERIOD_BITS 7
  |  |  ------------------
  ------------------
  188|  22.5M|    RC_NORM_LOCAL(R)
  189|       |
  190|  22.5M|    PPMD_SetAllBitsIn256Bytes(charMask)
  ------------------
  |  |  164|   112M|  { size_t z; for (z = 0; z < 256 / sizeof(p[0]); z += 8) { \
  |  |  ------------------
  |  |  |  Branch (164:27): [True: 90.1M, False: 22.5M]
  |  |  ------------------
  |  |  165|  90.1M|  p[z+7] = p[z+6] = p[z+5] = p[z+4] = p[z+3] = p[z+2] = p[z+1] = p[z+0] = ~(size_t)0; }}
  ------------------
  191|  22.5M|    MASK(s->Symbol) = 0;
  ------------------
  |  |   85|  22.5M|#define MASK(sym)  ((Byte *)charMask)[sym]
  ------------------
  192|  22.5M|    p->PrevSuccess = 0;
  193|  22.5M|  }
  194|       |
  195|  71.2M|  for (;;)
  196|  87.6M|  {
  197|  87.6M|    CPpmd_See *see;
  198|  87.6M|    CPpmd_State *s;
  199|  87.6M|    UInt32 sum, escFreq;
  200|  87.6M|    CPpmd8_Context *mc;
  201|  87.6M|    unsigned i, numMasked;
  202|       |
  203|  87.6M|    RC_NORM_REMOTE(p)
  ------------------
  |  |   47|  87.6M|#define RC_NORM_REMOTE(p)   RC_NORM(p)
  |  |  ------------------
  |  |  |  |   29|  94.6M|  while ((p->Low ^ (p->Low + p->Range)) < kTop \
  |  |  |  |  ------------------
  |  |  |  |  |  |   11|   189M|#define kTop ((UInt32)1 << 24)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (29:10): [True: 6.94M, False: 87.6M]
  |  |  |  |  ------------------
  |  |  |  |   30|  94.6M|    || (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1))) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|   175M|#define kBot ((UInt32)1 << 15)
  |  |  |  |  ------------------
  |  |  |  |                   || (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1))) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   12|  11.2k|#define kBot ((UInt32)1 << 15)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (30:9): [True: 11.2k, False: 87.6M]
  |  |  |  |  |  Branch (30:28): [True: 11.2k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   31|  87.6M|    { WRITE_BYTE(p); p->Range <<= 8; p->Low <<= 8; }
  |  |  |  |  ------------------
  |  |  |  |  |  |   14|  6.95M|#define WRITE_BYTE(p) IByteOut_Write(p->Stream.Out, (Byte)(p->Low >> 24))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  337|  6.95M|#define IByteOut_Write(p, b) (p)->Write(p, b)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  204|       |
  205|  87.6M|    mc = p->MinContext;
  206|  87.6M|    numMasked = mc->NumStats;
  207|       |
  208|  87.6M|    do
  209|  88.7M|    {
  210|  88.7M|      p->OrderFall++;
  211|  88.7M|      if (!mc->Suffix)
  ------------------
  |  Branch (211:11): [True: 2.02k, False: 88.7M]
  ------------------
  212|  2.02k|        return; /* EndMarker (symbol = -1) */
  213|  88.7M|      mc = Ppmd8_GetContext(p, mc->Suffix);
  ------------------
  |  |  116|  88.7M|#define Ppmd8_GetContext(p, ptr) Ppmd_GetPtr_Type(p, ptr, CPpmd8_Context)
  |  |  ------------------
  |  |  |  |  115|  88.7M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  88.7M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  214|       |
  215|  88.7M|    }
  216|  88.7M|    while (mc->NumStats == numMasked);
  ------------------
  |  Branch (216:12): [True: 1.06M, False: 87.6M]
  ------------------
  217|       |    
  218|  87.6M|    p->MinContext = mc;
  219|       |
  220|  87.6M|    see = Ppmd8_MakeEscFreq(p, numMasked, &escFreq);
  221|       |    
  222|       |    
  223|       |    
  224|       |    
  225|       |    
  226|       |    
  227|       |    
  228|       |    
  229|       |    
  230|       |
  231|       |    
  232|       |    
  233|       |    
  234|       |    
  235|       |    
  236|       |    
  237|       |
  238|       |    
  239|       |    
  240|       |    
  241|       |    
  242|       |    
  243|       |    
  244|       |    
  245|  87.6M|    s = Ppmd8_GetStats(p, p->MinContext);
  ------------------
  |  |  117|  87.6M|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  ------------------
  |  |  |  |  115|  87.6M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  87.6M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  246|  87.6M|    sum = 0;
  247|  87.6M|    i = (unsigned)p->MinContext->NumStats + 1;
  248|       |
  249|  87.6M|    do
  250|  9.62G|    {
  251|  9.62G|      const unsigned cur = s->Symbol;
  252|  9.62G|      if ((int)cur == symbol)
  ------------------
  |  Branch (252:11): [True: 71.2M, False: 9.55G]
  ------------------
  253|  71.2M|      {
  254|  71.2M|        const UInt32 low = sum;
  255|  71.2M|        const UInt32 freq = s->Freq;
  256|  71.2M|        unsigned num2;
  257|       |
  258|  71.2M|        Ppmd_See_UPDATE(see)
  ------------------
  |  |   52|  71.2M|  { if ((p)->Shift < PPMD_PERIOD_BITS && --(p)->Count == 0) \
  |  |  ------------------
  |  |  |  |   26|   142M|#define PPMD_PERIOD_BITS 7
  |  |  ------------------
  |  |  |  Branch (52:9): [True: 4.02M, False: 67.2M]
  |  |  |  Branch (52:42): [True: 101k, False: 3.92M]
  |  |  ------------------
  |  |   53|  71.2M|    { (p)->Summ = (UInt16)((p)->Summ << 1); \
  |  |   54|   101k|      (p)->Count = (Byte)(3 << (p)->Shift++); }}
  ------------------
  259|  71.2M|        p->FoundState = s;
  260|  71.2M|        sum += escFreq;
  261|       |
  262|  71.2M|        num2 = i / 2;
  263|  71.2M|        i &= 1;
  264|  71.2M|        sum += freq & (0 - (UInt32)i);
  265|  71.2M|        if (num2 != 0)
  ------------------
  |  Branch (265:13): [True: 70.7M, False: 481k]
  ------------------
  266|  70.7M|        {
  267|  70.7M|          s += i;
  268|  70.7M|          do
  269|  3.95G|          {
  270|  3.95G|            const unsigned sym0 = s[0].Symbol;
  271|  3.95G|            const unsigned sym1 = s[1].Symbol;
  272|  3.95G|            s += 2;
  273|  3.95G|            sum += (s[-2].Freq & (unsigned)(MASK(sym0)));
  ------------------
  |  |   85|  3.95G|#define MASK(sym)  ((Byte *)charMask)[sym]
  ------------------
  274|  3.95G|            sum += (s[-1].Freq & (unsigned)(MASK(sym1)));
  ------------------
  |  |   85|  3.95G|#define MASK(sym)  ((Byte *)charMask)[sym]
  ------------------
  275|  3.95G|          }
  276|  3.95G|          while (--num2);
  ------------------
  |  Branch (276:18): [True: 3.88G, False: 70.7M]
  ------------------
  277|  70.7M|        }
  278|       |
  279|  71.2M|        PPMD8_CORRECT_SUM_RANGE(p, sum)
  ------------------
  |  |  142|  71.2M|#define PPMD8_CORRECT_SUM_RANGE(p, _sum_) if (_sum_ > p->Range /* /1 */) _sum_ = p->Range;
  |  |  ------------------
  |  |  |  Branch (142:47): [True: 0, False: 71.2M]
  |  |  ------------------
  ------------------
  280|       |
  281|  71.2M|        RC_EncodeFinal(low, freq, sum)
  ------------------
  |  |   76|  71.2M|#define RC_EncodeFinal(start, size, total)  RC_Encode(start, size, total)  RC_NORM_REMOTE(p)
  |  |  ------------------
  |  |  |  |   75|  71.2M|#define RC_Encode(start, size, total)  Ppmd8_RangeEnc_Encode(p, start, size, total);
  |  |  ------------------
  |  |               #define RC_EncodeFinal(start, size, total)  RC_Encode(start, size, total)  RC_NORM_REMOTE(p)
  |  |  ------------------
  |  |  |  |   47|  71.2M|#define RC_NORM_REMOTE(p)   RC_NORM(p)
  |  |  |  |  ------------------
  |  |  |  |  |  |   29|   137M|  while ((p->Low ^ (p->Low + p->Range)) < kTop \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   11|   274M|#define kTop ((UInt32)1 << 24)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (29:10): [True: 65.9M, False: 71.2M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   30|   137M|    || (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1))) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   12|   142M|#define kBot ((UInt32)1 << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                   || (p->Range < kBot && ((p->Range = (0 - p->Low) & (kBot - 1)), 1))) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   12|  24.8k|#define kBot ((UInt32)1 << 15)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (30:9): [True: 24.8k, False: 71.2M]
  |  |  |  |  |  |  |  Branch (30:28): [True: 24.8k, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  71.2M|    { WRITE_BYTE(p); p->Range <<= 8; p->Low <<= 8; }
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   14|  65.9M|#define WRITE_BYTE(p) IByteOut_Write(p->Stream.Out, (Byte)(p->Low >> 24))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  337|  65.9M|#define IByteOut_Write(p, b) (p)->Write(p, b)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  282|  71.2M|        Ppmd8_Update2(p);
  283|  71.2M|        return;
  284|  71.2M|      }
  285|  9.55G|      sum += (s->Freq & (unsigned)(MASK(cur)));
  ------------------
  |  |   85|  9.55G|#define MASK(sym)  ((Byte *)charMask)[sym]
  ------------------
  286|  9.55G|      s++;
  287|  9.55G|    }
  288|  9.55G|    while (--i);
  ------------------
  |  Branch (288:12): [True: 9.54G, False: 16.4M]
  ------------------
  289|       |    
  290|  16.4M|    {
  291|  16.4M|      UInt32 total = sum + escFreq;
  292|  16.4M|      see->Summ = (UInt16)(see->Summ + total);
  293|  16.4M|      PPMD8_CORRECT_SUM_RANGE(p, total)
  ------------------
  |  |  142|  16.4M|#define PPMD8_CORRECT_SUM_RANGE(p, _sum_) if (_sum_ > p->Range /* /1 */) _sum_ = p->Range;
  |  |  ------------------
  |  |  |  Branch (142:47): [True: 0, False: 16.4M]
  |  |  ------------------
  ------------------
  294|       |
  295|  16.4M|      RC_Encode(sum, total - sum, total)
  ------------------
  |  |   75|  16.4M|#define RC_Encode(start, size, total)  Ppmd8_RangeEnc_Encode(p, start, size, total);
  ------------------
  296|  16.4M|    }
  297|       |
  298|  16.4M|    {
  299|  16.4M|      const CPpmd_State *s2 = Ppmd8_GetStats(p, p->MinContext);
  ------------------
  |  |  117|  16.4M|#define Ppmd8_GetStats(p, ctx)   Ppmd_GetPtr_Type(p, (ctx)->Union4.Stats, CPpmd_State)
  |  |  ------------------
  |  |  |  |  115|  16.4M|  #define Ppmd_GetPtr_Type(p, offs, type) ((type *)Ppmd_GetPtr(p, offs))
  |  |  |  |  ------------------
  |  |  |  |  |  |  114|  16.4M|  #define Ppmd_GetPtr(p, offs)  ((void *)((p)->Base + (offs)))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  300|  16.4M|      s--;
  301|  16.4M|      MASK(s->Symbol) = 0;
  ------------------
  |  |   85|  16.4M|#define MASK(sym)  ((Byte *)charMask)[sym]
  ------------------
  302|  16.4M|      do
  303|   897M|      {
  304|   897M|        const unsigned sym0 = s2[0].Symbol;
  305|   897M|        const unsigned sym1 = s2[1].Symbol;
  306|   897M|        s2 += 2;
  307|   897M|        MASK(sym0) = 0;
  ------------------
  |  |   85|   897M|#define MASK(sym)  ((Byte *)charMask)[sym]
  ------------------
  308|   897M|        MASK(sym1) = 0;
  ------------------
  |  |   85|   897M|#define MASK(sym)  ((Byte *)charMask)[sym]
  ------------------
  309|   897M|      }
  310|   897M|      while (s2 < s);
  ------------------
  |  Branch (310:14): [True: 880M, False: 16.4M]
  ------------------
  311|  16.4M|    }
  312|  16.4M|  }
  313|  71.2M|}
Ppmd8Enc.c:Ppmd8_RangeEnc_Encode:
   60|   158M|{
   61|   158M|  R->Low += start * (R->Range /= total);
  ------------------
  |  |   52|   158M|#define R p
  ------------------
                R->Low += start * (R->Range /= total);
  ------------------
  |  |   52|   158M|#define R p
  ------------------
   62|   158M|  R->Range *= size;
  ------------------
  |  |   52|   158M|#define R p
  ------------------
   63|   158M|  RC_NORM_LOCAL(R)
   64|   158M|}

