yr_initialize:
  242|      1|{
  243|      1|  YR_DEBUG_FPRINTF(2, stderr, "+ %s() {\n", __FUNCTION__);
  244|       |
  245|      1|  uint32_t def_stack_size = DEFAULT_STACK_SIZE;
  ------------------
  |  |   81|      1|#define DEFAULT_STACK_SIZE               16384
  ------------------
  246|      1|  uint32_t def_max_strings_per_rule = DEFAULT_MAX_STRINGS_PER_RULE;
  ------------------
  |  |   82|      1|#define DEFAULT_MAX_STRINGS_PER_RULE     10000
  ------------------
  247|      1|  uint32_t def_max_match_data = DEFAULT_MAX_MATCH_DATA;
  ------------------
  |  |   83|      1|#define DEFAULT_MAX_MATCH_DATA           512
  ------------------
  248|      1|  uint64_t def_max_process_memory_chunk = DEFAULT_MAX_PROCESS_MEMORY_CHUNK;
  ------------------
  |  |   84|      1|#define DEFAULT_MAX_PROCESS_MEMORY_CHUNK 1073741824
  ------------------
  249|       |
  250|      1|  init_count++;
  251|       |
  252|      1|  if (init_count > 1)
  ------------------
  |  Branch (252:7): [True: 0, False: 1]
  ------------------
  253|      0|    return ERROR_SUCCESS;
  ------------------
  |  |   40|      0|#define ERROR_SUCCESS 0
  ------------------
  254|       |
  255|       |  // Initialize random number generator, as it is used for generating object
  256|       |  // canaries.
  257|      1|  srand((unsigned) time(NULL));
  258|       |
  259|    257|  for (int i = 0; i < 256; i++)
  ------------------
  |  Branch (259:19): [True: 256, False: 1]
  ------------------
  260|    256|  {
  261|    256|    if (i >= 'a' && i <= 'z')
  ------------------
  |  Branch (261:9): [True: 159, False: 97]
  |  Branch (261:21): [True: 26, False: 133]
  ------------------
  262|     26|      yr_altercase[i] = i - 32;
  263|    230|    else if (i >= 'A' && i <= 'Z')
  ------------------
  |  Branch (263:14): [True: 165, False: 65]
  |  Branch (263:26): [True: 26, False: 139]
  ------------------
  264|     26|      yr_altercase[i] = i + 32;
  265|    204|    else
  266|    204|      yr_altercase[i] = i;
  267|       |
  268|    256|    yr_lowercase[i] = tolower(i);
  ------------------
  |  Branch (268:23): [True: 0, False: 0]
  |  Branch (268:23): [True: 0, False: 256]
  |  Branch (268:23): [True: 256, Folded]
  ------------------
  269|    256|  }
  270|       |
  271|      1|  FAIL_ON_ERROR(yr_heap_alloc());
  ------------------
  |  |  134|      1|  {                               \
  |  |  135|      1|    int __error = (x);            \
  |  |  136|      1|    if (__error != ERROR_SUCCESS) \
  |  |  ------------------
  |  |  |  |   40|      1|#define ERROR_SUCCESS 0
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  137|      1|      return __error;             \
  |  |  138|      1|  }
  ------------------
  272|      1|  FAIL_ON_ERROR(yr_thread_storage_create(&yr_yyfatal_trampoline_tls));
  ------------------
  |  |  134|      1|  {                               \
  |  |  135|      1|    int __error = (x);            \
  |  |  136|      1|    if (__error != ERROR_SUCCESS) \
  |  |  ------------------
  |  |  |  |   40|      1|#define ERROR_SUCCESS 0
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  137|      1|      return __error;             \
  |  |  138|      1|  }
  ------------------
  273|      1|  FAIL_ON_ERROR(yr_thread_storage_create(&yr_trycatch_trampoline_tls));
  ------------------
  |  |  134|      1|  {                               \
  |  |  135|      1|    int __error = (x);            \
  |  |  136|      1|    if (__error != ERROR_SUCCESS) \
  |  |  ------------------
  |  |  |  |   40|      1|#define ERROR_SUCCESS 0
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  137|      1|      return __error;             \
  |  |  138|      1|  }
  ------------------
  274|       |
  275|       |#if defined HAVE_LIBCRYPTO && OPENSSL_VERSION_NUMBER < 0x10100000L
  276|       |
  277|       |  openssl_locks = (YR_MUTEX *) OPENSSL_malloc(
  278|       |      CRYPTO_num_locks() * sizeof(YR_MUTEX));
  279|       |
  280|       |  for (int i = 0; i < CRYPTO_num_locks(); i++)
  281|       |    yr_mutex_create(&openssl_locks[i]);
  282|       |
  283|       |  CRYPTO_THREADID_set_callback(_thread_id);
  284|       |  CRYPTO_set_locking_callback(_locking_function);
  285|       |
  286|       |#elif defined(HAVE_WINCRYPT_H)
  287|       |
  288|       |  if (!CryptAcquireContext(
  289|       |          &yr_cryptprov, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
  290|       |  {
  291|       |    return ERROR_INTERNAL_FATAL_ERROR;
  292|       |  }
  293|       |
  294|       |#elif defined(HAVE_COMMON_CRYPTO)
  295|       |
  296|       |  ...
  297|       |
  298|       |#endif
  299|       |
  300|      1|  FAIL_ON_ERROR(yr_modules_initialize());
  ------------------
  |  |  134|      1|  {                               \
  |  |  135|      1|    int __error = (x);            \
  |  |  136|      1|    if (__error != ERROR_SUCCESS) \
  |  |  ------------------
  |  |  |  |   40|      1|#define ERROR_SUCCESS 0
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  137|      1|      return __error;             \
  |  |  138|      1|  }
  ------------------
  301|       |
  302|       |  // Initialize default configuration options
  303|       |
  304|      1|  FAIL_ON_ERROR(yr_set_configuration(YR_CONFIG_STACK_SIZE, &def_stack_size));
  ------------------
  |  |  134|      1|  {                               \
  |  |  135|      1|    int __error = (x);            \
  |  |  136|      1|    if (__error != ERROR_SUCCESS) \
  |  |  ------------------
  |  |  |  |   40|      1|#define ERROR_SUCCESS 0
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  137|      1|      return __error;             \
  |  |  138|      1|  }
  ------------------
  305|       |
  306|      1|  FAIL_ON_ERROR(yr_set_configuration(
  ------------------
  |  |  134|      1|  {                               \
  |  |  135|      1|    int __error = (x);            \
  |  |  136|      1|    if (__error != ERROR_SUCCESS) \
  |  |  ------------------
  |  |  |  |   40|      1|#define ERROR_SUCCESS 0
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  137|      1|      return __error;             \
  |  |  138|      1|  }
  ------------------
  307|      1|      YR_CONFIG_MAX_STRINGS_PER_RULE, &def_max_strings_per_rule));
  308|       |
  309|      1|  FAIL_ON_ERROR(yr_set_configuration(
  ------------------
  |  |  134|      1|  {                               \
  |  |  135|      1|    int __error = (x);            \
  |  |  136|      1|    if (__error != ERROR_SUCCESS) \
  |  |  ------------------
  |  |  |  |   40|      1|#define ERROR_SUCCESS 0
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  137|      1|      return __error;             \
  |  |  138|      1|  }
  ------------------
  310|      1|      YR_CONFIG_MAX_PROCESS_MEMORY_CHUNK, &def_max_process_memory_chunk));
  311|       |
  312|      1|  FAIL_ON_ERROR(
  ------------------
  |  |  134|      1|  {                               \
  |  |  135|      1|    int __error = (x);            \
  |  |  136|      1|    if (__error != ERROR_SUCCESS) \
  |  |  ------------------
  |  |  |  |   40|      1|#define ERROR_SUCCESS 0
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 1]
  |  |  ------------------
  |  |  137|      1|      return __error;             \
  |  |  138|      1|  }
  ------------------
  313|      1|      yr_set_configuration(YR_CONFIG_MAX_MATCH_DATA, &def_max_match_data));
  314|       |
  315|      1|  YR_DEBUG_FPRINTF(2, stderr, "} // %s()\n", __FUNCTION__);
  316|       |
  317|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
  318|      1|}
yr_set_configuration:
  396|      4|{
  397|      4|  if (src == NULL)
  ------------------
  |  Branch (397:7): [True: 0, False: 4]
  ------------------
  398|      0|    return ERROR_INTERNAL_FATAL_ERROR;
  ------------------
  |  |   78|      0|#define ERROR_INTERNAL_FATAL_ERROR           31
  ------------------
  399|       |
  400|      4|  switch (name)
  401|      4|  {  // lump all the cases using same types together in one cascade
  402|      1|  case YR_CONFIG_STACK_SIZE:
  ------------------
  |  Branch (402:3): [True: 1, False: 3]
  ------------------
  403|      2|  case YR_CONFIG_MAX_STRINGS_PER_RULE:
  ------------------
  |  Branch (403:3): [True: 1, False: 3]
  ------------------
  404|      3|  case YR_CONFIG_MAX_MATCH_DATA:
  ------------------
  |  Branch (404:3): [True: 1, False: 3]
  ------------------
  405|      3|    yr_cfgs[name].ui32 = *(uint32_t *) src;
  406|      3|    break;
  407|       |
  408|      1|  case YR_CONFIG_MAX_PROCESS_MEMORY_CHUNK:
  ------------------
  |  Branch (408:3): [True: 1, False: 3]
  ------------------
  409|      1|    yr_cfgs[name].ui64 = *(uint64_t *) src;
  410|      1|    break;
  411|       |
  412|      0|  default:
  ------------------
  |  Branch (412:3): [True: 0, False: 4]
  ------------------
  413|      0|    return ERROR_INTERNAL_FATAL_ERROR;
  ------------------
  |  |   78|      0|#define ERROR_INTERNAL_FATAL_ERROR           31
  ------------------
  414|      4|  }
  415|       |
  416|      4|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      4|#define ERROR_SUCCESS 0
  ------------------
  417|      4|}

yr_heap_alloc:
  120|      1|{
  121|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
  122|      1|}

yr_modules_initialize:
   64|      1|{
   65|     11|  for (YR_MODULE* module = yr_modules_table; module->initialize != NULL;
  ------------------
  |  Branch (65:46): [True: 10, False: 1]
  ------------------
   66|     10|       module++)
   67|     10|  {
   68|     10|    int result = module->initialize(module);
   69|       |
   70|     10|    if (result != ERROR_SUCCESS)
  ------------------
  |  |   40|     10|#define ERROR_SUCCESS 0
  ------------------
  |  Branch (70:9): [True: 0, False: 10]
  ------------------
   71|      0|      return result;
   72|     10|  }
   73|       |
   74|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
   75|      1|}

console__initialize:
  260|      1|{
  261|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
  262|      1|}

dex__initialize:
 1451|      1|{
 1452|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
 1453|      1|}

dotnet__initialize:
 3487|      1|{
 3488|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
 3489|      1|}

elf__initialize:
 1005|      1|{
 1006|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
 1007|      1|}

macho__initialize:
 1363|      1|{
 1364|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
 1365|      1|}

math__initialize:
  816|      1|{
  817|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
  818|      1|}

pe__initialize:
 4008|      1|{
 4009|       |#if defined(HAVE_LIBCRYPTO) && !defined(BORINGSSL)
 4010|       |  // Initialize OpenSSL global objects for the auth library before any
 4011|       |  // multithreaded environment as it is not thread-safe. This can
 4012|       |  // only be called once per process.
 4013|       |  static bool s_initialized = false;
 4014|       |
 4015|       |  if (!s_initialized)
 4016|       |  {
 4017|       |    s_initialized = true;
 4018|       |    initialize_authenticode_parser();
 4019|       |  }
 4020|       |#endif
 4021|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
 4022|      1|}

string__initialize:
  103|      1|{
  104|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
  105|      1|}

tests__initialize:
  158|      1|{
  159|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
  160|      1|}

time__initialize:
   51|      1|{
   52|      1|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      1|#define ERROR_SUCCESS 0
  ------------------
   53|      1|}

yr_thread_storage_create:
  160|      2|{
  161|      2|  if (pthread_key_create(storage, NULL) != 0)
  ------------------
  |  Branch (161:7): [True: 0, False: 2]
  ------------------
  162|      0|    return ERROR_INTERNAL_FATAL_ERROR;
  ------------------
  |  |   78|      0|#define ERROR_INTERNAL_FATAL_ERROR           31
  ------------------
  163|       |
  164|      2|  return ERROR_SUCCESS;
  ------------------
  |  |   40|      2|#define ERROR_SUCCESS 0
  ------------------
  165|      2|}

LLVMFuzzerInitialize:
   37|      1|{
   38|      1|  yr_initialize();
   39|      1|  return 0;
   40|      1|}

