	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	_gmtime]
;
; Line 11:	{
;
_gmtime:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 04H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,DWORD _rv
;
; Line 16:		time_t t = *time;
;
	MOV	EAX,DWORD [EBP+08H]
	MOV	EBX,DWORD [EAX+00H]
;
; Line 17:		int temp1,x=0;
;
	MOV	DWORD [EBP+0FFFFFFFCH],00H
;
; Line 18:		rv.tm_sec = t %60;
;
	MOV	EAX,EBX
	CDQ
	IDIV	DWORD [L_1]
	MOV	DWORD [ESI+00H],EDX
;
; Line 19:		t/=60;
;
	XCHG	EAX,EBX
	CDQ
	IDIV	DWORD [L_1]
	MOV	EBX,EAX
;
; Line 20:		rv.tm_min = t %60;
;
	MOV	EAX,EBX
	CDQ
	IDIV	DWORD [L_1]
	MOV	DWORD [ESI+04H],EDX
;
; Line 21:		t /=60;
;
	XCHG	EAX,EBX
	CDQ
	IDIV	DWORD [L_1]
	MOV	EBX,EAX
;
; Line 22:		rv.tm_hour = t %24;
;
	MOV	EAX,EBX
	CDQ
	IDIV	DWORD [L_2]
	MOV	DWORD [ESI+08H],EDX
;
; Line 23:		t /=24;
;
	XCHG	EAX,EBX
	CDQ
	IDIV	DWORD [L_2]
	MOV	EBX,EAX
;
; Line 24:		rv.tm_yday = t;
;
	MOV	DWORD [ESI+01CH],EBX
;
; Line 25:		rv.tm_wday = (t +4 )%7;
;
	LEA	EAX,[EBX+04H]
	CDQ
	IDIV	DWORD [L_3]
	MOV	DWORD [ESI+018H],EDX
;
; Line 26:		rv.tm_year = 70+(rv.tm_yday /365);
;
	MOV	EAX,DWORD [ESI+01CH]
	CDQ
	IDIV	DWORD [L_4]
	ADD	EAX,BYTE 046H
	MOV	DWORD [ESI+014H],EAX
;
; Line 27:		rv.tm_yday = rv.tm_yday % 365;
;
	MOV	EAX,DWORD [ESI+01CH]
	CDQ
	IDIV	DWORD [L_4]
	MOV	DWORD [ESI+01CH],EDX
;
; Line 28:		rv.tm_yday -= (rv.tm_year - 69)/4;
;
	MOV	EAX,DWORD [ESI+014H]
	SUB	EAX,BYTE 045H
	JNS	SHORT	L_5
	ADD	EAX,BYTE 03H
L_5:
	SAR	EAX,02H
	SUB	DWORD [ESI+01CH],EAX
;
; Line 29:		if (rv.tm_yday <0) {
;
	CMP	DWORD [ESI+01CH],BYTE 00H
	JGE	SHORT	L_6
;
; Line 30:			rv.tm_yday = 364;
;
	MOV	DWORD [ESI+01CH],016CH
;
; Line 31:			rv.tm_year--;
;
	DEC	DWORD [ESI+014H]
;
; Line 32:			if (!((rv.tm_year-72)%4))
;
	MOV	EAX,DWORD [ESI+014H]
	SUB	EAX,BYTE 048H
	AND	EAX,BYTE 03H
	JNE	SHORT	L_8
;
; Line 33:				rv.tm_yday++;
;
	INC	DWORD [ESI+01CH]
L_8:
;
; Line 34:		}
;
L_6:
;
; Line 35:		if (rv.tm_yday > 31+28+1 && ((rv.tm_year-72) %4 == 0) && (rv.tm_year != 30)) {
;
	CMP	DWORD [ESI+01CH],BYTE 03CH
	JLE	NEAR	L_10
	MOV	EAX,DWORD [ESI+014H]
	SUB	EAX,BYTE 048H
	AND	EAX,BYTE 03H
	JNE	SHORT	L_10
	CMP	DWORD [ESI+014H],BYTE 01EH
	JE	SHORT	L_10
;
; Line 36:			_monthdays[1] = 29;
;
	MOV	BYTE [01H+__monthdays],01DH
;
; Line 37:		}
;
	JMP	L_11
L_10:
;
; Line 39:			_monthdays[1] = 28;
;
	MOV	BYTE [01H+__monthdays],01CH
L_11:
;
; Line 40:		temp1 = rv.tm_yday;
;
	MOV	EDI,DWORD [ESI+01CH]
;
; Line 41:		rv.tm_mon = -1;
;
	MOV	DWORD [ESI+010H],0FFFFFFFFH
	JMP	L_12
L_14:
;
; Line 43:			temp1-=_monthdays[++rv.tm_mon];
;
	INC	DWORD [ESI+010H]
	MOV	EAX,DWORD [ESI+010H]
	MOVSX	EAX,BYTE [EAX+__monthdays+00H]
	SUB	EDI,EAX
L_12:
;
; Line 42:		while (temp1 >=0) 
;
	TEST	EDI,EDI
	JGE	SHORT	L_14
L_13:
;
; Line 44:		rv.tm_mday = temp1 + _monthdays[rv.tm_mon]+1;
;
	MOV	EAX,DWORD [ESI+010H]
	MOVSX	EAX,BYTE [EAX+__monthdays+00H]
	ADD	EAX,EDI
	INC	EAX
	MOV	DWORD [ESI+0CH],EAX
;
; Line 45:		rv.tm_isdst = 0;
;
	MOV	DWORD [ESI+020H],00H
;
; Line 46:		return rv;
;
	MOV	EAX,ESI
L_15:
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET

	TIMES $$-$ & 3 NOP
L_4:
	DD	016dH
L_3:
	DD	07H
L_2:
	DD	018H
L_1:
	DD	03cH

SECTION _DATA
[GLOBAL	__monthdays]

__monthdays	DB	01FH,01CH,01FH,01EH,01FH,01EH,01FH,01FH,01EH,01FH,01EH,01FH
SECTION _BSS

_rv	RESB	024H
