# Biggest bottleneck fix in human history

• This one is an old assembly program labeled:

;======================================================================
; Attempt at creating a pattern generator based on info from
; "A New Kind of Science" by Stephen Wolfram
;======================================================================

The author of this program is not Stephen Wolfram, it's some other guy trying to make a working program which is related to concepts from him.This guy made a formula specifically for manipulating 3 bits, and since it's so enormously bloated, littered with jumps and IF statements, and frankly is just plain retarded, I couldn't help but try to review it and simplify it.  The program basically generates a monochrome graphic, and the meat of the program lies inside this single function, called "RuleTest." When the program executes, it runs this function for every pixel in the image.  Obviously it should be a fairly efficient function, right? Apparently not.

I slowly chopped the function down and looked for patterns, and mainly tried to eliminate the if statements.  I was amazed when I realized how little this function actually gets done.

Here is my simplification of the program:

<FONT face="Courier New">RuleTest PROC
</FONT>
<FONT face="Courier New">  ; parameter passed through bx
xor eax,eax
bt rule, ebx
rcl eax, 1
ret
RuleTest ENDP</FONT>

Here is the original function:
(And, Yes.  They get the same exact thing accomplished.  Hard to believe, I know.)

<FONT face="Courier New" size=2>RuleTest PROC rule:word
</FONT><FONT face="Courier New" size=2>  ; parameter passed through bx
mov bx, rule
mov eax,0
</FONT>

<FONT face="Courier New" size=2>   .IF     rule==0  ; We just get the initial seed

.ELSEIF rule==1  ; 1
.IF bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==2  ; 2
.IF bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==3  ; 2 1
.IF bx==C2 || ebx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==4  ; 4
.IF bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==5  ; 4 1
.IF bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==6  ; 4 2
.IF bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==7  ; 4 2 1
.IF bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==8  ; 8
.IF bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==9  ; 8 1
.IF (bx==C8 || bx==C1)
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==10 ; 8 2
.IF bx==C8 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==11 ; 8 2 1
.IF bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==12 ; 8 4
.IF bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==13 ; 8 4 1
.IF bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==14 ; 8 4 2
.IF bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==15 ; 8 4 2 1  J
.IF bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==16 ; 16
.IF bx==C16
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==17 ; 16 1
.IF bx==C16 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==18 ; 16 2
.IF bx==C16 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==19 ; 16 2 1
.IF bx==C16 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==20 ; 16 4
.IF bx==C16 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==21 ; 16 4 1
.IF bx==C16 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==22 ; 16 4 2
.IF bx==C16 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==23 ; 16 4 2 1
.IF bx==C16 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==24 ; 16 8
.IF bx==C16 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==25 ; 16 8 1 J
.IF bx==C16 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==26 ; 16 8 2
.IF bx==C16 || bx==C8 || bx==C2
mov eax,1
.ENDIF

.ELSEIF rule==27 ; 16 8 2 1 J
.IF bx==C16 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==28 ; 16 8 4
.IF bx==C16 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==29 ; 16 8 4 1
.IF bx==C16 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==30 ; 16 8 4 2
.IF bx== C16 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==31 ; 16 8 4 2 1
.IF bx== C16 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==32 ; 32
.IF bx==C32
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==33 ; 32 1
.IF bx==C32 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==34 ; 32 2
.IF bx==C32 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==35 ; 32 2 1
.IF  bx==C32 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==36 ; 32 4
.IF bx==C32 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==37 ; 32 4 1
.IF bx==C32 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==38 ; 32 4 2
.IF bx==C32 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==39 ; 32 4 2 1
.IF bx==C32 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==40 ; 32 8
.IF bx==C32 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==41 ; 32 8 1 Junk
.IF  bx==C32 || bx==C8 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==42 ; 32 8 2
.IF  bx==C32 || bx==C8 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==43 ; 32 8 2 1 J
.IF  bx==C32 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==44 ; 32 8 4
.IF bx==C32 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==45 ; 32 8 4 1 J
.IF bx==C32 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==46 ; 32 8 4 2
.IF bx==C32 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF

.ELSEIF rule==47 ; 32 8 4 2 1
.IF bx==C32 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==48 ; 32 16
.IF bx==C32 || bx==C16
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==49 ; 32 16 1
.IF bx==C32 || bx==C16 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==50 ; 32 16 2
.IF bx==C32 || bx==C16 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==51 ; 32 16 2 1
.IF bx==C32 || bx==C16 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==52 ; 32 16 4
.IF bx==C32 || bx==C16 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==53 ; 32 16 4 1
.IF bx==C32 || bx==C16 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==54 ; 32 16 4 2
.IF bx==C32 || bx==C16 || bx==C4 || bx==C2
mov eax,1
.ENDIF

.ELSEIF rule==55 ; 32 16 4 2 1
.IF bx==C32 || bx==C16 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==56 ; 32 16 8
.IF bx==C32 || bx==C16 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==57 ; 32 16 8 1 J
.IF bx==C32 || bx==C16 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==58 ; 32 16 8 2
.IF bx==C32 || bx==C16 || bx==C8 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==59 ; 32 16 8 2 1 junk
.IF bx==C32 || bx==C16 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==60 ; 32 16 8 4
.IF bx==C32 || bx==C16 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==61 ; 32 16 8 4 1
.IF bx==C32 || bx==C16 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==62 ; 32 16 8 4 2
.IF bx==C32 || bx==C16 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==63 ; 32 16 8 4 2 1
.IF bx==C32 || bx==C16 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==64 ; 64
.IF bx==C64
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==65 ; 64 1 J
.IF bx==C64 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==66 ; 64 2
.IF bx==C64 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==67 ; 64 2 1 J
.IF bx==C64 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==68 ; 64 4
.IF bx==C64 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==69 ; 64 4 1 J
.IF bx==C64 || bx==C4 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==70 ; 64 4 2
.IF bx==C64 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==71 ; 64 4 2 1
.IF bx==C64 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==72 ; 64 8
.IF bx==C64 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==73 ; 64 8 1 J
.IF bx==C64 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==74 ; 64 8 2
.IF bx==C64 || bx==C8 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==75 ; 64 8 2 1 J
.IF bx==C64 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==76 ; 64 8 4
.IF bx==C64 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==77 ; 64 8 4 1 J
.IF bx==C64 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==78 ; 64 8 4 2
.IF bx==C64 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==79 ; 64 8 4 2 1 J
.IF bx==C64 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==80 ; 64 16
.IF bx==C64 || bx==C16
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==81 ; 64 16 1 J
.IF bx==C64 || bx==C16 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==82 ; 64 16 2
.IF bx==C64 || bx==C16 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==83 ; 64 16 2 1 J
.IF bx==C64 || bx==C16 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==84 ; 64 16 4
.IF bx==C64 || bx==C16 || bx==C4
mov eax,1
.ENDIF

.ELSEIF rule==85 ; 64 16 4 1 J
.IF bx==C64 || bx==C16 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>    .ELSEIF rule==86 ; 64 16 4 2
.IF bx==C64 || bx==C16 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==87 ; 64 16 4 2 1
.IF bx==C64 || bx==C16 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==88 ; 64 16 8
.IF bx==C64 || bx==C16 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==89 ; 64 16 8 1 J
.IF bx==C64 || bx==C16 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==90 ; 64 16 8 2
.IF bx==C64 || bx==C16 || bx==C8 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==91 ; 64 16 8 2 1
.IF bx==C64 || bx==C16 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==92 ; 64 16 8 4
.IF bx==C64 || bx==C16 || bx==C8 || bx==C4
mov eax,1
.ENDIF

.ELSEIF rule==93 ; 64 16 8 4 1 J
.IF bx==C64 || bx==C16 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==94 ; 64 16 8 4 2
.IF bx==C64 || bx==C16 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==95 ; 64 16 8 4 2 1
.IF bx==C64 || bx==C16 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==96 ; 64 32
.IF bx==C64 || bx==C32
mov eax,1
.ENDIF

.ELSEIF rule==97 ; 64 32 1 J
.IF bx==C64 || bx==C32 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==98 ; 64 32 2
.IF bx==C64 || bx==C32 || bx==C2
mov eax,1
.ENDIF

.ELSEIF rule==99 ; 64 32 2 1 J
.IF bx==C64 || bx==C32 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==100 ; 64 32 4
.IF bx==C64 || bx==C32 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==101 ; 64 32 4 1 J
.IF bx==C64 || bx==C32 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==102 ; 64 32 4 2
.IF bx==C64 || bx==C32 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==103 ; 64 32 4 2 1
.IF bx==C64 || bx==C32 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==104 ; 64 32 8
.IF bx==C64 || bx==C32 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==105 ; 64 32 8 1
.IF bx==C64 || bx==C32 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==106 ; 64 32 8 2
.IF bx==C64 || bx==C32 || bx==C8 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==107 ; 64 32 8 2 1
.IF bx==C64 || bx==C32 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==108 ;  64 32 8 4
.IF bx==C64 || bx==C32 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==109 ; 64 32 8 4 1
.IF bx==C64 || bx==C32 || bx==C8 || bx==C4  || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==110 ; 64 32 8 4 2
.IF bx==C64 || bx==C32 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==111 ; 64 32 8 4 2 1 J
.IF bx==C64 || bx==C32 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==112 ; 64 32 16
.IF  bx==C64 || bx==C32 || bx==C16
mov eax,1
.ENDIF

.ELSEIF rule==113 ; 64 32 16 1 J
.IF bx==C64 || bx==C32 || bx==C16 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==114 ; 64 32 16 2
.IF bx==C64 || bx==C32 || bx==C16 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==115 ; 64 32 16 2 1 J
.IF bx==C64 || bx==C32 || bx==C16 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==116 ; 64 32 16 4
.IF  bx==C64 || bx==C32 || bx==C16 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==117 ; 64 32 16 4 1 J
.IF bx==C64 || bx==C32 || bx==C16 || bx==C4 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==118 ; 64 32 16 4 2
.IF bx==C64 || bx==C32 || bx==C16 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==119 ; 64 32 16 4 2 1
.IF bx==C64 || bx==C32 || bx==C16 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==120 ; 64 32 16 8
.IF bx==C64 || bx==C32 || bx==C16 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==121 ; 64 32 16 8 1 J
.IF bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==122 ; 64 32 16 8 2
.IF bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==123 ; 64 32 16 8 2 1
.IF bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==124 ; 64 32 16 8 4
.IF bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C4
mov eax,1
.ENDIF

.ELSEIF rule==125 ; 64 32 16 8 4 1
.IF bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==126 ; 64 32 16 8 4 2
.IF bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==127 ; 64 32 16 8 4 2 1
.IF bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==128 ; 128
.IF bx==C128
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>    .ELSEIF rule==129 ; 128 1
.IF bx==C128 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==130 ; 128 2
.IF bx==C128 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==131 ; 128 2 1 J
.IF bx==C128 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==132 ; 128 4
.IF bx==C128 || bx==C4
mov eax,1
.ENDIF

.ELSEIF rule==133 ; 128 4 1 J
.IF bx==C128 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==134 ; 128 4 2
.IF bx==C128 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==135 ; 128 4 2 1 J
.IF bx==C128 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==136 ; 128 8
.IF bx==C128 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==137 ; 128 8 1 J
.IF bx==C128 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==138 ; 128 8 2
.IF bx==C128 || bx==C8 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==139 ; 128 8 2 1 J
.IF bx==C128 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==140 ; 128 8 4
.IF bx==C128 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==141 ; 128 8 4 1 J
.IF bx==C128 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==142 ; 128 8 4 2
.IF bx==C128 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==143 ; 128 8 4 2 1 J
.IF bx==C128 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==144 ; 128 16
.IF bx==C128 || bx==C16
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==145 ; 128 16 1 J
.IF bx==C128 || bx==C16 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==146 ; 128 16 2
.IF bx==C128 || bx==C16 || bx==C2
mov eax,1
.ENDIF

.ELSEIF rule==147 ; 128 16 2 1 J
.IF bx==C128 || bx==C16 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==148 ; 128 16 4 J
.IF bx==C128 || bx==C16 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==149 ; 128 16 4 1 J
.IF bx==C128 || bx==C16 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==150 ; 128 16 4 2
.IF bx==C128 || bx==C16 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==151 ; 128 16 4 2 1 J
.IF bx==C128 || bx==C16 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==152 ; 128 16 8
.IF bx==C128 || bx==C16 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==153 ; 128 16 8 1 J
.IF bx==C128 || bx==C16 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==154 ; 128 16 8 2
.IF bx==C128 || bx==C16 || bx==C8 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==155 ; 128 16 8 2 1 J
.IF bx==C128 || bx==C16 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==156 ; 128 16 8 4 J
.IF bx==C128 || bx==C16 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==157 ; 128 16 8 4 1 J
.IF bx==C128 || bx==C16 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==158 ; 128 16 8 4 2
.IF bx==C128 || bx==C16 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==159 ; 128 16 8 4 2 1 J
.IF bx==C128 || bx==C16 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==160 ; 128 32
.IF bx==C128 || bx==C32
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==161 ; 128 32 1 J
.IF bx==C128 || bx==C32 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==162 ; 128 32 2
.IF bx==C128 || bx==C32 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==163 ; 128 32 2 1 J
.IF bx==C128 || bx==C32 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==164 ; 128 32 4
.IF  bx==C128 || bx==C32 || bx==C4
mov eax,1
.ENDIF

.ELSEIF rule==165 ; 128 32 4 1 J
.IF bx==C128 || bx==C32 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==166 ; 128 32 4 2
.IF bx==C128 || bx==C32 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==167 ; 128 32 4 2 1 J
.IF bx==C128 || bx==C32 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==168 ; 128 32 8
.IF bx==C128 || bx==C32 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==169 ; 128 32 8 1 J
.IF bx==C128 || bx==C32 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==170 ; 128 32 8 2
.IF bx==C128 || bx==C32 || bx==C8 || bx==C2
mov eax,1
.ENDIF

.ELSEIF rule==171 ; 128 32 8 2 1 J
.IF  bx==C128 || bx==C32 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==172 ; 128 32 8 4
.IF bx==C128 || bx==C32 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==173 ; 128 32 8 4 1 J
.IF bx==C128 || bx==C32 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==174 ; 128 32 8 4 2
.IF bx==C128 || bx==C32 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF

.ELSEIF rule==175 ; 128 32 8 4 2 1 J
.IF  bx==C128 || bx==C32 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==176 ; 128 32 16
.IF bx==C128 || bx==C32 || bx==C16
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==177 ; 128 32 16 1 J
.IF bx==C128 || bx==C32 || bx==C16 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==178 ; 128 32 16 2
.IF bx==C128 || bx==C32 || bx==C16 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==179 ; 128 32 16 2 1 J
.IF bx==C128 || bx==C32 || bx==C16 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==180 ; 128 32 16 4
.IF bx==C128 || bx==C32 || bx==C16 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==181 ; 128 32 16 4 1 J
.IF bx==C128 || bx==C32 || bx==C16 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==182 ; 128 32 16 4 2
.IF bx==C128 || bx==C32 || bx==C16 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==183 ; 128 32 16 4 2 1 J
.IF bx==C128 || bx==C32 || bx==C16 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==184 ; 128 32 16 8
.IF bx==C128 || bx==C32 || bx==C16 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==185 ; 128 32 16 8 1 J
.IF bx==C128 || bx==C32 || bx==C16 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==186 ; 128 32 16 8 2
.IF bx==C128 || bx==C32 || bx==C16 || bx==C8 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==187 ; 128 32 16 8 2 1 J
.IF bx==C128 || bx==C32 || bx==C16 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==188 ; 128 32 16 8 4
.IF bx==C128 || bx==C32 || bx==C16 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==189 ; 128 32 16 8 4 1
.IF bx==C128 || bx==C32 || bx==C16 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==190 ; 128 32 16 8 4 2
.IF bx==C128 || bx==C32 || bx==C16 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==191 ; 128 32 16 8 4 2 1
.IF bx==C128 || bx==C32 || bx==C16 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==192 ; 128 64
.IF  bx==C128 || bx==C64
mov eax,1
.ENDIF

.ELSEIF rule==193 ; 128 64 1
.IF  bx==C128 || bx==C64 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==194 ; 128 64 2
.IF bx==C128 || bx==C64 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==195 ; 128 64 2 1
.IF bx==C128 || bx==C64 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==196 ; 128 64 4
.IF bx==C128 || bx==C64 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==197 ; 128 64 4 1
.IF  bx==C128 || bx==C64 || bx==C4 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==198 ; 128 64 4 2
.IF bx==C128 || bx==C64 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==199 ; 128 64 4 2 1
.IF bx==C128 || bx==C64 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==200 ; 128 64 8
.IF bx==C128 || bx==C64 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==201 ; 128 64 8 1
.IF  bx==C128 || bx==C64 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==202 ; 128 64 8 2
.IF bx==C128 || bx==C64 || bx==C8 || bx==C2
mov eax,1
.ENDIF

.ELSEIF rule==203 ; 128 64 8 2 1
.IF bx==C128 || bx==C64 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==204 ; 128 64 8 4
.IF bx==C128 || bx==C64 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==205 ; 128 64 8 4 1
.IF bx==C128 || bx==C64 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==206 ; 128 64 8 4 2
.IF bx==C128 || bx==C64 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==207 ; 128 64 8 4 2 1
.IF bx==C128 || bx==C64 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==208 ; 128 64 16
.IF bx==C128 || bx==C64 || bx==C16
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==209 ; 128 64 16 1
.IF bx==C128 || bx==C64 || bx==C16 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==210 ; 128 64 16 2
.IF bx==C128 || bx==C64 || bx==C16 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==211 ; 128 64 16 2 1
.IF bx==C128 || bx==C64 || bx==C16 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==212 ; 128 64 16 4
.IF bx==C128 || bx==C64 || bx==C16 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==213 ; 128 64 16 4 1
.IF bx==C128 || bx==C64 || bx==C16 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==214 ; 128 64 16 4 2
.IF bx==C128 || bx==C64 || bx==C16 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==215 ; 128 64 16 4 2 1
.IF bx==C128 || bx==C64 || bx==C16 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==216 ; 128 64 16 8
.IF bx==C128 || bx==C64 || bx==C16 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==217 ; 128 64 16 8 1
.IF bx==C128 || bx==C64 || bx==C16 || bx==C8 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==218 ; 128 64 16 8 2
.IF bx==C128 || bx==C64 || bx==C16 || bx==C8 || bx==C2
mov eax,1
.ENDIF

.ELSEIF rule==219 ; 128 64 16 8 2 1
.IF bx==C128 || bx==C64 || bx==C16 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==220 ; 128 64 16 8 4
.IF bx==C128 || bx==C64 || bx==C16 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==221 ; 128 64 16 8 4 1
.IF bx==C128 || bx==C64 || bx==C16 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==222 ; 128 64 16 8 4 2
.IF bx==C128 || bx==C64 || bx==C16 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==223 ; 128 64 16 8 4 2 1
.IF bx==C128 || bx==C64 || bx==C16 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==224 ; 128 64 32
.IF bx==C128 || bx==C64 || bx==C32
mov eax,1
.ENDIF

.ELSEIF rule==225 ; 128 64 32 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==226 ; 128 64 32 2
.IF bx==C128 || bx==C64 || bx==C32 || bx==C2
mov eax,1
.ENDIF

.ELSEIF rule==227 ; 128 64 32 2 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==228 ; 128 64 32 4
.IF bx==C128 || bx==C64 || bx==C32 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==229 ; 128 64 32 4 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C4 || ebx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==230 ; 128 64 32 4 2
.IF bx==C128 || bx==C64 || bx==C32 || bx==C4 || ebx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==231 ; 128 64 32 4 2 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C4 || ebx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==232 ; 128 64 32 8
.IF bx==C128 || bx==C64 || bx==C32 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==233 ; 128 64 32 8 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==234 ; 128 64 32 8 2
.IF bx==C128 || bx==C64 || bx==C32 || bx==C8 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==235 ; 128 64 32 8 2 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF

.ELSEIF rule==236 ; 128 64 32 8 4
.IF bx==C128 || bx==C64 || bx==C32 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==237 ; 128 64 32 8 4 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C8 || bx==C4 || ebx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==238 ; 128 64 32 8 4 2
.IF bx==C128 || bx==C64 || bx==C32 || bx==C8 || bx==C4 || ebx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==239 ; 128 64 32 8 4 2 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C8 || bx==C4 || ebx==C2 || ebx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==240 ; 128 64 32 16
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==241 ; 128 64 32 16 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==242 ; 128 64 32 16 2
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==243 ; 128 64 32 16 2 1 J
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==244 ; 128 64 32 16 4
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==245 ; 128 64 32 16 4 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==246 ; 128 64 32 16 4 2
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==247 ; 128 64 32 16 4 2 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==248 ; 128 64 32 16 8
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C8
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==249 ; 128 64 32 16 8 1
.IF  bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==250 ; 128 64 32 16 8 2
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>    .ELSEIF rule==251 ; 128 64 32 16 8 2 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C2 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>    .ELSEIF rule==252 ; 128 64 32 16 8 4
.IF  bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C4
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>    .ELSEIF rule==253 ; 128 64 32 16 8 4 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C4 || bx==C1
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>          .ELSEIF rule==254 ; 128 64 32 16 8 4 2
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C4 || bx==C2
mov eax,1
.ENDIF
</FONT>

<FONT face="Courier New" size=2>   .ELSEIF rule==255 ; 128 64 32 16 8 4 2 1
.IF bx==C128 || bx==C64 || bx==C32 || bx==C16 || bx==C8 || bx==C4 || bx==C2 || bx==C1
mov eax,1
.ENDIF
.ENDIF
ret
RuleTest endp
</FONT>

• Thanks for giving my scrolling finger it's daily workout. Now we just wait for somebody to quote the whole thing, and put 'Wow...' right under it.

Since I'm too damn lazy to Google, is this related to/the progenitor of the "Life" program popular back in the 70s?

• @eax said:

This one is an old assembly program labeled:

;======================================================================
; Attempt at creating a pattern generator based on info from
; "A New Kind of Science" by Stephen Wolfram
;======================================================================

The author of this program is not Stephen Wolfram, it's some other guy trying to make a working program which is related to concepts from him.This guy made a formula specifically for manipulating 3 bits, and since it's so enormously bloated, littered with jumps and IF statements, and frankly is just plain retarded, I couldn't help but try to review it and simplify it.  The program basically generates a monochrome graphic, and the meat of the program lies inside this single function, called "RuleTest." When the program executes, it runs this function for every pixel in the image.  Obviously it should be a fairly efficient function, right? Apparently not.

I slowly chopped the function down and looked for patterns, and mainly tried to eliminate the if statements.  I was amazed when I realized how little this function actually gets done.

Here is my simplification of the program:

<FONT face="Courier New">RuleTest PROC
</FONT>
<FONT face="Courier New">  ; parameter passed through bx
xor eax,eax
bt rule, ebx
rcl eax, 1
ret
RuleTest ENDP</FONT>

Here is the original function:
(And, Yes.  They get the same exact thing accomplished.  Hard to believe, I know.)

Wow!

Moderator Edit: Removed the original quote

• @R.Flowers said:

Thanks for giving my scrolling finger it's daily workout. Now we just wait for somebody to quote the whole thing, and put 'Wow...' right under it.

Since I'm too damn lazy to Google, is this related to/the progenitor of the "Life" program popular back in the 70s?

You realize that it had to be done, right? [:D]

• @R.Flowers said:

Thanks for giving my scrolling finger it's daily workout. Now we just wait for somebody to quote the whole thing, and put 'Wow...' right under it.

You realize that it had to be done, right? [:D]

(... reaches for 'troll' button... ) [:P]

• @R.Flowers said:

IIRC, when quoting, CommunityServer chokes on spaces and/or punctuation in a username.

But, I could be wrong.

And, although I'm motivated enough to write this response, I'm not motivated enough to look it up.  Sad, eh?

• yup

• @R.Flowers said:

Thanks for giving my scrolling finger it's daily workout. Now we just wait for somebody to quote the whole thing, and put 'Wow...' right under it.

Since I'm too damn lazy to Google, is this related to/the progenitor of the "Life" program popular back in the 70s?

yup

• Amazing.

• Or, if you want code that runs on the 8086 and 80286 (NASM syntax):

```proc:

mov al, [rule]
mov cl, bl
shr al, cl
and al, 1
ret
```

I see the code mixes 32-bit (eax) and 16-bit (bx) registers. A good rule of thumb is "if you're writing 32-bit code, use 32-bit registers unless you absolutely need to use the 16-bit registers". Using 16-bit registers in 32-bit mode is no faster and bloats your code with operand-size prefixes.

• <FONT size=2>Hehe, nice work. That code reminds me on an old code by a friend of mine I saw a few years ago. He was trying to convert a character string to an integer value using C++. Instead using nValue = atoi(szChar) he curiously parsed the string himself and calculated the value manually char by char, adding every digit to his int value [:S]
I "optimized" the code in around 0.5 seconds. Yeah, this moment was awesome! [H]</FONT>

• In ancient times, we used to call that sort of thing "wallpaper code" because you could print it out and stick it...well, you know.

I'm surprised that anyone under 65 years old still writes code that way. I guess it goes to show George Santayana was right whe he said, "Those who cannot remember the past are condemned to repeat it."

• eax, please step into my office.  We need to talk about your productivity.  I see that the only think you have produced this entire week is this one function:

@eax said:

<font face="Courier New">RuleTest PROC
</font>
<font face="Courier New">  ; parameter passed through bx
xor eax,eax
bt rule, ebx
rcl eax, 1
ret
RuleTest ENDP</font>

At this company, we pride ourselves on hard work and we expect all of our employees to contribute substantially to our corporate vision.  I'm officially informing you that your productivity is below our standards.  You may consider yourself on probation.  Next week, I expect to see better performance from you, or we will forced to terminate your contract.

Do you have any questions?

• @jspenguin said:

```proc:
```mov al, [rule]
mov cl, bl
shr al, cl
and al, 1
ret</PRE></blockquote>
```
Now for extra credit, write a program in the language of your choice that accepts this code as input (or the short code from the original post, since I was too lazy to quote and edit that) and outputs the convoluted original or something equally complex/boneheaded.
```

• What I see is that the programmer was making some sort of state machine to take account of all possible cases.  That all cases caused the exact same effect is kind of weird.  Perhaps after much debugging and testing it turned out that setting the value to 1 on each case worked well, and this occured incrementally until all cases were set to 1, not realizing that all cases ended up the same.  That's the only thing I can imagine.  Or else, the setting of 1 on all cases is not actually correct, but only set used while testing; or shouldn't have been "hard-coded", but read from memory or a file or something, as variable input values that would affect the end result depending on the case.

Without knowning the original formula that he was trying to implement I can't tell.  I'm too lazy to google for it right now; would you happen to have a link to it at hand?

-dZ.

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.