Fix 2001/cheong to work with clang

I had to make a new function (also four letter word to match the
formatting) that is allowed to have an int as the third arg to it. I
chose the word pain :-) as it's a pain that clang is this way without
providing any option to disable it.

Note that the arg must be an even number of digits. This threw me off
until I read the README.md because on different systems I got different
results for odd number of digits args despite the fact there should be
no difference here as the diff shows.
This commit is contained in:
Cody Boone Ferguson committed 2023-03-19 11:30:34 -07:00
1 parent fd9b44ef76
commit 0e9d78e7c9
2 files changed
+27 -18

No files matched your search

+5 -3
View File
@@ -1,12 +1,14 @@
#include <stdio.h>
int l;int main(int o,char **O,
int l;int pain(int o,char **O,
int I){char c,*D=O[1];if(o>0){
for(l=0;D[l ];D[l
++]-=10){D [l++]-=120;D[l]-=
110;while (!main(0,O,l))D[l]
110;while (!pain(0,O,l))D[l]
+= 20; putchar((D[l]+1032)
/20 ) ;}putchar(10);}else{
c=o+ (D[I]+82)%10-(I>l/2)*
(D[I-l+I]+72)/10-9;D[I]+=I<0?0
:!(o=main(c/10,O,I-1))*((c+999
:!(o=pain(c/10,O,I-1))*((c+999
)%10-(D[I]+92)%10);}return o;}
int main(int o,char **O) {
return pain(o, O, l); }