	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	_qsort]
;
; Line 6:	{
;
_qsort:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 0CH
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	EBX,DWORD [EBP+010H]
;
; Line 8:		void *buf = malloc(width);
;
	PUSH	EBX
	CALL	_malloc
	POP	ECX
	MOV	DWORD [EBP+0FFFFFFFCH],EAX
;
; Line 9:		char *wp1 = base;
;
	MOV	ESI,DWORD [EBP+08H]
;
; Line 10:		if (!buf)
;
	CMP	DWORD [EBP+0FFFFFFFCH],BYTE 00H
	JE	NEAR	L_3
;
; Line 11:			return;
;
L_1:
	MOV	DWORD [EBP+0FFFFFFF8H],00H
	JMP	L_6
L_4:
;
; Line 13:			char *wp2 = wp1 + width;
;
	MOV	EAX,ESI
	ADD	EAX,EBX
	MOV	DWORD [EBP+0FFFFFFF4H],EAX
	MOV	EDI,DWORD [EBP+0FFFFFFF8H]
	INC	EDI
	JMP	L_10
L_8:
;
; Line 15:				if ((*compare)(wp1,wp2) >0) {
;
	PUSH	DWORD [EBP+0FFFFFFF4H]
	PUSH	ESI
	CALL	DWORD [EBP+014H]
	ADD	ESP,BYTE 08H
	TEST	EAX,EAX
	JLE	NEAR	L_12
;
; Line 16:					memcpy(buf,wp1,width);
;
	PUSH	EBX
	PUSH	ESI
	PUSH	DWORD [EBP+0FFFFFFFCH]
	CALL	_memcpy
	ADD	ESP,BYTE 0CH
;
; Line 17:					memcpy(wp1,wp2,width);
;
	PUSH	EBX
	PUSH	DWORD [EBP+0FFFFFFF4H]
	PUSH	ESI
	CALL	_memcpy
	ADD	ESP,BYTE 0CH
;
; Line 18:					memcpy(wp2,buf,width);
;
	PUSH	EBX
	PUSH	DWORD [EBP+0FFFFFFFCH]
	PUSH	DWORD [EBP+0FFFFFFF4H]
	CALL	_memcpy
	ADD	ESP,BYTE 0CH
;
; Line 19:				}
;
L_12:
;
; Line 20:				wp2 += width;
;
	ADD	DWORD [EBP+0FFFFFFF4H],EBX
;
; Line 21:			}
;
;
; Line 14:			for (j=i+1; j < num; j++) {
;
L_9:
	INC	EDI
L_10:
	CMP	EDI,DWORD [EBP+0CH]
	JB	NEAR	L_8
L_11:
;
; Line 22:			wp1 += width;
;
	ADD	ESI,EBX
;
; Line 23:		}
;
;
; Line 12:		for (i=0; i < num-1;i++) {
;
L_5:
	INC	DWORD [EBP+0FFFFFFF8H]
L_6:
	MOV	EAX,DWORD [EBP+0CH]
	DEC	EAX
	CMP	DWORD [EBP+0FFFFFFF8H],EAX
	JL	NEAR	L_4
L_7:
;
; Line 24:		free(buf);
;
	PUSH	DWORD [EBP+0FFFFFFFCH]
	CALL	_free
	POP	ECX
;
; Line 26:	}
;
L_3:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET


SECTION _TEXT
[EXTERN	_free]
[EXTERN	_memcpy]
[EXTERN	_malloc]
