....
//---------------------------------
// Init State
//---------------------------------
int32_t state[16];
state[0] = 0x61707865;
...
|| c -> asm(riscv32-gcc -S inputcode.c)
|| convert
\/
...
addi sp,sp,-112
sw ra,108(sp)
sw s0,104(sp)
addi s0,sp,112
sw a0,-100(s0)
sw a1,-104(s0)
li a5,1634762752
addi a5,a5,-1947
....
You can just use li a5,1634760805 (1634760805=1634762752-1947), but why do you do li a5,1634762752 and addi a5,a5,-1947?
GCC still does this with optimization enabled:
int foo(){
return 0x61707865;
}
compiling with rv32gcc 10.2 -O3 on Godbolt to
foo:
li a0,1634762752
addi a0,a0,-1947
ret
vs. this with clang 14 -O3 avoiding the li pseudo-instruction
foo: # @foo
lui a0, 399112
addi a0, a0, -1947
ret