stm32 confusion on directly setting pin modes

I was wondering if anyone here could post an example on how to do pinMode(pin, mode) directly with stm32, I figured out "digitalRead(pin)" and "digitalWrite(pin, value)" by reading the documentation but I don't understand how to do pinMode();

This is digitalRead/Write

const uint8_t highBits = ((GPIOB->regs->IDR & 0xF0F0u) * 0x11u) >> 8; //digitalRead()
GPIOC->regs->ODR &= ~(1 << 13); //digitalWrite(13, LOW)

So lets say pin at port C (like above) I want to set to OUTPUT how might I do so?

Edit: I managed to find an example after forever, for anyone else interested heres an example

	//Set pins 0-7 to input 
	GPIOA->regs->CRL = 0x88888888;
	//Set pins 8-10 and 13-15 to input leave 11-12 as they are
	GPIOA->regs->CRH = 0x888FF888;

source code is available in github, could provide some insights