aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa copied to clipboard
Optimize aaa.asm and fix section bug
Extra details:
Shrunk the program and made the loop more efficient. Takes advantage of the fact that RAX holds the number of bytes written via each SYSCALL, the number of bytes written will always be exactly 1 (in normal scenarios), and the x86_64 system call for 'write' happens to be 1. This allows the entire loop to execute with a single instruction in the body and shrinks the overall program from 32 bytes to 26 bytes.
If the user is running a Linux kernel that zeroes registers on program start (Debian is known to do this), the program can be shrunk further down to 24 bytes by replacing 'MOV RAX, 1' with 'INC RAX'.
Additionally, the assembled program no longer gives a segmentation fault error.