ESP32-s3 GPIO_IN_REG asm arduino Framework

Maybe someone can help me…
Reading the PIN 20 status works in C. (GPIO.in >> 20) & 1
But the same in asm doesn’t work. Where am I wrong?

Pin 20 is defined in C as an input.

.section .iram1,"ax"
.global     asmtest
.global     pin_stat
.type       asmtest,@function
.align      32

asmtest:
    entry a4, 16

    movi a10, 0x3FF4403C // GPIO_IN_REG
    l32i a11, a10, 0      
    srli a11,a11,20 // GPIO Pin 20 auf Bit0 verschieben
    movi a12, 1
    and a13, a11, a12  // Teste ob Pin 20 High  
    bnez a13, pinHigh         
    movi a9, 0     
    j exit

pinHigh:
    movi a9, 1           

exit:
    movi    a14, pin_stat // Adresse Variable pin_stat
  //  l32i    a15, a14, 0
  //  addi    a15, a15, 1 // counter test Variable pin_stat
    s32i    a9, a14, 0 // Status Pin 20 sichern
     memw

    retw

How did you write the function in C? How do you declare the prototype in C?

Also RISC-V ABI says a0 is the return register but I don’t see you writing to that?

The external asm function is declared in C with

extern “C” {
void asmtest(void);
}

and called with
asmtest();

since the assembly updates the pin_stat variable directly. There are no return parameters.

Addressing the variable works.
The two lines to work as a counter are successful.

Only querying the GPIO_IN_REG doesn’t work