c
char *endptr;
long int value = strtol(optarg, &endptr, 10);
if (endptr == optarg || *endptr != '\0') {
    handle_invalid_input_error();
}
if (value < INT_MIN || value > INT_MAX) {
    handle_out_of_range_error();
}
horizSubSampling = (int)value;

// Custom error handling functions
void handle_invalid_input_error() {
    // Handle error: input string is not a valid integer
}

void handle_out_of_range_error() {
    // Handle error: input value is outside the range of int
}
