#include <stdio.h>
#include <stdint.h>
typedef union {
uint16_t ALL;
// 2. Access individual bits
struct {
uint16_t MODE : 3; // Bits 0-2
uint16_t Speed : 5; // Bits 3-7
uint16_t RESERVED : 2; // Bit 8-9
uint16_t STATUS : 6 ; // Bits 10-15
} BITS;
} ControlRegister_t;
uint16_t pack_register(uint8_t mode, uint8_t speed, uint8_t status) {
// Your logic here
ControlRegister_t reg;
reg.BITS.MODE=mode;
reg.BITS.Speed=speed;
reg.BITS.STATUS=status;
return reg.ALL;
}
int main() {
uint8_t mode, speed, status;
scanf("%hhu %hhu %hhu", &mode, &speed, &status);
uint16_t reg = pack_register(mode, speed, status);
printf("%u", reg);
return 0;
}