#include<stdint.h>

#define RCC_ENR (*(int*)0x40021034)
#define GPIOA_MODER (*(int*)0x50000000)
#define GPIOC_MODER (*(int*)0x50000800)
#define GPIOA_ODR (*(int*)0x50000014)
#define GPIOC_IDR (*(int*)0x50000810)

int main(void)
{

  //enable the RCC
  RCC_ENR |= (1 << 0); // = 5
  RCC_ENR |= (1 << 2);  // 0000 0100
  
  //configure GPIO A
  GPIOA_MODER &= ~(3 << 18); //111001111111 clear 19 already 0
  GPIOA_MODER |= (1 << 18);

  //configure GPIO C
  GPIOC_MODER &=  ~(3 << 26);

  //loop
  while(1)
  {

    int input = GPIOC_IDR &= (1<<13);

    if (input == 0)
    {
      GPIOA_ODR &= ~(1 << 9);
    }
    else
    {
      GPIOA_ODR |= (1 << 9);
    }

  }
  return 0;
 
}