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

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

