Smali is a programming language used for developing Android apps. It is a low-level language that is used to write code that can be executed by the Dalvik Virtual Machine, which is the runtime environment for Android apps.
First, create a project and then create a class with your desired name.(Select Java)

Person.class

MainActivity.class
Then, decompile to smali this APK with Jadx-GUI and apktool. The result are like this:

Jadx-GUI output

APKTool output.
As you can see we have some difference in outputs. In Jadx-GUI we have .registers 5, but in APKTool we have .locals 5. This difference because these to tools use difference decompilers.
.registers is used to indicate the number of registers that a method will use. Registers are a type of temporary storage that are used by the Dalvik Virtual Machine to hold data and intermediate results during method execution. The number of registers required by a method depends on its complexity and the types of operations it performs.
.locals is used to specify the number of local variables that a method will use. Local variables are variables that are used within a method and are not accessible outside of it. The number of local variables required by a method depends on the number of arguments passed to the method, as well as any variables that are created and used within the method.
While both registers and local variables are used for data storage in Smali, they serve different purposes and cannot be used interchangeably.
Registers are a type of temporary storage that are used by the Dalvik Virtual Machine to hold data and intermediate results during method execution. They are a limited resource, and the number of registers available for use is determined by the .registers directive at the beginning of the method.
Local variables, on the other hand, are variables that are used within a method and are not accessible outside of it. They are used to store data that needs to persist across multiple instructions within a method. The number of local variables available for use is determined by the .locals directive at the beginning of the method.
Therefore, registers and local variables serve different purposes and cannot be used interchangeably. However, in some cases, it may be possible to use registers to store small amounts of data that would otherwise be stored in local variables. This approach can help to conserve the limited number of registers available and improve the performance of the app. However, this should be done with caution and only when necessary, as it can make the code more difficult to read and maintain.
We have another options too. There is plugin named Java2Smali for Android Studio. We can install it like this: