	SECTION _TEXT CLASS=CODE USE32
	SECTION _DATA CLASS=DATA USE32
	SECTION _BSS  CLASS=BSS USE32
	SECTION _CONST  CLASS=CONST USE32
	SECTION _STRING  CLASS=STRING USE32
	SECTION cstartup CLASS=INITDATA USE32
	SECTION crundown CLASS=EXITDATA USE32
	SECTION cppinit  CLASS=CPPINIT USE32
	SECTION cppexit  CLASS=CPPEXIT USE32
	GROUP DGROUP _DATA _BSS _CONST _STRING

SECTION _TEXT
[GLOBAL	_bsearch]
;
; Line 5:	{
;
_bsearch:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 08H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	EDI,DWORD [EBP+014H]
;
; Line 6:		size_t bottom = 0;
;
	MOV	DWORD [EBP+0FFFFFFF8H],00H
;
; Line 7:		size_t top = num;
;
	MOV	ESI,DWORD [EBP+010H]
	JMP	L_1
L_3:
;
; Line 11:			mid = (top + bottom)/2;
;
	MOV	EBX,ESI
	ADD	EBX,DWORD [EBP+0FFFFFFF8H]
	SHR	EBX,01H
;
; Line 12:			if ((l=(*compare)(key,(char *)base + mid*width))== 0)
;
	MOV	EAX,EBX
	IMUL	EAX,EDI
	ADD	EAX,DWORD [EBP+0CH]
	PUSH	EAX
	PUSH	DWORD [EBP+08H]
	CALL	DWORD [EBP+018H]
	ADD	ESP,BYTE 08H
	MOV	DWORD [EBP+0FFFFFFFCH],EAX
	TEST	EAX,EAX
	JNE	SHORT	L_4
;
; Line 13:				return (char *)base +mid * width;
;
	MOV	EAX,EBX
	IMUL	EAX,EDI
	ADD	EAX,DWORD [EBP+0CH]
	JMP	L_6
L_4:
;
; Line 14:			if (l < 0)
;
	CMP	DWORD [EBP+0FFFFFFFCH],BYTE 00H
	JGE	SHORT	L_7
;
; Line 15:				top = mid;
;
	MOV	ESI,EBX
	JMP	L_8
L_7:
;
; Line 17:				bottom = mid;
;
	MOV	DWORD [EBP+0FFFFFFF8H],EBX
L_8:
;
; Line 18:			if ((top +bottom)/2 == mid)
;
	MOV	EAX,ESI
	ADD	EAX,DWORD [EBP+0FFFFFFF8H]
	SHR	EAX,01H
	CMP	EAX,EBX
	JNE	SHORT	L_9
;
; Line 19:				return 0;
;
	MOV	EAX,00H
	JMP	L_6
L_9:
;
; Line 20:		}
;
L_1:
;
; Line 10:		while (1) {
;
	JMP	L_3
L_2:
;
; Line 21:		return 0;	 
;
	MOV	EAX,00H
L_6:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET

