	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	_strtol]
;
; Line 5:	{
;
_strtol:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 08H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD [EBP+08H]
	MOV	EDI,DWORD [EBP+0CH]
;
; Line 6:		int sign = 0;
;
	MOV	DWORD [EBP+0FFFFFFFCH],00H
;
; Line 7:		int val = 0;
;
	MOV	EBX,00H
	JMP	L_1
L_3:
	INC	ESI
L_1:
;
; Line 9:		while ((_ctype[ (*s) ] & (1            ))) s++;
;
	MOVSX	EAX,BYTE [ESI+00H]
	MOVZX	EAX,BYTE [EAX+__ctype+00H]
	AND	EAX,BYTE 01H
	JNE	SHORT	L_3
L_2:
;
; Line 11:		if (*s == '-') {
;
	MOVSX	EAX,BYTE [ESI+00H]
	CMP	EAX,BYTE 02DH
	JNE	SHORT	L_4
;
; Line 12:			sign++;
;
	INC	DWORD [EBP+0FFFFFFFCH]
;
; Line 13:			s++;
;
	INC	ESI
;
; Line 14:		}
;
	JMP	L_5
L_4:
;
; Line 15:		else if (*s == '+') 
;
	MOVSX	EAX,BYTE [ESI+00H]
	CMP	EAX,BYTE 02BH
	JNE	SHORT	L_6
;
; Line 16:			s++;
;
	INC	ESI
L_6:
L_5:
;
; Line 17:		if (*s == '0') {
;
	MOVSX	EAX,BYTE [ESI+00H]
	CMP	EAX,BYTE 030H
	JNE	NEAR	L_8
;
; Line 18:			radix = 8;
;
	MOV	DWORD [EBP+010H],08H
;
; Line 19:			s++;
;
	INC	ESI
;
; Line 20:			if (*s == 'x' || *s == 'X') {
;
	MOVSX	EAX,BYTE [ESI+00H]
	CMP	EAX,BYTE 078H
	JE	SHORT	L_12
	MOVSX	EAX,BYTE [ESI+00H]
	CMP	EAX,BYTE 058H
	JNE	SHORT	L_10
L_12:
;
; Line 21:				radix = 16;
;
	MOV	DWORD [EBP+010H],010H
;
; Line 22:				s++;
;
	INC	ESI
;
; Line 23:			}
;
L_10:
;
; Line 24:		}
;
L_8:
	JMP	L_13
L_15:
;
; Line 26:			unsigned temp = toupper(*s++)- '0';
;
	MOV	EAX,ESI
	INC	ESI
	MOVSX	EAX,BYTE [EAX+00H]
	PUSH	EAX
	CALL	_toupper
	POP	ECX
	SUB	EAX,BYTE 030H
	MOV	DWORD [EBP+0FFFFFFF8H],EAX
;
; Line 27:			if (temp >= 10)
;
	CMP	DWORD [EBP+0FFFFFFF8H],BYTE 0AH
	JB	SHORT	L_16
;
; Line 28:				temp -= 7;
;
	SUB	DWORD [EBP+0FFFFFFF8H],BYTE 07H
L_16:
;
; Line 29:			if (temp >=radix) {
;
	MOV	EAX,DWORD [EBP+0FFFFFFF8H]
	CMP	EAX,DWORD [EBP+010H]
	JB	SHORT	L_18
;
; Line 30:				s--;
;
	DEC	ESI
;
; Line 31:				break;
;
	JMP	L_14
L_18:
;
; Line 33:			val*= radix;
;
	IMUL	EBX,DWORD [EBP+010H]
;
; Line 34:			val += temp;
;
	ADD	EBX,DWORD [EBP+0FFFFFFF8H]
;
; Line 35:		}
;
L_13:
;
; Line 25:		while((_ctype[ (*s) ] & ((2             | (4             | 8            ))))) {
;
	MOVSX	EAX,BYTE [ESI+00H]
	MOVZX	EAX,BYTE [EAX+__ctype+00H]
	AND	EAX,BYTE 0EH
	JNE	NEAR	L_15
L_14:
;
; Line 36:		if (sign)
;
	CMP	DWORD [EBP+0FFFFFFFCH],BYTE 00H
	JE	SHORT	L_20
;
; Line 37:			val = -val;
;
	NEG	EBX
L_20:
;
; Line 38:		if (endptr)
;
	TEST	EDI,EDI
	JE	SHORT	L_22
;
; Line 39:			*endptr = s;
;
	MOV	DWORD [EDI+00H],ESI
L_22:
;
; Line 40:		return val;
;
	MOV	EAX,EBX
L_24:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET
[GLOBAL	_atol]
;
; Line 43:	{
;
_atol:
	PUSH	EBP
	MOV	EBP,ESP
;
; Line 44:		return strtol(s,0,10);
;
	PUSH	BYTE 0AH
	PUSH	BYTE 00H
	PUSH	DWORD [EBP+08H]
	CALL	_strtol
	ADD	ESP,BYTE 0CH
L_25:
	POP	EBP
	RET


SECTION _TEXT
[EXTERN	_toupper]

SECTION _DATA
[EXTERN	__ctype]
