Last active
October 17, 2016 23:01
-
-
Save stonegray/8e88875b1e6fa5d6cb2894138f34fde2 to your computer and use it in GitHub Desktop.
Obfuscated C Practice: Month to Integer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Month name to month integer. | |
// Input a lowercase month name | |
#include <stdio.h> | |
int main(int argc, char *argv[]){ | |
if (argc != 2) return 1; | |
const int __ = 0b1; | |
const int x_ = 0b11; | |
const int _x=x_+ 0b111; | |
char _[42]="\0\0LCPHGDOCTCRTOC[LWPLWNCWIUGRQEVPQXFGEmx\0"; | |
while(1){ | |
if( (*(x_-__+_+(*(_))+(*(_+__)*(x_)))+_x*(x_)==*(*(__+argv)+(*(_))++))&& | |
(*(x_-__+_+(*(_))+(*(_+__)*(x_)))+_x*(x_)==*(*(__+argv)+(*(_))++))&& | |
(*(x_-__+_+(*(_))+(*(_+__)*(x_)))+_x*(x_)==*(*(__+argv)+(*(_))++))){ | |
printf("Month %u\n",*(_+__)+__); | |
break; | |
} | |
if(!((*(_+__))++<_x+(x_-__))||((*(_))=(__>_x))){ | |
printf("Not a month!\n"); | |
break; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment