#include <stdio.h>
#include <stdint.h>
uint32_t set_baud_rate(uint32_t reg, uint8_t baud) {
// Your code here
// Step 1: Clear bits 8 to 11
uint32_t clear_mask = ~(15 << 8); // 15 = 0b1111 → 4 bits
reg = reg & clear_mask;
// Step 2: Insert new baud value at position 8
baud = baud & 15; // make sure only 4 bits are used
reg = reg | (baud << 8);
return reg;
}
int main() {
uint32_t reg;
uint8_t baud;
scanf("%u %hhu", ®, &baud);
printf("%u", set_baud_rate(reg, baud));
return 0;
}