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

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

