If it's smaller than (or equal to) 4 bytes in size (native register size) then it is stored directly in the r0 register (sign or zero extended if nessesary)
If it's larger than 4 bytes then the value is stored in memory and the address of that value is passed to the called function as a parameter (in r0)
Returning structs needs some special handling, see
Parameter Passing - AAPCS32
https://github.com/ARM-software/abi-aa/blob/main/aapcs32/aapcs32.rst#64result-return
In short:
r0
)