#include <stdio.h>
#include <stdint.h>
#define SET_BIT(REG, POS) ((REG) |= (1 << (POS)))
#define CLEAR_BIT(REG, POS) ((REG) &= ~(1 << (POS)))
#define TOGGLE_BIT(REG, POS) ((REG) ^= (1 << (POS)))
inline void set_bit(uint8_t* reg, uint8_t pos)
{
*reg |= (1 << pos);
}
inline void clear_bit(uint8_t* reg, uint8_t pos)
{
*reg &= ~(1 << pos);
}
inline void toggle_bit(uint8_t* reg, uint8_t pos)
{
*reg ^= (1 << pos);
}
// Define bitwise macros here
uint8_t modify_register(uint8_t reg) {
// Apply operations in order
set_bit(®, 2);
set_bit(®, 7);
clear_bit(®, 3);
toggle_bit(®, 5);
return reg;
}
int main() {
uint8_t reg;
scanf("%hhu", ®);
printf("%u", modify_register(reg));
return 0;
}
Input
0
Expected Output
164