Use PIN from C native

Dear Community,

Is it possible to use PINs in a C native subroutine?
On ESP32, I’d need to read the PIN faster than PY is able to. Meaning that, the following code is still too slow to get proper data stream where low/high value changes in a few microsecs:

for x in range(0,400):

Ty in advance.

It is possible to access and manipulate the bits in C language using the GPIO Functions in C language.

I might add a suggestion but i’m not sure if it is going to be faster, You can use interrupts in C language and append the state in the interrupt service routine. Check this.

Thanks for the quick help, this is exactly what I looked for.
You were right; checking its speed with hw timers in the C code, there is no significant increase in performance.