zmq_z85_decode:
  136|    160|{
  137|    160|    unsigned int byte_nbr = 0;
  138|    160|    unsigned int char_nbr = 0;
  139|    160|    uint32_t value = 0;
  140|    160|    size_t src_len = strlen (string_);
  141|       |
  142|    160|    if (src_len < 5 || src_len % 5 != 0)
  ------------------
  |  Branch (142:9): [True: 9, False: 151]
  |  Branch (142:24): [True: 37, False: 114]
  ------------------
  143|     46|        goto error_inval;
  144|       |
  145|  1.31M|    while (string_[char_nbr]) {
  ------------------
  |  Branch (145:12): [True: 1.31M, False: 59]
  ------------------
  146|       |        //  Accumulate value in base 85
  147|  1.31M|        if (UINT32_MAX / 85 < value) {
  ------------------
  |  Branch (147:13): [True: 7, False: 1.31M]
  ------------------
  148|       |            //  Invalid z85 encoding, represented value exceeds 0xffffffff
  149|      7|            goto error_inval;
  150|      7|        }
  151|  1.31M|        value *= 85;
  152|  1.31M|        const uint8_t index = string_[char_nbr++] - 32;
  153|  1.31M|        if (index >= sizeof (decoder)) {
  ------------------
  |  Branch (153:13): [True: 41, False: 1.31M]
  ------------------
  154|       |            //  Invalid z85 encoding, character outside range
  155|     41|            goto error_inval;
  156|     41|        }
  157|  1.31M|        const uint32_t summand = decoder[index];
  158|  1.31M|        if (summand == 0xFF || summand > (UINT32_MAX - value)) {
  ------------------
  |  Branch (158:13): [True: 5, False: 1.31M]
  |  Branch (158:32): [True: 2, False: 1.31M]
  ------------------
  159|       |            //  Invalid z85 encoding, invalid character or represented value exceeds 0xffffffff
  160|      7|            goto error_inval;
  161|      7|        }
  162|  1.31M|        value += summand;
  163|  1.31M|        if (char_nbr % 5 == 0) {
  ------------------
  |  Branch (163:13): [True: 263k, False: 1.05M]
  ------------------
  164|       |            //  Output value in base 256
  165|   263k|            unsigned int divisor = 256 * 256 * 256;
  166|  1.31M|            while (divisor) {
  ------------------
  |  Branch (166:20): [True: 1.05M, False: 263k]
  ------------------
  167|  1.05M|                dest_[byte_nbr++] = value / divisor % 256;
  168|  1.05M|                divisor /= 256;
  169|  1.05M|            }
  170|   263k|            value = 0;
  171|   263k|        }
  172|  1.31M|    }
  173|     59|    if (char_nbr % 5 != 0) {
  ------------------
  |  Branch (173:9): [True: 0, False: 59]
  ------------------
  174|      0|        goto error_inval;
  175|      0|    }
  176|     59|    assert (byte_nbr == strlen (string_) * 4 / 5);
  ------------------
  |  Branch (176:5): [True: 59, False: 0]
  ------------------
  177|     59|    return dest_;
  178|       |
  179|    101|error_inval:
  180|    101|    errno = EINVAL;
  181|       |    return NULL;
  182|     59|}

LLVMFuzzerTestOneInput:
   14|    164|{
   15|    164|    uint8_t *secret_key;
   16|       |
   17|    164|    if (size < 5)
  ------------------
  |  Branch (17:9): [True: 4, False: 160]
  ------------------
   18|      4|        return 0;
   19|       |
   20|       |    // As per API definition, input must be divisible by 5, so truncate it if it's not
   21|    160|    size -= size % 5;
   22|       |    // As per API definition, the destination must be at least 0.8 times the input data
   23|    160|    TEST_ASSERT_NOT_NULL (secret_key = (uint8_t *) malloc (size * 4 / 5));
  ------------------
  |  |  125|    160|#define TEST_ASSERT_NOT_NULL(pointer)                                                              UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL")
  |  |  ------------------
  |  |  |  |  656|    160|#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message)                                       UNITY_TEST_ASSERT(((pointer) != NULL),  (UNITY_LINE_TYPE)(line), (message))
  |  |  |  |  ------------------
  |  |  |  |  |  |  654|    160|#define UNITY_TEST_ASSERT(condition, line, message)                                              if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), (message));}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  647|      0|#define UNITY_TEST_FAIL(line, message)   UnityFail(   (message), (UNITY_LINE_TYPE)(line))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (654:102): [True: 160, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   24|       |
   25|    160|    std::string z85_secret_key (reinterpret_cast<const char *> (data), size);
   26|    160|    zmq_z85_decode (secret_key, z85_secret_key.c_str ());
   27|       |
   28|    160|    free (secret_key);
   29|       |
   30|    160|    return 0;
   31|    164|}

