static RzList /*<RzBinAddr *>*/ *dex_resolve_entrypoints_in_class(RzBinDex *dex, DexClassDef *class_def) {
	RzListIter *it;
	DexEncodedMethod *encoded_method = NULL;
	RzList *entrypoints = NULL;

	entrypoints = rz_list_newf((RzListFree)free);
	if (!entrypoints) {
		return NULL;
	}

	rz_list_foreach (class_def->direct_methods, it, encoded_method) {
		if (!dex_is_static(encoded_method->access_flags)) {
			// entrypoints are static
			continue;
		}

		if (encoded_method->method_idx >= rz_pvector_len(dex->method_ids)) {
			RZ_LOG_INFO("cannot find direct method with index %" PFMT64u "\n", encoded_method->method_idx);
			continue;
		}
		DexMethodId *method_id = (DexMethodId *)rz_pvector_at(dex->method_ids, encoded_method->method_idx);

		char *name = dex_resolve_string_id(dex, method_id->name_idx);
		if (!name) {
			continue;
		}

		if (strcmp(name, "main") != 0 && strcmp(name, "<init>") != 0 && strcmp(name, "<clinit>") != 0) {
			free(name);
			continue;
		}
		free(name);

		RzBinAddr *entrypoint = RZ_NEW0(RzBinAddr);
		if (!entrypoint) {
			break;
		}
		if (encoded_method->code_offset < RZ_DEX_RELOC_ADDRESS) {
			entrypoint->vaddr = RZ_DEX_VIRT_ADDRESS + encoded_method->code_offset;
			entrypoint->paddr = encoded_method->code_offset;
		} else {
			entrypoint->vaddr = encoded_method->code_offset;
			entrypoint->paddr = 0;
		}
		if (entrypoint && !rz_list_append(entrypoints, entrypoint)) {
			free(entrypoint);
		}
	}

	rz_list_foreach (class_def->virtual_methods, it, encoded_method) {
		if (!dex_is_static(encoded_method->access_flags)) {
			// entrypoints are static
			continue;
		}

		if (encoded_method->method_idx >= rz_pvector_len(dex->method_ids)) {
			RZ_LOG_INFO("cannot find virtual method with index %" PFMT64u "\n", encoded_method->method_idx);
			continue;
		}

		DexMethodId *method_id = (DexMethodId *)rz_pvector_at(dex->method_ids, encoded_method->method_idx);
		if (method_id->code_offset < 1) {
			// if there is no code, skip
			continue;
		}

		char *name = dex_resolve_string_id(dex, method_id->name_idx);
		if (!name) {
			continue;
		}

		if (strcmp(name, "main") != 0 && strcmp(name, "<init>") != 0 && strcmp(name, "<clinit>") != 0) {
			free(name);
			continue;
		}
		free(name);

		RzBinAddr *entrypoint = RZ_NEW0(RzBinAddr);
		if (!entrypoint) {
			break;
		}
		if (encoded_method->code_offset < RZ_DEX_RELOC_ADDRESS) {
			entrypoint->vaddr = RZ_DEX_VIRT_ADDRESS + encoded_method->code_offset;
			entrypoint->paddr = encoded_method->code_offset;
		} else {
			entrypoint->vaddr = encoded_method->code_offset;
			entrypoint->paddr = 0;
		}
		if (entrypoint && !rz_list_append(entrypoints, entrypoint)) {
			free(entrypoint);
		}
	}

	return entrypoints;
}
static RzList   *dex_resolve_entrypoints_in_class(RzBinDex *dex, DexClassDef *class_def) {
	RzListIter *it;
	DexEncodedMethod *encoded_method = NULL;
	RzList *entrypoints = NULL;

	entrypoints = rz_list_newf((RzListFree)free);
	if (!entrypoints) {
		return NULL;
	}

	rz_list_foreach (class_def->direct_methods, it, encoded_method) {
		if (!dex_is_static(encoded_method->access_flags)) {
			 
			continue;
		}

		if (encoded_method->method_idx >= rz_pvector_len(dex->method_ids)) {
			RZ_LOG_INFO("cannot find direct method with index %" PFMT64u "\n", encoded_method->method_idx);
			continue;
		}
		DexMethodId *method_id = (DexMethodId *)rz_pvector_at(dex->method_ids, encoded_method->method_idx);

		char *name = dex_resolve_string_id(dex, method_id->name_idx);
		if (!name) {
			continue;
		}

		if (strcmp(name, "main") != 0 && strcmp(name, "<init>") != 0 && strcmp(name, "<clinit>") != 0) {
			free(name);
			continue;
		}
		free(name);

		RzBinAddr *entrypoint = RZ_NEW0(RzBinAddr);
		if (!entrypoint) {
			break;
		}
		if (encoded_method->code_offset < RZ_DEX_RELOC_ADDRESS) {
			entrypoint->vaddr = RZ_DEX_VIRT_ADDRESS + encoded_method->code_offset;
			entrypoint->paddr = encoded_method->code_offset;
		} else {
			entrypoint->vaddr = encoded_method->code_offset;
			entrypoint->paddr = 0;
		}
		if (entrypoint && !rz_list_append(entrypoints, entrypoint)) {
			free(entrypoint);
		}
	}

	rz_list_foreach (class_def->virtual_methods, it, encoded_method) {
		if (!dex_is_static(encoded_method->access_flags)) {
			 
			continue;
		}

		if (encoded_method->method_idx >= rz_pvector_len(dex->method_ids)) {
			RZ_LOG_INFO("cannot find virtual method with index %" PFMT64u "\n", encoded_method->method_idx);
			continue;
		}

		DexMethodId *method_id = (DexMethodId *)rz_pvector_at(dex->method_ids, encoded_method->method_idx);
		if (method_id->code_offset < 1) {
			 
			continue;
		}

		char *name = dex_resolve_string_id(dex, method_id->name_idx);
		if (!name) {
			continue;
		}

		if (strcmp(name, "main") != 0 && strcmp(name, "<init>") != 0 && strcmp(name, "<clinit>") != 0) {
			free(name);
			continue;
		}
		free(name);

		RzBinAddr *entrypoint = RZ_NEW0(RzBinAddr);
		if (!entrypoint) {
			break;
		}
		if (encoded_method->code_offset < RZ_DEX_RELOC_ADDRESS) {
			entrypoint->vaddr = RZ_DEX_VIRT_ADDRESS + encoded_method->code_offset;
			entrypoint->paddr = encoded_method->code_offset;
		} else {
			entrypoint->vaddr = encoded_method->code_offset;
			entrypoint->paddr = 0;
		}
		if (entrypoint && !rz_list_append(entrypoints, entrypoint)) {
			free(entrypoint);
		}
	}

	return entrypoints;
}