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

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

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

decode_nsm_provide_token_resp:
  196|     96|{
  197|     96|	if (msg == NULL || cc == NULL || reason_code == NULL) {
  ------------------
  |  Branch (197:6): [True: 0, False: 96]
  |  Branch (197:21): [True: 0, False: 96]
  |  Branch (197:35): [True: 0, False: 96]
  ------------------
  198|      0|		return NSM_SW_ERROR_NULL;
  199|      0|	}
  200|       |
  201|     96|	int rc = decode_reason_code_and_cc(msg, msg_len, cc, reason_code);
  202|     96|	if (rc != NSM_SW_SUCCESS || *cc != NSM_SUCCESS) {
  ------------------
  |  Branch (202:6): [True: 48, False: 48]
  |  Branch (202:30): [True: 8, False: 40]
  ------------------
  203|     56|		return rc;
  204|     56|	}
  205|       |
  206|     40|	if (msg_len <
  ------------------
  |  Branch (206:6): [True: 4, False: 36]
  ------------------
  207|     40|	    sizeof(struct nsm_msg_hdr) + sizeof(nsm_provide_token_resp)) {
  208|      4|		return NSM_SW_ERROR_LENGTH;
  209|      4|	}
  210|       |
  211|     36|	return NSM_SW_SUCCESS;
  212|     40|}

