file_ms_alloc:
  551|      2|{
  552|      2|	struct magic_set *ms;
  553|      2|	size_t i, len;
  554|       |
  555|      2|	if ((ms = CAST(struct magic_set *, calloc(CAST(size_t, 1u),
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (555:6): [True: 0, False: 2]
  ------------------
  556|      2|	    sizeof(*ms)))) == NULL)
  557|      0|		return NULL;
  558|       |
  559|      2|	if (magic_setflags(ms, flags) == -1) {
  ------------------
  |  Branch (559:6): [True: 0, False: 2]
  ------------------
  560|      0|		errno = EINVAL;
  561|      0|		goto free;
  562|      0|	}
  563|       |
  564|      2|	ms->o.buf = ms->o.pbuf = NULL;
  565|      2|	ms->o.blen = 0;
  566|      2|	len = (ms->c.len = 10) * sizeof(*ms->c.li);
  567|       |
  568|      2|	if ((ms->c.li = CAST(struct level_info *, malloc(len))) == NULL)
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (568:6): [True: 0, False: 2]
  ------------------
  569|      0|		goto free;
  570|       |
  571|      2|	ms->event_flags = 0;
  572|      2|	ms->error = -1;
  573|      6|	for (i = 0; i < MAGIC_SETS; i++)
  ------------------
  |  |  463|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (573:14): [True: 4, False: 2]
  ------------------
  574|      4|		ms->mlist[i] = NULL;
  575|      2|	ms->file = "unknown";
  576|      2|	ms->line = 0;
  577|      2|	ms->indir_max = FILE_INDIR_MAX;
  ------------------
  |  |  511|      2|#define	FILE_INDIR_MAX			50
  ------------------
  578|      2|	ms->name_max = FILE_NAME_MAX;
  ------------------
  |  |  512|      2|#define	FILE_NAME_MAX			50
  ------------------
  579|      2|	ms->elf_shnum_max = FILE_ELF_SHNUM_MAX;
  ------------------
  |  |  509|      2|#define	FILE_ELF_SHNUM_MAX		32768
  ------------------
  580|      2|	ms->elf_shsize_max = FILE_ELF_SHSIZE_MAX;
  ------------------
  |  |  510|      2|#define	FILE_ELF_SHSIZE_MAX		(128 * 1024 * 1024)
  ------------------
  581|      2|	ms->elf_phnum_max = FILE_ELF_PHNUM_MAX;
  ------------------
  |  |  508|      2|#define	FILE_ELF_PHNUM_MAX		2048
  ------------------
  582|      2|	ms->elf_notes_max = FILE_ELF_NOTES_MAX;
  ------------------
  |  |  507|      2|#define	FILE_ELF_NOTES_MAX		256
  ------------------
  583|      2|	ms->regex_max = FILE_REGEX_MAX;
  ------------------
  |  |  513|      2|#define	FILE_REGEX_MAX			8192
  ------------------
  584|      2|	ms->bytes_max = FILE_BYTES_MAX;
  ------------------
  |  |  505|      2|# define FILE_BYTES_MAX (7 * 1024 * 1024)/* how much of the file to look at */
  ------------------
  585|      2|	ms->encoding_max = FILE_ENCODING_MAX;
  ------------------
  |  |  514|      2|#define	FILE_ENCODING_MAX		(64 * 1024)
  ------------------
  586|      2|#ifdef USE_C_LOCALE
  587|      2|	ms->c_lc_ctype = newlocale(LC_CTYPE_MASK, "C", 0);
  588|      2|	assert(ms->c_lc_ctype != NULL);
  589|      2|#endif
  590|      2|	return ms;
  591|      0|free:
  592|      0|	free(ms);
  593|      0|	return NULL;
  594|      2|}
file_apprentice:
  735|      2|{
  736|      2|	char *p, *mfn;
  737|      2|	int fileerr, errs = -1;
  738|      2|	size_t i, j;
  739|       |
  740|      2|	(void)file_reset(ms, 0);
  741|       |
  742|      2|	if ((fn = magic_getpath(fn, action)) == NULL)
  ------------------
  |  Branch (742:6): [True: 0, False: 2]
  ------------------
  743|      0|		return -1;
  744|       |
  745|      2|	init_file_tables();
  746|       |
  747|      2|	if ((mfn = strdup(fn)) == NULL) {
  ------------------
  |  Branch (747:6): [True: 0, False: 2]
  ------------------
  748|      0|		file_oomem(ms, strlen(fn));
  749|      0|		return -1;
  750|      0|	}
  751|       |
  752|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  463|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (752:14): [True: 4, False: 2]
  ------------------
  753|      4|		mlist_free(ms->mlist[i]);
  754|      4|		if ((ms->mlist[i] = mlist_alloc()) == NULL) {
  ------------------
  |  Branch (754:7): [True: 0, False: 4]
  ------------------
  755|      0|			file_oomem(ms, sizeof(*ms->mlist[0]));
  756|      0|			for (j = 0; j < i; j++) {
  ------------------
  |  Branch (756:16): [True: 0, False: 0]
  ------------------
  757|      0|				mlist_free(ms->mlist[j]);
  758|      0|				ms->mlist[j] = NULL;
  759|      0|			}
  760|      0|			free(mfn);
  761|      0|			return -1;
  762|      0|		}
  763|      4|	}
  764|      2|	fn = mfn;
  765|       |
  766|      4|	while (fn) {
  ------------------
  |  Branch (766:9): [True: 2, False: 2]
  ------------------
  767|      2|		p = CCAST(char *, strchr(fn, PATHSEP));
  ------------------
  |  |  446|      2|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  768|      2|		if (p)
  ------------------
  |  Branch (768:7): [True: 0, False: 2]
  ------------------
  769|      0|			*p++ = '\0';
  770|      2|		if (*fn == '\0')
  ------------------
  |  Branch (770:7): [True: 0, False: 2]
  ------------------
  771|      0|			break;
  772|      2|		fileerr = apprentice_1(ms, fn, action);
  773|      2|		errs = MAX(errs, fileerr);
  774|      2|		fn = p;
  775|      2|	}
  776|       |
  777|      2|	free(mfn);
  778|       |
  779|      2|	if (errs == -1) {
  ------------------
  |  Branch (779:6): [True: 0, False: 2]
  ------------------
  780|      0|		for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  463|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (780:15): [True: 0, False: 0]
  ------------------
  781|      0|			mlist_free(ms->mlist[i]);
  782|      0|			ms->mlist[i] = NULL;
  783|      0|		}
  784|      0|		file_error(ms, 0, "could not find any valid magic files!");
  785|      0|		return -1;
  786|      0|	}
  787|       |
  788|       |#if 0
  789|       |	/*
  790|       |	 * Always leave the database loaded
  791|       |	 */
  792|       |	if (action == FILE_LOAD)
  793|       |		return 0;
  794|       |
  795|       |	for (i = 0; i < MAGIC_SETS; i++) {
  796|       |		mlist_free(ms->mlist[i]);
  797|       |		ms->mlist[i] = NULL;
  798|       |	}
  799|       |#endif
  800|       |
  801|      2|	switch (action) {
  802|      2|	case FILE_LOAD:
  ------------------
  |  |  187|      2|#define	FILE_LOAD	0
  ------------------
  |  Branch (802:2): [True: 2, False: 0]
  ------------------
  803|      2|	case FILE_COMPILE:
  ------------------
  |  |  189|      2|#define FILE_COMPILE	2
  ------------------
  |  Branch (803:2): [True: 0, False: 2]
  ------------------
  804|      2|	case FILE_CHECK:
  ------------------
  |  |  188|      2|#define FILE_CHECK	1
  ------------------
  |  Branch (804:2): [True: 0, False: 2]
  ------------------
  805|      2|	case FILE_LIST:
  ------------------
  |  |  190|      2|#define FILE_LIST	3
  ------------------
  |  Branch (805:2): [True: 0, False: 2]
  ------------------
  806|      2|		return 0;
  807|      0|	default:
  ------------------
  |  Branch (807:2): [True: 0, False: 2]
  ------------------
  808|      0|		file_error(ms, 0, "Invalid action %d", action);
  809|      0|		return -1;
  810|      2|	}
  811|      2|}
file_signextend:
 1631|  73.5M|{
 1632|  73.5M|	if (!(m->flag & UNSIGNED)) {
  ------------------
  |  |  226|  73.5M|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (1632:6): [True: 69.3M, False: 4.21M]
  ------------------
 1633|  69.3M|		switch(m->type) {
 1634|       |		/*
 1635|       |		 * Do not remove the casts below.  They are
 1636|       |		 * vital.  When later compared with the data,
 1637|       |		 * the sign extension must have happened.
 1638|       |		 */
 1639|   620k|		case FILE_BYTE:
  ------------------
  |  |  241|   620k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1639:3): [True: 620k, False: 68.7M]
  ------------------
 1640|   620k|			v = CAST(signed char,  v);
  ------------------
  |  |  444|   620k|#define CAST(T, b)	((T)(b))
  ------------------
 1641|   620k|			break;
 1642|   829k|		case FILE_SHORT:
  ------------------
  |  |  242|   829k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1642:3): [True: 829k, False: 68.5M]
  ------------------
 1643|  4.13M|		case FILE_BESHORT:
  ------------------
  |  |  247|  4.13M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1643:3): [True: 3.30M, False: 66.0M]
  ------------------
 1644|  6.16M|		case FILE_LESHORT:
  ------------------
  |  |  250|  6.16M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1644:3): [True: 2.03M, False: 67.3M]
  ------------------
 1645|  6.16M|			v = CAST(short, v);
  ------------------
  |  |  444|  6.16M|#define CAST(T, b)	((T)(b))
  ------------------
 1646|  6.16M|			break;
 1647|      0|		case FILE_DATE:
  ------------------
  |  |  246|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (1647:3): [True: 0, False: 69.3M]
  ------------------
 1648|    155|		case FILE_BEDATE:
  ------------------
  |  |  249|    155|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1648:3): [True: 155, False: 69.3M]
  ------------------
 1649|    304|		case FILE_LEDATE:
  ------------------
  |  |  252|    304|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1649:3): [True: 149, False: 69.3M]
  ------------------
 1650|    400|		case FILE_MEDATE:
  ------------------
  |  |  261|    400|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1650:3): [True: 96, False: 69.3M]
  ------------------
 1651|    400|		case FILE_LDATE:
  ------------------
  |  |  254|    400|#define				FILE_LDATE		14
  ------------------
  |  Branch (1651:3): [True: 0, False: 69.3M]
  ------------------
 1652|    544|		case FILE_BELDATE:
  ------------------
  |  |  255|    544|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1652:3): [True: 144, False: 69.3M]
  ------------------
 1653|    578|		case FILE_LELDATE:
  ------------------
  |  |  256|    578|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1653:3): [True: 34, False: 69.3M]
  ------------------
 1654|    578|		case FILE_MELDATE:
  ------------------
  |  |  262|    578|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1654:3): [True: 0, False: 69.3M]
  ------------------
 1655|  1.27M|		case FILE_LONG:
  ------------------
  |  |  244|  1.27M|#define				FILE_LONG		4
  ------------------
  |  Branch (1655:3): [True: 1.27M, False: 68.1M]
  ------------------
 1656|  11.0M|		case FILE_BELONG:
  ------------------
  |  |  248|  11.0M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1656:3): [True: 9.75M, False: 59.6M]
  ------------------
 1657|  14.4M|		case FILE_LELONG:
  ------------------
  |  |  251|  14.4M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1657:3): [True: 3.38M, False: 65.9M]
  ------------------
 1658|  14.4M|		case FILE_MELONG:
  ------------------
  |  |  263|  14.4M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1658:3): [True: 68, False: 69.3M]
  ------------------
 1659|  14.4M|		case FILE_FLOAT:
  ------------------
  |  |  273|  14.4M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1659:3): [True: 0, False: 69.3M]
  ------------------
 1660|  14.4M|		case FILE_BEFLOAT:
  ------------------
  |  |  274|  14.4M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1660:3): [True: 0, False: 69.3M]
  ------------------
 1661|  14.4M|		case FILE_LEFLOAT:
  ------------------
  |  |  275|  14.4M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1661:3): [True: 0, False: 69.3M]
  ------------------
 1662|  14.4M|		case FILE_MSDOSDATE:
  ------------------
  |  |  293|  14.4M|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (1662:3): [True: 0, False: 69.3M]
  ------------------
 1663|  14.4M|		case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|  14.4M|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (1663:3): [True: 0, False: 69.3M]
  ------------------
 1664|  14.4M|		case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|  14.4M|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (1664:3): [True: 67, False: 69.3M]
  ------------------
 1665|  14.4M|		case FILE_MSDOSTIME:
  ------------------
  |  |  296|  14.4M|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (1665:3): [True: 0, False: 69.3M]
  ------------------
 1666|  14.4M|		case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|  14.4M|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (1666:3): [True: 0, False: 69.3M]
  ------------------
 1667|  14.4M|		case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|  14.4M|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (1667:3): [True: 67, False: 69.3M]
  ------------------
 1668|  14.4M|			v = CAST(int32_t, v);
  ------------------
  |  |  444|  14.4M|#define CAST(T, b)	((T)(b))
  ------------------
 1669|  14.4M|			break;
 1670|  57.2k|		case FILE_QUAD:
  ------------------
  |  |  264|  57.2k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1670:3): [True: 57.2k, False: 69.3M]
  ------------------
 1671|   612k|		case FILE_BEQUAD:
  ------------------
  |  |  266|   612k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1671:3): [True: 554k, False: 68.8M]
  ------------------
 1672|   890k|		case FILE_LEQUAD:
  ------------------
  |  |  265|   890k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1672:3): [True: 278k, False: 69.0M]
  ------------------
 1673|   890k|		case FILE_QDATE:
  ------------------
  |  |  267|   890k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1673:3): [True: 0, False: 69.3M]
  ------------------
 1674|   890k|		case FILE_QLDATE:
  ------------------
  |  |  270|   890k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1674:3): [True: 0, False: 69.3M]
  ------------------
 1675|   890k|		case FILE_QWDATE:
  ------------------
  |  |  282|   890k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1675:3): [True: 240, False: 69.3M]
  ------------------
 1676|   890k|		case FILE_BEQDATE:
  ------------------
  |  |  269|   890k|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1676:3): [True: 142, False: 69.3M]
  ------------------
 1677|   890k|		case FILE_BEQLDATE:
  ------------------
  |  |  272|   890k|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1677:3): [True: 0, False: 69.3M]
  ------------------
 1678|   890k|		case FILE_BEQWDATE:
  ------------------
  |  |  284|   890k|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1678:3): [True: 0, False: 69.3M]
  ------------------
 1679|   890k|		case FILE_LEQDATE:
  ------------------
  |  |  268|   890k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1679:3): [True: 89, False: 69.3M]
  ------------------
 1680|   890k|		case FILE_LEQLDATE:
  ------------------
  |  |  271|   890k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1680:3): [True: 20, False: 69.3M]
  ------------------
 1681|   891k|		case FILE_LEQWDATE:
  ------------------
  |  |  283|   891k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1681:3): [True: 1.12k, False: 69.3M]
  ------------------
 1682|   891k|		case FILE_DOUBLE:
  ------------------
  |  |  276|   891k|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1682:3): [True: 0, False: 69.3M]
  ------------------
 1683|   891k|		case FILE_BEDOUBLE:
  ------------------
  |  |  277|   891k|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1683:3): [True: 0, False: 69.3M]
  ------------------
 1684|   891k|		case FILE_LEDOUBLE:
  ------------------
  |  |  278|   891k|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1684:3): [True: 0, False: 69.3M]
  ------------------
 1685|   891k|		case FILE_OFFSET:
  ------------------
  |  |  290|   891k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1685:3): [True: 0, False: 69.3M]
  ------------------
 1686|   891k|		case FILE_BEVARINT:
  ------------------
  |  |  291|   891k|#define				FILE_BEVARINT		51
  ------------------
  |  Branch (1686:3): [True: 0, False: 69.3M]
  ------------------
 1687|   891k|		case FILE_LEVARINT:
  ------------------
  |  |  292|   891k|#define				FILE_LEVARINT		52
  ------------------
  |  Branch (1687:3): [True: 0, False: 69.3M]
  ------------------
 1688|   891k|			v = CAST(int64_t, v);
  ------------------
  |  |  444|   891k|#define CAST(T, b)	((T)(b))
  ------------------
 1689|   891k|			break;
 1690|  46.3M|		case FILE_STRING:
  ------------------
  |  |  245|  46.3M|#define				FILE_STRING		5
  ------------------
  |  Branch (1690:3): [True: 46.3M, False: 23.0M]
  ------------------
 1691|  46.3M|		case FILE_PSTRING:
  ------------------
  |  |  253|  46.3M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1691:3): [True: 19.8k, False: 69.3M]
  ------------------
 1692|  46.3M|		case FILE_BESTRING16:
  ------------------
  |  |  258|  46.3M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1692:3): [True: 147, False: 69.3M]
  ------------------
 1693|  46.4M|		case FILE_LESTRING16:
  ------------------
  |  |  259|  46.4M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1693:3): [True: 55.8k, False: 69.3M]
  ------------------
 1694|  46.6M|		case FILE_REGEX:
  ------------------
  |  |  257|  46.6M|#define				FILE_REGEX		17
  ------------------
  |  Branch (1694:3): [True: 215k, False: 69.1M]
  ------------------
 1695|  47.1M|		case FILE_SEARCH:
  ------------------
  |  |  260|  47.1M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1695:3): [True: 482k, False: 68.8M]
  ------------------
 1696|  47.1M|		case FILE_DEFAULT:
  ------------------
  |  |  243|  47.1M|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1696:3): [True: 6.08k, False: 69.3M]
  ------------------
 1697|  47.1M|		case FILE_INDIRECT:
  ------------------
  |  |  281|  47.1M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1697:3): [True: 0, False: 69.3M]
  ------------------
 1698|  47.1M|		case FILE_NAME:
  ------------------
  |  |  285|  47.1M|#define				FILE_NAME		45
  ------------------
  |  Branch (1698:3): [True: 0, False: 69.3M]
  ------------------
 1699|  47.1M|		case FILE_USE:
  ------------------
  |  |  286|  47.1M|#define				FILE_USE		46
  ------------------
  |  Branch (1699:3): [True: 0, False: 69.3M]
  ------------------
 1700|  47.1M|		case FILE_CLEAR:
  ------------------
  |  |  287|  47.1M|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1700:3): [True: 249, False: 69.3M]
  ------------------
 1701|  47.1M|		case FILE_DER:
  ------------------
  |  |  288|  47.1M|#define				FILE_DER		48
  ------------------
  |  Branch (1701:3): [True: 0, False: 69.3M]
  ------------------
 1702|  47.2M|		case FILE_GUID:
  ------------------
  |  |  289|  47.2M|#define				FILE_GUID		49
  ------------------
  |  Branch (1702:3): [True: 139k, False: 69.2M]
  ------------------
 1703|  47.2M|		case FILE_OCTAL:
  ------------------
  |  |  299|  47.2M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1703:3): [True: 0, False: 69.3M]
  ------------------
 1704|  47.2M|			break;
 1705|      0|		default:
  ------------------
  |  Branch (1705:3): [True: 0, False: 69.3M]
  ------------------
 1706|      0|			if (ms->flags & MAGIC_CHECK)
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (1706:8): [True: 0, False: 0]
  ------------------
 1707|      0|			    file_magwarn(ms, "cannot happen: m->type=%d\n",
 1708|      0|				    m->type);
 1709|      0|			return FILE_BADSIZE;
  ------------------
  |  |  175|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1710|  69.3M|		}
 1711|  69.3M|	}
 1712|  73.5M|	return v;
 1713|  73.5M|}
file_pstring_length_size:
 3635|  23.6k|{
 3636|  23.6k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  375|  23.6k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  404|  23.6k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  396|  23.6k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  23.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  399|  23.6k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  23.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  398|  23.6k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  23.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  401|  23.6k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  23.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  400|  23.6k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  23.6k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3637|  18.8k|	case PSTRING_1_LE:
  ------------------
  |  |  397|  18.8k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  388|  18.8k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3637:2): [True: 18.8k, False: 4.81k]
  ------------------
 3638|  18.8k|		return 1;
 3639|    462|	case PSTRING_2_LE:
  ------------------
  |  |  399|    462|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  388|    462|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3639:2): [True: 462, False: 23.1k]
  ------------------
 3640|  3.86k|	case PSTRING_2_BE:
  ------------------
  |  |  398|  3.86k|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  388|  3.86k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3640:2): [True: 3.40k, False: 20.2k]
  ------------------
 3641|  3.86k|		return 2;
 3642|    633|	case PSTRING_4_LE:
  ------------------
  |  |  401|    633|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  388|    633|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3642:2): [True: 633, False: 22.9k]
  ------------------
 3643|    948|	case PSTRING_4_BE:
  ------------------
  |  |  400|    948|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  388|    948|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3643:2): [True: 315, False: 23.3k]
  ------------------
 3644|    948|		return 4;
 3645|      0|	default:
  ------------------
  |  Branch (3645:2): [True: 0, False: 23.6k]
  ------------------
 3646|      0|		file_error(ms, 0, "corrupt magic file "
 3647|      0|		    "(bad pascal string length %d)",
 3648|      0|		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  375|      0|#define str_flags _u._s._flags
  ------------------
              		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  404|      0|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  396|      0|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  399|      0|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  398|      0|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  401|      0|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  400|      0|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3649|      0|		return FILE_BADSIZE;
  ------------------
  |  |  175|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 3650|  23.6k|	}
 3651|  23.6k|}
file_pstring_get_length:
 3655|  19.9k|{
 3656|  19.9k|	size_t len = 0;
 3657|  19.9k|	const unsigned char *s = RCAST(const unsigned char *, ss);
  ------------------
  |  |  445|  19.9k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 3658|  19.9k|	unsigned int s3, s2, s1, s0;
 3659|       |
 3660|  19.9k|	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  375|  19.9k|#define str_flags _u._s._flags
  ------------------
              	switch (m->str_flags & PSTRING_LEN) {
  ------------------
  |  |  404|  19.9k|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  396|  19.9k|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.9k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  399|  19.9k|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.9k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  398|  19.9k|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.9k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  401|  19.9k|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.9k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  400|  19.9k|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  19.9k|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3661|  18.5k|	case PSTRING_1_LE:
  ------------------
  |  |  397|  18.5k|#define PSTRING_1_LE				BIT(7)
  |  |  ------------------
  |  |  |  |  388|  18.5k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3661:2): [True: 18.5k, False: 1.37k]
  ------------------
 3662|  18.5k|		len = *s;
 3663|  18.5k|		break;
 3664|    154|	case PSTRING_2_LE:
  ------------------
  |  |  399|    154|#define PSTRING_2_LE				BIT(9)
  |  |  ------------------
  |  |  |  |  388|    154|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3664:2): [True: 154, False: 19.8k]
  ------------------
 3665|    154|		s0 = s[0];
 3666|    154|		s1 = s[1];
 3667|    154|		len = (s1 << 8) | s0;
 3668|    154|		break;
 3669|    900|	case PSTRING_2_BE:
  ------------------
  |  |  398|    900|#define PSTRING_2_BE				BIT(8)
  |  |  ------------------
  |  |  |  |  388|    900|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3669:2): [True: 900, False: 19.0k]
  ------------------
 3670|    900|		s0 = s[0];
 3671|    900|		s1 = s[1];
 3672|    900|		len = (s0 << 8) | s1;
 3673|    900|		break;
 3674|    211|	case PSTRING_4_LE:
  ------------------
  |  |  401|    211|#define PSTRING_4_LE				BIT(11)
  |  |  ------------------
  |  |  |  |  388|    211|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3674:2): [True: 211, False: 19.7k]
  ------------------
 3675|    211|		s0 = s[0];
 3676|    211|		s1 = s[1];
 3677|    211|		s2 = s[2];
 3678|    211|		s3 = s[3];
 3679|    211|		len = (s3 << 24) | (s2 << 16) | (s1 << 8) | s0;
 3680|    211|		break;
 3681|    105|	case PSTRING_4_BE:
  ------------------
  |  |  400|    105|#define PSTRING_4_BE				BIT(10)
  |  |  ------------------
  |  |  |  |  388|    105|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3681:2): [True: 105, False: 19.8k]
  ------------------
 3682|    105|		s0 = s[0];
 3683|    105|		s1 = s[1];
 3684|    105|		s2 = s[2];
 3685|    105|		s3 = s[3];
 3686|    105|		len = (s0 << 24) | (s1 << 16) | (s2 << 8) | s3;
 3687|    105|		break;
 3688|      0|	default:
  ------------------
  |  Branch (3688:2): [True: 0, False: 19.9k]
  ------------------
 3689|      0|		file_error(ms, 0, "corrupt magic file "
 3690|      0|		    "(bad pascal string length %d)",
 3691|      0|		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  375|      0|#define str_flags _u._s._flags
  ------------------
              		    m->str_flags & PSTRING_LEN);
  ------------------
  |  |  404|      0|    (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  396|      0|#define PSTRING_1_BE				BIT(7)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  399|      0|#define PSTRING_2_LE				BIT(9)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  398|      0|#define PSTRING_2_BE				BIT(8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  401|      0|#define PSTRING_4_LE				BIT(11)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                   (PSTRING_1_BE|PSTRING_2_LE|PSTRING_2_BE|PSTRING_4_LE|PSTRING_4_BE)
  |  |  ------------------
  |  |  |  |  400|      0|#define PSTRING_4_BE				BIT(10)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|      0|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3692|      0|		return FILE_BADSIZE;
  ------------------
  |  |  175|      0|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 3693|  19.9k|	}
 3694|       |
 3695|  19.9k|	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  375|  19.9k|#define str_flags _u._s._flags
  ------------------
              	if (m->str_flags & PSTRING_LENGTH_INCLUDES_ITSELF) {
  ------------------
  |  |  405|  19.9k|#define PSTRING_LENGTH_INCLUDES_ITSELF		BIT(12)
  |  |  ------------------
  |  |  |  |  388|  19.9k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (3695:6): [True: 869, False: 19.0k]
  ------------------
 3696|    869|		size_t l = file_pstring_length_size(ms, m);
 3697|    869|		if (l == FILE_BADSIZE)
  ------------------
  |  |  175|    869|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|    869|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (3697:7): [True: 0, False: 869]
  ------------------
 3698|      0|			return l;
 3699|    869|		len -= l;
 3700|    869|	}
 3701|       |
 3702|  19.9k|	return len;
 3703|  19.9k|}
file_magicfind:
 3707|  53.5k|{
 3708|  53.5k|	uint32_t i, j;
 3709|  53.5k|	struct mlist *mlist, *ml;
 3710|       |
 3711|  53.5k|	mlist = ms->mlist[1];
 3712|       |
 3713|  53.5k|	for (ml = mlist->next; ml != mlist; ml = ml->next) {
  ------------------
  |  Branch (3713:25): [True: 53.5k, False: 0]
  ------------------
 3714|  53.5k|		struct magic *ma = ml->magic;
 3715|   200M|		for (i = 0; i < ml->nmagic; i++) {
  ------------------
  |  Branch (3715:15): [True: 200M, False: 0]
  ------------------
 3716|   200M|			if (ma[i].type != FILE_NAME)
  ------------------
  |  |  285|   200M|#define				FILE_NAME		45
  ------------------
  |  Branch (3716:8): [True: 191M, False: 8.90M]
  ------------------
 3717|   191M|				continue;
 3718|  8.90M|			if (strcmp(ma[i].value.s, name) == 0) {
  ------------------
  |  Branch (3718:8): [True: 53.5k, False: 8.84M]
  ------------------
 3719|  53.5k|				v->magic = &ma[i];
 3720|  53.5k|				v->magic_rxcomp = &(ml->magic_rxcomp[i]);
 3721|  2.34M|				for (j = i + 1; j < ml->nmagic; j++)
  ------------------
  |  Branch (3721:21): [True: 2.34M, False: 66]
  ------------------
 3722|  2.34M|				    if (ma[j].cont_level == 0)
  ------------------
  |  Branch (3722:13): [True: 53.5k, False: 2.29M]
  ------------------
 3723|  53.5k|					    break;
 3724|  53.5k|				v->nmagic = j - i;
 3725|  53.5k|				return 0;
 3726|  53.5k|			}
 3727|  8.90M|		}
 3728|  53.5k|	}
 3729|      0|	return -1;
 3730|  53.5k|}
apprentice.c:mlist_free:
  674|      4|{
  675|      4|	struct mlist *ml, *next;
  676|       |
  677|      4|	if (mlist == NULL)
  ------------------
  |  Branch (677:6): [True: 4, False: 0]
  ------------------
  678|      4|		return;
  679|       |
  680|      0|	for (ml = mlist->next; ml != mlist;) {
  ------------------
  |  Branch (680:25): [True: 0, False: 0]
  ------------------
  681|      0|		next = ml->next;
  682|      0|		mlist_free_one(ml);
  683|      0|		ml = next;
  684|      0|	}
  685|      0|	mlist_free_one(mlist);
  686|      0|}
apprentice.c:init_file_tables:
  426|      2|{
  427|      2|	static int done = 0;
  428|      2|	const struct type_tbl_s *p;
  429|       |
  430|      2|	if (done)
  ------------------
  |  Branch (430:6): [True: 0, False: 2]
  ------------------
  431|      0|		return;
  432|      2|	done++;
  433|       |
  434|    122|	for (p = type_tbl; p->len; p++) {
  ------------------
  |  Branch (434:21): [True: 120, False: 2]
  ------------------
  435|    120|		assert(p->type < FILE_NAMES_SIZE);
  436|    120|		file_names[p->type] = p->name;
  437|    120|		file_formats[p->type] = p->format;
  438|    120|	}
  439|      2|	assert(p - type_tbl == FILE_NAMES_SIZE);
  440|      2|}
apprentice.c:mlist_alloc:
  632|      4|{
  633|      4|	struct mlist *mlist;
  634|      4|	if ((mlist = CAST(struct mlist *, calloc(1, sizeof(*mlist)))) == NULL) {
  ------------------
  |  |  444|      4|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (634:6): [True: 0, False: 4]
  ------------------
  635|      0|		return NULL;
  636|      0|	}
  637|      4|	mlist->next = mlist->prev = mlist;
  638|      4|	return mlist;
  639|      4|}
apprentice.c:add_mlist:
  444|      4|{
  445|      4|	struct mlist *ml;
  446|       |
  447|      4|	mlp->map = NULL;
  448|      4|	if ((ml = CAST(struct mlist *, malloc(sizeof(*ml)))) == NULL)
  ------------------
  |  |  444|      4|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (448:6): [True: 0, False: 4]
  ------------------
  449|      0|		return -1;
  450|       |
  451|      4|	ml->map = idx == 0 ? map : NULL;
  ------------------
  |  Branch (451:12): [True: 2, False: 2]
  ------------------
  452|      4|	ml->magic = map->magic[idx];
  453|      4|	ml->nmagic = map->nmagic[idx];
  454|      4|	if (ml->nmagic) {
  ------------------
  |  Branch (454:6): [True: 4, False: 0]
  ------------------
  455|      4|		ml->magic_rxcomp = CAST(file_regex_t **,
  ------------------
  |  |  444|      4|#define CAST(T, b)	((T)(b))
  ------------------
  456|      4|		    calloc(ml->nmagic, sizeof(*ml->magic_rxcomp)));
  457|      4|		if (ml->magic_rxcomp == NULL) {
  ------------------
  |  Branch (457:7): [True: 0, False: 4]
  ------------------
  458|      0|			free(ml);
  459|      0|			return -1;
  460|      0|		}
  461|      4|	} else
  462|      0|		ml->magic_rxcomp = NULL;
  463|      4|	mlp->prev->next = ml;
  464|      4|	ml->prev = mlp->prev;
  465|      4|	ml->next = mlp;
  466|      4|	mlp->prev = ml;
  467|      4|	return 0;
  468|      4|}
apprentice.c:apprentice_1:
  475|      2|{
  476|      2|	struct magic_map *map;
  477|      2|#ifndef COMPILE_ONLY
  478|      2|	size_t i;
  479|      2|#endif
  480|       |
  481|      2|	if (magicsize != FILE_MAGICSIZE) {
  ------------------
  |  |  183|      2|#define FILE_MAGICSIZE	432
  ------------------
  |  Branch (481:6): [True: 0, False: 2]
  ------------------
  482|      0|		file_error(ms, 0, "magic element size %lu != %lu",
  483|      0|		    CAST(unsigned long, sizeof(*map->magic[0])),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  484|      0|		    CAST(unsigned long, FILE_MAGICSIZE));
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  485|      0|		return -1;
  486|      0|	}
  487|       |
  488|      2|	if (action == FILE_COMPILE) {
  ------------------
  |  |  189|      2|#define FILE_COMPILE	2
  ------------------
  |  Branch (488:6): [True: 0, False: 2]
  ------------------
  489|      0|		map = apprentice_load(ms, fn, action);
  490|      0|		if (map == NULL)
  ------------------
  |  Branch (490:7): [True: 0, False: 0]
  ------------------
  491|      0|			return -1;
  492|      0|		return apprentice_compile(ms, map, fn);
  493|      0|	}
  494|       |
  495|      2|#ifndef COMPILE_ONLY
  496|      2|	map = apprentice_map(ms, fn);
  497|      2|	if (map == NULL) {
  ------------------
  |  Branch (497:6): [True: 0, False: 2]
  ------------------
  498|      0|		if (ms->flags & MAGIC_CHECK)
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (498:7): [True: 0, False: 0]
  ------------------
  499|      0|			file_magwarn(NULL, "using regular magic file `%s'", fn);
  500|      0|		map = apprentice_load(ms, fn, action);
  501|      0|		if (map == NULL)
  ------------------
  |  Branch (501:7): [True: 0, False: 0]
  ------------------
  502|      0|			return -1;
  503|      0|	}
  504|       |
  505|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  463|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (505:14): [True: 4, False: 2]
  ------------------
  506|      4|		if (add_mlist(ms->mlist[i], map, i) == -1) {
  ------------------
  |  Branch (506:7): [True: 0, False: 4]
  ------------------
  507|       |			/* failed to add to any list, free explicitly */
  508|      0|			if (i == 0)
  ------------------
  |  Branch (508:8): [True: 0, False: 0]
  ------------------
  509|      0|				apprentice_unmap(map);
  510|      0|			else
  511|      0|				mlist_free_all(ms);
  512|      0|			file_oomem(ms, sizeof(*ms->mlist[0]));
  513|      0|			return -1;
  514|      0|		}
  515|      4|	}
  516|       |
  517|      2|	if (action == FILE_LIST) {
  ------------------
  |  |  190|      2|#define FILE_LIST	3
  ------------------
  |  Branch (517:6): [True: 0, False: 2]
  ------------------
  518|      0|		for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  463|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (518:15): [True: 0, False: 0]
  ------------------
  519|      0|			printf("Set %" SIZE_T_FORMAT "u:\nBinary patterns:\n",
  520|      0|			    i);
  521|      0|			apprentice_list(ms->mlist[i], BINTEST);
  ------------------
  |  |  228|      0|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
  522|      0|			printf("Text patterns:\n");
  523|      0|			apprentice_list(ms->mlist[i], TEXTTEST);
  ------------------
  |  |  230|      0|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  524|      0|		}
  525|      0|	}
  526|      2|	return 0;
  527|       |#else
  528|       |	return 0;
  529|       |#endif /* COMPILE_ONLY */
  530|      2|}
apprentice.c:mkdbname:
 3467|      2|{
 3468|      2|	const char *p, *q;
 3469|      2|	char *buf;
 3470|       |
 3471|      2|	if (strip) {
  ------------------
  |  Branch (3471:6): [True: 0, False: 2]
  ------------------
 3472|      0|		if ((p = strrchr(fn, '/')) != NULL)
  ------------------
  |  Branch (3472:7): [True: 0, False: 0]
  ------------------
 3473|      0|			fn = ++p;
 3474|      0|	}
 3475|       |
 3476|     94|	for (q = fn; *q; q++)
  ------------------
  |  Branch (3476:15): [True: 92, False: 2]
  ------------------
 3477|     92|		continue;
 3478|       |	/* Look for .mgc */
 3479|      6|	for (p = ext + sizeof(ext) - 1; p >= ext && q >= fn; p--, q--)
  ------------------
  |  Branch (3479:34): [True: 6, False: 0]
  |  Branch (3479:46): [True: 6, False: 0]
  ------------------
 3480|      6|		if (*p != *q)
  ------------------
  |  Branch (3480:7): [True: 2, False: 4]
  ------------------
 3481|      2|			break;
 3482|       |
 3483|       |	/* Did not find .mgc, restore q */
 3484|      2|	if (p >= ext)
  ------------------
  |  Branch (3484:6): [True: 2, False: 0]
  ------------------
 3485|      6|		while (*q)
  ------------------
  |  Branch (3485:10): [True: 4, False: 2]
  ------------------
 3486|      4|			q++;
 3487|       |
 3488|      2|	q++;
 3489|       |	/* Compatibility with old code that looked in .mime */
 3490|      2|	if (ms->flags & MAGIC_MIME) {
  ------------------
  |  |   44|      2|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|      2|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|      2|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (3490:6): [True: 0, False: 2]
  ------------------
 3491|      0|		if (asprintf(&buf, "%.*s.mime%s", CAST(int, q - fn), fn, ext)
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3491:7): [True: 0, False: 0]
  ------------------
 3492|      0|		    < 0)
 3493|      0|			return NULL;
 3494|      0|		if (access(buf, R_OK) != -1) {
  ------------------
  |  Branch (3494:7): [True: 0, False: 0]
  ------------------
 3495|      0|			ms->flags &= MAGIC_MIME_TYPE;
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
 3496|      0|			return buf;
 3497|      0|		}
 3498|      0|		free(buf);
 3499|      0|	}
 3500|      2|	if (asprintf(&buf, "%.*s%s", CAST(int, q - fn), fn, ext) < 0)
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3500:6): [True: 0, False: 2]
  ------------------
 3501|      0|		return NULL;
 3502|       |
 3503|       |	/* Compatibility with old code that looked in .mime */
 3504|      2|	if (strstr(fn, ".mime") != NULL)
  ------------------
  |  Branch (3504:6): [True: 0, False: 2]
  ------------------
 3505|      0|		ms->flags &= MAGIC_MIME_TYPE;
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
 3506|      2|	return buf;
 3507|      2|}
apprentice.c:apprentice_map:
 3275|      2|{
 3276|      2|	int fd;
 3277|      2|	struct stat st;
 3278|      2|	char *dbname = NULL;
 3279|      2|	struct magic_map *map;
 3280|      2|	struct magic_map *rv = NULL;
 3281|       |
 3282|      2|	fd = -1;
 3283|      2|	if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3283:6): [True: 0, False: 2]
  ------------------
 3284|      0|		file_oomem(ms, sizeof(*map));
 3285|      0|		goto error;
 3286|      0|	}
 3287|      2|	map->type = MAP_TYPE_USER;	/* unspecified */
  ------------------
  |  |   86|      2|#define MAP_TYPE_USER	0
  ------------------
 3288|       |
 3289|      2|	dbname = mkdbname(ms, fn, 0);
 3290|      2|	if (dbname == NULL)
  ------------------
  |  Branch (3290:6): [True: 0, False: 2]
  ------------------
 3291|      0|		goto error;
 3292|       |
 3293|      2|	if ((fd = open(dbname, O_RDONLY|O_BINARY)) == -1)
  ------------------
  |  |  716|      2|#define O_BINARY	0
  ------------------
  |  Branch (3293:6): [True: 0, False: 2]
  ------------------
 3294|      0|		goto error;
 3295|       |
 3296|      2|	if (fstat(fd, &st) == -1) {
  ------------------
  |  Branch (3296:6): [True: 0, False: 2]
  ------------------
 3297|      0|		file_error(ms, errno, "cannot stat `%s'", dbname);
 3298|      0|		goto error;
 3299|      0|	}
 3300|      2|	if (st.st_size < 8 || st.st_size > maxoff_t()) {
  ------------------
  |  Branch (3300:6): [True: 0, False: 2]
  |  Branch (3300:24): [True: 0, False: 2]
  ------------------
 3301|      0|		file_error(ms, 0, "file `%s' is too %s", dbname,
 3302|      0|		    st.st_size < 8 ? "small" : "large");
  ------------------
  |  Branch (3302:7): [True: 0, False: 0]
  ------------------
 3303|      0|		goto error;
 3304|      0|	}
 3305|       |
 3306|      2|	map->len = CAST(size_t, st.st_size);
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3307|      2|#ifdef QUICK
 3308|      2|	map->type = MAP_TYPE_MMAP;
  ------------------
  |  |   88|      2|#define MAP_TYPE_MMAP	2
  ------------------
 3309|      2|	if ((map->p = mmap(0, CAST(size_t, st.st_size), PROT_READ|PROT_WRITE,
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3309:6): [True: 0, False: 2]
  ------------------
 3310|      2|	    MAP_PRIVATE|MAP_FILE, fd, CAST(off_t, 0))) == MAP_FAILED) {
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3311|      0|		file_error(ms, errno, "cannot map `%s'", dbname);
 3312|      0|		goto error;
 3313|      0|	}
 3314|       |#else
 3315|       |	map->type = MAP_TYPE_MALLOC;
 3316|       |	if ((map->p = CAST(void *, malloc(map->len))) == NULL) {
 3317|       |		file_oomem(ms, map->len);
 3318|       |		goto error;
 3319|       |	}
 3320|       |	if (read(fd, map->p, map->len) != (ssize_t)map->len) {
 3321|       |		file_badread(ms);
 3322|       |		goto error;
 3323|       |	}
 3324|       |#endif
 3325|      2|	(void)close(fd);
 3326|      2|	fd = -1;
 3327|       |
 3328|      2|	if (check_buffer(ms, map, dbname) != 0) {
  ------------------
  |  Branch (3328:6): [True: 0, False: 2]
  ------------------
 3329|      0|		goto error;
 3330|      0|	}
 3331|      2|#ifdef QUICK
 3332|      2|	if (mprotect(map->p, CAST(size_t, st.st_size), PROT_READ) == -1) {
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (3332:6): [True: 0, False: 2]
  ------------------
 3333|      0|		file_error(ms, errno, "cannot mprotect `%s'", dbname);
 3334|      0|		goto error;
 3335|      0|	}
 3336|      2|#endif
 3337|       |
 3338|      2|	free(dbname);
 3339|      2|	return map;
 3340|       |
 3341|      0|error:
 3342|      0|	if (fd != -1)
  ------------------
  |  Branch (3342:6): [True: 0, False: 0]
  ------------------
 3343|      0|		(void)close(fd);
 3344|      0|	apprentice_unmap(map);
 3345|      0|	free(dbname);
 3346|      0|	return rv;
 3347|      2|}
apprentice.c:maxoff_t:
  331|      2|maxoff_t(void) {
  332|      2|	if (/*CONSTCOND*/sizeof(off_t) == sizeof(int))
  ------------------
  |  Branch (332:19): [Folded - Ignored]
  ------------------
  333|      0|		return CAST(off_t, INT_MAX);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  334|      2|	if (/*CONSTCOND*/sizeof(off_t) == sizeof(long))
  ------------------
  |  Branch (334:19): [Folded - Ignored]
  ------------------
  335|      2|		return CAST(off_t, LONG_MAX);
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
  336|      0|	return 0x7fffffff;
  337|      2|}
apprentice.c:check_buffer:
 3351|      2|{
 3352|      2|	uint32_t *ptr;
 3353|      2|	uint32_t entries, nentries;
 3354|      2|	uint32_t version;
 3355|      2|	int i, needsbyteswap;
 3356|       |
 3357|      2|	ptr = CAST(uint32_t *, map->p);
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3358|      2|	if (*ptr != MAGICNO) {
  ------------------
  |  |  181|      2|#define MAGICNO		0xF11E041C
  ------------------
  |  Branch (3358:6): [True: 0, False: 2]
  ------------------
 3359|      0|		if (swap4(*ptr) != MAGICNO) {
  ------------------
  |  |  136|      0|#define swap4(x)	bswap_32(x)
  ------------------
              		if (swap4(*ptr) != MAGICNO) {
  ------------------
  |  |  181|      0|#define MAGICNO		0xF11E041C
  ------------------
  |  Branch (3359:7): [True: 0, False: 0]
  ------------------
 3360|      0|			file_error(ms, 0, "bad magic in `%s'", dbname);
 3361|      0|			return -1;
 3362|      0|		}
 3363|      0|		needsbyteswap = 1;
 3364|      0|	} else
 3365|      2|		needsbyteswap = 0;
 3366|      2|	if (needsbyteswap)
  ------------------
  |  Branch (3366:6): [True: 0, False: 2]
  ------------------
 3367|      0|		version = swap4(ptr[1]);
  ------------------
  |  |  136|      0|#define swap4(x)	bswap_32(x)
  ------------------
 3368|      2|	else
 3369|      2|		version = ptr[1];
 3370|      2|	if (version != VERSIONNO) {
  ------------------
  |  |  182|      2|#define VERSIONNO	19
  ------------------
  |  Branch (3370:6): [True: 0, False: 2]
  ------------------
 3371|      0|		file_error(ms, 0, "File %s supports only version %d magic "
 3372|      0|		    "files. `%s' is version %d", VERSION,
  ------------------
  |  |  356|      0|#define VERSION "5.45"
  ------------------
 3373|      0|		    VERSIONNO, dbname, version);
  ------------------
  |  |  182|      0|#define VERSIONNO	19
  ------------------
 3374|      0|		return -1;
 3375|      0|	}
 3376|      2|	entries = CAST(uint32_t, map->len / sizeof(struct magic));
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3377|      2|	if ((entries * sizeof(struct magic)) != map->len) {
  ------------------
  |  Branch (3377:6): [True: 0, False: 2]
  ------------------
 3378|      0|		file_error(ms, 0, "Size of `%s' %" SIZE_T_FORMAT "u is not "
 3379|      0|		    "a multiple of %" SIZE_T_FORMAT "u",
 3380|      0|		    dbname, map->len, sizeof(struct magic));
 3381|      0|		return -1;
 3382|      0|	}
 3383|      2|	map->magic[0] = CAST(struct magic *, map->p) + 1;
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  ------------------
 3384|      2|	nentries = 0;
 3385|      6|	for (i = 0; i < MAGIC_SETS; i++) {
  ------------------
  |  |  463|      6|#define MAGIC_SETS	2
  ------------------
  |  Branch (3385:14): [True: 4, False: 2]
  ------------------
 3386|      4|		if (needsbyteswap)
  ------------------
  |  Branch (3386:7): [True: 0, False: 4]
  ------------------
 3387|      0|			map->nmagic[i] = swap4(ptr[i + 2]);
  ------------------
  |  |  136|      0|#define swap4(x)	bswap_32(x)
  ------------------
 3388|      4|		else
 3389|      4|			map->nmagic[i] = ptr[i + 2];
 3390|      4|		if (i != MAGIC_SETS - 1)
  ------------------
  |  |  463|      4|#define MAGIC_SETS	2
  ------------------
  |  Branch (3390:7): [True: 2, False: 2]
  ------------------
 3391|      2|			map->magic[i + 1] = map->magic[i] + map->nmagic[i];
 3392|      4|		nentries += map->nmagic[i];
 3393|      4|	}
 3394|      2|	if (entries != nentries + 1) {
  ------------------
  |  Branch (3394:6): [True: 0, False: 2]
  ------------------
 3395|      0|		file_error(ms, 0, "Inconsistent entries in `%s' %u != %u",
 3396|      0|		    dbname, entries, nentries + 1);
 3397|      0|		return -1;
 3398|      0|	}
 3399|      2|	if (needsbyteswap)
  ------------------
  |  Branch (3399:6): [True: 0, False: 2]
  ------------------
 3400|      0|		for (i = 0; i < MAGIC_SETS; i++)
  ------------------
  |  |  463|      0|#define MAGIC_SETS	2
  ------------------
  |  Branch (3400:15): [True: 0, False: 0]
  ------------------
 3401|      0|			byteswap(map->magic[i], map->nmagic[i]);
 3402|      2|	return 0;
 3403|      2|}

file_ascmagic:
   72|  10.4k|{
   73|  10.4k|	file_unichar_t *ubuf = NULL;
   74|  10.4k|	size_t ulen = 0;
   75|  10.4k|	int rv = 1;
   76|  10.4k|	struct buffer bb;
   77|       |
   78|  10.4k|	const char *code = NULL;
   79|  10.4k|	const char *code_mime = NULL;
   80|  10.4k|	const char *type = NULL;
   81|       |
   82|  10.4k|	bb = *b;
   83|  10.4k|	bb.flen = trim_nuls(CAST(const unsigned char *, b->fbuf), b->flen);
  ------------------
  |  |  444|  10.4k|#define CAST(T, b)	((T)(b))
  ------------------
   84|       |	/*
   85|       |	 * Avoid trimming at an odd byte if the original buffer was evenly
   86|       |	 * sized; this avoids losing the last character on UTF-16 LE text
   87|       |	 */
   88|  10.4k|	if ((bb.flen & 1) && !(b->flen & 1))
  ------------------
  |  Branch (88:6): [True: 4.50k, False: 5.89k]
  |  Branch (88:23): [True: 935, False: 3.57k]
  ------------------
   89|    935|		bb.flen++;
   90|       |
   91|       |	/* If file doesn't look like any sort of text, give up. */
   92|  10.4k|	if (file_encoding(ms, &bb, &ubuf, &ulen, &code, &code_mime,
  ------------------
  |  Branch (92:6): [True: 8.16k, False: 2.23k]
  ------------------
   93|  10.4k|	    &type) == 0)
   94|  8.16k|		rv = 0;
   95|  2.23k|        else
   96|  2.23k|		rv = file_ascmagic_with_encoding(ms, &bb,
   97|  2.23k|		    ubuf, ulen, code, type, text);
   98|       |
   99|  10.4k|	free(ubuf);
  100|       |
  101|  10.4k|	return rv;
  102|  10.4k|}
file_ascmagic_with_encoding:
  108|  2.23k|{
  109|  2.23k|	struct buffer bb;
  110|  2.23k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  2.23k|#define CAST(T, b)	((T)(b))
  ------------------
  111|  2.23k|	size_t nbytes = b->flen;
  112|  2.23k|	unsigned char *utf8_buf = NULL, *utf8_end;
  113|  2.23k|	size_t mlen, i, len;
  114|  2.23k|	int rv = -1;
  115|  2.23k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  2.23k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.23k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.23k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  116|  2.23k|	int need_separator = 0;
  117|       |
  118|  2.23k|	const char *subtype = NULL;
  119|       |
  120|  2.23k|	int has_escapes = 0;
  121|  2.23k|	int has_backspace = 0;
  122|  2.23k|	int seen_cr = 0;
  123|       |
  124|  2.23k|	size_t n_crlf = 0;
  125|  2.23k|	size_t n_lf = 0;
  126|  2.23k|	size_t n_cr = 0;
  127|  2.23k|	size_t n_nel = 0;
  128|  2.23k|	int executable = 0;
  129|       |
  130|  2.23k|	size_t last_line_end = CAST(size_t, -1);
  ------------------
  |  |  444|  2.23k|#define CAST(T, b)	((T)(b))
  ------------------
  131|  2.23k|	size_t has_long_lines = 0;
  132|       |
  133|  2.23k|	nbytes = trim_nuls(buf, nbytes);
  134|       |
  135|       |	/* If we have fewer than 2 bytes, give up. */
  136|  2.23k|	if (nbytes <= 1) {
  ------------------
  |  Branch (136:6): [True: 16, False: 2.22k]
  ------------------
  137|     16|		rv = 0;
  138|     16|		goto done;
  139|     16|	}
  140|       |
  141|  2.22k|	if (ulen > 0 && (ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  2.14k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (141:6): [True: 2.14k, False: 71]
  |  Branch (141:18): [True: 2.14k, False: 0]
  ------------------
  142|       |		/* Convert ubuf to UTF-8 and try text soft magic */
  143|       |		/* malloc size is a conservative overestimate; could be
  144|       |		   improved, or at least realloced after conversion. */
  145|  2.14k|		mlen = ulen * 6;
  146|  2.14k|		if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  444|  2.14k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (146:7): [True: 0, False: 2.14k]
  ------------------
  147|      0|			file_oomem(ms, mlen);
  148|      0|			goto done;
  149|      0|		}
  150|  2.14k|		if ((utf8_end = encode_utf8(utf8_buf, mlen, ubuf, ulen))
  ------------------
  |  Branch (150:7): [True: 37, False: 2.11k]
  ------------------
  151|  2.14k|		    == NULL) {
  152|     37|			rv = 0;
  153|     37|			goto done;
  154|     37|		}
  155|  2.11k|		buffer_init(&bb, b->fd, &b->st, utf8_buf,
  156|  2.11k|		    CAST(size_t, utf8_end - utf8_buf));
  ------------------
  |  |  444|  2.11k|#define CAST(T, b)	((T)(b))
  ------------------
  157|       |
  158|  2.11k|		if ((rv = file_softmagic(ms, &bb, NULL, NULL,
  ------------------
  |  Branch (158:7): [True: 2.00k, False: 106]
  ------------------
  159|  2.11k|		    TEXTTEST, text)) == 0)
  ------------------
  |  |  230|  2.11k|#define TEXTTEST	0x40	/* for passing to file_softmagic */
  ------------------
  160|  2.00k|			rv = -1;
  161|    106|		else
  162|    106|			need_separator = 1;
  163|  2.11k|		buffer_fini(&bb);
  164|  2.11k|		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  2.11k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              		if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  2.11k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (164:7): [True: 0, False: 2.11k]
  ------------------
  165|      0|			rv = rv == -1 ? 0 : 1;
  ------------------
  |  Branch (165:9): [True: 0, False: 0]
  ------------------
  166|      0|			goto done;
  167|      0|		}
  168|  2.11k|	}
  169|       |
  170|  2.18k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   45|  2.18k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
  ------------------
  |  |   46|  2.18k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (170:6): [True: 0, False: 2.18k]
  ------------------
  171|      0|		rv = 0;
  172|      0|		goto done;
  173|      0|	}
  174|       |
  175|       |	/* Now try to discover other details about the file. */
  176|  12.1M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (176:14): [True: 12.1M, False: 2.18k]
  ------------------
  177|  12.1M|		if (ubuf[i] == '\n') {
  ------------------
  |  Branch (177:7): [True: 1.81M, False: 10.3M]
  ------------------
  178|  1.81M|			if (seen_cr)
  ------------------
  |  Branch (178:8): [True: 168k, False: 1.64M]
  ------------------
  179|   168k|				n_crlf++;
  180|  1.64M|			else
  181|  1.64M|				n_lf++;
  182|  1.81M|			last_line_end = i;
  183|  10.3M|		} else if (seen_cr)
  ------------------
  |  Branch (183:14): [True: 924k, False: 9.38M]
  ------------------
  184|   924k|			n_cr++;
  185|       |
  186|  12.1M|		seen_cr = (ubuf[i] == '\r');
  187|  12.1M|		if (seen_cr)
  ------------------
  |  Branch (187:7): [True: 1.09M, False: 11.0M]
  ------------------
  188|  1.09M|			last_line_end = i;
  189|       |
  190|  12.1M|		if (ubuf[i] == 0x85) { /* X3.64/ECMA-43 "next line" character */
  ------------------
  |  Branch (190:7): [True: 1.42M, False: 10.7M]
  ------------------
  191|  1.42M|			n_nel++;
  192|  1.42M|			last_line_end = i;
  193|  1.42M|		}
  194|       |
  195|       |		/* If this line is _longer_ than MAXLINELEN, remember it. */
  196|  12.1M|		if (i > last_line_end + MAXLINELEN) {
  ------------------
  |  |   49|  12.1M|#define MAXLINELEN 300	/* longest sane line length */
  ------------------
  |  Branch (196:7): [True: 7.27M, False: 4.84M]
  ------------------
  197|  7.27M|			size_t ll = i - last_line_end;
  198|  7.27M|			if (ll > has_long_lines)
  ------------------
  |  Branch (198:8): [True: 7.24M, False: 36.3k]
  ------------------
  199|  7.24M|				has_long_lines = ll;
  200|  7.27M|		}
  201|       |
  202|  12.1M|		if (ubuf[i] == '\033')
  ------------------
  |  Branch (202:7): [True: 102k, False: 12.0M]
  ------------------
  203|   102k|			has_escapes = 1;
  204|  12.1M|		if (ubuf[i] == '\b')
  ------------------
  |  Branch (204:7): [True: 76.1k, False: 12.0M]
  ------------------
  205|  76.1k|			has_backspace = 1;
  206|  12.1M|	}
  207|       |
  208|  2.18k|	if (strcmp(type, "binary") == 0) {
  ------------------
  |  Branch (208:6): [True: 0, False: 2.18k]
  ------------------
  209|      0|		rv = 0;
  210|      0|		goto done;
  211|      0|	}
  212|  2.18k|	len = file_printedlen(ms);
  213|  2.18k|	if (mime) {
  ------------------
  |  Branch (213:6): [True: 0, False: 2.18k]
  ------------------
  214|      0|		if ((mime & MAGIC_MIME_TYPE) != 0) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (214:7): [True: 0, False: 0]
  ------------------
  215|      0|			if (len) {
  ------------------
  |  Branch (215:8): [True: 0, False: 0]
  ------------------
  216|       |				/*
  217|       |				 * Softmagic printed something, we
  218|       |				 * are either done, or we need a separator
  219|       |				 */
  220|      0|				if ((ms->flags & MAGIC_CONTINUE) == 0) {
  ------------------
  |  |   38|      0|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (220:9): [True: 0, False: 0]
  ------------------
  221|      0|					rv = 1;
  222|      0|					goto done;
  223|      0|				}
  224|      0|				if (need_separator && file_separator(ms) == -1)
  ------------------
  |  Branch (224:9): [True: 0, False: 0]
  |  Branch (224:27): [True: 0, False: 0]
  ------------------
  225|      0|					goto done;
  226|      0|			}
  227|      0|			if (file_printf(ms, "text/plain") == -1)
  ------------------
  |  Branch (227:8): [True: 0, False: 0]
  ------------------
  228|      0|				goto done;
  229|      0|		}
  230|  2.18k|	} else {
  231|  2.18k|		if (len) {
  ------------------
  |  Branch (231:7): [True: 733, False: 1.45k]
  ------------------
  232|    733|			switch (file_replace(ms, " text$", ", ")) {
  233|    701|			case 0:
  ------------------
  |  Branch (233:4): [True: 701, False: 32]
  ------------------
  234|    701|				switch (file_replace(ms, " text executable$",
  235|    701|				    ", ")) {
  236|    636|				case 0:
  ------------------
  |  Branch (236:5): [True: 636, False: 65]
  ------------------
  237|    636|					if (file_printf(ms, ", ") == -1)
  ------------------
  |  Branch (237:10): [True: 0, False: 636]
  ------------------
  238|      0|						goto done;
  239|    636|					break;
  240|    636|				case -1:
  ------------------
  |  Branch (240:5): [True: 0, False: 701]
  ------------------
  241|      0|					goto done;
  242|     65|				default:
  ------------------
  |  Branch (242:5): [True: 65, False: 636]
  ------------------
  243|     65|					executable = 1;
  244|     65|					break;
  245|    701|				}
  246|    701|				break;
  247|    701|			case -1:
  ------------------
  |  Branch (247:4): [True: 0, False: 733]
  ------------------
  248|      0|				goto done;
  249|     32|			default:
  ------------------
  |  Branch (249:4): [True: 32, False: 701]
  ------------------
  250|     32|				break;
  251|    733|			}
  252|    733|		}
  253|       |
  254|  2.18k|		if (file_printf(ms, "%s", code) == -1)
  ------------------
  |  Branch (254:7): [True: 0, False: 2.18k]
  ------------------
  255|      0|			goto done;
  256|       |
  257|  2.18k|		if (subtype) {
  ------------------
  |  Branch (257:7): [True: 0, False: 2.18k]
  ------------------
  258|      0|			if (file_printf(ms, " %s", subtype) == -1)
  ------------------
  |  Branch (258:8): [True: 0, False: 0]
  ------------------
  259|      0|				goto done;
  260|      0|		}
  261|       |
  262|  2.18k|		if (file_printf(ms, " %s", type) == -1)
  ------------------
  |  Branch (262:7): [True: 0, False: 2.18k]
  ------------------
  263|      0|			goto done;
  264|       |
  265|  2.18k|		if (executable)
  ------------------
  |  Branch (265:7): [True: 65, False: 2.11k]
  ------------------
  266|     65|			if (file_printf(ms, " executable") == -1)
  ------------------
  |  Branch (266:8): [True: 0, False: 65]
  ------------------
  267|      0|				goto done;
  268|       |
  269|  2.18k|		if (has_long_lines)
  ------------------
  |  Branch (269:7): [True: 227, False: 1.95k]
  ------------------
  270|    227|			if (file_printf(ms, ", with very long lines (%"
  ------------------
  |  Branch (270:8): [True: 0, False: 227]
  ------------------
  271|    227|			    SIZE_T_FORMAT "u)", has_long_lines) == -1)
  272|      0|				goto done;
  273|       |
  274|       |		/*
  275|       |		 * Only report line terminators if we find one other than LF,
  276|       |		 * or if we find none at all.
  277|       |		 */
  278|  2.18k|		if ((n_crlf == 0 && n_cr == 0 && n_nel == 0 && n_lf == 0) ||
  ------------------
  |  Branch (278:8): [True: 2.13k, False: 44]
  |  Branch (278:23): [True: 2.04k, False: 98]
  |  Branch (278:36): [True: 1.98k, False: 56]
  |  Branch (278:50): [True: 1.86k, False: 119]
  ------------------
  279|  2.18k|		    (n_crlf != 0 || n_cr != 0 || n_nel != 0)) {
  ------------------
  |  Branch (279:8): [True: 44, False: 273]
  |  Branch (279:23): [True: 98, False: 175]
  |  Branch (279:36): [True: 56, False: 119]
  ------------------
  280|  2.06k|			if (file_printf(ms, ", with") == -1)
  ------------------
  |  Branch (280:8): [True: 0, False: 2.06k]
  ------------------
  281|      0|				goto done;
  282|       |
  283|  2.06k|			if (n_crlf == 0 && n_cr == 0 &&
  ------------------
  |  Branch (283:8): [True: 2.02k, False: 44]
  |  Branch (283:23): [True: 1.92k, False: 98]
  ------------------
  284|  2.06k|			    n_nel == 0 && n_lf == 0) {
  ------------------
  |  Branch (284:8): [True: 1.86k, False: 56]
  |  Branch (284:22): [True: 1.86k, False: 0]
  ------------------
  285|  1.86k|				if (file_printf(ms, " no") == -1)
  ------------------
  |  Branch (285:9): [True: 0, False: 1.86k]
  ------------------
  286|      0|					goto done;
  287|  1.86k|			} else {
  288|    198|				if (n_crlf) {
  ------------------
  |  Branch (288:9): [True: 44, False: 154]
  ------------------
  289|     44|					if (file_printf(ms, " CRLF") == -1)
  ------------------
  |  Branch (289:10): [True: 0, False: 44]
  ------------------
  290|      0|						goto done;
  291|     44|					if (n_cr || n_lf || n_nel)
  ------------------
  |  Branch (291:10): [True: 18, False: 26]
  |  Branch (291:18): [True: 13, False: 13]
  |  Branch (291:26): [True: 2, False: 11]
  ------------------
  292|     33|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (292:11): [True: 0, False: 33]
  ------------------
  293|      0|							goto done;
  294|     44|				}
  295|    198|				if (n_cr) {
  ------------------
  |  Branch (295:9): [True: 116, False: 82]
  ------------------
  296|    116|					if (file_printf(ms, " CR") == -1)
  ------------------
  |  Branch (296:10): [True: 0, False: 116]
  ------------------
  297|      0|						goto done;
  298|    116|					if (n_lf || n_nel)
  ------------------
  |  Branch (298:10): [True: 32, False: 84]
  |  Branch (298:18): [True: 20, False: 64]
  ------------------
  299|     52|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (299:11): [True: 0, False: 52]
  ------------------
  300|      0|							goto done;
  301|    116|				}
  302|    198|				if (n_lf) {
  ------------------
  |  Branch (302:9): [True: 64, False: 134]
  ------------------
  303|     64|					if (file_printf(ms, " LF") == -1)
  ------------------
  |  Branch (303:10): [True: 0, False: 64]
  ------------------
  304|      0|						goto done;
  305|     64|					if (n_nel)
  ------------------
  |  Branch (305:10): [True: 22, False: 42]
  ------------------
  306|     22|						if (file_printf(ms, ",") == -1)
  ------------------
  |  Branch (306:11): [True: 0, False: 22]
  ------------------
  307|      0|							goto done;
  308|     64|				}
  309|    198|				if (n_nel)
  ------------------
  |  Branch (309:9): [True: 81, False: 117]
  ------------------
  310|     81|					if (file_printf(ms, " NEL") == -1)
  ------------------
  |  Branch (310:10): [True: 0, False: 81]
  ------------------
  311|      0|						goto done;
  312|    198|			}
  313|       |
  314|  2.06k|			if (file_printf(ms, " line terminators") == -1)
  ------------------
  |  Branch (314:8): [True: 0, False: 2.06k]
  ------------------
  315|      0|				goto done;
  316|  2.06k|		}
  317|       |
  318|  2.18k|		if (has_escapes)
  ------------------
  |  Branch (318:7): [True: 41, False: 2.14k]
  ------------------
  319|     41|			if (file_printf(ms, ", with escape sequences") == -1)
  ------------------
  |  Branch (319:8): [True: 0, False: 41]
  ------------------
  320|      0|				goto done;
  321|  2.18k|		if (has_backspace)
  ------------------
  |  Branch (321:7): [True: 46, False: 2.13k]
  ------------------
  322|     46|			if (file_printf(ms, ", with overstriking") == -1)
  ------------------
  |  Branch (322:8): [True: 0, False: 46]
  ------------------
  323|      0|				goto done;
  324|  2.18k|	}
  325|  2.18k|	rv = 1;
  326|  2.23k|done:
  327|  2.23k|	free(utf8_buf);
  328|       |
  329|  2.23k|	return rv;
  330|  2.18k|}
ascmagic.c:trim_nuls:
   63|  12.6k|{
   64|   182M|	while (nbytes > 1 && buf[nbytes - 1] == '\0')
  ------------------
  |  Branch (64:9): [True: 182M, False: 199]
  |  Branch (64:23): [True: 182M, False: 12.4k]
  ------------------
   65|   182M|		nbytes--;
   66|       |
   67|  12.6k|	return nbytes;
   68|  12.6k|}
ascmagic.c:encode_utf8:
  338|  2.14k|{
  339|  2.14k|	size_t i;
  340|  2.14k|	unsigned char *end = buf + len;
  341|       |
  342|  12.1M|	for (i = 0; i < ulen; i++) {
  ------------------
  |  Branch (342:14): [True: 12.1M, False: 2.11k]
  ------------------
  343|  12.1M|		if (ubuf[i] <= 0x7f) {
  ------------------
  |  Branch (343:7): [True: 8.57M, False: 3.55M]
  ------------------
  344|  8.57M|			if (end - buf < 1)
  ------------------
  |  Branch (344:8): [True: 0, False: 8.57M]
  ------------------
  345|      0|				return NULL;
  346|  8.57M|			*buf++ = CAST(unsigned char, ubuf[i]);
  ------------------
  |  |  444|  8.57M|#define CAST(T, b)	((T)(b))
  ------------------
  347|  8.57M|			continue;
  348|  8.57M|		} 
  349|  3.55M|		if (ubuf[i] <= 0x7ff) {
  ------------------
  |  Branch (349:7): [True: 3.06M, False: 495k]
  ------------------
  350|  3.06M|			if (end - buf < 2)
  ------------------
  |  Branch (350:8): [True: 0, False: 3.06M]
  ------------------
  351|      0|				return NULL;
  352|  3.06M|			*buf++ = CAST(unsigned char, (ubuf[i] >> 6) + 0xc0);
  ------------------
  |  |  444|  3.06M|#define CAST(T, b)	((T)(b))
  ------------------
  353|  3.06M|			goto out1;
  354|  3.06M|		}
  355|   495k|		if (ubuf[i] <= 0xffff) {
  ------------------
  |  Branch (355:7): [True: 328k, False: 167k]
  ------------------
  356|   328k|			if (end - buf < 3)
  ------------------
  |  Branch (356:8): [True: 0, False: 328k]
  ------------------
  357|      0|				return NULL;
  358|   328k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 12) + 0xe0);
  ------------------
  |  |  444|   328k|#define CAST(T, b)	((T)(b))
  ------------------
  359|   328k|			goto out2;
  360|   328k|		}
  361|   167k|		if (ubuf[i] <= 0x1fffff) {
  ------------------
  |  Branch (361:7): [True: 29.2k, False: 137k]
  ------------------
  362|  29.2k|			if (end - buf < 4)
  ------------------
  |  Branch (362:8): [True: 0, False: 29.2k]
  ------------------
  363|      0|				return NULL;
  364|  29.2k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 18) + 0xf0);
  ------------------
  |  |  444|  29.2k|#define CAST(T, b)	((T)(b))
  ------------------
  365|  29.2k|			goto out3;
  366|  29.2k|		}
  367|   137k|		if (ubuf[i] <= 0x3ffffff) {
  ------------------
  |  Branch (367:7): [True: 60.1k, False: 77.6k]
  ------------------
  368|  60.1k|			if (end - buf < 5)
  ------------------
  |  Branch (368:8): [True: 0, False: 60.1k]
  ------------------
  369|      0|				return NULL;
  370|  60.1k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 24) + 0xf8);
  ------------------
  |  |  444|  60.1k|#define CAST(T, b)	((T)(b))
  ------------------
  371|  60.1k|			goto out4;
  372|  60.1k|		} 
  373|  77.6k|		if (ubuf[i] <= 0x7fffffff) {
  ------------------
  |  Branch (373:7): [True: 77.6k, False: 37]
  ------------------
  374|  77.6k|			if (end - buf < 6)
  ------------------
  |  Branch (374:8): [True: 0, False: 77.6k]
  ------------------
  375|      0|				return NULL;
  376|  77.6k|			*buf++ = CAST(unsigned char, (ubuf[i] >> 30) + 0xfc);
  ------------------
  |  |  444|  77.6k|#define CAST(T, b)	((T)(b))
  ------------------
  377|  77.6k|			goto out5;
  378|  77.6k|		} 
  379|       |		/* Invalid character */
  380|     37|		return NULL;
  381|  77.6k|	out5:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 24) & 0x3f) + 0x80);
  ------------------
  |  |  444|  77.6k|#define CAST(T, b)	((T)(b))
  ------------------
  382|   137k|	out4:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 18) & 0x3f) + 0x80);
  ------------------
  |  |  444|   137k|#define CAST(T, b)	((T)(b))
  ------------------
  383|   167k|	out3:	*buf++ = CAST(unsigned char, ((ubuf[i] >> 12) & 0x3f) + 0x80);
  ------------------
  |  |  444|   167k|#define CAST(T, b)	((T)(b))
  ------------------
  384|   495k|	out2:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  6) & 0x3f) + 0x80);
  ------------------
  |  |  444|   495k|#define CAST(T, b)	((T)(b))
  ------------------
  385|  3.55M|	out1:	*buf++ = CAST(unsigned char, ((ubuf[i] >>  0) & 0x3f) + 0x80);
  ------------------
  |  |  444|  3.55M|#define CAST(T, b)	((T)(b))
  ------------------
  386|  3.55M|	}
  387|       |
  388|  2.11k|	return buf;
  389|  2.14k|}

buffer_init:
   42|  89.0M|{
   43|  89.0M|	b->fd = fd;
   44|  89.0M|	if (st)
  ------------------
  |  Branch (44:6): [True: 2.11k, False: 88.9M]
  ------------------
   45|  2.11k|		memcpy(&b->st, st, sizeof(b->st));
   46|  88.9M|	else if (b->fd == -1 || fstat(b->fd, &b->st) == -1)
  ------------------
  |  Branch (46:11): [True: 88.9M, False: 0]
  |  Branch (46:26): [True: 0, False: 0]
  ------------------
   47|  88.9M|		memset(&b->st, 0, sizeof(b->st));
   48|  89.0M|	b->fbuf = data;
   49|  89.0M|	b->flen = len;
   50|  89.0M|	b->eoff = 0;
   51|  89.0M|	b->ebuf = NULL;
   52|  89.0M|	b->elen = 0;
   53|  89.0M|}
buffer_fini:
   57|  32.7k|{
   58|  32.7k|	free(b->ebuf);
   59|  32.7k|	b->ebuf = NULL;
   60|  32.7k|	b->elen = 0;
   61|  32.7k|}
buffer_fill:
   65|   221k|{
   66|   221k|	struct buffer *b = CCAST(struct buffer *, bb);
  ------------------
  |  |  446|   221k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
   67|       |
   68|   221k|	if (b->elen != 0)
  ------------------
  |  Branch (68:6): [True: 193k, False: 27.7k]
  ------------------
   69|   193k|		return b->elen == FILE_BADSIZE ? -1 : 0;
  ------------------
  |  |  175|   193k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|   193k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (69:10): [True: 193k, False: 0]
  ------------------
   70|       |
   71|  27.7k|	if (!S_ISREG(b->st.st_mode))
  ------------------
  |  Branch (71:6): [True: 27.7k, False: 0]
  ------------------
   72|  27.7k|		goto out;
   73|       |
   74|      0|	b->elen = CAST(size_t, b->st.st_size) < b->flen ?
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (74:12): [True: 0, False: 0]
  ------------------
   75|      0|	    CAST(size_t, b->st.st_size) : b->flen;
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
   76|      0|	if (b->elen == 0) {
  ------------------
  |  Branch (76:6): [True: 0, False: 0]
  ------------------
   77|      0|		free(b->ebuf);
   78|      0|		b->ebuf = NULL;
   79|      0|		return 0;
   80|      0|	}
   81|      0|	if ((b->ebuf = malloc(b->elen)) == NULL)
  ------------------
  |  Branch (81:6): [True: 0, False: 0]
  ------------------
   82|      0|		goto out;
   83|       |
   84|      0|	b->eoff = b->st.st_size - b->elen;
   85|      0|	if (pread(b->fd, b->ebuf, b->elen, b->eoff) == -1) {
  ------------------
  |  Branch (85:6): [True: 0, False: 0]
  ------------------
   86|      0|		free(b->ebuf);
   87|      0|		b->ebuf = NULL;
   88|      0|		goto out;
   89|      0|	}
   90|       |
   91|      0|	return 0;
   92|  27.7k|out:
   93|  27.7k|	b->elen = FILE_BADSIZE;
  ------------------
  |  |  175|  27.7k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|  27.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
   94|  27.7k|	return -1;
   95|      0|}

cdf_swap_header:
  230|  3.20k|{
  231|  3.20k|	size_t i;
  232|       |
  233|  3.20k|	h->h_magic = CDF_TOLE8(h->h_magic);
  ------------------
  |  |   82|  3.20k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|  3.20k|	h->h_uuid[0] = CDF_TOLE8(h->h_uuid[0]);
  ------------------
  |  |   82|  3.20k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  235|  3.20k|	h->h_uuid[1] = CDF_TOLE8(h->h_uuid[1]);
  ------------------
  |  |   82|  3.20k|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  236|  3.20k|	h->h_revision = CDF_TOLE2(h->h_revision);
  ------------------
  |  |   86|  3.20k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  237|  3.20k|	h->h_version = CDF_TOLE2(h->h_version);
  ------------------
  |  |   86|  3.20k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  238|  3.20k|	h->h_byte_order = CDF_TOLE2(h->h_byte_order);
  ------------------
  |  |   86|  3.20k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  239|  3.20k|	h->h_sec_size_p2 = CDF_TOLE2(h->h_sec_size_p2);
  ------------------
  |  |   86|  3.20k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  240|  3.20k|	h->h_short_sec_size_p2 = CDF_TOLE2(h->h_short_sec_size_p2);
  ------------------
  |  |   86|  3.20k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  241|  3.20k|	h->h_num_sectors_in_sat = CDF_TOLE4(h->h_num_sectors_in_sat);
  ------------------
  |  |   84|  3.20k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  242|  3.20k|	h->h_secid_first_directory = CDF_TOLE4(h->h_secid_first_directory);
  ------------------
  |  |   84|  3.20k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  243|  3.20k|	h->h_min_size_standard_stream =
  244|  3.20k|	    CDF_TOLE4(h->h_min_size_standard_stream);
  ------------------
  |  |   84|  3.20k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  245|  3.20k|	h->h_secid_first_sector_in_short_sat =
  246|  3.20k|	    CDF_TOLE4(CAST(uint32_t, h->h_secid_first_sector_in_short_sat));
  ------------------
  |  |   84|  3.20k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  247|  3.20k|	h->h_num_sectors_in_short_sat =
  248|  3.20k|	    CDF_TOLE4(h->h_num_sectors_in_short_sat);
  ------------------
  |  |   84|  3.20k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  249|  3.20k|	h->h_secid_first_sector_in_master_sat =
  250|  3.20k|	    CDF_TOLE4(CAST(uint32_t, h->h_secid_first_sector_in_master_sat));
  ------------------
  |  |   84|  3.20k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  251|  3.20k|	h->h_num_sectors_in_master_sat =
  252|  3.20k|	    CDF_TOLE4(h->h_num_sectors_in_master_sat);
  ------------------
  |  |   84|  3.20k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  6.41k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  253|   352k|	for (i = 0; i < __arraycount(h->h_master_sat); i++) {
  ------------------
  |  |  130|   352k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (253:14): [True: 349k, False: 3.20k]
  ------------------
  254|   349k|		h->h_master_sat[i] =
  255|   349k|		    CDF_TOLE4(CAST(uint32_t, h->h_master_sat[i]));
  ------------------
  |  |   84|   349k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|   699k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 349k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  256|   349k|	}
  257|  3.20k|}
cdf_unpack_header:
  261|  3.20k|{
  262|  3.20k|	size_t i;
  263|  3.20k|	size_t len = 0;
  264|       |
  265|  3.20k|	CDF_UNPACK(h->h_magic);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  266|  3.20k|	CDF_UNPACKA(h->h_uuid);
  ------------------
  |  |  208|  3.20k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  267|  3.20k|	CDF_UNPACK(h->h_revision);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  268|  3.20k|	CDF_UNPACK(h->h_version);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  269|  3.20k|	CDF_UNPACK(h->h_byte_order);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  270|  3.20k|	CDF_UNPACK(h->h_sec_size_p2);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  271|  3.20k|	CDF_UNPACK(h->h_short_sec_size_p2);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  272|  3.20k|	CDF_UNPACKA(h->h_unused0);
  ------------------
  |  |  208|  3.20k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  273|  3.20k|	CDF_UNPACK(h->h_num_sectors_in_sat);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  274|  3.20k|	CDF_UNPACK(h->h_secid_first_directory);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  275|  3.20k|	CDF_UNPACKA(h->h_unused1);
  ------------------
  |  |  208|  3.20k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  276|  3.20k|	CDF_UNPACK(h->h_min_size_standard_stream);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  277|  3.20k|	CDF_UNPACK(h->h_secid_first_sector_in_short_sat);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  278|  3.20k|	CDF_UNPACK(h->h_num_sectors_in_short_sat);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  279|  3.20k|	CDF_UNPACK(h->h_secid_first_sector_in_master_sat);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  280|  3.20k|	CDF_UNPACK(h->h_num_sectors_in_master_sat);
  ------------------
  |  |  206|  3.20k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  281|   352k|	for (i = 0; i < __arraycount(h->h_master_sat); i++)
  ------------------
  |  |  130|   352k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (281:14): [True: 349k, False: 3.20k]
  ------------------
  282|   349k|		CDF_UNPACK(h->h_master_sat[i]);
  ------------------
  |  |  206|   349k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  283|  3.20k|}
cdf_swap_class:
  304|    944|{
  305|    944|	d->cl_dword = CDF_TOLE4(d->cl_dword);
  ------------------
  |  |   84|    944|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  1.88k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 944]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  306|    944|	d->cl_word[0] = CDF_TOLE2(d->cl_word[0]);
  ------------------
  |  |   86|    944|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|  1.88k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 944]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  307|    944|	d->cl_word[1] = CDF_TOLE2(d->cl_word[1]);
  ------------------
  |  |   86|    944|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|  1.88k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 944]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  308|    944|}
cdf_unpack_dir:
  312|  43.1k|{
  313|  43.1k|	size_t len = 0;
  314|       |
  315|  43.1k|	CDF_UNPACKA(d->d_name);
  ------------------
  |  |  208|  43.1k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  316|  43.1k|	CDF_UNPACK(d->d_namelen);
  ------------------
  |  |  206|  43.1k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  317|  43.1k|	CDF_UNPACK(d->d_type);
  ------------------
  |  |  206|  43.1k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  318|  43.1k|	CDF_UNPACK(d->d_color);
  ------------------
  |  |  206|  43.1k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  319|  43.1k|	CDF_UNPACK(d->d_left_child);
  ------------------
  |  |  206|  43.1k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  320|  43.1k|	CDF_UNPACK(d->d_right_child);
  ------------------
  |  |  206|  43.1k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  321|  43.1k|	CDF_UNPACK(d->d_storage);
  ------------------
  |  |  206|  43.1k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  322|  43.1k|	CDF_UNPACKA(d->d_storage_uuid);
  ------------------
  |  |  208|  43.1k|    (void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  323|  43.1k|	CDF_UNPACK(d->d_flags);
  ------------------
  |  |  206|  43.1k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  324|  43.1k|	CDF_UNPACK(d->d_created);
  ------------------
  |  |  206|  43.1k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  325|  43.1k|	CDF_UNPACK(d->d_modified);
  ------------------
  |  |  206|  43.1k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  326|  43.1k|	CDF_UNPACK(d->d_stream_first_sector);
  ------------------
  |  |  206|  43.1k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  327|  43.1k|	CDF_UNPACK(d->d_size);
  ------------------
  |  |  206|  43.1k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  328|  43.1k|	CDF_UNPACK(d->d_unused0);
  ------------------
  |  |  206|  43.1k|    (void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
  ------------------
  329|  43.1k|}
cdf_zero_stream:
  333|  4.59k|{
  334|  4.59k|	scn->sst_len = 0;
  335|  4.59k|	scn->sst_dirlen = 0;
  336|  4.59k|	scn->sst_ss = 0;
  337|  4.59k|	free(scn->sst_tab);
  338|  4.59k|	scn->sst_tab = NULL;
  339|  4.59k|	return -1;
  340|  4.59k|}
cdf_read_header:
  396|  10.4k|{
  397|  10.4k|	char buf[512];
  398|       |
  399|  10.4k|	(void)memcpy(cdf_bo.s, "\01\02\03\04", 4);
  400|  10.4k|	if (cdf_read(info, CAST(off_t, 0), buf, sizeof(buf)) == -1)
  ------------------
  |  |  444|  10.4k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (400:6): [True: 7.19k, False: 3.20k]
  ------------------
  401|  7.19k|		return -1;
  402|  3.20k|	cdf_unpack_header(h, buf);
  403|  3.20k|	cdf_swap_header(h);
  404|  3.20k|	if (h->h_magic != CDF_MAGIC) {
  ------------------
  |  |   61|  3.20k|#define CDF_MAGIC	0xE11AB1A1E011CFD0LL
  ------------------
  |  Branch (404:6): [True: 1.31k, False: 1.89k]
  ------------------
  405|  1.31k|		DPRINTF(("Bad magic %#" INT64_T_FORMAT "x != %#"
  406|  1.31k|		    INT64_T_FORMAT "x\n",
  407|  1.31k|		    (unsigned long long)h->h_magic,
  408|  1.31k|		    (unsigned long long)CDF_MAGIC));
  409|  1.31k|		goto out;
  410|  1.31k|	}
  411|  1.89k|	if (h->h_sec_size_p2 > 20) {
  ------------------
  |  Branch (411:6): [True: 9, False: 1.88k]
  ------------------
  412|      9|		DPRINTF(("Bad sector size %hu\n", h->h_sec_size_p2));
  413|      9|		goto out;
  414|      9|	}
  415|  1.88k|	if (h->h_short_sec_size_p2 > 20) {
  ------------------
  |  Branch (415:6): [True: 1, False: 1.88k]
  ------------------
  416|      1|		DPRINTF(("Bad short sector size %hu\n",
  417|      1|		    h->h_short_sec_size_p2));
  418|      1|		goto out;
  419|      1|	}
  420|  1.88k|	return 0;
  421|  1.32k|out:
  422|  1.32k|	errno = EFTYPE;
  ------------------
  |  |   59|  1.32k|#define EFTYPE EINVAL
  ------------------
  423|  1.32k|	return -1;
  424|  1.88k|}
cdf_read_sector:
  430|  5.98M|{
  431|  5.98M|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   80|  5.98M|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  444|  5.98M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  432|  5.98M|	size_t pos;
  433|       |
  434|  5.98M|	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |   63|  5.98M|#define SIZE_T_MAX CAST(size_t, ~0ULL)
  |  |  ------------------
  |  |  |  |  444|  5.98M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |  444|  5.98M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (434:6): [True: 0, False: 5.98M]
  ------------------
  435|      0|		return -1;
  436|       |
  437|  5.98M|	pos = CDF_SEC_POS(h, id);
  ------------------
  |  |   81|  5.98M|#define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   80|  5.98M|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|  5.98M|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   80|  5.98M|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|  5.98M|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  438|  5.98M|	assert(ss == len);
  439|  5.98M|	return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len);
  ------------------
  |  |  444|  5.98M|#define CAST(T, b)	((T)(b))
  ------------------
              	return cdf_read(info, CAST(off_t, pos), RCAST(char *, buf) + offs, len);
  ------------------
  |  |  445|  5.98M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  440|  5.98M|}
cdf_read_short_sector:
  445|    746|{
  446|    746|	size_t ss = CDF_SHORT_SEC_SIZE(h);
  ------------------
  |  |   82|    746|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  444|    746|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  447|    746|	size_t pos;
  448|       |
  449|    746|	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |   63|    746|#define SIZE_T_MAX CAST(size_t, ~0ULL)
  |  |  ------------------
  |  |  |  |  444|    746|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	if (SIZE_T_MAX / ss < CAST(size_t, id))
  ------------------
  |  |  444|    746|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (449:6): [True: 0, False: 746]
  ------------------
  450|      0|		return -1;
  451|       |
  452|    746|	pos = CDF_SHORT_SEC_POS(h, id);
  ------------------
  |  |   83|    746|#define CDF_SHORT_SEC_POS(h, secid) ((secid) * CDF_SHORT_SEC_SIZE(h))
  |  |  ------------------
  |  |  |  |   82|    746|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  444|    746|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  453|    746|	assert(ss == len);
  454|    746|	if (pos + len > CDF_SEC_SIZE(h) * sst->sst_len) {
  ------------------
  |  |   80|    746|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  444|    746|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (454:6): [True: 23, False: 723]
  ------------------
  455|     23|		DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %"
  456|     23|		    SIZE_T_FORMAT "u\n",
  457|     23|		    pos + len, CDF_SEC_SIZE(h) * sst->sst_len));
  458|     23|		goto out;
  459|     23|	}
  460|    723|	(void)memcpy(RCAST(char *, buf) + offs,
  ------------------
  |  |  445|    723|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  461|    723|	    RCAST(const char *, sst->sst_tab) + pos, len);
  ------------------
  |  |  445|    723|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  462|    723|	return len;
  463|     23|out:
  464|     23|	errno = EFTYPE;
  ------------------
  |  |   59|     23|#define EFTYPE EINVAL
  ------------------
  465|     23|	return -1;
  466|    746|}
cdf_read_sat:
  473|  1.88k|{
  474|  1.88k|	size_t i, j, k;
  475|  1.88k|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   80|  1.88k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  444|  1.88k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  476|  1.88k|	cdf_secid_t *msa, mid, sec;
  477|  1.88k|	size_t nsatpersec = (ss / sizeof(mid)) - 1;
  478|       |
  479|   133k|	for (i = 0; i < __arraycount(h->h_master_sat); i++)
  ------------------
  |  |  130|   133k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (479:14): [True: 132k, False: 1.05k]
  ------------------
  480|   132k|		if (h->h_master_sat[i] == CDF_SECID_FREE)
  ------------------
  |  |   54|   132k|#define CDF_SECID_FREE					-1
  ------------------
  |  Branch (480:7): [True: 822, False: 131k]
  ------------------
  481|    822|			break;
  482|       |
  483|  1.88k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  484|  1.88k|	if ((nsatpersec > 0 &&
  ------------------
  |  Branch (484:7): [True: 1.71k, False: 166]
  ------------------
  485|  1.88k|	    h->h_num_sectors_in_master_sat > CDF_SEC_LIMIT / nsatpersec) ||
  ------------------
  |  |  483|  1.71k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  ------------------
  |  Branch (485:6): [True: 26, False: 1.68k]
  ------------------
  486|  1.88k|	    i > CDF_SEC_LIMIT) {
  ------------------
  |  |  483|  1.85k|#define CDF_SEC_LIMIT (UINT32_MAX / (64 * ss))
  ------------------
  |  Branch (486:6): [True: 2, False: 1.85k]
  ------------------
  487|     28|		DPRINTF(("Number of sectors in master SAT too big %u %"
  488|     28|		    SIZE_T_FORMAT "u\n", h->h_num_sectors_in_master_sat, i));
  489|     28|		errno = EFTYPE;
  ------------------
  |  |   59|     28|#define EFTYPE EINVAL
  ------------------
  490|     28|		return -1;
  491|     28|	}
  492|       |
  493|  1.85k|	sat->sat_len = h->h_num_sectors_in_master_sat * nsatpersec + i;
  494|  1.85k|	DPRINTF(("sat_len = %" SIZE_T_FORMAT "u ss = %" SIZE_T_FORMAT "u\n",
  495|  1.85k|	    sat->sat_len, ss));
  496|  1.85k|	if ((sat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(sat->sat_len, ss)))
  ------------------
  |  |  444|  1.85k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (496:6): [True: 0, False: 1.85k]
  ------------------
  497|  1.85k|	    == NULL)
  498|      0|		return -1;
  499|       |
  500|  46.8k|	for (i = 0; i < __arraycount(h->h_master_sat); i++) {
  ------------------
  |  |  130|  46.8k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (500:14): [True: 46.4k, False: 374]
  ------------------
  501|  46.4k|		if (h->h_master_sat[i] < 0)
  ------------------
  |  Branch (501:7): [True: 1.43k, False: 45.0k]
  ------------------
  502|  1.43k|			break;
  503|  45.0k|		if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
  ------------------
  |  Branch (503:7): [True: 43, False: 44.9k]
  ------------------
  504|  45.0k|		    h->h_master_sat[i]) != CAST(ssize_t, ss)) {
  ------------------
  |  |  444|  45.0k|#define CAST(T, b)	((T)(b))
  ------------------
  505|     43|			DPRINTF(("Reading sector %d", h->h_master_sat[i]));
  506|     43|			goto out1;
  507|     43|		}
  508|  45.0k|	}
  509|       |
  510|  1.80k|	if ((msa = CAST(cdf_secid_t *, CDF_CALLOC(1, ss))) == NULL)
  ------------------
  |  |  444|  1.80k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (510:6): [True: 0, False: 1.80k]
  ------------------
  511|      0|		goto out1;
  512|       |
  513|  1.80k|	mid = h->h_secid_first_sector_in_master_sat;
  514|   291k|	for (j = 0; j < h->h_num_sectors_in_master_sat; j++) {
  ------------------
  |  Branch (514:14): [True: 290k, False: 994]
  ------------------
  515|   290k|		if (mid < 0)
  ------------------
  |  Branch (515:7): [True: 531, False: 290k]
  ------------------
  516|    531|			goto out;
  517|   290k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|   290k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (517:7): [True: 12, False: 290k]
  ------------------
  518|     12|			DPRINTF(("Reading master sector loop limit"));
  519|     12|			goto out3;
  520|     12|		}
  521|   290k|		if (cdf_read_sector(info, msa, 0, ss, h, mid) !=
  ------------------
  |  Branch (521:7): [True: 60, False: 290k]
  ------------------
  522|   290k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  444|   290k|#define CAST(T, b)	((T)(b))
  ------------------
  523|     60|			DPRINTF(("Reading master sector %d", mid));
  524|     60|			goto out2;
  525|     60|		}
  526|  5.92M|		for (k = 0; k < nsatpersec; k++, i++) {
  ------------------
  |  Branch (526:15): [True: 5.63M, False: 289k]
  ------------------
  527|  5.63M|			sec = CDF_TOLE4(CAST(uint32_t, msa[k]));
  ------------------
  |  |   84|  5.63M|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  11.2M|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 5.63M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  528|  5.63M|			if (sec < 0)
  ------------------
  |  Branch (528:8): [True: 198, False: 5.63M]
  ------------------
  529|    198|				goto out;
  530|  5.63M|			if (i >= sat->sat_len) {
  ------------------
  |  Branch (530:8): [True: 0, False: 5.63M]
  ------------------
  531|      0|			    DPRINTF(("Out of bounds reading MSA %"
  532|      0|				SIZE_T_FORMAT "u >= %" SIZE_T_FORMAT "u",
  533|      0|				i, sat->sat_len));
  534|      0|			    goto out3;
  535|      0|			}
  536|  5.63M|			if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
  ------------------
  |  Branch (536:8): [True: 14, False: 5.63M]
  ------------------
  537|  5.63M|			    sec) != CAST(ssize_t, ss)) {
  ------------------
  |  |  444|  5.63M|#define CAST(T, b)	((T)(b))
  ------------------
  538|     14|				DPRINTF(("Reading sector %d",
  539|     14|				    CDF_TOLE4(msa[k])));
  540|     14|				goto out2;
  541|     14|			}
  542|  5.63M|		}
  543|   289k|		mid = CDF_TOLE4(CAST(uint32_t, msa[nsatpersec]));
  ------------------
  |  |   84|   289k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|   579k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 289k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  544|   289k|	}
  545|  1.72k|out:
  546|  1.72k|	sat->sat_len = i;
  547|  1.72k|	free(msa);
  548|  1.72k|	return 0;
  549|     12|out3:
  550|     12|	errno = EFTYPE;
  ------------------
  |  |   59|     12|#define EFTYPE EINVAL
  ------------------
  551|     86|out2:
  552|     86|	free(msa);
  553|    129|out1:
  554|    129|	free(sat->sat_tab);
  555|    129|	return -1;
  556|     86|}
cdf_count_chain:
  560|  4.86k|{
  561|  4.86k|	size_t i, j;
  562|  4.86k|	cdf_secid_t maxsector = CAST(cdf_secid_t, (sat->sat_len * size)
  ------------------
  |  |  444|  4.86k|#define CAST(T, b)	((T)(b))
  ------------------
  563|  4.86k|	    / sizeof(maxsector));
  564|       |
  565|  4.86k|	DPRINTF(("Chain:"));
  566|  4.86k|	if (sid == CDF_SECID_END_OF_CHAIN) {
  ------------------
  |  |   55|  4.86k|#define CDF_SECID_END_OF_CHAIN				-2
  ------------------
  |  Branch (566:6): [True: 20, False: 4.84k]
  ------------------
  567|       |		/* 0-length chain. */
  568|     20|		DPRINTF((" empty\n"));
  569|     20|		return 0;
  570|     20|	}
  571|       |
  572|   308k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (572:18): [True: 303k, False: 4.48k]
  ------------------
  573|   303k|		DPRINTF((" %d", sid));
  574|   303k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|   303k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (574:7): [True: 29, False: 303k]
  ------------------
  575|     29|			DPRINTF(("Counting chain loop limit"));
  576|     29|			goto out;
  577|     29|		}
  578|   303k|		if (sid >= maxsector) {
  ------------------
  |  Branch (578:7): [True: 331, False: 303k]
  ------------------
  579|    331|			DPRINTF(("Sector %d >= %d\n", sid, maxsector));
  580|    331|			goto out;
  581|    331|		}
  582|   303k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|   303k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|   606k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 303k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  583|   303k|	}
  584|  4.48k|	if (i == 0) {
  ------------------
  |  Branch (584:6): [True: 199, False: 4.28k]
  ------------------
  585|    199|		DPRINTF((" none, sid: %d\n", sid));
  586|    199|		goto out;
  587|       |
  588|    199|	}
  589|  4.28k|	DPRINTF(("\n"));
  590|  4.28k|	return i;
  591|    559|out:
  592|    559|	errno = EFTYPE;
  ------------------
  |  |   59|    559|#define EFTYPE EINVAL
  ------------------
  593|    559|	return CAST(size_t, -1);
  ------------------
  |  |  444|    559|#define CAST(T, b)	((T)(b))
  ------------------
  594|  4.48k|}
cdf_read_long_sector_chain:
  599|  1.34k|{
  600|  1.34k|	size_t ss = CDF_SEC_SIZE(h), i, j;
  ------------------
  |  |   80|  1.34k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  444|  1.34k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  601|  1.34k|	ssize_t nr;
  602|  1.34k|	scn->sst_tab = NULL;
  603|  1.34k|	scn->sst_len = cdf_count_chain(sat, sid, ss);
  604|  1.34k|	scn->sst_dirlen = MAX(h->h_min_size_standard_stream, len);
  605|  1.34k|	scn->sst_ss = ss;
  606|       |
  607|  1.34k|	if (sid == CDF_SECID_END_OF_CHAIN || len == 0)
  ------------------
  |  |   55|  2.69k|#define CDF_SECID_END_OF_CHAIN				-2
  ------------------
  |  Branch (607:6): [True: 1, False: 1.34k]
  |  Branch (607:39): [True: 59, False: 1.28k]
  ------------------
  608|     60|		return cdf_zero_stream(scn);
  609|       |
  610|  1.28k|	if (scn->sst_len == CAST(size_t, -1))
  ------------------
  |  |  444|  1.28k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (610:6): [True: 84, False: 1.20k]
  ------------------
  611|     84|		goto out;
  612|       |
  613|  1.20k|	scn->sst_tab = CDF_CALLOC(scn->sst_len, ss);
  ------------------
  |  |   96|  1.20k|#define CDF_CALLOC(n, u) cdf_calloc(__FILE__, __LINE__, (n), (u))
  ------------------
  614|  1.20k|	if (scn->sst_tab == NULL)
  ------------------
  |  Branch (614:6): [True: 0, False: 1.20k]
  ------------------
  615|      0|		return cdf_zero_stream(scn);
  616|       |
  617|  5.18k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (617:18): [True: 4.02k, False: 1.16k]
  ------------------
  618|  4.02k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  4.02k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (618:7): [True: 0, False: 4.02k]
  ------------------
  619|      0|			DPRINTF(("Read long sector chain loop limit"));
  620|      0|			goto out;
  621|      0|		}
  622|  4.02k|		if (i >= scn->sst_len) {
  ------------------
  |  Branch (622:7): [True: 0, False: 4.02k]
  ------------------
  623|      0|			DPRINTF(("Out of bounds reading long sector chain "
  624|      0|			    "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i,
  625|      0|			    scn->sst_len));
  626|      0|			goto out;
  627|      0|		}
  628|  4.02k|		if ((nr = cdf_read_sector(info, scn->sst_tab, i * ss, ss, h,
  ------------------
  |  Branch (628:7): [True: 41, False: 3.98k]
  ------------------
  629|  4.02k|		    sid)) != CAST(ssize_t, ss)) {
  ------------------
  |  |  444|  4.02k|#define CAST(T, b)	((T)(b))
  ------------------
  630|     41|			if (i == scn->sst_len - 1 && nr > 0) {
  ------------------
  |  Branch (630:8): [True: 29, False: 12]
  |  Branch (630:33): [True: 0, False: 29]
  ------------------
  631|       |				/* Last sector might be truncated */
  632|      0|				return 0;
  633|      0|			}
  634|     41|			DPRINTF(("Reading long sector chain %d", sid));
  635|     41|			goto out;
  636|     41|		}
  637|  3.98k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|  3.98k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  7.97k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  638|  3.98k|	}
  639|  1.16k|	return 0;
  640|    125|out:
  641|    125|	errno = EFTYPE;
  ------------------
  |  |   59|    125|#define EFTYPE EINVAL
  ------------------
  642|    125|	return cdf_zero_stream(scn);
  643|  1.20k|}
cdf_read_short_sector_chain:
  649|    299|{
  650|    299|	size_t ss = CDF_SHORT_SEC_SIZE(h), i, j;
  ------------------
  |  |   82|    299|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  444|    299|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  651|    299|	scn->sst_tab = NULL;
  652|    299|	scn->sst_len = cdf_count_chain(ssat, sid, CDF_SEC_SIZE(h));
  ------------------
  |  |   80|    299|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  444|    299|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  653|    299|	scn->sst_dirlen = len;
  654|    299|	scn->sst_ss = ss;
  655|       |
  656|    299|	if (scn->sst_len == CAST(size_t, -1))
  ------------------
  |  |  444|    299|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (656:6): [True: 102, False: 197]
  ------------------
  657|    102|		goto out;
  658|       |
  659|    197|	scn->sst_tab = CDF_CALLOC(scn->sst_len, ss);
  ------------------
  |  |   96|    197|#define CDF_CALLOC(n, u) cdf_calloc(__FILE__, __LINE__, (n), (u))
  ------------------
  660|    197|	if (scn->sst_tab == NULL)
  ------------------
  |  Branch (660:6): [True: 0, False: 197]
  ------------------
  661|      0|		return cdf_zero_stream(scn);
  662|       |
  663|    920|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (663:18): [True: 746, False: 174]
  ------------------
  664|    746|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|    746|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (664:7): [True: 0, False: 746]
  ------------------
  665|      0|			DPRINTF(("Read short sector chain loop limit"));
  666|      0|			goto out;
  667|      0|		}
  668|    746|		if (i >= scn->sst_len) {
  ------------------
  |  Branch (668:7): [True: 0, False: 746]
  ------------------
  669|      0|			DPRINTF(("Out of bounds reading short sector chain "
  670|      0|			    "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n",
  671|      0|			    i, scn->sst_len));
  672|      0|			goto out;
  673|      0|		}
  674|    746|		if (cdf_read_short_sector(sst, scn->sst_tab, i * ss, ss, h,
  ------------------
  |  Branch (674:7): [True: 23, False: 723]
  ------------------
  675|    746|		    sid) != CAST(ssize_t, ss)) {
  ------------------
  |  |  444|    746|#define CAST(T, b)	((T)(b))
  ------------------
  676|     23|			DPRINTF(("Reading short sector chain %d", sid));
  677|     23|			goto out;
  678|     23|		}
  679|    723|		sid = CDF_TOLE4(CAST(uint32_t, ssat->sat_tab[sid]));
  ------------------
  |  |   84|    723|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  1.44k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 723]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  680|    723|	}
  681|    174|	return 0;
  682|    125|out:
  683|    125|	errno = EFTYPE;
  ------------------
  |  |   59|    125|#define EFTYPE EINVAL
  ------------------
  684|    125|	return cdf_zero_stream(scn);
  685|    197|}
cdf_read_sector_chain:
  691|  1.20k|{
  692|       |
  693|  1.20k|	if (len < h->h_min_size_standard_stream && sst->sst_tab != NULL)
  ------------------
  |  Branch (693:6): [True: 561, False: 645]
  |  Branch (693:45): [True: 299, False: 262]
  ------------------
  694|    299|		return cdf_read_short_sector_chain(h, ssat, sst, sid, len,
  695|    299|		    scn);
  696|    907|	else
  697|    907|		return cdf_read_long_sector_chain(info, h, sat, sid, len, scn);
  698|  1.20k|}
cdf_read_dir:
  703|  1.49k|{
  704|  1.49k|	size_t i, j;
  705|  1.49k|	size_t ss = CDF_SEC_SIZE(h), ns, nd;
  ------------------
  |  |   80|  1.49k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  444|  1.49k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  706|  1.49k|	char *buf;
  707|  1.49k|	cdf_secid_t sid = h->h_secid_first_directory;
  708|       |
  709|  1.49k|	ns = cdf_count_chain(sat, sid, ss);
  710|  1.49k|	if (ns == CAST(size_t, -1))
  ------------------
  |  |  444|  1.49k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (710:6): [True: 123, False: 1.37k]
  ------------------
  711|    123|		return -1;
  712|       |
  713|  1.37k|	nd = ss / CDF_DIRECTORY_SIZE;
  ------------------
  |  |  117|  1.37k|#define CDF_DIRECTORY_SIZE	128
  ------------------
  714|       |
  715|  1.37k|	dir->dir_len = ns * nd;
  716|  1.37k|	dir->dir_tab = CAST(cdf_directory_t *,
  ------------------
  |  |  444|  1.37k|#define CAST(T, b)	((T)(b))
  ------------------
  717|  1.37k|	    CDF_CALLOC(dir->dir_len, sizeof(dir->dir_tab[0])));
  718|  1.37k|	if (dir->dir_tab == NULL)
  ------------------
  |  Branch (718:6): [True: 0, False: 1.37k]
  ------------------
  719|      0|		return -1;
  720|       |
  721|  1.37k|	if ((buf = CAST(char *, CDF_MALLOC(ss))) == NULL) {
  ------------------
  |  |  444|  1.37k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (721:6): [True: 0, False: 1.37k]
  ------------------
  722|      0|		free(dir->dir_tab);
  723|      0|		return -1;
  724|      0|	}
  725|       |
  726|  6.12k|	for (j = i = 0; i < ns; i++, j++) {
  ------------------
  |  Branch (726:18): [True: 4.76k, False: 1.35k]
  ------------------
  727|  4.76k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  4.76k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (727:7): [True: 0, False: 4.76k]
  ------------------
  728|      0|			DPRINTF(("Read dir loop limit"));
  729|      0|			goto out;
  730|      0|		}
  731|  4.76k|		if (cdf_read_sector(info, buf, 0, ss, h, sid) !=
  ------------------
  |  Branch (731:7): [True: 18, False: 4.74k]
  ------------------
  732|  4.76k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  444|  4.76k|#define CAST(T, b)	((T)(b))
  ------------------
  733|     18|			DPRINTF(("Reading directory sector %d", sid));
  734|     18|			goto out;
  735|     18|		}
  736|  47.8k|		for (j = 0; j < nd; j++) {
  ------------------
  |  Branch (736:15): [True: 43.1k, False: 4.74k]
  ------------------
  737|  43.1k|			cdf_unpack_dir(&dir->dir_tab[i * nd + j],
  738|  43.1k|			    &buf[j * CDF_DIRECTORY_SIZE]);
  ------------------
  |  |  117|  43.1k|#define CDF_DIRECTORY_SIZE	128
  ------------------
  739|  43.1k|		}
  740|  4.74k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|  4.74k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  9.49k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 4.74k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  741|  4.74k|	}
  742|  1.35k|	if (NEED_SWAP)
  ------------------
  |  |   79|  1.35k|#define NEED_SWAP	(cdf_bo.u == CAST(uint32_t, 0x01020304))
  |  |  ------------------
  |  |  |  |  444|  1.35k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (79:19): [True: 0, False: 1.35k]
  |  |  ------------------
  ------------------
  743|      0|		for (i = 0; i < dir->dir_len; i++)
  ------------------
  |  Branch (743:15): [True: 0, False: 0]
  ------------------
  744|      0|			cdf_swap_dir(&dir->dir_tab[i]);
  745|  1.35k|	free(buf);
  746|  1.35k|	return 0;
  747|     18|out:
  748|     18|	free(dir->dir_tab);
  749|     18|	free(buf);
  750|     18|	errno = EFTYPE;
  ------------------
  |  |   59|     18|#define EFTYPE EINVAL
  ------------------
  751|     18|	return -1;
  752|  1.37k|}
cdf_read_ssat:
  758|  1.72k|{
  759|  1.72k|	size_t i, j;
  760|  1.72k|	size_t ss = CDF_SEC_SIZE(h);
  ------------------
  |  |   80|  1.72k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  444|  1.72k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  761|  1.72k|	cdf_secid_t sid = h->h_secid_first_sector_in_short_sat;
  762|       |
  763|  1.72k|	ssat->sat_tab = NULL;
  764|  1.72k|	ssat->sat_len = cdf_count_chain(sat, sid, ss);
  765|  1.72k|	if (ssat->sat_len == CAST(size_t, -1))
  ------------------
  |  |  444|  1.72k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (765:6): [True: 210, False: 1.51k]
  ------------------
  766|    210|		goto out;
  767|       |
  768|  1.51k|	ssat->sat_tab = CAST(cdf_secid_t *, CDF_CALLOC(ssat->sat_len, ss));
  ------------------
  |  |  444|  1.51k|#define CAST(T, b)	((T)(b))
  ------------------
  769|  1.51k|	if (ssat->sat_tab == NULL)
  ------------------
  |  Branch (769:6): [True: 0, False: 1.51k]
  ------------------
  770|      0|		goto out1;
  771|       |
  772|  5.21k|	for (j = i = 0; sid >= 0; i++, j++) {
  ------------------
  |  Branch (772:18): [True: 3.71k, False: 1.49k]
  ------------------
  773|  3.71k|		if (j >= CDF_LOOP_LIMIT) {
  ------------------
  |  |   50|  3.71k|#define CDF_LOOP_LIMIT					10000
  ------------------
  |  Branch (773:7): [True: 0, False: 3.71k]
  ------------------
  774|      0|			DPRINTF(("Read short sat sector loop limit"));
  775|      0|			goto out;
  776|      0|		}
  777|  3.71k|		if (i >= ssat->sat_len) {
  ------------------
  |  Branch (777:7): [True: 0, False: 3.71k]
  ------------------
  778|      0|			DPRINTF(("Out of bounds reading short sector chain "
  779|      0|			    "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i,
  780|      0|			    ssat->sat_len));
  781|      0|			goto out;
  782|      0|		}
  783|  3.71k|		if (cdf_read_sector(info, ssat->sat_tab, i * ss, ss, h, sid) !=
  ------------------
  |  Branch (783:7): [True: 15, False: 3.70k]
  ------------------
  784|  3.71k|		    CAST(ssize_t, ss)) {
  ------------------
  |  |  444|  3.71k|#define CAST(T, b)	((T)(b))
  ------------------
  785|     15|			DPRINTF(("Reading short sat sector %d", sid));
  786|     15|			goto out1;
  787|     15|		}
  788|  3.70k|		sid = CDF_TOLE4(CAST(uint32_t, sat->sat_tab[sid]));
  ------------------
  |  |   84|  3.70k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  7.40k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 3.70k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  789|  3.70k|	}
  790|  1.49k|	return 0;
  791|    210|out:
  792|    210|	errno = EFTYPE;
  ------------------
  |  |   59|    210|#define EFTYPE EINVAL
  ------------------
  793|    225|out1:
  794|    225|	free(ssat->sat_tab);
  795|    225|	return -1;
  796|    210|}
cdf_read_short_stream:
  802|  1.35k|{
  803|  1.35k|	size_t i;
  804|  1.35k|	const cdf_directory_t *d;
  805|       |
  806|  1.35k|	*root = NULL;
  807|  12.6k|	for (i = 0; i < dir->dir_len; i++)
  ------------------
  |  Branch (807:14): [True: 11.9k, False: 712]
  ------------------
  808|  11.9k|		if (dir->dir_tab[i].d_type == CDF_DIR_TYPE_ROOT_STORAGE)
  ------------------
  |  |  101|  11.9k|#define CDF_DIR_TYPE_ROOT_STORAGE	5
  ------------------
  |  Branch (808:7): [True: 645, False: 11.2k]
  ------------------
  809|    645|			break;
  810|       |
  811|       |	/* If the it is not there, just fake it; some docs don't have it */
  812|  1.35k|	if (i == dir->dir_len) {
  ------------------
  |  Branch (812:6): [True: 712, False: 645]
  ------------------
  813|    712|		DPRINTF(("Cannot find root storage dir\n"));
  814|    712|		goto out;
  815|    712|	}
  816|    645|	d = &dir->dir_tab[i];
  817|    645|	*root = d;
  818|       |
  819|       |	/* If the it is not there, just fake it; some docs don't have it */
  820|    645|	if (d->d_stream_first_sector < 0) {
  ------------------
  |  Branch (820:6): [True: 205, False: 440]
  ------------------
  821|    205|		DPRINTF(("No first secror in dir\n"));
  822|    205|		goto out;
  823|    205|	}
  824|       |
  825|    440|	return cdf_read_long_sector_chain(info, h, sat,
  826|    440|	    d->d_stream_first_sector, d->d_size, scn);
  827|    917|out:
  828|    917|	scn->sst_tab = NULL;
  829|    917|	(void)cdf_zero_stream(scn);
  830|    917|	return 0;
  831|    645|}
cdf_read_doc_summary_info:
  846|  1.09k|{
  847|  1.09k|	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
  848|  1.09k|	    "\05DocumentSummaryInformation", scn);
  849|  1.09k|}
cdf_read_summary_info:
  855|  1.24k|{
  856|  1.24k|	return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
  857|  1.24k|	    "\05SummaryInformation", scn);
  858|  1.24k|}
cdf_read_user_stream:
  864|  3.59k|{
  865|  3.59k|	const cdf_directory_t *d;
  866|  3.59k|	int i = cdf_find_stream(dir, name, CDF_DIR_TYPE_USER_STREAM);
  ------------------
  |  |   98|  3.59k|#define CDF_DIR_TYPE_USER_STREAM	2
  ------------------
  867|       |
  868|  3.59k|	if (i <= 0) {
  ------------------
  |  Branch (868:6): [True: 2.38k, False: 1.20k]
  ------------------
  869|  2.38k|		memset(scn, 0, sizeof(*scn));
  870|  2.38k|		return -1;
  871|  2.38k|	}
  872|       |
  873|  1.20k|	d = &dir->dir_tab[i - 1];
  874|  1.20k|	return cdf_read_sector_chain(info, h, sat, ssat, sst,
  875|  1.20k|	    d->d_stream_first_sector, d->d_size, scn);
  876|  3.59k|}
cdf_find_stream:
  880|  13.4k|{
  881|  13.4k|	size_t i, name_len = strlen(name) + 1;
  882|       |
  883|   359k|	for (i = dir->dir_len; i > 0; i--)
  ------------------
  |  Branch (883:25): [True: 347k, False: 12.2k]
  ------------------
  884|   347k|		if (dir->dir_tab[i - 1].d_type == type &&
  ------------------
  |  Branch (884:7): [True: 17.5k, False: 329k]
  ------------------
  885|   347k|		    cdf_namecmp(name, dir->dir_tab[i - 1].d_name, name_len)
  ------------------
  |  Branch (885:7): [True: 1.21k, False: 16.3k]
  ------------------
  886|  17.5k|		    == 0)
  887|  1.21k|			break;
  888|  13.4k|	if (i > 0)
  ------------------
  |  Branch (888:6): [True: 1.21k, False: 12.2k]
  ------------------
  889|  1.21k|		return CAST(int, i);
  ------------------
  |  |  444|  1.21k|#define CAST(T, b)	((T)(b))
  ------------------
  890|       |
  891|  12.2k|	DPRINTF(("Cannot find type %d `%s'\n", type, name));
  892|  12.2k|	errno = ESRCH;
  893|  12.2k|	return 0;
  894|  13.4k|}
cdf_read_property_info:
  993|    944|{
  994|    944|	const cdf_section_header_t *shp;
  995|    944|	cdf_section_header_t sh;
  996|    944|	const uint8_t *p, *q, *e;
  997|    944|	size_t i, o4, nelements, j, slen, left;
  998|    944|	cdf_property_info_t *inp;
  999|       |
 1000|    944|	if (offs > UINT32_MAX / 4) {
  ------------------
  |  Branch (1000:6): [True: 12, False: 932]
  ------------------
 1001|     12|		errno = EFTYPE;
  ------------------
  |  |   59|     12|#define EFTYPE EINVAL
  ------------------
 1002|     12|		goto out;
 1003|     12|	}
 1004|    932|	shp = CAST(const cdf_section_header_t *,
  ------------------
  |  |  444|    932|#define CAST(T, b)	((T)(b))
  ------------------
 1005|    932|	    cdf_offset(sst->sst_tab, offs));
 1006|    932|	if (cdf_check_stream_offset(sst, h, shp, sizeof(*shp), __LINE__) == -1)
  ------------------
  |  Branch (1006:6): [True: 76, False: 856]
  ------------------
 1007|     76|		goto out;
 1008|    856|	sh.sh_len = CDF_TOLE4(shp->sh_len);
  ------------------
  |  |   84|    856|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  1.71k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 856]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1009|    856|	if (sh.sh_len > CDF_SHLEN_LIMIT) {
  ------------------
  |  |  896|    856|#define CDF_SHLEN_LIMIT (UINT32_MAX / 64)
  ------------------
  |  Branch (1009:6): [True: 15, False: 841]
  ------------------
 1010|     15|		errno = EFTYPE;
  ------------------
  |  |   59|     15|#define EFTYPE EINVAL
  ------------------
 1011|     15|		goto out;
 1012|     15|	}
 1013|       |
 1014|    841|	if (cdf_check_stream_offset(sst, h, shp, sh.sh_len, __LINE__) == -1)
  ------------------
  |  Branch (1014:6): [True: 36, False: 805]
  ------------------
 1015|     36|		goto out;
 1016|       |
 1017|    805|	sh.sh_properties = CDF_TOLE4(shp->sh_properties);
  ------------------
  |  |   84|    805|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  1.61k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 805]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1018|    805|	DPRINTF(("section len: %u properties %u\n", sh.sh_len,
 1019|    805|	    sh.sh_properties));
 1020|    805|	if (sh.sh_properties > CDF_PROP_LIMIT)
  ------------------
  |  |  897|    805|#define CDF_PROP_LIMIT (UINT32_MAX / (64 * sizeof(cdf_property_info_t)))
  ------------------
  |  Branch (1020:6): [True: 22, False: 783]
  ------------------
 1021|     22|		goto out;
 1022|    783|	inp = cdf_grow_info(info, maxcount, sh.sh_properties);
 1023|    783|	if (inp == NULL)
  ------------------
  |  Branch (1023:6): [True: 0, False: 783]
  ------------------
 1024|      0|		goto out;
 1025|    783|	inp += *count;
 1026|    783|	*count += sh.sh_properties;
 1027|    783|	p = CAST(const uint8_t *, cdf_offset(sst->sst_tab, offs + sizeof(sh)));
  ------------------
  |  |  444|    783|#define CAST(T, b)	((T)(b))
  ------------------
 1028|    783|	e = CAST(const uint8_t *, cdf_offset(shp, sh.sh_len));
  ------------------
  |  |  444|    783|#define CAST(T, b)	((T)(b))
  ------------------
 1029|    783|	if (p >= e || cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
  ------------------
  |  Branch (1029:6): [True: 9, False: 774]
  |  Branch (1029:16): [True: 0, False: 774]
  ------------------
 1030|      9|		goto out;
 1031|       |
 1032|  4.80k|	for (i = 0; i < sh.sh_properties; i++) {
  ------------------
  |  Branch (1032:14): [True: 4.38k, False: 419]
  ------------------
 1033|  4.38k|		if ((q = cdf_get_property_info_pos(sst, h, p, e, i)) == NULL)
  ------------------
  |  Branch (1033:7): [True: 230, False: 4.15k]
  ------------------
 1034|    230|			goto out;
 1035|  4.15k|		inp[i].pi_id = CDF_GETUINT32(p, i << 1);
  ------------------
  |  |   92|  4.15k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1036|  4.15k|		left = CAST(size_t, e - q);
  ------------------
  |  |  444|  4.15k|#define CAST(T, b)	((T)(b))
  ------------------
 1037|  4.15k|		if (left < sizeof(uint32_t)) {
  ------------------
  |  Branch (1037:7): [True: 3, False: 4.15k]
  ------------------
 1038|      3|			DPRINTF(("short info (no type)_\n"));
 1039|      3|			goto out;
 1040|      3|		}
 1041|  4.15k|		inp[i].pi_type = CDF_GETUINT32(q, 0);
  ------------------
  |  |   92|  4.15k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1042|  4.15k|		DPRINTF(("%" SIZE_T_FORMAT "u) id=%#x type=%#x offs=%#tx,%#x\n",
 1043|  4.15k|		    i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
 1044|  4.15k|		if (inp[i].pi_type & CDF_VECTOR) {
  ------------------
  |  |  237|  4.15k|#define CDF_VECTOR		0x00001000
  ------------------
  |  Branch (1044:7): [True: 525, False: 3.62k]
  ------------------
 1045|    525|			if (left < sizeof(uint32_t) * 2) {
  ------------------
  |  Branch (1045:8): [True: 4, False: 521]
  ------------------
 1046|      4|				DPRINTF(("missing CDF_VECTOR length\n"));
 1047|      4|				goto out;
 1048|      4|			}
 1049|    521|			nelements = CDF_GETUINT32(q, 1);
  ------------------
  |  |   92|    521|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1050|    521|			if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {
  ------------------
  |  |   51|  1.04k|#define CDF_ELEMENT_LIMIT				100000
  ------------------
  |  Branch (1050:8): [True: 49, False: 472]
  |  Branch (1050:41): [True: 3, False: 469]
  ------------------
 1051|     52|				DPRINTF(("CDF_VECTOR with nelements == %"
 1052|     52|				    SIZE_T_FORMAT "u\n", nelements));
 1053|     52|				goto out;
 1054|     52|			}
 1055|    469|			slen = 2;
 1056|  3.62k|		} else {
 1057|  3.62k|			nelements = 1;
 1058|  3.62k|			slen = 1;
 1059|  3.62k|		}
 1060|  4.09k|		o4 = slen * sizeof(uint32_t);
 1061|  4.09k|		if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
  ------------------
  |  |  238|  4.09k|#define CDF_ARRAY		0x00002000
  ------------------
              		if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
  ------------------
  |  |  239|  4.09k|#define CDF_BYREF		0x00004000
  ------------------
              		if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
  ------------------
  |  |  240|  4.09k|#define CDF_RESERVED		0x00008000
  ------------------
  |  Branch (1061:7): [True: 707, False: 3.38k]
  ------------------
 1062|    707|			goto unknown;
 1063|  3.38k|		switch (inp[i].pi_type & CDF_TYPEMASK) {
  ------------------
  |  |  243|  3.38k|#define CDF_TYPEMASK		0x00000fff
  ------------------
 1064|    173|		case CDF_NULL:
  ------------------
  |  |  198|    173|#define CDF_NULL		0x00000001
  ------------------
  |  Branch (1064:3): [True: 173, False: 3.21k]
  ------------------
 1065|    495|		case CDF_EMPTY:
  ------------------
  |  |  197|    495|#define CDF_EMPTY		0x00000000
  ------------------
  |  Branch (1065:3): [True: 322, False: 3.06k]
  ------------------
 1066|    495|			break;
 1067|    216|		case CDF_SIGNED16:
  ------------------
  |  |  199|    216|#define CDF_SIGNED16		0x00000002
  ------------------
  |  Branch (1067:3): [True: 216, False: 3.17k]
  ------------------
 1068|    216|			if (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int16_t)))
  ------------------
  |  Branch (1068:8): [True: 82, False: 134]
  ------------------
 1069|     82|				goto unknown;
 1070|    134|			break;
 1071|    185|		case CDF_SIGNED32:
  ------------------
  |  |  200|    185|#define CDF_SIGNED32		0x00000003
  ------------------
  |  Branch (1071:3): [True: 185, False: 3.20k]
  ------------------
 1072|    262|		case CDF_BOOL:
  ------------------
  |  |  208|    262|#define CDF_BOOL		0x0000000b
  ------------------
  |  Branch (1072:3): [True: 77, False: 3.31k]
  ------------------
 1073|    430|		case CDF_UNSIGNED32:
  ------------------
  |  |  215|    430|#define CDF_UNSIGNED32		0x00000013
  ------------------
  |  Branch (1073:3): [True: 168, False: 3.21k]
  ------------------
 1074|    606|		case CDF_FLOAT:
  ------------------
  |  |  201|    606|#define CDF_FLOAT		0x00000004
  ------------------
  |  Branch (1074:3): [True: 176, False: 3.21k]
  ------------------
 1075|    606|			if (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int32_t)))
  ------------------
  |  Branch (1075:8): [True: 170, False: 436]
  ------------------
 1076|    170|				goto unknown;
 1077|    436|			break;
 1078|    436|		case CDF_SIGNED64:
  ------------------
  |  |  216|     78|#define CDF_SIGNED64		0x00000014
  ------------------
  |  Branch (1078:3): [True: 78, False: 3.30k]
  ------------------
 1079|    164|		case CDF_UNSIGNED64:
  ------------------
  |  |  217|    164|#define CDF_UNSIGNED64		0x00000015
  ------------------
  |  Branch (1079:3): [True: 86, False: 3.30k]
  ------------------
 1080|    341|		case CDF_DOUBLE:
  ------------------
  |  |  202|    341|#define CDF_DOUBLE		0x00000005
  ------------------
  |  Branch (1080:3): [True: 177, False: 3.21k]
  ------------------
 1081|    953|		case CDF_FILETIME:
  ------------------
  |  |  228|    953|#define CDF_FILETIME		0x00000040
  ------------------
  |  Branch (1081:3): [True: 612, False: 2.77k]
  ------------------
 1082|    953|			if (!cdf_copy_info(&inp[i], &q[o4], e, sizeof(int64_t)))
  ------------------
  |  Branch (1082:8): [True: 90, False: 863]
  ------------------
 1083|     90|				goto unknown;
 1084|    863|			break;
 1085|    863|		case CDF_LENGTH32_STRING:
  ------------------
  |  |  226|    295|#define CDF_LENGTH32_STRING	0x0000001e
  ------------------
  |  Branch (1085:3): [True: 295, False: 3.09k]
  ------------------
 1086|    612|		case CDF_LENGTH32_WSTRING:
  ------------------
  |  |  227|    612|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (1086:3): [True: 317, False: 3.07k]
  ------------------
 1087|    612|			if (nelements > 1) {
  ------------------
  |  Branch (1087:8): [True: 87, False: 525]
  ------------------
 1088|     87|				size_t nelem = inp - *info;
 1089|     87|				inp = cdf_grow_info(info, maxcount, nelements);
 1090|     87|				if (inp == NULL)
  ------------------
  |  Branch (1090:9): [True: 1, False: 86]
  ------------------
 1091|      1|					goto out;
 1092|     86|				inp += nelem;
 1093|     86|			}
 1094|   481k|			for (j = 0; j < nelements && i < sh.sh_properties;
  ------------------
  |  Branch (1094:16): [True: 480k, False: 539]
  |  Branch (1094:33): [True: 480k, False: 7]
  ------------------
 1095|   480k|			    j++, i++)
 1096|   480k|			{
 1097|   480k|				uint32_t l;
 1098|       |
 1099|   480k|				if (o4 + sizeof(uint32_t) > left)
  ------------------
  |  Branch (1099:9): [True: 8, False: 480k]
  ------------------
 1100|      8|					goto out;
 1101|       |
 1102|   480k|				l = CDF_GETUINT32(q, slen);
  ------------------
  |  |   92|   480k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
 1103|   480k|				o4 += sizeof(uint32_t);
 1104|   480k|				if (o4 + l > left)
  ------------------
  |  Branch (1104:9): [True: 57, False: 480k]
  ------------------
 1105|     57|					goto out;
 1106|       |
 1107|   480k|				inp[i].pi_str.s_len = l;
  ------------------
  |  |  191|   480k|#define pi_str	pi_val._pi_str
  ------------------
 1108|   480k|				inp[i].pi_str.s_buf = CAST(const char *,
  ------------------
  |  |  191|   480k|#define pi_str	pi_val._pi_str
  ------------------
              				inp[i].pi_str.s_buf = CAST(const char *,
  ------------------
  |  |  444|   480k|#define CAST(T, b)	((T)(b))
  ------------------
 1109|   480k|				    CAST(const void *, &q[o4]));
 1110|       |
 1111|   480k|				DPRINTF(("o=%" SIZE_T_FORMAT "u l=%d(%"
 1112|   480k|				    SIZE_T_FORMAT "u), t=%" SIZE_T_FORMAT
 1113|   480k|				    "u s=%.*s\n", o4, l,
 1114|   480k|				    CDF_ROUND(l, sizeof(l)),
 1115|   480k|				    left, (int)l, inp[i].pi_str.s_buf));
 1116|       |
 1117|   480k|				if (l & 1)
  ------------------
  |  Branch (1117:9): [True: 197, False: 480k]
  ------------------
 1118|    197|					l++;
 1119|       |
 1120|   480k|				slen += l >> 1;
 1121|   480k|				o4 = slen * sizeof(uint32_t);
 1122|   480k|			}
 1123|    546|			i--;
 1124|    546|			break;
 1125|    114|		case CDF_CLIPBOARD:
  ------------------
  |  |  235|    114|#define CDF_CLIPBOARD		0x00000047
  ------------------
  |  Branch (1125:3): [True: 114, False: 3.27k]
  ------------------
 1126|    114|			if (inp[i].pi_type & CDF_VECTOR)
  ------------------
  |  |  237|    114|#define CDF_VECTOR		0x00001000
  ------------------
  |  Branch (1126:8): [True: 12, False: 102]
  ------------------
 1127|     12|				goto unknown;
 1128|    102|			break;
 1129|    391|		default:
  ------------------
  |  Branch (1129:3): [True: 391, False: 2.99k]
  ------------------
 1130|  1.45k|		unknown:
 1131|  1.45k|			memset(&inp[i].pi_val, 0, sizeof(inp[i].pi_val));
 1132|  1.45k|			DPRINTF(("Don't know how to deal with %#x\n",
 1133|  1.45k|			    inp[i].pi_type));
 1134|  1.45k|			break;
 1135|  3.38k|		}
 1136|  3.38k|	}
 1137|    419|	return 0;
 1138|    525|out:
 1139|    525|	free(*info);
 1140|    525|	*info = NULL;
 1141|    525|	*count = 0;
 1142|    525|	*maxcount = 0;
 1143|    525|	errno = EFTYPE;
  ------------------
  |  |   59|    525|#define EFTYPE EINVAL
  ------------------
 1144|    525|	return -1;
 1145|    774|}
cdf_unpack_summary_info:
 1150|    972|{
 1151|    972|	size_t maxcount;
 1152|    972|	const cdf_summary_info_header_t *si =
 1153|    972|	    CAST(const cdf_summary_info_header_t *, sst->sst_tab);
  ------------------
  |  |  444|    972|#define CAST(T, b)	((T)(b))
  ------------------
 1154|    972|	const cdf_section_declaration_t *sd =
 1155|    972|	    CAST(const cdf_section_declaration_t *, RCAST(const void *,
  ------------------
  |  |  444|    972|#define CAST(T, b)	((T)(b))
  ------------------
 1156|    972|	    RCAST(const char *, sst->sst_tab)
 1157|    972|	    + CDF_SECTION_DECLARATION_OFFSET));
 1158|       |
 1159|    972|	if (cdf_check_stream_offset(sst, h, si, sizeof(*si), __LINE__) == -1 ||
  ------------------
  |  Branch (1159:6): [True: 18, False: 954]
  ------------------
 1160|    972|	    cdf_check_stream_offset(sst, h, sd, sizeof(*sd), __LINE__) == -1)
  ------------------
  |  Branch (1160:6): [True: 10, False: 944]
  ------------------
 1161|     28|		return -1;
 1162|    944|	ssi->si_byte_order = CDF_TOLE2(si->si_byte_order);
  ------------------
  |  |   86|    944|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|  1.88k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 944]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1163|    944|	ssi->si_os_version = CDF_TOLE2(si->si_os_version);
  ------------------
  |  |   86|    944|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|  1.88k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 944]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1164|    944|	ssi->si_os = CDF_TOLE2(si->si_os);
  ------------------
  |  |   86|    944|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|  1.88k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 944]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1165|    944|	ssi->si_class = si->si_class;
 1166|    944|	cdf_swap_class(&ssi->si_class);
 1167|    944|	ssi->si_count = CDF_TOLE4(si->si_count);
  ------------------
  |  |   84|    944|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  1.88k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 944]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1168|    944|	*count = 0;
 1169|    944|	maxcount = 0;
 1170|    944|	*info = NULL;
 1171|    944|	if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset), info,
  ------------------
  |  |   84|    944|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|  1.88k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 944]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1171:6): [True: 525, False: 419]
  ------------------
 1172|    944|	    count, &maxcount) == -1)
 1173|    525|		return -1;
 1174|    419|	return 0;
 1175|    944|}
cdf_print_property_name:
 1292|  1.39k|{
 1293|  1.39k|	size_t i;
 1294|       |
 1295|  23.6k|	for (i = 0; i < __arraycount(vn); i++)
  ------------------
  |  |  130|  23.6k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1295:14): [True: 22.7k, False: 914]
  ------------------
 1296|  22.7k|		if (vn[i].v == p)
  ------------------
  |  Branch (1296:7): [True: 482, False: 22.2k]
  ------------------
 1297|    482|			return snprintf(buf, bufsiz, "%s", vn[i].n);
 1298|    914|	return snprintf(buf, bufsiz, "%#x", p);
 1299|  1.39k|}
cdf_print_elapsed_time:
 1303|    243|{
 1304|    243|	int len = 0;
 1305|    243|	int days, hours, mins, secs;
 1306|       |
 1307|    243|	ts /= CDF_TIME_PREC;
  ------------------
  |  |   90|    243|#define CDF_TIME_PREC	10000000
  ------------------
 1308|    243|	secs = CAST(int, ts % 60);
  ------------------
  |  |  444|    243|#define CAST(T, b)	((T)(b))
  ------------------
 1309|    243|	ts /= 60;
 1310|    243|	mins = CAST(int, ts % 60);
  ------------------
  |  |  444|    243|#define CAST(T, b)	((T)(b))
  ------------------
 1311|    243|	ts /= 60;
 1312|    243|	hours = CAST(int, ts % 24);
  ------------------
  |  |  444|    243|#define CAST(T, b)	((T)(b))
  ------------------
 1313|    243|	ts /= 24;
 1314|    243|	days = CAST(int, ts);
  ------------------
  |  |  444|    243|#define CAST(T, b)	((T)(b))
  ------------------
 1315|       |
 1316|    243|	if (days) {
  ------------------
  |  Branch (1316:6): [True: 116, False: 127]
  ------------------
 1317|    116|		len += snprintf(buf + len, bufsiz - len, "%dd+", days);
 1318|    116|		if (CAST(size_t, len) >= bufsiz)
  ------------------
  |  |  444|    116|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1318:7): [True: 0, False: 116]
  ------------------
 1319|      0|			return len;
 1320|    116|	}
 1321|       |
 1322|    243|	if (days || hours) {
  ------------------
  |  Branch (1322:6): [True: 116, False: 127]
  |  Branch (1322:14): [True: 48, False: 79]
  ------------------
 1323|    164|		len += snprintf(buf + len, bufsiz - len, "%.2d:", hours);
 1324|    164|		if (CAST(size_t, len) >= bufsiz)
  ------------------
  |  |  444|    164|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1324:7): [True: 0, False: 164]
  ------------------
 1325|      0|			return len;
 1326|    164|	}
 1327|       |
 1328|    243|	len += snprintf(buf + len, bufsiz - len, "%.2d:", mins);
 1329|    243|	if (CAST(size_t, len) >= bufsiz)
  ------------------
  |  |  444|    243|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1329:6): [True: 0, False: 243]
  ------------------
 1330|      0|		return len;
 1331|       |
 1332|    243|	len += snprintf(buf + len, bufsiz - len, "%.2d", secs);
 1333|    243|	return len;
 1334|    243|}
cdf.c:cdf_read:
  371|  5.99M|{
  372|  5.99M|	size_t siz = CAST(size_t, off + len);
  ------------------
  |  |  444|  5.99M|#define CAST(T, b)	((T)(b))
  ------------------
  373|       |
  374|  5.99M|	if (CAST(off_t, off + len) != CAST(off_t, siz))
  ------------------
  |  |  444|  5.99M|#define CAST(T, b)	((T)(b))
  ------------------
              	if (CAST(off_t, off + len) != CAST(off_t, siz))
  ------------------
  |  |  444|  5.99M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (374:6): [True: 0, False: 5.99M]
  ------------------
  375|      0|		goto out;
  376|       |
  377|  5.99M|	if (info->i_buf != NULL && info->i_len >= siz) {
  ------------------
  |  Branch (377:6): [True: 5.99M, False: 0]
  |  Branch (377:29): [True: 5.98M, False: 7.38k]
  ------------------
  378|  5.98M|		(void)memcpy(buf, &info->i_buf[off], len);
  379|  5.98M|		return CAST(ssize_t, len);
  ------------------
  |  |  444|  5.98M|#define CAST(T, b)	((T)(b))
  ------------------
  380|  5.98M|	}
  381|       |
  382|  7.38k|	if (info->i_fd == -1)
  ------------------
  |  Branch (382:6): [True: 7.38k, False: 0]
  ------------------
  383|  7.38k|		goto out;
  384|       |
  385|      0|	if (pread(info->i_fd, buf, len, off) != CAST(ssize_t, len))
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (385:6): [True: 0, False: 0]
  ------------------
  386|      0|		return -1;
  387|       |
  388|      0|	return CAST(ssize_t, len);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  389|  7.38k|out:
  390|  7.38k|	errno = EINVAL;
  391|  7.38k|	return -1;
  392|      0|}
cdf.c:cdf_calloc:
  125|  7.94k|{
  126|  7.94k|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u %"
  127|  7.94k|	    SIZE_T_FORMAT "u\n", file, line, __func__, n, u));
  128|  7.94k|	if (n == 0)
  ------------------
  |  Branch (128:6): [True: 65, False: 7.88k]
  ------------------
  129|     65|	    n++;
  130|  7.94k|	return calloc(n, u);
  131|  7.94k|}
cdf.c:cdf_malloc:
  103|  1.37k|{
  104|  1.37k|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u\n",
  105|  1.37k|	    file, line, __func__, n));
  106|  1.37k|	if (n == 0)
  ------------------
  |  Branch (106:6): [True: 0, False: 1.37k]
  ------------------
  107|      0|	    n++;
  108|  1.37k|	return malloc(n);
  109|  1.37k|}
cdf.c:cdf_namecmp:
  835|  17.5k|{
  836|  44.0k|	for (; l--; d++, s++)
  ------------------
  |  Branch (836:9): [True: 42.8k, False: 1.21k]
  ------------------
  837|  42.8k|		if (*d != CDF_TOLE2(*s))
  ------------------
  |  |   86|  42.8k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|  85.7k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 42.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (837:7): [True: 16.3k, False: 26.4k]
  ------------------
  838|  16.3k|			return CAST(unsigned char, *d) - CDF_TOLE2(*s);
  ------------------
  |  |  444|  16.3k|#define CAST(T, b)	((T)(b))
  ------------------
              			return CAST(unsigned char, *d) - CDF_TOLE2(*s);
  ------------------
  |  |   86|  16.3k|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|  32.7k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 16.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  839|  1.21k|	return 0;
  840|  17.5k|}
cdf.c:cdf_offset:
  901|  6.65k|{
  902|  6.65k|	return CAST(const void *, CAST(const uint8_t *, p) + l);
  ------------------
  |  |  444|  6.65k|#define CAST(T, b)	((T)(b))
  ------------------
  903|  6.65k|}
cdf.c:cdf_check_stream_offset:
  354|  8.85k|{
  355|  8.85k|	const char *b = RCAST(const char *, sst->sst_tab);
  ------------------
  |  |  445|  8.85k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  356|  8.85k|	const char *e = RCAST(const char *, p) + tail;
  ------------------
  |  |  445|  8.85k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  357|  8.85k|	size_t ss = cdf_check_stream(sst, h);
  358|  8.85k|	/*LINTED*/(void)&line;
  359|  8.85k|	if (e >= b && CAST(size_t, e - b) <= ss * sst->sst_len)
  ------------------
  |  |  444|  8.85k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (359:6): [True: 8.85k, False: 0]
  |  Branch (359:16): [True: 8.69k, False: 158]
  ------------------
  360|  8.69k|		return 0;
  361|    158|	DPRINTF(("%d: offset begin %p < end %p || %" SIZE_T_FORMAT "u"
  362|    158|	    " > %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
  363|    158|	    SIZE_T_FORMAT "u]\n", line, b, e, (size_t)(e - b),
  364|    158|	    ss * sst->sst_len, ss, sst->sst_len));
  365|    158|	errno = EFTYPE;
  ------------------
  |  |   59|    158|#define EFTYPE EINVAL
  ------------------
  366|    158|	return -1;
  367|  8.85k|}
cdf.c:cdf_grow_info:
  938|    870|{
  939|    870|	cdf_property_info_t *inp;
  940|    870|	size_t newcount = *maxcount + incr;
  941|       |
  942|    870|	if (newcount > CDF_PROP_LIMIT) {
  ------------------
  |  |  897|    870|#define CDF_PROP_LIMIT (UINT32_MAX / (64 * sizeof(cdf_property_info_t)))
  ------------------
  |  Branch (942:6): [True: 1, False: 869]
  ------------------
  943|      1|		DPRINTF(("exceeded property limit %" SIZE_T_FORMAT "u > %"
  944|      1|		    SIZE_T_FORMAT "u\n", newcount, CDF_PROP_LIMIT));
  945|      1|		goto out;
  946|      1|	}
  947|    869|	inp = CAST(cdf_property_info_t *,
  ------------------
  |  |  444|    869|#define CAST(T, b)	((T)(b))
  ------------------
  948|    869|	    CDF_REALLOC(*info, newcount * sizeof(*inp)));
  949|    869|	if (inp == NULL)
  ------------------
  |  Branch (949:6): [True: 0, False: 869]
  ------------------
  950|      0|		goto out;
  951|       |
  952|    869|	*info = inp;
  953|    869|	*maxcount = newcount;
  954|    869|	return inp;
  955|      1|out:
  956|      1|	free(*info);
  957|      1|	*maxcount = 0;
  958|      1|	*info = NULL;
  959|      1|	return NULL;
  960|    869|}
cdf.c:cdf_realloc:
  115|    869|{
  116|    869|	DPRINTF(("%s,%" SIZE_T_FORMAT "u: %s %" SIZE_T_FORMAT "u\n",
  117|    869|	    file, line, __func__, n));
  118|    869|	return realloc(p, n);
  119|    869|}
cdf.c:cdf_get_property_info_pos:
  908|  4.38k|{
  909|  4.38k|	size_t tail = (i << 1) + 1;
  910|  4.38k|	size_t ofs;
  911|       |
  912|  4.38k|	if (p >= e) {
  ------------------
  |  Branch (912:6): [True: 0, False: 4.38k]
  ------------------
  913|      0|		DPRINTF(("Past end %p < %p\n", e, p));
  914|      0|		return NULL;
  915|      0|	}
  916|       |
  917|  4.38k|	if (cdf_check_stream_offset(sst, h, p, (tail + 1) * sizeof(uint32_t),
  ------------------
  |  Branch (917:6): [True: 18, False: 4.36k]
  ------------------
  918|  4.38k|	    __LINE__) == -1)
  919|     18|		return NULL;
  920|       |
  921|  4.36k|	ofs = CDF_GETUINT32(p, tail);
  ------------------
  |  |   92|  4.36k|#define CDF_GETUINT32(x, y)	cdf_getuint32(x, y)
  ------------------
  922|  4.36k|	if (ofs < 2 * sizeof(uint32_t)) {
  ------------------
  |  Branch (922:6): [True: 23, False: 4.34k]
  ------------------
  923|     23|		DPRINTF(("Offset too small %zu\n", ofs));
  924|     23|		return NULL;
  925|     23|	}
  926|       |
  927|  4.34k|	ofs -= 2 * sizeof(uint32_t);
  928|  4.34k|	if (ofs > CAST(size_t, e - p)) {
  ------------------
  |  |  444|  4.34k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (928:6): [True: 189, False: 4.15k]
  ------------------
  929|    189|		DPRINTF(("Offset too big %zu %td\n", ofs, e - p));
  930|    189|		return NULL;
  931|    189|	}
  932|       |
  933|  4.15k|	return CAST(const uint8_t *, cdf_offset(CAST(const void *, p), ofs));
  ------------------
  |  |  444|  4.15k|#define CAST(T, b)	((T)(b))
  ------------------
  934|  4.34k|}
cdf.c:cdf_getuint32:
  199|   494k|{
  200|   494k|	uint32_t rv;
  201|   494k|	(void)memcpy(&rv, p + offs * sizeof(uint32_t), sizeof(rv));
  202|   494k|	return CDF_TOLE4(rv);
  ------------------
  |  |   84|   494k|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|   988k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 494k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  203|   494k|}
cdf.c:cdf_copy_info:
  965|  1.77k|{
  966|  1.77k|	if (inp->pi_type & CDF_VECTOR)
  ------------------
  |  |  237|  1.77k|#define CDF_VECTOR		0x00001000
  ------------------
  |  Branch (966:6): [True: 71, False: 1.70k]
  ------------------
  967|     71|		return 0;
  968|       |
  969|  1.70k|	if (CAST(size_t, CAST(const char *, e) - CAST(const char *, p)) < len)
  ------------------
  |  |  444|  1.70k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (969:6): [True: 271, False: 1.43k]
  ------------------
  970|    271|		return 0;
  971|       |
  972|  1.43k|	(void)memcpy(&inp->pi_val, p, len);
  973|       |
  974|  1.43k|	switch (len) {
  975|    134|	case 2:
  ------------------
  |  Branch (975:2): [True: 134, False: 1.29k]
  ------------------
  976|    134|		inp->pi_u16 = CDF_TOLE2(inp->pi_u16);
  ------------------
  |  |  186|    134|#define pi_u16	pi_val._pi_u16
  ------------------
              		inp->pi_u16 = CDF_TOLE2(inp->pi_u16);
  ------------------
  |  |   86|    134|    (CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
  |  |  ------------------
  |  |  |  |  444|    268|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 134]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  977|    134|		break;
  978|    436|	case 4:
  ------------------
  |  Branch (978:2): [True: 436, False: 997]
  ------------------
  979|    436|		inp->pi_u32 = CDF_TOLE4(inp->pi_u32);
  ------------------
  |  |  184|    436|#define pi_u32	pi_val._pi_u32
  ------------------
              		inp->pi_u32 = CDF_TOLE4(inp->pi_u32);
  ------------------
  |  |   84|    436|    (CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))
  |  |  ------------------
  |  |  |  |  444|    872|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 436]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  980|    436|		break;
  981|    863|	case 8:
  ------------------
  |  Branch (981:2): [True: 863, False: 570]
  ------------------
  982|    863|		inp->pi_u64 = CDF_TOLE8(inp->pi_u64);
  ------------------
  |  |  182|    863|#define pi_u64	pi_val._pi_u64
  ------------------
              		inp->pi_u64 = CDF_TOLE8(inp->pi_u64);
  ------------------
  |  |   82|    863|    (CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))
  |  |  ------------------
  |  |  |  |  444|  1.72k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [True: 0, False: 863]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  983|    863|		break;
  984|      0|	default:
  ------------------
  |  Branch (984:2): [True: 0, False: 1.43k]
  ------------------
  985|      0|		abort();
  986|  1.43k|	}
  987|  1.43k|	return 1;
  988|  1.43k|}
cdf.c:cdf_check_stream:
  344|  8.85k|{
  345|  8.85k|	size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
  ------------------
  |  Branch (345:14): [True: 716, False: 8.14k]
  ------------------
  346|  8.85k|	    CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
  ------------------
  |  |   82|    716|#define CDF_SHORT_SEC_SIZE(h)	CAST(size_t, 1 << (h)->h_short_sec_size_p2)
  |  |  ------------------
  |  |  |  |  444|    716|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
              	    CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
  ------------------
  |  |   80|  8.14k|#define CDF_SEC_SIZE(h) CAST(size_t, 1 << (h)->h_sec_size_p2)
  |  |  ------------------
  |  |  |  |  444|  8.14k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  347|  8.85k|	assert(ss == sst->sst_ss);
  348|  8.85k|	return sst->sst_ss;
  349|  8.85k|}

cdf_timestamp_to_timespec:
  100|  1.12k|{
  101|  1.12k|	struct tm tm;
  102|  1.12k|#ifdef HAVE_STRUCT_TM_TM_ZONE
  103|  1.12k|	static char UTC[] = "UTC";
  104|  1.12k|#endif
  105|  1.12k|	int rdays;
  106|       |
  107|       |	/* Unit is 100's of nanoseconds */
  108|  1.12k|	ts->tv_nsec = (t % CDF_TIME_PREC) * 100;
  ------------------
  |  |   90|  1.12k|#define CDF_TIME_PREC	10000000
  ------------------
  109|       |
  110|  1.12k|	t /= CDF_TIME_PREC;
  ------------------
  |  |   90|  1.12k|#define CDF_TIME_PREC	10000000
  ------------------
  111|  1.12k|	tm.tm_sec = CAST(int, t % 60);
  ------------------
  |  |  444|  1.12k|#define CAST(T, b)	((T)(b))
  ------------------
  112|  1.12k|	t /= 60;
  113|       |
  114|  1.12k|	tm.tm_min = CAST(int, t % 60);
  ------------------
  |  |  444|  1.12k|#define CAST(T, b)	((T)(b))
  ------------------
  115|  1.12k|	t /= 60;
  116|       |
  117|  1.12k|	tm.tm_hour = CAST(int, t % 24);
  ------------------
  |  |  444|  1.12k|#define CAST(T, b)	((T)(b))
  ------------------
  118|  1.12k|	t /= 24;
  119|       |
  120|       |	/* XXX: Approx */
  121|  1.12k|	tm.tm_year = CAST(int, CDF_BASE_YEAR + (t / 365));
  ------------------
  |  |  444|  1.12k|#define CAST(T, b)	((T)(b))
  ------------------
  122|       |
  123|  1.12k|	rdays = cdf_getdays(tm.tm_year);
  124|  1.12k|	t -= rdays - 1;
  125|  1.12k|	tm.tm_mday = cdf_getday(tm.tm_year, CAST(int, t));
  ------------------
  |  |  444|  1.12k|#define CAST(T, b)	((T)(b))
  ------------------
  126|  1.12k|	tm.tm_mon = cdf_getmonth(tm.tm_year, CAST(int, t));
  ------------------
  |  |  444|  1.12k|#define CAST(T, b)	((T)(b))
  ------------------
  127|  1.12k|	tm.tm_wday = 0;
  128|  1.12k|	tm.tm_yday = 0;
  129|  1.12k|	tm.tm_isdst = 0;
  130|  1.12k|#ifdef HAVE_STRUCT_TM_TM_GMTOFF
  131|  1.12k|	tm.tm_gmtoff = 0;
  132|  1.12k|#endif
  133|  1.12k|#ifdef HAVE_STRUCT_TM_TM_ZONE
  134|  1.12k|	tm.tm_zone = UTC;
  135|  1.12k|#endif
  136|  1.12k|	tm.tm_year -= 1900;
  137|  1.12k|	ts->tv_sec = mktime(&tm);
  138|  1.12k|	if (ts->tv_sec == -1) {
  ------------------
  |  Branch (138:6): [True: 31, False: 1.09k]
  ------------------
  139|     31|		errno = EINVAL;
  140|     31|		return -1;
  141|     31|	}
  142|  1.09k|	return 0;
  143|  1.12k|}
cdf_ctime:
  170|    159|{
  171|    159|	char *ptr = *sec > MAX_CTIME ? NULL : ctime_r(sec, buf);
  ------------------
  |  |  173|    159|    CAST(time_t, sizeof(time_t) > 4 ? 0x3afff487cfULL : 0x7fffffffULL)
  |  |  ------------------
  |  |  |  |  444|    318|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (171:14): [True: 61, False: 98]
  ------------------
  172|    159|	if (ptr != NULL)
  ------------------
  |  Branch (172:6): [True: 98, False: 61]
  ------------------
  173|     98|		return buf;
  174|       |#ifdef WIN32
  175|       |	(void)snprintf(buf, 26, "*Bad* 0x%16.16I64x\n",
  176|       |	    CAST(long long, *sec));
  177|       |#else
  178|     61|	(void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
  179|     61|	    CAST(long long, *sec));
  ------------------
  |  |  444|     61|#define CAST(T, b)	((T)(b))
  ------------------
  180|     61|#endif
  181|     61|	return buf;
  182|    159|}
cdf_time.c:cdf_getdays:
   53|  1.12k|{
   54|  1.12k|	int days = 0;
   55|  1.12k|	int y;
   56|       |
   57|  2.94M|	for (y = CDF_BASE_YEAR; y < year; y++)
  ------------------
  |  |   89|  1.12k|#define CDF_BASE_YEAR	1601
  ------------------
  |  Branch (57:26): [True: 2.94M, False: 1.12k]
  ------------------
   58|  2.94M|		days += isleap(y) + 365;
  ------------------
  |  |   41|  2.94M|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 736k, False: 2.20M]
  |  |  ------------------
  |  |   42|  2.94M|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 707k, False: 29.0k]
  |  |  |  Branch (42:28): [True: 7.03k, False: 22.0k]
  |  |  ------------------
  ------------------
   59|       |
   60|  1.12k|	return days;
   61|  1.12k|}
cdf_time.c:cdf_getday:
   68|  1.12k|{
   69|  1.12k|	size_t m;
   70|       |
   71|  4.16k|	for (m = 0; m < __arraycount(mdays); m++) {
  ------------------
  |  |  130|  4.16k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (71:14): [True: 4.14k, False: 18]
  ------------------
   72|  4.14k|		int sub = mdays[m] + (m == 1 && isleap(year));
  ------------------
  |  |   41|    552|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 254, False: 298]
  |  |  ------------------
  |  |   42|    552|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 125, False: 129]
  |  |  |  Branch (42:28): [True: 63, False: 66]
  |  |  ------------------
  ------------------
  |  Branch (72:25): [True: 552, False: 3.59k]
  ------------------
   73|  4.14k|		if (days < sub)
  ------------------
  |  Branch (73:7): [True: 1.10k, False: 3.03k]
  ------------------
   74|  1.10k|			return days;
   75|  3.03k|		days -= sub;
   76|  3.03k|	}
   77|     18|	return days;
   78|  1.12k|}
cdf_time.c:cdf_getmonth:
   85|  1.12k|{
   86|  1.12k|	size_t m;
   87|       |
   88|  4.09k|	for (m = 0; m < __arraycount(mdays); m++) {
  ------------------
  |  |  130|  4.09k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (88:14): [True: 4.09k, False: 0]
  ------------------
   89|  4.09k|		days -= mdays[m];
   90|  4.09k|		if (m == 1 && isleap(year))
  ------------------
  |  |   41|    505|#define isleap(y) ((((y) % 4) == 0) && \
  |  |  ------------------
  |  |  |  Branch (41:20): [True: 254, False: 251]
  |  |  ------------------
  |  |   42|    505|    ((((y) % 100) != 0) || (((y) % 400) == 0)))
  |  |  ------------------
  |  |  |  Branch (42:6): [True: 125, False: 129]
  |  |  |  Branch (42:28): [True: 63, False: 66]
  |  |  ------------------
  ------------------
  |  Branch (90:7): [True: 505, False: 3.58k]
  ------------------
   91|    188|			days--;
   92|  4.09k|		if (days <= 0)
  ------------------
  |  Branch (92:7): [True: 1.12k, False: 2.96k]
  ------------------
   93|  1.12k|			return CAST(int, m);
  ------------------
  |  |  444|  1.12k|#define CAST(T, b)	((T)(b))
  ------------------
   94|  4.09k|	}
   95|      0|	return CAST(int, m);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
   96|  1.12k|}

file_zmagic:
  270|  13.0k|{
  271|  13.0k|	unsigned char *newbuf = NULL;
  272|  13.0k|	size_t i, nsz;
  273|  13.0k|	char *rbuf;
  274|  13.0k|	file_pushbuf_t *pb;
  275|  13.0k|	int urv, prv, rv = 0;
  276|  13.0k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  13.0k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  13.0k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  13.0k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  277|  13.0k|	int fd = b->fd;
  278|  13.0k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  13.0k|#define CAST(T, b)	((T)(b))
  ------------------
  279|  13.0k|	size_t nbytes = b->flen;
  280|  13.0k|	int sa_saved = 0;
  281|  13.0k|	struct sigaction sig_act;
  282|       |
  283|  13.0k|	if ((ms->flags & MAGIC_COMPRESS) == 0)
  ------------------
  |  |   35|  13.0k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  |  Branch (283:6): [True: 5.57k, False: 7.45k]
  ------------------
  284|  5.57k|		return 0;
  285|       |
  286|   119k|	for (i = 0; i < ncompr; i++) {
  ------------------
  |  Branch (286:14): [True: 111k, False: 7.45k]
  ------------------
  287|   111k|		int zm;
  288|   111k|		if (nbytes < CAST(size_t, abs(compr[i].maglen)))
  ------------------
  |  |  444|   111k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (288:7): [True: 7.08k, False: 104k]
  ------------------
  289|  7.08k|			continue;
  290|   104k|		if (compr[i].maglen < 0) {
  ------------------
  |  Branch (290:7): [True: 11.9k, False: 92.7k]
  ------------------
  291|  11.9k|			zm = (*compr[i].u.func)(buf);
  292|  92.7k|		} else {
  293|  92.7k|			zm = memcmp(buf, compr[i].u.magic,
  294|  92.7k|			    CAST(size_t, compr[i].maglen)) == 0;
  ------------------
  |  |  444|  92.7k|#define CAST(T, b)	((T)(b))
  ------------------
  295|  92.7k|		}
  296|       |
  297|   104k|		if (!zm)
  ------------------
  |  Branch (297:7): [True: 101k, False: 2.93k]
  ------------------
  298|   101k|			continue;
  299|       |
  300|       |		/* Prevent SIGPIPE death if child dies unexpectedly */
  301|  2.93k|		if (!sa_saved) {
  ------------------
  |  Branch (301:7): [True: 2.62k, False: 311]
  ------------------
  302|       |			//We can use sig_act for both new and old, but
  303|  2.62k|			struct sigaction new_act;
  304|  2.62k|			memset(&new_act, 0, sizeof(new_act));
  305|  2.62k|			new_act.sa_handler = SIG_IGN;
  306|  2.62k|			sa_saved = sigaction(SIGPIPE, &new_act, &sig_act) != -1;
  307|  2.62k|		}
  308|       |
  309|  2.93k|		nsz = nbytes;
  310|  2.93k|		free(newbuf);
  311|  2.93k|		urv = uncompressbuf(fd, ms->bytes_max, i, 
  312|  2.93k|		    (ms->flags & MAGIC_NO_COMPRESS_FORK), buf, &newbuf, &nsz);
  ------------------
  |  |   50|  2.93k|#define MAGIC_NO_COMPRESS_FORK	0x4000000 /* Don't allow decompression that
  ------------------
  313|  2.93k|		DPRINTF("uncompressbuf = %d, %s, %" SIZE_T_FORMAT "u\n", urv,
  314|  2.93k|		    (char *)newbuf, nsz);
  315|  2.93k|		switch (urv) {
  316|  2.71k|		case OKDATA:
  ------------------
  |  |  215|  2.71k|#define OKDATA 	0
  ------------------
  |  Branch (316:3): [True: 2.71k, False: 218]
  ------------------
  317|  2.93k|		case ERRDATA:
  ------------------
  |  |  217|  2.93k|#define ERRDATA	2
  ------------------
  |  Branch (317:3): [True: 218, False: 2.71k]
  ------------------
  318|  2.93k|			ms->flags &= ~MAGIC_COMPRESS;
  ------------------
  |  |   35|  2.93k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  319|  2.93k|			if (urv == ERRDATA)
  ------------------
  |  |  217|  2.93k|#define ERRDATA	2
  ------------------
  |  Branch (319:8): [True: 218, False: 2.71k]
  ------------------
  320|    218|				prv = format_decompression_error(ms, i, newbuf);
  321|  2.71k|			else
  322|  2.71k|				prv = file_buffer(ms, -1, NULL, name, newbuf,
  323|  2.71k|				    nsz);
  324|  2.93k|			if (prv == -1)
  ------------------
  |  Branch (324:8): [True: 0, False: 2.93k]
  ------------------
  325|      0|				goto error;
  326|  2.93k|			rv = 1;
  327|  2.93k|			if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
  ------------------
  |  |   48|  2.93k|#define MAGIC_COMPRESS_TRANSP	0x2000000 /* Check inside compressed files
  ------------------
  |  Branch (327:8): [True: 0, False: 2.93k]
  ------------------
  328|      0|				goto out;
  329|  2.93k|			if (mime != MAGIC_MIME && mime != 0)
  ------------------
  |  |   44|  5.86k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  2.93k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  2.93k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (329:8): [True: 2.93k, False: 0]
  |  Branch (329:30): [True: 0, False: 2.93k]
  ------------------
  330|      0|				goto out;
  331|  2.93k|			if ((file_printf(ms,
  ------------------
  |  Branch (331:8): [True: 0, False: 2.93k]
  ------------------
  332|  2.93k|			    mime ? " compressed-encoding=" : " (")) == -1)
  ------------------
  |  Branch (332:8): [True: 0, False: 2.93k]
  ------------------
  333|      0|				goto error;
  334|  2.93k|			if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (334:8): [True: 57, False: 2.87k]
  ------------------
  335|     57|				goto error;
  336|       |			/*
  337|       |			 * XXX: If file_buffer fails here, we overwrite
  338|       |			 * the compressed text. FIXME.
  339|       |			 */
  340|  2.87k|			if (file_buffer(ms, -1, NULL, NULL, buf, nbytes) == -1)
  ------------------
  |  Branch (340:8): [True: 0, False: 2.87k]
  ------------------
  341|      0|			{
  342|      0|				if (file_pop_buffer(ms, pb) != NULL)
  ------------------
  |  Branch (342:9): [True: 0, False: 0]
  ------------------
  343|      0|					abort();
  344|      0|				goto error;
  345|      0|			}
  346|  2.87k|			if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
  ------------------
  |  Branch (346:8): [True: 2.87k, False: 0]
  ------------------
  347|  2.87k|				if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (347:9): [True: 2, False: 2.87k]
  ------------------
  348|      2|					free(rbuf);
  349|      2|					goto error;
  350|      2|				}
  351|  2.87k|				free(rbuf);
  352|  2.87k|			}
  353|  2.87k|			if (!mime && file_printf(ms, ")") == -1)
  ------------------
  |  Branch (353:8): [True: 2.87k, False: 0]
  |  Branch (353:17): [True: 0, False: 2.87k]
  ------------------
  354|      0|				goto error;
  355|       |			/*FALLTHROUGH*/
  356|  2.87k|		case NODATA:
  ------------------
  |  |  216|  2.87k|#define NODATA	1
  ------------------
  |  Branch (356:3): [True: 0, False: 2.93k]
  ------------------
  357|  2.87k|			break;
  358|      0|		default:
  ------------------
  |  Branch (358:3): [True: 0, False: 2.93k]
  ------------------
  359|      0|			abort();
  360|       |			/*NOTREACHED*/
  361|     59|		error:
  362|     59|			rv = -1;
  363|     59|			break;
  364|  2.93k|		}
  365|  2.93k|	}
  366|  7.45k|out:
  367|  7.45k|	DPRINTF("rv = %d\n", rv);
  368|       |
  369|  7.45k|	if (sa_saved && sig_act.sa_handler != SIG_IGN)
  ------------------
  |  Branch (369:6): [True: 2.62k, False: 4.83k]
  |  Branch (369:18): [True: 2.62k, False: 0]
  ------------------
  370|  2.62k|		(void)sigaction(SIGPIPE, &sig_act, NULL);
  371|       |
  372|  7.45k|	free(newbuf);
  373|  7.45k|	ms->flags |= MAGIC_COMPRESS;
  ------------------
  |  |   35|  7.45k|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
  374|  7.45k|	DPRINTF("Zmagic returns %d\n", rv);
  375|  7.45k|	return rv;
  376|  7.45k|}
sread:
  408|  5.72k|{
  409|  5.72k|	ssize_t rv;
  410|  5.72k|#if defined(FIONREAD) && !defined(__MINGW32__)
  411|  5.72k|	int t = 0;
  412|  5.72k|#endif
  413|  5.72k|	size_t rn = n;
  414|       |
  415|  5.72k|	if (fd == STDIN_FILENO)
  ------------------
  |  Branch (415:6): [True: 0, False: 5.72k]
  ------------------
  416|      0|		goto nocheck;
  417|       |
  418|  5.72k|#if defined(FIONREAD) && !defined(__MINGW32__)
  419|  5.72k|	if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
  ------------------
  |  Branch (419:6): [True: 0, False: 5.72k]
  |  Branch (419:20): [True: 0, False: 0]
  |  Branch (419:53): [True: 0, False: 0]
  ------------------
  420|      0|#ifdef FD_ZERO
  421|      0|		ssize_t cnt;
  422|      0|		for (cnt = 0;; cnt++) {
  423|      0|			fd_set check;
  424|      0|			struct timeval tout = {0, 100 * 1000};
  425|      0|			int selrv;
  426|       |
  427|      0|			FD_ZERO(&check);
  428|      0|			FD_SET(fd, &check);
  429|       |
  430|       |			/*
  431|       |			 * Avoid soft deadlock: do not read if there
  432|       |			 * is nothing to read from sockets and pipes.
  433|       |			 */
  434|      0|			selrv = select(fd + 1, &check, NULL, NULL, &tout);
  435|      0|			if (selrv == -1) {
  ------------------
  |  Branch (435:8): [True: 0, False: 0]
  ------------------
  436|      0|				if (errno == EINTR || errno == EAGAIN)
  ------------------
  |  Branch (436:9): [True: 0, False: 0]
  |  Branch (436:27): [True: 0, False: 0]
  ------------------
  437|      0|					continue;
  438|      0|			} else if (selrv == 0 && cnt >= 5) {
  ------------------
  |  Branch (438:15): [True: 0, False: 0]
  |  Branch (438:29): [True: 0, False: 0]
  ------------------
  439|      0|				return 0;
  440|      0|			} else
  441|      0|				break;
  442|      0|		}
  443|      0|#endif
  444|      0|		(void)ioctl(fd, FIONREAD, &t);
  445|      0|	}
  446|       |
  447|  5.72k|	if (t > 0 && CAST(size_t, t) < n) {
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (447:6): [True: 0, False: 5.72k]
  |  Branch (447:15): [True: 0, False: 0]
  ------------------
  448|      0|		n = t;
  449|      0|		rn = n;
  450|      0|	}
  451|  5.72k|#endif
  452|       |
  453|  5.72k|nocheck:
  454|  5.72k|	do
  455|   120k|		switch ((rv = read(fd, buf, n))) {
  456|     62|		case -1:
  ------------------
  |  Branch (456:3): [True: 62, False: 120k]
  ------------------
  457|     62|			if (errno == EINTR)
  ------------------
  |  Branch (457:8): [True: 62, False: 0]
  ------------------
  458|     62|				continue;
  459|      0|			return -1;
  460|  5.68k|		case 0:
  ------------------
  |  Branch (460:3): [True: 5.68k, False: 114k]
  ------------------
  461|  5.68k|			return rn - n;
  462|   114k|		default:
  ------------------
  |  Branch (462:3): [True: 114k, False: 5.74k]
  ------------------
  463|   114k|			n -= rv;
  464|   114k|			buf = CAST(char *, CCAST(void *, buf)) + rv;
  ------------------
  |  |  444|   114k|#define CAST(T, b)	((T)(b))
  ------------------
  465|   114k|			break;
  466|   120k|		}
  467|   114k|	while (n > 0);
  ------------------
  |  Branch (467:9): [True: 114k, False: 45]
  ------------------
  468|     45|	return rn;
  469|  5.72k|}
compress.c:lzmacmp:
  137|  4.50k|{
  138|  4.50k|	if (buf[0] != 0x5d || buf[1] || buf[2])
  ------------------
  |  Branch (138:6): [True: 4.48k, False: 22]
  |  Branch (138:24): [True: 2, False: 20]
  |  Branch (138:34): [True: 8, False: 12]
  ------------------
  139|  4.49k|		return 0;
  140|     12|	if (buf[12] && buf[12] != 0xff)
  ------------------
  |  Branch (140:6): [True: 10, False: 2]
  |  Branch (140:17): [True: 9, False: 1]
  ------------------
  141|      9|		return 0;
  142|      3|	return 1;
  143|     12|}
compress.c:zlibcmp:
  119|  7.45k|{
  120|  7.45k|	unsigned short x = 1;
  121|  7.45k|	unsigned char *s = CAST(unsigned char *, CAST(void *, &x));
  ------------------
  |  |  444|  7.45k|#define CAST(T, b)	((T)(b))
  ------------------
  122|       |
  123|  7.45k|	if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
  ------------------
  |  Branch (123:6): [True: 7.36k, False: 92]
  |  Branch (123:29): [True: 24, False: 68]
  ------------------
  124|  7.38k|		return 0;
  125|     68|	if (s[0] != 1)	/* endianness test */
  ------------------
  |  Branch (125:6): [True: 0, False: 68]
  ------------------
  126|      0|		x = buf[0] | (buf[1] << 8);
  127|     68|	else
  128|     68|		x = buf[1] | (buf[0] << 8);
  129|     68|	if (x % 31)
  ------------------
  |  Branch (129:6): [True: 46, False: 22]
  ------------------
  130|     46|		return 0;
  131|     22|	return 1;
  132|     68|}
compress.c:format_decompression_error:
  253|    218|{
  254|    218|	unsigned char *p;
  255|    218|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|    218|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|    218|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|    218|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  256|       |
  257|    218|	if (!mime)
  ------------------
  |  Branch (257:6): [True: 218, False: 0]
  ------------------
  258|    218|		return file_printf(ms, "ERROR:[%s: %s]", methodname(i), buf);
  259|       |
  260|      0|	for (p = buf; *p; p++)
  ------------------
  |  Branch (260:16): [True: 0, False: 0]
  ------------------
  261|      0|		if (!isalnum(*p))
  ------------------
  |  Branch (261:7): [True: 0, False: 0]
  ------------------
  262|      0|			*p = '-';
  263|       |
  264|      0|	return file_printf(ms, "application/x-decompression-error-%s-%s",
  265|      0|	    methodname(i), buf);
  266|    218|}
compress.c:methodname:
  986|    218|{
  987|    218|	switch (method) {
  988|      0|#ifdef BUILTIN_DECOMPRESS
  989|     10|	case METH_FROZEN:
  ------------------
  |  |  185|     10|#define METH_FROZEN	2
  ------------------
  |  Branch (989:2): [True: 10, False: 208]
  ------------------
  990|     32|	case METH_ZLIB:
  ------------------
  |  |  191|     32|#define METH_ZLIB	14
  ------------------
  |  Branch (990:2): [True: 22, False: 196]
  ------------------
  991|     32|		return "zlib";
  992|      0|#endif
  993|      0|#ifdef BUILTIN_BZLIB
  994|     10|	case METH_BZIP:
  ------------------
  |  |  186|     10|#define METH_BZIP	7
  ------------------
  |  Branch (994:2): [True: 10, False: 208]
  ------------------
  995|     10|		return "bzlib";
  996|      0|#endif
  997|      0|#ifdef BUILTIN_XZLIB
  998|      2|	case METH_XZ:
  ------------------
  |  |  187|      2|#define METH_XZ		9
  ------------------
  |  Branch (998:2): [True: 2, False: 216]
  ------------------
  999|      5|	case METH_LZMA:
  ------------------
  |  |  190|      5|#define METH_LZMA	13
  ------------------
  |  Branch (999:2): [True: 3, False: 215]
  ------------------
 1000|      5|		return "xzlib";
 1001|      0|#endif
 1002|      0|#ifdef BUILTIN_ZSTDLIB
 1003|      2|	case METH_ZSTD:
  ------------------
  |  |  189|      2|#define METH_ZSTD	12
  ------------------
  |  Branch (1003:2): [True: 2, False: 216]
  ------------------
 1004|      2|		return "zstd";
 1005|      0|#endif
 1006|       |#ifdef BUILTIN_LZLIB
 1007|       |	case METH_LZIP:
 1008|       |		return "lzlib";
 1009|       |#endif
 1010|    169|	default:
  ------------------
  |  Branch (1010:2): [True: 169, False: 49]
  ------------------
 1011|    169|		return compr[method].argv[0];
 1012|    218|	}
 1013|    218|}
compress.c:uncompressbuf:
 1051|  2.93k|{
 1052|  2.93k|	int fdp[3][2];
 1053|  2.93k|	int status, rv, w;
 1054|  2.93k|	pid_t pid;
 1055|  2.93k|	pid_t writepid = -1;
 1056|  2.93k|	size_t i;
 1057|  2.93k|	ssize_t r, re;
 1058|  2.93k|	char *const *args;
 1059|  2.93k|#ifdef HAVE_POSIX_SPAWNP
 1060|  2.93k|	posix_spawn_file_actions_t fa;
 1061|  2.93k|#endif
 1062|  2.93k|	int (*decompress)(const unsigned char *, unsigned char **,
 1063|  2.93k|	    size_t, size_t *, int) = getdecompressor(method);
 1064|       |
 1065|  2.93k|	*newch = CAST(unsigned char *, malloc(bytes_max + 1));
  ------------------
  |  |  444|  2.93k|#define CAST(T, b)	((T)(b))
  ------------------
 1066|  2.93k|	if (*newch == NULL)
  ------------------
  |  Branch (1066:6): [True: 0, False: 2.93k]
  ------------------
 1067|      0|		return makeerror(newch, n, "No buffer, %s", strerror(errno));
 1068|       |
 1069|  2.93k|	if (decompress) {
  ------------------
  |  Branch (1069:6): [True: 49, False: 2.88k]
  ------------------
 1070|     49|		if (nofork) {
  ------------------
  |  Branch (1070:7): [True: 49, False: 0]
  ------------------
 1071|     49|			return makeerror(newch, n,
 1072|     49|			    "Fork is required to uncompress, but disabled");
 1073|     49|		}
 1074|      0|		return (*decompress)(old, newch, bytes_max, n, 1);
 1075|     49|	}
 1076|       |
 1077|  2.88k|	(void)fflush(stdout);
 1078|  2.88k|	(void)fflush(stderr);
 1079|       |
 1080|  11.5k|	for (i = 0; i < __arraycount(fdp); i++)
  ------------------
  |  |  130|  11.5k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1080:14): [True: 8.65k, False: 2.88k]
  ------------------
 1081|  8.65k|		fdp[i][0] = fdp[i][1] = -1;
 1082|       |
 1083|       |	/*
 1084|       |	 * There are multithreaded users who run magic_file()
 1085|       |	 * from dozens of threads. If two parallel magic_file() calls
 1086|       |	 * analyze two large compressed files, both will spawn
 1087|       |	 * an uncompressing child here, which writes out uncompressed data.
 1088|       |	 * We read some portion, then close the pipe, then waitpid() the child.
 1089|       |	 * If uncompressed data is larger, child should get EPIPE and exit.
 1090|       |	 * However, with *parallel* calls OTHER child may unintentionally
 1091|       |	 * inherit pipe fds, thus keeping pipe open and making writes in
 1092|       |	 * our child block instead of failing with EPIPE!
 1093|       |	 * (For the bug to occur, two threads must mutually inherit their pipes,
 1094|       |	 * and both must have large outputs. Thus it happens not that often).
 1095|       |	 * To avoid this, be sure to create pipes with O_CLOEXEC.
 1096|       |	 */
 1097|  2.88k|	if ((fd == -1 && file_pipe_closexec(fdp[STDIN_FILENO]) == -1) ||
  ------------------
  |  Branch (1097:7): [True: 2.88k, False: 0]
  |  Branch (1097:19): [True: 0, False: 2.88k]
  ------------------
 1098|  2.88k|	    file_pipe_closexec(fdp[STDOUT_FILENO]) == -1 ||
  ------------------
  |  Branch (1098:6): [True: 0, False: 2.88k]
  ------------------
 1099|  2.88k|	    file_pipe_closexec(fdp[STDERR_FILENO]) == -1) {
  ------------------
  |  Branch (1099:6): [True: 0, False: 2.88k]
  ------------------
 1100|      0|		closep(fdp[STDIN_FILENO]);
 1101|      0|		closep(fdp[STDOUT_FILENO]);
 1102|      0|		return makeerror(newch, n, "Cannot create pipe, %s",
 1103|      0|		    strerror(errno));
 1104|      0|	}
 1105|       |
 1106|  2.88k|	args = RCAST(char *const *, RCAST(intptr_t, compr[method].argv));
  ------------------
  |  |  445|  2.88k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1107|  2.88k|#ifdef HAVE_POSIX_SPAWNP
 1108|  2.88k|	posix_spawn_file_actions_init(&fa);
 1109|       |
 1110|  2.88k|	handledesc(&fa, fd, fdp);
 1111|       |
 1112|  2.88k|	DPRINTF("Executing %s\n", compr[method].argv[0]);
 1113|  2.88k|	status = posix_spawnp(&pid, compr[method].argv[0], &fa, NULL,
 1114|  2.88k|	    args, NULL);
 1115|       |
 1116|  2.88k|	posix_spawn_file_actions_destroy(&fa);
 1117|       |
 1118|  2.88k|	if (status == -1) {
  ------------------
  |  Branch (1118:6): [True: 0, False: 2.88k]
  ------------------
 1119|      0|		return makeerror(newch, n, "Cannot posix_spawn `%s', %s",
 1120|      0|		    compr[method].argv[0], strerror(errno));
 1121|      0|	}
 1122|       |#else
 1123|       |	/* For processes with large mapped virtual sizes, vfork
 1124|       |	 * may be _much_ faster (10-100 times) than fork.
 1125|       |	 */
 1126|       |	pid = vfork();
 1127|       |	if (pid == -1) {
 1128|       |		return makeerror(newch, n, "Cannot vfork, %s",
 1129|       |		    strerror(errno));
 1130|       |	}
 1131|       |	if (pid == 0) {
 1132|       |		/* child */
 1133|       |		/* Note: we are after vfork, do not modify memory
 1134|       |		 * in a way which confuses parent. In particular,
 1135|       |		 * do not modify fdp[i][j].
 1136|       |		 */
 1137|       |		handledesc(NULL, fd, fdp);
 1138|       |		DPRINTF("Executing %s\n", compr[method].argv[0]);
 1139|       |
 1140|       |		(void)execvp(compr[method].argv[0], args);
 1141|       |		dprintf(STDERR_FILENO, "exec `%s' failed, %s",
 1142|       |		    compr[method].argv[0], strerror(errno));
 1143|       |		_exit(EXIT_FAILURE); /* _exit(), not exit(), because of vfork */
 1144|       |	}
 1145|       |#endif
 1146|       |	/* parent */
 1147|       |	/* Close write sides of child stdout/err pipes */
 1148|  8.65k|	for (i = 1; i < __arraycount(fdp); i++)
  ------------------
  |  |  130|  8.65k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (1148:14): [True: 5.77k, False: 2.88k]
  ------------------
 1149|  5.77k|		closefd(fdp[i], 1);
 1150|       |	/* Write the buffer data to child stdin, if we don't have fd */
 1151|  2.88k|	if (fd == -1) {
  ------------------
  |  Branch (1151:6): [True: 2.88k, False: 0]
  ------------------
 1152|  2.88k|		closefd(fdp[STDIN_FILENO], 0);
 1153|  2.88k|		writepid = writechild(fdp[STDIN_FILENO][1], old, *n);
 1154|  2.88k|		if (writepid == (pid_t)-1) {
  ------------------
  |  Branch (1154:7): [True: 0, False: 2.88k]
  ------------------
 1155|      0|			rv = makeerror(newch, n, "Write to child failed, %s",
 1156|      0|			    strerror(errno));
 1157|      0|			DPRINTF("Write to child failed\n");
 1158|      0|			goto err;
 1159|      0|		}
 1160|  2.88k|		closefd(fdp[STDIN_FILENO], 1);
 1161|  2.88k|	}
 1162|       |
 1163|  2.88k|	rv = OKDATA;
  ------------------
  |  |  215|  2.88k|#define OKDATA 	0
  ------------------
 1164|  2.88k|	r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0);
 1165|  2.88k|	DPRINTF("read got %zd\n", r);
 1166|  2.88k|	if (r < 0) {
  ------------------
  |  Branch (1166:6): [True: 0, False: 2.88k]
  ------------------
 1167|      0|		rv = ERRDATA;
  ------------------
  |  |  217|      0|#define ERRDATA	2
  ------------------
 1168|      0|		DPRINTF("Read stdout failed %d (%s)\n", fdp[STDOUT_FILENO][0],
 1169|      0|		        strerror(errno));
 1170|      0|		goto err;
 1171|      0|	} 
 1172|  2.88k|	if (CAST(size_t, r) == bytes_max) {
  ------------------
  |  |  444|  2.88k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1172:6): [True: 45, False: 2.84k]
  ------------------
 1173|       |		/*
 1174|       |		 * close fd so that the child exits with sigpipe and ignore
 1175|       |		 * errors, otherwise we risk the child blocking and never
 1176|       |		 * exiting.
 1177|       |		 */
 1178|     45|		DPRINTF("Closing stdout for bytes_max\n");
 1179|     45|		closefd(fdp[STDOUT_FILENO], 0);
 1180|     45|		goto ok;
 1181|     45|	}
 1182|  2.84k|	if ((re = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0) {
  ------------------
  |  Branch (1182:6): [True: 158, False: 2.68k]
  ------------------
 1183|    158|		DPRINTF("Got stuff from stderr %s\n", *newch);
 1184|    158|		rv = ERRDATA;
  ------------------
  |  |  217|    158|#define ERRDATA	2
  ------------------
 1185|    158|		r = filter_error(*newch, r);
 1186|    158|		goto ok;
 1187|    158|	}
 1188|  2.68k|	if  (re == 0)
  ------------------
  |  Branch (1188:7): [True: 2.68k, False: 0]
  ------------------
 1189|  2.68k|		goto ok;
 1190|      0|	rv = makeerror(newch, n, "Read stderr failed, %s",
 1191|      0|	    strerror(errno));
 1192|      0|	goto err;
 1193|  2.88k|ok:
 1194|  2.88k|	*n = r;
 1195|       |	/* NUL terminate, as every buffer is handled here. */
 1196|  2.88k|	(*newch)[*n] = '\0';
 1197|  2.88k|err:
 1198|  2.88k|	closefd(fdp[STDIN_FILENO], 1);
 1199|  2.88k|	closefd(fdp[STDOUT_FILENO], 0);
 1200|  2.88k|	closefd(fdp[STDERR_FILENO], 0);
 1201|       |
 1202|  2.88k|	w = waitpid(pid, &status, 0);
 1203|  5.77k|wait_err:
 1204|  5.77k|	if (w == -1) {
  ------------------
  |  Branch (1204:6): [True: 11, False: 5.75k]
  ------------------
 1205|     11|		rv = makeerror(newch, n, "Wait failed, %s", strerror(errno));
 1206|     11|		DPRINTF("Child wait return %#x\n", status);
 1207|  5.75k|	} else if (!WIFEXITED(status)) {
  ------------------
  |  Branch (1207:13): [True: 0, False: 5.75k]
  ------------------
 1208|      0|		DPRINTF("Child not exited (%#x)\n", status);
 1209|  5.75k|	} else if (WEXITSTATUS(status) != 0) {
  ------------------
  |  Branch (1209:13): [True: 3.08k, False: 2.67k]
  ------------------
 1210|  3.08k|		DPRINTF("Child exited (%#x)\n", WEXITSTATUS(status));
 1211|  3.08k|	}
 1212|  5.77k|	if (writepid > 0) {
  ------------------
  |  Branch (1212:6): [True: 2.88k, False: 2.88k]
  ------------------
 1213|       |		/* _After_ we know decompressor has exited, our input writer
 1214|       |		 * definitely will exit now (at worst, writing fails in it,
 1215|       |		 * since output fd is closed now on the reading size).
 1216|       |		 */
 1217|  2.88k|		w = waitpid(writepid, &status, 0);
 1218|  2.88k|		writepid = -1;
 1219|  2.88k|		goto wait_err;
 1220|  2.88k|	}
 1221|       |
 1222|  2.88k|	closefd(fdp[STDIN_FILENO], 0); //why? it is already closed here!
 1223|  2.88k|	DPRINTF("Returning %p n=%" SIZE_T_FORMAT "u rv=%d\n", *newch, *n, rv);
 1224|       |
 1225|  2.88k|	return rv;
 1226|  5.77k|}
compress.c:getdecompressor:
 1018|  2.93k|{
 1019|  2.93k|	switch (method) {
 1020|      0|#ifdef BUILTIN_DECOMPRESS
 1021|     10|	case METH_FROZEN:
  ------------------
  |  |  185|     10|#define METH_FROZEN	2
  ------------------
  |  Branch (1021:2): [True: 10, False: 2.92k]
  ------------------
 1022|     10|		return uncompressgzipped;
 1023|     22|	case METH_ZLIB:
  ------------------
  |  |  191|     22|#define METH_ZLIB	14
  ------------------
  |  Branch (1023:2): [True: 22, False: 2.91k]
  ------------------
 1024|     22|		return uncompresszlib;
 1025|      0|#endif
 1026|      0|#ifdef BUILTIN_BZLIB
 1027|     10|	case METH_BZIP:
  ------------------
  |  |  186|     10|#define METH_BZIP	7
  ------------------
  |  Branch (1027:2): [True: 10, False: 2.92k]
  ------------------
 1028|     10|		return uncompressbzlib;
 1029|      0|#endif
 1030|      0|#ifdef BUILTIN_XZLIB
 1031|      2|	case METH_XZ:
  ------------------
  |  |  187|      2|#define METH_XZ		9
  ------------------
  |  Branch (1031:2): [True: 2, False: 2.93k]
  ------------------
 1032|      5|	case METH_LZMA:
  ------------------
  |  |  190|      5|#define METH_LZMA	13
  ------------------
  |  Branch (1032:2): [True: 3, False: 2.93k]
  ------------------
 1033|      5|		return uncompressxzlib;
 1034|      0|#endif
 1035|      0|#ifdef BUILTIN_ZSTDLIB
 1036|      2|	case METH_ZSTD:
  ------------------
  |  |  189|      2|#define METH_ZSTD	12
  ------------------
  |  Branch (1036:2): [True: 2, False: 2.93k]
  ------------------
 1037|      2|		return uncompresszstd;
 1038|      0|#endif
 1039|       |#ifdef BUILTIN_LZLIB
 1040|       |	case METH_LZIP:
 1041|       |		return uncompresslzlib;
 1042|       |#endif
 1043|  2.88k|	default:
  ------------------
  |  Branch (1043:2): [True: 2.88k, False: 49]
  ------------------
 1044|  2.88k|		return NULL;
 1045|  2.93k|	}
 1046|  2.93k|}
compress.c:makeerror:
  835|     60|{
  836|     60|	char *msg;
  837|     60|	va_list ap;
  838|     60|	int rv;
  839|       |
  840|     60|	DPRINTF("Makeerror %s\n", fmt);
  841|     60|	free(*buf);
  842|     60|	va_start(ap, fmt);
  843|     60|	rv = vasprintf(&msg, fmt, ap);
  844|     60|	va_end(ap);
  845|     60|	if (rv < 0) {
  ------------------
  |  Branch (845:6): [True: 0, False: 60]
  ------------------
  846|      0|		DPRINTF("Makeerror failed");
  847|      0|		*buf = NULL;
  848|      0|		*len = 0;
  849|      0|		return NODATA;
  ------------------
  |  |  216|      0|#define NODATA	1
  ------------------
  850|      0|	}
  851|     60|	*buf = RCAST(unsigned char *, msg);
  ------------------
  |  |  445|     60|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  852|     60|	*len = strlen(msg);
  853|     60|	return ERRDATA;
  ------------------
  |  |  217|     60|#define ERRDATA	2
  ------------------
  854|     60|}
compress.c:handledesc:
  904|  2.88k|{
  905|  2.88k|	if (fd != -1) {
  ------------------
  |  Branch (905:6): [True: 0, False: 2.88k]
  ------------------
  906|      0|		(void) lseek(fd, CAST(off_t, 0), SEEK_SET);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  907|      0|		movedesc(v, STDIN_FILENO, fd);
  908|  2.88k|	} else {
  909|  2.88k|		movedesc(v, STDIN_FILENO, fdp[STDIN_FILENO][0]);
  910|  2.88k|		if (fdp[STDIN_FILENO][1] > 2)
  ------------------
  |  Branch (910:7): [True: 2.88k, False: 0]
  ------------------
  911|  2.88k|		    closedesc(v, fdp[STDIN_FILENO][1]);
  912|  2.88k|	}
  913|       |
  914|  2.88k|	file_clear_closexec(STDIN_FILENO);
  915|       |
  916|       |///FIXME: if one of the fdp[i][j] is 0 or 1, this can bomb spectacularly
  917|  2.88k|	movedesc(v, STDOUT_FILENO, fdp[STDOUT_FILENO][1]);
  918|  2.88k|	if (fdp[STDOUT_FILENO][0] > 2)
  ------------------
  |  Branch (918:6): [True: 2.88k, False: 0]
  ------------------
  919|  2.88k|		closedesc(v, fdp[STDOUT_FILENO][0]);
  920|       |
  921|  2.88k|	file_clear_closexec(STDOUT_FILENO);
  922|       |
  923|  2.88k|	movedesc(v, STDERR_FILENO, fdp[STDERR_FILENO][1]);
  924|  2.88k|	if (fdp[STDERR_FILENO][0] > 2)
  ------------------
  |  Branch (924:6): [True: 2.88k, False: 0]
  ------------------
  925|  2.88k|		closedesc(v, fdp[STDERR_FILENO][0]);
  926|       |
  927|  2.88k|	file_clear_closexec(STDERR_FILENO);
  928|  2.88k|}
compress.c:movedesc:
  875|  8.65k|{
  876|  8.65k|	if (fd == i)
  ------------------
  |  Branch (876:6): [True: 0, False: 8.65k]
  ------------------
  877|      0|		return; /* "no dup was necessary" */
  878|  8.65k|#ifdef HAVE_POSIX_SPAWNP
  879|  8.65k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  445|  8.65k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  880|  8.65k|	posix_spawn_file_actions_adddup2(fa, fd, i);
  881|  8.65k|	posix_spawn_file_actions_addclose(fa, fd);
  882|       |#else
  883|       |	if (dup2(fd, i) == -1) {
  884|       |		DPRINTF("dup(%d, %d) failed (%s)\n", fd, i, strerror(errno));
  885|       |		exit(EXIT_FAILURE);
  886|       |	}
  887|       |	close(v ? fd : fd);
  888|       |#endif
  889|  8.65k|}
compress.c:closedesc:
  893|  8.65k|{
  894|  8.65k|#ifdef HAVE_POSIX_SPAWNP
  895|  8.65k|	posix_spawn_file_actions_t *fa = RCAST(posix_spawn_file_actions_t *, v);
  ------------------
  |  |  445|  8.65k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  896|  8.65k|	posix_spawn_file_actions_addclose(fa, fd);
  897|       |#else
  898|       |	close(v ? fd : fd);
  899|       |#endif
  900|  8.65k|}
compress.c:closefd:
  858|  23.1k|{
  859|  23.1k|	if (fd[i] == -1)
  ------------------
  |  Branch (859:6): [True: 5.81k, False: 17.3k]
  ------------------
  860|  5.81k|		return;
  861|  17.3k|	(void) close(fd[i]);
  862|  17.3k|	fd[i] = -1;
  863|  17.3k|}
compress.c:writechild:
  932|  2.88k|{
  933|  2.88k|	pid_t pid;
  934|       |
  935|       |	/*
  936|       |	 * fork again, to avoid blocking because both
  937|       |	 * pipes filled
  938|       |	 */
  939|  2.88k|	pid = fork();
  940|  2.88k|	if (pid == -1) {
  ------------------
  |  Branch (940:6): [True: 0, False: 2.88k]
  ------------------
  941|      0|		DPRINTF("Fork failed (%s)\n", strerror(errno));
  942|      0|		return -1;
  943|      0|	}
  944|  2.88k|	if (pid == 0) {
  ------------------
  |  Branch (944:6): [True: 0, False: 2.88k]
  ------------------
  945|       |		/* child */
  946|      0|		if (swrite(fd, old, n) != CAST(ssize_t, n)) {
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (946:7): [True: 0, False: 0]
  ------------------
  947|      0|			DPRINTF("Write failed (%s)\n", strerror(errno));
  948|      0|			exit(EXIT_FAILURE);
  949|      0|		}
  950|      0|		exit(EXIT_SUCCESS);
  951|      0|	}
  952|       |	/* parent */
  953|  2.88k|	return pid;
  954|  2.88k|}
compress.c:filter_error:
  958|    158|{
  959|    158|	char *p;
  960|    158|	char *buf;
  961|       |
  962|    158|	ubuf[n] = '\0';
  963|    158|	buf = RCAST(char *, ubuf);
  ------------------
  |  |  445|    158|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  964|    158|	while (isspace(CAST(unsigned char, *buf)))
  965|     51|		buf++;
  966|    158|	DPRINTF("Filter error[[[%s]]]\n", buf);
  967|    158|	if ((p = strchr(CAST(char *, buf), '\n')) != NULL)
  ------------------
  |  |  444|    158|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (967:6): [True: 6, False: 152]
  ------------------
  968|      6|		*p = '\0';
  969|    158|	if ((p = strchr(CAST(char *, buf), ';')) != NULL)
  ------------------
  |  |  444|    158|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (969:6): [True: 0, False: 158]
  ------------------
  970|      0|		*p = '\0';
  971|    158|	if ((p = strrchr(CAST(char *, buf), ':')) != NULL) {
  ------------------
  |  |  444|    158|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (971:6): [True: 15, False: 143]
  ------------------
  972|     15|		++p;
  973|     15|		while (isspace(CAST(unsigned char, *p)))
  974|     11|			p++;
  975|     15|		n = strlen(p);
  976|     15|		memmove(ubuf, p, CAST(size_t, n + 1));
  ------------------
  |  |  444|     15|#define CAST(T, b)	((T)(b))
  ------------------
  977|     15|	}
  978|    158|	DPRINTF("Filter error after[[[%s]]]\n", (char *)ubuf);
  979|    158|	if (islower(*ubuf))
  980|     11|		*ubuf = toupper(*ubuf);
  981|    158|	return n;
  982|    158|}

der_offs:
  265|  31.0k|{
  266|  31.0k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  445|  31.0k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  267|  31.0k|	size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes;
  ------------------
  |  Branch (267:25): [True: 31.0k, False: 0]
  ------------------
  268|       |
  269|  31.0k|	if (gettag(b, &offs, len) == DER_BAD) {
  ------------------
  |  |   62|  31.0k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  31.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (269:6): [True: 0, False: 31.0k]
  ------------------
  270|      0|		DPRINTF(("%s: bad tag 1\n", __func__));
  271|      0|		return -1;
  272|      0|	}
  273|  31.0k|	DPRINTF(("%s1: %u %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  274|  31.0k|	    offs, m->offset));
  275|       |
  276|  31.0k|	uint32_t tlen = getlength(b, &offs, len);
  277|  31.0k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|  31.0k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  31.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (277:6): [True: 0, False: 31.0k]
  ------------------
  278|      0|		DPRINTF(("%s: bad tag 2\n", __func__));
  279|      0|		return -1;
  280|      0|	}
  281|  31.0k|	DPRINTF(("%s2: %u %" SIZE_T_FORMAT "u %u\n", __func__, ms->offset,
  282|  31.0k|	    offs, tlen));
  283|       |
  284|  31.0k|	offs += ms->offset + m->offset;
  285|  31.0k|	DPRINTF(("cont_level = %d\n", m->cont_level));
  286|       |#ifdef DEBUG_DER
  287|       |	size_t i;
  288|       |	for (i = 0; i < m->cont_level; i++)
  289|       |		printf("cont_level[%" SIZE_T_FORMAT "u] = %d\n", i,
  290|       |		    ms->c.li[i].off);
  291|       |#endif
  292|  31.0k|	if (m->cont_level != 0) {
  ------------------
  |  Branch (292:6): [True: 5.41k, False: 25.5k]
  ------------------
  293|  5.41k|		if (offs + tlen > nbytes)
  ------------------
  |  Branch (293:7): [True: 0, False: 5.41k]
  ------------------
  294|      0|			return -1;
  295|  5.41k|		ms->c.li[m->cont_level - 1].off = CAST(int, offs + tlen);
  ------------------
  |  |  444|  5.41k|#define CAST(T, b)	((T)(b))
  ------------------
  296|  5.41k|		DPRINTF(("cont_level[%u] = %d\n", m->cont_level - 1,
  297|  5.41k|		    ms->c.li[m->cont_level - 1].off));
  298|  5.41k|	}
  299|  31.0k|	return CAST(int32_t, offs);
  ------------------
  |  |  444|  31.0k|#define CAST(T, b)	((T)(b))
  ------------------
  300|  31.0k|}
der_cmp:
  304|   375k|{
  305|   375k|	const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
  ------------------
  |  |  445|   375k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  306|   375k|	const char *s = m->value.s;
  307|   375k|	size_t offs = 0, len = ms->search.s_len;
  308|   375k|	uint32_t tag, tlen;
  309|   375k|	char buf[128];
  310|       |
  311|   375k|	DPRINTF(("%s: compare %zu bytes\n", __func__, len));
  312|       |
  313|   375k|	tag = gettag(b, &offs, len);
  314|   375k|	if (tag == DER_BAD) {
  ------------------
  |  |   62|   375k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|   375k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (314:6): [True: 9.48k, False: 365k]
  ------------------
  315|  9.48k|		DPRINTF(("%s: bad tag 1\n", __func__));
  316|  9.48k|		return -1;
  317|  9.48k|	}
  318|       |
  319|   365k|	DPRINTF(("%s1: %d %" SIZE_T_FORMAT "u %d\n", __func__, ms->offset,
  320|   365k|	    offs, m->offset));
  321|       |
  322|   365k|	tlen = getlength(b, &offs, len);
  323|   365k|	if (tlen == DER_BAD) {
  ------------------
  |  |   62|   365k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|   365k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (323:6): [True: 128k, False: 236k]
  ------------------
  324|   128k|		DPRINTF(("%s: bad tag 2\n", __func__));
  325|   128k|		return -1;
  326|   128k|	}
  327|       |
  328|   236k|	der_tag(buf, sizeof(buf), tag);
  329|   236k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   236k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (329:6): [True: 0, False: 236k]
  ------------------
  330|      0|		fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
  331|      0|		    buf, s);
  332|   236k|	size_t slen = strlen(buf);
  333|       |
  334|   236k|	if (strncmp(buf, s, slen) != 0) {
  ------------------
  |  Branch (334:6): [True: 202k, False: 34.1k]
  ------------------
  335|   202k|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  336|   202k|		return 0;
  337|   202k|	}
  338|       |
  339|  34.1k|	s += slen;
  340|       |
  341|  35.8k|again:
  342|  35.8k|	switch (*s) {
  343|  30.1k|	case '\0':
  ------------------
  |  Branch (343:2): [True: 30.1k, False: 5.71k]
  ------------------
  344|  30.1k|		DPRINTF(("%s: EOF match\n", __func__));
  345|  30.1k|		return 1;
  346|  1.91k|	case '=':
  ------------------
  |  Branch (346:2): [True: 1.91k, False: 33.9k]
  ------------------
  347|  1.91k|		s++;
  348|  1.91k|		goto val;
  349|  3.80k|	default:
  ------------------
  |  Branch (349:2): [True: 3.80k, False: 32.0k]
  ------------------
  350|  3.80k|		if (!isdigit(CAST(unsigned char, *s))) {
  ------------------
  |  Branch (350:7): [True: 0, False: 3.80k]
  ------------------
  351|      0|			DPRINTF(("%s: no digit %c\n", __func__, *s));
  352|      0|			return 0;
  353|      0|		}
  354|       |
  355|  3.80k|		slen = 0;
  356|  3.80k|		do
  357|  5.76k|			slen = slen * 10 + *s - '0';
  358|  3.80k|		while (isdigit(CAST(unsigned char, *++s)));
  359|  3.80k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  3.80k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (359:7): [True: 0, False: 3.80k]
  ------------------
  360|      0|			fprintf(stderr, "%s: len %" SIZE_T_FORMAT "u %u\n",
  361|      0|			    __func__, slen, tlen);
  362|  3.80k|		if (tlen != slen) {
  ------------------
  |  Branch (362:7): [True: 2.11k, False: 1.68k]
  ------------------
  363|  2.11k|			DPRINTF(("%s: len %u != %zu\n", __func__, tlen, slen));
  364|  2.11k|			return 0;
  365|  2.11k|		}
  366|  1.68k|		goto again;
  367|  35.8k|	}
  368|  1.91k|val:
  369|  1.91k|	DPRINTF(("%s: before data %" SIZE_T_FORMAT "u %u\n", __func__, offs,
  370|  1.91k|	    tlen));
  371|  1.91k|	der_data(buf, sizeof(buf), tag, b + offs, tlen);
  372|  1.91k|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.91k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (372:6): [True: 0, False: 1.91k]
  ------------------
  373|      0|		fprintf(stderr, "%s: data %s %s\n", __func__, buf, s);
  374|  1.91k|	if (strcmp(buf, s) != 0 && strcmp("x", s) != 0) {
  ------------------
  |  Branch (374:6): [True: 1.36k, False: 553]
  |  Branch (374:29): [True: 1.06k, False: 299]
  ------------------
  375|  1.06k|		DPRINTF(("%s: no string match %s != %s\n", __func__, buf, s));
  376|  1.06k|		return 0;
  377|  1.06k|	}
  378|    852|	strlcpy(ms->ms_value.s, buf, sizeof(ms->ms_value.s));
  379|    852|	DPRINTF(("%s: complete match\n", __func__));
  380|    852|	return 1;
  381|  1.91k|}
der.c:gettag:
  150|   406k|{
  151|   406k|	uint32_t tag;
  152|       |
  153|   406k|	if (*p >= l)
  ------------------
  |  Branch (153:6): [True: 4.93k, False: 401k]
  ------------------
  154|  4.93k|		return DER_BAD;
  ------------------
  |  |   62|  4.93k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  4.93k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  155|       |
  156|   401k|	tag = c[(*p)++] & 0x1f;
  157|       |
  158|   401k|	if (tag != 0x1f)
  ------------------
  |  Branch (158:6): [True: 284k, False: 117k]
  ------------------
  159|   284k|		return tag;
  160|       |
  161|   117k|	if (*p >= l)
  ------------------
  |  Branch (161:6): [True: 556, False: 116k]
  ------------------
  162|    556|		return DER_BAD;
  ------------------
  |  |   62|    556|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|    556|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  163|       |
  164|  44.6M|	while (c[*p] >= 0x80) {
  ------------------
  |  Branch (164:9): [True: 44.4M, False: 113k]
  ------------------
  165|  44.4M|		tag = tag * 128 + c[(*p)++] - 0x80;
  166|  44.4M|		if (*p >= l)
  ------------------
  |  Branch (166:7): [True: 3.10k, False: 44.4M]
  ------------------
  167|  3.10k|			return DER_BAD;
  ------------------
  |  |   62|  3.10k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  3.10k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  168|  44.4M|	}
  169|   113k|	return tag;
  170|   116k|}
der.c:getlength:
  183|   396k|{
  184|   396k|	uint8_t digits, i;
  185|   396k|	size_t len;
  186|   396k|	int is_onebyte_result;
  187|       |
  188|   396k|	if (*p >= l) {
  ------------------
  |  Branch (188:6): [True: 4.08k, False: 392k]
  ------------------
  189|  4.08k|		DPRINTF(("%s:[1] %zu >= %zu\n", __func__, *p, l));
  190|  4.08k|		return DER_BAD;
  ------------------
  |  |   62|  4.08k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  4.08k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  191|  4.08k|	}
  192|       |
  193|       |	/*
  194|       |	 * Digits can either be 0b0 followed by the result, or 0b1
  195|       |	 * followed by the number of digits of the result. In either case,
  196|       |	 * we verify that we can read so many bytes from the input.
  197|       |	 */
  198|   392k|	is_onebyte_result = (c[*p] & 0x80) == 0;
  199|   392k|	digits = c[(*p)++] & 0x7f;
  200|   392k|	if (*p + digits >= l) {
  ------------------
  |  Branch (200:6): [True: 99.8k, False: 292k]
  ------------------
  201|  99.8k|		DPRINTF(("%s:[2] %zu + %u >= %zu\n", __func__, *p, digits, l));
  202|  99.8k|		return DER_BAD;
  ------------------
  |  |   62|  99.8k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  99.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  203|  99.8k|	}
  204|       |
  205|   292k|	if (is_onebyte_result)
  ------------------
  |  Branch (205:6): [True: 227k, False: 64.7k]
  ------------------
  206|   227k|		return digits;
  207|       |
  208|       |	/*
  209|       |	 * Decode len. We've already verified that we're allowed to read
  210|       |	 * `digits` bytes.
  211|       |	 */
  212|  64.7k|	len = 0;
  213|  4.55M|	for (i = 0; i < digits; i++)
  ------------------
  |  Branch (213:14): [True: 4.49M, False: 64.7k]
  ------------------
  214|  4.49M|		len = (len << 8) | c[(*p)++];
  215|       |
  216|  64.7k|	if (len > UINT32_MAX - *p || *p + len > l) {
  ------------------
  |  Branch (216:6): [True: 23.8k, False: 40.8k]
  |  Branch (216:31): [True: 1.20k, False: 39.6k]
  ------------------
  217|  25.0k|		DPRINTF(("%s:[3] bad len %zu + %zu >= %zu\n",
  218|  25.0k|		    __func__, *p, len, l));
  219|  25.0k|		return DER_BAD;
  ------------------
  |  |   62|  25.0k|#define DER_BAD	CAST(uint32_t, -1)
  |  |  ------------------
  |  |  |  |  444|  25.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  220|  25.0k|	}
  221|  39.6k|	return CAST(uint32_t, len);
  ------------------
  |  |  444|  39.6k|#define CAST(T, b)	((T)(b))
  ------------------
  222|  64.7k|}
der.c:der_tag:
  226|   236k|{
  227|   236k|	if (tag < DER_TAG_LAST)
  ------------------
  |  |  115|   236k|#define	DER_TAG_LAST			0x25
  ------------------
  |  Branch (227:6): [True: 152k, False: 83.9k]
  ------------------
  228|   152k|		strlcpy(buf, der__tag[tag], len);
  229|  83.9k|	else
  230|  83.9k|		snprintf(buf, len, "%#x", tag);
  231|   236k|	return buf;
  232|   236k|}
der.c:der_data:
  237|  1.91k|{
  238|  1.91k|	uint32_t i;
  239|  1.91k|	const uint8_t *d = CAST(const uint8_t *, q);
  ------------------
  |  |  444|  1.91k|#define CAST(T, b)	((T)(b))
  ------------------
  240|  1.91k|	switch (tag) {
  241|     93|	case DER_TAG_PRINTABLE_STRING:
  ------------------
  |  |   97|     93|#define	DER_TAG_PRINTABLE_STRING	0x13
  ------------------
  |  Branch (241:2): [True: 93, False: 1.82k]
  ------------------
  242|    190|	case DER_TAG_UTF8_STRING:
  ------------------
  |  |   90|    190|#define	DER_TAG_UTF8_STRING		0x0c
  ------------------
  |  Branch (242:2): [True: 97, False: 1.81k]
  ------------------
  243|    231|	case DER_TAG_IA5_STRING:
  ------------------
  |  |  100|    231|#define	DER_TAG_IA5_STRING		0x16
  ------------------
  |  Branch (243:2): [True: 41, False: 1.87k]
  ------------------
  244|    231|		return snprintf(buf, blen, "%.*s", len, RCAST(const char *, q));
  ------------------
  |  |  445|    231|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  245|      0|	case DER_TAG_UTCTIME:
  ------------------
  |  |  101|      0|#define	DER_TAG_UTCTIME			0x17
  ------------------
  |  Branch (245:2): [True: 0, False: 1.91k]
  ------------------
  246|      0|		if (len < 12)
  ------------------
  |  Branch (246:7): [True: 0, False: 0]
  ------------------
  247|      0|			break;
  248|      0|		return snprintf(buf, blen,
  249|      0|		    "20%c%c-%c%c-%c%c %c%c:%c%c:%c%c GMT", d[0], d[1], d[2],
  250|      0|		    d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10], d[11]);
  251|  1.68k|	default:
  ------------------
  |  Branch (251:2): [True: 1.68k, False: 231]
  ------------------
  252|  1.68k|		break;
  253|  1.91k|	}
  254|       |
  255|  6.91k|	for (i = 0; i < len; i++) {
  ------------------
  |  Branch (255:14): [True: 5.23k, False: 1.68k]
  ------------------
  256|  5.23k|		uint32_t z = i << 1;
  257|  5.23k|		if (z < blen - 2)
  ------------------
  |  Branch (257:7): [True: 4.17k, False: 1.06k]
  ------------------
  258|  4.17k|			snprintf(buf + z, blen - z, "%.2x", d[i]);
  259|  5.23k|	}
  260|  1.68k|	return len * 2;
  261|  1.91k|}

file_encoding:
   78|  23.4k|{
   79|  23.4k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  23.4k|#define CAST(T, b)	((T)(b))
  ------------------
   80|  23.4k|	size_t nbytes = b->flen;
   81|  23.4k|	size_t mlen;
   82|  23.4k|	int rv = 1, ucs_type;
   83|  23.4k|	file_unichar_t *udefbuf;
   84|  23.4k|	size_t udeflen;
   85|       |
   86|  23.4k|	if (ubuf == NULL)
  ------------------
  |  Branch (86:6): [True: 13.0k, False: 10.4k]
  ------------------
   87|  13.0k|		ubuf = &udefbuf;
   88|  23.4k|	if (ulen == NULL)
  ------------------
  |  Branch (88:6): [True: 13.0k, False: 10.4k]
  ------------------
   89|  13.0k|		ulen = &udeflen;
   90|       |
   91|  23.4k|	*type = "text";
   92|  23.4k|	*ulen = 0;
   93|  23.4k|	*code = "unknown";
   94|  23.4k|	*code_mime = "binary";
   95|       |
   96|  23.4k|	if (nbytes > ms->encoding_max)
  ------------------
  |  Branch (96:6): [True: 756, False: 22.6k]
  ------------------
   97|    756|		nbytes = ms->encoding_max;
   98|       |
   99|  23.4k|	mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
  100|  23.4k|	*ubuf = CAST(file_unichar_t *, calloc(CAST(size_t, 1), mlen));
  ------------------
  |  |  444|  23.4k|#define CAST(T, b)	((T)(b))
  ------------------
  101|  23.4k|	if (*ubuf == NULL) {
  ------------------
  |  Branch (101:6): [True: 0, False: 23.4k]
  ------------------
  102|      0|		file_oomem(ms, mlen);
  103|      0|		goto done;
  104|      0|	}
  105|  23.4k|	if (looks_ascii(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (105:6): [True: 1.74k, False: 21.6k]
  ------------------
  106|  1.74k|		if (looks_utf7(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (106:7): [True: 12, False: 1.73k]
  ------------------
  107|     12|			DPRINTF(("utf-7 %" SIZE_T_FORMAT "u\n", *ulen));
  108|     12|			*code = "Unicode text, UTF-7";
  109|     12|			*code_mime = "utf-7";
  110|  1.73k|		} else {
  111|  1.73k|			DPRINTF(("ascii %" SIZE_T_FORMAT "u\n", *ulen));
  112|  1.73k|			*code = "ASCII";
  113|  1.73k|			*code_mime = "us-ascii";
  114|  1.73k|		}
  115|  21.6k|	} else if (looks_utf8_with_BOM(buf, nbytes, *ubuf, ulen) > 0) {
  ------------------
  |  Branch (115:13): [True: 7, False: 21.6k]
  ------------------
  116|      7|		DPRINTF(("utf8/bom %" SIZE_T_FORMAT "u\n", *ulen));
  117|      7|		*code = "Unicode text, UTF-8 (with BOM)";
  118|      7|		*code_mime = "utf-8";
  119|  21.6k|	} else if (file_looks_utf8(buf, nbytes, *ubuf, ulen) > 1) {
  ------------------
  |  Branch (119:13): [True: 173, False: 21.5k]
  ------------------
  120|    173|		DPRINTF(("utf8 %" SIZE_T_FORMAT "u\n", *ulen));
  121|    173|		*code = "Unicode text, UTF-8";
  122|    173|		*code_mime = "utf-8";
  123|  21.5k|	} else if ((ucs_type = looks_ucs32(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (123:13): [True: 316, False: 21.1k]
  ------------------
  124|    316|		if (ucs_type == 1) {
  ------------------
  |  Branch (124:7): [True: 141, False: 175]
  ------------------
  125|    141|			*code = "Unicode text, UTF-32, little-endian";
  126|    141|			*code_mime = "utf-32le";
  127|    175|		} else {
  128|    175|			*code = "Unicode text, UTF-32, big-endian";
  129|    175|			*code_mime = "utf-32be";
  130|    175|		}
  131|    316|		DPRINTF(("ucs32 %" SIZE_T_FORMAT "u\n", *ulen));
  132|  21.1k|	} else if ((ucs_type = looks_ucs16(buf, nbytes, *ubuf, ulen)) != 0) {
  ------------------
  |  Branch (132:13): [True: 381, False: 20.8k]
  ------------------
  133|    381|		if (ucs_type == 1) {
  ------------------
  |  Branch (133:7): [True: 200, False: 181]
  ------------------
  134|    200|			*code = "Unicode text, UTF-16, little-endian";
  135|    200|			*code_mime = "utf-16le";
  136|    200|		} else {
  137|    181|			*code = "Unicode text, UTF-16, big-endian";
  138|    181|			*code_mime = "utf-16be";
  139|    181|		}
  140|    381|		DPRINTF(("ucs16 %" SIZE_T_FORMAT "u\n", *ulen));
  141|  20.8k|	} else if (looks_latin1(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (141:13): [True: 882, False: 19.9k]
  ------------------
  142|    882|		DPRINTF(("latin1 %" SIZE_T_FORMAT "u\n", *ulen));
  143|    882|		*code = "ISO-8859";
  144|    882|		*code_mime = "iso-8859-1";
  145|  19.9k|	} else if (looks_extended(buf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (145:13): [True: 512, False: 19.4k]
  ------------------
  146|    512|		DPRINTF(("extended %" SIZE_T_FORMAT "u\n", *ulen));
  147|    512|		*code = "Non-ISO extended-ASCII";
  148|    512|		*code_mime = "unknown-8bit";
  149|  19.4k|	} else {
  150|  19.4k|		unsigned char *nbuf;
  151|       |
  152|  19.4k|		mlen = (nbytes + 1) * sizeof(nbuf[0]);
  153|  19.4k|		if ((nbuf = CAST(unsigned char *, malloc(mlen))) == NULL) {
  ------------------
  |  |  444|  19.4k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (153:7): [True: 0, False: 19.4k]
  ------------------
  154|      0|			file_oomem(ms, mlen);
  155|      0|			goto done;
  156|      0|		}
  157|  19.4k|		from_ebcdic(buf, nbytes, nbuf);
  158|       |
  159|  19.4k|		if (looks_ascii(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (159:7): [True: 123, False: 19.2k]
  ------------------
  160|    123|			DPRINTF(("ebcdic %" SIZE_T_FORMAT "u\n", *ulen));
  161|    123|			*code = "EBCDIC";
  162|    123|			*code_mime = "ebcdic";
  163|  19.2k|		} else if (looks_latin1(nbuf, nbytes, *ubuf, ulen)) {
  ------------------
  |  Branch (163:14): [True: 104, False: 19.1k]
  ------------------
  164|    104|			DPRINTF(("ebcdic/international %" SIZE_T_FORMAT "u\n",
  165|    104|			    *ulen));
  166|    104|			*code = "International EBCDIC";
  167|    104|			*code_mime = "ebcdic";
  168|  19.1k|		} else { /* Doesn't look like text at all */
  169|  19.1k|			DPRINTF(("binary\n"));
  170|  19.1k|			rv = 0;
  171|  19.1k|			*type = "binary";
  172|  19.1k|		}
  173|  19.4k|		free(nbuf);
  174|  19.4k|	}
  175|       |
  176|  23.4k| done:
  177|  23.4k|	if (ubuf == &udefbuf)
  ------------------
  |  Branch (177:6): [True: 13.0k, False: 10.4k]
  ------------------
  178|  13.0k|		free(udefbuf);
  179|       |
  180|  23.4k|	return rv;
  181|  23.4k|}
file_looks_utf8:
  352|  21.7k|{
  353|  21.7k|	size_t i;
  354|  21.7k|	int n;
  355|  21.7k|	file_unichar_t c;
  356|  21.7k|	int gotone = 0, ctrl = 0;
  357|       |
  358|  21.7k|	if (ubuf)
  ------------------
  |  Branch (358:6): [True: 21.7k, False: 0]
  ------------------
  359|  21.7k|		*ulen = 0;
  360|       |
  361|  19.8M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (361:14): [True: 19.8M, False: 1.64k]
  ------------------
  362|  19.8M|		if ((buf[i] & 0x80) == 0) {	   /* 0xxxxxxx is plain ASCII */
  ------------------
  |  Branch (362:7): [True: 19.7M, False: 110k]
  ------------------
  363|       |			/*
  364|       |			 * Even if the whole file is valid UTF-8 sequences,
  365|       |			 * still reject it if it uses weird control characters.
  366|       |			 */
  367|       |
  368|  19.7M|			if (text_chars[buf[i]] != T)
  ------------------
  |  |  236|  19.7M|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (368:8): [True: 17.4M, False: 2.32M]
  ------------------
  369|  17.4M|				ctrl = 1;
  370|       |
  371|  19.7M|			if (ubuf)
  ------------------
  |  Branch (371:8): [True: 19.7M, False: 0]
  ------------------
  372|  19.7M|				ubuf[(*ulen)++] = buf[i];
  373|  19.7M|		} else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */
  ------------------
  |  Branch (373:14): [True: 10.2k, False: 100k]
  ------------------
  374|  10.2k|			return -1;
  375|   100k|		} else {			   /* 11xxxxxx begins UTF-8 */
  376|   100k|			int following;
  377|   100k|			uint8_t x = first[buf[i]];
  378|   100k|			const struct accept_range *ar =
  379|   100k|			    &accept_ranges[(unsigned int)x >> 4];
  380|   100k|			if (x == XX)
  ------------------
  |  |  300|   100k|#define	XX 0xF1 // invalid: size 1
  ------------------
  |  Branch (380:8): [True: 4.04k, False: 96.5k]
  ------------------
  381|  4.04k|				return -1;
  382|       |
  383|  96.5k|			if ((buf[i] & 0x20) == 0) {		/* 110xxxxx */
  ------------------
  |  Branch (383:8): [True: 64.4k, False: 32.0k]
  ------------------
  384|  64.4k|				c = buf[i] & 0x1f;
  385|  64.4k|				following = 1;
  386|  64.4k|			} else if ((buf[i] & 0x10) == 0) {	/* 1110xxxx */
  ------------------
  |  Branch (386:15): [True: 1.45k, False: 30.5k]
  ------------------
  387|  1.45k|				c = buf[i] & 0x0f;
  388|  1.45k|				following = 2;
  389|  30.5k|			} else if ((buf[i] & 0x08) == 0) {	/* 11110xxx */
  ------------------
  |  Branch (389:15): [True: 30.5k, False: 0]
  ------------------
  390|  30.5k|				c = buf[i] & 0x07;
  391|  30.5k|				following = 3;
  392|  30.5k|			} else if ((buf[i] & 0x04) == 0) {	/* 111110xx */
  ------------------
  |  Branch (392:15): [True: 0, False: 0]
  ------------------
  393|      0|				c = buf[i] & 0x03;
  394|      0|				following = 4;
  395|      0|			} else if ((buf[i] & 0x02) == 0) {	/* 1111110x */
  ------------------
  |  Branch (395:15): [True: 0, False: 0]
  ------------------
  396|      0|				c = buf[i] & 0x01;
  397|      0|				following = 5;
  398|      0|			} else
  399|      0|				return -1;
  400|       |
  401|   248k|			for (n = 0; n < following; n++) {
  ------------------
  |  Branch (401:16): [True: 158k, False: 90.7k]
  ------------------
  402|   158k|				i++;
  403|   158k|				if (i >= nbytes)
  ------------------
  |  Branch (403:9): [True: 175, False: 158k]
  ------------------
  404|    175|					goto done;
  405|       |
  406|   158k|				if (n == 0 &&
  ------------------
  |  Branch (406:9): [True: 96.3k, False: 61.6k]
  ------------------
  407|   158k|				     (buf[i] < ar->lo || buf[i] > ar->hi))
  ------------------
  |  Branch (407:11): [True: 870, False: 95.5k]
  |  Branch (407:30): [True: 4.65k, False: 90.8k]
  ------------------
  408|  5.52k|					return -1;
  409|       |
  410|   152k|				if ((buf[i] & 0x80) == 0 || (buf[i] & 0x40))
  ------------------
  |  Branch (410:9): [True: 61, False: 152k]
  |  Branch (410:33): [True: 53, False: 152k]
  ------------------
  411|    114|					return -1;
  412|       |
  413|   152k|				c = (c << 6) + (buf[i] & 0x3f);
  414|   152k|			}
  415|       |
  416|  90.7k|			if (ubuf)
  ------------------
  |  Branch (416:8): [True: 90.7k, False: 0]
  ------------------
  417|  90.7k|				ubuf[(*ulen)++] = c;
  418|  90.7k|			gotone = 1;
  419|  90.7k|		}
  420|  19.8M|	}
  421|  1.81k|done:
  422|  1.81k|	return ctrl ? 0 : (gotone ? 2 : 1);
  ------------------
  |  Branch (422:9): [True: 1.55k, False: 261]
  |  Branch (422:21): [True: 173, False: 88]
  ------------------
  423|  21.7k|}
encoding.c:looks_ascii:
  265|  42.8k|    size_t *ulen) \
  266|  42.8k|{ \
  267|  42.8k|	size_t i; \
  268|  42.8k|\
  269|  42.8k|	*ulen = 0; \
  270|  42.8k|\
  271|  15.3M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 15.3M, False: 1.87k]
  ------------------
  272|  15.3M|		int t = text_chars[buf[i]]; \
  273|  15.3M|\
  274|  15.3M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 40.9k, False: 15.3M]
  ------------------
  275|  15.3M|			return 0; \
  276|  15.3M|\
  277|  15.3M|		ubuf[(*ulen)++] = buf[i]; \
  278|  15.3M|	} \
  279|  42.8k|	return 1; \
  280|  42.8k|}
encoding.c:looks_latin1:
  265|  40.0k|    size_t *ulen) \
  266|  40.0k|{ \
  267|  40.0k|	size_t i; \
  268|  40.0k|\
  269|  40.0k|	*ulen = 0; \
  270|  40.0k|\
  271|  4.56M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 4.56M, False: 986]
  ------------------
  272|  4.56M|		int t = text_chars[buf[i]]; \
  273|  4.56M|\
  274|  11.5M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 2.39M, False: 2.16M]
  |  Branch (274:7): [True: 39.1k, False: 2.35M]
  ------------------
  275|  4.56M|			return 0; \
  276|  4.56M|\
  277|  4.56M|		ubuf[(*ulen)++] = buf[i]; \
  278|  4.52M|	} \
  279|  40.0k|	return 1; \
  280|  40.0k|}
encoding.c:looks_extended:
  265|  19.9k|    size_t *ulen) \
  266|  19.9k|{ \
  267|  19.9k|	size_t i; \
  268|  19.9k|\
  269|  19.9k|	*ulen = 0; \
  270|  19.9k|\
  271|  5.38M|	for (i = 0; i < nbytes; i++) { \
  ------------------
  |  Branch (271:14): [True: 5.38M, False: 512]
  ------------------
  272|  5.38M|		int t = text_chars[buf[i]]; \
  273|  5.38M|\
  274|  17.7M|		if (COND) \
  ------------------
  |  Branch (274:7): [True: 1.08M, False: 4.30M]
  |  Branch (274:7): [True: 508k, False: 576k]
  |  Branch (274:7): [True: 19.4k, False: 489k]
  ------------------
  275|  5.38M|			return 0; \
  276|  5.38M|\
  277|  5.38M|		ubuf[(*ulen)++] = buf[i]; \
  278|  5.36M|	} \
  279|  19.9k|	return 1; \
  280|  19.9k|}
encoding.c:looks_utf8_with_BOM:
  433|  21.6k|{
  434|  21.6k|	if (nbytes > 3 && buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
  ------------------
  |  Branch (434:6): [True: 20.4k, False: 1.23k]
  |  Branch (434:20): [True: 138, False: 20.3k]
  |  Branch (434:38): [True: 96, False: 42]
  |  Branch (434:56): [True: 69, False: 27]
  ------------------
  435|     69|		return file_looks_utf8(buf + 3, nbytes - 3, ubuf, ulen);
  436|  21.6k|	else
  437|  21.6k|		return -1;
  438|  21.6k|}
encoding.c:looks_utf7:
  443|  1.74k|{
  444|  1.74k|	if (nbytes > 4 && buf[0] == '+' && buf[1] == '/' && buf[2] == 'v')
  ------------------
  |  Branch (444:6): [True: 1.07k, False: 676]
  |  Branch (444:20): [True: 37, False: 1.03k]
  |  Branch (444:37): [True: 18, False: 19]
  |  Branch (444:54): [True: 15, False: 3]
  ------------------
  445|     15|		switch (buf[3]) {
  446|      3|		case '8':
  ------------------
  |  Branch (446:3): [True: 3, False: 12]
  ------------------
  447|      6|		case '9':
  ------------------
  |  Branch (447:3): [True: 3, False: 12]
  ------------------
  448|      9|		case '+':
  ------------------
  |  Branch (448:3): [True: 3, False: 12]
  ------------------
  449|     12|		case '/':
  ------------------
  |  Branch (449:3): [True: 3, False: 12]
  ------------------
  450|     12|			if (ubuf)
  ------------------
  |  Branch (450:8): [True: 12, False: 0]
  ------------------
  451|     12|				*ulen = 0;
  452|     12|			return 1;
  453|      3|		default:
  ------------------
  |  Branch (453:3): [True: 3, False: 12]
  ------------------
  454|      3|			return -1;
  455|     15|		}
  456|  1.73k|	else
  457|  1.73k|		return -1;
  458|  1.74k|}
encoding.c:looks_ucs16:
  467|  21.1k|{
  468|  21.1k|	int bigend;
  469|  21.1k|	uint32_t hi;
  470|  21.1k|	size_t i;
  471|       |
  472|  21.1k|	if (nbytes < 2)
  ------------------
  |  Branch (472:6): [True: 71, False: 21.1k]
  ------------------
  473|     71|		return 0;
  474|       |
  475|  21.1k|	if (bf[0] == 0xff && bf[1] == 0xfe)
  ------------------
  |  Branch (475:6): [True: 2.15k, False: 18.9k]
  |  Branch (475:23): [True: 289, False: 1.86k]
  ------------------
  476|    289|		bigend = 0;
  477|  20.8k|	else if (bf[0] == 0xfe && bf[1] == 0xff)
  ------------------
  |  Branch (477:11): [True: 305, False: 20.5k]
  |  Branch (477:28): [True: 272, False: 33]
  ------------------
  478|    272|		bigend = 1;
  479|  20.5k|	else
  480|  20.5k|		return 0;
  481|       |
  482|    561|	*ulen = 0;
  483|    561|	hi = 0;
  484|       |
  485|   728k|	for (i = 2; i + 1 < nbytes; i += 2) {
  ------------------
  |  Branch (485:14): [True: 728k, False: 381]
  ------------------
  486|   728k|		uint32_t uc;
  487|       |
  488|   728k|		if (bigend)
  ------------------
  |  Branch (488:7): [True: 67.1k, False: 661k]
  ------------------
  489|  67.1k|			uc = CAST(uint32_t,
  ------------------
  |  |  444|  67.1k|#define CAST(T, b)	((T)(b))
  ------------------
  490|   728k|			    bf[i + 1] | (CAST(file_unichar_t, bf[i]) << 8));
  491|   661k|		else
  492|   661k|			uc = CAST(uint32_t,
  ------------------
  |  |  444|   661k|#define CAST(T, b)	((T)(b))
  ------------------
  493|   728k|			    bf[i] | (CAST(file_unichar_t, bf[i + 1]) << 8));
  494|       |
  495|   728k|		uc &= 0xffff;
  496|       |
  497|   728k|		switch (uc) {
  498|      8|		case 0xfffe:
  ------------------
  |  Branch (498:3): [True: 8, False: 728k]
  ------------------
  499|     14|		case 0xffff:
  ------------------
  |  Branch (499:3): [True: 6, False: 728k]
  ------------------
  500|     14|			return 0;
  501|   728k|		default:
  ------------------
  |  Branch (501:3): [True: 728k, False: 14]
  ------------------
  502|   728k|			if (UCS16_NOCHAR(uc))
  ------------------
  |  |  460|   728k|#define UCS16_NOCHAR(c) ((c) >= 0xfdd0 && (c) <= 0xfdef)
  |  |  ------------------
  |  |  |  Branch (460:26): [True: 875, False: 727k]
  |  |  |  Branch (460:43): [True: 16, False: 859]
  |  |  ------------------
  ------------------
  503|     16|				return 0;
  504|   728k|			break;
  505|   728k|		}
  506|   728k|		if (hi) {
  ------------------
  |  Branch (506:7): [True: 478, False: 727k]
  ------------------
  507|    478|			if (!UCS16_LOSURR(uc))
  ------------------
  |  |  462|    478|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (462:26): [True: 427, False: 51]
  |  |  |  Branch (462:43): [True: 416, False: 11]
  |  |  ------------------
  ------------------
  508|     62|				return 0;
  509|    416|			uc = 0x10000 + 0x400 * (hi - 1) + (uc - 0xdc00);
  510|    416|			hi = 0;
  511|    416|		}
  512|   728k|		if (uc < 128 && text_chars[CAST(size_t, uc)] != T)
  ------------------
  |  |  444|  65.4k|#define CAST(T, b)	((T)(b))
  ------------------
              		if (uc < 128 && text_chars[CAST(size_t, uc)] != T)
  ------------------
  |  |  236|  65.4k|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (512:7): [True: 65.4k, False: 662k]
  |  Branch (512:19): [True: 48, False: 65.3k]
  ------------------
  513|     48|			return 0;
  514|   728k|		ubf[(*ulen)++] = uc;
  515|   728k|		if (UCS16_HISURR(uc))
  ------------------
  |  |  461|   728k|#define UCS16_HISURR(c) ((c) >= 0xd800 && (c) <= 0xdbff)
  |  |  ------------------
  |  |  |  Branch (461:26): [True: 67.4k, False: 660k]
  |  |  |  Branch (461:43): [True: 520, False: 66.8k]
  |  |  ------------------
  ------------------
  516|    520|			hi = uc - 0xd800 + 1;
  517|   728k|		if (UCS16_LOSURR(uc))
  ------------------
  |  |  462|   728k|#define UCS16_LOSURR(c) ((c) >= 0xdc00 && (c) <= 0xdfff)
  |  |  ------------------
  |  |  |  Branch (462:26): [True: 66.8k, False: 661k]
  |  |  |  Branch (462:43): [True: 40, False: 66.8k]
  |  |  ------------------
  ------------------
  518|     40|			return 0;
  519|   728k|	}
  520|       |
  521|    381|	return 1 + bigend;
  522|    561|}
encoding.c:looks_ucs32:
  527|  21.5k|{
  528|  21.5k|	int bigend;
  529|  21.5k|	size_t i;
  530|       |
  531|  21.5k|	if (nbytes < 4)
  ------------------
  |  Branch (531:6): [True: 1.15k, False: 20.3k]
  ------------------
  532|  1.15k|		return 0;
  533|       |
  534|  20.3k|	if (bf[0] == 0xff && bf[1] == 0xfe && bf[2] == 0 && bf[3] == 0)
  ------------------
  |  Branch (534:6): [True: 2.20k, False: 18.1k]
  |  Branch (534:23): [True: 401, False: 1.79k]
  |  Branch (534:40): [True: 208, False: 193]
  |  Branch (534:54): [True: 168, False: 40]
  ------------------
  535|    168|		bigend = 0;
  536|  20.1k|	else if (bf[0] == 0 && bf[1] == 0 && bf[2] == 0xfe && bf[3] == 0xff)
  ------------------
  |  Branch (536:11): [True: 1.26k, False: 18.9k]
  |  Branch (536:25): [True: 615, False: 652]
  |  Branch (536:39): [True: 237, False: 378]
  |  Branch (536:56): [True: 182, False: 55]
  ------------------
  537|    182|		bigend = 1;
  538|  19.9k|	else
  539|  19.9k|		return 0;
  540|       |
  541|    350|	*ulen = 0;
  542|       |
  543|   569k|	for (i = 4; i + 3 < nbytes; i += 4) {
  ------------------
  |  Branch (543:14): [True: 569k, False: 316]
  ------------------
  544|       |		/* XXX fix to properly handle chars > 65536 */
  545|       |
  546|   569k|		if (bigend)
  ------------------
  |  Branch (546:7): [True: 263k, False: 306k]
  ------------------
  547|   263k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 3])
  ------------------
  |  |  444|   263k|#define CAST(T, b)	((T)(b))
  ------------------
  548|   263k|			    | (CAST(file_unichar_t, bf[i + 2]) << 8)
  ------------------
  |  |  444|   263k|#define CAST(T, b)	((T)(b))
  ------------------
  549|   263k|			    | (CAST(file_unichar_t, bf[i + 1]) << 16)
  ------------------
  |  |  444|   263k|#define CAST(T, b)	((T)(b))
  ------------------
  550|   263k|			    | (CAST(file_unichar_t, bf[i]) << 24);
  ------------------
  |  |  444|   263k|#define CAST(T, b)	((T)(b))
  ------------------
  551|   306k|		else
  552|   306k|			ubf[(*ulen)++] = CAST(file_unichar_t, bf[i + 0])
  ------------------
  |  |  444|   306k|#define CAST(T, b)	((T)(b))
  ------------------
  553|   306k|			    | (CAST(file_unichar_t, bf[i + 1]) << 8) 
  ------------------
  |  |  444|   306k|#define CAST(T, b)	((T)(b))
  ------------------
  554|   306k|			    | (CAST(file_unichar_t, bf[i + 2]) << 16)
  ------------------
  |  |  444|   306k|#define CAST(T, b)	((T)(b))
  ------------------
  555|   306k|			    | (CAST(file_unichar_t, bf[i + 3]) << 24);
  ------------------
  |  |  444|   306k|#define CAST(T, b)	((T)(b))
  ------------------
  556|       |
  557|   569k|		if (ubf[*ulen - 1] == 0xfffe)
  ------------------
  |  Branch (557:7): [True: 7, False: 569k]
  ------------------
  558|      7|			return 0;
  559|   569k|		if (ubf[*ulen - 1] < 128 &&
  ------------------
  |  Branch (559:7): [True: 17.8k, False: 551k]
  ------------------
  560|   569k|		    text_chars[CAST(size_t, ubf[*ulen - 1])] != T)
  ------------------
  |  |  444|  17.8k|#define CAST(T, b)	((T)(b))
  ------------------
              		    text_chars[CAST(size_t, ubf[*ulen - 1])] != T)
  ------------------
  |  |  236|  17.8k|#define T 1   /* character appears in plain ASCII text */
  ------------------
  |  Branch (560:7): [True: 27, False: 17.8k]
  ------------------
  561|     27|			return 0;
  562|   569k|	}
  563|       |
  564|    316|	return 1 + bigend;
  565|    350|}
encoding.c:from_ebcdic:
  652|  19.4k|{
  653|  19.4k|	size_t i;
  654|       |
  655|  88.9M|	for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (655:14): [True: 88.8M, False: 19.4k]
  ------------------
  656|  88.8M|		out[i] = ebcdic_to_ascii[buf[i]];
  657|  88.8M|	}
  658|  19.4k|}

fmtcheck:
  236|  30.2k|{
  237|  30.2k|	const char	*f1p, *f2p;
  238|  30.2k|	EFT		f1t, f2t;
  239|       |
  240|  30.2k|	if (!f1) return f2;
  ------------------
  |  Branch (240:6): [True: 0, False: 30.2k]
  ------------------
  241|       |
  242|  30.2k|	f1p = f1;
  243|  30.2k|	f1t = FMTCHECK_START;
  244|  30.2k|	f2p = f2;
  245|  30.2k|	f2t = FMTCHECK_START;
  246|  60.5k|	while ((f1t = get_next_format(&f1p, f1t)) != FMTCHECK_DONE) {
  ------------------
  |  Branch (246:9): [True: 30.2k, False: 30.2k]
  ------------------
  247|  30.2k|		if (f1t == FMTCHECK_UNKNOWN)
  ------------------
  |  Branch (247:7): [True: 0, False: 30.2k]
  ------------------
  248|      0|			return f2;
  249|  30.2k|		f2t = get_next_format(&f2p, f2t);
  250|  30.2k|		if (f1t != f2t)
  ------------------
  |  Branch (250:7): [True: 0, False: 30.2k]
  ------------------
  251|      0|			return f2;
  252|  30.2k|	}
  253|  30.2k|	return f1;
  254|  30.2k|}
fmtcheck.c:get_next_format:
  190|  90.8k|{
  191|  90.8k|	int		infmt;
  192|  90.8k|	const char	*f;
  193|       |
  194|  90.8k|	if (eft == FMTCHECK_WIDTH) {
  ------------------
  |  Branch (194:6): [True: 0, False: 90.8k]
  ------------------
  195|      0|		(*pf)++;
  196|      0|		return get_next_format_from_width(pf);
  197|  90.8k|	} else if (eft == FMTCHECK_PRECISION) {
  ------------------
  |  Branch (197:13): [True: 0, False: 90.8k]
  ------------------
  198|      0|		(*pf)++;
  199|      0|		return get_next_format_from_precision(pf);
  200|      0|	}
  201|       |
  202|  90.8k|	f = *pf;
  203|  90.8k|	infmt = 0;
  204|   151k|	while (!infmt) {
  ------------------
  |  Branch (204:9): [True: 90.8k, False: 60.5k]
  ------------------
  205|  90.8k|		f = strchr(f, '%');
  206|  90.8k|		if (f == NULL)
  ------------------
  |  Branch (206:7): [True: 30.2k, False: 60.5k]
  ------------------
  207|  30.2k|			RETURN(pf,f,FMTCHECK_DONE);
  ------------------
  |  |   60|  30.2k|#define RETURN(pf,f,r) do { \
  |  |   61|  30.2k|			*(pf) = (f); \
  |  |   62|  30.2k|			return r; \
  |  |   63|  30.2k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  208|  60.5k|		f++;
  209|  60.5k|		if (!*f)
  ------------------
  |  Branch (209:7): [True: 0, False: 60.5k]
  ------------------
  210|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  211|  60.5k|		if (*f != '%')
  ------------------
  |  Branch (211:7): [True: 60.5k, False: 0]
  ------------------
  212|  60.5k|			infmt = 1;
  213|      0|		else
  214|      0|			f++;
  215|  60.5k|	}
  216|       |
  217|       |	/* Eat any of the flags */
  218|  66.0k|	while (*f && (strchr("#0- +", *f)))
  ------------------
  |  Branch (218:9): [True: 66.0k, False: 0]
  |  Branch (218:15): [True: 5.48k, False: 60.5k]
  ------------------
  219|  5.48k|		f++;
  220|       |
  221|  60.5k|	if (*f == '*') {
  ------------------
  |  Branch (221:6): [True: 0, False: 60.5k]
  ------------------
  222|      0|		RETURN(pf,f,FMTCHECK_WIDTH);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  223|      0|	}
  224|       |	/* eat any width */
  225|  60.5k|	while (isdigit((unsigned char)*f)) f++;
  226|  60.5k|	if (!*f) {
  ------------------
  |  Branch (226:6): [True: 0, False: 60.5k]
  ------------------
  227|      0|		RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  228|      0|	}
  229|       |
  230|  60.5k|	RETURN(pf,f,get_next_format_from_width(pf));
  ------------------
  |  |   60|  60.5k|#define RETURN(pf,f,r) do { \
  |  |   61|  60.5k|			*(pf) = (f); \
  |  |   62|  60.5k|			return r; \
  |  |   63|  60.5k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  231|       |	/*NOTREACHED*/
  232|  60.5k|}
fmtcheck.c:get_next_format_from_width:
  171|  60.5k|{
  172|  60.5k|	const char	*f;
  173|       |
  174|  60.5k|	f = *pf;
  175|  60.5k|	if (*f == '.') {
  ------------------
  |  Branch (175:6): [True: 2.36k, False: 58.1k]
  ------------------
  176|  2.36k|		f++;
  177|  2.36k|		if (*f == '*') {
  ------------------
  |  Branch (177:7): [True: 0, False: 2.36k]
  ------------------
  178|      0|			RETURN(pf,f,FMTCHECK_PRECISION);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  179|      0|		}
  180|       |		/* eat any precision (empty is allowed) */
  181|  3.03k|		while (isdigit((unsigned char)*f)) f++;
  182|  2.36k|		if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (182:7): [True: 0, False: 2.36k]
  ------------------
  183|  2.36k|	}
  184|  60.5k|	RETURN(pf,f,get_next_format_from_precision(pf));
  ------------------
  |  |   60|  60.5k|#define RETURN(pf,f,r) do { \
  |  |   61|  60.5k|			*(pf) = (f); \
  |  |   62|  60.5k|			return r; \
  |  |   63|  60.5k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  185|       |	/*NOTREACHED*/
  186|  60.5k|}
fmtcheck.c:get_next_format_from_precision:
   67|  60.5k|{
   68|  60.5k|	int		sh, lg, quad, longdouble;
   69|  60.5k|	const char	*f;
   70|       |
   71|  60.5k|	sh = lg = quad = longdouble = 0;
   72|       |
   73|  60.5k|	f = *pf;
   74|  60.5k|	switch (*f) {
   75|      0|	case 'h':
  ------------------
  |  Branch (75:2): [True: 0, False: 60.5k]
  ------------------
   76|      0|		f++;
   77|      0|		sh = 1;
   78|      0|		break;
   79|  1.84k|	case 'l':
  ------------------
  |  Branch (79:2): [True: 1.84k, False: 58.6k]
  ------------------
   80|  1.84k|		f++;
   81|  1.84k|		if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (81:7): [True: 0, False: 1.84k]
  ------------------
   82|  1.84k|		if (*f == 'l') {
  ------------------
  |  Branch (82:7): [True: 1.84k, False: 0]
  ------------------
   83|  1.84k|			f++;
   84|  1.84k|			quad = 1;
   85|  1.84k|		} else {
   86|      0|			lg = 1;
   87|      0|		}
   88|  1.84k|		break;
   89|      0|	case 'q':
  ------------------
  |  Branch (89:2): [True: 0, False: 60.5k]
  ------------------
   90|      0|		f++;
   91|      0|		quad = 1;
   92|      0|		break;
   93|      0|	case 'L':
  ------------------
  |  Branch (93:2): [True: 0, False: 60.5k]
  ------------------
   94|      0|		f++;
   95|      0|		longdouble = 1;
   96|      0|		break;
   97|       |#ifdef WIN32
   98|       |	case 'I':
   99|       |		f++;
  100|       |		if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
  101|       |		if (*f == '3' && f[1] == '2') {
  102|       |			f += 2;
  103|       |		} else if (*f == '6' && f[1] == '4') {
  104|       |			f += 2;
  105|       |			quad = 1;
  106|       |		}
  107|       |#ifdef _WIN64
  108|       |		else {
  109|       |			quad = 1;
  110|       |		}
  111|       |#endif
  112|       |		break;
  113|       |#endif
  114|  58.6k|	default:
  ------------------
  |  Branch (114:2): [True: 58.6k, False: 1.84k]
  ------------------
  115|  58.6k|		break;
  116|  60.5k|	}
  117|  60.5k|	if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  |  Branch (117:6): [True: 0, False: 60.5k]
  ------------------
  118|  60.5k|	if (strchr("diouxX", *f)) {
  ------------------
  |  Branch (118:6): [True: 43.5k, False: 16.9k]
  ------------------
  119|  43.5k|		if (longdouble)
  ------------------
  |  Branch (119:7): [True: 0, False: 43.5k]
  ------------------
  120|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  121|  43.5k|		if (lg)
  ------------------
  |  Branch (121:7): [True: 0, False: 43.5k]
  ------------------
  122|      0|			RETURN(pf,f,FMTCHECK_LONG);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  123|  43.5k|		if (quad)
  ------------------
  |  Branch (123:7): [True: 1.84k, False: 41.7k]
  ------------------
  124|  1.84k|			RETURN(pf,f,FMTCHECK_QUAD);
  ------------------
  |  |   60|  1.84k|#define RETURN(pf,f,r) do { \
  |  |   61|  1.84k|			*(pf) = (f); \
  |  |   62|  1.84k|			return r; \
  |  |   63|  1.84k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  125|  41.7k|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|  41.7k|#define RETURN(pf,f,r) do { \
  |  |   61|  41.7k|			*(pf) = (f); \
  |  |   62|  41.7k|			return r; \
  |  |   63|  41.7k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  126|  41.7k|	}
  127|  16.9k|	if (*f == 'n') {
  ------------------
  |  Branch (127:6): [True: 0, False: 16.9k]
  ------------------
  128|      0|		if (longdouble)
  ------------------
  |  Branch (128:7): [True: 0, False: 0]
  ------------------
  129|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  130|      0|		if (sh)
  ------------------
  |  Branch (130:7): [True: 0, False: 0]
  ------------------
  131|      0|			RETURN(pf,f,FMTCHECK_SHORTPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  132|      0|		if (lg)
  ------------------
  |  Branch (132:7): [True: 0, False: 0]
  ------------------
  133|      0|			RETURN(pf,f,FMTCHECK_LONGPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  134|      0|		if (quad)
  ------------------
  |  Branch (134:7): [True: 0, False: 0]
  ------------------
  135|      0|			RETURN(pf,f,FMTCHECK_QUADPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  136|      0|		RETURN(pf,f,FMTCHECK_INTPOINTER);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  137|      0|	}
  138|  16.9k|	if (strchr("DOU", *f)) {
  ------------------
  |  Branch (138:6): [True: 0, False: 16.9k]
  ------------------
  139|      0|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (139:7): [True: 0, False: 0]
  ------------------
  140|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  141|      0|		RETURN(pf,f,FMTCHECK_LONG);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  142|      0|	}
  143|  16.9k|	if (strchr("eEfg", *f)) {
  ------------------
  |  Branch (143:6): [True: 1.03k, False: 15.9k]
  ------------------
  144|  1.03k|		if (longdouble)
  ------------------
  |  Branch (144:7): [True: 0, False: 1.03k]
  ------------------
  145|      0|			RETURN(pf,f,FMTCHECK_LONGDOUBLE);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  146|  1.03k|		if (sh + lg + quad)
  ------------------
  |  Branch (146:7): [True: 0, False: 1.03k]
  ------------------
  147|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  148|  1.03k|		RETURN(pf,f,FMTCHECK_DOUBLE);
  ------------------
  |  |   60|  1.03k|#define RETURN(pf,f,r) do { \
  |  |   61|  1.03k|			*(pf) = (f); \
  |  |   62|  1.03k|			return r; \
  |  |   63|  1.03k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  149|  1.03k|	}
  150|  15.9k|	if (*f == 'c') {
  ------------------
  |  Branch (150:6): [True: 483, False: 15.4k]
  ------------------
  151|    483|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (151:7): [True: 0, False: 483]
  ------------------
  152|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  153|    483|		RETURN(pf,f,FMTCHECK_INT);
  ------------------
  |  |   60|    483|#define RETURN(pf,f,r) do { \
  |  |   61|    483|			*(pf) = (f); \
  |  |   62|    483|			return r; \
  |  |   63|    483|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  154|    483|	}
  155|  15.4k|	if (*f == 's') {
  ------------------
  |  Branch (155:6): [True: 15.4k, False: 0]
  ------------------
  156|  15.4k|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (156:7): [True: 0, False: 15.4k]
  ------------------
  157|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  158|  15.4k|		RETURN(pf,f,FMTCHECK_STRING);
  ------------------
  |  |   60|  15.4k|#define RETURN(pf,f,r) do { \
  |  |   61|  15.4k|			*(pf) = (f); \
  |  |   62|  15.4k|			return r; \
  |  |   63|  15.4k|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  159|  15.4k|	}
  160|      0|	if (*f == 'p') {
  ------------------
  |  Branch (160:6): [True: 0, False: 0]
  ------------------
  161|      0|		if (sh + lg + quad + longdouble)
  ------------------
  |  Branch (161:7): [True: 0, False: 0]
  ------------------
  162|      0|			RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  163|      0|		RETURN(pf,f,FMTCHECK_LONG);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  164|      0|	}
  165|      0|	RETURN(pf,f,FMTCHECK_UNKNOWN);
  ------------------
  |  |   60|      0|#define RETURN(pf,f,r) do { \
  |  |   61|      0|			*(pf) = (f); \
  |  |   62|      0|			return r; \
  |  |   63|      0|		       } /*NOTREACHED*/ /*CONSTCOND*/ while (0)
  |  |  ------------------
  |  |  |  Branch (63:48): [Folded - Ignored]
  |  |  ------------------
  ------------------
  166|       |	/*NOTREACHED*/
  167|      0|}

file_checkfmt:
   95|   271k|{
   96|   271k|	const char *p;
   97|  1.89M|	for (p = fmt; *p; p++) {
  ------------------
  |  Branch (97:16): [True: 1.62M, False: 271k]
  ------------------
   98|  1.62M|		if (*p != '%')
  ------------------
  |  Branch (98:7): [True: 1.50M, False: 115k]
  ------------------
   99|  1.50M|			continue;
  100|   115k|		if (*++p == '%')
  ------------------
  |  Branch (100:7): [True: 0, False: 115k]
  ------------------
  101|      0|			continue;
  102|       |		// Skip uninteresting.
  103|   121k|		while (strchr("#0.'+- ", *p) != NULL)
  ------------------
  |  Branch (103:10): [True: 6.14k, False: 115k]
  ------------------
  104|  6.14k|			p++;
  105|   115k|		if (*p == '*') {
  ------------------
  |  Branch (105:7): [True: 0, False: 115k]
  ------------------
  106|      0|			if (msg)
  ------------------
  |  Branch (106:8): [True: 0, False: 0]
  ------------------
  107|      0|				snprintf(msg, mlen, "* not allowed in format");
  108|      0|			return -1;
  109|      0|		}
  110|       |
  111|   115k|		if (!file_checkfield(msg, mlen, "width", &p))
  ------------------
  |  Branch (111:7): [True: 0, False: 115k]
  ------------------
  112|      0|			return -1;
  113|       |
  114|   115k|		if (*p == '.') {
  ------------------
  |  Branch (114:7): [True: 1.69k, False: 113k]
  ------------------
  115|  1.69k|			p++;
  116|  1.69k|			if (!file_checkfield(msg, mlen, "precision", &p))
  ------------------
  |  Branch (116:8): [True: 0, False: 1.69k]
  ------------------
  117|      0|				return -1;
  118|  1.69k|		}
  119|       |
  120|   115k|		if (!isalpha((unsigned char)*p)) {
  ------------------
  |  Branch (120:7): [True: 0, False: 115k]
  ------------------
  121|      0|			if (msg)
  ------------------
  |  Branch (121:8): [True: 0, False: 0]
  ------------------
  122|      0|				snprintf(msg, mlen, "bad format char: %c", *p);
  123|      0|			return -1;
  124|      0|		}
  125|   115k|	}
  126|   271k|	return 0;
  127|   271k|}
file_vprintf:
  134|   280k|{
  135|   280k|	int len;
  136|   280k|	char *buf, *newstr;
  137|   280k|	char tbuf[1024];
  138|       |
  139|   280k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|   280k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (139:6): [True: 8.19k, False: 271k]
  ------------------
  140|  8.19k|		return 0;
  141|       |
  142|   271k|	if (file_checkfmt(tbuf, sizeof(tbuf), fmt)) {
  ------------------
  |  Branch (142:6): [True: 0, False: 271k]
  ------------------
  143|      0|		file_clearbuf(ms);
  144|      0|		file_error(ms, 0, "Bad magic format `%s' (%s)", fmt, tbuf);
  145|      0|		return -1;
  146|      0|	}
  147|       |
  148|   271k|	len = vasprintf(&buf, fmt, ap);
  149|   271k|	if (len < 0 || (size_t)len > 1024 || len + ms->o.blen > 1024 * 1024) {
  ------------------
  |  Branch (149:6): [True: 0, False: 271k]
  |  Branch (149:17): [True: 108, False: 271k]
  |  Branch (149:39): [True: 0, False: 271k]
  ------------------
  150|    108|		size_t blen = ms->o.blen;
  151|    108|		free(buf);
  152|    108|		file_clearbuf(ms);
  153|    108|		file_error(ms, 0, "Output buffer space exceeded %d+%"
  154|    108|		    SIZE_T_FORMAT "u", len, blen);
  155|    108|		return -1;
  156|    108|	}
  157|       |
  158|   271k|	if (ms->o.buf != NULL) {
  ------------------
  |  Branch (158:6): [True: 246k, False: 25.7k]
  ------------------
  159|   246k|		len = asprintf(&newstr, "%s%s", ms->o.buf, buf);
  160|   246k|		free(buf);
  161|   246k|		if (len < 0)
  ------------------
  |  Branch (161:7): [True: 0, False: 246k]
  ------------------
  162|      0|			goto out;
  163|   246k|		free(ms->o.buf);
  164|   246k|		buf = newstr;
  165|   246k|	}
  166|   271k|	ms->o.buf = buf;
  167|   271k|	ms->o.blen = len;
  168|   271k|	return 0;
  169|      0|out:
  170|      0|	file_clearbuf(ms);
  171|      0|	file_error(ms, errno, "vasprintf failed");
  172|      0|	return -1;
  173|   271k|}
file_printf:
  177|   279k|{
  178|   279k|	int rv;
  179|   279k|	va_list ap;
  180|       |
  181|   279k|	va_start(ap, fmt);
  182|   279k|	rv = file_vprintf(ms, fmt, ap);
  183|   279k|	va_end(ap);
  184|   279k|	return rv;
  185|   279k|}
file_error:
  215|    805|{
  216|    805|	va_list va;
  217|    805|	va_start(va, f);
  218|    805|	file_error_core(ms, error, f, va, 0);
  219|    805|	va_end(va);
  220|    805|}
file_separator:
  259|  44.1k|{
  260|  44.1k|	return file_printf(ms, FILE_SEPARATOR);
  ------------------
  |  |  255|  44.1k|#define FILE_SEPARATOR "\n- "
  ------------------
  261|  44.1k|}
file_default:
  294|  8.24k|{
  295|  8.24k|	if (ms->flags & MAGIC_MIME) {
  ------------------
  |  |   44|  8.24k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  8.24k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  8.24k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  |  Branch (295:6): [True: 0, False: 8.24k]
  ------------------
  296|      0|		if ((ms->flags & MAGIC_MIME_TYPE) &&
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (296:7): [True: 0, False: 0]
  ------------------
  297|      0|		    file_printf(ms, "application/%s",
  ------------------
  |  Branch (297:7): [True: 0, False: 0]
  ------------------
  298|      0|			nb ? "octet-stream" : "x-empty") == -1)
  ------------------
  |  Branch (298:4): [True: 0, False: 0]
  ------------------
  299|      0|			return -1;
  300|      0|		return 1;
  301|      0|	}
  302|  8.24k|	if (ms->flags & MAGIC_APPLE) {
  ------------------
  |  |   45|  8.24k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (302:6): [True: 0, False: 8.24k]
  ------------------
  303|      0|		if (file_printf(ms, "UNKNUNKN") == -1)
  ------------------
  |  Branch (303:7): [True: 0, False: 0]
  ------------------
  304|      0|			return -1;
  305|      0|		return 1;
  306|      0|	}
  307|  8.24k|	if (ms->flags & MAGIC_EXTENSION) {
  ------------------
  |  |   46|  8.24k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (307:6): [True: 0, False: 8.24k]
  ------------------
  308|      0|		if (file_printf(ms, "???") == -1)
  ------------------
  |  Branch (308:7): [True: 0, False: 0]
  ------------------
  309|      0|			return -1;
  310|      0|		return 1;
  311|      0|	}
  312|  8.24k|	return 0;
  313|  8.24k|}
file_buffer:
  326|  13.0k|{
  327|  13.0k|	int m = 0, rv = 0, looks_text = 0;
  328|  13.0k|	const char *code = NULL;
  329|  13.0k|	const char *code_mime = "binary";
  330|  13.0k|	const char *def = "data";
  331|  13.0k|	const char *ftype = NULL;
  332|  13.0k|	char *rbuf = NULL;
  333|  13.0k|	struct buffer b;
  334|       |
  335|  13.0k|	buffer_init(&b, fd, st, buf, nb);
  336|  13.0k|	ms->mode = b.st.st_mode;
  337|       |
  338|  13.0k|	if (nb == 0) {
  ------------------
  |  Branch (338:6): [True: 16, False: 13.0k]
  ------------------
  339|     16|		def = "empty";
  340|     16|		goto simple;
  341|  13.0k|	} else if (nb == 1) {
  ------------------
  |  Branch (341:13): [True: 6, False: 13.0k]
  ------------------
  342|      6|		def = "very short file (no magic)";
  343|      6|		goto simple;
  344|      6|	}
  345|       |
  346|  13.0k|	if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) {
  ------------------
  |  |   63|  13.0k|#define MAGIC_NO_CHECK_ENCODING 0x0200000 /* Don't check text encodings */
  ------------------
  |  Branch (346:6): [True: 13.0k, False: 0]
  ------------------
  347|  13.0k|		looks_text = file_encoding(ms, &b, NULL, 0,
  348|  13.0k|		    &code, &code_mime, &ftype);
  349|  13.0k|	}
  350|       |
  351|       |#ifdef __EMX__
  352|       |	if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) {
  353|       |		m = file_os2_apptype(ms, inname, &b);
  354|       |		if ((ms->flags & MAGIC_DEBUG) != 0)
  355|       |			(void)fprintf(stderr, "[try os2_apptype %d]\n", m);
  356|       |		switch (m) {
  357|       |		case -1:
  358|       |			return -1;
  359|       |		case 0:
  360|       |			break;
  361|       |		default:
  362|       |			return 1;
  363|       |		}
  364|       |	}
  365|       |#endif
  366|  13.0k|#if HAVE_FORK
  367|       |	/* try compression stuff */
  368|  13.0k|	if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) == 0) {
  ------------------
  |  |   54|  13.0k|#define	MAGIC_NO_CHECK_COMPRESS	0x0001000 /* Don't check for compressed files */
  ------------------
  |  Branch (368:6): [True: 13.0k, False: 0]
  ------------------
  369|  13.0k|		m = file_zmagic(ms, &b, inname);
  370|  13.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  13.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (370:7): [True: 0, False: 13.0k]
  ------------------
  371|      0|			(void)fprintf(stderr, "[try zmagic %d]\n", m);
  372|  13.0k|		if (m) {
  ------------------
  |  Branch (372:7): [True: 2.62k, False: 10.4k]
  ------------------
  373|  2.62k|			goto done_encoding;
  374|  2.62k|		}
  375|  13.0k|	}
  376|  10.4k|#endif
  377|       |	/* Check if we have a tar file */
  378|  10.4k|	if ((ms->flags & MAGIC_NO_CHECK_TAR) == 0) {
  ------------------
  |  |   55|  10.4k|#define	MAGIC_NO_CHECK_TAR	0x0002000 /* Don't check for tar files */
  ------------------
  |  Branch (378:6): [True: 10.4k, False: 0]
  ------------------
  379|  10.4k|		m = file_is_tar(ms, &b);
  380|  10.4k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.4k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (380:7): [True: 0, False: 10.4k]
  ------------------
  381|      0|			(void)fprintf(stderr, "[try tar %d]\n", m);
  382|  10.4k|		if (m) {
  ------------------
  |  Branch (382:7): [True: 25, False: 10.3k]
  ------------------
  383|     25|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (383:8): [True: 0, False: 25]
  ------------------
  384|      0|				goto done;
  385|     25|		}
  386|  10.4k|	}
  387|       |
  388|       |	/* Check if we have a JSON file */
  389|  10.4k|	if ((ms->flags & MAGIC_NO_CHECK_JSON) == 0) {
  ------------------
  |  |   64|  10.4k|#define MAGIC_NO_CHECK_JSON	0x0400000 /* Don't check for JSON files */
  ------------------
  |  Branch (389:6): [True: 10.4k, False: 0]
  ------------------
  390|  10.4k|		m = file_is_json(ms, &b);
  391|  10.4k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.4k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (391:7): [True: 0, False: 10.4k]
  ------------------
  392|      0|			(void)fprintf(stderr, "[try json %d]\n", m);
  393|  10.4k|		if (m) {
  ------------------
  |  Branch (393:7): [True: 40, False: 10.3k]
  ------------------
  394|     40|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (394:8): [True: 0, False: 40]
  ------------------
  395|      0|				goto done;
  396|     40|		}
  397|  10.4k|	}
  398|       |
  399|       |	/* Check if we have a CSV file */
  400|  10.4k|	if ((ms->flags & MAGIC_NO_CHECK_CSV) == 0) {
  ------------------
  |  |   61|  10.4k|#define MAGIC_NO_CHECK_CSV	0x0080000 /* Don't check for CSV files */
  ------------------
  |  Branch (400:6): [True: 10.4k, False: 0]
  ------------------
  401|  10.4k|		m = file_is_csv(ms, &b, looks_text, code);
  402|  10.4k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.4k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (402:7): [True: 0, False: 10.4k]
  ------------------
  403|      0|			(void)fprintf(stderr, "[try csv %d]\n", m);
  404|  10.4k|		if (m) {
  ------------------
  |  Branch (404:7): [True: 7, False: 10.3k]
  ------------------
  405|      7|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (405:8): [True: 0, False: 7]
  ------------------
  406|      0|				goto done;
  407|      7|		}
  408|  10.4k|	}
  409|       |
  410|       |	/* Check if we have a SIMH tape file */
  411|  10.4k|	if ((ms->flags & MAGIC_NO_CHECK_SIMH) == 0) {
  ------------------
  |  |   65|  10.4k|#define MAGIC_NO_CHECK_SIMH	0x0800000 /* Don't check for SIMH tape files */
  ------------------
  |  Branch (411:6): [True: 10.4k, False: 0]
  ------------------
  412|  10.4k|		m = file_is_simh(ms, &b);
  413|  10.4k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.4k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (413:7): [True: 0, False: 10.4k]
  ------------------
  414|      0|			(void)fprintf(stderr, "[try simh %d]\n", m);
  415|  10.4k|		if (m) {
  ------------------
  |  Branch (415:7): [True: 37, False: 10.3k]
  ------------------
  416|     37|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (416:8): [True: 0, False: 37]
  ------------------
  417|      0|				goto done;
  418|     37|		}
  419|  10.4k|	}
  420|       |
  421|       |	/* Check if we have a CDF file */
  422|  10.4k|	if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) {
  ------------------
  |  |   60|  10.4k|#define	MAGIC_NO_CHECK_CDF	0x0040000 /* Don't check for cdf files */
  ------------------
  |  Branch (422:6): [True: 10.4k, False: 0]
  ------------------
  423|  10.4k|		m = file_trycdf(ms, &b);
  424|  10.4k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.4k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (424:7): [True: 0, False: 10.4k]
  ------------------
  425|      0|			(void)fprintf(stderr, "[try cdf %d]\n", m);
  426|  10.4k|		if (m) {
  ------------------
  |  Branch (426:7): [True: 1.88k, False: 8.52k]
  ------------------
  427|  1.88k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (427:8): [True: 0, False: 1.88k]
  ------------------
  428|      0|				goto done;
  429|  1.88k|		}
  430|  10.4k|	}
  431|  10.4k|#ifdef BUILTIN_ELF
  432|  10.4k|	if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && nb > 5 && fd != -1) {
  ------------------
  |  |   58|  10.4k|#define	MAGIC_NO_CHECK_ELF	0x0010000 /* Don't check for elf details */
  ------------------
  |  Branch (432:6): [True: 10.4k, False: 0]
  |  Branch (432:47): [True: 8.91k, False: 1.49k]
  |  Branch (432:57): [True: 0, False: 8.91k]
  ------------------
  433|      0|		file_pushbuf_t *pb;
  434|       |		/*
  435|       |		 * We matched something in the file, so this
  436|       |		 * *might* be an ELF file, and the file is at
  437|       |		 * least 5 bytes long, so if it's an ELF file
  438|       |		 * it has at least one byte past the ELF magic
  439|       |		 * number - try extracting information from the
  440|       |		 * ELF headers that cannot easily be  extracted
  441|       |		 * with rules in the magic file. We we don't
  442|       |		 * print the information yet.
  443|       |		 */
  444|      0|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (444:7): [True: 0, False: 0]
  ------------------
  445|      0|			return -1;
  446|       |
  447|      0|		rv = file_tryelf(ms, &b);
  448|      0|		rbuf = file_pop_buffer(ms, pb);
  449|      0|		if (rv == -1) {
  ------------------
  |  Branch (449:7): [True: 0, False: 0]
  ------------------
  450|      0|			free(rbuf);
  451|      0|			rbuf = NULL;
  452|      0|		}
  453|      0|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (453:7): [True: 0, False: 0]
  ------------------
  454|      0|			(void)fprintf(stderr, "[try elf %d]\n", m);
  455|      0|	}
  456|  10.4k|#endif
  457|       |
  458|       |	/* try soft magic tests */
  459|  10.4k|	if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
  ------------------
  |  |   56|  10.4k|#define	MAGIC_NO_CHECK_SOFT	0x0004000 /* Don't check magic entries */
  ------------------
  |  Branch (459:6): [True: 10.4k, False: 0]
  ------------------
  460|  10.4k|		m = file_softmagic(ms, &b, NULL, NULL, BINTEST, looks_text);
  ------------------
  |  |  228|  10.4k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
  461|  10.4k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.4k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (461:7): [True: 0, False: 10.4k]
  ------------------
  462|      0|			(void)fprintf(stderr, "[try softmagic %d]\n", m);
  463|  10.4k|		if (m == 1 && rbuf) {
  ------------------
  |  Branch (463:7): [True: 7.23k, False: 3.17k]
  |  Branch (463:17): [True: 0, False: 7.23k]
  ------------------
  464|      0|			if (file_printf(ms, "%s", rbuf) == -1)
  ------------------
  |  Branch (464:8): [True: 0, False: 0]
  ------------------
  465|      0|				goto done;
  466|      0|		}
  467|  10.4k|		if (m) {
  ------------------
  |  Branch (467:7): [True: 7.37k, False: 3.02k]
  ------------------
  468|  7.37k|			if (checkdone(ms, &rv))
  ------------------
  |  Branch (468:8): [True: 0, False: 7.37k]
  ------------------
  469|      0|				goto done;
  470|  7.37k|		}
  471|  10.4k|	}
  472|       |
  473|       |	/* try text properties */
  474|  10.4k|	if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) {
  ------------------
  |  |   59|  10.4k|#define	MAGIC_NO_CHECK_TEXT	0x0020000 /* Don't check for text files */
  ------------------
  |  Branch (474:6): [True: 10.4k, False: 0]
  ------------------
  475|       |
  476|  10.4k|		m = file_ascmagic(ms, &b, looks_text);
  477|  10.4k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  10.4k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (477:7): [True: 0, False: 10.4k]
  ------------------
  478|      0|			(void)fprintf(stderr, "[try ascmagic %d]\n", m);
  479|  10.4k|		if (m) {
  ------------------
  |  Branch (479:7): [True: 2.18k, False: 8.22k]
  ------------------
  480|  2.18k|			goto done;
  481|  2.18k|		}
  482|  10.4k|	}
  483|       |
  484|  8.24k|simple:
  485|       |	/* give up */
  486|  8.24k|	if (m == 0) {
  ------------------
  |  Branch (486:6): [True: 8.24k, False: 0]
  ------------------
  487|  8.24k|		m = 1;
  488|  8.24k|		rv = file_default(ms, nb);
  489|  8.24k|		if (rv == 0)
  ------------------
  |  Branch (489:7): [True: 8.24k, False: 0]
  ------------------
  490|  8.24k|			if (file_printf(ms, "%s", def) == -1)
  ------------------
  |  Branch (490:8): [True: 0, False: 8.24k]
  ------------------
  491|      0|				rv = -1;
  492|  8.24k|	}
  493|  10.4k| done:
  494|  10.4k|	trim_separator(ms);
  495|  10.4k|	if ((ms->flags & MAGIC_MIME_ENCODING) != 0) {
  ------------------
  |  |   43|  10.4k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (495:6): [True: 0, False: 10.4k]
  ------------------
  496|      0|		if (ms->flags & MAGIC_MIME_TYPE)
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (496:7): [True: 0, False: 0]
  ------------------
  497|      0|			if (file_printf(ms, "; charset=") == -1)
  ------------------
  |  Branch (497:8): [True: 0, False: 0]
  ------------------
  498|      0|				rv = -1;
  499|      0|		if (file_printf(ms, "%s", code_mime) == -1)
  ------------------
  |  Branch (499:7): [True: 0, False: 0]
  ------------------
  500|      0|			rv = -1;
  501|      0|	}
  502|  10.4k|#if HAVE_FORK
  503|  13.0k| done_encoding:
  504|  13.0k|#endif
  505|  13.0k|	free(rbuf);
  506|  13.0k|	buffer_fini(&b);
  507|  13.0k|	if (rv)
  ------------------
  |  Branch (507:6): [True: 0, False: 13.0k]
  ------------------
  508|      0|		return rv;
  509|       |
  510|  13.0k|	return m;
  511|  13.0k|}
file_reset:
  516|  7.45k|{
  517|  7.45k|	if (checkloaded && ms->mlist[0] == NULL) {
  ------------------
  |  Branch (517:6): [True: 7.45k, False: 2]
  |  Branch (517:21): [True: 0, False: 7.45k]
  ------------------
  518|      0|		file_error(ms, 0, "no magic files loaded");
  519|      0|		return -1;
  520|      0|	}
  521|  7.45k|	file_clearbuf(ms);
  522|  7.45k|	if (ms->o.pbuf) {
  ------------------
  |  Branch (522:6): [True: 7.25k, False: 204]
  ------------------
  523|  7.25k|		free(ms->o.pbuf);
  524|  7.25k|		ms->o.pbuf = NULL;
  525|  7.25k|	}
  526|  7.45k|	ms->event_flags &= ~EVENT_HAD_ERR;
  ------------------
  |  |  479|  7.45k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  527|  7.45k|	ms->error = -1;
  528|  7.45k|	return 0;
  529|  7.45k|}
file_getbuffer:
  541|  7.39k|{
  542|  7.39k|	char *pbuf, *op, *np;
  543|  7.39k|	size_t psize, len;
  544|       |
  545|  7.39k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|  7.39k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (545:6): [True: 143, False: 7.25k]
  ------------------
  546|    143|		return NULL;
  547|       |
  548|  7.25k|	if (ms->flags & MAGIC_RAW)
  ------------------
  |  |   41|  7.25k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (548:6): [True: 0, False: 7.25k]
  ------------------
  549|      0|		return ms->o.buf;
  550|       |
  551|  7.25k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (551:6): [True: 0, False: 7.25k]
  ------------------
  552|      0|		return NULL;
  553|       |
  554|       |	/* * 4 is for octal representation, + 1 is for NUL */
  555|  7.25k|	len = strlen(ms->o.buf);
  556|  7.25k|	if (len > (SIZE_MAX - 1) / 4) {
  ------------------
  |  Branch (556:6): [True: 0, False: 7.25k]
  ------------------
  557|      0|		file_oomem(ms, len);
  558|      0|		return NULL;
  559|      0|	}
  560|  7.25k|	psize = len * 4 + 1;
  561|  7.25k|	if ((pbuf = CAST(char *, realloc(ms->o.pbuf, psize))) == NULL) {
  ------------------
  |  |  444|  7.25k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (561:6): [True: 0, False: 7.25k]
  ------------------
  562|      0|		file_oomem(ms, psize);
  563|      0|		return NULL;
  564|      0|	}
  565|  7.25k|	ms->o.pbuf = pbuf;
  566|       |
  567|  7.25k|#if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
  568|  7.25k|	{
  569|  7.25k|		mbstate_t state;
  570|  7.25k|		wchar_t nextchar;
  571|  7.25k|		int mb_conv = 1;
  572|  7.25k|		size_t bytesconsumed;
  573|  7.25k|		char *eop;
  574|  7.25k|		(void)memset(&state, 0, sizeof(mbstate_t));
  575|       |
  576|  7.25k|		np = ms->o.pbuf;
  577|  7.25k|		op = ms->o.buf;
  578|  7.25k|		eop = op + len;
  579|       |
  580|  1.44M|		while (op < eop) {
  ------------------
  |  Branch (580:10): [True: 1.43M, False: 7.22k]
  ------------------
  581|  1.43M|			bytesconsumed = mbrtowc(&nextchar, op,
  582|  1.43M|			    CAST(size_t, eop - op), &state);
  ------------------
  |  |  444|  1.43M|#define CAST(T, b)	((T)(b))
  ------------------
  583|  1.43M|			if (bytesconsumed == CAST(size_t, -1) ||
  ------------------
  |  |  444|  2.86M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (583:8): [True: 29, False: 1.43M]
  ------------------
  584|  1.43M|			    bytesconsumed == CAST(size_t, -2)) {
  ------------------
  |  |  444|  1.43M|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (584:8): [True: 0, False: 1.43M]
  ------------------
  585|     29|				mb_conv = 0;
  586|     29|				break;
  587|     29|			}
  588|       |
  589|  1.43M|			if (iswprint(nextchar)) {
  ------------------
  |  Branch (589:8): [True: 1.40M, False: 29.4k]
  ------------------
  590|  1.40M|				(void)memcpy(np, op, bytesconsumed);
  591|  1.40M|				op += bytesconsumed;
  592|  1.40M|				np += bytesconsumed;
  593|  1.40M|			} else {
  594|  58.9k|				while (bytesconsumed-- > 0)
  ------------------
  |  Branch (594:12): [True: 29.4k, False: 29.4k]
  ------------------
  595|  29.4k|					OCTALIFY(np, op);
  ------------------
  |  |  533|  29.4k|	(void)(*(n)++ = '\\', \
  |  |  534|  29.4k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  444|  29.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  535|  29.4k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  444|  29.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  536|  29.4k|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  444|  29.4k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  537|  29.4k|	(o)++)
  ------------------
  596|  29.4k|			}
  597|  1.43M|		}
  598|  7.25k|		*np = '\0';
  599|       |
  600|       |		/* Parsing succeeded as a multi-byte sequence */
  601|  7.25k|		if (mb_conv != 0)
  ------------------
  |  Branch (601:7): [True: 7.22k, False: 29]
  ------------------
  602|  7.22k|			return ms->o.pbuf;
  603|  7.25k|	}
  604|     29|#endif
  605|       |
  606|  14.7k|	for (np = ms->o.pbuf, op = ms->o.buf; *op;) {
  ------------------
  |  Branch (606:40): [True: 14.7k, False: 29]
  ------------------
  607|  14.7k|		if (isprint(CAST(unsigned char, *op))) {
  608|  14.1k|			*np++ = *op++;
  609|  14.1k|		} else {
  610|    620|			OCTALIFY(np, op);
  ------------------
  |  |  533|    620|	(void)(*(n)++ = '\\', \
  |  |  534|    620|	*(n)++ = ((CAST(uint32_t, *(o)) >> 6) & 3) + '0', \
  |  |  ------------------
  |  |  |  |  444|    620|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  535|    620|	*(n)++ = ((CAST(uint32_t, *(o)) >> 3) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  444|    620|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  536|    620|	*(n)++ = ((CAST(uint32_t, *(o)) >> 0) & 7) + '0', \
  |  |  ------------------
  |  |  |  |  444|    620|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  537|    620|	(o)++)
  ------------------
  611|    620|		}
  612|  14.7k|	}
  613|     29|	*np = '\0';
  614|     29|	return ms->o.pbuf;
  615|  7.25k|}
file_check_mem:
  619|   697k|{
  620|   697k|	size_t len;
  621|       |
  622|   697k|	if (level >= ms->c.len) {
  ------------------
  |  Branch (622:6): [True: 1, False: 697k]
  ------------------
  623|      1|		len = (ms->c.len = 20 + level) * sizeof(*ms->c.li);
  624|      1|		ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ?
  ------------------
  |  |  444|      2|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (444:25): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  625|      1|		    malloc(len) :
  626|      1|		    realloc(ms->c.li, len));
  627|      1|		if (ms->c.li == NULL) {
  ------------------
  |  Branch (627:7): [True: 0, False: 1]
  ------------------
  628|      0|			file_oomem(ms, len);
  629|      0|			return -1;
  630|      0|		}
  631|      1|	}
  632|   697k|	ms->c.li[level].got_match = 0;
  633|   697k|#ifdef ENABLE_CONDITIONALS
  634|   697k|	ms->c.li[level].last_match = 0;
  635|   697k|	ms->c.li[level].last_cond = COND_NONE;
  ------------------
  |  |  353|   697k|#define				COND_NONE	0
  ------------------
  636|   697k|#endif /* ENABLE_CONDITIONALS */
  637|   697k|	return 0;
  638|   697k|}
file_printedlen:
  642|  2.18k|{
  643|  2.18k|	return ms->o.blen;
  644|  2.18k|}
file_replace:
  648|  1.43k|{
  649|  1.43k|	file_regex_t rx;
  650|  1.43k|	int rc, rv = -1;
  651|       |
  652|  1.43k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED);
  653|  1.43k|	if (rc == 0) {
  ------------------
  |  Branch (653:6): [True: 1.43k, False: 0]
  ------------------
  654|  1.43k|		regmatch_t rm;
  655|  1.43k|		int nm = 0;
  656|  1.53k|		while (file_regexec(ms, &rx, ms->o.buf, 1, &rm, 0) == 0) {
  ------------------
  |  Branch (656:10): [True: 97, False: 1.43k]
  ------------------
  657|     97|			ms->o.buf[rm.rm_so] = '\0';
  658|     97|			if (file_printf(ms, "%s%s", rep,
  ------------------
  |  Branch (658:8): [True: 0, False: 97]
  ------------------
  659|     97|			    rm.rm_eo != 0 ? ms->o.buf + rm.rm_eo : "") == -1)
  ------------------
  |  Branch (659:8): [True: 97, False: 0]
  ------------------
  660|      0|				goto out;
  661|     97|			nm++;
  662|     97|		}
  663|  1.43k|		rv = nm;
  664|  1.43k|	}
  665|  1.43k|out:
  666|  1.43k|	file_regfree(&rx);
  667|  1.43k|	return rv;
  668|  1.43k|}
file_regcomp:
  721|  24.1k|{
  722|  24.1k|	if (check_regex(ms, pat) == -1)
  ------------------
  |  Branch (722:6): [True: 0, False: 24.1k]
  ------------------
  723|      0|		return -1;
  724|       |
  725|  24.1k|#ifdef USE_C_LOCALE
  726|  24.1k|	locale_t old = uselocale(ms->c_lc_ctype);
  727|  24.1k|	assert(old != NULL);
  728|       |#else
  729|       |	char old[1024];
  730|       |	strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
  731|       |	(void)setlocale(LC_CTYPE, "C");
  732|       |#endif
  733|  24.1k|	int rc;
  734|  24.1k|	rc = regcomp(rx, pat, flags);
  735|       |
  736|  24.1k|#ifdef USE_C_LOCALE
  737|  24.1k|	uselocale(old);
  738|       |#else
  739|       |	(void)setlocale(LC_CTYPE, old);
  740|       |#endif
  741|  24.1k|	if (rc > 0 && (ms->flags & MAGIC_CHECK)) {
  ------------------
  |  |   39|      0|#define	MAGIC_CHECK		0x0000040 /* Print warnings to stderr */
  ------------------
  |  Branch (741:6): [True: 0, False: 24.1k]
  |  Branch (741:16): [True: 0, False: 0]
  ------------------
  742|      0|		char errmsg[512], buf[512];
  743|       |
  744|      0|		(void)regerror(rc, rx, errmsg, sizeof(errmsg));
  745|      0|		file_magerror(ms, "regex error %d for `%s', (%s)", rc, 
  746|      0|		    file_printable(ms, buf, sizeof(buf), pat, strlen(pat)),
  747|      0|		    errmsg);
  748|      0|	}
  749|  24.1k|	return rc;
  750|  24.1k|}
file_regexec:
  756|   240k|{
  757|   240k|#ifdef USE_C_LOCALE
  758|   240k|	locale_t old = uselocale(ms->c_lc_ctype);
  759|   240k|	assert(old != NULL);
  760|       |#else
  761|       |	char old[1024];
  762|       |	strlcpy(old, setlocale(LC_CTYPE, NULL), sizeof(old));
  763|       |	(void)setlocale(LC_CTYPE, "C");
  764|       |#endif
  765|   240k|	int rc;
  766|       |	/* XXX: force initialization because glibc does not always do this */
  767|   240k|	if (nmatch != 0)
  ------------------
  |  Branch (767:6): [True: 217k, False: 22.5k]
  ------------------
  768|   217k|		memset(pmatch, 0, nmatch * sizeof(*pmatch));
  769|   240k|	rc = regexec(rx, str, nmatch, pmatch, eflags);
  770|   240k|#ifdef USE_C_LOCALE
  771|   240k|	uselocale(old);
  772|       |#else
  773|       |	(void)setlocale(LC_CTYPE, old);
  774|       |#endif
  775|   240k|	return rc;
  776|   240k|}
file_regfree:
  780|  23.9k|{
  781|  23.9k|	regfree(rx);
  782|  23.9k|}
file_push_buffer:
  786|  21.4k|{
  787|  21.4k|	file_pushbuf_t *pb;
  788|       |
  789|  21.4k|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|  21.4k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (789:6): [True: 986, False: 20.4k]
  ------------------
  790|    986|		return NULL;
  791|       |
  792|  20.4k|	if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL)
  ------------------
  |  |  444|  20.4k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (792:6): [True: 0, False: 20.4k]
  ------------------
  793|      0|		return NULL;
  794|       |
  795|  20.4k|	pb->buf = ms->o.buf;
  796|  20.4k|	pb->blen = ms->o.blen;
  797|  20.4k|	pb->offset = ms->offset;
  798|       |
  799|  20.4k|	ms->o.buf = NULL;
  800|  20.4k|	ms->o.blen = 0;
  801|  20.4k|	ms->offset = 0;
  802|       |
  803|  20.4k|	return pb;
  804|  20.4k|}
file_pop_buffer:
  808|  20.4k|{
  809|  20.4k|	char *rbuf;
  810|       |
  811|  20.4k|	if (ms->event_flags & EVENT_HAD_ERR) {
  ------------------
  |  |  479|  20.4k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (811:6): [True: 1.44k, False: 19.0k]
  ------------------
  812|  1.44k|		free(pb->buf);
  813|  1.44k|		free(pb);
  814|  1.44k|		return NULL;
  815|  1.44k|	}
  816|       |
  817|  19.0k|	rbuf = ms->o.buf;
  818|       |
  819|  19.0k|	ms->o.buf = pb->buf;
  820|  19.0k|	ms->o.blen = pb->blen;
  821|  19.0k|	ms->offset = pb->offset;
  822|       |
  823|  19.0k|	free(pb);
  824|  19.0k|	return rbuf;
  825|  20.4k|}
file_printable:
  833|  38.3k|{
  834|  38.3k|	char *ptr, *eptr = buf + bufsiz - 1;
  835|  38.3k|	const unsigned char *s = RCAST(const unsigned char *, str);
  ------------------
  |  |  445|  38.3k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  836|  38.3k|	const unsigned char *es = s + slen;
  837|       |
  838|   238k|	for (ptr = buf;  ptr < eptr && s < es && *s; s++) {
  ------------------
  |  Branch (838:19): [True: 238k, False: 71]
  |  Branch (838:33): [True: 237k, False: 590]
  |  Branch (838:43): [True: 200k, False: 37.6k]
  ------------------
  839|   200k|		if ((ms->flags & MAGIC_RAW) != 0 || isprint(*s)) {
  ------------------
  |  |   41|   200k|#define	MAGIC_RAW		0x0000100 /* Don't convert unprintable chars */
  ------------------
  |  Branch (839:7): [True: 0, False: 200k]
  ------------------
  840|   119k|			*ptr++ = *s;
  841|   119k|			continue;
  842|   119k|		}
  843|  80.4k|		if (ptr >= eptr - 3)
  ------------------
  |  Branch (843:7): [True: 70, False: 80.3k]
  ------------------
  844|     70|			break;
  845|  80.3k|		*ptr++ = '\\';
  846|  80.3k|		*ptr++ = ((CAST(unsigned int, *s) >> 6) & 7) + '0';
  ------------------
  |  |  444|  80.3k|#define CAST(T, b)	((T)(b))
  ------------------
  847|  80.3k|		*ptr++ = ((CAST(unsigned int, *s) >> 3) & 7) + '0';
  ------------------
  |  |  444|  80.3k|#define CAST(T, b)	((T)(b))
  ------------------
  848|  80.3k|		*ptr++ = ((CAST(unsigned int, *s) >> 0) & 7) + '0';
  ------------------
  |  |  444|  80.3k|#define CAST(T, b)	((T)(b))
  ------------------
  849|  80.3k|	}
  850|  38.3k|	*ptr = '\0';
  851|  38.3k|	return buf;
  852|  38.3k|}
file_print_guid:
  888|    369|{
  889|    369|	const struct guid *g = CAST(const struct guid *,
  ------------------
  |  |  444|    369|#define CAST(T, b)	((T)(b))
  ------------------
  890|    369|	    CAST(const void *, guid));
  891|       |
  892|    369|#ifndef WIN32
  893|    369|	return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hhX%.2hhX-"
  894|    369|	    "%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX",
  895|    369|	    g->data1, g->data2, g->data3, g->data4[0], g->data4[1],
  896|    369|	    g->data4[2], g->data4[3], g->data4[4], g->data4[5],
  897|    369|	    g->data4[6], g->data4[7]);
  898|       |#else
  899|       |	return snprintf(str, len, "%.8X-%.4hX-%.4hX-%.2hX%.2hX-"
  900|       |	    "%.2hX%.2hX%.2hX%.2hX%.2hX%.2hX",
  901|       |	    g->data1, g->data2, g->data3, g->data4[0], g->data4[1],
  902|       |	    g->data4[2], g->data4[3], g->data4[4], g->data4[5],
  903|       |	    g->data4[6], g->data4[7]);
  904|       |#endif
  905|    369|}
file_pipe_closexec:
  909|  8.65k|{
  910|       |#ifdef __MINGW32__
  911|       |	return 0;
  912|       |#elif defined(HAVE_PIPE2)
  913|  8.65k|	return pipe2(fds, O_CLOEXEC);
  914|       |#else
  915|       |	if (pipe(fds) == -1)
  916|       |		return -1;
  917|       |# ifdef F_SETFD
  918|       |	(void)fcntl(fds[0], F_SETFD, FD_CLOEXEC);
  919|       |	(void)fcntl(fds[1], F_SETFD, FD_CLOEXEC);
  920|       |# endif
  921|       |	return 0;
  922|       |#endif
  923|  8.65k|}
file_clear_closexec:
  926|  8.65k|file_clear_closexec(int fd) {
  927|  8.65k|#ifdef F_SETFD
  928|  8.65k|	return fcntl(fd, F_SETFD, 0);
  929|       |#else
  930|       |	return 0;
  931|       |#endif
  932|  8.65k|}
file_strtrim:
  936|    296|{
  937|    296|	char *last;
  938|       |
  939|    296|	while (isspace(CAST(unsigned char, *str)))
  940|    335|		str++;
  941|    296|	last = str;
  942|  2.65k|	while (*last)
  ------------------
  |  Branch (942:9): [True: 2.35k, False: 296]
  ------------------
  943|  2.35k|		last++;
  944|    296|	--last;
  945|    296|	while (isspace(CAST(unsigned char, *last)))
  946|    427|		last--;
  947|    296|	*++last = '\0';
  948|    296|	return str;
  949|    296|}
funcs.c:file_checkfield:
   76|   117k|{
   77|   117k|	const char *p = *pp;
   78|   117k|	int fw = 0;
   79|       |
   80|   122k|	while (*p && isdigit((unsigned char)*p))
  ------------------
  |  Branch (80:9): [True: 122k, False: 0]
  ------------------
   81|  5.14k|		fw = fw * 10 + (*p++ - '0');
   82|       |
   83|   117k|	*pp = p;
   84|       |
   85|   117k|	if (fw < 1024)
  ------------------
  |  Branch (85:6): [True: 117k, False: 0]
  ------------------
   86|   117k|		return 1;
   87|      0|	if (msg)
  ------------------
  |  Branch (87:6): [True: 0, False: 0]
  ------------------
   88|      0|		snprintf(msg, mlen, "field %s too large: %d", what, fw);
   89|       |
   90|      0|	return 0;
   91|   117k|}
funcs.c:file_clearbuf:
   68|  7.56k|{
   69|  7.56k|	free(ms->o.buf);
   70|  7.56k|	ms->o.buf = NULL;
   71|  7.56k|	ms->o.blen = 0;
   72|  7.56k|}
funcs.c:file_error_core:
  195|    805|{
  196|       |	/* Only the first error is ok */
  197|    805|	if (ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|    805|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (197:6): [True: 604, False: 201]
  ------------------
  198|    604|		return;
  199|    201|	if (lineno != 0) {
  ------------------
  |  Branch (199:6): [True: 0, False: 201]
  ------------------
  200|      0|		file_clearbuf(ms);
  201|      0|		(void)file_printf(ms, "line %" SIZE_T_FORMAT "u:", lineno);
  202|      0|	}
  203|    201|	if (ms->o.buf && *ms->o.buf)
  ------------------
  |  Branch (203:6): [True: 4, False: 197]
  |  Branch (203:19): [True: 4, False: 0]
  ------------------
  204|      4|		(void)file_printf(ms, " ");
  205|    201|	(void)file_vprintf(ms, f, va);
  206|    201|	if (error > 0)
  ------------------
  |  Branch (206:6): [True: 0, False: 201]
  ------------------
  207|      0|		(void)file_printf(ms, " (%s)", strerror(error));
  208|    201|	ms->event_flags |= EVENT_HAD_ERR;
  ------------------
  |  |  479|    201|#define 		EVENT_HAD_ERR		0x01
  ------------------
  209|    201|	ms->error = error;
  210|    201|}
funcs.c:checkdone:
  284|  9.36k|{
  285|  9.36k|	if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  9.36k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (285:6): [True: 0, False: 9.36k]
  ------------------
  286|      0|		return 1;
  287|  9.36k|	if (file_separator(ms) == -1)
  ------------------
  |  Branch (287:6): [True: 0, False: 9.36k]
  ------------------
  288|      0|		*rv = -1;
  289|  9.36k|	return 0;
  290|  9.36k|}
funcs.c:trim_separator:
  265|  10.4k|{
  266|  10.4k|	size_t l;
  267|       |
  268|  10.4k|	if (ms->o.buf == NULL)
  ------------------
  |  Branch (268:6): [True: 0, False: 10.4k]
  ------------------
  269|      0|		return;
  270|       |
  271|  10.4k|	l = strlen(ms->o.buf);
  272|  10.4k|	if (l < sizeof(FILE_SEPARATOR))
  ------------------
  |  |  255|  10.4k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (272:6): [True: 0, False: 10.4k]
  ------------------
  273|      0|		return;
  274|       |
  275|  10.4k|	l -= sizeof(FILE_SEPARATOR) - 1;
  ------------------
  |  |  255|  10.4k|#define FILE_SEPARATOR "\n- "
  ------------------
  276|  10.4k|	if (strcmp(ms->o.buf + l, FILE_SEPARATOR) != 0)
  ------------------
  |  |  255|  10.4k|#define FILE_SEPARATOR "\n- "
  ------------------
  |  Branch (276:6): [True: 10.4k, False: 0]
  ------------------
  277|  10.4k|		return;
  278|       |
  279|      0|	ms->o.buf[l] = '\0';
  280|      0|}
funcs.c:check_regex:
  672|  24.1k|{
  673|  24.1k|	char sbuf[512];
  674|  24.1k|	unsigned char oc = '\0';
  675|  24.1k|	const char *p;
  676|  24.1k|	unsigned long l;
  677|       |
  678|   292k|	for (p = pat; *p; p++) {
  ------------------
  |  Branch (678:16): [True: 268k, False: 24.1k]
  ------------------
  679|   268k|		unsigned char c = *p;
  680|       |		// Avoid repetition
  681|   268k|		if (c == oc && strchr("?*+{", c) != NULL) {
  ------------------
  |  Branch (681:7): [True: 141, False: 268k]
  |  Branch (681:18): [True: 0, False: 141]
  ------------------
  682|      0|			size_t len = strlen(pat);
  683|      0|			file_magwarn(ms,
  684|      0|			    "repetition-operator operand `%c' "
  685|      0|			    "invalid in regex `%s'", c,
  686|      0|			    file_printable(ms, sbuf, sizeof(sbuf), pat, len));
  687|      0|			return -1;
  688|      0|		}
  689|   268k|		if (c == '{') {
  ------------------
  |  Branch (689:7): [True: 67, False: 268k]
  ------------------
  690|     67|			char *ep, *eep;
  691|     67|			errno = 0;
  692|     67|			l = strtoul(p + 1, &ep, 10);
  693|     67|			if (ep != p + 1 && l > 1000)
  ------------------
  |  Branch (693:8): [True: 44, False: 23]
  |  Branch (693:23): [True: 0, False: 44]
  ------------------
  694|      0|				goto bounds;
  695|       |
  696|     67|			if (*ep == ',') {
  ------------------
  |  Branch (696:8): [True: 28, False: 39]
  ------------------
  697|     28|				l = strtoul(ep + 1, &eep, 10);
  698|     28|				if (eep != ep + 1 && l > 1000)
  ------------------
  |  Branch (698:9): [True: 28, False: 0]
  |  Branch (698:26): [True: 0, False: 28]
  ------------------
  699|      0|					goto bounds;
  700|     28|			}
  701|     67|		}
  702|   268k|		oc = c;
  703|   268k|		if (isprint(c) || isspace(c) || c == '\b'
  ------------------
  |  Branch (703:35): [True: 4, False: 1]
  ------------------
  704|   268k|		    || c == 0x8a) // XXX: apple magic fixme
  ------------------
  |  Branch (704:10): [True: 1, False: 0]
  ------------------
  705|   268k|			continue;
  706|      0|		size_t len = strlen(pat);
  707|      0|		file_magwarn(ms,
  708|      0|		    "non-ascii characters in regex \\%#o `%s'",
  709|      0|		    c, file_printable(ms, sbuf, sizeof(sbuf), pat, len));
  710|      0|		return -1;
  711|   268k|	}
  712|  24.1k|	return 0;
  713|      0|bounds:
  714|      0|	file_magwarn(ms, "bounds too large %ld in regex `%s'", l, pat);
  715|      0|	return -1;
  716|  24.1k|}

file_is_csv:
  135|  10.4k|{
  136|  10.4k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  10.4k|#define CAST(T, b)	((T)(b))
  ------------------
  137|  10.4k|	const unsigned char *ue = uc + b->flen;
  138|  10.4k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  10.4k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  10.4k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  10.4k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  139|       |
  140|  10.4k|	if (!looks_text)
  ------------------
  |  Branch (140:6): [True: 8.42k, False: 1.98k]
  ------------------
  141|  8.42k|		return 0;
  142|       |
  143|  1.98k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  1.98k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  1.98k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (143:6): [True: 0, False: 1.98k]
  ------------------
  144|      0|		return 0;
  145|       |
  146|  1.98k|	if (!csv_parse(uc, ue))
  ------------------
  |  Branch (146:6): [True: 1.97k, False: 7]
  ------------------
  147|  1.97k|		return 0;
  148|       |
  149|      7|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|      7|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (149:6): [True: 0, False: 7]
  ------------------
  150|      0|		return 1;
  151|       |
  152|      7|	if (mime) {
  ------------------
  |  Branch (152:6): [True: 0, False: 7]
  ------------------
  153|      0|		if (file_printf(ms, "text/csv") == -1)
  ------------------
  |  Branch (153:7): [True: 0, False: 0]
  ------------------
  154|      0|			return -1;
  155|      0|		return 1;
  156|      0|	}
  157|       |
  158|      7|	if (file_printf(ms, "CSV %s%stext", code ? code : "",
  ------------------
  |  Branch (158:6): [True: 0, False: 7]
  |  Branch (158:38): [True: 7, False: 0]
  ------------------
  159|      7|	    code ? " " : "") == -1)
  ------------------
  |  Branch (159:6): [True: 7, False: 0]
  ------------------
  160|      0|		return -1;
  161|       |
  162|      7|	return 1;
  163|      7|}
is_csv.c:csv_parse:
   93|  1.98k|{
   94|  1.98k|	size_t nf = 0, tf = 0, nl = 0;
   95|       |
   96|   215M|	while (uc < ue) {
  ------------------
  |  Branch (96:9): [True: 215M, False: 1.80k]
  ------------------
   97|   215M|		switch (*uc++) {
   98|  3.51M|		case '"':
  ------------------
  |  Branch (98:3): [True: 3.51M, False: 212M]
  ------------------
   99|       |			// Eat until the matching quote
  100|  3.51M|			uc = eatquote(uc, ue);
  101|  3.51M|			break;
  102|  5.74M|		case ',':
  ------------------
  |  Branch (102:3): [True: 5.74M, False: 210M]
  ------------------
  103|  5.74M|			nf++;
  104|  5.74M|			break;
  105|    274|		case '\n':
  ------------------
  |  Branch (105:3): [True: 274, False: 215M]
  ------------------
  106|    274|			DPRINTF("%zu %zu %zu\n", nl, nf, tf);
  107|    274|			nl++;
  108|    274|#if CSV_LINES
  109|    274|			if (nl == CSV_LINES)
  ------------------
  |  |   61|    274|#define CSV_LINES 10
  ------------------
  |  Branch (109:8): [True: 1, False: 273]
  ------------------
  110|      1|				return tf != 0 && tf == nf;
  ------------------
  |  Branch (110:12): [True: 1, False: 0]
  |  Branch (110:23): [True: 0, False: 1]
  ------------------
  111|    273|#endif
  112|    273|			if (tf == 0) {
  ------------------
  |  Branch (112:8): [True: 202, False: 71]
  ------------------
  113|       |				// First time and no fields, give up
  114|    202|				if (nf == 0) 
  ------------------
  |  Branch (114:9): [True: 135, False: 67]
  ------------------
  115|    135|					return 0;
  116|       |				// First time, set the number of fields
  117|     67|				tf = nf;
  118|     71|			} else if (tf != nf) {
  ------------------
  |  Branch (118:15): [True: 38, False: 33]
  ------------------
  119|       |				// Field number mismatch, we are done.
  120|     38|				return 0;
  121|     38|			}
  122|    100|			nf = 0;
  123|    100|			break;
  124|   206M|		default:
  ------------------
  |  Branch (124:3): [True: 206M, False: 9.26M]
  ------------------
  125|   206M|			break;
  126|   215M|		}
  127|   215M|	}
  128|  1.80k|	return tf && nl >= 2;
  ------------------
  |  Branch (128:9): [True: 28, False: 1.78k]
  |  Branch (128:15): [True: 7, False: 21]
  ------------------
  129|  1.98k|}
is_csv.c:eatquote:
   68|  3.51M|{
   69|  3.51M|	int quote = 0;
   70|       |
   71|  85.4M|	while (uc < ue) {
  ------------------
  |  Branch (71:9): [True: 85.4M, False: 185]
  ------------------
   72|  85.4M|		unsigned char c = *uc++;
   73|  85.4M|		if (c != '"') {
  ------------------
  |  Branch (73:7): [True: 81.8M, False: 3.62M]
  ------------------
   74|       |			// We already got one, done.
   75|  81.8M|			if (quote) {
  ------------------
  |  Branch (75:8): [True: 3.51M, False: 78.2M]
  ------------------
   76|  3.51M|				return --uc;
   77|  3.51M|			}
   78|  78.2M|			continue;
   79|  81.8M|		}
   80|  3.62M|		if (quote) {
  ------------------
  |  Branch (80:7): [True: 54.6k, False: 3.57M]
  ------------------
   81|       |			// quote-quote escapes
   82|  54.6k|			quote = 0;
   83|  54.6k|			continue;
   84|  54.6k|		}
   85|       |		// first quote
   86|  3.57M|		quote = 1;
   87|  3.57M|	}
   88|    185|	return ue;
   89|  3.51M|}

file_is_json:
  423|  10.4k|{
  424|  10.4k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  10.4k|#define CAST(T, b)	((T)(b))
  ------------------
  425|  10.4k|	const unsigned char *ue = uc + b->flen;
  426|  10.4k|	size_t st[JSON_MAX];
  427|  10.4k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  10.4k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  10.4k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  10.4k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  428|  10.4k|	int jt;
  429|       |
  430|       |
  431|  10.4k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  10.4k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  10.4k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (431:6): [True: 0, False: 10.4k]
  ------------------
  432|      0|		return 0;
  433|       |
  434|  10.4k|	memset(st, 0, sizeof(st));
  435|       |
  436|  10.4k|	if ((jt = json_parse(&uc, ue, st, 0)) == 0)
  ------------------
  |  Branch (436:6): [True: 10.3k, False: 40]
  ------------------
  437|  10.3k|		return 0;
  438|       |
  439|     40|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     40|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (439:6): [True: 0, False: 40]
  ------------------
  440|      0|		return 1;
  441|     40|	if (mime) {
  ------------------
  |  Branch (441:6): [True: 0, False: 40]
  ------------------
  442|      0|		if (file_printf(ms, "application/%s",
  ------------------
  |  Branch (442:7): [True: 0, False: 0]
  ------------------
  443|      0|		    jt == 1 ? "json" : "x-ndjson") == -1)
  ------------------
  |  Branch (443:7): [True: 0, False: 0]
  ------------------
  444|      0|			return -1;
  445|      0|		return 1;
  446|      0|	}
  447|     40|	if (file_printf(ms, "%sJSON text data",
  ------------------
  |  Branch (447:6): [True: 0, False: 40]
  ------------------
  448|     40|	    jt == 1 ? "" : "New Line Delimited ") == -1)
  ------------------
  |  Branch (448:6): [True: 27, False: 13]
  ------------------
  449|      0|		return -1;
  450|       |#if JSON_COUNT
  451|       |#define P(n) st[n], st[n] > 1 ? "s" : ""
  452|       |	if (file_printf(ms, " (%" SIZE_T_FORMAT "u object%s, %" SIZE_T_FORMAT
  453|       |	    "u array%s, %" SIZE_T_FORMAT "u string%s, %" SIZE_T_FORMAT
  454|       |	    "u constant%s, %" SIZE_T_FORMAT "u number%s, %" SIZE_T_FORMAT
  455|       |	    "u >1array%s)",
  456|       |	    P(JSON_OBJECT), P(JSON_ARRAY), P(JSON_STRING), P(JSON_CONSTANT),
  457|       |	    P(JSON_NUMBER), P(JSON_ARRAYN))
  458|       |	    == -1)
  459|       |		return -1;
  460|       |#endif
  461|     40|	return 1;
  462|     40|}
is_json.c:json_parse:
  348|  18.3k|{
  349|  18.3k|	const unsigned char *uc, *ouc;
  350|  18.3k|	int rv = 0;
  351|  18.3k|	int t;
  352|       |
  353|  18.3k|	ouc = uc = json_skip_space(*ucp, ue);
  354|  18.3k|	if (uc == ue)
  ------------------
  |  Branch (354:6): [True: 97, False: 18.2k]
  ------------------
  355|     97|		goto out;
  356|       |
  357|       |	// Avoid recursion
  358|  18.2k|	if (lvl > 500) {
  ------------------
  |  Branch (358:6): [True: 2, False: 18.2k]
  ------------------
  359|      2|		DPRINTF("Too many levels", uc, *ucp);
  ------------------
  |  |   52|      2|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  360|      2|		return 0;
  361|      2|	}
  362|       |#if JSON_COUNT
  363|       |	/* bail quickly if not counting */
  364|       |	if (lvl > 1 && (st[JSON_OBJECT] || st[JSON_ARRAYN]))
  365|       |		return 1;
  366|       |#endif
  367|       |
  368|  18.2k|	DPRINTF("Parse general: ", uc, *ucp);
  ------------------
  |  |   52|  18.2k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  369|  18.2k|	switch (*uc++) {
  370|    574|	case '"':
  ------------------
  |  Branch (370:2): [True: 574, False: 17.6k]
  ------------------
  371|    574|		rv = json_parse_string(&uc, ue, lvl + 1);
  372|    574|		t = JSON_STRING;
  ------------------
  |  |   60|    574|#define JSON_STRING	4
  ------------------
  373|    574|		break;
  374|  4.24k|	case '[':
  ------------------
  |  Branch (374:2): [True: 4.24k, False: 13.9k]
  ------------------
  375|  4.24k|		rv = json_parse_array(&uc, ue, st, lvl + 1);
  376|  4.24k|		t = JSON_ARRAY;
  ------------------
  |  |   56|  4.24k|#define JSON_ARRAY	0
  ------------------
  377|  4.24k|		break;
  378|    728|	case '{': /* '}' */
  ------------------
  |  Branch (378:2): [True: 728, False: 17.5k]
  ------------------
  379|    728|		rv = json_parse_object(&uc, ue, st, lvl + 1);
  380|    728|		t = JSON_OBJECT;
  ------------------
  |  |   59|    728|#define JSON_OBJECT	3
  ------------------
  381|    728|		break;
  382|    408|	case 't':
  ------------------
  |  Branch (382:2): [True: 408, False: 17.8k]
  ------------------
  383|    408|		rv = json_parse_const(&uc, ue, "true", sizeof("true"), lvl + 1);
  384|    408|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    408|#define JSON_CONSTANT	1
  ------------------
  385|    408|		break;
  386|    241|	case 'f':
  ------------------
  |  Branch (386:2): [True: 241, False: 17.9k]
  ------------------
  387|    241|		rv = json_parse_const(&uc, ue, "false", sizeof("false"),
  388|    241|		    lvl + 1);
  389|    241|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    241|#define JSON_CONSTANT	1
  ------------------
  390|    241|		break;
  391|    180|	case 'n':
  ------------------
  |  Branch (391:2): [True: 180, False: 18.0k]
  ------------------
  392|    180|		rv = json_parse_const(&uc, ue, "null", sizeof("null"), lvl + 1);
  393|    180|		t = JSON_CONSTANT;
  ------------------
  |  |   57|    180|#define JSON_CONSTANT	1
  ------------------
  394|    180|		break;
  395|  11.8k|	default:
  ------------------
  |  Branch (395:2): [True: 11.8k, False: 6.37k]
  ------------------
  396|  11.8k|		--uc;
  397|  11.8k|		rv = json_parse_number(&uc, ue, lvl + 1);
  398|  11.8k|		t = JSON_NUMBER;
  ------------------
  |  |   58|  11.8k|#define JSON_NUMBER	2
  ------------------
  399|  11.8k|		break;
  400|  18.2k|	}
  401|  18.2k|	if (rv)
  ------------------
  |  Branch (401:6): [True: 4.67k, False: 13.5k]
  ------------------
  402|  4.67k|		st[t]++;
  403|  18.2k|	uc = json_skip_space(uc, ue);
  404|  18.3k|out:
  405|  18.3k|	DPRINTF("End general: ", uc, *ucp);
  ------------------
  |  |   52|  18.3k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  406|  18.3k|	*ucp = uc;
  407|  18.3k|	if (lvl == 0) {
  ------------------
  |  Branch (407:6): [True: 10.4k, False: 7.92k]
  ------------------
  408|  10.4k|		if (!rv)
  ------------------
  |  Branch (408:7): [True: 10.0k, False: 374]
  ------------------
  409|  10.0k|			return 0;
  410|    374|		if (uc == ue)
  ------------------
  |  Branch (410:7): [True: 104, False: 270]
  ------------------
  411|    104|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   61|    104|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 1 : 0;
  ------------------
  |  |   59|     85|#define JSON_OBJECT	3
  ------------------
  |  Branch (411:12): [True: 19, False: 85]
  |  Branch (411:31): [True: 8, False: 77]
  ------------------
  412|    270|		if (*ouc == *uc && json_parse(&uc, ue, st, 1))
  ------------------
  |  Branch (412:7): [True: 54, False: 216]
  |  Branch (412:22): [True: 44, False: 10]
  ------------------
  413|     44|			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   61|     44|#define JSON_ARRAYN	5
  ------------------
              			return (st[JSON_ARRAYN] || st[JSON_OBJECT]) ? 2 : 0;
  ------------------
  |  |   59|     34|#define JSON_OBJECT	3
  ------------------
  |  Branch (413:12): [True: 10, False: 34]
  |  Branch (413:31): [True: 3, False: 31]
  ------------------
  414|    226|		else
  415|    226|			return 0;
  416|    270|	}
  417|  7.92k|	return rv;
  418|  18.3k|}
is_json.c:json_skip_space:
  119|  45.8k|{
  120|  45.7M|	while (uc < ue && json_isspace(*uc))
  ------------------
  |  Branch (120:9): [True: 45.7M, False: 3.26k]
  |  Branch (120:20): [True: 45.7M, False: 42.6k]
  ------------------
  121|  45.7M|		uc++;
  122|  45.8k|	return uc;
  123|  45.8k|}
is_json.c:json_isspace:
   79|  45.7M|{
   80|  45.7M|	switch (uc) {
   81|   132k|	case ' ':
  ------------------
  |  Branch (81:2): [True: 132k, False: 45.6M]
  ------------------
   82|  21.2M|	case '\n':
  ------------------
  |  Branch (82:2): [True: 21.1M, False: 24.6M]
  ------------------
   83|  45.7M|	case '\r':
  ------------------
  |  Branch (83:2): [True: 24.4M, False: 21.3M]
  ------------------
   84|  45.7M|	case '\t':
  ------------------
  |  Branch (84:2): [True: 874, False: 45.7M]
  ------------------
   85|  45.7M|		return 1;
   86|  42.6k|	default:
  ------------------
  |  Branch (86:2): [True: 42.6k, False: 45.7M]
  ------------------
   87|  42.6k|		return 0;
   88|  45.7M|	}
   89|  45.7M|}
is_json.c:json_parse_string:
  129|  1.24k|{
  130|  1.24k|	const unsigned char *uc = *ucp;
  131|  1.24k|	size_t i;
  132|       |
  133|  1.24k|	DPRINTF("Parse string: ", uc, *ucp);
  ------------------
  |  |   52|  1.24k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  134|  87.5M|	while (uc < ue) {
  ------------------
  |  Branch (134:9): [True: 87.5M, False: 115]
  ------------------
  135|  87.5M|		switch (*uc++) {
  136|     10|		case '\0':
  ------------------
  |  Branch (136:3): [True: 10, False: 87.5M]
  ------------------
  137|     10|			goto out;
  138|  19.9M|		case '\\':
  ------------------
  |  Branch (138:3): [True: 19.9M, False: 67.6M]
  ------------------
  139|  19.9M|			if (uc == ue)
  ------------------
  |  Branch (139:8): [True: 16, False: 19.9M]
  ------------------
  140|     16|				goto out;
  141|  19.9M|			switch (*uc++) {
  142|      0|			case '\0':
  ------------------
  |  Branch (142:4): [True: 0, False: 19.9M]
  ------------------
  143|      0|				goto out;
  144|  3.24M|			case '"':
  ------------------
  |  Branch (144:4): [True: 3.24M, False: 16.6M]
  ------------------
  145|  7.37M|			case '\\':
  ------------------
  |  Branch (145:4): [True: 4.13M, False: 15.7M]
  ------------------
  146|  8.44M|			case '/':
  ------------------
  |  Branch (146:4): [True: 1.06M, False: 18.8M]
  ------------------
  147|  10.7M|			case 'b':
  ------------------
  |  Branch (147:4): [True: 2.26M, False: 17.6M]
  ------------------
  148|  12.5M|			case 'f':
  ------------------
  |  Branch (148:4): [True: 1.89M, False: 18.0M]
  ------------------
  149|  13.5M|			case 'n':
  ------------------
  |  Branch (149:4): [True: 996k, False: 18.9M]
  ------------------
  150|  15.7M|			case 'r':
  ------------------
  |  Branch (150:4): [True: 2.11M, False: 17.8M]
  ------------------
  151|  16.8M|			case 't':
  ------------------
  |  Branch (151:4): [True: 1.08M, False: 18.8M]
  ------------------
  152|  16.8M|				continue;
  153|  3.11M|			case 'u':
  ------------------
  |  Branch (153:4): [True: 3.11M, False: 16.8M]
  ------------------
  154|  3.11M|				if (ue - uc < 4) {
  ------------------
  |  Branch (154:9): [True: 8, False: 3.11M]
  ------------------
  155|      8|					uc = ue;
  156|      8|					goto out;
  157|      8|				}
  158|  15.5M|				for (i = 0; i < 4; i++)
  ------------------
  |  Branch (158:17): [True: 12.4M, False: 3.11M]
  ------------------
  159|  12.4M|					if (!json_isxdigit(*uc++))
  ------------------
  |  Branch (159:10): [True: 26, False: 12.4M]
  ------------------
  160|     26|						goto out;
  161|  3.11M|				continue;
  162|  3.11M|			default:
  ------------------
  |  Branch (162:4): [True: 4, False: 19.9M]
  ------------------
  163|      4|				goto out;
  164|  19.9M|			}
  165|  1.06k|		case '"':
  ------------------
  |  Branch (165:3): [True: 1.06k, False: 87.5M]
  ------------------
  166|  1.06k|			DPRINTF("Good string: ", uc, *ucp);
  ------------------
  |  |   52|  1.06k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  167|  1.06k|			*ucp = uc;
  168|  1.06k|			return 1;
  169|  67.6M|		default:
  ------------------
  |  Branch (169:3): [True: 67.6M, False: 19.9M]
  ------------------
  170|  67.6M|			continue;
  171|  87.5M|		}
  172|  87.5M|	}
  173|    179|out:
  174|    179|	DPRINTF("Bad string: ", uc, *ucp);
  ------------------
  |  |   52|    179|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  175|    179|	*ucp = uc;
  176|    179|	return 0;
  177|  1.24k|}
is_json.c:json_isxdigit:
  105|  12.4M|{
  106|  12.4M|	if (json_isdigit(uc))
  ------------------
  |  Branch (106:6): [True: 3.32M, False: 9.14M]
  ------------------
  107|  3.32M|		return 1;
  108|  9.14M|	switch (uc) {
  109|  2.98M|	case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
  ------------------
  |  Branch (109:2): [True: 649k, False: 8.49M]
  |  Branch (109:12): [True: 12, False: 9.14M]
  |  Branch (109:22): [True: 703k, False: 8.43M]
  |  Branch (109:32): [True: 191k, False: 8.94M]
  |  Branch (109:42): [True: 3, False: 9.14M]
  |  Branch (109:52): [True: 1.44M, False: 7.69M]
  ------------------
  110|  9.14M|	case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
  ------------------
  |  Branch (110:2): [True: 2.98M, False: 6.15M]
  |  Branch (110:12): [True: 4, False: 9.14M]
  |  Branch (110:22): [True: 10, False: 9.14M]
  |  Branch (110:32): [True: 191k, False: 8.94M]
  |  Branch (110:42): [True: 10, False: 9.14M]
  |  Branch (110:52): [True: 2.97M, False: 6.16M]
  ------------------
  111|  9.14M|		return 1;
  112|     26|	default:
  ------------------
  |  Branch (112:2): [True: 26, False: 9.14M]
  ------------------
  113|     26|		return 0;
  114|  9.14M|	}
  115|  9.14M|}
is_json.c:json_isdigit:
   93|  21.1M|{
   94|  21.1M|	switch (uc) {
   95|  11.5M|	case '0': case '1': case '2': case '3': case '4':
  ------------------
  |  Branch (95:2): [True: 8.48M, False: 12.6M]
  |  Branch (95:12): [True: 33.7k, False: 21.1M]
  |  Branch (95:22): [True: 2.92M, False: 18.2M]
  |  Branch (95:32): [True: 80.2k, False: 21.0M]
  |  Branch (95:42): [True: 12.9k, False: 21.1M]
  ------------------
   96|  12.0M|	case '5': case '6': case '7': case '8': case '9':
  ------------------
  |  Branch (96:2): [True: 49.3k, False: 21.1M]
  |  Branch (96:12): [True: 172k, False: 20.9M]
  |  Branch (96:22): [True: 171k, False: 20.9M]
  |  Branch (96:32): [True: 65.7k, False: 21.1M]
  |  Branch (96:42): [True: 426, False: 21.1M]
  ------------------
   97|  12.0M|		return 1;
   98|  9.16M|	default:
  ------------------
  |  Branch (98:2): [True: 9.16M, False: 12.0M]
  ------------------
   99|  9.16M|		return 0;
  100|  21.1M|	}
  101|  21.1M|}
is_json.c:json_parse_array:
  182|  4.24k|{
  183|  4.24k|	const unsigned char *uc = *ucp;
  184|       |
  185|  4.24k|	DPRINTF("Parse array: ", uc, *ucp);
  ------------------
  |  |   52|  4.24k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  186|  7.76k|	while (uc < ue) {
  ------------------
  |  Branch (186:9): [True: 7.72k, False: 39]
  ------------------
  187|  7.72k|		uc = json_skip_space(uc, ue);
  188|  7.72k|		if (uc == ue)
  ------------------
  |  Branch (188:7): [True: 13, False: 7.71k]
  ------------------
  189|     13|			goto out;
  190|  7.71k|		if (*uc == ']')
  ------------------
  |  Branch (190:7): [True: 479, False: 7.23k]
  ------------------
  191|    479|			goto done;
  192|  7.23k|		if (!json_parse(&uc, ue, st, lvl + 1))
  ------------------
  |  Branch (192:7): [True: 3.36k, False: 3.87k]
  ------------------
  193|  3.36k|			goto out;
  194|  3.87k|		if (uc == ue)
  ------------------
  |  Branch (194:7): [True: 48, False: 3.82k]
  ------------------
  195|     48|			goto out;
  196|  3.82k|		switch (*uc) {
  197|  3.52k|		case ',':
  ------------------
  |  Branch (197:3): [True: 3.52k, False: 300]
  ------------------
  198|  3.52k|			uc++;
  199|  3.52k|			continue;
  200|    282|		case ']':
  ------------------
  |  Branch (200:3): [True: 282, False: 3.54k]
  ------------------
  201|    761|		done:
  202|    761|			st[JSON_ARRAYN]++;
  ------------------
  |  |   61|    761|#define JSON_ARRAYN	5
  ------------------
  203|    761|			DPRINTF("Good array: ", uc, *ucp);
  ------------------
  |  |   52|    761|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  204|    761|			*ucp = uc + 1;
  205|    761|			return 1;
  206|     18|		default:
  ------------------
  |  Branch (206:3): [True: 18, False: 3.80k]
  ------------------
  207|     18|			goto out;
  208|  3.82k|		}
  209|  3.82k|	}
  210|  3.47k|out:
  211|  3.47k|	DPRINTF("Bad array: ", uc,  *ucp);
  ------------------
  |  |   52|  3.47k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  212|  3.47k|	*ucp = uc;
  213|  3.47k|	return 0;
  214|  4.24k|}
is_json.c:json_parse_object:
  219|    728|{
  220|    728|	const unsigned char *uc = *ucp;
  221|    728|	DPRINTF("Parse object: ", uc, *ucp);
  ------------------
  |  |   52|    728|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  222|    922|	while (uc < ue) {
  ------------------
  |  Branch (222:9): [True: 912, False: 10]
  ------------------
  223|    912|		uc = json_skip_space(uc, ue);
  224|    912|		if (uc == ue)
  ------------------
  |  Branch (224:7): [True: 12, False: 900]
  ------------------
  225|     12|			goto out;
  226|    900|		if (*uc == '}') {
  ------------------
  |  Branch (226:7): [True: 202, False: 698]
  ------------------
  227|    202|			uc++;
  228|    202|			goto done;
  229|    202|		}
  230|    698|		if (*uc++ != '"') {
  ------------------
  |  Branch (230:7): [True: 28, False: 670]
  ------------------
  231|     28|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|     28|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  232|     28|			goto out;
  233|     28|		}
  234|    670|		DPRINTF("next field", uc, *ucp);
  ------------------
  |  |   52|    670|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  235|    670|		if (!json_parse_string(&uc, ue, lvl)) {
  ------------------
  |  Branch (235:7): [True: 4, False: 666]
  ------------------
  236|      4|			DPRINTF("not string", uc, *ucp);
  ------------------
  |  |   52|      4|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  237|      4|			goto out;
  238|      4|		}
  239|    666|		uc = json_skip_space(uc, ue);
  240|    666|		if (uc == ue)
  ------------------
  |  Branch (240:7): [True: 11, False: 655]
  ------------------
  241|     11|			goto out;
  242|    655|		if (*uc++ != ':') {
  ------------------
  |  Branch (242:7): [True: 10, False: 645]
  ------------------
  243|     10|			DPRINTF("not colon", uc, *ucp);
  ------------------
  |  |   52|     10|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  244|     10|			goto out;
  245|     10|		}
  246|    645|		if (!json_parse(&uc, ue, st, lvl + 1)) {
  ------------------
  |  Branch (246:7): [True: 255, False: 390]
  ------------------
  247|    255|			DPRINTF("not json", uc, *ucp);
  ------------------
  |  |   52|    255|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  248|    255|			goto out;
  249|    255|		}
  250|    390|		if (uc == ue)
  ------------------
  |  Branch (250:7): [True: 1, False: 389]
  ------------------
  251|      1|			goto out;
  252|    389|		switch (*uc++) {
  253|    194|		case ',':
  ------------------
  |  Branch (253:3): [True: 194, False: 195]
  ------------------
  254|    194|			continue;
  255|    194|		case '}': /* { */
  ------------------
  |  Branch (255:3): [True: 194, False: 195]
  ------------------
  256|    396|		done:
  257|    396|			DPRINTF("Good object: ", uc, *ucp);
  ------------------
  |  |   52|    396|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  258|    396|			*ucp = uc;
  259|    396|			return 1;
  260|      1|		default:
  ------------------
  |  Branch (260:3): [True: 1, False: 388]
  ------------------
  261|      1|			DPRINTF("not more", uc, *ucp);
  ------------------
  |  |   52|      1|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  262|      1|			*ucp = uc - 1;
  263|      1|			goto out;
  264|    389|		}
  265|    389|	}
  266|    332|out:
  267|    332|	DPRINTF("Bad object: ", uc, *ucp);
  ------------------
  |  |   52|    332|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  268|    332|	*ucp = uc;
  269|    332|	return 0;
  270|    728|}
is_json.c:json_parse_const:
  328|    829|{
  329|    829|	const unsigned char *uc = *ucp;
  330|       |
  331|    829|	DPRINTF("Parse const: ", uc, *ucp);
  ------------------
  |  |   52|    829|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  332|    829|	*ucp += --len - 1;
  333|    829|	if (*ucp > ue)
  ------------------
  |  Branch (333:6): [True: 49, False: 780]
  ------------------
  334|     49|		*ucp = ue;
  335|  3.26k|	for (; uc < ue && --len;) {
  ------------------
  |  Branch (335:9): [True: 3.22k, False: 46]
  |  Branch (335:20): [True: 2.50k, False: 713]
  ------------------
  336|  2.50k|		if (*uc++ != *++str) {
  ------------------
  |  Branch (336:7): [True: 70, False: 2.43k]
  ------------------
  337|     70|			DPRINTF("Bad const: ", uc, *ucp);
  ------------------
  |  |   52|     70|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  338|     70|			return 0;
  339|     70|		}
  340|  2.50k|	}
  341|    759|	DPRINTF("Good const: ", uc, *ucp);
  ------------------
  |  |   52|    759|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  342|    759|	return 1;
  343|    829|}
is_json.c:json_parse_number:
  276|  11.8k|{
  277|  11.8k|	const unsigned char *uc = *ucp;
  278|  11.8k|	int got = 0;
  279|       |
  280|  11.8k|	DPRINTF("Parse number: ", uc, *ucp);
  ------------------
  |  |   52|  11.8k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  281|  11.8k|	if (uc == ue)
  ------------------
  |  Branch (281:6): [True: 0, False: 11.8k]
  ------------------
  282|      0|		return 0;
  283|  11.8k|	if (*uc == '-')
  ------------------
  |  Branch (283:6): [True: 203, False: 11.6k]
  ------------------
  284|    203|		uc++;
  285|       |
  286|  8.68M|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (286:9): [True: 8.68M, False: 44]
  ------------------
  287|  8.68M|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (287:7): [True: 11.8k, False: 8.67M]
  ------------------
  288|  11.8k|			break;
  289|  8.67M|		got = 1;
  290|  8.67M|	}
  291|  11.8k|	if (uc == ue)
  ------------------
  |  Branch (291:6): [True: 44, False: 11.8k]
  ------------------
  292|     44|		goto out;
  293|  11.8k|	if (*uc == '.')
  ------------------
  |  Branch (293:6): [True: 256, False: 11.5k]
  ------------------
  294|    256|		uc++;
  295|  12.2k|	for (; uc < ue; uc++) {
  ------------------
  |  Branch (295:9): [True: 12.2k, False: 23]
  ------------------
  296|  12.2k|		if (!json_isdigit(*uc))
  ------------------
  |  Branch (296:7): [True: 11.7k, False: 434]
  ------------------
  297|  11.7k|			break;
  298|    434|		got = 1;
  299|    434|	}
  300|  11.8k|	if (uc == ue)
  ------------------
  |  Branch (300:6): [True: 23, False: 11.7k]
  ------------------
  301|     23|		goto out;
  302|  11.7k|	if (got && (*uc == 'e' || *uc == 'E')) {
  ------------------
  |  Branch (302:6): [True: 2.35k, False: 9.44k]
  |  Branch (302:14): [True: 823, False: 1.53k]
  |  Branch (302:28): [True: 235, False: 1.29k]
  ------------------
  303|  1.05k|		uc++;
  304|  1.05k|		got = 0;
  305|  1.05k|		if (uc == ue)
  ------------------
  |  Branch (305:7): [True: 15, False: 1.04k]
  ------------------
  306|     15|			goto out;
  307|  1.04k|		if (*uc == '+' || *uc == '-')
  ------------------
  |  Branch (307:7): [True: 203, False: 840]
  |  Branch (307:21): [True: 393, False: 447]
  ------------------
  308|    596|			uc++;
  309|  2.54k|		for (; uc < ue; uc++) {
  ------------------
  |  Branch (309:10): [True: 2.51k, False: 28]
  ------------------
  310|  2.51k|			if (!json_isdigit(*uc))
  ------------------
  |  Branch (310:8): [True: 1.01k, False: 1.49k]
  ------------------
  311|  1.01k|				break;
  312|  1.49k|			got = 1;
  313|  1.49k|		}
  314|  1.04k|	}
  315|  11.8k|out:
  316|  11.8k|	if (!got)
  ------------------
  |  Branch (316:6): [True: 9.50k, False: 2.36k]
  ------------------
  317|  9.50k|		DPRINTF("Bad number: ", uc, *ucp);
  ------------------
  |  |   52|  9.50k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  318|  2.36k|	else
  319|  2.36k|		DPRINTF("Good number: ", uc, *ucp);
  ------------------
  |  |   52|  2.36k|#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
  |  |  ------------------
  |  |  |  Branch (52:53): [Folded - Ignored]
  |  |  ------------------
  ------------------
  320|  11.8k|	*ucp = uc;
  321|  11.8k|	return got;
  322|  11.7k|}

file_is_simh:
  150|  10.4k|{
  151|  10.4k|	const unsigned char *uc = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  10.4k|#define CAST(T, b)	((T)(b))
  ------------------
  152|  10.4k|	const unsigned char *ue = uc + b->flen;
  153|  10.4k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  10.4k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  10.4k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  10.4k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
  154|       |
  155|  10.4k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  10.4k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  10.4k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (155:6): [True: 0, False: 10.4k]
  ------------------
  156|      0|		return 0;
  157|       |
  158|  10.4k|	if (!simh_parse(uc, ue))
  ------------------
  |  Branch (158:6): [True: 10.3k, False: 37]
  ------------------
  159|  10.3k|		return 0;
  160|       |
  161|     37|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     37|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (161:6): [True: 0, False: 37]
  ------------------
  162|      0|		return 1;
  163|       |
  164|     37|	if (mime) {
  ------------------
  |  Branch (164:6): [True: 0, False: 37]
  ------------------
  165|      0|		if (file_printf(ms, "application/SIMH-tape-data") == -1)
  ------------------
  |  Branch (165:7): [True: 0, False: 0]
  ------------------
  166|      0|			return -1;
  167|      0|		return 1;
  168|      0|	}
  169|       |
  170|     37|	if (file_printf(ms, "SIMH tape data") == -1)
  ------------------
  |  Branch (170:6): [True: 0, False: 37]
  ------------------
  171|      0|		return -1;
  172|       |
  173|     37|	return 1;
  174|     37|}
is_simh.c:simh_parse:
  111|  10.4k|{
  112|  10.4k|	uint32_t nbytes, cbytes;
  113|  10.4k|	const unsigned char *orig_uc = uc;
  114|  10.4k|	size_t nt = 0, nr = 0;
  115|       |
  116|  10.4k|	(void)memcpy(simh_bo.s, "\01\02\03\04", 4);
  117|       |
  118|   119k|	while (ue - uc >= CAST(ptrdiff_t, sizeof(nbytes))) {
  ------------------
  |  |  444|   119k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (118:9): [True: 119k, False: 739]
  ------------------
  119|   119k|		nbytes = getlen(&uc);
  120|   119k|		if ((nt > 0 || nr > 0) && nbytes == 0xFFFFFFFF)
  ------------------
  |  Branch (120:8): [True: 27.4k, False: 91.7k]
  |  Branch (120:18): [True: 82.0k, False: 9.69k]
  |  Branch (120:29): [True: 3, False: 109k]
  ------------------
  121|       |			/* EOM after at least one record or tapemark */
  122|      3|			break;
  123|   119k|		if (nbytes == 0) {
  ------------------
  |  Branch (123:7): [True: 1.23k, False: 117k]
  ------------------
  124|  1.23k|			nt++;	/* count tapemarks */
  125|  1.23k|#if SIMH_TAPEMARKS
  126|  1.23k|			if (nt == SIMH_TAPEMARKS)
  ------------------
  |  |   65|  1.23k|#define SIMH_TAPEMARKS 10
  ------------------
  |  Branch (126:8): [True: 110, False: 1.12k]
  ------------------
  127|    110|				break;
  128|  1.12k|#endif
  129|  1.12k|			continue;
  130|  1.23k|		}
  131|       |		/* handle a data record */
  132|   117k|		uc += nbytes;
  133|   117k|		if (ue - uc < CAST(ptrdiff_t, sizeof(nbytes)))
  ------------------
  |  |  444|   117k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (133:7): [True: 9.29k, False: 108k]
  ------------------
  134|  9.29k|			break;
  135|   108k|		cbytes = getlen(&uc);
  136|   108k|		if (nbytes != cbytes)
  ------------------
  |  Branch (136:7): [True: 255, False: 108k]
  ------------------
  137|    255|			return 0;
  138|   108k|		nr++;
  139|   108k|	}
  140|  10.1k|	if (nt * sizeof(uint32_t) == CAST(size_t, uc - orig_uc))
  ------------------
  |  |  444|  10.1k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (140:6): [True: 842, False: 9.30k]
  ------------------
  141|    842|		return 0;	/* All examined data was tapemarks (0) */
  142|  9.30k|	if (nr == 0)		/* No records */
  ------------------
  |  Branch (142:6): [True: 9.26k, False: 37]
  ------------------
  143|  9.26k|		return 0;
  144|     37|	return 1;
  145|  9.30k|}
is_simh.c:getlen:
   95|   227k|{
   96|   227k|	uint32_t n;
   97|   227k|	memcpy(&n, *uc, sizeof(n));
   98|   227k|	*uc += sizeof(n);
   99|   227k|	if (NEED_SWAP)
  ------------------
  |  |   75|   227k|#define NEED_SWAP	(simh_bo.u == CAST(uint32_t, 0x01020304))
  |  |  ------------------
  |  |  |  |  444|   227k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (75:19): [True: 0, False: 227k]
  |  |  ------------------
  ------------------
  100|      0|		n = swap4(n);
  101|   227k|	if (n == 0xffffffff)	/* check for End of Medium */
  ------------------
  |  Branch (101:6): [True: 40, False: 227k]
  ------------------
  102|     40|		return n;
  103|   227k|	n &= 0x00ffffff;	/* keep only the record len */
  104|   227k|	if (n & 1)
  ------------------
  |  Branch (104:6): [True: 5.68k, False: 222k]
  ------------------
  105|  5.68k|		n++;
  106|   227k|	return n;
  107|   227k|}

file_is_tar:
   64|  10.4k|{
   65|  10.4k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  10.4k|#define CAST(T, b)	((T)(b))
  ------------------
   66|  10.4k|	size_t nbytes = b->flen;
   67|       |	/*
   68|       |	 * Do the tar test first, because if the first file in the tar
   69|       |	 * archive starts with a dot, we can confuse it with an nroff file.
   70|       |	 */
   71|  10.4k|	int tar;
   72|  10.4k|	int mime = ms->flags & MAGIC_MIME;
  ------------------
  |  |   44|  10.4k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   37|  10.4k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  ------------------
  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  ------------------
  |  |  |  |   43|  10.4k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  ------------------
  ------------------
   73|       |
   74|  10.4k|	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   45|  10.4k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)) != 0)
  ------------------
  |  |   46|  10.4k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (74:6): [True: 0, False: 10.4k]
  ------------------
   75|      0|		return 0;
   76|       |
   77|  10.4k|	tar = is_tar(buf, nbytes);
   78|  10.4k|	if (tar < 1 || tar > 3)
  ------------------
  |  Branch (78:6): [True: 10.3k, False: 25]
  |  Branch (78:17): [True: 0, False: 25]
  ------------------
   79|  10.3k|		return 0;
   80|       |
   81|     25|	if (mime == MAGIC_MIME_ENCODING)
  ------------------
  |  |   43|     25|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  ------------------
  |  Branch (81:6): [True: 0, False: 25]
  ------------------
   82|      0|		return 1;
   83|       |
   84|     25|	if (file_printf(ms, "%s", mime ? "application/x-tar" :
  ------------------
  |  Branch (84:6): [True: 0, False: 25]
  |  Branch (84:28): [True: 0, False: 25]
  ------------------
   85|     25|	    tartype[tar - 1]) == -1)
   86|      0|		return -1;
   87|       |
   88|     25|	return 1;
   89|     25|}
is_tar.c:is_tar:
  100|  10.4k|{
  101|  10.4k|	static const char gpkg_match[] = "/gpkg-1";
  102|       |
  103|  10.4k|	const union record *header = RCAST(const union record *,
  ------------------
  |  |  445|  10.4k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  104|  10.4k|	    RCAST(const void *, buf));
  105|  10.4k|	size_t i;
  106|  10.4k|	int sum, recsum;
  107|  10.4k|	const unsigned char *p, *ep;
  108|  10.4k|	const char *nulp;
  109|       |
  110|  10.4k|	if (nbytes < sizeof(*header))
  ------------------
  |  Branch (110:6): [True: 7.19k, False: 3.20k]
  ------------------
  111|  7.19k|		return 0;
  112|       |
  113|       |	/* If the file looks like Gentoo GLEP 78 binary package (GPKG),
  114|       |	 * don't waste time on further checks and fall back to magic rules.
  115|       |	 */
  116|  3.20k|	nulp = CAST(const char *,
  ------------------
  |  |  444|  3.20k|#define CAST(T, b)	((T)(b))
  ------------------
  117|  3.20k|	    memchr(header->header.name, 0, sizeof(header->header.name)));
  118|  3.20k|	if (nulp != NULL && nulp >= header->header.name + sizeof(gpkg_match) &&
  ------------------
  |  Branch (118:6): [True: 2.88k, False: 328]
  |  Branch (118:22): [True: 2.12k, False: 752]
  ------------------
  119|  3.20k|	    memcmp(nulp - sizeof(gpkg_match) + 1, gpkg_match,
  ------------------
  |  Branch (119:6): [True: 41, False: 2.08k]
  ------------------
  120|  2.12k|	    sizeof(gpkg_match)) == 0)
  121|     41|	    return 0;
  122|       |
  123|  3.16k|	recsum = from_oct(header->header.chksum, sizeof(header->header.chksum));
  124|       |
  125|  3.16k|	sum = 0;
  126|  3.16k|	p = header->charptr;
  127|  3.16k|	ep = header->charptr + sizeof(*header);
  128|  1.62M|	while (p < ep)
  ------------------
  |  Branch (128:9): [True: 1.62M, False: 3.16k]
  ------------------
  129|  1.62M|		sum += *p++;
  130|       |
  131|       |	/* Adjust checksum to count the "chksum" field as blanks. */
  132|  28.5k|	for (i = 0; i < sizeof(header->header.chksum); i++)
  ------------------
  |  Branch (132:14): [True: 25.3k, False: 3.16k]
  ------------------
  133|  25.3k|		sum -= header->header.chksum[i];
  134|  3.16k|	sum += ' ' * sizeof(header->header.chksum);
  135|       |
  136|  3.16k|	if (sum != recsum)
  ------------------
  |  Branch (136:6): [True: 3.14k, False: 25]
  ------------------
  137|  3.14k|		return 0;	/* Not a tar archive */
  138|       |
  139|     25|	if (strncmp(header->header.magic, GNUTMAGIC,
  ------------------
  |  |   73|     25|#define	GNUTMAGIC	"ustar  "	/* 7 chars and a null */
  ------------------
  |  Branch (139:6): [True: 1, False: 24]
  ------------------
  140|     25|	    sizeof(header->header.magic)) == 0)
  141|      1|		return 3;		/* GNU Unix Standard tar archive */
  142|       |
  143|     24|	if (strncmp(header->header.magic, TMAGIC,
  ------------------
  |  |   72|     24|#define	TMAGIC		"ustar"		/* 5 chars and a null */
  ------------------
  |  Branch (143:6): [True: 1, False: 23]
  ------------------
  144|     24|	    sizeof(header->header.magic)) == 0)
  145|      1|		return 2;		/* Unix Standard tar archive */
  146|       |
  147|     23|	return 1;			/* Old fashioned tar archive */
  148|     24|}
is_tar.c:from_oct:
  158|  3.16k|{
  159|  3.16k|	int	value;
  160|       |
  161|  3.16k|	if (digs == 0)
  ------------------
  |  Branch (161:6): [True: 0, False: 3.16k]
  ------------------
  162|      0|		return -1;
  163|       |
  164|  3.16k|	while (isspace(CAST(unsigned char, *where))) {	/* Skip spaces */
  165|    872|		where++;
  166|    872|		if (digs-- == 0)
  ------------------
  |  Branch (166:7): [True: 77, False: 795]
  ------------------
  167|     77|			return -1;		/* All blank field */
  168|    872|	}
  169|  3.09k|	value = 0;
  170|  3.46k|	while (digs > 0 && isodigit(*where)) {	/* Scan til non-octal */
  ------------------
  |  |   51|  3.44k|#define	isodigit(c)	( ((c) >= '0') && ((c) <= '7') )
  |  |  ------------------
  |  |  |  Branch (51:23): [True: 810, False: 2.63k]
  |  |  |  Branch (51:39): [True: 369, False: 441]
  |  |  ------------------
  ------------------
  |  Branch (170:9): [True: 3.44k, False: 17]
  ------------------
  171|    369|		value = (value << 3) | (*where++ - '0');
  172|    369|		digs--;
  173|    369|	}
  174|       |
  175|  3.09k|	if (digs > 0 && *where && !isspace(CAST(unsigned char, *where)))
  ------------------
  |  Branch (175:6): [True: 3.07k, False: 17]
  |  Branch (175:18): [True: 1.38k, False: 1.69k]
  |  Branch (175:28): [True: 1.37k, False: 12]
  ------------------
  176|  1.37k|		return -1;			/* Ended on non-(space/NUL) */
  177|       |
  178|  1.72k|	return value;
  179|  3.09k|}

magic_getpath:
  255|      2|{
  256|      2|	if (magicfile != NULL)
  ------------------
  |  Branch (256:6): [True: 2, False: 0]
  ------------------
  257|      2|		return magicfile;
  258|       |
  259|      0|	magicfile = getenv("MAGIC");
  260|      0|	if (magicfile != NULL)
  ------------------
  |  Branch (260:6): [True: 0, False: 0]
  ------------------
  261|      0|		return magicfile;
  262|       |
  263|      0|	return action == FILE_LOAD ? get_default_magic() : MAGIC;
  ------------------
  |  |  187|      0|#define	FILE_LOAD	0
  ------------------
  |  Branch (263:9): [True: 0, False: 0]
  ------------------
  264|      0|}
magic_open:
  268|      2|{
  269|      2|	return file_ms_alloc(flags);
  270|      2|}
magic_load:
  318|      2|{
  319|      2|	if (ms == NULL)
  ------------------
  |  Branch (319:6): [True: 0, False: 2]
  ------------------
  320|      0|		return -1;
  321|      2|	return file_apprentice(ms, magicfile, FILE_LOAD);
  ------------------
  |  |  187|      2|#define	FILE_LOAD	0
  ------------------
  322|      2|}
magic_buffer:
  550|  7.45k|{
  551|  7.45k|	if (ms == NULL)
  ------------------
  |  Branch (551:6): [True: 0, False: 7.45k]
  ------------------
  552|      0|		return NULL;
  553|  7.45k|	if (file_reset(ms, 1) == -1)
  ------------------
  |  Branch (553:6): [True: 0, False: 7.45k]
  ------------------
  554|      0|		return NULL;
  555|       |	/*
  556|       |	 * The main work is done here!
  557|       |	 * We have the file name and/or the data buffer to be identified.
  558|       |	 */
  559|  7.45k|	if (file_buffer(ms, -1, NULL, NULL, buf, nb) == -1) {
  ------------------
  |  Branch (559:6): [True: 58, False: 7.39k]
  ------------------
  560|     58|		return NULL;
  561|     58|	}
  562|  7.39k|	return file_getbuffer(ms);
  563|  7.45k|}
magic_setflags:
  593|      2|{
  594|      2|	if (ms == NULL)
  ------------------
  |  Branch (594:6): [True: 0, False: 2]
  ------------------
  595|      0|		return -1;
  596|       |#if !defined(HAVE_UTIME) && !defined(HAVE_UTIMES)
  597|       |	if (flags & MAGIC_PRESERVE_ATIME)
  598|       |		return -1;
  599|       |#endif
  600|      2|	ms->flags = flags;
  601|      2|	return 0;
  602|      2|}

file_fmtdatetime:
  273|  1.65k|{
  274|  1.65k|	char *pp;
  275|  1.65k|	time_t t;
  276|  1.65k|	struct tm *tm, tmz;
  277|       |
  278|  1.65k|	if (flags & FILE_T_WINDOWS) {
  ------------------
  |  |  529|  1.65k|#define FILE_T_WINDOWS	2
  ------------------
  |  Branch (278:6): [True: 966, False: 689]
  ------------------
  279|    966|		struct timespec ts;
  280|    966|		cdf_timestamp_to_timespec(&ts, CAST(cdf_timestamp_t, v));
  ------------------
  |  |  444|    966|#define CAST(T, b)	((T)(b))
  ------------------
  281|    966|		t = ts.tv_sec;
  282|    966|	} else {
  283|       |		// XXX: perhaps detect and print something if overflow
  284|       |		// on 32 bit time_t?
  285|    689|		t = CAST(time_t, v);
  ------------------
  |  |  444|    689|#define CAST(T, b)	((T)(b))
  ------------------
  286|    689|	}
  287|       |
  288|  1.65k|	if (t > MAX_CTIME)
  ------------------
  |  |  173|  1.65k|    CAST(time_t, sizeof(time_t) > 4 ? 0x3afff487cfULL : 0x7fffffffULL)
  |  |  ------------------
  |  |  |  |  444|  3.31k|#define CAST(T, b)	((T)(b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (444:25): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (288:6): [True: 85, False: 1.57k]
  ------------------
  289|     85|		goto out;
  290|       |
  291|  1.57k|	if (flags & FILE_T_LOCAL) {
  ------------------
  |  |  528|  1.57k|#define FILE_T_LOCAL	1
  ------------------
  |  Branch (291:6): [True: 198, False: 1.37k]
  ------------------
  292|    198|		tzset();
  293|    198|		tm = localtime_r(&t, &tmz);
  294|  1.37k|	} else {
  295|  1.37k|		tm = gmtime_r(&t, &tmz);
  296|  1.37k|	}
  297|  1.57k|	if (tm == NULL)
  ------------------
  |  Branch (297:6): [True: 92, False: 1.47k]
  ------------------
  298|     92|		goto out;
  299|  1.47k|	pp = asctime_r(tm, buf);
  300|       |
  301|  1.47k|	if (pp == NULL)
  ------------------
  |  Branch (301:6): [True: 124, False: 1.35k]
  ------------------
  302|    124|		goto out;
  303|  1.35k|	pp[strcspn(pp, "\n")] = '\0';
  304|  1.35k|	return pp;
  305|    301|out:
  306|    301|	strlcpy(buf, "*Invalid datetime*", bsize);
  307|    301|	return buf;
  308|  1.47k|}
file_fmtdate:
  316|     67|{
  317|     67|	struct tm tm;
  318|       |
  319|     67|	memset(&tm, 0, sizeof(tm));
  320|     67|	tm.tm_mday = v & 0x1f;
  321|     67|	tm.tm_mon = ((v >> 5) & 0xf) - 1;
  322|     67|	tm.tm_year = (v >> 9) + 80;
  323|       |
  324|     67|	if (strftime(buf, bsize, "%a, %b %d %Y", &tm) == 0)
  ------------------
  |  Branch (324:6): [True: 0, False: 67]
  ------------------
  325|      0|		goto out;
  326|       |
  327|     67|	return buf;
  328|      0|out:
  329|      0|	strlcpy(buf, "*Invalid date*", bsize);
  330|      0|	return buf;
  331|     67|}
file_fmttime:
  335|     67|{
  336|     67|	struct tm tm;
  337|       |
  338|     67|	memset(&tm, 0, sizeof(tm));
  339|     67|	tm.tm_sec = (v & 0x1f) * 2;
  340|     67|	tm.tm_min = ((v >> 5) & 0x3f);
  341|     67|	tm.tm_hour = (v >> 11);
  342|       |
  343|     67|	if (strftime(buf, bsize, "%T", &tm) == 0)
  ------------------
  |  Branch (343:6): [True: 0, False: 67]
  ------------------
  344|      0|		goto out;
  345|       |
  346|     67|	return buf;
  347|      0|out:
  348|      0|	strlcpy(buf, "*Invalid time*", bsize);
  349|      0|	return buf;
  350|       |
  351|     67|}

file_trycdf:
  542|  10.4k|{
  543|  10.4k|	int fd = b->fd;
  544|  10.4k|	const unsigned char *buf = CAST(const unsigned char *, b->fbuf);
  ------------------
  |  |  444|  10.4k|#define CAST(T, b)	((T)(b))
  ------------------
  545|  10.4k|	size_t nbytes = b->flen;
  546|  10.4k|	cdf_info_t info;
  547|  10.4k|	cdf_header_t h;
  548|  10.4k|	cdf_sat_t sat, ssat;
  549|  10.4k|	cdf_stream_t sst, scn;
  550|  10.4k|	cdf_dir_t dir;
  551|  10.4k|	int i;
  552|  10.4k|	const char *expn = "";
  553|  10.4k|	const cdf_directory_t *root_storage;
  554|       |
  555|  10.4k|	scn.sst_tab = NULL;
  556|  10.4k|	info.i_fd = fd;
  557|  10.4k|	info.i_buf = buf;
  558|  10.4k|	info.i_len = nbytes;
  559|  10.4k|	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   45|  10.4k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
              	if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
  ------------------
  |  |   46|  10.4k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (559:6): [True: 0, False: 10.4k]
  ------------------
  560|      0|		return 0;
  561|  10.4k|	if (cdf_read_header(&info, &h) == -1)
  ------------------
  |  Branch (561:6): [True: 8.52k, False: 1.88k]
  ------------------
  562|  8.52k|		return 0;
  563|       |#ifdef CDF_DEBUG
  564|       |	cdf_dump_header(&h);
  565|       |#endif
  566|       |
  567|  1.88k|	if ((i = cdf_read_sat(&info, &h, &sat)) == -1) {
  ------------------
  |  Branch (567:6): [True: 157, False: 1.72k]
  ------------------
  568|    157|		expn = "Can't read SAT";
  569|    157|		goto out0;
  570|    157|	}
  571|       |#ifdef CDF_DEBUG
  572|       |	cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
  573|       |#endif
  574|       |
  575|  1.72k|	if ((i = cdf_read_ssat(&info, &h, &sat, &ssat)) == -1) {
  ------------------
  |  Branch (575:6): [True: 225, False: 1.49k]
  ------------------
  576|    225|		expn = "Can't read SSAT";
  577|    225|		goto out1;
  578|    225|	}
  579|       |#ifdef CDF_DEBUG
  580|       |	cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
  581|       |#endif
  582|       |
  583|  1.49k|	if ((i = cdf_read_dir(&info, &h, &sat, &dir)) == -1) {
  ------------------
  |  Branch (583:6): [True: 141, False: 1.35k]
  ------------------
  584|    141|		expn = "Can't read directory";
  585|    141|		goto out2;
  586|    141|	}
  587|       |
  588|  1.35k|	if ((i = cdf_read_short_stream(&info, &h, &sat, &dir, &sst,
  ------------------
  |  Branch (588:6): [True: 109, False: 1.24k]
  ------------------
  589|  1.35k|	    &root_storage)) == -1) {
  590|    109|		expn = "Cannot read short stream";
  591|    109|		goto out3;
  592|    109|	}
  593|       |#ifdef CDF_DEBUG
  594|       |	cdf_dump_dir(&info, &h, &sat, &ssat, &sst, &dir);
  595|       |#endif
  596|       |#ifdef notdef
  597|       |	if (root_storage) {
  598|       |		if (NOTMIME(ms)) {
  599|       |			char clsbuf[128];
  600|       |			if (file_printf(ms, "CLSID %s, ",
  601|       |			    format_clsid(clsbuf, sizeof(clsbuf),
  602|       |			    root_storage->d_storage_uuid)) == -1)
  603|       |				return -1;
  604|       |		}
  605|       |	}
  606|       |#endif
  607|       |
  608|  1.24k|	if (cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (608:6): [True: 33, False: 1.21k]
  ------------------
  609|  1.24k|	    "FileHeader", &scn) != -1) {
  610|     33|#define HWP5_SIGNATURE "HWP Document File"
  611|     33|		if (scn.sst_len * scn.sst_ss >= sizeof(HWP5_SIGNATURE) - 1
  ------------------
  |  |  610|     33|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (611:7): [True: 27, False: 6]
  ------------------
  612|     33|		    && memcmp(scn.sst_tab, HWP5_SIGNATURE,
  ------------------
  |  |  610|     27|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  |  Branch (612:10): [True: 1, False: 26]
  ------------------
  613|     27|		    sizeof(HWP5_SIGNATURE) - 1) == 0) {
  ------------------
  |  |  610|     27|#define HWP5_SIGNATURE "HWP Document File"
  ------------------
  614|      1|		    if (NOTMIME(ms)) {
  ------------------
  |  |   42|      1|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|      1|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      1|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      1|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  615|      1|			if (file_printf(ms,
  ------------------
  |  Branch (615:8): [True: 0, False: 1]
  ------------------
  616|      1|			    "Hancom HWP (Hangul Word Processor) file, version 5.0") == -1)
  617|      0|			    return -1;
  618|      1|		    } else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (618:18): [True: 0, False: 0]
  ------------------
  619|      0|			if (file_printf(ms, "application/x-hwp") == -1)
  ------------------
  |  Branch (619:8): [True: 0, False: 0]
  ------------------
  620|      0|			    return -1;
  621|      0|		    }
  622|      1|		    i = 1;
  623|      1|		    goto out5;
  624|     32|		} else {
  625|     32|		    cdf_zero_stream(&scn);
  626|     32|		}
  627|     33|	}
  628|       |
  629|  1.24k|	if ((i = cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
  ------------------
  |  Branch (629:6): [True: 406, False: 841]
  ------------------
  630|  1.24k|	    &scn)) == -1) {
  631|    406|		if (errno != ESRCH) {
  ------------------
  |  Branch (631:7): [True: 61, False: 345]
  ------------------
  632|     61|			expn = "Cannot read summary info";
  633|     61|		}
  634|    841|	} else {
  635|    841|		i = cdf_check_summary_info(ms, &info, &h,
  636|    841|		    &sat, &ssat, &sst, &dir, &scn, root_storage, &expn);
  637|    841|		cdf_zero_stream(&scn);
  638|    841|	}
  639|  1.24k|	if (i <= 0) {
  ------------------
  |  Branch (639:6): [True: 1.09k, False: 150]
  ------------------
  640|  1.09k|		if ((i = cdf_read_doc_summary_info(&info, &h, &sat, &ssat,
  ------------------
  |  Branch (640:7): [True: 966, False: 131]
  ------------------
  641|  1.09k|		    &sst, &dir, &scn)) == -1) {
  642|    966|			if (errno != ESRCH) {
  ------------------
  |  Branch (642:8): [True: 23, False: 943]
  ------------------
  643|     23|				expn = "Cannot read summary info";
  644|     23|			}
  645|    966|		} else {
  646|    131|			i = cdf_check_summary_info(ms, &info, &h, &sat, &ssat,
  647|    131|			    &sst, &dir, &scn, root_storage, &expn);
  648|    131|		}
  649|  1.09k|	}
  650|  1.24k|	if (i <= 0) {
  ------------------
  |  Branch (650:6): [True: 1.09k, False: 150]
  ------------------
  651|  1.09k|		i = cdf_file_dir_info(ms, &dir);
  652|  1.09k|		if (i < 0)
  ------------------
  |  Branch (652:7): [True: 1.09k, False: 6]
  ------------------
  653|  1.09k|			expn = "Cannot read section info";
  654|  1.09k|	}
  655|  1.24k|out5:
  656|  1.24k|	cdf_zero_stream(&scn);
  657|  1.24k|	cdf_zero_stream(&sst);
  658|  1.35k|out3:
  659|  1.35k|	free(dir.dir_tab);
  660|  1.49k|out2:
  661|  1.49k|	free(ssat.sat_tab);
  662|  1.72k|out1:
  663|  1.72k|	free(sat.sat_tab);
  664|  1.88k|out0:
  665|       |	/* If we handled it already, return */
  666|  1.88k|	if (i != -1)
  ------------------
  |  Branch (666:6): [True: 157, False: 1.72k]
  ------------------
  667|    157|		return i;
  668|       |	/* Provide a default handler */
  669|  1.72k|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|  1.72k|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|  1.72k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  1.72k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  1.72k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 1.72k, False: 0]
  |  |  ------------------
  ------------------
  670|  1.72k|		if (file_printf(ms,
  ------------------
  |  Branch (670:7): [True: 0, False: 1.72k]
  ------------------
  671|  1.72k|		    "Composite Document File V2 Document") == -1)
  672|      0|			return -1;
  673|  1.72k|		if (*expn)
  ------------------
  |  Branch (673:7): [True: 1.72k, False: 0]
  ------------------
  674|  1.72k|			if (file_printf(ms, ", %s", expn) == -1)
  ------------------
  |  Branch (674:8): [True: 0, False: 1.72k]
  ------------------
  675|      0|				return -1;
  676|  1.72k|	} else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (676:13): [True: 0, False: 0]
  ------------------
  677|       |		/* https://reposcope.com/mimetype/application/x-ole-storage */
  678|      0|		if (file_printf(ms, "application/x-ole-storage") == -1)
  ------------------
  |  Branch (678:7): [True: 0, False: 0]
  ------------------
  679|      0|			return -1;
  680|      0|	}
  681|  1.72k|	return 1;
  682|  1.72k|}
readcdf.c:cdf_check_summary_info:
  391|    972|{
  392|    972|	int i;
  393|    972|	const char *str = NULL;
  394|    972|	cdf_directory_t *d;
  395|    972|	char name[__arraycount(d->d_name)];
  396|    972|	size_t j, k;
  397|       |
  398|       |#ifdef CDF_DEBUG
  399|       |	cdf_dump_summary_info(h, scn);
  400|       |#endif
  401|    972|	if ((i = cdf_file_summary_info(ms, h, scn, root_storage)) < 0) {
  ------------------
  |  Branch (401:6): [True: 822, False: 150]
  ------------------
  402|    822|	    *expn = "Can't expand summary_info";
  403|    822|	    return i;
  404|    822|	}
  405|    150|	if (i == 1)
  ------------------
  |  Branch (405:6): [True: 150, False: 0]
  ------------------
  406|    150|		return i;
  407|      0|	for (j = 0; str == NULL && j < dir->dir_len; j++) {
  ------------------
  |  Branch (407:14): [True: 0, False: 0]
  |  Branch (407:29): [True: 0, False: 0]
  ------------------
  408|      0|		d = &dir->dir_tab[j];
  409|      0|		for (k = 0; k < sizeof(name); k++)
  ------------------
  |  Branch (409:15): [True: 0, False: 0]
  ------------------
  410|      0|			name[k] = CAST(char, cdf_tole2(d->d_name[k]));
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  411|      0|		str = cdf_app_to_mime(name,
  412|      0|				      NOTMIME(ms) ? name2desc : name2mime);
  ------------------
  |  |   42|      0|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|      0|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  413|      0|	}
  414|      0|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|      0|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|      0|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  415|      0|		if (str != NULL) {
  ------------------
  |  Branch (415:7): [True: 0, False: 0]
  ------------------
  416|      0|			if (file_printf(ms, "%s", str) == -1)
  ------------------
  |  Branch (416:8): [True: 0, False: 0]
  ------------------
  417|      0|				return -1;
  418|      0|			i = 1;
  419|      0|		}
  420|      0|	} else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (420:13): [True: 0, False: 0]
  ------------------
  421|      0|		if (str == NULL)
  ------------------
  |  Branch (421:7): [True: 0, False: 0]
  ------------------
  422|      0|			str = "vnd.ms-office";
  423|      0|		if (file_printf(ms, "application/%s", str) == -1)
  ------------------
  |  Branch (423:7): [True: 0, False: 0]
  ------------------
  424|      0|			return -1;
  425|      0|		i = 1;
  426|      0|	}
  427|      0|	if (i <= 0) {
  ------------------
  |  Branch (427:6): [True: 0, False: 0]
  ------------------
  428|      0|		i = cdf_file_catalog_info(ms, info, h, sat, ssat, sst,
  429|      0|					  dir, scn);
  430|      0|	}
  431|      0|	return i;
  432|      0|}
readcdf.c:cdf_file_summary_info:
  299|    972|{
  300|    972|	cdf_summary_info_header_t si;
  301|    972|	cdf_property_info_t *info;
  302|    972|	size_t count;
  303|    972|	int m;
  304|       |
  305|    972|	if (cdf_unpack_summary_info(sst, h, &si, &info, &count) == -1)
  ------------------
  |  Branch (305:6): [True: 553, False: 419]
  ------------------
  306|    553|		return -1;
  307|       |
  308|    419|	if (NOTMIME(ms)) {
  ------------------
  |  |   42|    419|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    419|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    419|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    419|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 419, False: 0]
  |  |  ------------------
  ------------------
  309|    419|		const char *str;
  310|       |
  311|    419|		if (file_printf(ms, "Composite Document File V2 Document")
  ------------------
  |  Branch (311:7): [True: 0, False: 419]
  ------------------
  312|    419|		    == -1)
  313|      0|			return -1;
  314|       |
  315|    419|		if (file_printf(ms, ", %s Endian",
  ------------------
  |  Branch (315:7): [True: 0, False: 419]
  ------------------
  316|    419|		    si.si_byte_order == 0xfffe ?  "Little" : "Big") == -1)
  ------------------
  |  Branch (316:7): [True: 13, False: 406]
  ------------------
  317|      0|			return -2;
  318|    419|		switch (si.si_os) {
  319|     30|		case 2:
  ------------------
  |  Branch (319:3): [True: 30, False: 389]
  ------------------
  320|     30|			if (file_printf(ms, ", Os: Windows, Version %d.%d",
  ------------------
  |  Branch (320:8): [True: 0, False: 30]
  ------------------
  321|     30|			    si.si_os_version & 0xff,
  322|     30|			    CAST(uint32_t, si.si_os_version) >> 8) == -1)
  ------------------
  |  |  444|     30|#define CAST(T, b)	((T)(b))
  ------------------
  323|      0|				return -2;
  324|     30|			break;
  325|     30|		case 1:
  ------------------
  |  Branch (325:3): [True: 9, False: 410]
  ------------------
  326|      9|			if (file_printf(ms, ", Os: MacOS, Version %d.%d",
  ------------------
  |  Branch (326:8): [True: 0, False: 9]
  ------------------
  327|      9|			    CAST(uint32_t, si.si_os_version) >> 8,
  ------------------
  |  |  444|      9|#define CAST(T, b)	((T)(b))
  ------------------
  328|      9|			    si.si_os_version & 0xff) == -1)
  329|      0|				return -2;
  330|      9|			break;
  331|    380|		default:
  ------------------
  |  Branch (331:3): [True: 380, False: 39]
  ------------------
  332|    380|			if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os,
  ------------------
  |  Branch (332:8): [True: 0, False: 380]
  ------------------
  333|    380|			    si.si_os_version & 0xff,
  334|    380|			    CAST(uint32_t, si.si_os_version) >> 8) == -1)
  ------------------
  |  |  444|    380|#define CAST(T, b)	((T)(b))
  ------------------
  335|      0|				return -2;
  336|    380|			break;
  337|    419|		}
  338|    419|		if (root_storage) {
  ------------------
  |  Branch (338:7): [True: 169, False: 250]
  ------------------
  339|    169|			str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
  340|    169|			    clsid2desc);
  341|    169|			if (str) {
  ------------------
  |  Branch (341:8): [True: 1, False: 168]
  ------------------
  342|      1|				if (file_printf(ms, ", %s", str) == -1)
  ------------------
  |  Branch (342:9): [True: 0, False: 1]
  ------------------
  343|      0|					return -2;
  344|      1|			}
  345|    169|		}
  346|    419|	}
  347|       |
  348|    419|	m = cdf_file_property_info(ms, info, count, root_storage);
  349|    419|	free(info);
  350|       |
  351|    419|	return m == -1 ? -2 : m;
  ------------------
  |  Branch (351:9): [True: 269, False: 150]
  ------------------
  352|    419|}
readcdf.c:cdf_clsid_to_mime:
   97|    169|{
   98|    169|	size_t i;
   99|    337|	for (i = 0; cv[i].mime != NULL; i++) {
  ------------------
  |  Branch (99:14): [True: 169, False: 168]
  ------------------
  100|    169|		if (clsid[0] == cv[i].clsid[0] && clsid[1] == cv[i].clsid[1])
  ------------------
  |  Branch (100:7): [True: 64, False: 105]
  |  Branch (100:37): [True: 1, False: 63]
  ------------------
  101|      1|			return cv[i].mime;
  102|    169|	}
  103|       |#ifdef CDF_DEBUG
  104|       |	fprintf(stderr, "unknown mime %" PRIx64 ", %" PRIx64 "\n", clsid[0],
  105|       |	    clsid[1]);
  106|       |#endif
  107|    168|	return NULL;
  108|    169|}
readcdf.c:cdf_file_property_info:
  150|    419|{
  151|    419|	size_t i;
  152|    419|	cdf_timestamp_t tp;
  153|    419|	struct timespec ts;
  154|    419|	char buf[64];
  155|    419|	const char *str = NULL;
  156|    419|	const char *s, *e;
  157|    419|	int len;
  158|       |
  159|    419|	if (!NOTMIME(ms) && root_storage)
  ------------------
  |  |   42|    838|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    419|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    419|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    419|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (159:6): [True: 0, False: 419]
  |  Branch (159:22): [True: 0, False: 0]
  ------------------
  160|      0|		str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
  161|      0|		    clsid2mime);
  162|       |
  163|  1.54k|	for (i = 0; i < count; i++) {
  ------------------
  |  Branch (163:14): [True: 1.39k, False: 150]
  ------------------
  164|  1.39k|		cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
  165|  1.39k|		switch (info[i].pi_type) {
  166|     74|		case CDF_NULL:
  ------------------
  |  |  198|     74|#define CDF_NULL		0x00000001
  ------------------
  |  Branch (166:3): [True: 74, False: 1.32k]
  ------------------
  167|     74|			break;
  168|     51|		case CDF_SIGNED16:
  ------------------
  |  |  199|     51|#define CDF_SIGNED16		0x00000002
  ------------------
  |  Branch (168:3): [True: 51, False: 1.34k]
  ------------------
  169|     51|			if (NOTMIME(ms) && file_printf(ms, ", %s: %hd", buf,
  ------------------
  |  |   42|    102|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     51|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     51|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     51|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 51, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (169:23): [True: 0, False: 51]
  ------------------
  170|     51|			    info[i].pi_s16) == -1)
  ------------------
  |  |  187|     51|#define pi_s16	pi_val._pi_s16
  ------------------
  171|      0|				return -1;
  172|     51|			break;
  173|     69|		case CDF_SIGNED32:
  ------------------
  |  |  200|     69|#define CDF_SIGNED32		0x00000003
  ------------------
  |  Branch (173:3): [True: 69, False: 1.32k]
  ------------------
  174|     69|			if (NOTMIME(ms) && file_printf(ms, ", %s: %d", buf,
  ------------------
  |  |   42|    138|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     69|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     69|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     69|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 69, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (174:23): [True: 0, False: 69]
  ------------------
  175|     69|			    info[i].pi_s32) == -1)
  ------------------
  |  |  185|     69|#define pi_s32	pi_val._pi_s32
  ------------------
  176|      0|				return -1;
  177|     69|			break;
  178|     69|		case CDF_UNSIGNED32:
  ------------------
  |  |  215|     63|#define CDF_UNSIGNED32		0x00000013
  ------------------
  |  Branch (178:3): [True: 63, False: 1.33k]
  ------------------
  179|     63|			if (NOTMIME(ms) && file_printf(ms, ", %s: %u", buf,
  ------------------
  |  |   42|    126|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     63|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     63|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     63|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 63, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (179:23): [True: 0, False: 63]
  ------------------
  180|     63|			    info[i].pi_u32) == -1)
  ------------------
  |  |  184|     63|#define pi_u32	pi_val._pi_u32
  ------------------
  181|      0|				return -1;
  182|     63|			break;
  183|     67|		case CDF_FLOAT:
  ------------------
  |  |  201|     67|#define CDF_FLOAT		0x00000004
  ------------------
  |  Branch (183:3): [True: 67, False: 1.32k]
  ------------------
  184|     67|			if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
  ------------------
  |  |   42|    134|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     67|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     67|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     67|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 67, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (184:23): [True: 0, False: 67]
  ------------------
  185|     67|			    info[i].pi_f) == -1)
  ------------------
  |  |  188|     67|#define pi_f	pi_val._pi_f
  ------------------
  186|      0|				return -1;
  187|     67|			break;
  188|     67|		case CDF_DOUBLE:
  ------------------
  |  |  202|     46|#define CDF_DOUBLE		0x00000005
  ------------------
  |  Branch (188:3): [True: 46, False: 1.35k]
  ------------------
  189|     46|			if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf,
  ------------------
  |  |   42|     92|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|     46|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|     46|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|     46|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 46, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (189:23): [True: 0, False: 46]
  ------------------
  190|     46|			    info[i].pi_d) == -1)
  ------------------
  |  |  189|     46|#define pi_d	pi_val._pi_d
  ------------------
  191|      0|				return -1;
  192|     46|			break;
  193|    125|		case CDF_LENGTH32_STRING:
  ------------------
  |  |  226|    125|#define CDF_LENGTH32_STRING	0x0000001e
  ------------------
  |  Branch (193:3): [True: 125, False: 1.27k]
  ------------------
  194|    291|		case CDF_LENGTH32_WSTRING:
  ------------------
  |  |  227|    291|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (194:3): [True: 166, False: 1.23k]
  ------------------
  195|    291|			len = info[i].pi_str.s_len;
  ------------------
  |  |  191|    291|#define pi_str	pi_val._pi_str
  ------------------
  196|    291|			if (len > 1) {
  ------------------
  |  Branch (196:8): [True: 209, False: 82]
  ------------------
  197|    209|				char vbuf[1024];
  198|    209|				size_t j, k = 1;
  199|       |
  200|    209|				if (info[i].pi_type == CDF_LENGTH32_WSTRING)
  ------------------
  |  |  227|    209|#define CDF_LENGTH32_WSTRING	0x0000001f
  ------------------
  |  Branch (200:9): [True: 109, False: 100]
  ------------------
  201|    109|				    k++;
  202|    209|				s = info[i].pi_str.s_buf;
  ------------------
  |  |  191|    209|#define pi_str	pi_val._pi_str
  ------------------
  203|    209|				e = info[i].pi_str.s_buf + len;
  ------------------
  |  |  191|    209|#define pi_str	pi_val._pi_str
  ------------------
  204|  35.6k|				for (j = 0; s < e && j < sizeof(vbuf)
  ------------------
  |  Branch (204:17): [True: 35.5k, False: 59]
  |  Branch (204:26): [True: 35.5k, False: 11]
  ------------------
  205|  35.6k|				    && len--; s += k) {
  ------------------
  |  Branch (205:12): [True: 35.5k, False: 0]
  ------------------
  206|  35.5k|					if (*s == '\0')
  ------------------
  |  Branch (206:10): [True: 139, False: 35.4k]
  ------------------
  207|    139|						break;
  208|  35.4k|					if (isprint(CAST(unsigned char, *s)))
  209|  31.1k|						vbuf[j++] = *s;
  210|  35.4k|				}
  211|    209|				if (j == sizeof(vbuf))
  ------------------
  |  Branch (211:9): [True: 11, False: 198]
  ------------------
  212|     11|					--j;
  213|    209|				vbuf[j] = '\0';
  214|    209|				if (NOTMIME(ms)) {
  ------------------
  |  |   42|    209|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    209|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    209|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    209|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 209, False: 0]
  |  |  ------------------
  ------------------
  215|    209|					if (vbuf[0]) {
  ------------------
  |  Branch (215:10): [True: 152, False: 57]
  ------------------
  216|    152|						if (file_printf(ms, ", %s: %s",
  ------------------
  |  Branch (216:11): [True: 9, False: 143]
  ------------------
  217|    152|						    buf, vbuf) == -1)
  218|      9|							return -1;
  219|    152|					}
  220|    209|				} else if (str == NULL && info[i].pi_id ==
  ------------------
  |  Branch (220:16): [True: 0, False: 0]
  |  Branch (220:31): [True: 0, False: 0]
  ------------------
  221|      0|				    CDF_PROPERTY_NAME_OF_APPLICATION) {
  ------------------
  |  |  262|      0|#define CDF_PROPERTY_NAME_OF_APPLICATION	0x00000012
  ------------------
  222|      0|					str = cdf_app_to_mime(vbuf, app2mime);
  223|      0|				}
  224|    209|			}
  225|    282|			break;
  226|    438|		case CDF_FILETIME:
  ------------------
  |  |  228|    438|#define CDF_FILETIME		0x00000040
  ------------------
  |  Branch (226:3): [True: 438, False: 958]
  ------------------
  227|    438|			tp = info[i].pi_tp;
  ------------------
  |  |  190|    438|#define pi_tp	pi_val._pi_tp
  ------------------
  228|    438|			if (tp != 0) {
  ------------------
  |  Branch (228:8): [True: 402, False: 36]
  ------------------
  229|    402|				char tbuf[64];
  230|    402|				if (tp < 1000000000000000LL) {
  ------------------
  |  Branch (230:9): [True: 243, False: 159]
  ------------------
  231|    243|					cdf_print_elapsed_time(tbuf,
  232|    243|					    sizeof(tbuf), tp);
  233|    243|					if (NOTMIME(ms) && file_printf(ms,
  ------------------
  |  |   42|    486|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    243|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    243|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    243|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 243, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (233:25): [True: 0, False: 243]
  ------------------
  234|    243|					    ", %s: %s", buf, tbuf) == -1)
  235|      0|						return -1;
  236|    243|				} else {
  237|    159|					char *c, *ec;
  238|    159|					cdf_timestamp_to_timespec(&ts, tp);
  239|    159|					c = cdf_ctime(&ts.tv_sec, tbuf);
  240|    159|					if (c != NULL &&
  ------------------
  |  Branch (240:10): [True: 159, False: 0]
  ------------------
  241|    159|					    (ec = strchr(c, '\n')) != NULL)
  ------------------
  |  Branch (241:10): [True: 159, False: 0]
  ------------------
  242|    159|						*ec = '\0';
  243|       |
  244|    159|					if (NOTMIME(ms) && file_printf(ms,
  ------------------
  |  |   42|    318|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|    159|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|    159|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    159|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 159, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (244:25): [True: 0, False: 159]
  ------------------
  245|    159|					    ", %s: %s", buf, c) == -1)
  246|      0|						return -1;
  247|    159|				}
  248|    402|			}
  249|    438|			break;
  250|    438|		case CDF_CLIPBOARD:
  ------------------
  |  |  235|     37|#define CDF_CLIPBOARD		0x00000047
  ------------------
  |  Branch (250:3): [True: 37, False: 1.35k]
  ------------------
  251|     37|			break;
  252|    260|		default:
  ------------------
  |  Branch (252:3): [True: 260, False: 1.13k]
  ------------------
  253|    260|			return -1;
  254|  1.39k|		}
  255|  1.39k|	}
  256|    150|	if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|    150|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (256:6): [True: 0, False: 150]
  ------------------
  257|      0|		if (str == NULL)
  ------------------
  |  Branch (257:7): [True: 0, False: 0]
  ------------------
  258|      0|			return 0;
  259|      0|		if (file_printf(ms, "application/%s", str) == -1)
  ------------------
  |  Branch (259:7): [True: 0, False: 0]
  ------------------
  260|      0|			return -1;
  261|      0|	}
  262|    150|	return 1;
  263|    150|}
readcdf.c:cdf_file_dir_info:
  513|  1.09k|{
  514|  1.09k|	size_t sd, j;
  515|       |
  516|  7.66k|	for (sd = 0; sd < __arraycount(sectioninfo); sd++) {
  ------------------
  |  |  130|  7.66k|#define __arraycount(a) (sizeof(a) / sizeof(a[0]))
  ------------------
  |  Branch (516:15): [True: 6.57k, False: 1.09k]
  ------------------
  517|  6.57k|		const struct sinfo *si = &sectioninfo[sd];
  518|  16.4k|		for (j = 0; si->sections[j]; j++) {
  ------------------
  |  Branch (518:15): [True: 9.85k, False: 6.56k]
  ------------------
  519|  9.85k|			if (cdf_find_stream(dir, si->sections[j], si->types[j])
  ------------------
  |  Branch (519:8): [True: 6, False: 9.85k]
  ------------------
  520|  9.85k|			    > 0)
  521|      6|				break;
  522|       |#ifdef CDF_DEBUG
  523|       |			fprintf(stderr, "Can't read %s\n", si->sections[j]);
  524|       |#endif
  525|  9.85k|		}
  526|  6.57k|		if (si->sections[j] == NULL)
  ------------------
  |  Branch (526:7): [True: 6.56k, False: 6]
  ------------------
  527|  6.56k|			continue;
  528|      6|		if (NOTMIME(ms)) {
  ------------------
  |  |   42|      6|#define NOTMIME(ms) (((ms)->flags & MAGIC_MIME) == 0)
  |  |  ------------------
  |  |  |  |   44|      6|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|      6|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      6|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (42:21): [True: 6, False: 0]
  |  |  ------------------
  ------------------
  529|      6|			if (file_printf(ms, "CDFV2 %s", si->name) == -1)
  ------------------
  |  Branch (529:8): [True: 0, False: 6]
  ------------------
  530|      0|				return -1;
  531|      6|		} else if (ms->flags & MAGIC_MIME_TYPE) {
  ------------------
  |  |   37|      0|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (531:14): [True: 0, False: 0]
  ------------------
  532|      0|			if (file_printf(ms, "application/%s", si->mime) == -1)
  ------------------
  |  Branch (532:8): [True: 0, False: 0]
  ------------------
  533|      0|				return -1;
  534|      0|		}
  535|      6|		return 1;
  536|      6|	}
  537|  1.09k|	return -1;
  538|  1.09k|}

file_softmagic:
  121|  12.5k|{
  122|  12.5k|	struct mlist *ml;
  123|  12.5k|	int rv = 0, printed_something = 0, need_separator = 0, firstline = 1;
  124|  12.5k|	uint16_t nc, ic;
  125|       |
  126|  12.5k|	if (name_count == NULL) {
  ------------------
  |  Branch (126:6): [True: 12.5k, False: 0]
  ------------------
  127|  12.5k|		nc = 0;
  128|  12.5k|		name_count = &nc;
  129|  12.5k|	}
  130|  12.5k|	if (indir_count == NULL) {
  ------------------
  |  Branch (130:6): [True: 12.5k, False: 0]
  ------------------
  131|  12.5k|		ic = 0;
  132|  12.5k|		indir_count = &ic;
  133|  12.5k|	}
  134|       |
  135|  24.8k|	for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next) {
  ------------------
  |  Branch (135:32): [True: 12.5k, False: 12.3k]
  ------------------
  136|  12.5k|		int ret = match(ms, ml->magic, ml->magic_rxcomp, ml->nmagic, b,
  137|  12.5k|		    0, mode, text, 0, indir_count, name_count,
  138|  12.5k|		    &printed_something, &need_separator, &firstline,
  139|  12.5k|		    NULL, NULL);
  140|  12.5k|		switch (ret) {
  141|    145|		case -1:
  ------------------
  |  Branch (141:3): [True: 145, False: 12.3k]
  ------------------
  142|    145|			return ret;
  143|  5.03k|		case 0:
  ------------------
  |  Branch (143:3): [True: 5.03k, False: 7.48k]
  ------------------
  144|  5.03k|			continue;
  145|  7.33k|		default:
  ------------------
  |  Branch (145:3): [True: 7.33k, False: 5.17k]
  ------------------
  146|  7.33k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|  7.33k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (146:8): [True: 0, False: 7.33k]
  ------------------
  147|      0|				return ret;
  148|  7.33k|			rv = ret;
  149|  7.33k|			break;
  150|  12.5k|		}
  151|  12.5k|	}
  152|       |
  153|  12.3k|	return rv;
  154|  12.5k|}
softmagic.c:match:
  213|  83.7k|{
  214|  83.7k|	uint32_t magindex = 0;
  215|  83.7k|	unsigned int cont_level = 0;
  216|  83.7k|	int found_matchv = 0; /* if a match is found it is set to 1*/
  217|  83.7k|	int returnvalv = 0, e;
  218|  83.7k|	struct buffer bb;
  219|  83.7k|	int print = (ms->flags & MAGIC_NODESC) == 0;
  ------------------
  |  |   52|  83.7k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  83.7k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  83.7k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  83.7k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  83.7k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  83.7k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  220|       |
  221|       |	/*
  222|       |	 * returnval can be 0 if a match is found, but there was no
  223|       |	 * annotation to be printed.
  224|       |	 */
  225|  83.7k|	if (returnval == NULL)
  ------------------
  |  Branch (225:6): [True: 30.1k, False: 53.5k]
  ------------------
  226|  30.1k|		returnval = &returnvalv;
  227|  83.7k|	if (found_match == NULL)
  ------------------
  |  Branch (227:6): [True: 30.1k, False: 53.5k]
  ------------------
  228|  30.1k|		found_match = &found_matchv;
  229|       |
  230|  83.7k|	if (file_check_mem(ms, cont_level) == -1)
  ------------------
  |  Branch (230:6): [True: 0, False: 83.7k]
  ------------------
  231|      0|		return -1;
  232|       |
  233|   107M|	for (magindex = 0; magindex < nmagic; magindex++) {
  ------------------
  |  Branch (233:21): [True: 107M, False: 80.5k]
  ------------------
  234|   107M|		int flush = 0;
  235|   107M|		struct magic *m = &magic[magindex];
  236|   107M|		file_regex_t **m_rxcomp = &magic_rxcomp[magindex];
  237|       |
  238|   107M|		if (m->type != FILE_NAME)
  ------------------
  |  |  285|   107M|#define				FILE_NAME		45
  ------------------
  |  Branch (238:7): [True: 107M, False: 53.5k]
  ------------------
  239|   107M|		if ((IS_STRING(m->type) &&
  ------------------
  |  |  303|   214M|	((t) == FILE_STRING || \
  |  |  ------------------
  |  |  |  |  245|   214M|#define				FILE_STRING		5
  |  |  ------------------
  |  |  |  Branch (303:3): [True: 66.4M, False: 40.5M]
  |  |  ------------------
  |  |  304|   107M|	 (t) == FILE_PSTRING || \
  |  |  ------------------
  |  |  |  |  253|   147M|#define				FILE_PSTRING		13
  |  |  ------------------
  |  |  |  Branch (304:3): [True: 30.0k, False: 40.5M]
  |  |  ------------------
  |  |  305|   107M|	 (t) == FILE_BESTRING16 || \
  |  |  ------------------
  |  |  |  |  258|   147M|#define				FILE_BESTRING16		18
  |  |  ------------------
  |  |  |  Branch (305:3): [True: 0, False: 40.5M]
  |  |  ------------------
  |  |  306|   107M|	 (t) == FILE_LESTRING16 || \
  |  |  ------------------
  |  |  |  |  259|   147M|#define				FILE_LESTRING16		19
  |  |  ------------------
  |  |  |  Branch (306:3): [True: 59.4k, False: 40.4M]
  |  |  ------------------
  |  |  307|   107M|	 (t) == FILE_REGEX || \
  |  |  ------------------
  |  |  |  |  257|   147M|#define				FILE_REGEX		17
  |  |  ------------------
  |  |  |  Branch (307:3): [True: 2.02M, False: 38.4M]
  |  |  ------------------
  |  |  308|   107M|	 (t) == FILE_SEARCH || \
  |  |  ------------------
  |  |  |  |  260|   145M|#define				FILE_SEARCH		20
  |  |  ------------------
  |  |  |  Branch (308:3): [True: 7.26M, False: 31.2M]
  |  |  ------------------
  |  |  309|   107M|	 (t) == FILE_INDIRECT || \
  |  |  ------------------
  |  |  |  |  281|   138M|#define				FILE_INDIRECT		41
  |  |  ------------------
  |  |  |  Branch (309:3): [True: 0, False: 31.2M]
  |  |  ------------------
  |  |  310|   107M|	 (t) == FILE_NAME || \
  |  |  ------------------
  |  |  |  |  285|   138M|#define				FILE_NAME		45
  |  |  ------------------
  |  |  |  Branch (310:3): [True: 0, False: 31.2M]
  |  |  ------------------
  |  |  311|   107M|	 (t) == FILE_USE || \
  |  |  ------------------
  |  |  |  |  286|   138M|#define				FILE_USE		46
  |  |  ------------------
  |  |  |  Branch (311:3): [True: 0, False: 31.2M]
  |  |  ------------------
  |  |  312|   214M|	 (t) == FILE_OCTAL)
  |  |  ------------------
  |  |  |  |  299|  31.2M|#define				FILE_OCTAL		59
  |  |  ------------------
  |  |  |  Branch (312:3): [True: 0, False: 31.2M]
  |  |  ------------------
  ------------------
  240|   107M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  241|   107M|		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  375|  10.7M|#define str_flags _u._s._flags
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  240|  10.7M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  395|  10.7M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  10.7M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  394|  10.7M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  10.7M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
  ------------------
  |  |  395|  10.7M|#define STRING_BINTEST				BIT(6)
  |  |  ------------------
  |  |  |  |  388|  10.7M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (241:10): [True: 10.7M, False: 65.0M]
  |  Branch (241:18): [True: 409k, False: 10.3M]
  ------------------
  242|  75.8M|		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  375|  65.0M|#define str_flags _u._s._flags
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  240|  65.0M|#define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  395|  65.0M|#define STRING_BINTEST				BIT(6)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  65.0M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define FLT (STRING_BINTEST | STRING_TEXTTEST)
  |  |  ------------------
  |  |  |  |  394|  65.0M|#define STRING_TEXTTEST				BIT(5)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|  65.0M|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              		      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
  ------------------
  |  |  394|  65.0M|#define STRING_TEXTTEST				BIT(5)
  |  |  ------------------
  |  |  |  |  388|  65.0M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (242:10): [True: 65.0M, False: 10.3M]
  |  Branch (242:19): [True: 3.01M, False: 62.0M]
  ------------------
  243|   107M|		    (m->flag & mode) != mode) {
  ------------------
  |  Branch (243:7): [True: 14.4M, False: 89.1M]
  ------------------
  244|   106M|flush:
  245|       |			/* Skip sub-tests */
  246|   483M|			while (magindex < nmagic - 1 &&
  ------------------
  |  Branch (246:11): [True: 483M, False: 26.9k]
  ------------------
  247|   483M|			    magic[magindex + 1].cont_level != 0)
  ------------------
  |  Branch (247:8): [True: 376M, False: 106M]
  ------------------
  248|   376M|				magindex++;
  249|   106M|			cont_level = 0;
  250|   106M|			continue; /* Skip to next top-level test*/
  251|  17.8M|		}
  252|       |
  253|  89.2M|		if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
  ------------------
  |  Branch (253:7): [True: 220k, False: 88.9M]
  ------------------
  254|   220k|			goto flush;
  255|  88.9M|		ms->line = m->lineno;
  256|       |
  257|       |		/* if main entry matches, print it... */
  258|  88.9M|		switch (mget(ms, m, b, CAST(const unsigned char *, bb.fbuf),
  ------------------
  |  |  444|  88.9M|#define CAST(T, b)	((T)(b))
  ------------------
  259|  88.9M|		    bb.flen, offset, cont_level,
  260|  88.9M|		    mode, text, flip, indir_count, name_count,
  261|  88.9M|		    printed_something, need_separator, firstline, returnval,
  262|  88.9M|		    found_match))
  263|  88.9M|		{
  264|    407|		case -1:
  ------------------
  |  Branch (264:3): [True: 407, False: 88.9M]
  ------------------
  265|    407|			return -1;
  266|  15.9M|		case 0:
  ------------------
  |  Branch (266:3): [True: 15.9M, False: 73.0M]
  ------------------
  267|  15.9M|			flush = m->reln != '!';
  268|  15.9M|			break;
  269|  73.0M|		default:
  ------------------
  |  Branch (269:3): [True: 73.0M, False: 15.9M]
  ------------------
  270|  73.0M|			if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  281|  73.0M|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (270:8): [True: 0, False: 73.0M]
  ------------------
  271|      0|				*found_match = 1;
  272|      0|				*returnval = 1;
  273|      0|			}
  274|       |
  275|  73.0M|			switch (magiccheck(ms, m, m_rxcomp)) {
  276|      0|			case -1:
  ------------------
  |  Branch (276:4): [True: 0, False: 73.0M]
  ------------------
  277|      0|				return -1;
  278|  72.7M|			case 0:
  ------------------
  |  Branch (278:4): [True: 72.7M, False: 339k]
  ------------------
  279|  72.7M|				flush++;
  280|  72.7M|				break;
  281|   339k|			default:
  ------------------
  |  Branch (281:4): [True: 339k, False: 72.7M]
  ------------------
  282|   339k|				flush = 0;
  283|   339k|				break;
  284|  73.0M|			}
  285|  73.0M|			break;
  286|  88.9M|		}
  287|  88.9M|		if (flush) {
  ------------------
  |  Branch (287:7): [True: 88.6M, False: 339k]
  ------------------
  288|       |			/*
  289|       |			 * main entry didn't match,
  290|       |			 * flush its continuations
  291|       |			 */
  292|  88.6M|			goto flush;
  293|  88.6M|		}
  294|       |
  295|   339k|		if ((e = handle_annotation(ms, m, *firstline)) != 0)
  ------------------
  |  Branch (295:7): [True: 0, False: 339k]
  ------------------
  296|      0|		{
  297|      0|			*found_match = 1;
  298|      0|			*need_separator = 1;
  299|      0|			*printed_something = 1;
  300|      0|			*returnval = 1;
  301|      0|			*firstline = 0;
  302|      0|			return e;
  303|      0|		}
  304|       |
  305|       |		/*
  306|       |		 * If we are going to print something, we'll need to print
  307|       |		 * a blank before we print something else.
  308|       |		 */
  309|   339k|		if (*m->desc) {
  ------------------
  |  Branch (309:7): [True: 25.3k, False: 314k]
  ------------------
  310|  25.3k|			*found_match = 1;
  311|  25.3k|			if (print) {
  ------------------
  |  Branch (311:8): [True: 25.3k, False: 0]
  ------------------
  312|  25.3k|				*returnval = 1;
  313|  25.3k|				*need_separator = 1;
  314|  25.3k|				*printed_something = 1;
  315|  25.3k|				if (print_sep(ms, *firstline) == -1)
  ------------------
  |  Branch (315:9): [True: 0, False: 25.3k]
  ------------------
  316|      0|					return -1;
  317|  25.3k|				if (mprint(ms, m) == -1)
  ------------------
  |  Branch (317:9): [True: 0, False: 25.3k]
  ------------------
  318|      0|					return -1;
  319|  25.3k|			}
  320|  25.3k|		}
  321|       |
  322|   339k|		switch (moffset(ms, m, &bb, &ms->c.li[cont_level].off)) {
  323|  22.3k|		case -1:
  ------------------
  |  Branch (323:3): [True: 22.3k, False: 317k]
  ------------------
  324|  22.3k|		case 0:
  ------------------
  |  Branch (324:3): [True: 0, False: 339k]
  ------------------
  325|  22.3k|			goto flush;
  326|   317k|		default:
  ------------------
  |  Branch (326:3): [True: 317k, False: 22.3k]
  ------------------
  327|   317k|			break;
  328|   339k|		}
  329|       |
  330|       |		/* and any continuations that match */
  331|   317k|		if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (331:7): [True: 0, False: 317k]
  ------------------
  332|      0|			return -1;
  333|       |
  334|  5.34M|		while (magindex + 1 < nmagic &&
  ------------------
  |  Branch (334:10): [True: 5.29M, False: 53.6k]
  ------------------
  335|  5.34M|		    magic[magindex + 1].cont_level != 0) {
  ------------------
  |  Branch (335:7): [True: 5.03M, False: 259k]
  ------------------
  336|  5.03M|			m = &magic[++magindex];
  337|  5.03M|			m_rxcomp = &magic_rxcomp[magindex];
  338|  5.03M|			ms->line = m->lineno; /* for messages */
  339|       |
  340|  5.03M|			if (cont_level < m->cont_level)
  ------------------
  |  Branch (340:8): [True: 3.93M, False: 1.09M]
  ------------------
  341|  3.93M|				continue;
  342|  1.09M|			if (cont_level > m->cont_level) {
  ------------------
  |  Branch (342:8): [True: 94.0k, False: 997k]
  ------------------
  343|       |				/*
  344|       |				 * We're at the end of the level
  345|       |				 * "cont_level" continuations.
  346|       |				 */
  347|  94.0k|				cont_level = m->cont_level;
  348|  94.0k|			}
  349|  1.09M|			if (msetoffset(ms, m, &bb, b, offset, cont_level) == -1)
  ------------------
  |  Branch (349:8): [True: 977, False: 1.09M]
  ------------------
  350|    977|				goto flush;
  351|  1.09M|			if (m->flag & OFFADD) {
  ------------------
  |  |  224|  1.09M|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
  |  Branch (351:8): [True: 103k, False: 986k]
  ------------------
  352|   103k|				if (cont_level == 0) {
  ------------------
  |  Branch (352:9): [True: 0, False: 103k]
  ------------------
  353|      0|					if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (353:10): [True: 0, False: 0]
  ------------------
  354|      0|						fprintf(stderr,
  355|      0|						    "direct *zero*"
  356|      0|						    " cont_level\n");
  357|      0|					return 0;
  358|      0|				}
  359|   103k|				ms->offset +=
  360|   103k|				    ms->c.li[cont_level - 1].off;
  361|   103k|			}
  362|       |
  363|  1.09M|#ifdef ENABLE_CONDITIONALS
  364|  1.09M|			if (m->cond == COND_ELSE ||
  ------------------
  |  |  356|  2.18M|#define				COND_ELSE	3
  ------------------
  |  Branch (364:8): [True: 0, False: 1.09M]
  ------------------
  365|  1.09M|			    m->cond == COND_ELIF) {
  ------------------
  |  |  355|  1.09M|#define				COND_ELIF	2
  ------------------
  |  Branch (365:8): [True: 0, False: 1.09M]
  ------------------
  366|      0|				if (ms->c.li[cont_level].last_match == 1)
  ------------------
  |  Branch (366:9): [True: 0, False: 0]
  ------------------
  367|      0|					continue;
  368|      0|			}
  369|  1.09M|#endif
  370|  1.09M|			switch (mget(ms, m, b, CAST(const unsigned char *,
  ------------------
  |  |  444|  1.09M|#define CAST(T, b)	((T)(b))
  ------------------
  371|  1.09M|			    bb.fbuf), bb.flen, offset,
  372|  1.09M|			    cont_level, mode, text, flip, indir_count,
  373|  1.09M|			    name_count, printed_something, need_separator,
  374|  1.09M|			    firstline, returnval, found_match)) {
  375|  2.76k|			case -1:
  ------------------
  |  Branch (375:4): [True: 2.76k, False: 1.08M]
  ------------------
  376|  2.76k|				return -1;
  377|  98.0k|			case 0:
  ------------------
  |  Branch (377:4): [True: 98.0k, False: 992k]
  ------------------
  378|  98.0k|				if (m->reln != '!')
  ------------------
  |  Branch (378:9): [True: 95.4k, False: 2.62k]
  ------------------
  379|  95.4k|					continue;
  380|  2.62k|				flush = 1;
  381|  2.62k|				break;
  382|   989k|			default:
  ------------------
  |  Branch (382:4): [True: 989k, False: 100k]
  ------------------
  383|   989k|				if (m->type == FILE_INDIRECT) {
  ------------------
  |  |  281|   989k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (383:9): [True: 13.0k, False: 976k]
  ------------------
  384|  13.0k|					*found_match = 1;
  385|  13.0k|					*returnval = 1;
  386|  13.0k|				}
  387|   989k|				flush = 0;
  388|   989k|				break;
  389|  1.09M|			}
  390|       |
  391|   992k|			switch (flush ? 1 : magiccheck(ms, m, m_rxcomp)) {
  ------------------
  |  Branch (391:12): [True: 2.62k, False: 989k]
  ------------------
  392|      0|			case -1:
  ------------------
  |  Branch (392:4): [True: 0, False: 992k]
  ------------------
  393|      0|				return -1;
  394|   694k|			case 0:
  ------------------
  |  Branch (394:4): [True: 694k, False: 297k]
  ------------------
  395|   694k|#ifdef ENABLE_CONDITIONALS
  396|   694k|				ms->c.li[cont_level].last_match = 0;
  397|   694k|#endif
  398|   694k|				break;
  399|   297k|			default:
  ------------------
  |  Branch (399:4): [True: 297k, False: 694k]
  ------------------
  400|   297k|#ifdef ENABLE_CONDITIONALS
  401|   297k|				ms->c.li[cont_level].last_match = 1;
  402|   297k|#endif
  403|   297k|				if (m->type == FILE_CLEAR)
  ------------------
  |  |  287|   297k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (403:9): [True: 249, False: 297k]
  ------------------
  404|    249|					ms->c.li[cont_level].got_match = 0;
  405|   297k|				else if (ms->c.li[cont_level].got_match) {
  ------------------
  |  Branch (405:14): [True: 61.0k, False: 236k]
  ------------------
  406|  61.0k|					if (m->type == FILE_DEFAULT)
  ------------------
  |  |  243|  61.0k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (406:10): [True: 1.08k, False: 60.0k]
  ------------------
  407|  1.08k|						break;
  408|  61.0k|				} else
  409|   236k|					ms->c.li[cont_level].got_match = 1;
  410|       |
  411|   296k|				if ((e = handle_annotation(ms, m, *firstline))
  ------------------
  |  Branch (411:9): [True: 0, False: 296k]
  ------------------
  412|   296k|				    != 0) {
  413|      0|					*found_match = 1;
  414|      0|					*need_separator = 1;
  415|      0|					*printed_something = 1;
  416|      0|					*returnval = 1;
  417|      0|					return e;
  418|      0|				}
  419|   296k|				if (*m->desc) {
  ------------------
  |  Branch (419:9): [True: 83.9k, False: 212k]
  ------------------
  420|  83.9k|					*found_match = 1;
  421|  83.9k|				}
  422|   296k|				if (print && *m->desc) {
  ------------------
  |  Branch (422:9): [True: 296k, False: 0]
  |  Branch (422:18): [True: 83.9k, False: 212k]
  ------------------
  423|  83.9k|					*returnval = 1;
  424|       |					/*
  425|       |					 * This continuation matched.  Print
  426|       |					 * its message, with a blank before it
  427|       |					 * if the previous item printed and
  428|       |					 * this item isn't empty.
  429|       |					 */
  430|       |					/*
  431|       |					 * If we are going to print something,
  432|       |					 * make sure that we have a separator
  433|       |					 * first.
  434|       |					 */
  435|  83.9k|					if (!*printed_something) {
  ------------------
  |  Branch (435:10): [True: 18.7k, False: 65.2k]
  ------------------
  436|  18.7k|						*printed_something = 1;
  437|  18.7k|						if (print_sep(ms, *firstline)
  ------------------
  |  Branch (437:11): [True: 0, False: 18.7k]
  ------------------
  438|  18.7k|						    == -1)
  439|      0|							return -1;
  440|  18.7k|					}
  441|       |					/* space if previous printed */
  442|  83.9k|					if (*need_separator
  ------------------
  |  Branch (442:10): [True: 74.7k, False: 9.25k]
  ------------------
  443|  83.9k|					    && (m->flag & NOSPACE) == 0) {
  ------------------
  |  |  227|  74.7k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (443:13): [True: 21.8k, False: 52.9k]
  ------------------
  444|  21.8k|						if (file_printf(ms, " ") == -1)
  ------------------
  |  Branch (444:11): [True: 0, False: 21.8k]
  ------------------
  445|      0|							return -1;
  446|  21.8k|					}
  447|  83.9k|					if (mprint(ms, m) == -1)
  ------------------
  |  Branch (447:10): [True: 0, False: 83.9k]
  ------------------
  448|      0|						return -1;
  449|  83.9k|					*need_separator = 1;
  450|  83.9k|				}
  451|       |
  452|   296k|				switch (moffset(ms, m, &bb,
  453|   296k|				    &ms->c.li[cont_level].off)) {
  454|  4.37k|				case -1:
  ------------------
  |  Branch (454:5): [True: 4.37k, False: 292k]
  ------------------
  455|  4.37k|				case 0:
  ------------------
  |  Branch (455:5): [True: 0, False: 296k]
  ------------------
  456|  4.37k|					cont_level--;
  457|  4.37k|					break;
  458|   292k|				default:
  ------------------
  |  Branch (458:5): [True: 292k, False: 4.37k]
  ------------------
  459|   292k|					break;
  460|   296k|				}
  461|       |
  462|       |				/*
  463|       |				 * If we see any continuations
  464|       |				 * at a higher level,
  465|       |				 * process them.
  466|       |				 */
  467|   296k|				if (file_check_mem(ms, ++cont_level) == -1)
  ------------------
  |  Branch (467:9): [True: 0, False: 296k]
  ------------------
  468|      0|					return -1;
  469|   296k|				break;
  470|   992k|			}
  471|   992k|		}
  472|   313k|		if (*printed_something) {
  ------------------
  |  Branch (472:7): [True: 90.7k, False: 222k]
  ------------------
  473|  90.7k|			*firstline = 0;
  474|  90.7k|		}
  475|   313k|		if (*found_match) {
  ------------------
  |  Branch (475:7): [True: 203k, False: 109k]
  ------------------
  476|   203k|			if ((ms->flags & MAGIC_CONTINUE) == 0)
  ------------------
  |  |   38|   203k|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
  |  Branch (476:8): [True: 0, False: 203k]
  ------------------
  477|      0|				return *returnval;
  478|       |			// So that we print a separator
  479|   203k|			*printed_something = 0;
  480|   203k|			*firstline = 0;
  481|   203k|		}
  482|   313k|		cont_level = 0;
  483|   313k|	}
  484|  80.5k|	return *returnval;
  485|  83.7k|}
softmagic.c:msetoffset:
 1515|  90.2M|{
 1516|  90.2M|	int32_t offset;
 1517|  90.2M|	if (m->flag & OFFNEGATIVE) {
  ------------------
  |  |  231|  90.2M|#define OFFNEGATIVE	0x80	/* relative to the end of file */
  ------------------
  |  Branch (1517:6): [True: 223k, False: 90.0M]
  ------------------
 1518|   223k|		offset = -m->offset;
 1519|   223k|		if (cont_level > 0) {
  ------------------
  |  Branch (1519:7): [True: 3.00k, False: 220k]
  ------------------
 1520|  3.00k|			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  224|  3.00k|#define OFFADD		0x02	/* if '>&' or '>...(&' appears */
  ------------------
              			if (m->flag & (OFFADD|INDIROFFADD))
  ------------------
  |  |  225|  3.00k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1520:8): [True: 2.02k, False: 977]
  ------------------
 1521|  2.02k|				goto normal;
 1522|       |#if 0
 1523|       |			file_error(ms, 0, "negative offset %d at continuation"
 1524|       |			    "level %u", m->offset, cont_level);
 1525|       |			return -1;
 1526|       |#endif
 1527|  3.00k|		}
 1528|   221k|		if (buffer_fill(b) == -1)
  ------------------
  |  Branch (1528:7): [True: 221k, False: 0]
  ------------------
 1529|   221k|			return -1;
 1530|      0|		if (o != 0) {
  ------------------
  |  Branch (1530:7): [True: 0, False: 0]
  ------------------
 1531|       |			// Not yet!
 1532|      0|			file_magerror(ms, "non zero offset %" SIZE_T_FORMAT
 1533|      0|			    "u at level %u", o, cont_level);
 1534|      0|			return -1;
 1535|      0|		}
 1536|      0|		if (CAST(size_t, m->offset) > b->elen)
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1536:7): [True: 0, False: 0]
  ------------------
 1537|      0|			return -1;
 1538|      0|		buffer_init(bb, -1, NULL, b->ebuf, b->elen);
 1539|      0|		ms->eoffset = ms->offset = CAST(int32_t, b->elen - m->offset);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1540|  90.0M|	} else {
 1541|  90.0M|		offset = m->offset;
 1542|  90.0M|		if (cont_level == 0) {
  ------------------
  |  Branch (1542:7): [True: 88.9M, False: 1.08M]
  ------------------
 1543|  88.9M|normal:
 1544|       |			// XXX: Pass real fd, then who frees bb?
 1545|  88.9M|			buffer_init(bb, -1, NULL, b->fbuf, b->flen);
 1546|  88.9M|			ms->offset = offset;
 1547|  88.9M|			ms->eoffset = 0;
 1548|  88.9M|		} else {
 1549|  1.08M|			ms->offset = ms->eoffset + offset;
 1550|  1.08M|		}
 1551|  90.0M|	}
 1552|  90.0M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  90.0M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1552:6): [True: 0, False: 90.0M]
  ------------------
 1553|      0|		fprintf(stderr, "bb=[%p,%" SIZE_T_FORMAT "u,%"
 1554|      0|		    SIZE_T_FORMAT "u], %d [b=%p,%"
 1555|      0|		    SIZE_T_FORMAT "u,%" SIZE_T_FORMAT "u], [o=%#x, c=%d]\n",
 1556|      0|		    bb->fbuf, bb->flen, bb->elen, ms->offset, b->fbuf,
 1557|      0|		    b->flen, b->elen, offset, cont_level);
 1558|      0|	}
 1559|  90.0M|	return 0;
 1560|  90.2M|}
softmagic.c:mget:
 1590|  90.0M|{
 1591|  90.0M|	uint32_t eoffset, offset = ms->offset;
 1592|  90.0M|	struct buffer bb;
 1593|  90.0M|	intmax_t lhs;
 1594|  90.0M|	file_pushbuf_t *pb;
 1595|  90.0M|	int rv, oneed_separator, in_type, nfound_match;
 1596|  90.0M|	char *rbuf;
 1597|  90.0M|	union VALUETYPE *p = &ms->ms_value;
 1598|  90.0M|	struct mlist ml, *mlp;
 1599|  90.0M|	struct cont c;
 1600|       |
 1601|  90.0M|	if (*indir_count >= ms->indir_max) {
  ------------------
  |  Branch (1601:6): [True: 687, False: 90.0M]
  ------------------
 1602|    687|		file_error(ms, 0, "indirect count (%hu) exceeded",
 1603|    687|		    *indir_count);
 1604|    687|		return -1;
 1605|    687|	}
 1606|       |
 1607|  90.0M|	if (*name_count >= ms->name_max) {
  ------------------
  |  Branch (1607:6): [True: 10, False: 90.0M]
  ------------------
 1608|     10|		file_error(ms, 0, "name use count (%hu) exceeded",
 1609|     10|		    *name_count);
 1610|     10|		return -1;
 1611|     10|	}
 1612|       |
 1613|       |
 1614|       |
 1615|  90.0M|	if (mcopy(ms, p, m->type, m->flag & INDIR, s,
  ------------------
  |  |  223|  90.0M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1615:6): [True: 0, False: 90.0M]
  ------------------
 1616|  90.0M|	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  444|  90.0M|#define CAST(T, b)	((T)(b))
  ------------------
              	    CAST(uint32_t, offset + o), CAST(uint32_t, nbytes), m) == -1)
  ------------------
  |  |  444|  90.0M|#define CAST(T, b)	((T)(b))
  ------------------
 1617|      0|		return -1;
 1618|       |
 1619|  90.0M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  90.0M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1619:6): [True: 0, False: 90.0M]
  ------------------
 1620|      0|		fprintf(stderr, "mget(type=%d, flag=%#x, offset=%u, o=%"
 1621|      0|		    SIZE_T_FORMAT "u, " "nbytes=%" SIZE_T_FORMAT
 1622|      0|		    "u, il=%hu, nc=%hu)\n",
 1623|      0|		    m->type, m->flag, offset, o, nbytes,
 1624|      0|		    *indir_count, *name_count);
 1625|      0|		mdebug(offset, RCAST(char *, RCAST(void *, p)),
  ------------------
  |  |  445|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1626|      0|		    sizeof(union VALUETYPE));
 1627|      0|#ifndef COMPILE_ONLY
 1628|      0|		file_mdump(m);
 1629|      0|#endif
 1630|      0|	}
 1631|       |
 1632|  90.0M|	if (m->flag & INDIR) {
  ------------------
  |  |  223|  90.0M|#define INDIR		0x01	/* if '(...)' appears */
  ------------------
  |  Branch (1632:6): [True: 115k, False: 89.9M]
  ------------------
 1633|   115k|		intmax_t off = m->in_offset;
 1634|   115k|		const int sgn = m->in_op & FILE_OPSIGNED;
  ------------------
  |  |  348|   115k|#define				FILE_OPSIGNED	0x20
  ------------------
 1635|   115k|		if (m->in_op & FILE_OPINDIRECT) {
  ------------------
  |  |  350|   115k|#define				FILE_OPINDIRECT	0x80
  ------------------
  |  Branch (1635:7): [True: 1.19k, False: 114k]
  ------------------
 1636|  1.19k|			const union VALUETYPE *q = CAST(const union VALUETYPE *,
  ------------------
  |  |  444|  1.19k|#define CAST(T, b)	((T)(b))
  ------------------
 1637|  1.19k|			    RCAST(const void *, s + offset + off));
 1638|  1.19k|			int op;
 1639|  1.19k|			switch (op = cvt_flip(m->in_type, flip)) {
 1640|      0|			case FILE_BYTE:
  ------------------
  |  |  241|      0|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1640:4): [True: 0, False: 1.19k]
  ------------------
 1641|      0|				if (OFFSET_OOB(nbytes, offset + off, 1))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1642|      0|					return 0;
 1643|      0|				off = SEXT(sgn,8,q->b);
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1644|      0|				break;
 1645|      0|			case FILE_SHORT:
  ------------------
  |  |  242|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1645:4): [True: 0, False: 1.19k]
  ------------------
 1646|      0|				if (OFFSET_OOB(nbytes, offset + off, 2))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1647|      0|					return 0;
 1648|      0|				off = SEXT(sgn,16,q->h);
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1649|      0|				break;
 1650|      0|			case FILE_BESHORT:
  ------------------
  |  |  247|      0|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1650:4): [True: 0, False: 1.19k]
  ------------------
 1651|      0|				if (OFFSET_OOB(nbytes, offset + off, 2))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1652|      0|					return 0;
 1653|      0|				off = SEXT(sgn,16,BE16(q));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1654|      0|				break;
 1655|      0|			case FILE_LESHORT:
  ------------------
  |  |  250|      0|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1655:4): [True: 0, False: 1.19k]
  ------------------
 1656|      0|				if (OFFSET_OOB(nbytes, offset + off, 2))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1657|      0|					return 0;
 1658|      0|				off = SEXT(sgn,16,LE16(q));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1659|      0|				break;
 1660|      0|			case FILE_LONG:
  ------------------
  |  |  244|      0|#define				FILE_LONG		4
  ------------------
  |  Branch (1660:4): [True: 0, False: 1.19k]
  ------------------
 1661|      0|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1662|      0|					return 0;
 1663|      0|				off = SEXT(sgn,32,q->l);
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1664|      0|				break;
 1665|      0|			case FILE_BELONG:
  ------------------
  |  |  248|      0|#define				FILE_BELONG		8
  ------------------
  |  Branch (1665:4): [True: 0, False: 1.19k]
  ------------------
 1666|      0|			case FILE_BEID3:
  ------------------
  |  |  279|      0|#define				FILE_BEID3		39
  ------------------
  |  Branch (1666:4): [True: 0, False: 1.19k]
  ------------------
 1667|      0|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1668|      0|					return 0;
 1669|      0|				off = SEXT(sgn,32,BE32(q));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1670|      0|				break;
 1671|      0|			case FILE_LEID3:
  ------------------
  |  |  280|      0|#define				FILE_LEID3		40
  ------------------
  |  Branch (1671:4): [True: 0, False: 1.19k]
  ------------------
 1672|  1.19k|			case FILE_LELONG:
  ------------------
  |  |  251|  1.19k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1672:4): [True: 1.19k, False: 0]
  ------------------
 1673|  1.19k|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   72|  1.19k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  2.39k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 199, False: 997]
  |  |  |  Branch (72:59): [True: 198, False: 799]
  |  |  ------------------
  ------------------
 1674|    397|					return 0;
 1675|    799|				off = SEXT(sgn,32,LE32(q));
  ------------------
  |  |  109|    799|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 799]
  |  |  ------------------
  |  |  110|    799|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|    799|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|    799|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1676|    799|				break;
 1677|      0|			case FILE_MELONG:
  ------------------
  |  |  263|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1677:4): [True: 0, False: 1.19k]
  ------------------
 1678|      0|				if (OFFSET_OOB(nbytes, offset + off, 4))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1679|      0|					return 0;
 1680|      0|				off = SEXT(sgn,32,ME32(q));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1681|      0|				break;
 1682|      0|			case FILE_BEQUAD:
  ------------------
  |  |  266|      0|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1682:4): [True: 0, False: 1.19k]
  ------------------
 1683|      0|				if (OFFSET_OOB(nbytes, offset + off, 8))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1684|      0|					return 0;
 1685|      0|				off = SEXT(sgn,64,BE64(q));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1686|      0|				break;
 1687|      0|			case FILE_LEQUAD:
  ------------------
  |  |  265|      0|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1687:4): [True: 0, False: 1.19k]
  ------------------
 1688|      0|				if (OFFSET_OOB(nbytes, offset + off, 8))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1689|      0|					return 0;
 1690|      0|				off = SEXT(sgn,64,LE64(q));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1691|      0|				break;
 1692|      0|			case FILE_OCTAL:
  ------------------
  |  |  299|      0|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1692:4): [True: 0, False: 1.19k]
  ------------------
 1693|      0|				if (OFFSET_OOB(nbytes, offset, m->vallen))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1694|      0|					return 0;
 1695|      0|				off = SEXT(sgn,64,strtoull(p->s, NULL, 8));
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1696|      0|				break;
 1697|      0|			default:
  ------------------
  |  Branch (1697:4): [True: 0, False: 1.19k]
  ------------------
 1698|      0|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1698:9): [True: 0, False: 0]
  ------------------
 1699|      0|					fprintf(stderr, "bad op=%d\n", op);
 1700|      0|				return 0;
 1701|  1.19k|			}
 1702|    799|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    799|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1702:8): [True: 0, False: 799]
  ------------------
 1703|      0|				fprintf(stderr, "indirect offs=%jd\n", off);
 1704|    799|		}
 1705|   114k|		switch (in_type = cvt_flip(m->in_type, flip)) {
 1706|  21.3k|		case FILE_BYTE:
  ------------------
  |  |  241|  21.3k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1706:3): [True: 21.3k, False: 93.5k]
  ------------------
 1707|  21.3k|			if (OFFSET_OOB(nbytes, offset, 1))
  ------------------
  |  |   72|  21.3k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  42.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 71, False: 21.2k]
  |  |  |  Branch (72:59): [True: 34, False: 21.2k]
  |  |  ------------------
  ------------------
 1708|    105|				return 0;
 1709|  21.2k|			if (do_ops(ms, m, &offset, SEXT(sgn,8,p->b), off))
  ------------------
  |  |  109|  21.2k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 21.2k]
  |  |  ------------------
  |  |  110|  21.2k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  21.2k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  21.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1709:8): [True: 0, False: 21.2k]
  ------------------
 1710|      0|				return 0;
 1711|  21.2k|			break;
 1712|  21.2k|		case FILE_BESHORT:
  ------------------
  |  |  247|  20.4k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1712:3): [True: 20.4k, False: 94.5k]
  ------------------
 1713|  20.4k|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   72|  20.4k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  40.8k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 106, False: 20.3k]
  |  |  |  Branch (72:59): [True: 115, False: 20.2k]
  |  |  ------------------
  ------------------
 1714|    221|				return 0;
 1715|  20.2k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,BE16(p)), off))
  ------------------
  |  |  109|  20.2k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 20.2k]
  |  |  ------------------
  |  |  110|  20.2k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  20.2k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  20.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1715:8): [True: 0, False: 20.2k]
  ------------------
 1716|      0|				return 0;
 1717|  20.2k|			break;
 1718|  20.2k|		case FILE_LESHORT:
  ------------------
  |  |  250|  6.49k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1718:3): [True: 6.49k, False: 108k]
  ------------------
 1719|  6.49k|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   72|  6.49k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  12.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 456, False: 6.04k]
  |  |  |  Branch (72:59): [True: 76, False: 5.96k]
  |  |  ------------------
  ------------------
 1720|    532|				return 0;
 1721|  5.96k|			if (do_ops(ms, m, &offset, SEXT(sgn,16,LE16(p)), off))
  ------------------
  |  |  109|  5.96k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 99, False: 5.86k]
  |  |  ------------------
  |  |  110|  5.96k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|     99|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  5.96k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  5.86k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1721:8): [True: 0, False: 5.96k]
  ------------------
 1722|      0|				return 0;
 1723|  5.96k|			break;
 1724|  5.96k|		case FILE_SHORT:
  ------------------
  |  |  242|      0|#define				FILE_SHORT		2
  ------------------
  |  Branch (1724:3): [True: 0, False: 114k]
  ------------------
 1725|      0|			if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1726|      0|				return 0;
 1727|      0|			if (do_ops(ms, m, &offset, SEXT(sgn,16,p->h), off))
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1727:8): [True: 0, False: 0]
  ------------------
 1728|      0|				return 0;
 1729|      0|			break;
 1730|  8.83k|		case FILE_BELONG:
  ------------------
  |  |  248|  8.83k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1730:3): [True: 8.83k, False: 106k]
  ------------------
 1731|  9.06k|		case FILE_BEID3:
  ------------------
  |  |  279|  9.06k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1731:3): [True: 227, False: 114k]
  ------------------
 1732|  9.06k|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|  9.06k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  18.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 252, False: 8.81k]
  |  |  |  Branch (72:59): [True: 200, False: 8.61k]
  |  |  ------------------
  ------------------
 1733|    452|				return 0;
 1734|  8.61k|			lhs = BE32(p);
  ------------------
  |  |   96|  8.61k|#define BE32(p) ( \
  |  |   97|  8.61k|    (CAST(uint32_t, (p)->hl[0])<<24)| \
  |  |  ------------------
  |  |  |  |  444|  8.61k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|  8.61k|    (CAST(uint32_t, (p)->hl[1])<<16)| \
  |  |  ------------------
  |  |  |  |  444|  8.61k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   99|  8.61k|    (CAST(uint32_t, (p)->hl[2])<<8)| \
  |  |  ------------------
  |  |  |  |  444|  8.61k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  100|  8.61k|    (CAST(uint32_t, (p)->hl[3])))
  |  |  ------------------
  |  |  |  |  444|  8.61k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1735|  8.61k|			if (in_type == FILE_BEID3)
  ------------------
  |  |  279|  8.61k|#define				FILE_BEID3		39
  ------------------
  |  Branch (1735:8): [True: 146, False: 8.46k]
  ------------------
 1736|    146|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  444|    146|#define CAST(T, b)	((T)(b))
  ------------------
 1737|  8.61k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  109|  8.61k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 8.61k]
  |  |  ------------------
  |  |  110|  8.61k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  8.61k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  8.61k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1737:8): [True: 433, False: 8.18k]
  ------------------
 1738|    433|				return 0;
 1739|  8.18k|			break;
 1740|  56.5k|		case FILE_LELONG:
  ------------------
  |  |  251|  56.5k|#define				FILE_LELONG		11
  ------------------
  |  Branch (1740:3): [True: 56.5k, False: 58.3k]
  ------------------
 1741|  56.5k|		case FILE_LEID3:
  ------------------
  |  |  280|  56.5k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1741:3): [True: 0, False: 114k]
  ------------------
 1742|  56.5k|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|  56.5k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|   113k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 1.59k, False: 54.9k]
  |  |  |  Branch (72:59): [True: 3.75k, False: 51.1k]
  |  |  ------------------
  ------------------
 1743|  5.34k|				return 0;
 1744|  51.1k|			lhs = LE32(p);
  ------------------
  |  |   91|  51.1k|#define LE32(p) ( \
  |  |   92|  51.1k|    (CAST(uint32_t, (p)->hl[3])<<24)| \
  |  |  ------------------
  |  |  |  |  444|  51.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|  51.1k|    (CAST(uint32_t, (p)->hl[2])<<16)| \
  |  |  ------------------
  |  |  |  |  444|  51.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|  51.1k|    (CAST(uint32_t, (p)->hl[1])<<8)| \
  |  |  ------------------
  |  |  |  |  444|  51.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   95|  51.1k|    (CAST(uint32_t, (p)->hl[0])))
  |  |  ------------------
  |  |  |  |  444|  51.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1745|  51.1k|			if (in_type == FILE_LEID3)
  ------------------
  |  |  280|  51.1k|#define				FILE_LEID3		40
  ------------------
  |  Branch (1745:8): [True: 0, False: 51.1k]
  ------------------
 1746|      0|				lhs = cvt_id3(ms, CAST(uint32_t, lhs));
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 1747|  51.1k|			if (do_ops(ms, m, &offset, SEXT(sgn,32,lhs), off))
  ------------------
  |  |  109|  51.1k|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 51.1k]
  |  |  ------------------
  |  |  110|  51.1k|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|  51.1k|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|  51.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1747:8): [True: 756, False: 50.4k]
  ------------------
 1748|    756|				return 0;
 1749|  50.4k|			break;
 1750|  50.4k|		case FILE_MELONG:
  ------------------
  |  |  263|      0|#define				FILE_MELONG		23
  ------------------
  |  Branch (1750:3): [True: 0, False: 114k]
  ------------------
 1751|      0|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|      0|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 0]
  |  |  |  Branch (72:59): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1752|      0|				return 0;
 1753|      0|			if (do_ops(ms, m, &offset, SEXT(sgn,32,ME32(p)), off))
  ------------------
  |  |  109|      0|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  110|      0|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|      0|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1753:8): [True: 0, False: 0]
  ------------------
 1754|      0|				return 0;
 1755|      0|			break;
 1756|    354|		case FILE_LONG:
  ------------------
  |  |  244|    354|#define				FILE_LONG		4
  ------------------
  |  Branch (1756:3): [True: 354, False: 114k]
  ------------------
 1757|    354|			if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|    354|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|    708|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 75, False: 279]
  |  |  |  Branch (72:59): [True: 67, False: 212]
  |  |  ------------------
  ------------------
 1758|    142|				return 0;
 1759|    212|			if (do_ops(ms, m, &offset, SEXT(sgn,32,p->l), off))
  ------------------
  |  |  109|    212|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 212]
  |  |  ------------------
  |  |  110|    212|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|    212|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|    212|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1759:8): [True: 81, False: 131]
  ------------------
 1760|     81|				return 0;
 1761|    131|			break;
 1762|    179|		case FILE_LEQUAD:
  ------------------
  |  |  265|    179|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1762:3): [True: 179, False: 114k]
  ------------------
 1763|    179|			if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   72|    179|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|    358|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 179]
  |  |  |  Branch (72:59): [True: 0, False: 179]
  |  |  ------------------
  ------------------
 1764|      0|				return 0;
 1765|    179|			if (do_ops(ms, m, &offset, SEXT(sgn,64,LE64(p)), off))	
  ------------------
  |  |  109|    179|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 179]
  |  |  ------------------
  |  |  110|    179|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|    179|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|    179|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1765:8): [True: 99, False: 80]
  ------------------
 1766|     99|				return 0;
 1767|     80|			break;
 1768|    171|		case FILE_BEQUAD:
  ------------------
  |  |  266|    171|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1768:3): [True: 171, False: 114k]
  ------------------
 1769|    171|			if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   72|    171|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|    342|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 171]
  |  |  |  Branch (72:59): [True: 0, False: 171]
  |  |  ------------------
  ------------------
 1770|      0|				return 0;
 1771|    171|			if (do_ops(ms, m, &offset, SEXT(sgn,64,BE64(p)), off))
  ------------------
  |  |  109|    171|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 171]
  |  |  ------------------
  |  |  110|    171|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|    171|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|    171|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1771:8): [True: 97, False: 74]
  ------------------
 1772|     97|				return 0;
 1773|     74|			break;
 1774|    333|		case FILE_OCTAL:
  ------------------
  |  |  299|    333|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1774:3): [True: 333, False: 114k]
  ------------------
 1775|    333|			if (OFFSET_OOB(nbytes, offset, m->vallen))
  ------------------
  |  |   72|    333|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|    666|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 70, False: 263]
  |  |  |  Branch (72:59): [True: 70, False: 193]
  |  |  ------------------
  ------------------
 1776|    140|				return 0;
 1777|    193|			if(do_ops(ms, m, &offset,
  ------------------
  |  Branch (1777:7): [True: 89, False: 104]
  ------------------
 1778|    193|			    SEXT(sgn,64,strtoull(p->s, NULL, 8)), off))
  ------------------
  |  |  109|    193|#define SEXT(s,v,p) ((s) ? \
  |  |  ------------------
  |  |  |  Branch (109:22): [True: 0, False: 193]
  |  |  ------------------
  |  |  110|    193|	CAST(intmax_t, CAST(int##v##_t, p)) : \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  111|    193|	CAST(intmax_t, CAST(uint##v##_t, p)))
  |  |  ------------------
  |  |  |  |  444|    193|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1779|     89|				return 0;
 1780|    104|			break;
 1781|    104|		default:
  ------------------
  |  Branch (1781:3): [True: 0, False: 114k]
  ------------------
 1782|      0|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1782:8): [True: 0, False: 0]
  ------------------
 1783|      0|				fprintf(stderr, "bad in_type=%d\n", in_type);
 1784|      0|			return 0;
 1785|   114k|		}
 1786|       |
 1787|   106k|		if (m->flag & INDIROFFADD) {
  ------------------
  |  |  225|   106k|#define INDIROFFADD	0x04	/* if '>&(' appears */
  ------------------
  |  Branch (1787:7): [True: 2.60k, False: 103k]
  ------------------
 1788|  2.60k|			if (cont_level == 0) {
  ------------------
  |  Branch (1788:8): [True: 0, False: 2.60k]
  ------------------
 1789|      0|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1789:9): [True: 0, False: 0]
  ------------------
 1790|      0|					fprintf(stderr,
 1791|      0|					    "indirect *zero* cont_level\n");
 1792|      0|				return 0;
 1793|      0|			}
 1794|  2.60k|			offset += ms->c.li[cont_level - 1].off;
 1795|  2.60k|			if (offset == 0) {
  ------------------
  |  Branch (1795:8): [True: 301, False: 2.30k]
  ------------------
 1796|    301|				if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    301|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1796:9): [True: 0, False: 301]
  ------------------
 1797|      0|					fprintf(stderr,
 1798|      0|					    "indirect *zero* offset\n");
 1799|    301|				return 0;
 1800|    301|			}
 1801|  2.30k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  2.30k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1801:8): [True: 0, False: 2.30k]
  ------------------
 1802|      0|				fprintf(stderr, "indirect +offs=%u\n", offset);
 1803|  2.30k|		}
 1804|   106k|		if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
  ------------------
  |  Branch (1804:7): [True: 0, False: 106k]
  ------------------
 1805|      0|			return -1;
 1806|   106k|		ms->offset = offset;
 1807|       |
 1808|   106k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   106k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1808:7): [True: 0, False: 106k]
  ------------------
 1809|      0|			mdebug(offset, RCAST(char *, RCAST(void *, p)),
  ------------------
  |  |  445|      0|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1810|      0|			    sizeof(union VALUETYPE));
 1811|      0|#ifndef COMPILE_ONLY
 1812|      0|			file_mdump(m);
 1813|      0|#endif
 1814|      0|		}
 1815|   106k|	}
 1816|       |
 1817|       |	/* Verify we have enough data to match magic type */
 1818|  90.0M|	switch (m->type) {
 1819|  1.29M|	case FILE_BYTE:
  ------------------
  |  |  241|  1.29M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1819:2): [True: 1.29M, False: 88.7M]
  ------------------
 1820|  1.29M|		if (OFFSET_OOB(nbytes, offset, 1))
  ------------------
  |  |   72|  1.29M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  2.59M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 104k, False: 1.19M]
  |  |  |  Branch (72:59): [True: 18.7k, False: 1.17M]
  |  |  ------------------
  ------------------
 1821|   123k|			return 0;
 1822|  1.17M|		break;
 1823|       |
 1824|  1.17M|	case FILE_SHORT:
  ------------------
  |  |  242|   905k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1824:2): [True: 905k, False: 89.1M]
  ------------------
 1825|  4.90M|	case FILE_BESHORT:
  ------------------
  |  |  247|  4.90M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1825:2): [True: 3.99M, False: 86.0M]
  ------------------
 1826|  7.62M|	case FILE_LESHORT:
  ------------------
  |  |  250|  7.62M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1826:2): [True: 2.71M, False: 87.3M]
  ------------------
 1827|  7.62M|		if (OFFSET_OOB(nbytes, offset, 2))
  ------------------
  |  |   72|  7.62M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  15.2M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 393k, False: 7.22M]
  |  |  |  Branch (72:59): [True: 189k, False: 7.03M]
  |  |  ------------------
  ------------------
 1828|   582k|			return 0;
 1829|  7.03M|		break;
 1830|       |
 1831|  7.03M|	case FILE_LONG:
  ------------------
  |  |  244|  1.40M|#define				FILE_LONG		4
  ------------------
  |  Branch (1831:2): [True: 1.40M, False: 88.6M]
  ------------------
 1832|  13.1M|	case FILE_BELONG:
  ------------------
  |  |  248|  13.1M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1832:2): [True: 11.7M, False: 78.3M]
  ------------------
 1833|  18.7M|	case FILE_LELONG:
  ------------------
  |  |  251|  18.7M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1833:2): [True: 5.59M, False: 84.4M]
  ------------------
 1834|  18.7M|	case FILE_MELONG:
  ------------------
  |  |  263|  18.7M|#define				FILE_MELONG		23
  ------------------
  |  Branch (1834:2): [True: 34, False: 90.0M]
  ------------------
 1835|  18.7M|	case FILE_DATE:
  ------------------
  |  |  246|  18.7M|#define				FILE_DATE		6
  ------------------
  |  Branch (1835:2): [True: 0, False: 90.0M]
  ------------------
 1836|  18.7M|	case FILE_BEDATE:
  ------------------
  |  |  249|  18.7M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1836:2): [True: 231, False: 90.0M]
  ------------------
 1837|  18.7M|	case FILE_LEDATE:
  ------------------
  |  |  252|  18.7M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1837:2): [True: 157, False: 90.0M]
  ------------------
 1838|  18.7M|	case FILE_MEDATE:
  ------------------
  |  |  261|  18.7M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1838:2): [True: 96, False: 90.0M]
  ------------------
 1839|  18.7M|	case FILE_LDATE:
  ------------------
  |  |  254|  18.7M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1839:2): [True: 0, False: 90.0M]
  ------------------
 1840|  18.7M|	case FILE_BELDATE:
  ------------------
  |  |  255|  18.7M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1840:2): [True: 222, False: 90.0M]
  ------------------
 1841|  18.7M|	case FILE_LELDATE:
  ------------------
  |  |  256|  18.7M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1841:2): [True: 68, False: 90.0M]
  ------------------
 1842|  18.7M|	case FILE_MELDATE:
  ------------------
  |  |  262|  18.7M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1842:2): [True: 0, False: 90.0M]
  ------------------
 1843|  18.7M|	case FILE_FLOAT:
  ------------------
  |  |  273|  18.7M|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1843:2): [True: 0, False: 90.0M]
  ------------------
 1844|  18.7M|	case FILE_BEFLOAT:
  ------------------
  |  |  274|  18.7M|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1844:2): [True: 0, False: 90.0M]
  ------------------
 1845|  18.7M|	case FILE_LEFLOAT:
  ------------------
  |  |  275|  18.7M|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1845:2): [True: 4.77k, False: 90.0M]
  ------------------
 1846|  18.7M|		if (OFFSET_OOB(nbytes, offset, 4))
  ------------------
  |  |   72|  18.7M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  37.5M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 953k, False: 17.8M]
  |  |  |  Branch (72:59): [True: 1.28M, False: 16.5M]
  |  |  ------------------
  ------------------
 1847|  2.24M|			return 0;
 1848|  16.5M|		break;
 1849|       |
 1850|  16.5M|	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1850:2): [True: 0, False: 90.0M]
  ------------------
 1851|    329|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|    329|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1851:2): [True: 329, False: 90.0M]
  ------------------
 1852|  1.19k|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|  1.19k|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1852:2): [True: 866, False: 90.0M]
  ------------------
 1853|  1.19k|		if (OFFSET_OOB(nbytes, offset, 8))
  ------------------
  |  |   72|  1.19k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|  2.39k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 369, False: 826]
  |  |  |  Branch (72:59): [True: 297, False: 529]
  |  |  ------------------
  ------------------
 1854|    666|			return 0;
 1855|    529|		break;
 1856|       |
 1857|   164k|	case FILE_GUID:
  ------------------
  |  |  289|   164k|#define				FILE_GUID		49
  ------------------
  |  Branch (1857:2): [True: 164k, False: 89.9M]
  ------------------
 1858|   164k|		if (OFFSET_OOB(nbytes, offset, 16))
  ------------------
  |  |   72|   164k|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|   328k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 0, False: 164k]
  |  |  |  Branch (72:59): [True: 24.6k, False: 139k]
  |  |  ------------------
  ------------------
 1859|  24.6k|			return 0;
 1860|   139k|		break;
 1861|       |
 1862|  59.0M|	case FILE_STRING:
  ------------------
  |  |  245|  59.0M|#define				FILE_STRING		5
  ------------------
  |  Branch (1862:2): [True: 59.0M, False: 31.0M]
  ------------------
 1863|  59.0M|	case FILE_PSTRING:
  ------------------
  |  |  253|  59.0M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1863:2): [True: 29.4k, False: 90.0M]
  ------------------
 1864|  59.9M|	case FILE_SEARCH:
  ------------------
  |  |  260|  59.9M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1864:2): [True: 849k, False: 89.2M]
  ------------------
 1865|  59.9M|	case FILE_OCTAL:
  ------------------
  |  |  299|  59.9M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1865:2): [True: 0, False: 90.0M]
  ------------------
 1866|  59.9M|		if (OFFSET_OOB(nbytes, offset, m->vallen))
  ------------------
  |  |   72|  59.9M|#define OFFSET_OOB(n, o, i)	((n) < CAST(uint32_t, (o)) || (i) > ((n) - (o)))
  |  |  ------------------
  |  |  |  |  444|   119M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (72:30): [True: 3.78M, False: 56.1M]
  |  |  |  Branch (72:59): [True: 9.25M, False: 46.8M]
  |  |  ------------------
  ------------------
 1867|  13.0M|			return 0;
 1868|  46.8M|		break;
 1869|       |
 1870|  46.8M|	case FILE_REGEX:
  ------------------
  |  |  257|   217k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1870:2): [True: 217k, False: 89.8M]
  ------------------
 1871|   217k|		if (nbytes < offset)
  ------------------
  |  Branch (1871:7): [True: 1.50k, False: 216k]
  ------------------
 1872|  1.50k|			return 0;
 1873|   216k|		break;
 1874|       |
 1875|   216k|	case FILE_INDIRECT:
  ------------------
  |  |  281|  21.8k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (1875:2): [True: 21.8k, False: 90.0M]
  ------------------
 1876|  21.8k|		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  375|  21.8k|#define str_flags _u._s._flags
  ------------------
              		if (m->str_flags & INDIRECT_RELATIVE)
  ------------------
  |  |  427|  21.8k|#define	INDIRECT_RELATIVE			BIT(0)
  |  |  ------------------
  |  |  |  |  388|  21.8k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1876:7): [True: 12.8k, False: 8.95k]
  ------------------
 1877|  12.8k|			offset += CAST(uint32_t, o);
  ------------------
  |  |  444|  12.8k|#define CAST(T, b)	((T)(b))
  ------------------
 1878|  21.8k|		if (offset == 0)
  ------------------
  |  Branch (1878:7): [True: 982, False: 20.8k]
  ------------------
 1879|    982|			return 0;
 1880|       |
 1881|  20.8k|		if (nbytes < offset)
  ------------------
  |  Branch (1881:7): [True: 2.31k, False: 18.5k]
  ------------------
 1882|  2.31k|			return 0;
 1883|       |
 1884|  18.5k|		if ((pb = file_push_buffer(ms)) == NULL)
  ------------------
  |  Branch (1884:7): [True: 929, False: 17.6k]
  ------------------
 1885|    929|			return -1;
 1886|       |
 1887|  17.6k|		(*indir_count)++;
 1888|  17.6k|		bb = *b;
 1889|  17.6k|		bb.fbuf = s + offset;
 1890|  17.6k|		bb.flen = nbytes - offset;
 1891|  17.6k|		bb.ebuf = NULL;
 1892|  17.6k|		bb.elen = 0;
 1893|  17.6k|		rv = -1;
 1894|  20.6k|		for (mlp = ms->mlist[0]->next; mlp != ms->mlist[0];
  ------------------
  |  Branch (1894:34): [True: 17.6k, False: 3.02k]
  ------------------
 1895|  17.6k|		    mlp = mlp->next)
 1896|  17.6k|		{
 1897|  17.6k|			if ((rv = match(ms, mlp->magic, mlp->magic_rxcomp,
  ------------------
  |  Branch (1897:8): [True: 14.5k, False: 3.02k]
  ------------------
 1898|  17.6k|			    mlp->nmagic, &bb, 0, BINTEST, text, 0, indir_count,
  ------------------
  |  |  228|  17.6k|#define BINTEST		0x20	/* test is for a binary type (set only
  ------------------
 1899|  17.6k|			    name_count, printed_something, need_separator,
 1900|  17.6k|			    firstline, NULL, NULL)) != 0)
 1901|  14.5k|				break;
 1902|  17.6k|		}
 1903|  17.6k|		buffer_fini(&bb);
 1904|       |
 1905|  17.6k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  17.6k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1905:7): [True: 0, False: 17.6k]
  ------------------
 1906|      0|			fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
 1907|       |
 1908|  17.6k|		rbuf = file_pop_buffer(ms, pb);
 1909|  17.6k|		if (rbuf == NULL && ms->event_flags & EVENT_HAD_ERR)
  ------------------
  |  |  479|  3.68k|#define 		EVENT_HAD_ERR		0x01
  ------------------
  |  Branch (1909:7): [True: 3.68k, False: 13.9k]
  |  Branch (1909:23): [True: 1.44k, False: 2.24k]
  ------------------
 1910|  1.44k|			return -1;
 1911|       |
 1912|  16.1k|		if (rv == 1) {
  ------------------
  |  Branch (1912:7): [True: 13.1k, False: 3.02k]
  ------------------
 1913|  13.1k|			if ((ms->flags & MAGIC_NODESC) == 0 &&
  ------------------
  |  |   52|  13.1k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  13.1k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  13.1k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  13.1k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  13.1k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  13.1k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1913:8): [True: 13.1k, False: 0]
  ------------------
 1914|  13.1k|			    file_printf(ms, F(ms, m->desc, "%u"), offset) == -1)
  ------------------
  |  |  158|  13.1k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (1914:8): [True: 0, False: 13.1k]
  ------------------
 1915|      0|			{
 1916|      0|				free(rbuf);
 1917|      0|				return -1;
 1918|      0|			}
 1919|  13.1k|			if (file_printf(ms, "%s", rbuf) == -1) {
  ------------------
  |  Branch (1919:8): [True: 97, False: 13.0k]
  ------------------
 1920|     97|				free(rbuf);
 1921|     97|				return -1;
 1922|     97|			}
 1923|  13.1k|		}
 1924|  16.0k|		free(rbuf);
 1925|  16.0k|		return rv;
 1926|       |
 1927|  62.0k|	case FILE_USE:
  ------------------
  |  |  286|  62.0k|#define				FILE_USE		46
  ------------------
  |  Branch (1927:2): [True: 62.0k, False: 90.0M]
  ------------------
 1928|  62.0k|		if (nbytes < offset)
  ------------------
  |  Branch (1928:7): [True: 8.47k, False: 53.5k]
  ------------------
 1929|  8.47k|			return 0;
 1930|  53.5k|		rbuf = m->value.s;
 1931|  53.5k|		if (*rbuf == '^') {
  ------------------
  |  Branch (1931:7): [True: 474, False: 53.1k]
  ------------------
 1932|    474|			rbuf++;
 1933|    474|			flip = !flip;
 1934|    474|		}
 1935|  53.5k|		if (file_magicfind(ms, rbuf, &ml) == -1) {
  ------------------
  |  Branch (1935:7): [True: 0, False: 53.5k]
  ------------------
 1936|      0|			file_error(ms, 0, "cannot find entry `%s'", rbuf);
 1937|      0|			return -1;
 1938|      0|		}
 1939|  53.5k|		if (save_cont(ms, &c) == -1) {
  ------------------
  |  Branch (1939:7): [True: 0, False: 53.5k]
  ------------------
 1940|      0|			file_error(ms, errno, "can't allocate continuation");
 1941|      0|			return -1;
 1942|      0|		}
 1943|       |
 1944|  53.5k|		oneed_separator = *need_separator;
 1945|  53.5k|		if (m->flag & NOSPACE)
  ------------------
  |  |  227|  53.5k|#define NOSPACE		0x10	/* suppress space character before output */
  ------------------
  |  Branch (1945:7): [True: 13.7k, False: 39.8k]
  ------------------
 1946|  13.7k|			*need_separator = 0;
 1947|       |
 1948|  53.5k|		nfound_match = 0;
 1949|  53.5k|		(*name_count)++;
 1950|  53.5k|		eoffset = ms->eoffset;
 1951|  53.5k|		rv = match(ms, ml.magic, ml.magic_rxcomp, ml.nmagic, b,
 1952|  53.5k|		    offset + o, mode, text, flip, indir_count, name_count,
 1953|  53.5k|		    printed_something, need_separator, firstline, returnval,
 1954|  53.5k|		    &nfound_match);
 1955|  53.5k|		ms->ms_value.q = nfound_match;
 1956|  53.5k|		(*name_count)--;
 1957|  53.5k|		*found_match |= nfound_match;
 1958|       |
 1959|  53.5k|		restore_cont(ms, &c);
 1960|       |
 1961|  53.5k|		if (rv != 1)
  ------------------
  |  Branch (1961:7): [True: 6.06k, False: 47.5k]
  ------------------
 1962|  6.06k|		    *need_separator = oneed_separator;
 1963|  53.5k|		ms->offset = offset;
 1964|  53.5k|		ms->eoffset = eoffset;
 1965|  53.5k|		return rv || *found_match;
  ------------------
  |  Branch (1965:10): [True: 49.4k, False: 4.12k]
  |  Branch (1965:16): [True: 0, False: 4.12k]
  ------------------
 1966|       |
 1967|  53.5k|	case FILE_NAME:
  ------------------
  |  |  285|  53.5k|#define				FILE_NAME		45
  ------------------
  |  Branch (1967:2): [True: 53.5k, False: 90.0M]
  ------------------
 1968|  53.5k|		if (ms->flags & MAGIC_NODESC)
  ------------------
  |  |   52|  53.5k|#define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   46|  53.5k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   44|  53.5k|#define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   37|  53.5k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  |  |  |  |  ------------------
  |  |  |  |               #define MAGIC_MIME		(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  53.5k|#define	MAGIC_MIME_ENCODING	0x0000400 /* Return the MIME encoding */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define MAGIC_NODESC		(MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
  |  |  ------------------
  |  |  |  |   45|  53.5k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  |  |  ------------------
  ------------------
  |  Branch (1968:7): [True: 0, False: 53.5k]
  ------------------
 1969|      0|			return 1;
 1970|  53.5k|		if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (1970:7): [True: 0, False: 53.5k]
  ------------------
 1971|      0|			return -1;
 1972|  53.5k|		return 1;
 1973|   375k|	case FILE_DER:
  ------------------
  |  |  288|   375k|#define				FILE_DER		48
  ------------------
  |  Branch (1973:2): [True: 375k, False: 89.6M]
  ------------------
 1974|   381k|	case FILE_DEFAULT:	/* nothing to check */
  ------------------
  |  |  243|   381k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1974:2): [True: 6.08k, False: 90.0M]
  ------------------
 1975|   381k|	case FILE_CLEAR:
  ------------------
  |  |  287|   381k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1975:2): [True: 249, False: 90.0M]
  ------------------
 1976|  1.94M|	default:
  ------------------
  |  Branch (1976:2): [True: 1.56M, False: 88.5M]
  ------------------
 1977|  1.94M|		break;
 1978|  90.0M|	}
 1979|  73.9M|	if (!mconvert(ms, m, flip))
  ------------------
  |  Branch (1979:6): [True: 82, False: 73.9M]
  ------------------
 1980|     82|		return 0;
 1981|  73.9M|	return 1;
 1982|  73.9M|}
softmagic.c:mcopy:
 1325|  90.1M|{
 1326|  90.1M|	size_t size = sizeof(*p);
 1327|       |	/*
 1328|       |	 * Note: FILE_SEARCH and FILE_REGEX do not actually copy
 1329|       |	 * anything, but setup pointers into the source
 1330|       |	 */
 1331|  90.1M|	if (indir == 0) {
  ------------------
  |  Branch (1331:6): [True: 90.0M, False: 115k]
  ------------------
 1332|  90.0M|		switch (type) {
 1333|   375k|		case FILE_DER:
  ------------------
  |  |  288|   375k|#define				FILE_DER		48
  ------------------
  |  Branch (1333:3): [True: 375k, False: 89.6M]
  ------------------
 1334|  1.22M|		case FILE_SEARCH:
  ------------------
  |  |  260|  1.22M|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1334:3): [True: 849k, False: 89.2M]
  ------------------
 1335|  1.22M|			if (offset > nbytes)
  ------------------
  |  Branch (1335:8): [True: 63.0k, False: 1.16M]
  ------------------
 1336|  63.0k|				offset = CAST(uint32_t, nbytes);
  ------------------
  |  |  444|  63.0k|#define CAST(T, b)	((T)(b))
  ------------------
 1337|  1.22M|			ms->search.s = RCAST(const char *, s) + offset;
  ------------------
  |  |  445|  1.22M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1338|  1.22M|			ms->search.s_len = nbytes - offset;
 1339|  1.22M|			ms->search.offset = offset;
 1340|  1.22M|			return 0;
 1341|       |
 1342|   217k|		case FILE_REGEX: {
  ------------------
  |  |  257|   217k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1342:3): [True: 217k, False: 89.8M]
  ------------------
 1343|   217k|			const char *b;
 1344|   217k|			const char *c;
 1345|   217k|			const char *last;	/* end of search region */
 1346|   217k|			const char *buf;	/* start of search region */
 1347|   217k|			const char *end;
 1348|   217k|			size_t lines, linecnt, bytecnt;
 1349|       |
 1350|   217k|			if (s == NULL || nbytes < offset) {
  ------------------
  |  Branch (1350:8): [True: 0, False: 217k]
  |  Branch (1350:21): [True: 1.56k, False: 215k]
  ------------------
 1351|  1.56k|				ms->search.s_len = 0;
 1352|  1.56k|				ms->search.s = NULL;
 1353|  1.56k|				return 0;
 1354|  1.56k|			}
 1355|       |
 1356|   215k|			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  375|   215k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & REGEX_LINE_COUNT) {
  ------------------
  |  |  402|   215k|#define REGEX_LINE_COUNT			BIT(11)
  |  |  ------------------
  |  |  |  |  388|   215k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (1356:8): [True: 55.6k, False: 160k]
  ------------------
 1357|  55.6k|				linecnt = m->str_range;
  ------------------
  |  |  374|  55.6k|#define str_range _u._s._count
  ------------------
 1358|  55.6k|				bytecnt = linecnt * 80;
 1359|   160k|			} else {
 1360|   160k|				linecnt = 0;
 1361|   160k|				bytecnt = m->str_range;
  ------------------
  |  |  374|   160k|#define str_range _u._s._count
  ------------------
 1362|   160k|			}
 1363|       |
 1364|   215k|			if (bytecnt == 0 || bytecnt > nbytes - offset)
  ------------------
  |  Branch (1364:8): [True: 135k, False: 80.2k]
  |  Branch (1364:24): [True: 68.1k, False: 12.1k]
  ------------------
 1365|   203k|				bytecnt = nbytes - offset;
 1366|   215k|			if (bytecnt > ms->regex_max)
  ------------------
  |  Branch (1366:8): [True: 22.0k, False: 193k]
  ------------------
 1367|  22.0k|				bytecnt = ms->regex_max;
 1368|       |
 1369|   215k|			buf = RCAST(const char *, s) + offset;
  ------------------
  |  |  445|   215k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1370|   215k|			end = last = RCAST(const char *, s) + bytecnt + offset;
  ------------------
  |  |  445|   215k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1371|       |			/* mget() guarantees buf <= last */
 1372|   466k|			for (lines = linecnt, b = buf; lines && b < end &&
  ------------------
  |  Branch (1372:35): [True: 303k, False: 162k]
  |  Branch (1372:44): [True: 300k, False: 3.21k]
  ------------------
 1373|   466k|			     ((b = CAST(const char *,
  ------------------
  |  |  444|   300k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1373:10): [True: 184k, False: 116k]
  ------------------
 1374|   300k|				 memchr(c = b, '\n', CAST(size_t, (end - b)))))
 1375|   300k|			     || (b = CAST(const char *,
  ------------------
  |  |  444|   116k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (1375:12): [True: 66.3k, False: 49.8k]
  ------------------
 1376|   116k|				 memchr(c, '\r', CAST(size_t, (end - c))))));
 1377|   250k|			     lines--, b++) {
 1378|   250k|				if (b < end - 1 && b[0] == '\r' && b[1] == '\n')
  ------------------
  |  Branch (1378:9): [True: 247k, False: 2.58k]
  |  Branch (1378:24): [True: 65.6k, False: 182k]
  |  Branch (1378:40): [True: 0, False: 65.6k]
  ------------------
 1379|      0|					b++;
 1380|   250k|				if (b < end - 1 && b[0] == '\n')
  ------------------
  |  Branch (1380:9): [True: 247k, False: 2.58k]
  |  Branch (1380:24): [True: 182k, False: 65.6k]
  ------------------
 1381|   182k|					b++;
 1382|   250k|				last = b;
 1383|   250k|			}
 1384|   215k|			if (lines)
  ------------------
  |  Branch (1384:8): [True: 53.0k, False: 162k]
  ------------------
 1385|  53.0k|				last = end;
 1386|       |
 1387|   215k|			ms->search.s = buf;
 1388|   215k|			ms->search.s_len = last - buf;
 1389|   215k|			ms->search.offset = offset;
 1390|   215k|			ms->search.rm_len = 0;
 1391|   215k|			return 0;
 1392|   217k|		}
 1393|    147|		case FILE_BESTRING16:
  ------------------
  |  |  258|    147|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1393:3): [True: 147, False: 90.0M]
  ------------------
 1394|  55.9k|		case FILE_LESTRING16: {
  ------------------
  |  |  259|  55.9k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1394:3): [True: 55.8k, False: 90.0M]
  ------------------
 1395|  55.9k|			const unsigned char *src = s + offset;
 1396|  55.9k|			const unsigned char *esrc = s + nbytes;
 1397|  55.9k|			char *dst = p->s;
 1398|  55.9k|			char *edst = &p->s[sizeof(p->s) - 1];
 1399|       |
 1400|  55.9k|			if (type == FILE_BESTRING16)
  ------------------
  |  |  258|  55.9k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1400:8): [True: 147, False: 55.8k]
  ------------------
 1401|    147|				src++;
 1402|       |
 1403|       |			/* check that offset is within range */
 1404|  55.9k|			if (offset >= nbytes)
  ------------------
  |  Branch (1404:8): [True: 1.86k, False: 54.0k]
  ------------------
 1405|  1.86k|				break;
 1406|  2.66M|			for (/*EMPTY*/; src < esrc; src += 2, dst++) {
  ------------------
  |  Branch (1406:20): [True: 2.63M, False: 38.7k]
  ------------------
 1407|  2.63M|				if (dst < edst)
  ------------------
  |  Branch (1407:9): [True: 2.61M, False: 15.2k]
  ------------------
 1408|  2.61M|					*dst = *src;
 1409|  15.2k|				else
 1410|  15.2k|					break;
 1411|  2.61M|				if (*dst == '\0') {
  ------------------
  |  Branch (1411:9): [True: 1.40M, False: 1.21M]
  ------------------
 1412|  1.40M|					if (type == FILE_BESTRING16 ?
  ------------------
  |  |  258|  1.40M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1412:10): [True: 2.88k, False: 1.40M]
  |  Branch (1412:10): [True: 585k, False: 817k]
  ------------------
 1413|  2.88k|					    *(src - 1) != '\0' :
 1414|  1.40M|					    ((src + 1 < esrc) &&
  ------------------
  |  Branch (1414:11): [True: 1.39M, False: 2.77k]
  ------------------
 1415|  1.40M|					    *(src + 1) != '\0'))
  ------------------
  |  Branch (1415:10): [True: 585k, False: 811k]
  ------------------
 1416|   585k|						*dst = ' ';
 1417|  1.40M|				}
 1418|  2.61M|			}
 1419|  54.0k|			*edst = '\0';
 1420|  54.0k|			return 0;
 1421|  55.9k|		}
 1422|  59.0M|		case FILE_STRING:	/* XXX - these two should not need */
  ------------------
  |  |  245|  59.0M|#define				FILE_STRING		5
  ------------------
  |  Branch (1422:3): [True: 59.0M, False: 31.0M]
  ------------------
 1423|  59.0M|		case FILE_PSTRING:	/* to copy anything, but do anyway. */
  ------------------
  |  |  253|  59.0M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1423:3): [True: 29.4k, False: 90.0M]
  ------------------
 1424|  59.0M|			if (m->str_range != 0 && m->str_range < sizeof(*p))
  ------------------
  |  |  374|  59.0M|#define str_range _u._s._count
  ------------------
              			if (m->str_range != 0 && m->str_range < sizeof(*p))
  ------------------
  |  |  374|     34|#define str_range _u._s._count
  ------------------
  |  Branch (1424:8): [True: 34, False: 59.0M]
  |  Branch (1424:29): [True: 34, False: 0]
  ------------------
 1425|     34|				size = m->str_range;
  ------------------
  |  |  374|     34|#define str_range _u._s._count
  ------------------
 1426|  59.0M|			break;
 1427|  29.4M|		default:
  ------------------
  |  Branch (1427:3): [True: 29.4M, False: 60.5M]
  ------------------
 1428|  29.4M|			break;
 1429|  90.0M|		}
 1430|  90.0M|	}
 1431|       |
 1432|  88.6M|	if (type == FILE_OFFSET) {
  ------------------
  |  |  290|  88.6M|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1432:6): [True: 0, False: 88.6M]
  ------------------
 1433|      0|		(void)memset(p, '\0', sizeof(*p));
 1434|      0|		p->q = offset;
 1435|      0|		return 0;
 1436|      0|	}
 1437|       |
 1438|  88.6M|	if (offset >= nbytes) {
  ------------------
  |  Branch (1438:6): [True: 6.76M, False: 81.9M]
  ------------------
 1439|  6.76M|		(void)memset(p, '\0', sizeof(*p));
 1440|  6.76M|		return 0;
 1441|  6.76M|	}
 1442|  81.9M|	if (nbytes - offset < size)
  ------------------
  |  Branch (1442:6): [True: 55.4M, False: 26.4M]
  ------------------
 1443|  55.4M|		nbytes = nbytes - offset;
 1444|  26.4M|	else
 1445|  26.4M|		nbytes = size;
 1446|       |
 1447|  81.9M|	(void)memcpy(p, s + offset, nbytes);
 1448|       |
 1449|       |	/*
 1450|       |	 * the usefulness of padding with zeroes eludes me, it
 1451|       |	 * might even cause problems
 1452|       |	 */
 1453|  81.9M|	if (nbytes < sizeof(*p))
  ------------------
  |  Branch (1453:6): [True: 55.4M, False: 26.4M]
  ------------------
 1454|  55.4M|		(void)memset(RCAST(char *, RCAST(void *, p)) + nbytes, '\0',
  ------------------
  |  |  445|  55.4M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1455|  55.4M|		    sizeof(*p) - nbytes);
 1456|  81.9M|	return 0;
 1457|  88.6M|}
softmagic.c:cvt_flip:
 1001|  74.0M|{
 1002|  74.0M|	if (flip == 0)
  ------------------
  |  Branch (1002:6): [True: 74.0M, False: 14.6k]
  ------------------
 1003|  74.0M|		return type;
 1004|  14.6k|	switch (type) {
 1005|     15|	case FILE_BESHORT:
  ------------------
  |  |  247|     15|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1005:2): [True: 15, False: 14.6k]
  ------------------
 1006|     15|		return FILE_LESHORT;
  ------------------
  |  |  250|     15|#define				FILE_LESHORT		10
  ------------------
 1007|  1.39k|	case FILE_BELONG:
  ------------------
  |  |  248|  1.39k|#define				FILE_BELONG		8
  ------------------
  |  Branch (1007:2): [True: 1.39k, False: 13.2k]
  ------------------
 1008|  1.39k|		return FILE_LELONG;
  ------------------
  |  |  251|  1.39k|#define				FILE_LELONG		11
  ------------------
 1009|      0|	case FILE_BEDATE:
  ------------------
  |  |  249|      0|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1009:2): [True: 0, False: 14.6k]
  ------------------
 1010|      0|		return FILE_LEDATE;
  ------------------
  |  |  252|      0|#define				FILE_LEDATE		12
  ------------------
 1011|      0|	case FILE_BELDATE:
  ------------------
  |  |  255|      0|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1011:2): [True: 0, False: 14.6k]
  ------------------
 1012|      0|		return FILE_LELDATE;
  ------------------
  |  |  256|      0|#define				FILE_LELDATE		16
  ------------------
 1013|     28|	case FILE_BEQUAD:
  ------------------
  |  |  266|     28|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1013:2): [True: 28, False: 14.6k]
  ------------------
 1014|     28|		return FILE_LEQUAD;
  ------------------
  |  |  265|     28|#define				FILE_LEQUAD		25
  ------------------
 1015|     46|	case FILE_BEQDATE:
  ------------------
  |  |  269|     46|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1015:2): [True: 46, False: 14.5k]
  ------------------
 1016|     46|		return FILE_LEQDATE;
  ------------------
  |  |  268|     46|#define				FILE_LEQDATE		28
  ------------------
 1017|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  272|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1017:2): [True: 0, False: 14.6k]
  ------------------
 1018|      0|		return FILE_LEQLDATE;
  ------------------
  |  |  271|      0|#define				FILE_LEQLDATE		31
  ------------------
 1019|      0|	case FILE_BEQWDATE:
  ------------------
  |  |  284|      0|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1019:2): [True: 0, False: 14.6k]
  ------------------
 1020|      0|		return FILE_LEQWDATE;
  ------------------
  |  |  283|      0|#define				FILE_LEQWDATE		43
  ------------------
 1021|  11.7k|	case FILE_LESHORT:
  ------------------
  |  |  250|  11.7k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1021:2): [True: 11.7k, False: 2.86k]
  ------------------
 1022|  11.7k|		return FILE_BESHORT;
  ------------------
  |  |  247|  11.7k|#define				FILE_BESHORT		7
  ------------------
 1023|    333|	case FILE_LELONG:
  ------------------
  |  |  251|    333|#define				FILE_LELONG		11
  ------------------
  |  Branch (1023:2): [True: 333, False: 14.3k]
  ------------------
 1024|    333|		return FILE_BELONG;
  ------------------
  |  |  248|    333|#define				FILE_BELONG		8
  ------------------
 1025|     18|	case FILE_LEDATE:
  ------------------
  |  |  252|     18|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1025:2): [True: 18, False: 14.6k]
  ------------------
 1026|     18|		return FILE_BEDATE;
  ------------------
  |  |  249|     18|#define				FILE_BEDATE		9
  ------------------
 1027|      0|	case FILE_LELDATE:
  ------------------
  |  |  256|      0|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1027:2): [True: 0, False: 14.6k]
  ------------------
 1028|      0|		return FILE_BELDATE;
  ------------------
  |  |  255|      0|#define				FILE_BELDATE		15
  ------------------
 1029|    120|	case FILE_LEQUAD:
  ------------------
  |  |  265|    120|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1029:2): [True: 120, False: 14.5k]
  ------------------
 1030|    120|		return FILE_BEQUAD;
  ------------------
  |  |  266|    120|#define				FILE_BEQUAD		26
  ------------------
 1031|      0|	case FILE_LEQDATE:
  ------------------
  |  |  268|      0|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1031:2): [True: 0, False: 14.6k]
  ------------------
 1032|      0|		return FILE_BEQDATE;
  ------------------
  |  |  269|      0|#define				FILE_BEQDATE		29
  ------------------
 1033|     10|	case FILE_LEQLDATE:
  ------------------
  |  |  271|     10|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1033:2): [True: 10, False: 14.6k]
  ------------------
 1034|     10|		return FILE_BEQLDATE;
  ------------------
  |  |  272|     10|#define				FILE_BEQLDATE		32
  ------------------
 1035|      0|	case FILE_LEQWDATE:
  ------------------
  |  |  283|      0|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1035:2): [True: 0, False: 14.6k]
  ------------------
 1036|      0|		return FILE_BEQWDATE;
  ------------------
  |  |  284|      0|#define				FILE_BEQWDATE		44
  ------------------
 1037|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1037:2): [True: 0, False: 14.6k]
  ------------------
 1038|      0|		return FILE_LEFLOAT;
  ------------------
  |  |  275|      0|#define				FILE_LEFLOAT		35
  ------------------
 1039|      0|	case FILE_LEFLOAT:
  ------------------
  |  |  275|      0|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1039:2): [True: 0, False: 14.6k]
  ------------------
 1040|      0|		return FILE_BEFLOAT;
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
 1041|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1041:2): [True: 0, False: 14.6k]
  ------------------
 1042|      0|		return FILE_LEDOUBLE;
  ------------------
  |  |  278|      0|#define				FILE_LEDOUBLE		38
  ------------------
 1043|      0|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|      0|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1043:2): [True: 0, False: 14.6k]
  ------------------
 1044|      0|		return FILE_BEDOUBLE;
  ------------------
  |  |  277|      0|#define				FILE_BEDOUBLE		37
  ------------------
 1045|    903|	default:
  ------------------
  |  Branch (1045:2): [True: 903, False: 13.7k]
  ------------------
 1046|    903|		return type;
 1047|  14.6k|	}
 1048|  14.6k|}
softmagic.c:do_ops:
 1462|   107k|{
 1463|   107k|	intmax_t offset;
 1464|       |	// On purpose not INTMAX_MAX
 1465|   107k|	if (lhs >= UINT_MAX || lhs <= INT_MIN ||
  ------------------
  |  Branch (1465:6): [True: 735, False: 107k]
  |  Branch (1465:25): [True: 107, False: 107k]
  ------------------
 1466|   107k|	    off >= UINT_MAX || off <= INT_MIN) {
  ------------------
  |  Branch (1466:6): [True: 202, False: 106k]
  |  Branch (1466:25): [True: 0, False: 106k]
  ------------------
 1467|  1.04k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  1.04k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1467:7): [True: 0, False: 1.04k]
  ------------------
 1468|      0|			fprintf(stderr, "lhs/off overflow %jd %jd\n", lhs, off);
 1469|  1.04k|		return 1;
 1470|  1.04k|	}
 1471|       |	   
 1472|   106k|	if (off) {
  ------------------
  |  Branch (1472:6): [True: 72.0k, False: 34.9k]
  ------------------
 1473|  72.0k|		switch (m->in_op & FILE_OPS_MASK) {
  ------------------
  |  |  345|  72.0k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  ------------------
  |  Branch (1473:11): [True: 0, False: 72.0k]
  ------------------
 1474|     68|		case FILE_OPAND:
  ------------------
  |  |  337|     68|#define				FILE_OPAND	0
  ------------------
  |  Branch (1474:3): [True: 68, False: 71.9k]
  ------------------
 1475|     68|			offset = lhs & off;
 1476|     68|			break;
 1477|      0|		case FILE_OPOR:
  ------------------
  |  |  338|      0|#define				FILE_OPOR	1
  ------------------
  |  Branch (1477:3): [True: 0, False: 72.0k]
  ------------------
 1478|      0|			offset = lhs | off;
 1479|      0|			break;
 1480|      0|		case FILE_OPXOR:
  ------------------
  |  |  339|      0|#define				FILE_OPXOR	2
  ------------------
  |  Branch (1480:3): [True: 0, False: 72.0k]
  ------------------
 1481|      0|			offset = lhs ^ off;
 1482|      0|			break;
 1483|  66.0k|		case FILE_OPADD:
  ------------------
  |  |  340|  66.0k|#define				FILE_OPADD	3
  ------------------
  |  Branch (1483:3): [True: 66.0k, False: 5.99k]
  ------------------
 1484|  66.0k|			offset = lhs + off;
 1485|  66.0k|			break;
 1486|  1.81k|		case FILE_OPMINUS:
  ------------------
  |  |  341|  1.81k|#define				FILE_OPMINUS	4
  ------------------
  |  Branch (1486:3): [True: 1.81k, False: 70.2k]
  ------------------
 1487|  1.81k|			offset = lhs - off;
 1488|  1.81k|			break;
 1489|  4.07k|		case FILE_OPMULTIPLY:
  ------------------
  |  |  342|  4.07k|#define				FILE_OPMULTIPLY	5
  ------------------
  |  Branch (1489:3): [True: 4.07k, False: 67.9k]
  ------------------
 1490|  4.07k|			offset = lhs * off;
 1491|  4.07k|			break;
 1492|     36|		case FILE_OPDIVIDE:
  ------------------
  |  |  343|     36|#define				FILE_OPDIVIDE	6
  ------------------
  |  Branch (1492:3): [True: 36, False: 71.9k]
  ------------------
 1493|     36|			offset = lhs / off;
 1494|     36|			break;
 1495|      0|		case FILE_OPMODULO:
  ------------------
  |  |  344|      0|#define				FILE_OPMODULO	7
  ------------------
  |  Branch (1495:3): [True: 0, False: 72.0k]
  ------------------
 1496|      0|			offset = lhs % off;
 1497|      0|			break;
 1498|  72.0k|		}
 1499|  72.0k|	} else
 1500|  34.9k|		offset = lhs;
 1501|   106k|	if (m->in_op & FILE_OPINVERSE)
  ------------------
  |  |  349|   106k|#define				FILE_OPINVERSE	0x40
  ------------------
  |  Branch (1501:6): [True: 0, False: 106k]
  ------------------
 1502|      0|		offset = ~offset;
 1503|   106k|	if (offset >= UINT_MAX) {
  ------------------
  |  Branch (1503:6): [True: 511, False: 106k]
  ------------------
 1504|    511|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    511|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (1504:7): [True: 0, False: 511]
  ------------------
 1505|      0|			fprintf(stderr, "offset overflow %jd\n", offset);
 1506|    511|		return 1;
 1507|    511|	}
 1508|   106k|	*rv = CAST(uint32_t, offset);
  ------------------
  |  |  444|   106k|#define CAST(T, b)	((T)(b))
  ------------------
 1509|   106k|	return 0;
 1510|   106k|}
softmagic.c:cvt_id3:
  989|    146|{
  990|    146|	v = ((((v >>  0) & 0x7f) <<  0) |
  991|    146|	     (((v >>  8) & 0x7f) <<  7) |
  992|    146|	     (((v >> 16) & 0x7f) << 14) |
  993|    146|	     (((v >> 24) & 0x7f) << 21));
  994|    146|	if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    146|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (994:6): [True: 0, False: 146]
  ------------------
  995|      0|		fprintf(stderr, "id3 offs=%u\n", v);
  996|    146|	return v;
  997|    146|}
softmagic.c:file_fmtcheck:
  163|   111k|{
  164|   111k|	const char *ptr;
  165|       |
  166|   111k|	if (strchr(desc, '%') == NULL)
  ------------------
  |  Branch (166:6): [True: 81.4k, False: 30.2k]
  ------------------
  167|  81.4k|		return desc;
  168|       |
  169|  30.2k|	ptr = fmtcheck(desc, def);
  170|  30.2k|	if (ptr == def)
  ------------------
  |  Branch (170:6): [True: 0, False: 30.2k]
  ------------------
  171|      0|		file_magerror(ms,
  172|      0|		    "%s, %" SIZE_T_FORMAT "u: format `%s' does not match"
  173|      0|		    " with `%s'", file, line, desc, def);
  174|  30.2k|	return ptr;
  175|   111k|}
softmagic.c:save_cont:
 1564|  53.5k|{
 1565|  53.5k|	size_t len;
 1566|  53.5k|	*c = ms->c;
 1567|  53.5k|	len = c->len * sizeof(*c->li);
 1568|  53.5k|	ms->c.li = CAST(struct level_info *, malloc(len));
  ------------------
  |  |  444|  53.5k|#define CAST(T, b)	((T)(b))
  ------------------
 1569|  53.5k|	if (ms->c.li == NULL) {
  ------------------
  |  Branch (1569:6): [True: 0, False: 53.5k]
  ------------------
 1570|      0|		ms->c = *c;
 1571|      0|		return -1;
 1572|      0|	}
 1573|  53.5k|	memcpy(ms->c.li, c->li, len);
 1574|  53.5k|	return 0;
 1575|  53.5k|}
softmagic.c:restore_cont:
 1579|  53.5k|{
 1580|  53.5k|	free(ms->c.li);
 1581|  53.5k|	ms->c = *c;
 1582|  53.5k|}
softmagic.c:mconvert:
 1152|  73.9M|{
 1153|  73.9M|	union VALUETYPE *p = &ms->ms_value;
 1154|       |
 1155|  73.9M|	switch (cvt_flip(m->type, flip)) {
 1156|  1.17M|	case FILE_BYTE:
  ------------------
  |  |  241|  1.17M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (1156:2): [True: 1.17M, False: 72.7M]
  ------------------
 1157|  1.17M|		if (cvt_8(p, m) == -1)
  ------------------
  |  Branch (1157:7): [True: 0, False: 1.17M]
  ------------------
 1158|      0|			goto out;
 1159|  1.17M|		return 1;
 1160|   874k|	case FILE_SHORT:
  ------------------
  |  |  242|   874k|#define				FILE_SHORT		2
  ------------------
  |  Branch (1160:2): [True: 874k, False: 73.0M]
  ------------------
 1161|   874k|	case FILE_MSDOSDATE:
  ------------------
  |  |  293|   874k|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (1161:2): [True: 0, False: 73.9M]
  ------------------
 1162|   874k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|   874k|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (1162:2): [True: 67, False: 73.9M]
  ------------------
 1163|   874k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|   874k|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (1163:2): [True: 0, False: 73.9M]
  ------------------
 1164|   874k|	case FILE_MSDOSTIME:
  ------------------
  |  |  296|   874k|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (1164:2): [True: 0, False: 73.9M]
  ------------------
 1165|   874k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|   874k|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (1165:2): [True: 67, False: 73.9M]
  ------------------
 1166|   874k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|   874k|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (1166:2): [True: 0, False: 73.9M]
  ------------------
 1167|   874k|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1167:7): [True: 0, False: 874k]
  ------------------
 1168|      0|			goto out;
 1169|   874k|		return 1;
 1170|  1.27M|	case FILE_LONG:
  ------------------
  |  |  244|  1.27M|#define				FILE_LONG		4
  ------------------
  |  Branch (1170:2): [True: 1.27M, False: 72.6M]
  ------------------
 1171|  1.27M|	case FILE_DATE:
  ------------------
  |  |  246|  1.27M|#define				FILE_DATE		6
  ------------------
  |  Branch (1171:2): [True: 0, False: 73.9M]
  ------------------
 1172|  1.27M|	case FILE_LDATE:
  ------------------
  |  |  254|  1.27M|#define				FILE_LDATE		14
  ------------------
  |  Branch (1172:2): [True: 0, False: 73.9M]
  ------------------
 1173|  1.27M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1173:7): [True: 0, False: 1.27M]
  ------------------
 1174|      0|			goto out;
 1175|  1.27M|		return 1;
 1176|  57.0k|	case FILE_QUAD:
  ------------------
  |  |  264|  57.0k|#define				FILE_QUAD		24
  ------------------
  |  Branch (1176:2): [True: 57.0k, False: 73.8M]
  ------------------
 1177|  57.0k|	case FILE_QDATE:
  ------------------
  |  |  267|  57.0k|#define				FILE_QDATE		27
  ------------------
  |  Branch (1177:2): [True: 0, False: 73.9M]
  ------------------
 1178|  57.0k|	case FILE_QLDATE:
  ------------------
  |  |  270|  57.0k|#define				FILE_QLDATE		30
  ------------------
  |  Branch (1178:2): [True: 0, False: 73.9M]
  ------------------
 1179|  57.3k|	case FILE_QWDATE:
  ------------------
  |  |  282|  57.3k|#define				FILE_QWDATE		42
  ------------------
  |  Branch (1179:2): [True: 240, False: 73.9M]
  ------------------
 1180|  57.3k|	case FILE_OFFSET:
  ------------------
  |  |  290|  57.3k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (1180:2): [True: 0, False: 73.9M]
  ------------------
 1181|  57.3k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1181:7): [True: 0, False: 57.3k]
  ------------------
 1182|      0|			goto out;
 1183|  57.3k|		return 1;
 1184|  46.3M|	case FILE_STRING:
  ------------------
  |  |  245|  46.3M|#define				FILE_STRING		5
  ------------------
  |  Branch (1184:2): [True: 46.3M, False: 27.5M]
  ------------------
 1185|  46.3M|	case FILE_BESTRING16:
  ------------------
  |  |  258|  46.3M|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (1185:2): [True: 147, False: 73.9M]
  ------------------
 1186|  46.4M|	case FILE_LESTRING16:
  ------------------
  |  |  259|  46.4M|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (1186:2): [True: 55.8k, False: 73.8M]
  ------------------
 1187|  46.4M|	case FILE_OCTAL: {
  ------------------
  |  |  299|  46.4M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (1187:2): [True: 0, False: 73.9M]
  ------------------
 1188|       |		/* Null terminate and eat *trailing* return */
 1189|  46.4M|		p->s[sizeof(p->s) - 1] = '\0';
 1190|  46.4M|		return 1;
 1191|  46.4M|	}
 1192|  19.9k|	case FILE_PSTRING: {
  ------------------
  |  |  253|  19.9k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (1192:2): [True: 19.9k, False: 73.8M]
  ------------------
 1193|  19.9k|		char *ptr1, *ptr2;
 1194|  19.9k|		size_t len, sz = file_pstring_length_size(ms, m);
 1195|  19.9k|		if (sz == FILE_BADSIZE)
  ------------------
  |  |  175|  19.9k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|  19.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1195:7): [True: 0, False: 19.9k]
  ------------------
 1196|      0|			return 0;
 1197|  19.9k|		ptr1 = p->s;
 1198|  19.9k|		ptr2 = ptr1 + sz;
 1199|  19.9k|		len = file_pstring_get_length(ms, m, ptr1);
 1200|  19.9k|		if (len == FILE_BADSIZE)
  ------------------
  |  |  175|  19.9k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|  19.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (1200:7): [True: 82, False: 19.8k]
  ------------------
 1201|     82|			return 0;
 1202|  19.8k|		sz = sizeof(p->s) - sz; /* maximum length of string */
 1203|  19.8k|		if (len >= sz) {
  ------------------
  |  Branch (1203:7): [True: 10.6k, False: 9.22k]
  ------------------
 1204|       |			/*
 1205|       |			 * The size of the pascal string length (sz)
 1206|       |			 * is 1, 2, or 4. We need at least 1 byte for NUL
 1207|       |			 * termination, but we've already truncated the
 1208|       |			 * string by p->s, so we need to deduct sz.
 1209|       |			 * Because we can use one of the bytes of the length
 1210|       |			 * after we shifted as NUL termination.
 1211|       |			 */
 1212|  10.6k|			len = sz;
 1213|  10.6k|		}
 1214|  1.69M|		while (len--)
  ------------------
  |  Branch (1214:10): [True: 1.67M, False: 19.8k]
  ------------------
 1215|  1.67M|			*ptr1++ = *ptr2++;
 1216|  19.8k|		*ptr1 = '\0';
 1217|  19.8k|		return 1;
 1218|  19.9k|	}
 1219|  3.71M|	case FILE_BESHORT:
  ------------------
  |  |  247|  3.71M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (1219:2): [True: 3.71M, False: 70.1M]
  ------------------
 1220|  3.71M|		p->h = CAST(short, BE16(p));
  ------------------
  |  |  444|  3.71M|#define CAST(T, b)	((T)(b))
  ------------------
 1221|  3.71M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1221:7): [True: 0, False: 3.71M]
  ------------------
 1222|      0|			goto out;
 1223|  3.71M|		return 1;
 1224|  10.4M|	case FILE_BELONG:
  ------------------
  |  |  248|  10.4M|#define				FILE_BELONG		8
  ------------------
  |  Branch (1224:2): [True: 10.4M, False: 63.4M]
  ------------------
 1225|  10.4M|	case FILE_BEDATE:
  ------------------
  |  |  249|  10.4M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (1225:2): [True: 173, False: 73.9M]
  ------------------
 1226|  10.4M|	case FILE_BELDATE:
  ------------------
  |  |  255|  10.4M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (1226:2): [True: 144, False: 73.9M]
  ------------------
 1227|  10.4M|		p->l = CAST(int32_t, BE32(p));
  ------------------
  |  |  444|  10.4M|#define CAST(T, b)	((T)(b))
  ------------------
 1228|  10.4M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1228:7): [True: 0, False: 10.4M]
  ------------------
 1229|      0|			goto out;
 1230|  10.4M|		return 1;
 1231|   779k|	case FILE_BEQUAD:
  ------------------
  |  |  266|   779k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (1231:2): [True: 779k, False: 73.1M]
  ------------------
 1232|   779k|	case FILE_BEQDATE:
  ------------------
  |  |  269|   779k|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (1232:2): [True: 96, False: 73.9M]
  ------------------
 1233|   779k|	case FILE_BEQLDATE:
  ------------------
  |  |  272|   779k|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (1233:2): [True: 10, False: 73.9M]
  ------------------
 1234|   779k|	case FILE_BEQWDATE:
  ------------------
  |  |  284|   779k|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (1234:2): [True: 0, False: 73.9M]
  ------------------
 1235|   779k|		p->q = CAST(uint64_t, BE64(p));
  ------------------
  |  |  444|   779k|#define CAST(T, b)	((T)(b))
  ------------------
 1236|   779k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1236:7): [True: 0, False: 779k]
  ------------------
 1237|      0|			goto out;
 1238|   779k|		return 1;
 1239|  2.44M|	case FILE_LESHORT:
  ------------------
  |  |  250|  2.44M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (1239:2): [True: 2.44M, False: 71.4M]
  ------------------
 1240|  2.44M|		p->h = CAST(short, LE16(p));
  ------------------
  |  |  444|  2.44M|#define CAST(T, b)	((T)(b))
  ------------------
 1241|  2.44M|		if (cvt_16(p, m) == -1)
  ------------------
  |  Branch (1241:7): [True: 0, False: 2.44M]
  ------------------
 1242|      0|			goto out;
 1243|  2.44M|		return 1;
 1244|  4.73M|	case FILE_LELONG:
  ------------------
  |  |  251|  4.73M|#define				FILE_LELONG		11
  ------------------
  |  Branch (1244:2): [True: 4.73M, False: 69.1M]
  ------------------
 1245|  4.74M|	case FILE_LEDATE:
  ------------------
  |  |  252|  4.74M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (1245:2): [True: 131, False: 73.9M]
  ------------------
 1246|  4.74M|	case FILE_LELDATE:
  ------------------
  |  |  256|  4.74M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (1246:2): [True: 34, False: 73.9M]
  ------------------
 1247|  4.74M|		p->l = CAST(int32_t, LE32(p));
  ------------------
  |  |  444|  4.74M|#define CAST(T, b)	((T)(b))
  ------------------
 1248|  4.74M|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1248:7): [True: 0, False: 4.74M]
  ------------------
 1249|      0|			goto out;
 1250|  4.74M|		return 1;
 1251|   666k|	case FILE_LEQUAD:
  ------------------
  |  |  265|   666k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (1251:2): [True: 666k, False: 73.2M]
  ------------------
 1252|   666k|	case FILE_LEQDATE:
  ------------------
  |  |  268|   666k|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (1252:2): [True: 135, False: 73.9M]
  ------------------
 1253|   666k|	case FILE_LEQLDATE:
  ------------------
  |  |  271|   666k|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (1253:2): [True: 10, False: 73.9M]
  ------------------
 1254|   667k|	case FILE_LEQWDATE:
  ------------------
  |  |  283|   667k|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (1254:2): [True: 1.12k, False: 73.9M]
  ------------------
 1255|   667k|		p->q = CAST(uint64_t, LE64(p));
  ------------------
  |  |  444|   667k|#define CAST(T, b)	((T)(b))
  ------------------
 1256|   667k|		if (cvt_64(p, m) == -1)
  ------------------
  |  Branch (1256:7): [True: 0, False: 667k]
  ------------------
 1257|      0|			goto out;
 1258|   667k|		return 1;
 1259|     34|	case FILE_MELONG:
  ------------------
  |  |  263|     34|#define				FILE_MELONG		23
  ------------------
  |  Branch (1259:2): [True: 34, False: 73.9M]
  ------------------
 1260|    130|	case FILE_MEDATE:
  ------------------
  |  |  261|    130|#define				FILE_MEDATE		21
  ------------------
  |  Branch (1260:2): [True: 96, False: 73.9M]
  ------------------
 1261|    130|	case FILE_MELDATE:
  ------------------
  |  |  262|    130|#define				FILE_MELDATE		22
  ------------------
  |  Branch (1261:2): [True: 0, False: 73.9M]
  ------------------
 1262|    130|		p->l = CAST(int32_t, ME32(p));
  ------------------
  |  |  444|    130|#define CAST(T, b)	((T)(b))
  ------------------
 1263|    130|		if (cvt_32(p, m) == -1)
  ------------------
  |  Branch (1263:7): [True: 0, False: 130]
  ------------------
 1264|      0|			goto out;
 1265|    130|		return 1;
 1266|      0|	case FILE_FLOAT:
  ------------------
  |  |  273|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (1266:2): [True: 0, False: 73.9M]
  ------------------
 1267|      0|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1267:7): [True: 0, False: 0]
  ------------------
 1268|      0|			goto out;
 1269|      0|		return 1;
 1270|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (1270:2): [True: 0, False: 73.9M]
  ------------------
 1271|      0|		p->l = BE32(p);
  ------------------
  |  |   96|      0|#define BE32(p) ( \
  |  |   97|      0|    (CAST(uint32_t, (p)->hl[0])<<24)| \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   98|      0|    (CAST(uint32_t, (p)->hl[1])<<16)| \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   99|      0|    (CAST(uint32_t, (p)->hl[2])<<8)| \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  100|      0|    (CAST(uint32_t, (p)->hl[3])))
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1272|      0|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1272:7): [True: 0, False: 0]
  ------------------
 1273|      0|			goto out;
 1274|      0|		return 1;
 1275|  4.77k|	case FILE_LEFLOAT:
  ------------------
  |  |  275|  4.77k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (1275:2): [True: 4.77k, False: 73.9M]
  ------------------
 1276|  4.77k|		p->l = LE32(p);
  ------------------
  |  |   91|  4.77k|#define LE32(p) ( \
  |  |   92|  4.77k|    (CAST(uint32_t, (p)->hl[3])<<24)| \
  |  |  ------------------
  |  |  |  |  444|  4.77k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   93|  4.77k|    (CAST(uint32_t, (p)->hl[2])<<16)| \
  |  |  ------------------
  |  |  |  |  444|  4.77k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   94|  4.77k|    (CAST(uint32_t, (p)->hl[1])<<8)| \
  |  |  ------------------
  |  |  |  |  444|  4.77k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   95|  4.77k|    (CAST(uint32_t, (p)->hl[0])))
  |  |  ------------------
  |  |  |  |  444|  4.77k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1277|  4.77k|		if (cvt_float(p, m) == -1)
  ------------------
  |  Branch (1277:7): [True: 0, False: 4.77k]
  ------------------
 1278|      0|			goto out;
 1279|  4.77k|		return 1;
 1280|      0|	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (1280:2): [True: 0, False: 73.9M]
  ------------------
 1281|      0|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1281:7): [True: 0, False: 0]
  ------------------
 1282|      0|			goto out;
 1283|      0|		return 1;
 1284|    157|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|    157|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (1284:2): [True: 157, False: 73.9M]
  ------------------
 1285|    157|		p->q = BE64(p);
  ------------------
  |  |   73|    157|#define BE64(p) ( \
  |  |   74|    157|    (CAST(uint64_t, (p)->hq[0])<<56)| \
  |  |  ------------------
  |  |  |  |  444|    157|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   75|    157|    (CAST(uint64_t, (p)->hq[1])<<48)| \
  |  |  ------------------
  |  |  |  |  444|    157|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   76|    157|    (CAST(uint64_t, (p)->hq[2])<<40)| \
  |  |  ------------------
  |  |  |  |  444|    157|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   77|    157|    (CAST(uint64_t, (p)->hq[3])<<32)| \
  |  |  ------------------
  |  |  |  |  444|    157|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   78|    157|    (CAST(uint64_t, (p)->hq[4])<<24)| \
  |  |  ------------------
  |  |  |  |  444|    157|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   79|    157|    (CAST(uint64_t, (p)->hq[5])<<16)| \
  |  |  ------------------
  |  |  |  |  444|    157|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   80|    157|    (CAST(uint64_t, (p)->hq[6])<<8)| \
  |  |  ------------------
  |  |  |  |  444|    157|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   81|    157|    (CAST(uint64_t, (p)->hq[7])))
  |  |  ------------------
  |  |  |  |  444|    157|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1286|    157|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1286:7): [True: 0, False: 157]
  ------------------
 1287|      0|			goto out;
 1288|    157|		return 1;
 1289|    372|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|    372|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (1289:2): [True: 372, False: 73.9M]
  ------------------
 1290|    372|		p->q = LE64(p);
  ------------------
  |  |   82|    372|#define LE64(p) ( \
  |  |   83|    372|    (CAST(uint64_t, (p)->hq[7])<<56)| \
  |  |  ------------------
  |  |  |  |  444|    372|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   84|    372|    (CAST(uint64_t, (p)->hq[6])<<48)| \
  |  |  ------------------
  |  |  |  |  444|    372|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   85|    372|    (CAST(uint64_t, (p)->hq[5])<<40)| \
  |  |  ------------------
  |  |  |  |  444|    372|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   86|    372|    (CAST(uint64_t, (p)->hq[4])<<32)| \
  |  |  ------------------
  |  |  |  |  444|    372|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   87|    372|    (CAST(uint64_t, (p)->hq[3])<<24)| \
  |  |  ------------------
  |  |  |  |  444|    372|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   88|    372|    (CAST(uint64_t, (p)->hq[2])<<16)| \
  |  |  ------------------
  |  |  |  |  444|    372|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   89|    372|    (CAST(uint64_t, (p)->hq[1])<<8)| \
  |  |  ------------------
  |  |  |  |  444|    372|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |   90|    372|    (CAST(uint64_t, (p)->hq[0])))
  |  |  ------------------
  |  |  |  |  444|    372|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
 1291|    372|		if (cvt_double(p, m) == -1)
  ------------------
  |  Branch (1291:7): [True: 0, False: 372]
  ------------------
 1292|      0|			goto out;
 1293|    372|		return 1;
 1294|   216k|	case FILE_REGEX:
  ------------------
  |  |  257|   216k|#define				FILE_REGEX		17
  ------------------
  |  Branch (1294:2): [True: 216k, False: 73.6M]
  ------------------
 1295|   698k|	case FILE_SEARCH:
  ------------------
  |  |  260|   698k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (1295:2): [True: 482k, False: 73.4M]
  ------------------
 1296|   704k|	case FILE_DEFAULT:
  ------------------
  |  |  243|   704k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (1296:2): [True: 6.08k, False: 73.9M]
  ------------------
 1297|   704k|	case FILE_CLEAR:
  ------------------
  |  |  287|   704k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (1297:2): [True: 249, False: 73.9M]
  ------------------
 1298|   704k|	case FILE_NAME:
  ------------------
  |  |  285|   704k|#define				FILE_NAME		45
  ------------------
  |  Branch (1298:2): [True: 0, False: 73.9M]
  ------------------
 1299|   704k|	case FILE_USE:
  ------------------
  |  |  286|   704k|#define				FILE_USE		46
  ------------------
  |  Branch (1299:2): [True: 0, False: 73.9M]
  ------------------
 1300|  1.07M|	case FILE_DER:
  ------------------
  |  |  288|  1.07M|#define				FILE_DER		48
  ------------------
  |  Branch (1300:2): [True: 375k, False: 73.5M]
  ------------------
 1301|  1.21M|	case FILE_GUID:
  ------------------
  |  |  289|  1.21M|#define				FILE_GUID		49
  ------------------
  |  Branch (1301:2): [True: 139k, False: 73.7M]
  ------------------
 1302|  1.21M|		return 1;
 1303|      0|	default:
  ------------------
  |  Branch (1303:2): [True: 0, False: 73.9M]
  ------------------
 1304|      0|		file_magerror(ms, "invalid type %d in mconvert()", m->type);
 1305|      0|		return 0;
 1306|  73.9M|	}
 1307|      0|out:
 1308|      0|	file_magerror(ms, "zerodivide in mconvert()");
 1309|      0|	return 0;
 1310|  73.9M|}
softmagic.c:cvt_8:
 1086|  1.17M|{
 1087|  1.17M|	DO_CVT(b, uint8_t);
  ------------------
  |  | 1050|  1.17M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  1.17M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1050:6): [True: 118k, False: 1.05M]
  |  |  ------------------
  |  | 1051|  1.17M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|   118k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1051:11): [True: 0, False: 118k]
  |  |  ------------------
  |  | 1052|  98.7k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  337|  98.7k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 98.7k, False: 20.0k]
  |  |  ------------------
  |  | 1053|  98.7k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|  98.7k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|  98.7k|			break; \
  |  | 1055|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  338|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 118k]
  |  |  ------------------
  |  | 1056|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|      0|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  339|      0|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 0, False: 118k]
  |  |  ------------------
  |  | 1059|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|      0|			break; \
  |  | 1061|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 0, False: 118k]
  |  |  ------------------
  |  | 1062|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|      0|			break; \
  |  | 1064|  19.9k|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|  19.9k|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 19.9k, False: 98.9k]
  |  |  ------------------
  |  | 1065|  19.9k|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|  19.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|  19.9k|			break; \
  |  | 1067|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 0, False: 118k]
  |  |  ------------------
  |  | 1068|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1069|      0|			break; \
  |  | 1070|     92|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|     92|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1070:3): [True: 92, False: 118k]
  |  |  ------------------
  |  | 1071|     92|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|     92|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1071:8): [True: 0, False: 92]
  |  |  ------------------
  |  | 1072|     92|				return -1; \
  |  | 1073|     92|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     92|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1074|     92|			break; \
  |  | 1075|     92|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  344|     72|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1075:3): [True: 72, False: 118k]
  |  |  ------------------
  |  | 1076|     72|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|     72|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1076:8): [True: 0, False: 72]
  |  |  ------------------
  |  | 1077|     72|				return -1; \
  |  | 1078|     72|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     72|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1079|     72|			break; \
  |  | 1080|   118k|		} \
  |  | 1081|  1.17M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  349|  1.17M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1081:6): [True: 0, False: 1.17M]
  |  |  ------------------
  |  | 1082|  1.17M|		p->fld = ~p->fld \
  ------------------
 1088|  1.17M|	return 0;
 1089|  1.17M|}
softmagic.c:cvt_16:
 1093|  7.03M|{
 1094|  7.03M|	DO_CVT(h, uint16_t);
  ------------------
  |  | 1050|  7.03M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  7.03M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1050:6): [True: 514k, False: 6.52M]
  |  |  ------------------
  |  | 1051|  7.03M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|   514k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1051:11): [True: 0, False: 514k]
  |  |  ------------------
  |  | 1052|   490k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  337|   490k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 490k, False: 24.6k]
  |  |  ------------------
  |  | 1053|   490k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|   490k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|   490k|			break; \
  |  | 1055|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  338|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 514k]
  |  |  ------------------
  |  | 1056|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|      0|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  339|      0|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 0, False: 514k]
  |  |  ------------------
  |  | 1059|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|      0|			break; \
  |  | 1061|     62|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|     62|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 62, False: 514k]
  |  |  ------------------
  |  | 1062|     62|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     62|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|     62|			break; \
  |  | 1064|    147|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|    147|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 147, False: 514k]
  |  |  ------------------
  |  | 1065|    147|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    147|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|    147|			break; \
  |  | 1067|     71|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|     71|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 71, False: 514k]
  |  |  ------------------
  |  | 1068|     71|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     71|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1069|     71|			break; \
  |  | 1070|    294|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|    294|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1070:3): [True: 294, False: 514k]
  |  |  ------------------
  |  | 1071|    294|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|    294|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1071:8): [True: 0, False: 294]
  |  |  ------------------
  |  | 1072|    294|				return -1; \
  |  | 1073|    294|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    294|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1074|    294|			break; \
  |  | 1075|  24.0k|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  344|  24.0k|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1075:3): [True: 24.0k, False: 490k]
  |  |  ------------------
  |  | 1076|  24.0k|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|  24.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1076:8): [True: 0, False: 24.0k]
  |  |  ------------------
  |  | 1077|  24.0k|				return -1; \
  |  | 1078|  24.0k|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|  24.0k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1079|  24.0k|			break; \
  |  | 1080|   514k|		} \
  |  | 1081|  7.03M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  349|  7.03M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1081:6): [True: 0, False: 7.03M]
  |  |  ------------------
  |  | 1082|  7.03M|		p->fld = ~p->fld \
  ------------------
 1095|  7.03M|	return 0;
 1096|  7.03M|}
softmagic.c:cvt_32:
 1100|  16.5M|{
 1101|  16.5M|	DO_CVT(l, uint32_t);
  ------------------
  |  | 1050|  16.5M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  16.5M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1050:6): [True: 3.08M, False: 13.4M]
  |  |  ------------------
  |  | 1051|  16.5M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|  3.08M|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1051:11): [True: 0, False: 3.08M]
  |  |  ------------------
  |  | 1052|  3.08M|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  337|  3.08M|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 3.08M, False: 1.17k]
  |  |  ------------------
  |  | 1053|  3.08M|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|  3.08M|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|  3.08M|			break; \
  |  | 1055|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  338|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 3.08M]
  |  |  ------------------
  |  | 1056|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|     68|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  339|     68|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 68, False: 3.08M]
  |  |  ------------------
  |  | 1059|     68|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     68|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|     68|			break; \
  |  | 1061|    135|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|    135|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 135, False: 3.08M]
  |  |  ------------------
  |  | 1062|    135|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    135|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|    135|			break; \
  |  | 1064|     77|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|     77|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 77, False: 3.08M]
  |  |  ------------------
  |  | 1065|     77|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     77|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|     77|			break; \
  |  | 1067|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 0, False: 3.08M]
  |  |  ------------------
  |  | 1068|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1069|      0|			break; \
  |  | 1070|    577|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|    577|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1070:3): [True: 577, False: 3.08M]
  |  |  ------------------
  |  | 1071|    577|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|    577|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1071:8): [True: 0, False: 577]
  |  |  ------------------
  |  | 1072|    577|				return -1; \
  |  | 1073|    577|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    577|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1074|    577|			break; \
  |  | 1075|    577|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  344|    319|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1075:3): [True: 319, False: 3.08M]
  |  |  ------------------
  |  | 1076|    319|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|    319|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1076:8): [True: 0, False: 319]
  |  |  ------------------
  |  | 1077|    319|				return -1; \
  |  | 1078|    319|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|    319|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1079|    319|			break; \
  |  | 1080|  3.08M|		} \
  |  | 1081|  16.5M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  349|  16.5M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1081:6): [True: 0, False: 16.5M]
  |  |  ------------------
  |  | 1082|  16.5M|		p->fld = ~p->fld \
  ------------------
 1102|  16.5M|	return 0;
 1103|  16.5M|}
softmagic.c:cvt_64:
 1107|  1.50M|{
 1108|  1.50M|	DO_CVT(q, uint64_t);
  ------------------
  |  | 1050|  1.50M|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  1.50M|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1050:6): [True: 166k, False: 1.33M]
  |  |  ------------------
  |  | 1051|  1.50M|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|   166k|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1051:11): [True: 0, False: 166k]
  |  |  ------------------
  |  | 1052|   166k|		case FILE_OPAND: \
  |  |  ------------------
  |  |  |  |  337|   166k|#define				FILE_OPAND	0
  |  |  ------------------
  |  |  |  Branch (1052:3): [True: 166k, False: 114]
  |  |  ------------------
  |  | 1053|   166k|			p->fld &= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|   166k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1054|   166k|			break; \
  |  | 1055|      0|		case FILE_OPOR: \
  |  |  ------------------
  |  |  |  |  338|      0|#define				FILE_OPOR	1
  |  |  ------------------
  |  |  |  Branch (1055:3): [True: 0, False: 166k]
  |  |  ------------------
  |  | 1056|      0|			p->fld |= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1057|      0|			break; \
  |  | 1058|      0|		case FILE_OPXOR: \
  |  |  ------------------
  |  |  |  |  339|      0|#define				FILE_OPXOR	2
  |  |  ------------------
  |  |  |  Branch (1058:3): [True: 0, False: 166k]
  |  |  ------------------
  |  | 1059|      0|			p->fld ^= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1060|      0|			break; \
  |  | 1061|     34|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|     34|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1061:3): [True: 34, False: 166k]
  |  |  ------------------
  |  | 1062|     34|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     34|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1063|     34|			break; \
  |  | 1064|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1064:3): [True: 0, False: 166k]
  |  |  ------------------
  |  | 1065|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1066|      0|			break; \
  |  | 1067|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1067:3): [True: 0, False: 166k]
  |  |  ------------------
  |  | 1068|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1069|      0|			break; \
  |  | 1070|     80|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|     80|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1070:3): [True: 80, False: 166k]
  |  |  ------------------
  |  | 1071|     80|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|     80|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1071:8): [True: 0, False: 80]
  |  |  ------------------
  |  | 1072|     80|				return -1; \
  |  | 1073|     80|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|     80|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1074|     80|			break; \
  |  | 1075|     80|		case FILE_OPMODULO: \
  |  |  ------------------
  |  |  |  |  344|      0|#define				FILE_OPMODULO	7
  |  |  ------------------
  |  |  |  Branch (1075:3): [True: 0, False: 166k]
  |  |  ------------------
  |  | 1076|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1076:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1077|      0|				return -1; \
  |  | 1078|      0|			p->fld %= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1079|      0|			break; \
  |  | 1080|   166k|		} \
  |  | 1081|  1.50M|	if (m->mask_op & FILE_OPINVERSE) \
  |  |  ------------------
  |  |  |  |  349|  1.50M|#define				FILE_OPINVERSE	0x40
  |  |  ------------------
  |  |  |  Branch (1081:6): [True: 0, False: 1.50M]
  |  |  ------------------
  |  | 1082|  1.50M|		p->fld = ~p->fld \
  ------------------
 1109|  1.50M|	return 0;
 1110|  1.50M|}
softmagic.c:cvt_float:
 1133|  4.77k|{
 1134|  4.77k|	DO_CVT2(f, float);
  ------------------
  |  | 1113|  4.77k|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|  4.77k|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1113:6): [True: 0, False: 4.77k]
  |  |  ------------------
  |  | 1114|  4.77k|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|      0|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1114:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1115|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1115:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1116|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1117|      0|			break; \
  |  | 1118|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1118:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1119|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1120|      0|			break; \
  |  | 1121|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1121:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1122|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1123|      0|			break; \
  |  | 1124|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1124:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1125|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1125:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1126|      0|				return -1; \
  |  | 1127|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1128|      0|			break; \
  |  | 1129|      0|		} \
  ------------------
 1135|  4.77k|	return 0;
 1136|  4.77k|}
softmagic.c:cvt_double:
 1140|    529|{
 1141|    529|	DO_CVT2(d, double);
  ------------------
  |  | 1113|    529|	if (m->num_mask) \
  |  |  ------------------
  |  |  |  |  373|    529|#define num_mask _u._mask
  |  |  ------------------
  |  |  |  Branch (1113:6): [True: 0, False: 529]
  |  |  ------------------
  |  | 1114|    529|		switch (m->mask_op & FILE_OPS_MASK) { \
  |  |  ------------------
  |  |  |  |  345|      0|#define				FILE_OPS_MASK	0x07 /* mask for above ops */
  |  |  ------------------
  |  |  |  Branch (1114:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1115|      0|		case FILE_OPADD: \
  |  |  ------------------
  |  |  |  |  340|      0|#define				FILE_OPADD	3
  |  |  ------------------
  |  |  |  Branch (1115:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1116|      0|			p->fld += CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1117|      0|			break; \
  |  | 1118|      0|		case FILE_OPMINUS: \
  |  |  ------------------
  |  |  |  |  341|      0|#define				FILE_OPMINUS	4
  |  |  ------------------
  |  |  |  Branch (1118:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1119|      0|			p->fld -= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1120|      0|			break; \
  |  | 1121|      0|		case FILE_OPMULTIPLY: \
  |  |  ------------------
  |  |  |  |  342|      0|#define				FILE_OPMULTIPLY	5
  |  |  ------------------
  |  |  |  Branch (1121:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1122|      0|			p->fld *= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1123|      0|			break; \
  |  | 1124|      0|		case FILE_OPDIVIDE: \
  |  |  ------------------
  |  |  |  |  343|      0|#define				FILE_OPDIVIDE	6
  |  |  ------------------
  |  |  |  Branch (1124:3): [True: 0, False: 0]
  |  |  ------------------
  |  | 1125|      0|			if (CAST(type, m->num_mask) == 0) \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  |  Branch (1125:8): [True: 0, False: 0]
  |  |  ------------------
  |  | 1126|      0|				return -1; \
  |  | 1127|      0|			p->fld /= CAST(type, m->num_mask); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  | 1128|      0|			break; \
  |  | 1129|      0|		} \
  ------------------
 1142|    529|	return 0;
 1143|    529|}
softmagic.c:magiccheck:
 2097|  74.0M|{
 2098|  74.0M|	uint64_t l = m->value.q;
 2099|  74.0M|	uint64_t v;
 2100|  74.0M|	float fl, fv;
 2101|  74.0M|	double dl, dv;
 2102|  74.0M|	int matched;
 2103|  74.0M|	union VALUETYPE *p = &ms->ms_value;
 2104|       |
 2105|  74.0M|	switch (m->type) {
 2106|  1.17M|	case FILE_BYTE:
  ------------------
  |  |  241|  1.17M|#define 			FILE_BYTE		1
  ------------------
  |  Branch (2106:2): [True: 1.17M, False: 72.8M]
  ------------------
 2107|  1.17M|		v = p->b;
 2108|  1.17M|		break;
 2109|       |
 2110|   874k|	case FILE_SHORT:
  ------------------
  |  |  242|   874k|#define				FILE_SHORT		2
  ------------------
  |  Branch (2110:2): [True: 874k, False: 73.1M]
  ------------------
 2111|  4.58M|	case FILE_BESHORT:
  ------------------
  |  |  247|  4.58M|#define				FILE_BESHORT		7
  ------------------
  |  Branch (2111:2): [True: 3.70M, False: 70.3M]
  ------------------
 2112|  7.03M|	case FILE_LESHORT:
  ------------------
  |  |  250|  7.03M|#define				FILE_LESHORT		10
  ------------------
  |  Branch (2112:2): [True: 2.45M, False: 71.5M]
  ------------------
 2113|  7.03M|	case FILE_MSDOSDATE:
  ------------------
  |  |  293|  7.03M|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (2113:2): [True: 0, False: 74.0M]
  ------------------
 2114|  7.03M|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|  7.03M|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (2114:2): [True: 67, False: 74.0M]
  ------------------
 2115|  7.03M|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|  7.03M|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (2115:2): [True: 0, False: 74.0M]
  ------------------
 2116|  7.03M|	case FILE_MSDOSTIME:
  ------------------
  |  |  296|  7.03M|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (2116:2): [True: 0, False: 74.0M]
  ------------------
 2117|  7.03M|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|  7.03M|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (2117:2): [True: 67, False: 74.0M]
  ------------------
 2118|  7.03M|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|  7.03M|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (2118:2): [True: 0, False: 74.0M]
  ------------------
 2119|  7.03M|		v = p->h;
 2120|  7.03M|		break;
 2121|       |
 2122|  1.27M|	case FILE_LONG:
  ------------------
  |  |  244|  1.27M|#define				FILE_LONG		4
  ------------------
  |  Branch (2122:2): [True: 1.27M, False: 72.7M]
  ------------------
 2123|  11.7M|	case FILE_BELONG:
  ------------------
  |  |  248|  11.7M|#define				FILE_BELONG		8
  ------------------
  |  Branch (2123:2): [True: 10.4M, False: 63.5M]
  ------------------
 2124|  16.5M|	case FILE_LELONG:
  ------------------
  |  |  251|  16.5M|#define				FILE_LELONG		11
  ------------------
  |  Branch (2124:2): [True: 4.73M, False: 69.2M]
  ------------------
 2125|  16.5M|	case FILE_MELONG:
  ------------------
  |  |  263|  16.5M|#define				FILE_MELONG		23
  ------------------
  |  Branch (2125:2): [True: 34, False: 74.0M]
  ------------------
 2126|  16.5M|	case FILE_DATE:
  ------------------
  |  |  246|  16.5M|#define				FILE_DATE		6
  ------------------
  |  Branch (2126:2): [True: 0, False: 74.0M]
  ------------------
 2127|  16.5M|	case FILE_BEDATE:
  ------------------
  |  |  249|  16.5M|#define				FILE_BEDATE		9
  ------------------
  |  Branch (2127:2): [True: 155, False: 74.0M]
  ------------------
 2128|  16.5M|	case FILE_LEDATE:
  ------------------
  |  |  252|  16.5M|#define				FILE_LEDATE		12
  ------------------
  |  Branch (2128:2): [True: 149, False: 74.0M]
  ------------------
 2129|  16.5M|	case FILE_MEDATE:
  ------------------
  |  |  261|  16.5M|#define				FILE_MEDATE		21
  ------------------
  |  Branch (2129:2): [True: 96, False: 74.0M]
  ------------------
 2130|  16.5M|	case FILE_LDATE:
  ------------------
  |  |  254|  16.5M|#define				FILE_LDATE		14
  ------------------
  |  Branch (2130:2): [True: 0, False: 74.0M]
  ------------------
 2131|  16.5M|	case FILE_BELDATE:
  ------------------
  |  |  255|  16.5M|#define				FILE_BELDATE		15
  ------------------
  |  Branch (2131:2): [True: 144, False: 74.0M]
  ------------------
 2132|  16.5M|	case FILE_LELDATE:
  ------------------
  |  |  256|  16.5M|#define				FILE_LELDATE		16
  ------------------
  |  Branch (2132:2): [True: 34, False: 74.0M]
  ------------------
 2133|  16.5M|	case FILE_MELDATE:
  ------------------
  |  |  262|  16.5M|#define				FILE_MELDATE		22
  ------------------
  |  Branch (2133:2): [True: 0, False: 74.0M]
  ------------------
 2134|  16.5M|		v = p->l;
 2135|  16.5M|		break;
 2136|       |
 2137|  57.0k|	case FILE_QUAD:
  ------------------
  |  |  264|  57.0k|#define				FILE_QUAD		24
  ------------------
  |  Branch (2137:2): [True: 57.0k, False: 73.9M]
  ------------------
 2138|   723k|	case FILE_LEQUAD:
  ------------------
  |  |  265|   723k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (2138:2): [True: 666k, False: 73.3M]
  ------------------
 2139|  1.50M|	case FILE_BEQUAD:
  ------------------
  |  |  266|  1.50M|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (2139:2): [True: 779k, False: 73.2M]
  ------------------
 2140|  1.50M|	case FILE_QDATE:
  ------------------
  |  |  267|  1.50M|#define				FILE_QDATE		27
  ------------------
  |  Branch (2140:2): [True: 0, False: 74.0M]
  ------------------
 2141|  1.50M|	case FILE_BEQDATE:
  ------------------
  |  |  269|  1.50M|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (2141:2): [True: 142, False: 74.0M]
  ------------------
 2142|  1.50M|	case FILE_LEQDATE:
  ------------------
  |  |  268|  1.50M|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (2142:2): [True: 89, False: 74.0M]
  ------------------
 2143|  1.50M|	case FILE_QLDATE:
  ------------------
  |  |  270|  1.50M|#define				FILE_QLDATE		30
  ------------------
  |  Branch (2143:2): [True: 0, False: 74.0M]
  ------------------
 2144|  1.50M|	case FILE_BEQLDATE:
  ------------------
  |  |  272|  1.50M|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (2144:2): [True: 0, False: 74.0M]
  ------------------
 2145|  1.50M|	case FILE_LEQLDATE:
  ------------------
  |  |  271|  1.50M|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (2145:2): [True: 20, False: 74.0M]
  ------------------
 2146|  1.50M|	case FILE_QWDATE:
  ------------------
  |  |  282|  1.50M|#define				FILE_QWDATE		42
  ------------------
  |  Branch (2146:2): [True: 240, False: 74.0M]
  ------------------
 2147|  1.50M|	case FILE_BEQWDATE:
  ------------------
  |  |  284|  1.50M|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (2147:2): [True: 0, False: 74.0M]
  ------------------
 2148|  1.50M|	case FILE_LEQWDATE:
  ------------------
  |  |  283|  1.50M|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (2148:2): [True: 1.12k, False: 74.0M]
  ------------------
 2149|  1.50M|	case FILE_OFFSET:
  ------------------
  |  |  290|  1.50M|#define				FILE_OFFSET		50
  ------------------
  |  Branch (2149:2): [True: 0, False: 74.0M]
  ------------------
 2150|  1.50M|		v = p->q;
 2151|  1.50M|		break;
 2152|       |
 2153|      0|	case FILE_FLOAT:
  ------------------
  |  |  273|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (2153:2): [True: 0, False: 74.0M]
  ------------------
 2154|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (2154:2): [True: 0, False: 74.0M]
  ------------------
 2155|  4.77k|	case FILE_LEFLOAT:
  ------------------
  |  |  275|  4.77k|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (2155:2): [True: 4.77k, False: 74.0M]
  ------------------
 2156|  4.77k|		fl = m->value.f;
 2157|  4.77k|		fv = p->f;
 2158|  4.77k|		switch (m->reln) {
 2159|    230|		case 'x':
  ------------------
  |  Branch (2159:3): [True: 230, False: 4.54k]
  ------------------
 2160|    230|			matched = 1;
 2161|    230|			break;
 2162|       |
 2163|      0|		case '!':
  ------------------
  |  Branch (2163:3): [True: 0, False: 4.77k]
  ------------------
 2164|      0|			matched = isunordered(fl, fv) ? 1 : fv != fl;
 2165|      0|			break;
 2166|       |
 2167|      0|		case '=':
  ------------------
  |  Branch (2167:3): [True: 0, False: 4.77k]
  ------------------
 2168|      0|			matched = isunordered(fl, fv) ? 0 : fv == fl;
 2169|      0|			break;
 2170|       |
 2171|  4.54k|		case '>':
  ------------------
  |  Branch (2171:3): [True: 4.54k, False: 230]
  ------------------
 2172|  4.54k|			matched = isgreater(fv, fl);
 2173|  4.54k|			break;
 2174|       |
 2175|      0|		case '<':
  ------------------
  |  Branch (2175:3): [True: 0, False: 4.77k]
  ------------------
 2176|      0|			matched = isless(fv, fl);
 2177|      0|			break;
 2178|       |
 2179|      0|		default:
  ------------------
  |  Branch (2179:3): [True: 0, False: 4.77k]
  ------------------
 2180|      0|			file_magerror(ms, "cannot happen with float: "
 2181|      0|			    "invalid relation `%c'", m->reln);
 2182|      0|			return -1;
 2183|  4.77k|		}
 2184|  4.77k|		return matched;
 2185|       |
 2186|      0|	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (2186:2): [True: 0, False: 74.0M]
  ------------------
 2187|    157|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|    157|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (2187:2): [True: 157, False: 74.0M]
  ------------------
 2188|    529|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|    529|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (2188:2): [True: 372, False: 74.0M]
  ------------------
 2189|    529|		dl = m->value.d;
 2190|    529|		dv = p->d;
 2191|    529|		switch (m->reln) {
 2192|    286|		case 'x':
  ------------------
  |  Branch (2192:3): [True: 286, False: 243]
  ------------------
 2193|    286|			matched = 1;
 2194|    286|			break;
 2195|       |
 2196|      0|		case '!':
  ------------------
  |  Branch (2196:3): [True: 0, False: 529]
  ------------------
 2197|      0|			matched = isunordered(dv, dl) ? 1 : dv != dl;
 2198|      0|			break;
 2199|       |
 2200|    243|		case '=':
  ------------------
  |  Branch (2200:3): [True: 243, False: 286]
  ------------------
 2201|    243|			matched = isunordered(dv, dl) ? 0 : dv == dl;
 2202|    243|			break;
 2203|       |
 2204|      0|		case '>':
  ------------------
  |  Branch (2204:3): [True: 0, False: 529]
  ------------------
 2205|      0|			matched = isgreater(dv, dl);
 2206|      0|			break;
 2207|       |
 2208|      0|		case '<':
  ------------------
  |  Branch (2208:3): [True: 0, False: 529]
  ------------------
 2209|      0|			matched = isless(dv, dl);
 2210|      0|			break;
 2211|       |
 2212|      0|		default:
  ------------------
  |  Branch (2212:3): [True: 0, False: 529]
  ------------------
 2213|      0|			file_magerror(ms, "cannot happen with double: "
 2214|      0|			    "invalid relation `%c'", m->reln);
 2215|      0|			return -1;
 2216|    529|		}
 2217|    529|		return matched;
 2218|       |
 2219|  6.08k|	case FILE_DEFAULT:
  ------------------
  |  |  243|  6.08k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (2219:2): [True: 6.08k, False: 74.0M]
  ------------------
 2220|  6.32k|	case FILE_CLEAR:
  ------------------
  |  |  287|  6.32k|#define				FILE_CLEAR		47
  ------------------
  |  Branch (2220:2): [True: 249, False: 74.0M]
  ------------------
 2221|  6.32k|		l = 0;
 2222|  6.32k|		v = 0;
 2223|  6.32k|		break;
 2224|       |
 2225|  46.3M|	case FILE_STRING:
  ------------------
  |  |  245|  46.3M|#define				FILE_STRING		5
  ------------------
  |  Branch (2225:2): [True: 46.3M, False: 27.6M]
  ------------------
 2226|  46.4M|	case FILE_PSTRING:
  ------------------
  |  |  253|  46.4M|#define				FILE_PSTRING		13
  ------------------
  |  Branch (2226:2): [True: 19.8k, False: 74.0M]
  ------------------
 2227|  46.4M|	case FILE_OCTAL:
  ------------------
  |  |  299|  46.4M|#define				FILE_OCTAL		59
  ------------------
  |  Branch (2227:2): [True: 0, False: 74.0M]
  ------------------
 2228|  46.4M|		l = 0;
 2229|  46.4M|		v = file_strncmp(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  444|  46.4M|#define CAST(T, b)	((T)(b))
  ------------------
 2230|  46.4M|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  375|  46.4M|#define str_flags _u._s._flags
  ------------------
 2231|  46.4M|		break;
 2232|       |
 2233|    147|	case FILE_BESTRING16:
  ------------------
  |  |  258|    147|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (2233:2): [True: 147, False: 74.0M]
  ------------------
 2234|  55.9k|	case FILE_LESTRING16:
  ------------------
  |  |  259|  55.9k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (2234:2): [True: 55.8k, False: 73.9M]
  ------------------
 2235|  55.9k|		l = 0;
 2236|  55.9k|		v = file_strncmp16(m->value.s, p->s, CAST(size_t, m->vallen),
  ------------------
  |  |  444|  55.9k|#define CAST(T, b)	((T)(b))
  ------------------
 2237|  55.9k|		    sizeof(p->s), m->str_flags);
  ------------------
  |  |  375|  55.9k|#define str_flags _u._s._flags
  ------------------
 2238|  55.9k|		break;
 2239|       |
 2240|   482k|	case FILE_SEARCH: { /* search ms->search.s for the string m->value.s */
  ------------------
  |  |  260|   482k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (2240:2): [True: 482k, False: 73.5M]
  ------------------
 2241|   482k|		size_t slen;
 2242|   482k|		size_t idx;
 2243|       |
 2244|   482k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2244:7): [True: 0, False: 482k]
  ------------------
 2245|      0|			return 0;
 2246|       |
 2247|   482k|		slen = MIN(m->vallen, sizeof(m->value.s));
 2248|   482k|		l = 0;
 2249|   482k|		v = 0;
 2250|   482k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   482k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2250:7): [True: 0, False: 482k]
  ------------------
 2251|      0|			size_t xlen = ms->search.s_len > 100 ? 100
  ------------------
  |  Branch (2251:18): [True: 0, False: 0]
  ------------------
 2252|      0|			    : ms->search.s_len;
 2253|       |
 2254|      0|			fprintf(stderr, "search: [");
 2255|      0|			file_showstr(stderr, ms->search.s, xlen);
 2256|      0|			fprintf(stderr, "%s] for [", ms->search.s_len == xlen
  ------------------
  |  Branch (2256:33): [True: 0, False: 0]
  ------------------
 2257|      0|			    ? "" : "...");
 2258|      0|			file_showstr(stderr, m->value.s, slen);
 2259|      0|		}
 2260|   482k|#ifdef HAVE_MEMMEM
 2261|   482k|		if (slen > 0 && m->str_flags == 0) {
  ------------------
  |  |  375|   482k|#define str_flags _u._s._flags
  ------------------
  |  Branch (2261:7): [True: 482k, False: 0]
  |  Branch (2261:19): [True: 279k, False: 203k]
  ------------------
 2262|   279k|			const char *found;
 2263|   279k|			idx = m->str_range + slen;
  ------------------
  |  |  374|   279k|#define str_range _u._s._count
  ------------------
 2264|   279k|			if (m->str_range == 0 || ms->search.s_len < idx)
  ------------------
  |  |  374|   279k|#define str_range _u._s._count
  ------------------
  |  Branch (2264:8): [True: 4.09k, False: 275k]
  |  Branch (2264:29): [True: 103k, False: 171k]
  ------------------
 2265|   107k|				idx = ms->search.s_len;
 2266|   279k|			found = CAST(const char *, memmem(ms->search.s, idx,
  ------------------
  |  |  444|   279k|#define CAST(T, b)	((T)(b))
  ------------------
 2267|   279k|			    m->value.s, slen));
 2268|   279k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   279k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2268:8): [True: 0, False: 279k]
  ------------------
 2269|      0|				fprintf(stderr, "] %sfound\n",
 2270|      0|				    found ? "" : "not ");
  ------------------
  |  Branch (2270:9): [True: 0, False: 0]
  ------------------
 2271|      0|			}
 2272|   279k|			if (!found) {
  ------------------
  |  Branch (2272:8): [True: 276k, False: 2.36k]
  ------------------
 2273|   276k|				v = 1;
 2274|   276k|				break;
 2275|   276k|			}
 2276|  2.36k|			idx = found - ms->search.s;
 2277|  2.36k|			ms->search.offset += idx;
 2278|  2.36k|			ms->search.rm_len = ms->search.s_len - idx;
 2279|  2.36k|			break;
 2280|   279k|		}
 2281|   203k|#endif
 2282|       |
 2283|   552M|		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  374|   552M|#define str_range _u._s._count
  ------------------
              		for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
  ------------------
  |  |  374|   552M|#define str_range _u._s._count
  ------------------
  |  Branch (2283:17): [True: 0, False: 552M]
  |  Branch (2283:38): [True: 552M, False: 100k]
  ------------------
 2284|   552M|			if (slen + idx > ms->search.s_len) {
  ------------------
  |  Branch (2284:8): [True: 102k, False: 552M]
  ------------------
 2285|   102k|				v = 1;
 2286|   102k|				break;
 2287|   102k|			}
 2288|       |
 2289|   552M|			v = file_strncmp(m->value.s, ms->search.s + idx, slen,
 2290|   552M|			    ms->search.s_len - idx, m->str_flags);
  ------------------
  |  |  375|   552M|#define str_flags _u._s._flags
  ------------------
 2291|   552M|			if (v == 0) {	/* found match */
  ------------------
  |  Branch (2291:8): [True: 142, False: 552M]
  ------------------
 2292|    142|				ms->search.offset += idx;
 2293|    142|				ms->search.rm_len = ms->search.s_len - idx;
 2294|    142|				break;
 2295|    142|			}
 2296|   552M|		}
 2297|   203k|		if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   203k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2297:7): [True: 0, False: 203k]
  ------------------
 2298|      0|			fprintf(stderr, "] %sfound\n", v == 0 ? "" : "not ");
  ------------------
  |  Branch (2298:35): [True: 0, False: 0]
  ------------------
 2299|      0|		}
 2300|   203k|		break;
 2301|   482k|	}
 2302|   216k|	case FILE_REGEX: {
  ------------------
  |  |  257|   216k|#define				FILE_REGEX		17
  ------------------
  |  Branch (2302:2): [True: 216k, False: 73.8M]
  ------------------
 2303|   216k|		int rc;
 2304|   216k|		file_regex_t *rx = *m_cache;
 2305|   216k|		const char *search;
 2306|   216k|		regmatch_t pmatch;
 2307|   216k|		size_t slen = ms->search.s_len;
 2308|   216k|		char *copy;
 2309|       |
 2310|   216k|		if (ms->search.s == NULL)
  ------------------
  |  Branch (2310:7): [True: 66, False: 215k]
  ------------------
 2311|     66|			return 0;
 2312|       |
 2313|   215k|		if (rx == NULL) {
  ------------------
  |  Branch (2313:7): [True: 157, False: 215k]
  ------------------
 2314|    157|			rx = *m_cache = alloc_regex(ms, m);
 2315|    157|			if (rx == NULL)
  ------------------
  |  Branch (2315:8): [True: 0, False: 157]
  ------------------
 2316|      0|				return -1;
 2317|    157|		}
 2318|   215k|		l = 0;
 2319|   215k|		if (slen != 0) {
  ------------------
  |  Branch (2319:7): [True: 213k, False: 2.29k]
  ------------------
 2320|   213k|		    copy = CAST(char *, malloc(slen));
  ------------------
  |  |  444|   213k|#define CAST(T, b)	((T)(b))
  ------------------
 2321|   213k|		    if (copy == NULL)  {
  ------------------
  |  Branch (2321:11): [True: 0, False: 213k]
  ------------------
 2322|      0|			file_error(ms, errno,
 2323|      0|			    "can't allocate %" SIZE_T_FORMAT "u bytes",
 2324|      0|			    slen);
 2325|      0|			return -1;
 2326|      0|		    }
 2327|   213k|		    memcpy(copy, ms->search.s, slen);
 2328|   213k|		    copy[--slen] = '\0';
 2329|   213k|		    search = copy;
 2330|   213k|		} else {
 2331|  2.29k|		    search = CCAST(char *, "");
  ------------------
  |  |  446|  2.29k|#define CCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2332|  2.29k|		    copy = NULL;
 2333|  2.29k|		}
 2334|   215k|		rc = file_regexec(ms, rx, RCAST(const char *, search),
  ------------------
  |  |  445|   215k|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 2335|   215k|		    1, &pmatch, 0);
 2336|   215k|		free(copy);
 2337|   215k|		switch (rc) {
 2338|  3.09k|		case 0:
  ------------------
  |  Branch (2338:3): [True: 3.09k, False: 212k]
  ------------------
 2339|  3.09k|			ms->search.s += CAST(int, pmatch.rm_so);
  ------------------
  |  |  444|  3.09k|#define CAST(T, b)	((T)(b))
  ------------------
 2340|  3.09k|			ms->search.offset += CAST(size_t, pmatch.rm_so);
  ------------------
  |  |  444|  3.09k|#define CAST(T, b)	((T)(b))
  ------------------
 2341|  3.09k|			ms->search.rm_len = CAST(size_t,
  ------------------
  |  |  444|  3.09k|#define CAST(T, b)	((T)(b))
  ------------------
 2342|  3.09k|			    pmatch.rm_eo - pmatch.rm_so);
 2343|  3.09k|			v = 0;
 2344|  3.09k|			break;
 2345|       |
 2346|   212k|		case REG_NOMATCH:
  ------------------
  |  Branch (2346:3): [True: 212k, False: 3.09k]
  ------------------
 2347|   212k|			v = 1;
 2348|   212k|			break;
 2349|       |
 2350|      0|		default:
  ------------------
  |  Branch (2350:3): [True: 0, False: 215k]
  ------------------
 2351|      0|			return -1;
 2352|   215k|		}
 2353|   215k|		break;
 2354|   215k|	}
 2355|   215k|	case FILE_USE:
  ------------------
  |  |  286|  49.4k|#define				FILE_USE		46
  ------------------
  |  Branch (2355:2): [True: 49.4k, False: 73.9M]
  ------------------
 2356|  49.4k|		return ms->ms_value.q != 0;
 2357|  53.5k|	case FILE_NAME:
  ------------------
  |  |  285|  53.5k|#define				FILE_NAME		45
  ------------------
  |  Branch (2357:2): [True: 53.5k, False: 73.9M]
  ------------------
 2358|  66.6k|	case FILE_INDIRECT:
  ------------------
  |  |  281|  66.6k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (2358:2): [True: 13.0k, False: 74.0M]
  ------------------
 2359|  66.6k|		return 1;
 2360|   375k|	case FILE_DER:
  ------------------
  |  |  288|   375k|#define				FILE_DER		48
  ------------------
  |  Branch (2360:2): [True: 375k, False: 73.6M]
  ------------------
 2361|   375k|		matched = der_cmp(ms, m);
 2362|   375k|		if (matched == -1) {
  ------------------
  |  Branch (2362:7): [True: 138k, False: 236k]
  ------------------
 2363|   138k|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|   138k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2363:8): [True: 0, False: 138k]
  ------------------
 2364|      0|				(void) fprintf(stderr,
 2365|      0|				    "EOF comparing DER entries\n");
 2366|      0|			}
 2367|   138k|			return 0;
 2368|   138k|		}
 2369|   236k|		return matched;
 2370|   139k|	case FILE_GUID:
  ------------------
  |  |  289|   139k|#define				FILE_GUID		49
  ------------------
  |  Branch (2370:2): [True: 139k, False: 73.8M]
  ------------------
 2371|   139k|		l = 0;
 2372|   139k|		v = memcmp(m->value.guid, p->guid, sizeof(p->guid));
 2373|   139k|		break;
 2374|      0|	default:
  ------------------
  |  Branch (2374:2): [True: 0, False: 74.0M]
  ------------------
 2375|      0|		file_magerror(ms, "invalid type %d in magiccheck()", m->type);
 2376|      0|		return -1;
 2377|  74.0M|	}
 2378|       |
 2379|  73.5M|	v = file_signextend(ms, m, v);
 2380|       |
 2381|  73.5M|	switch (m->reln) {
 2382|  75.1k|	case 'x':
  ------------------
  |  Branch (2382:2): [True: 75.1k, False: 73.4M]
  ------------------
 2383|  75.1k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  75.1k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2383:7): [True: 0, False: 75.1k]
  ------------------
 2384|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT
 2385|      0|			    "u == *any* = 1", CAST(unsigned long long, v));
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2386|  75.1k|		matched = 1;
 2387|  75.1k|		break;
 2388|       |
 2389|  46.2k|	case '!':
  ------------------
  |  Branch (2389:2): [True: 46.2k, False: 73.4M]
  ------------------
 2390|  46.2k|		matched = v != l;
 2391|  46.2k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  46.2k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2391:7): [True: 0, False: 46.2k]
  ------------------
 2392|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT "u != %"
 2393|      0|			    INT64_T_FORMAT "u = %d",
 2394|      0|			    CAST(unsigned long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2395|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2396|  46.2k|		break;
 2397|       |
 2398|  72.9M|	case '=':
  ------------------
  |  Branch (2398:2): [True: 72.9M, False: 615k]
  ------------------
 2399|  72.9M|		matched = v == l;
 2400|  72.9M|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  72.9M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2400:7): [True: 0, False: 72.9M]
  ------------------
 2401|      0|			(void) fprintf(stderr, "%" INT64_T_FORMAT "u == %"
 2402|      0|			    INT64_T_FORMAT "u = %d",
 2403|      0|			    CAST(unsigned long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2404|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2405|  72.9M|		break;
 2406|       |
 2407|   189k|	case '>':
  ------------------
  |  Branch (2407:2): [True: 189k, False: 73.3M]
  ------------------
 2408|   189k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  226|   189k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2408:7): [True: 153k, False: 36.5k]
  ------------------
 2409|   153k|			matched = v > l;
 2410|   153k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   153k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2410:8): [True: 0, False: 153k]
  ------------------
 2411|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2412|      0|				    "u > %" INT64_T_FORMAT "u = %d",
 2413|      0|				    CAST(unsigned long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2414|      0|				    CAST(unsigned long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2415|   153k|		}
 2416|  36.5k|		else {
 2417|  36.5k|			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  444|  36.5k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) > CAST(int64_t, l);
  ------------------
  |  |  444|  36.5k|#define CAST(T, b)	((T)(b))
  ------------------
 2418|  36.5k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  36.5k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2418:8): [True: 0, False: 36.5k]
  ------------------
 2419|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2420|      0|				    "d > %" INT64_T_FORMAT "d = %d",
 2421|      0|				    CAST(long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2422|      0|				    CAST(long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2423|  36.5k|		}
 2424|   189k|		break;
 2425|       |
 2426|   277k|	case '<':
  ------------------
  |  Branch (2426:2): [True: 277k, False: 73.2M]
  ------------------
 2427|   277k|		if (m->flag & UNSIGNED) {
  ------------------
  |  |  226|   277k|#define UNSIGNED	0x08	/* comparison is unsigned */
  ------------------
  |  Branch (2427:7): [True: 238k, False: 38.7k]
  ------------------
 2428|   238k|			matched = v < l;
 2429|   238k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|   238k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2429:8): [True: 0, False: 238k]
  ------------------
 2430|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2431|      0|				    "u < %" INT64_T_FORMAT "u = %d",
 2432|      0|				    CAST(unsigned long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2433|      0|				    CAST(unsigned long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2434|   238k|		}
 2435|  38.7k|		else {
 2436|  38.7k|			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  444|  38.7k|#define CAST(T, b)	((T)(b))
  ------------------
              			matched = CAST(int64_t, v) < CAST(int64_t, l);
  ------------------
  |  |  444|  38.7k|#define CAST(T, b)	((T)(b))
  ------------------
 2437|  38.7k|			if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  38.7k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2437:8): [True: 0, False: 38.7k]
  ------------------
 2438|      0|				(void) fprintf(stderr, "%" INT64_T_FORMAT
 2439|      0|				    "d < %" INT64_T_FORMAT "d = %d",
 2440|      0|				     CAST(long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2441|      0|				     CAST(long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2442|  38.7k|		}
 2443|   277k|		break;
 2444|       |
 2445|  26.0k|	case '&':
  ------------------
  |  Branch (2445:2): [True: 26.0k, False: 73.5M]
  ------------------
 2446|  26.0k|		matched = (v & l) == l;
 2447|  26.0k|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|  26.0k|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2447:7): [True: 0, False: 26.0k]
  ------------------
 2448|      0|			(void) fprintf(stderr, "((%" INT64_T_FORMAT "x & %"
 2449|      0|			    INT64_T_FORMAT "x) == %" INT64_T_FORMAT
 2450|      0|			    "x) = %d", CAST(unsigned long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2451|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2452|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2453|      0|			    matched);
 2454|  26.0k|		break;
 2455|       |
 2456|    555|	case '^':
  ------------------
  |  Branch (2456:2): [True: 555, False: 73.5M]
  ------------------
 2457|    555|		matched = (v & l) != l;
 2458|    555|		if ((ms->flags & MAGIC_DEBUG) != 0)
  ------------------
  |  |   33|    555|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2458:7): [True: 0, False: 555]
  ------------------
 2459|      0|			(void) fprintf(stderr, "((%" INT64_T_FORMAT "x & %"
 2460|      0|			    INT64_T_FORMAT "x) != %" INT64_T_FORMAT
 2461|      0|			    "x) = %d", CAST(unsigned long long, v),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2462|      0|			    CAST(unsigned long long, l),
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2463|      0|			    CAST(unsigned long long, l), matched);
  ------------------
  |  |  444|      0|#define CAST(T, b)	((T)(b))
  ------------------
 2464|    555|		break;
 2465|       |
 2466|      0|	default:
  ------------------
  |  Branch (2466:2): [True: 0, False: 73.5M]
  ------------------
 2467|      0|		file_magerror(ms, "cannot happen: invalid relation `%c'",
 2468|      0|		    m->reln);
 2469|      0|		return -1;
 2470|  73.5M|	}
 2471|  73.5M|	if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|  73.5M|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (2471:6): [True: 0, False: 73.5M]
  ------------------
 2472|      0|		(void) fprintf(stderr, " strength=%zu\n",
 2473|      0|		    file_magic_strength(m, 1));
 2474|      0|	}
 2475|       |
 2476|  73.5M|	return matched;
 2477|  73.5M|}
softmagic.c:file_strncmp:
 1987|   598M|{
 1988|       |	/*
 1989|       |	 * Convert the source args to unsigned here so that (1) the
 1990|       |	 * compare will be unsigned as it is in strncmp() and (2) so
 1991|       |	 * the ctype functions will work correctly without extra
 1992|       |	 * casting.
 1993|       |	 */
 1994|   598M|	const unsigned char *a = RCAST(const unsigned char *, s1);
  ------------------
  |  |  445|   598M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1995|   598M|	const unsigned char *b = RCAST(const unsigned char *, s2);
  ------------------
  |  |  445|   598M|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
 1996|   598M|	uint32_t ws = flags & (STRING_COMPACT_WHITESPACE |
  ------------------
  |  |  389|   598M|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  388|   598M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 1997|   598M|	    STRING_COMPACT_OPTIONAL_WHITESPACE);
  ------------------
  |  |  390|   598M|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  388|   598M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
 1998|   598M|	const unsigned char *eb = b + (ws ? maxlen : len);
  ------------------
  |  Branch (1998:33): [True: 45.6M, False: 552M]
  ------------------
 1999|   598M|	uint64_t v;
 2000|       |
 2001|       |	/*
 2002|       |	 * What we want here is v = strncmp(s1, s2, len),
 2003|       |	 * but ignoring any nulls.
 2004|       |	 */
 2005|   598M|	v = 0;
 2006|   598M|	len++;
 2007|   598M|	if (0L == flags) { /* normal string: do it fast */
  ------------------
  |  Branch (2007:6): [True: 44.1M, False: 554M]
  ------------------
 2008|  44.8M|		while (--len > 0)
  ------------------
  |  Branch (2008:10): [True: 44.8M, False: 41.5k]
  ------------------
 2009|  44.8M|			if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2009:8): [True: 44.0M, False: 742k]
  ------------------
 2010|  44.0M|				break;
 2011|  44.1M|	}
 2012|   554M|	else { /* combine the others */
 2013|   554M|		while (--len > 0) {
  ------------------
  |  Branch (2013:10): [True: 554M, False: 28.6k]
  ------------------
 2014|   554M|			if (b >= eb) {
  ------------------
  |  Branch (2014:8): [True: 233k, False: 554M]
  ------------------
 2015|   233k|				v = 1;
 2016|   233k|				break;
 2017|   233k|			}
 2018|   554M|			if ((flags & STRING_IGNORE_LOWERCASE) &&
  ------------------
  |  |  391|   554M|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  ------------------
  |  |  |  |  388|   554M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2018:8): [True: 44.8M, False: 509M]
  ------------------
 2019|   554M|			    islower(*a)) {
 2020|  2.33M|				if ((v = tolower(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2020:9): [True: 2.31M, False: 19.5k]
  ------------------
 2021|  2.31M|					break;
 2022|  2.33M|			}
 2023|   552M|			else if ((flags & STRING_IGNORE_UPPERCASE) &&
  ------------------
  |  |  392|   552M|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  ------------------
  |  |  |  |  388|   552M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2023:13): [True: 14.3k, False: 552M]
  ------------------
 2024|   552M|			    isupper(*a)) {
 2025|  14.2k|				if ((v = toupper(*b++) - *a++) != '\0')
  ------------------
  |  Branch (2025:9): [True: 14.0k, False: 249]
  ------------------
 2026|  14.0k|					break;
 2027|  14.2k|			}
 2028|   552M|			else if ((flags & STRING_COMPACT_WHITESPACE) &&
  ------------------
  |  |  389|   552M|#define STRING_COMPACT_WHITESPACE		BIT(0)
  |  |  ------------------
  |  |  |  |  388|   552M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2028:13): [True: 33.6M, False: 518M]
  ------------------
 2029|   552M|			    isspace(*a)) {
 2030|  1.35M|				a++;
 2031|  1.35M|				if (isspace(*b)) {
 2032|   319k|					b++;
 2033|   319k|					if (!isspace(*a))
  ------------------
  |  Branch (2033:10): [True: 319k, False: 0]
  ------------------
 2034|  11.5G|						while (b < eb && isspace(*b))
  ------------------
  |  Branch (2034:14): [True: 11.5G, False: 233k]
  ------------------
 2035|  11.5G|							b++;
 2036|   319k|				}
 2037|  1.04M|				else {
 2038|  1.04M|					v = 1;
 2039|  1.04M|					break;
 2040|  1.04M|				}
 2041|  1.35M|			}
 2042|   550M|			else if ((flags & STRING_COMPACT_OPTIONAL_WHITESPACE) &&
  ------------------
  |  |  390|   550M|#define STRING_COMPACT_OPTIONAL_WHITESPACE	BIT(1)
  |  |  ------------------
  |  |  |  |  388|   550M|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2042:13): [True: 12.0M, False: 538M]
  ------------------
 2043|   550M|			    isspace(*a)) {
 2044|  1.80k|				a++;
 2045|  7.43k|				while (b < eb && isspace(*b))
  ------------------
  |  Branch (2045:12): [True: 7.37k, False: 64]
  ------------------
 2046|  5.62k|					b++;
 2047|  1.80k|			}
 2048|   550M|			else {
 2049|   550M|				if ((v = *b++ - *a++) != '\0')
  ------------------
  |  Branch (2049:9): [True: 550M, False: 142k]
  ------------------
 2050|   550M|					break;
 2051|   550M|			}
 2052|   554M|		}
 2053|   554M|		if (len == 0 && v == 0 && (flags & STRING_FULL_WORD)) {
  ------------------
  |  |  407|  28.6k|#define	STRING_FULL_WORD			BIT(14)
  |  |  ------------------
  |  |  |  |  388|  28.6k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (2053:7): [True: 28.6k, False: 554M]
  |  Branch (2053:19): [True: 28.6k, False: 0]
  |  Branch (2053:29): [True: 103, False: 28.5k]
  ------------------
 2054|    103|			if (*b && !isspace(*b))
  ------------------
  |  Branch (2054:8): [True: 69, False: 34]
  |  Branch (2054:14): [True: 35, False: 34]
  ------------------
 2055|     35|				v = 1;
 2056|    103|		}
 2057|   554M|	}
 2058|   598M|	return v;
 2059|   598M|}
softmagic.c:file_strncmp16:
 2064|  55.9k|{
 2065|       |	/*
 2066|       |	 * XXX - The 16-bit string compare probably needs to be done
 2067|       |	 * differently, especially if the flags are to be supported.
 2068|       |	 * At the moment, I am unsure.
 2069|       |	 */
 2070|  55.9k|	flags = 0;
 2071|  55.9k|	return file_strncmp(a, b, len, maxlen, flags);
 2072|  55.9k|}
softmagic.c:alloc_regex:
 2076|    157|{
 2077|    157|	int rc;
 2078|    157|	file_regex_t *rx = CAST(file_regex_t *, malloc(sizeof(*rx)));
  ------------------
  |  |  444|    157|#define CAST(T, b)	((T)(b))
  ------------------
 2079|       |
 2080|    157|	if (rx == NULL) {
  ------------------
  |  Branch (2080:6): [True: 0, False: 157]
  ------------------
 2081|      0|		file_error(ms, errno, "can't allocate %" SIZE_T_FORMAT
 2082|      0|		    "u bytes", sizeof(*rx));
 2083|      0|		return NULL;
 2084|      0|	}
 2085|       |
 2086|    157|	rc = file_regcomp(ms, rx, m->value.s, REG_EXTENDED | REG_NEWLINE |
 2087|    157|	    ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
  ------------------
  |  |  375|    157|#define str_flags _u._s._flags
  ------------------
              	    ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
  ------------------
  |  |  424|    157|#define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  ------------------
  |  |  |  |  391|    157|#define STRING_IGNORE_LOWERCASE			BIT(2)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|    157|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define STRING_IGNORE_CASE		(STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
  |  |  ------------------
  |  |  |  |  392|    157|#define STRING_IGNORE_UPPERCASE			BIT(3)
  |  |  |  |  ------------------
  |  |  |  |  |  |  388|    157|#define BIT(A)   (1 << (A))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2087:7): [True: 20, False: 137]
  ------------------
 2088|    157|	if (rc == 0)
  ------------------
  |  Branch (2088:6): [True: 157, False: 0]
  ------------------
 2089|    157|		return rx;
 2090|       |
 2091|      0|	free(rx);
 2092|      0|	return NULL;
 2093|    157|}
softmagic.c:handle_annotation:
 2481|   636k|{
 2482|   636k|	if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
  ------------------
  |  |   45|   636k|#define	MAGIC_APPLE		0x0000800 /* Return the Apple creator/type */
  ------------------
  |  Branch (2482:6): [True: 0, False: 636k]
  |  Branch (2482:35): [True: 0, False: 0]
  ------------------
 2483|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2483:7): [True: 0, False: 0]
  ------------------
 2484|      0|			return -1;
 2485|      0|		if (file_printf(ms, "%.8s", m->apple) == -1)
  ------------------
  |  Branch (2485:7): [True: 0, False: 0]
  ------------------
 2486|      0|			return -1;
 2487|      0|		return 1;
 2488|      0|	}
 2489|   636k|	if ((ms->flags & MAGIC_EXTENSION) && m->ext[0]) {
  ------------------
  |  |   46|   636k|#define	MAGIC_EXTENSION		0x1000000 /* Return a /-separated list of
  ------------------
  |  Branch (2489:6): [True: 0, False: 636k]
  |  Branch (2489:39): [True: 0, False: 0]
  ------------------
 2490|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2490:7): [True: 0, False: 0]
  ------------------
 2491|      0|			return -1;
 2492|      0|		if (file_printf(ms, "%s", m->ext) == -1)
  ------------------
  |  Branch (2492:7): [True: 0, False: 0]
  ------------------
 2493|      0|			return -1;
 2494|      0|		return 1;
 2495|      0|	}
 2496|   636k|	if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) {
  ------------------
  |  |   37|   636k|#define	MAGIC_MIME_TYPE		0x0000010 /* Return the MIME type */
  ------------------
  |  Branch (2496:6): [True: 0, False: 636k]
  |  Branch (2496:39): [True: 0, False: 0]
  ------------------
 2497|      0|		char buf[1024];
 2498|      0|		const char *p;
 2499|      0|		if (print_sep(ms, firstline) == -1)
  ------------------
  |  Branch (2499:7): [True: 0, False: 0]
  ------------------
 2500|      0|			return -1;
 2501|      0|		if (varexpand(ms, buf, sizeof(buf), m->mimetype) == -1)
  ------------------
  |  Branch (2501:7): [True: 0, False: 0]
  ------------------
 2502|      0|			p = m->mimetype;
 2503|      0|		else
 2504|      0|			p = buf;
 2505|      0|		if (file_printf(ms, "%s", p) == -1)
  ------------------
  |  Branch (2505:7): [True: 0, False: 0]
  ------------------
 2506|      0|			return -1;
 2507|      0|		return 1;
 2508|      0|	}
 2509|   636k|	return 0;
 2510|   636k|}
softmagic.c:varexpand:
  530|   109k|{
  531|   109k|	const char *ptr, *sptr, *e, *t, *ee, *et;
  532|   109k|	size_t l;
  533|       |
  534|   109k|	for (sptr = str; (ptr = strstr(sptr, "${")) != NULL;) {
  ------------------
  |  Branch (534:19): [True: 58, False: 109k]
  ------------------
  535|     58|		l = CAST(size_t, ptr - sptr);
  ------------------
  |  |  444|     58|#define CAST(T, b)	((T)(b))
  ------------------
  536|     58|		if (l >= len)
  ------------------
  |  Branch (536:7): [True: 0, False: 58]
  ------------------
  537|      0|			return -1;
  538|     58|		memcpy(buf, sptr, l);
  539|     58|		buf += l;
  540|     58|		len -= l;
  541|     58|		ptr += 2;
  542|     58|		if (!*ptr || ptr[1] != '?')
  ------------------
  |  Branch (542:7): [True: 0, False: 58]
  |  Branch (542:16): [True: 0, False: 58]
  ------------------
  543|      0|			return -1;
  544|    870|		for (et = t = ptr + 2; *et && *et != ':'; et++)
  ------------------
  |  Branch (544:26): [True: 870, False: 0]
  |  Branch (544:33): [True: 812, False: 58]
  ------------------
  545|    812|			continue;
  546|     58|		if (*et != ':')
  ------------------
  |  Branch (546:7): [True: 0, False: 58]
  ------------------
  547|      0|			return -1;
  548|    812|		for (ee = e = et + 1; *ee && *ee != '}'; ee++)
  ------------------
  |  Branch (548:25): [True: 812, False: 0]
  |  Branch (548:32): [True: 754, False: 58]
  ------------------
  549|    754|			continue;
  550|     58|		if (*ee != '}')
  ------------------
  |  Branch (550:7): [True: 0, False: 58]
  ------------------
  551|      0|			return -1;
  552|     58|		switch (*ptr) {
  553|     58|		case 'x':
  ------------------
  |  Branch (553:3): [True: 58, False: 0]
  ------------------
  554|     58|			if (ms->mode & 0111) {
  ------------------
  |  Branch (554:8): [True: 0, False: 58]
  ------------------
  555|      0|				ptr = t;
  556|      0|				l = et - t;
  557|     58|			} else {
  558|     58|				ptr = e;
  559|     58|				l = ee - e;
  560|     58|			}
  561|     58|			break;
  562|      0|		default:
  ------------------
  |  Branch (562:3): [True: 0, False: 58]
  ------------------
  563|      0|			return -1;
  564|     58|		}
  565|     58|		if (l >= len)
  ------------------
  |  Branch (565:7): [True: 0, False: 58]
  ------------------
  566|      0|			return -1;
  567|     58|		memcpy(buf, ptr, l);
  568|     58|		buf += l;
  569|     58|		len -= l;
  570|     58|		sptr = ee + 1;
  571|     58|	}
  572|       |
  573|   109k|	l = strlen(sptr);
  574|   109k|	if (l >= len)
  ------------------
  |  Branch (574:6): [True: 0, False: 109k]
  ------------------
  575|      0|		return -1;
  576|       |
  577|   109k|	memcpy(buf, sptr, l);
  578|   109k|	buf[l] = '\0';
  579|   109k|	return 0;
  580|   109k|}
softmagic.c:print_sep:
 2514|  44.1k|{
 2515|  44.1k|	if (firstline)
  ------------------
  |  Branch (2515:6): [True: 9.38k, False: 34.7k]
  ------------------
 2516|  9.38k|		return 0;
 2517|       |	/*
 2518|       |	 * we found another match
 2519|       |	 * put a newline and '-' to do some simple formatting
 2520|       |	 */
 2521|  34.7k|	return file_separator(ms);
 2522|  44.1k|}
softmagic.c:mprint:
  585|   109k|{
  586|   109k|	uint64_t v;
  587|   109k|	float vf;
  588|   109k|	double vd;
  589|   109k| 	char buf[128], tbuf[26], sbuf[512], ebuf[512];
  590|   109k|	const char *desc;
  591|   109k|	union VALUETYPE *p = &ms->ms_value;
  592|       |
  593|   109k|	if (varexpand(ms, ebuf, sizeof(ebuf), m->desc) == -1)
  ------------------
  |  Branch (593:6): [True: 0, False: 109k]
  ------------------
  594|      0|		desc = m->desc;
  595|   109k|	else
  596|   109k|		desc = ebuf;
  597|       |
  598|   109k|#define	PRINTER(value, format, stype, utype)	\
  599|   109k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  600|   109k|	switch (check_fmt(ms, desc)) { \
  601|   109k|	case -1: \
  602|   109k|		return -1; \
  603|   109k|	case 1: \
  604|   109k|		if (m->flag & UNSIGNED) { \
  605|   109k|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  606|   109k|			    CAST(utype, v)); \
  607|   109k|		} else { \
  608|   109k|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  609|   109k|			    CAST(stype, v)); \
  610|   109k|		} \
  611|   109k|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  612|   109k|			return -1; \
  613|   109k|		break; \
  614|   109k|	default: \
  615|   109k|		if (m->flag & UNSIGNED) { \
  616|   109k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  617|   109k|			   CAST(utype, v)) == -1) \
  618|   109k|			   return -1; \
  619|   109k|		} else { \
  620|   109k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  621|   109k|			   CAST(stype, v)) == -1) \
  622|   109k|			   return -1; \
  623|   109k|		} \
  624|   109k|		break; \
  625|   109k|	} \
  626|   109k|	break
  627|       |
  628|   109k|  	switch (m->type) {
  629|  8.96k|  	case FILE_BYTE:
  ------------------
  |  |  241|  8.96k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (629:4): [True: 8.96k, False: 100k]
  ------------------
  630|  8.96k|		PRINTER(p->b, "", int8_t, uint8_t);
  ------------------
  |  |  599|  8.96k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  444|  8.96k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  600|  8.96k|	switch (check_fmt(ms, desc)) { \
  |  |  601|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (601:2): [True: 0, False: 8.96k]
  |  |  ------------------
  |  |  602|      0|		return -1; \
  |  |  603|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (603:2): [True: 0, False: 8.96k]
  |  |  ------------------
  |  |  604|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (604:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  605|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  606|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  607|      0|		} else { \
  |  |  608|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  609|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  610|      0|		} \
  |  |  611|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (611:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  612|      0|			return -1; \
  |  |  613|      0|		break; \
  |  |  614|  8.96k|	default: \
  |  |  ------------------
  |  |  |  Branch (614:2): [True: 8.96k, False: 0]
  |  |  ------------------
  |  |  615|  8.96k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|  8.96k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (615:7): [True: 5.58k, False: 3.38k]
  |  |  ------------------
  |  |  616|  5.58k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  158|  5.58k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (616:14): [True: 0, False: 5.58k]
  |  |  ------------------
  |  |  617|  5.58k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  5.58k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  618|  5.58k|			   return -1; \
  |  |  619|  5.58k|		} else { \
  |  |  620|  3.38k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  158|  3.38k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (620:14): [True: 0, False: 3.38k]
  |  |  ------------------
  |  |  621|  3.38k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  3.38k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  622|  3.38k|			   return -1; \
  |  |  623|  3.38k|		} \
  |  |  624|  8.96k|		break; \
  |  |  625|  8.96k|	} \
  |  |  626|  8.96k|	break
  ------------------
  631|       |
  632|  8.96k|  	case FILE_SHORT:
  ------------------
  |  |  242|  2.46k|#define				FILE_SHORT		2
  ------------------
  |  Branch (632:4): [True: 2.46k, False: 106k]
  ------------------
  633|  7.56k|  	case FILE_BESHORT:
  ------------------
  |  |  247|  7.56k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (633:4): [True: 5.09k, False: 104k]
  ------------------
  634|  15.1k|  	case FILE_LESHORT:
  ------------------
  |  |  250|  15.1k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (634:4): [True: 7.63k, False: 101k]
  ------------------
  635|  15.1k|		PRINTER(p->h, "", int16_t, uint16_t);
  ------------------
  |  |  599|  15.1k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  444|  15.1k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  600|  15.1k|	switch (check_fmt(ms, desc)) { \
  |  |  601|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (601:2): [True: 0, False: 15.1k]
  |  |  ------------------
  |  |  602|      0|		return -1; \
  |  |  603|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (603:2): [True: 0, False: 15.1k]
  |  |  ------------------
  |  |  604|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (604:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  605|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  606|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  607|      0|		} else { \
  |  |  608|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  609|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  610|      0|		} \
  |  |  611|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (611:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  612|      0|			return -1; \
  |  |  613|      0|		break; \
  |  |  614|  15.1k|	default: \
  |  |  ------------------
  |  |  |  Branch (614:2): [True: 15.1k, False: 0]
  |  |  ------------------
  |  |  615|  15.1k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|  15.1k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (615:7): [True: 11.5k, False: 3.68k]
  |  |  ------------------
  |  |  616|  11.5k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  158|  11.5k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (616:14): [True: 0, False: 11.5k]
  |  |  ------------------
  |  |  617|  11.5k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  11.5k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  618|  11.5k|			   return -1; \
  |  |  619|  11.5k|		} else { \
  |  |  620|  3.68k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  158|  3.68k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (620:14): [True: 0, False: 3.68k]
  |  |  ------------------
  |  |  621|  3.68k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  3.68k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  622|  3.68k|			   return -1; \
  |  |  623|  3.68k|		} \
  |  |  624|  15.1k|		break; \
  |  |  625|  15.1k|	} \
  |  |  626|  15.1k|	break
  ------------------
  636|       |
  637|  15.1k|  	case FILE_LONG:
  ------------------
  |  |  244|    432|#define				FILE_LONG		4
  ------------------
  |  Branch (637:4): [True: 432, False: 108k]
  ------------------
  638|  24.7k|  	case FILE_BELONG:
  ------------------
  |  |  248|  24.7k|#define				FILE_BELONG		8
  ------------------
  |  Branch (638:4): [True: 24.3k, False: 85.0k]
  ------------------
  639|  31.9k|  	case FILE_LELONG:
  ------------------
  |  |  251|  31.9k|#define				FILE_LELONG		11
  ------------------
  |  Branch (639:4): [True: 7.16k, False: 102k]
  ------------------
  640|  31.9k|  	case FILE_MELONG:
  ------------------
  |  |  263|  31.9k|#define				FILE_MELONG		23
  ------------------
  |  Branch (640:4): [True: 34, False: 109k]
  ------------------
  641|  31.9k|		PRINTER(p->l, "", int32_t, uint32_t);
  ------------------
  |  |  599|  31.9k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  444|  31.9k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  600|  31.9k|	switch (check_fmt(ms, desc)) { \
  |  |  601|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (601:2): [True: 0, False: 31.9k]
  |  |  ------------------
  |  |  602|      0|		return -1; \
  |  |  603|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (603:2): [True: 0, False: 31.9k]
  |  |  ------------------
  |  |  604|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (604:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  605|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  606|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  607|      0|		} else { \
  |  |  608|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  609|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  610|      0|		} \
  |  |  611|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (611:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  612|      0|			return -1; \
  |  |  613|      0|		break; \
  |  |  614|  31.9k|	default: \
  |  |  ------------------
  |  |  |  Branch (614:2): [True: 31.9k, False: 0]
  |  |  ------------------
  |  |  615|  31.9k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|  31.9k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (615:7): [True: 7.74k, False: 24.2k]
  |  |  ------------------
  |  |  616|  7.74k|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  158|  7.74k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (616:14): [True: 0, False: 7.74k]
  |  |  ------------------
  |  |  617|  7.74k|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  7.74k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  618|  7.74k|			   return -1; \
  |  |  619|  24.2k|		} else { \
  |  |  620|  24.2k|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  158|  24.2k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (620:14): [True: 0, False: 24.2k]
  |  |  ------------------
  |  |  621|  24.2k|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|  24.2k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  622|  24.2k|			   return -1; \
  |  |  623|  24.2k|		} \
  |  |  624|  31.9k|		break; \
  |  |  625|  31.9k|	} \
  |  |  626|  31.9k|	break
  ------------------
  642|       |
  643|  31.9k|  	case FILE_QUAD:
  ------------------
  |  |  264|    133|#define				FILE_QUAD		24
  ------------------
  |  Branch (643:4): [True: 133, False: 109k]
  ------------------
  644|    861|  	case FILE_BEQUAD:
  ------------------
  |  |  266|    861|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (644:4): [True: 728, False: 108k]
  ------------------
  645|  1.30k|  	case FILE_LEQUAD:
  ------------------
  |  |  265|  1.30k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (645:4): [True: 445, False: 108k]
  ------------------
  646|  1.30k|	case FILE_OFFSET:
  ------------------
  |  |  290|  1.30k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (646:2): [True: 0, False: 109k]
  ------------------
  647|  1.30k|		PRINTER(p->q, INT64_T_FORMAT, long long, unsigned long long);
  ------------------
  |  |  599|  1.30k|	v = file_signextend(ms, m, CAST(uint64_t, value)); \
  |  |  ------------------
  |  |  |  |  444|  1.30k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  600|  1.30k|	switch (check_fmt(ms, desc)) { \
  |  |  601|      0|	case -1: \
  |  |  ------------------
  |  |  |  Branch (601:2): [True: 0, False: 1.30k]
  |  |  ------------------
  |  |  602|      0|		return -1; \
  |  |  603|      0|	case 1: \
  |  |  ------------------
  |  |  |  Branch (603:2): [True: 0, False: 1.30k]
  |  |  ------------------
  |  |  604|      0|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|      0|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (604:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  605|      0|			(void)snprintf(buf, sizeof(buf), "%" format "u", \
  |  |  606|      0|			    CAST(utype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  607|      0|		} else { \
  |  |  608|      0|			(void)snprintf(buf, sizeof(buf), "%" format "d", \
  |  |  609|      0|			    CAST(stype, v)); \
  |  |  ------------------
  |  |  |  |  444|      0|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  610|      0|		} \
  |  |  611|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1) \
  |  |  ------------------
  |  |  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (611:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  612|      0|			return -1; \
  |  |  613|      0|		break; \
  |  |  614|  1.30k|	default: \
  |  |  ------------------
  |  |  |  Branch (614:2): [True: 1.30k, False: 0]
  |  |  ------------------
  |  |  615|  1.30k|		if (m->flag & UNSIGNED) { \
  |  |  ------------------
  |  |  |  |  226|  1.30k|#define UNSIGNED	0x08	/* comparison is unsigned */
  |  |  ------------------
  |  |  |  Branch (615:7): [True: 936, False: 370]
  |  |  ------------------
  |  |  616|    936|		       if (file_printf(ms, F(ms, desc, "%" format "u"), \
  |  |  ------------------
  |  |  |  |  158|    936|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (616:14): [True: 0, False: 936]
  |  |  ------------------
  |  |  617|    936|			   CAST(utype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|    936|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  618|    936|			   return -1; \
  |  |  619|    936|		} else { \
  |  |  620|    370|		       if (file_printf(ms, F(ms, desc, "%" format "d"), \
  |  |  ------------------
  |  |  |  |  158|    370|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  |  |  ------------------
  |  |  |  Branch (620:14): [True: 0, False: 370]
  |  |  ------------------
  |  |  621|    370|			   CAST(stype, v)) == -1) \
  |  |  ------------------
  |  |  |  |  444|    370|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  |  |  622|    370|			   return -1; \
  |  |  623|    370|		} \
  |  |  624|  1.30k|		break; \
  |  |  625|  1.30k|	} \
  |  |  626|  1.30k|	break
  ------------------
  648|       |
  649|  35.3k|  	case FILE_STRING:
  ------------------
  |  |  245|  35.3k|#define				FILE_STRING		5
  ------------------
  |  Branch (649:4): [True: 35.3k, False: 74.0k]
  ------------------
  650|  36.7k|  	case FILE_PSTRING:
  ------------------
  |  |  253|  36.7k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (650:4): [True: 1.39k, False: 107k]
  ------------------
  651|  36.8k|  	case FILE_BESTRING16:
  ------------------
  |  |  258|  36.8k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (651:4): [True: 147, False: 109k]
  ------------------
  652|  37.3k|  	case FILE_LESTRING16:
  ------------------
  |  |  259|  37.3k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (652:4): [True: 444, False: 108k]
  ------------------
  653|  37.3k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (653:7): [True: 18.9k, False: 18.3k]
  |  Branch (653:25): [True: 623, False: 17.7k]
  ------------------
  654|  19.5k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|  19.5k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (654:8): [True: 0, False: 19.5k]
  ------------------
  655|  19.5k|			    file_printable(ms, sbuf, sizeof(sbuf), m->value.s,
  656|  19.5k|			    sizeof(m->value.s))) == -1)
  657|      0|				return -1;
  658|  19.5k|		}
  659|  17.7k|		else {
  660|  17.7k|			char *str = p->s;
  661|       |
  662|       |			/* compute t before we mangle the string? */
  663|       |
  664|  17.7k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (664:8): [True: 17.6k, False: 145]
  ------------------
  665|  17.6k|				str[strcspn(str, "\r\n")] = '\0';
  666|       |
  667|  17.7k|			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  375|  17.7k|#define str_flags _u._s._flags
  ------------------
              			if (m->str_flags & STRING_TRIM)
  ------------------
  |  |  406|  17.7k|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  388|  17.7k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (667:8): [True: 262, False: 17.5k]
  ------------------
  668|    262|				str = file_strtrim(str);
  669|       |
  670|  17.7k|			if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|  17.7k|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (670:8): [True: 0, False: 17.7k]
  ------------------
  671|  17.7k|			    file_printable(ms, sbuf, sizeof(sbuf), str,
  672|  17.7k|				sizeof(p->s) - (str - p->s))) == -1)
  673|      0|				return -1;
  674|       |
  675|  17.7k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  253|  17.7k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (675:8): [True: 1.39k, False: 16.3k]
  ------------------
  676|  1.39k|				size_t l = file_pstring_length_size(ms, m);
  677|  1.39k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  175|  1.39k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|  1.39k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (677:9): [True: 0, False: 1.39k]
  ------------------
  678|      0|					return -1;
  679|  1.39k|			}
  680|  17.7k|		}
  681|  37.3k|		break;
  682|       |
  683|  37.3k|	case FILE_DATE:
  ------------------
  |  |  246|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (683:2): [True: 0, False: 109k]
  ------------------
  684|     52|	case FILE_BEDATE:
  ------------------
  |  |  249|     52|#define				FILE_BEDATE		9
  ------------------
  |  Branch (684:2): [True: 52, False: 109k]
  ------------------
  685|    164|	case FILE_LEDATE:
  ------------------
  |  |  252|    164|#define				FILE_LEDATE		12
  ------------------
  |  Branch (685:2): [True: 112, False: 109k]
  ------------------
  686|    260|	case FILE_MEDATE:
  ------------------
  |  |  261|    260|#define				FILE_MEDATE		21
  ------------------
  |  Branch (686:2): [True: 96, False: 109k]
  ------------------
  687|    260|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    260|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (687:7): [True: 0, False: 260]
  ------------------
  688|    260|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, 0)) == -1)
  689|      0|			return -1;
  690|    260|		break;
  691|       |
  692|    260|	case FILE_LDATE:
  ------------------
  |  |  254|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (692:2): [True: 0, False: 109k]
  ------------------
  693|    144|	case FILE_BELDATE:
  ------------------
  |  |  255|    144|#define				FILE_BELDATE		15
  ------------------
  |  Branch (693:2): [True: 144, False: 109k]
  ------------------
  694|    178|	case FILE_LELDATE:
  ------------------
  |  |  256|    178|#define				FILE_LELDATE		16
  ------------------
  |  Branch (694:2): [True: 34, False: 109k]
  ------------------
  695|    178|	case FILE_MELDATE:
  ------------------
  |  |  262|    178|#define				FILE_MELDATE		22
  ------------------
  |  Branch (695:2): [True: 0, False: 109k]
  ------------------
  696|    178|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    178|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (696:7): [True: 0, False: 178]
  ------------------
  697|    178|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->l, FILE_T_LOCAL))
  ------------------
  |  |  528|    178|#define FILE_T_LOCAL	1
  ------------------
  698|    178|			== -1)
  699|      0|			return -1;
  700|    178|		break;
  701|       |
  702|    178|	case FILE_QDATE:
  ------------------
  |  |  267|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (702:2): [True: 0, False: 109k]
  ------------------
  703|    142|	case FILE_BEQDATE:
  ------------------
  |  |  269|    142|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (703:2): [True: 142, False: 109k]
  ------------------
  704|    231|	case FILE_LEQDATE:
  ------------------
  |  |  268|    231|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (704:2): [True: 89, False: 109k]
  ------------------
  705|    231|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    231|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (705:7): [True: 0, False: 231]
  ------------------
  706|    231|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, 0)) == -1)
  707|      0|			return -1;
  708|    231|		break;
  709|       |
  710|    231|	case FILE_QLDATE:
  ------------------
  |  |  270|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (710:2): [True: 0, False: 109k]
  ------------------
  711|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  272|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (711:2): [True: 0, False: 109k]
  ------------------
  712|     20|	case FILE_LEQLDATE:
  ------------------
  |  |  271|     20|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (712:2): [True: 20, False: 109k]
  ------------------
  713|     20|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|     20|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (713:7): [True: 0, False: 20]
  ------------------
  714|     20|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_LOCAL)) == -1)
  ------------------
  |  |  528|     20|#define FILE_T_LOCAL	1
  ------------------
  715|      0|			return -1;
  716|     20|		break;
  717|       |
  718|    240|	case FILE_QWDATE:
  ------------------
  |  |  282|    240|#define				FILE_QWDATE		42
  ------------------
  |  Branch (718:2): [True: 240, False: 109k]
  ------------------
  719|    240|	case FILE_BEQWDATE:
  ------------------
  |  |  284|    240|#define				FILE_BEQWDATE		44
  ------------------
  |  Branch (719:2): [True: 0, False: 109k]
  ------------------
  720|    966|	case FILE_LEQWDATE:
  ------------------
  |  |  283|    966|#define				FILE_LEQWDATE		43
  ------------------
  |  Branch (720:2): [True: 726, False: 108k]
  ------------------
  721|    966|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    966|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (721:7): [True: 0, False: 966]
  ------------------
  722|    966|		    file_fmtdatetime(tbuf, sizeof(tbuf), p->q, FILE_T_WINDOWS))
  ------------------
  |  |  529|    966|#define FILE_T_WINDOWS	2
  ------------------
  723|    966|		    == -1)
  724|      0|			return -1;
  725|    966|		break;
  726|       |
  727|    966|	case FILE_FLOAT:
  ------------------
  |  |  273|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (727:2): [True: 0, False: 109k]
  ------------------
  728|      0|	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (728:2): [True: 0, False: 109k]
  ------------------
  729|    285|	case FILE_LEFLOAT:
  ------------------
  |  |  275|    285|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (729:2): [True: 285, False: 109k]
  ------------------
  730|    285|		vf = p->f;
  731|    285|		switch (check_fmt(ms, desc)) {
  732|      0|		case -1:
  ------------------
  |  Branch (732:3): [True: 0, False: 285]
  ------------------
  733|      0|			return -1;
  734|      0|		case 1:
  ------------------
  |  Branch (734:3): [True: 0, False: 285]
  ------------------
  735|      0|			(void)snprintf(buf, sizeof(buf), "%g", vf);
  736|      0|			if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (736:8): [True: 0, False: 0]
  ------------------
  737|      0|				return -1;
  738|      0|			break;
  739|    285|		default:
  ------------------
  |  Branch (739:3): [True: 285, False: 0]
  ------------------
  740|    285|			if (file_printf(ms, F(ms, desc, "%g"), vf) == -1)
  ------------------
  |  |  158|    285|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (740:8): [True: 0, False: 285]
  ------------------
  741|      0|				return -1;
  742|    285|			break;
  743|    285|		}
  744|    285|  		break;
  745|       |
  746|    285|	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (746:2): [True: 0, False: 109k]
  ------------------
  747|      0|	case FILE_BEDOUBLE:
  ------------------
  |  |  277|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (747:2): [True: 0, False: 109k]
  ------------------
  748|    286|	case FILE_LEDOUBLE:
  ------------------
  |  |  278|    286|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (748:2): [True: 286, False: 109k]
  ------------------
  749|    286|		vd = p->d;
  750|    286|		switch (check_fmt(ms, desc)) {
  751|      0|		case -1:
  ------------------
  |  Branch (751:3): [True: 0, False: 286]
  ------------------
  752|      0|			return -1;
  753|      0|		case 1:
  ------------------
  |  Branch (753:3): [True: 0, False: 286]
  ------------------
  754|      0|			(void)snprintf(buf, sizeof(buf), "%g", vd);
  755|      0|			if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (755:8): [True: 0, False: 0]
  ------------------
  756|      0|				return -1;
  757|      0|			break;
  758|    286|		default:
  ------------------
  |  Branch (758:3): [True: 286, False: 0]
  ------------------
  759|    286|			if (file_printf(ms, F(ms, desc, "%g"), vd) == -1)
  ------------------
  |  |  158|    286|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (759:8): [True: 0, False: 286]
  ------------------
  760|      0|				return -1;
  761|    286|			break;
  762|    286|		}
  763|    286|  		break;
  764|       |
  765|    286|	case FILE_SEARCH:
  ------------------
  |  |  260|    275|#define				FILE_SEARCH		20
  ------------------
  |  Branch (765:2): [True: 275, False: 109k]
  ------------------
  766|    770|	case FILE_REGEX: {
  ------------------
  |  |  257|    770|#define				FILE_REGEX		17
  ------------------
  |  Branch (766:2): [True: 495, False: 108k]
  ------------------
  767|    770|		char *cp, *scp;
  768|    770|		int rval;
  769|       |
  770|    770|		cp = strndup(RCAST(const char *, ms->search.s),
  ------------------
  |  |  445|    770|#define RCAST(T, b)	((T)(uintptr_t)(b))
  ------------------
  771|    770|		    ms->search.rm_len);
  772|    770|		if (cp == NULL) {
  ------------------
  |  Branch (772:7): [True: 0, False: 770]
  ------------------
  773|      0|			file_oomem(ms, ms->search.rm_len);
  774|      0|			return -1;
  775|      0|		}
  776|    770|		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  375|    770|#define str_flags _u._s._flags
  ------------------
              		scp = (m->str_flags & STRING_TRIM) ? file_strtrim(cp) : cp;
  ------------------
  |  |  406|    770|#define	STRING_TRIM				BIT(13)
  |  |  ------------------
  |  |  |  |  388|    770|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (776:9): [True: 34, False: 736]
  ------------------
  777|       |
  778|    770|		rval = file_printf(ms, F(ms, desc, "%s"), file_printable(ms,
  ------------------
  |  |  158|    770|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  779|    770|		    sbuf, sizeof(sbuf), scp, ms->search.rm_len));
  780|    770|		free(cp);
  781|       |
  782|    770|		if (rval == -1)
  ------------------
  |  Branch (782:7): [True: 0, False: 770]
  ------------------
  783|      0|			return -1;
  784|    770|		break;
  785|    770|	}
  786|       |
  787|    914|	case FILE_DEFAULT:
  ------------------
  |  |  243|    914|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (787:2): [True: 914, False: 108k]
  ------------------
  788|    916|	case FILE_CLEAR:
  ------------------
  |  |  287|    916|#define				FILE_CLEAR		47
  ------------------
  |  Branch (788:2): [True: 2, False: 109k]
  ------------------
  789|    916|	  	if (file_printf(ms, "%s", m->desc) == -1)
  ------------------
  |  Branch (789:9): [True: 0, False: 916]
  ------------------
  790|      0|			return -1;
  791|    916|		break;
  792|       |
  793|  2.79k|	case FILE_INDIRECT:
  ------------------
  |  |  281|  2.79k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (793:2): [True: 2.79k, False: 106k]
  ------------------
  794|  2.79k|	case FILE_USE:
  ------------------
  |  |  286|  2.79k|#define				FILE_USE		46
  ------------------
  |  Branch (794:2): [True: 0, False: 109k]
  ------------------
  795|  9.88k|	case FILE_NAME:
  ------------------
  |  |  285|  9.88k|#define				FILE_NAME		45
  ------------------
  |  Branch (795:2): [True: 7.08k, False: 102k]
  ------------------
  796|  9.88k|		break;
  797|    320|	case FILE_DER:
  ------------------
  |  |  288|    320|#define				FILE_DER		48
  ------------------
  |  Branch (797:2): [True: 320, False: 109k]
  ------------------
  798|    320|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|    320|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (798:7): [True: 0, False: 320]
  ------------------
  799|    320|		    file_printable(ms, sbuf, sizeof(sbuf), ms->ms_value.s,
  800|    320|			sizeof(ms->ms_value.s))) == -1)
  801|      0|			return -1;
  802|    320|		break;
  803|    369|	case FILE_GUID:
  ------------------
  |  |  289|    369|#define				FILE_GUID		49
  ------------------
  |  Branch (803:2): [True: 369, False: 108k]
  ------------------
  804|    369|		(void) file_print_guid(buf, sizeof(buf), ms->ms_value.guid);
  805|    369|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  158|    369|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (805:7): [True: 0, False: 369]
  ------------------
  806|      0|			return -1;
  807|    369|		break;
  808|    369|	case FILE_MSDOSDATE:
  ------------------
  |  |  293|      0|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (808:2): [True: 0, False: 109k]
  ------------------
  809|      0|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|      0|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (809:2): [True: 0, False: 109k]
  ------------------
  810|     67|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|     67|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (810:2): [True: 67, False: 109k]
  ------------------
  811|     67|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|     67|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (811:7): [True: 0, False: 67]
  ------------------
  812|     67|		    file_fmtdate(tbuf, sizeof(tbuf), p->h)) == -1)
  813|      0|			return -1;
  814|     67|		break;
  815|     67|	case FILE_MSDOSTIME:
  ------------------
  |  |  296|      0|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (815:2): [True: 0, False: 109k]
  ------------------
  816|      0|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|      0|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (816:2): [True: 0, False: 109k]
  ------------------
  817|     67|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|     67|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (817:2): [True: 67, False: 109k]
  ------------------
  818|     67|		if (file_printf(ms, F(ms, desc, "%s"),
  ------------------
  |  |  158|     67|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (818:7): [True: 0, False: 67]
  ------------------
  819|     67|		    file_fmttime(tbuf, sizeof(tbuf), p->h)) == -1)
  820|      0|			return -1;
  821|     67|		break;
  822|     67|	case FILE_OCTAL:
  ------------------
  |  |  299|      0|#define				FILE_OCTAL		59
  ------------------
  |  Branch (822:2): [True: 0, False: 109k]
  ------------------
  823|      0|		file_fmtnum(buf, sizeof(buf), m->value.s, 8);
  824|      0|		if (file_printf(ms, F(ms, desc, "%s"), buf) == -1)
  ------------------
  |  |  158|      0|#define F(a, b, c) file_fmtcheck((a), (b), (c), __FILE__, __LINE__)
  ------------------
  |  Branch (824:7): [True: 0, False: 0]
  ------------------
  825|      0|			return -1;
  826|      0|		break;
  827|      0|	default:
  ------------------
  |  Branch (827:2): [True: 0, False: 109k]
  ------------------
  828|      0|		file_magerror(ms, "invalid m->type (%d) in mprint()", m->type);
  829|      0|		return -1;
  830|   109k|	}
  831|   109k|	return 0;
  832|   109k|}
softmagic.c:check_fmt:
  489|  58.0k|{
  490|  58.0k|	file_regex_t rx;
  491|  58.0k|	int rc, rv = -1;
  492|  58.0k|        const char* pat = "%[-0-9\\.]*s";
  493|       |
  494|  58.0k|	if (strchr(fmt, '%') == NULL)
  ------------------
  |  Branch (494:6): [True: 35.4k, False: 22.5k]
  ------------------
  495|  35.4k|		return 0;
  496|       |
  497|  22.5k|	rc = file_regcomp(ms, &rx, pat, REG_EXTENDED|REG_NOSUB);
  498|  22.5k|	if (rc == 0) {
  ------------------
  |  Branch (498:6): [True: 22.5k, False: 0]
  ------------------
  499|  22.5k|		rc = file_regexec(ms, &rx, fmt, 0, 0, 0);
  500|  22.5k|		rv = !rc;
  501|  22.5k|	}
  502|  22.5k|	file_regfree(&rx);
  503|  22.5k|	return rv;
  504|  58.0k|}
softmagic.c:moffset:
  837|   636k|{
  838|   636k|	size_t nbytes = b->flen;
  839|   636k|	int32_t o;
  840|       |
  841|   636k|  	switch (m->type) {
  842|   194k|  	case FILE_BYTE:
  ------------------
  |  |  241|   194k|#define 			FILE_BYTE		1
  ------------------
  |  Branch (842:4): [True: 194k, False: 441k]
  ------------------
  843|   194k|		o = CAST(int32_t, (ms->offset + sizeof(char)));
  ------------------
  |  |  444|   194k|#define CAST(T, b)	((T)(b))
  ------------------
  844|   194k|		break;
  845|       |
  846|  16.7k|  	case FILE_SHORT:
  ------------------
  |  |  242|  16.7k|#define				FILE_SHORT		2
  ------------------
  |  Branch (846:4): [True: 16.7k, False: 619k]
  ------------------
  847|  56.5k|  	case FILE_BESHORT:
  ------------------
  |  |  247|  56.5k|#define				FILE_BESHORT		7
  ------------------
  |  Branch (847:4): [True: 39.8k, False: 596k]
  ------------------
  848|  78.0k|  	case FILE_LESHORT:
  ------------------
  |  |  250|  78.0k|#define				FILE_LESHORT		10
  ------------------
  |  Branch (848:4): [True: 21.4k, False: 614k]
  ------------------
  849|  78.0k|	case FILE_MSDOSDATE:
  ------------------
  |  |  293|  78.0k|#define				FILE_MSDOSDATE		53
  ------------------
  |  Branch (849:2): [True: 0, False: 636k]
  ------------------
  850|  78.0k|	case FILE_LEMSDOSDATE:
  ------------------
  |  |  294|  78.0k|#define				FILE_LEMSDOSDATE	54
  ------------------
  |  Branch (850:2): [True: 67, False: 636k]
  ------------------
  851|  78.0k|	case FILE_BEMSDOSDATE:
  ------------------
  |  |  295|  78.0k|#define				FILE_BEMSDOSDATE	55
  ------------------
  |  Branch (851:2): [True: 0, False: 636k]
  ------------------
  852|  78.0k|	case FILE_MSDOSTIME:
  ------------------
  |  |  296|  78.0k|#define				FILE_MSDOSTIME		56
  ------------------
  |  Branch (852:2): [True: 0, False: 636k]
  ------------------
  853|  78.1k|	case FILE_LEMSDOSTIME:
  ------------------
  |  |  297|  78.1k|#define				FILE_LEMSDOSTIME	57
  ------------------
  |  Branch (853:2): [True: 67, False: 636k]
  ------------------
  854|  78.1k|	case FILE_BEMSDOSTIME:
  ------------------
  |  |  298|  78.1k|#define				FILE_BEMSDOSTIME	58
  ------------------
  |  Branch (854:2): [True: 0, False: 636k]
  ------------------
  855|  78.1k|		o = CAST(int32_t, (ms->offset + sizeof(short)));
  ------------------
  |  |  444|  78.1k|#define CAST(T, b)	((T)(b))
  ------------------
  856|  78.1k|		break;
  857|       |
  858|  4.77k|  	case FILE_LONG:
  ------------------
  |  |  244|  4.77k|#define				FILE_LONG		4
  ------------------
  |  Branch (858:4): [True: 4.77k, False: 631k]
  ------------------
  859|  88.9k|  	case FILE_BELONG:
  ------------------
  |  |  248|  88.9k|#define				FILE_BELONG		8
  ------------------
  |  Branch (859:4): [True: 84.1k, False: 551k]
  ------------------
  860|   109k|  	case FILE_LELONG:
  ------------------
  |  |  251|   109k|#define				FILE_LELONG		11
  ------------------
  |  Branch (860:4): [True: 20.0k, False: 616k]
  ------------------
  861|   109k|  	case FILE_MELONG:
  ------------------
  |  |  263|   109k|#define				FILE_MELONG		23
  ------------------
  |  Branch (861:4): [True: 34, False: 636k]
  ------------------
  862|   109k|		o = CAST(int32_t, (ms->offset + sizeof(int32_t)));
  ------------------
  |  |  444|   109k|#define CAST(T, b)	((T)(b))
  ------------------
  863|   109k|		break;
  864|       |
  865|  25.0k|  	case FILE_QUAD:
  ------------------
  |  |  264|  25.0k|#define				FILE_QUAD		24
  ------------------
  |  Branch (865:4): [True: 25.0k, False: 611k]
  ------------------
  866|  29.4k|  	case FILE_BEQUAD:
  ------------------
  |  |  266|  29.4k|#define				FILE_BEQUAD		26
  ------------------
  |  Branch (866:4): [True: 4.40k, False: 631k]
  ------------------
  867|  30.2k|  	case FILE_LEQUAD:
  ------------------
  |  |  265|  30.2k|#define				FILE_LEQUAD		25
  ------------------
  |  Branch (867:4): [True: 790, False: 635k]
  ------------------
  868|  30.2k|		o = CAST(int32_t, (ms->offset + sizeof(int64_t)));
  ------------------
  |  |  444|  30.2k|#define CAST(T, b)	((T)(b))
  ------------------
  869|  30.2k|		break;
  870|       |
  871|  76.7k|  	case FILE_STRING:
  ------------------
  |  |  245|  76.7k|#define				FILE_STRING		5
  ------------------
  |  Branch (871:4): [True: 76.7k, False: 559k]
  ------------------
  872|  78.1k|  	case FILE_PSTRING:
  ------------------
  |  |  253|  78.1k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (872:4): [True: 1.40k, False: 634k]
  ------------------
  873|  78.3k|  	case FILE_BESTRING16:
  ------------------
  |  |  258|  78.3k|#define				FILE_BESTRING16		18
  ------------------
  |  Branch (873:4): [True: 147, False: 635k]
  ------------------
  874|  78.7k|  	case FILE_LESTRING16:
  ------------------
  |  |  259|  78.7k|#define				FILE_LESTRING16		19
  ------------------
  |  Branch (874:4): [True: 444, False: 635k]
  ------------------
  875|  78.7k|	case FILE_OCTAL:
  ------------------
  |  |  299|  78.7k|#define				FILE_OCTAL		59
  ------------------
  |  Branch (875:2): [True: 0, False: 636k]
  ------------------
  876|  78.7k|		if (m->reln == '=' || m->reln == '!') {
  ------------------
  |  Branch (876:7): [True: 27.8k, False: 50.9k]
  |  Branch (876:25): [True: 1.39k, False: 49.5k]
  ------------------
  877|  29.2k|			o = ms->offset + m->vallen;
  878|  49.5k|		} else {
  879|  49.5k|			union VALUETYPE *p = &ms->ms_value;
  880|       |
  881|  49.5k|			if (*m->value.s == '\0')
  ------------------
  |  Branch (881:8): [True: 42.1k, False: 7.38k]
  ------------------
  882|  42.1k|				p->s[strcspn(p->s, "\r\n")] = '\0';
  883|  49.5k|			o = CAST(uint32_t, (ms->offset + strlen(p->s)));
  ------------------
  |  |  444|  49.5k|#define CAST(T, b)	((T)(b))
  ------------------
  884|  49.5k|			if (m->type == FILE_PSTRING) {
  ------------------
  |  |  253|  49.5k|#define				FILE_PSTRING		13
  ------------------
  |  Branch (884:8): [True: 1.40k, False: 48.1k]
  ------------------
  885|  1.40k|				size_t l = file_pstring_length_size(ms, m);
  886|  1.40k|				if (l == FILE_BADSIZE)
  ------------------
  |  |  175|  1.40k|#define FILE_BADSIZE CAST(size_t, ~0ul)
  |  |  ------------------
  |  |  |  |  444|  1.40k|#define CAST(T, b)	((T)(b))
  |  |  ------------------
  ------------------
  |  Branch (886:9): [True: 0, False: 1.40k]
  ------------------
  887|      0|					return -1;
  888|  1.40k|				o += CAST(uint32_t, l);
  ------------------
  |  |  444|  1.40k|#define CAST(T, b)	((T)(b))
  ------------------
  889|  1.40k|			}
  890|  49.5k|		}
  891|  78.7k|		break;
  892|       |
  893|  78.7k|	case FILE_DATE:
  ------------------
  |  |  246|      0|#define				FILE_DATE		6
  ------------------
  |  Branch (893:2): [True: 0, False: 636k]
  ------------------
  894|     52|	case FILE_BEDATE:
  ------------------
  |  |  249|     52|#define				FILE_BEDATE		9
  ------------------
  |  Branch (894:2): [True: 52, False: 636k]
  ------------------
  895|    164|	case FILE_LEDATE:
  ------------------
  |  |  252|    164|#define				FILE_LEDATE		12
  ------------------
  |  Branch (895:2): [True: 112, False: 636k]
  ------------------
  896|    260|	case FILE_MEDATE:
  ------------------
  |  |  261|    260|#define				FILE_MEDATE		21
  ------------------
  |  Branch (896:2): [True: 96, False: 636k]
  ------------------
  897|    260|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  444|    260|#define CAST(T, b)	((T)(b))
  ------------------
  898|    260|		break;
  899|       |
  900|      0|	case FILE_LDATE:
  ------------------
  |  |  254|      0|#define				FILE_LDATE		14
  ------------------
  |  Branch (900:2): [True: 0, False: 636k]
  ------------------
  901|    144|	case FILE_BELDATE:
  ------------------
  |  |  255|    144|#define				FILE_BELDATE		15
  ------------------
  |  Branch (901:2): [True: 144, False: 636k]
  ------------------
  902|    178|	case FILE_LELDATE:
  ------------------
  |  |  256|    178|#define				FILE_LELDATE		16
  ------------------
  |  Branch (902:2): [True: 34, False: 636k]
  ------------------
  903|    178|	case FILE_MELDATE:
  ------------------
  |  |  262|    178|#define				FILE_MELDATE		22
  ------------------
  |  Branch (903:2): [True: 0, False: 636k]
  ------------------
  904|    178|		o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
  ------------------
  |  |  444|    178|#define CAST(T, b)	((T)(b))
  ------------------
  905|    178|		break;
  906|       |
  907|      0|	case FILE_QDATE:
  ------------------
  |  |  267|      0|#define				FILE_QDATE		27
  ------------------
  |  Branch (907:2): [True: 0, False: 636k]
  ------------------
  908|    142|	case FILE_BEQDATE:
  ------------------
  |  |  269|    142|#define				FILE_BEQDATE		29
  ------------------
  |  Branch (908:2): [True: 142, False: 636k]
  ------------------
  909|    231|	case FILE_LEQDATE:
  ------------------
  |  |  268|    231|#define				FILE_LEQDATE		28
  ------------------
  |  Branch (909:2): [True: 89, False: 636k]
  ------------------
  910|    231|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  444|    231|#define CAST(T, b)	((T)(b))
  ------------------
  911|    231|		break;
  912|       |
  913|      0|	case FILE_QLDATE:
  ------------------
  |  |  270|      0|#define				FILE_QLDATE		30
  ------------------
  |  Branch (913:2): [True: 0, False: 636k]
  ------------------
  914|      0|	case FILE_BEQLDATE:
  ------------------
  |  |  272|      0|#define				FILE_BEQLDATE		32
  ------------------
  |  Branch (914:2): [True: 0, False: 636k]
  ------------------
  915|     20|	case FILE_LEQLDATE:
  ------------------
  |  |  271|     20|#define				FILE_LEQLDATE		31
  ------------------
  |  Branch (915:2): [True: 20, False: 636k]
  ------------------
  916|     20|		o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
  ------------------
  |  |  444|     20|#define CAST(T, b)	((T)(b))
  ------------------
  917|     20|		break;
  918|       |
  919|      0|  	case FILE_FLOAT:
  ------------------
  |  |  273|      0|#define				FILE_FLOAT		33
  ------------------
  |  Branch (919:4): [True: 0, False: 636k]
  ------------------
  920|      0|  	case FILE_BEFLOAT:
  ------------------
  |  |  274|      0|#define				FILE_BEFLOAT		34
  ------------------
  |  Branch (920:4): [True: 0, False: 636k]
  ------------------
  921|    285|  	case FILE_LEFLOAT:
  ------------------
  |  |  275|    285|#define				FILE_LEFLOAT		35
  ------------------
  |  Branch (921:4): [True: 285, False: 635k]
  ------------------
  922|    285|		o = CAST(int32_t, (ms->offset + sizeof(float)));
  ------------------
  |  |  444|    285|#define CAST(T, b)	((T)(b))
  ------------------
  923|    285|		break;
  924|       |
  925|      0|  	case FILE_DOUBLE:
  ------------------
  |  |  276|      0|#define				FILE_DOUBLE		36
  ------------------
  |  Branch (925:4): [True: 0, False: 636k]
  ------------------
  926|      0|  	case FILE_BEDOUBLE:
  ------------------
  |  |  277|      0|#define				FILE_BEDOUBLE		37
  ------------------
  |  Branch (926:4): [True: 0, False: 636k]
  ------------------
  927|    286|  	case FILE_LEDOUBLE:
  ------------------
  |  |  278|    286|#define				FILE_LEDOUBLE		38
  ------------------
  |  Branch (927:4): [True: 286, False: 635k]
  ------------------
  928|    286|		o = CAST(int32_t, (ms->offset + sizeof(double)));
  ------------------
  |  |  444|    286|#define CAST(T, b)	((T)(b))
  ------------------
  929|    286|		break;
  930|       |
  931|  1.21k|	case FILE_REGEX:
  ------------------
  |  |  257|  1.21k|#define				FILE_REGEX		17
  ------------------
  |  Branch (931:2): [True: 1.21k, False: 634k]
  ------------------
  932|  1.21k|		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  375|  1.21k|#define str_flags _u._s._flags
  ------------------
              		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  393|  1.21k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  388|  1.21k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (932:7): [True: 43, False: 1.17k]
  ------------------
  933|     43|			o = CAST(int32_t, ms->search.offset);
  ------------------
  |  |  444|     43|#define CAST(T, b)	((T)(b))
  ------------------
  934|  1.17k|		else
  935|  1.17k|			o = CAST(int32_t,
  ------------------
  |  |  444|  1.17k|#define CAST(T, b)	((T)(b))
  ------------------
  936|  1.21k|			    (ms->search.offset + ms->search.rm_len));
  937|  1.21k|		break;
  938|       |
  939|  6.64k|	case FILE_SEARCH:
  ------------------
  |  |  260|  6.64k|#define				FILE_SEARCH		20
  ------------------
  |  Branch (939:2): [True: 6.64k, False: 629k]
  ------------------
  940|  6.64k|		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  375|  6.64k|#define str_flags _u._s._flags
  ------------------
              		if ((m->str_flags & REGEX_OFFSET_START) != 0)
  ------------------
  |  |  393|  6.64k|#define REGEX_OFFSET_START			BIT(4)
  |  |  ------------------
  |  |  |  |  388|  6.64k|#define BIT(A)   (1 << (A))
  |  |  ------------------
  ------------------
  |  Branch (940:7): [True: 93, False: 6.55k]
  ------------------
  941|     93|			o = CAST(int32_t, ms->search.offset);
  ------------------
  |  |  444|     93|#define CAST(T, b)	((T)(b))
  ------------------
  942|  6.55k|		else
  943|  6.55k|			o = CAST(int32_t, (ms->search.offset + m->vallen));
  ------------------
  |  |  444|  6.55k|#define CAST(T, b)	((T)(b))
  ------------------
  944|  6.64k|		break;
  945|       |
  946|    249|	case FILE_CLEAR:
  ------------------
  |  |  287|    249|#define				FILE_CLEAR		47
  ------------------
  |  Branch (946:2): [True: 249, False: 635k]
  ------------------
  947|  5.24k|	case FILE_DEFAULT:
  ------------------
  |  |  243|  5.24k|#define				FILE_DEFAULT		3
  ------------------
  |  Branch (947:2): [True: 4.99k, False: 631k]
  ------------------
  948|  18.2k|	case FILE_INDIRECT:
  ------------------
  |  |  281|  18.2k|#define				FILE_INDIRECT		41
  ------------------
  |  Branch (948:2): [True: 13.0k, False: 623k]
  ------------------
  949|  18.2k|	case FILE_OFFSET:
  ------------------
  |  |  290|  18.2k|#define				FILE_OFFSET		50
  ------------------
  |  Branch (949:2): [True: 0, False: 636k]
  ------------------
  950|  49.9k|	case FILE_USE:
  ------------------
  |  |  286|  49.9k|#define				FILE_USE		46
  ------------------
  |  Branch (950:2): [True: 31.7k, False: 604k]
  ------------------
  951|  49.9k|		o = ms->offset;
  952|  49.9k|		break;
  953|       |
  954|  31.0k|	case FILE_DER:
  ------------------
  |  |  288|  31.0k|#define				FILE_DER		48
  ------------------
  |  Branch (954:2): [True: 31.0k, False: 605k]
  ------------------
  955|  31.0k|		o = der_offs(ms, m, nbytes);
  956|  31.0k|		if (o == -1 || CAST(size_t, o) > nbytes) {
  ------------------
  |  |  444|  31.0k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (956:7): [True: 0, False: 31.0k]
  |  Branch (956:18): [True: 0, False: 31.0k]
  ------------------
  957|      0|			if ((ms->flags & MAGIC_DEBUG) != 0) {
  ------------------
  |  |   33|      0|#define	MAGIC_DEBUG		0x0000001 /* Turn on debugging */
  ------------------
  |  Branch (957:8): [True: 0, False: 0]
  ------------------
  958|      0|				(void)fprintf(stderr,
  959|      0|				    "Bad DER offset %d nbytes=%"
  960|      0|				    SIZE_T_FORMAT "u", o, nbytes);
  961|      0|			}
  962|      0|			*op = 0;
  963|      0|			return 0;
  964|      0|		}
  965|  31.0k|		break;
  966|       |
  967|  31.0k|	case FILE_GUID:
  ------------------
  |  |  289|    369|#define				FILE_GUID		49
  ------------------
  |  Branch (967:2): [True: 369, False: 635k]
  ------------------
  968|    369|		o = CAST(int32_t, (ms->offset + 2 * sizeof(uint64_t)));
  ------------------
  |  |  444|    369|#define CAST(T, b)	((T)(b))
  ------------------
  969|    369|		break;
  970|       |
  971|  54.5k|	default:
  ------------------
  |  Branch (971:2): [True: 54.5k, False: 581k]
  ------------------
  972|  54.5k|		o = 0;
  973|  54.5k|		break;
  974|   636k|	}
  975|       |
  976|   636k|	if (CAST(size_t, o) > nbytes) {
  ------------------
  |  |  444|   636k|#define CAST(T, b)	((T)(b))
  ------------------
  |  Branch (976:6): [True: 26.6k, False: 609k]
  ------------------
  977|       |#if 0
  978|       |		file_error(ms, 0, "Offset out of range %" SIZE_T_FORMAT
  979|       |		    "u > %" SIZE_T_FORMAT "u", (size_t)o, nbytes);
  980|       |#endif
  981|  26.6k|		return -1;
  982|  26.6k|	}
  983|   609k|	*op = o;
  984|   609k|	return 1;
  985|   636k|}

strlcpy:
   35|   153k|{
   36|   153k|	char *d = dst;
   37|   153k|	const char *s = src;
   38|   153k|	size_t n = siz;
   39|       |
   40|       |	/* Copy as many bytes as will fit */
   41|   153k|	if (n != 0 && --n != 0) {
  ------------------
  |  Branch (41:6): [True: 153k, False: 0]
  |  Branch (41:16): [True: 153k, False: 0]
  ------------------
   42|   747k|		do {
   43|   747k|			if ((*d++ = *s++) == 0)
  ------------------
  |  Branch (43:8): [True: 153k, False: 594k]
  ------------------
   44|   153k|				break;
   45|   747k|		} while (--n != 0);
  ------------------
  |  Branch (45:12): [True: 594k, False: 34]
  ------------------
   46|   153k|	}
   47|       |
   48|       |	/* Not enough room in dst, add NUL and traverse rest of src */
   49|   153k|	if (n == 0) {
  ------------------
  |  Branch (49:6): [True: 34, False: 153k]
  ------------------
   50|     34|		if (siz != 0)
  ------------------
  |  Branch (50:7): [True: 34, False: 0]
  ------------------
   51|     34|			*d = '\0';		/* NUL-terminate dst */
   52|     34|		while (*s++)
  ------------------
  |  Branch (52:10): [True: 0, False: 34]
  ------------------
   53|      0|			;
   54|     34|	}
   55|       |
   56|   153k|	return(s - src - 1);	/* count does not include NUL */
   57|   153k|}

LLVMFuzzerInitialize:
   39|      2|extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) {
   40|      2|  char* exe_path = (*argv)[0];
   41|       |  // dirname() can modify its argument.
   42|      2|  char* exe_path_copy = strdup(exe_path);
   43|      2|  char* dir = dirname(exe_path_copy);
   44|      2|  env = new Environment(dir);
   45|      2|  free(exe_path_copy);
   46|      2|  return 0;
   47|      2|}
LLVMFuzzerTestOneInput:
   49|  7.45k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   50|  7.45k|  if (size < 1)
  ------------------
  |  Branch (50:7): [True: 0, False: 7.45k]
  ------------------
   51|      0|    return 0;
   52|  7.45k|  magic_buffer(env->magic, data, size);
   53|  7.45k|  return 0;
   54|  7.45k|}
_ZN11EnvironmentC2ENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   25|      2|  Environment(std::string data_dir) {
   26|      2|    magic = magic_open(MAGIC_COMPRESS|MAGIC_CONTINUE|MAGIC_NO_COMPRESS_FORK);
  ------------------
  |  |   35|      2|#define	MAGIC_COMPRESS		0x0000004 /* Check inside compressed files */
  ------------------
                  magic = magic_open(MAGIC_COMPRESS|MAGIC_CONTINUE|MAGIC_NO_COMPRESS_FORK);
  ------------------
  |  |   38|      2|#define	MAGIC_CONTINUE		0x0000020 /* Return all matches */
  ------------------
                  magic = magic_open(MAGIC_COMPRESS|MAGIC_CONTINUE|MAGIC_NO_COMPRESS_FORK);
  ------------------
  |  |   50|      2|#define MAGIC_NO_COMPRESS_FORK	0x4000000 /* Don't allow decompression that
  ------------------
   27|      2|    std::string magic_path = data_dir + "/magic";
   28|      2|    if (magic_load(magic, magic_path.c_str())) {
  ------------------
  |  Branch (28:9): [True: 0, False: 2]
  ------------------
   29|      0|      fprintf(stderr, "error loading magic file: %s\n", magic_error(magic));
   30|      0|      exit(1);
   31|      0|    }
   32|      2|  }

