LLVMFuzzerTestOneInput:
   35|     77|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   36|     77|    if (size < 2) return 0;
  ------------------
  |  Branch (36:9): [True: 1, False: 76]
  ------------------
   37|       |
   38|     76|    const uint8_t* payload = data;
   39|     76|    size_t payload_len = size;
   40|       |
   41|     76|    if (!validate_nsm_msg_length(payload, payload_len)) {
  ------------------
  |  Branch (41:9): [True: 3, False: 73]
  ------------------
   42|      3|        return 0;
   43|      3|    }
   44|       |
   45|     73|    const struct nsm_msg* msg = reinterpret_cast<const struct nsm_msg*>(payload);
   46|     73|    const struct nsm_msg_hdr* hdr = reinterpret_cast<const struct nsm_msg_hdr*>(payload);
   47|       |
   48|       |    // Mismatch prevention: verify request/response type
   49|     73|    if (hdr->request != false) {
  ------------------
  |  Branch (49:9): [True: 10, False: 63]
  ------------------
   50|     10|        return 0;
   51|     10|    }
   52|       |
   53|     63|    std::vector<uint8_t> out_buf(65536, 0);
   54|     63|    uint8_t fuzz_cc = 0;
   55|     63|    uint16_t fuzz_reason_code = 0;
   56|     63|    decode_reason_code_and_cc(msg, payload_len, &fuzz_cc, &fuzz_reason_code);
   57|       |
   58|     63|    return 0;
   59|     73|}

_Z23validate_nsm_msg_lengthPKhm:
   27|     76|inline bool validate_nsm_msg_length(const uint8_t* payload, size_t payload_len) {
   28|     76|    return payload_len >= sizeof(struct nsm_msg_hdr);
   29|     76|}

decode_reason_code_and_cc:
  705|     63|{
  706|     63|	if (msg == NULL || cc == NULL || reason_code == NULL) {
  ------------------
  |  Branch (706:6): [True: 0, False: 63]
  |  Branch (706:21): [True: 0, False: 63]
  |  Branch (706:35): [True: 0, False: 63]
  ------------------
  707|      0|		return NSM_SW_ERROR_NULL;
  708|      0|	}
  709|       |
  710|     63|	*cc = ((struct nsm_common_resp *)msg->payload)->completion_code;
  711|     63|	if (*cc == NSM_SUCCESS || *cc == NSM_ACCEPTED) {
  ------------------
  |  Branch (711:6): [True: 9, False: 54]
  |  Branch (711:28): [True: 1, False: 53]
  ------------------
  712|     10|		return NSM_SW_SUCCESS;
  713|     10|	}
  714|       |
  715|     53|	if (msg_len != (sizeof(struct nsm_msg_hdr) +
  ------------------
  |  Branch (715:6): [True: 52, False: 1]
  ------------------
  716|     53|			sizeof(struct nsm_common_non_success_resp))) {
  717|     52|		return NSM_SW_ERROR_LENGTH;
  718|     52|	}
  719|       |
  720|      1|	struct nsm_common_non_success_resp *response =
  721|      1|	    (struct nsm_common_non_success_resp *)msg->payload;
  722|       |
  723|       |	// reason code is expected to be present if CC != NSM_SUCCESS
  724|      1|	*reason_code = le16toh(response->reason_code);
  725|       |
  726|      1|	return NSM_SW_SUCCESS;
  727|     53|}

