and multiplies by 2 at the end -- but still compares for equality to 99999, a bit "odd" as it were...
Hmm, on a technical basis, it doesn't "multiply by 2" at the ASM level, but adds something to itself.
Code: Select all
0x00402b5c: call 0x404540 # get value from a function call
0x00402b61: mov 0x8(%ebp),%ecx
0x00402b64: add $0x4,%esp
0x00402b67: cmp $0x1869f,%eax # compare the value to 99999
0x00402b6c: je 0x402bcd
FUNCTION_CALL:
0x00404540: mov 0x4(%esp),%ecx
[...]
0x004046b6: lea 0x0(%ebp,%ebp,1),%eax # add ebp to itself for the return value
0x004046ba: pop %ebp
0x004046bb: pop %ebx
0x004046bc: ret
[...]
0x00404717: lea (%edi,%edi,1),%eax # double
0x0040471a: pop %edi
0x0040471b: pop %esi
0x0040471c: pop %ebp
0x0040471d: pop %ebx
0x0040471e: ret
[...]
0x00404729: lea (%edi,%edi,1),%eax # double
0x0040472c: pop %edi
0x0040472d: pop %esi
0x0040472e: pop %ebp
0x0040472f: pop %ebx
0x00404730: ret
0x00404731: pop %edi
0x00404732: lea (%esi,%esi,1),%eax # double
0x00404735: pop %esi
0x00404736: pop %ebp
0x00404737: pop %ebx
0x00404738: ret
[This is the only calling of 0x404540 in the code, and I've listed all the returns, with no jumps to instructions between a doubling and returning -- the function appears to have four cases, likely to do with the four corners of the board]. Zach has more technical details, but the rest of code also seems to follow that mentioned in the link.
As this code is for mating with bishop and knight, one can note that the versions from Rybka 1.0 Beta up to and including Rybka 4 are all generally unable to mate with KBN vs K w/o TBs -- somewhat like the bishop underpromotion
idiosyncrasy, it seems that these pre-Beta Rybkas had the most "knowledge" to some extent.