I have implementation of LED encryption algorithm derived from open-source implementation available on the GitHub (see details in the beginning of source code files in the attached archive). There are some wrapper functions around original code which allow to encrypt/decrypt area of memory and small self-test routing. The problem is that currently self-test doesn't pass. Self test initializes are of memory with length of 3 algorithm data blocks, makes copy of it, encrypts and then decrypts that copy and then compares to original. The problem that encryption/decryption of the first block goes fine but next ones are not. Your task is to fix this.
So, you must NOT completely/significantly rewrite code, you need to make some minor fixes which will make it work completely correctly. I also require you to preserve style and formatting of the code. You also must add short comment in all place where you have made fixes. Code is plain C99, please no C++. I am using Visual Studio 2015, but you may use any other C99 compiler of your choice to process this task.