The ARM cpu is a load-store architecture. It has a form of store as follows,
str rN, [rP, #4]
This will take the value of register rP
(a pointer) and add four to it. The BUS will issue a store to memory with the value in register rN
. You decompiler is seems rudimentaryNote below and has translated this as,
int32_t a = `some value`; /* sets up pointer register `rP` */
int32_t b = `another value`; /* Initializes value `rN` */
*(int32_t *)(a + 4) = b; /* the instruction `str rN, [rP, #4]` */
If you look at the decompiling wiki it notes that compiling to binary looses information. A goal of the decompiler will be that if you compile the result unaltered, it should give the same binary.
As the code is trying to replicate a machine language identical, there is no way the code will ever be portable.
Part of the issue with the tool is,
I have decompiled an .so file (from an ARM lib in an Android app)
Shared libraries are compiled to generate some strange code to allow them to be used by multiple users. It is possible that the registers used are non-standard which doesn't allow the decompiler to match the EABI regular register use as found in a main executable.
I looked briefly and the tool didn't seem to have a '-shared-library' decompile option. I suspect you are decompiling a thunk of some sort. Ie, a plt or got; see ARM Dynamic linking. Here is a question on shared library for the ARM; if the decompiler had a -shared-library
option, it would probably need an OS (and version) qualifier.