	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
;
; Line 12:	{
;
_envset:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,0400H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	EDI,DWORD __environ
;
; Line 13:		int count = _ll_getenv(0,0),i;
;
	PUSH	BYTE 00H
	PUSH	BYTE 00H
	CALL	__ll_getenv
	ADD	ESP,BYTE 08H
	MOV	ESI,EAX
;
; Line 14:		if (count) {
;
	TEST	ESI,ESI
	JE	NEAR	L_1
;
; Line 15:			_environ  = malloc(sizeof(char *)*(count+1));
;
	LEA	EAX,[ESI+01H]
	SAL	EAX,02H
	PUSH	EAX
	CALL	_malloc
	POP	ECX
	MOV	DWORD [EDI+00H],EAX
	MOV	EBX,01H
	JMP	L_5
L_3:
;
; Line 18:				_ll_getenv(buf,i);
;
	PUSH	EBX
	LEA	EAX,[EBP+0FFFFFC00H]
	PUSH	EAX
	CALL	__ll_getenv
	ADD	ESP,BYTE 08H
;
; Line 19:			  _environ[i-1] = strdup(buf) ;
;
	LEA	EAX,[EBP+0FFFFFC00H]
	PUSH	EAX
	CALL	_strdup
	POP	ECX
	MOV	ECX,DWORD [EDI+00H]
	LEA	EDX,[EBX+0FFFFFFFFH]
	MOV	DWORD [ECX+EDX*4+00H],EAX
;
; Line 20:			}
;
;
; Line 16:		  for (i=1; i<=count; i++) {
;
L_4:
	INC	EBX
L_5:
	CMP	EBX,ESI
	JLE	NEAR	L_3
L_6:
;
; Line 21:			_environ[count] = 0;
;
	MOV	EAX,DWORD [EDI+00H]
	MOV	DWORD [EAX+ESI*4+00H],00H
;
; Line 22:		}
;
	JMP	L_2
L_1:
;
; Line 24:			_environ = calloc(sizeof(char *),1);
;
	PUSH	BYTE 01H
	PUSH	BYTE 04H
	CALL	_calloc
	ADD	ESP,BYTE 08H
	MOV	DWORD [EDI+00H],EAX
;
; Line 25:		}
;
L_2:
;
; Line 26:	}
;
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET

SECTION _DATA
SECTION _BSS
[GLOBAL	__environ]

__environ	RESB	04H
SECTION cstartup
	DD	_envset,19

SECTION _TEXT
[EXTERN	_calloc]
[EXTERN	_malloc]
[EXTERN	__ll_getenv]
[EXTERN	_strdup]
