Likely a calling convention mismatch when mixing C and assembly. Verify that the function prologue and epilogue are correct and that the ABI register assignments match (x0–x7 for arguments, x0 for return value).