main(_){_^448&&main(-~_);putchar(--_%64?32|-~7[__TIME__-_/8%8][">'txiZ^(~z?"-48]>>";;;====~$::199"[_*2&8|_/64]/(_&2?1:8)%8&1:10);}
I'm SO embarrassed, that's C. Wrong Forum. Wrong everything.
HUTCH, at your convenience, could you please delete this irrelevant thread?
...I have obfuscated myself.
obfuscated C code contest?
...exactly, and, I was under the mistaken impression that I was looking at assembly code.
Either way, it didn't make any sense,...
; Listing generated by Microsoft (R) Optimizing Compiler Version 13.10.3077
TITLE obfus.c
.386P
include listing.inc
if @Version gt 510
.model FLAT
else
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'
_DATA ENDS
CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST ENDS
_BSS SEGMENT DWORD USE32 PUBLIC 'BSS'
_BSS ENDS
$$SYMBOLS SEGMENT BYTE USE32 'DEBSYM'
$$SYMBOLS ENDS
_TLS SEGMENT DWORD USE32 PUBLIC 'TLS'
_TLS ENDS
FLAT GROUP _DATA, CONST, _BSS
ASSUME CS: FLAT, DS: FLAT, SS: FLAT
endif
INCLUDELIB LIBC
INCLUDELIB OLDNAMES
_DATA SEGMENT
$SG473 DB '>''txiZ^(~z?', 00H
$SG474 DB '20:44:44', 00H
ORG $+3
$SG475 DB ';;;====~$::199', 00H
_DATA ENDS
PUBLIC _main
EXTRN _putchar:NEAR
; Function compile flags: /Odt
_TEXT SEGMENT
tv131 = -4 ; size = 4
__$ = 8 ; size = 4
_main PROC NEAR
; File c:\program files\microsoft visual c++ toolkit 2003\my\junk\obfus.c
; Line 1
push ebp
mov ebp, esp
push ecx
push esi
mov eax, DWORD PTR __$[ebp]
xor eax, 448 ; 000001c0H
je SHORT $L482
mov ecx, DWORD PTR __$[ebp]
not ecx
neg ecx
push ecx
call _main
add esp, 4
$L482:
mov edx, DWORD PTR __$[ebp]
sub edx, 1
mov DWORD PTR __$[ebp], edx
mov eax, DWORD PTR __$[ebp]
and eax, -2147483585 ; 8000003fH
jns SHORT $L485
dec eax
or eax, -64 ; ffffffc0H
inc eax
$L485:
test eax, eax
je SHORT $L483
mov ecx, OFFSET FLAT:$SG473
sub ecx, 48 ; 00000030H
mov eax, DWORD PTR __$[ebp]
cdq
and edx, 7
add eax, edx
sar eax, 3
and eax, -2147483641 ; 80000007H
jns SHORT $L486
dec eax
or eax, -8 ; fffffff8H
inc eax
$L486:
mov edx, OFFSET FLAT:$SG474
sub edx, eax
movsx eax, BYTE PTR [edx+7]
movsx esi, BYTE PTR [ecx+eax]
not esi
neg esi
mov ecx, DWORD PTR __$[ebp]
shl ecx, 1
and ecx, 8
mov eax, DWORD PTR __$[ebp]
cdq
and edx, 63 ; 0000003fH
add eax, edx
sar eax, 6
or ecx, eax
movsx eax, BYTE PTR $SG475[ecx]
mov ecx, DWORD PTR __$[ebp]
and ecx, 2
neg ecx
sbb ecx, ecx
and ecx, -7 ; fffffff9H
add ecx, 8
cdq
idiv ecx
and eax, -2147483641 ; 80000007H
jns SHORT $L487
dec eax
or eax, -8 ; fffffff8H
inc eax
$L487:
mov ecx, eax
sar esi, cl
and esi, 1
or esi, 32 ; 00000020H
mov DWORD PTR tv131[ebp], esi
jmp SHORT $L484
$L483:
mov DWORD PTR tv131[ebp], 10 ; 0000000aH
$L484:
mov edx, DWORD PTR tv131[ebp]
push edx
call _putchar
add esp, 4
xor eax, eax
pop esi
mov esp, ebp
pop ebp
ret 0
_main ENDP
_TEXT ENDS
END
MichaelW,
...excellent, I should have thought of that.
So, what the hell is it? It's a "one liner digital clock program". This is how the author describes it. It was an entry in the 2006 19th IOCCC contest. Explanation is here: http://www.stephensykes.com/IOCCC/2006/sykes2/remarks
Actual code is here: http://www.stephensykes.com/IOCCC/2006/sykes2/sykes2.c
The International Obfuscated C Code Contest is here: http://www.ioccc.org/
I can't follow most of the C code, and I was surprised that the compiler would compile it with only two warnings, and I had to specify /W4 to get both of them:
obfus.c(1) : warning C4131: 'main' : uses old-style declarator
obfus.c(1) : warning C4013: 'putchar' undefined; assuming extern returning int
IMO it does not qualify as a "digital clock program" because instead of displaying real time, it displays the compile time, encoded here:
$SG474 DB '20:44:44', 00H