I am not sure if i am experienced enough to figure out whats exactly going on but i'll try. The reason wrote it that way was that i kept my implementation close to other strcasecmp implementations i found in other projects, but i am going to change it.