#include <stdio.h>
typedef struct {
unsigned short reg;//an unsigned short integer (usually 16 bits)// ‘uint16_t’ is defined in header ‘<cstdint>’;
} ConfigRegister;
int validate_config(ConfigRegister *cfg) {
unsigned short buffer = (*cfg).reg;
if(buffer & 0x0001 != 1)
return 0;
unsigned short prority = (buffer>>2)&0x3;
if(prority ==3)// 11 is invalid
return 0;
if(buffer & 0xFFF0)
return 0;
return 1;
}
int main() {
ConfigRegister cfg;
scanf("%hx", &cfg.reg);
int result = validate_config(&cfg);
printf("%d", result);
return 0;
}