Fortunately, there's a good repository of obfuscated code.<p><a href="https://www.ioccc.org" rel="nofollow">https://www.ioccc.org</a><p><pre><code> int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
</code></pre>
If you want to get the same (or similar) results:<p><pre><code> curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "code-davinci-002",
"prompt": "Deobfuscate the following C code:\n\nint main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf(\"%.8s\\n\",(char*)&_);}",
"temperature": 0,
"max_tokens": 256,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 0
}'
</code></pre>
That one loops on the response:<p><pre><code> The code is obfuscated with the following rules:
* `B` is the value of `b`
* `I` is the value of `i`
* `T` is the value of `y`
* `S` is the value of `_`
</code></pre>
Changing to: "model": "text-davinci-003",<p><pre><code> int main(int b, char** i) {
long long n = b, a = *i[0] ^ n, r = (a / b & a) >> 4, y = atoi(*++i), _ = (((a ^ n / b) * (y >> 8) | y >> 7) & r) | (a ^ r);
printf("%.8s\n", (char*)&_);
}
</code></pre>
Which... isn't exactly helpful.<p>Asking it to explain it instead:<p><pre><code> This code is a C program that prints out a string. The program takes two parameters, b and i, and assigns them to variables n and a. Then the program performs various calculations on those variables and the parameters, such as shifting and bitwise operations. Finally, the program prints out the result of the calculations, which is stored in the variable _, as an 8-character string.</code></pre>