Manipulating esp8266 pins with registers

Why do you want to do that ?
If you have to ask, then you should not do that :thinking:

For example, the digitalWrite function is in the file core_esp8266_wiring_digital.cpp and is this:

extern void IRAM_ATTR __digitalWrite(uint8_t pin, uint8_t val) {
  stopWaveform(pin); // Disable any Tone or startWaveform on this pin
  _stopPWM(pin);     // and any analogWrites (PWM)
  if(pin < 16){
    if(val) GPOS = (1 << pin);
    else GPOC = (1 << pin);
  } else if(pin == 16){
    if(val) GP16O |= 1;
    else GP16O &= ~1;
  }
}

Have also a look a the pinMode() function. If you think you can do better than that, then I can not help you.