uint32_t i_rand_limit(uint32_t upper_bound)
{
	i_assert(upper_bound > 0);

	uint32_t val;
	uint32_t min = UNSIGNED_MINUS(upper_bound) % upper_bound;
	while((val = i_rand()) < min);
	return val % upper_bound;
}

Input: {'upper_bound': '2147483648'}

Output: {'type': 'unsigned int', 'value': '4150141857'}


int imap_parser_finish_line(struct imap_parser *parser, unsigned int count,
			    enum imap_parser_flags flags,
			    const struct imap_arg **args_r)
{
	const unsigned char *data;
	size_t data_size;
	int ret;

	ret = imap_parser_read_args(parser, count, flags, args_r);
	if (ret == -1)
		return -1;
	if (ret == -2) {

		if (parser->cur_type == ARG_PARSE_ATOM) {
			data = i_stream_get_data(parser->input, &data_size);
			imap_parser_save_arg(parser, data, data_size);
		}
	}
	return finish_line(parser, count, args_r);
}

Input: {'parser': 'NULL', 'count': '32767', 'flags': '(IMAP_PARSE_FLAG_INSIDE_LIST | IMAP_PARSE_FLAG_SERVER_TEXT | IMAP_PARSE_FLAG_STOP_AT_LIST | unknown: 0xffffdc00)', 'args_r': 'error'}

{'count': {'type': 'unsigned int', 'value': '32767'}}

Output: {'type': 'int', 'value': '-2'}