	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 14:	{
;
_get_progname:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,BYTE 040H
	PUSH	ESI
	MOV	ESI,DWORD [EBP+08H]
;
; Line 20:		__doscall(0x19,&regs);
;
	LEA	EAX,[EBP+0FFFFFFC8H]
	PUSH	EAX
	PUSH	BYTE 019H
	CALL	___doscall
	ADD	ESP,BYTE 08H
;
; Line 21:		buf[0] = regs.b.al + 'A';
;
	MOV	AL,BYTE [EBP+0FFFFFFE4H]
	ADD	AL,BYTE 041H
	MOV	BYTE [ESI+00H],AL
;
; Line 22:		buf[1] = ':';
;
	MOV	BYTE [ESI+01H],03AH
;
; Line 26:		asm push edi
;
	PUSH	EDI
;
; Line 27:		asm push es
;
	PUSH	ES
;
; Line 28:		asm mov ecx,-1
;
	MOV	ECX,0FFFFFFFFH
;
; Line 29:		asm sub edi,edi
;
	SUB	EDI,EDI
;
; Line 30:		asm mov es,[_pspseg]
;
	MOV	ES,WORD [__pspseg]
;
; Line 31:		asm mov es,es:[0x2c]
;
	MOV	ES,WORD [ES:02CH]
;
; Line 32:		asm sub al,al
;
	SUB	AL,AL
L_1:
;
; Line 34:		asm repnz scasb
;
	REPNZ	SCASB
;
; Line 35:		asm cmp es:[edi],al
;
	CMP	BYTE [ES:EDI],AL
;
; Line 36:		asm jnz lp
;
	JNZ	NEAR	L_1
;
; Line 37:		asm add edi,3
;
	ADD	EDI,DWORD 03H
;
; Line 38:		asm movzx edx,byte ptr es:[edi+1]
;
	MOVZX	EDX,BYTE [ES:EDI+01H]
;
; Line 39:	  asm mov [pos],edi
;
	MOV	DWORD [EBP+0FFFFFFC0H],EDI
;
; Line 40:	  asm mov [sel],es
;
	MOV	WORD [EBP+0FFFFFFC6H],ES
;
; Line 41:		asm mov ecx,-1
;
	MOV	ECX,0FFFFFFFFH
;
; Line 42:		asm repnz scasb
;
	REPNZ	SCASB
;
; Line 43:		asm not ecx
;
	NOT	ECX
;
; Line 44:		asm mov [len],ecx
;
	MOV	DWORD [EBP+0FFFFFFFCH],ECX
;
; Line 45:		asm pop es
;
	POP	ES
;
; Line 46:		asm pop edi
;
	POP	EDI
;
; Line 47:		if (_EDX == ':')
;
	CMP	EDX,BYTE 03AH
	JNE	SHORT	L_2
;
; Line 48:			dpmi_copy_to_ds(buf,sel,(ULONG) pos,len);
;
	PUSH	DWORD [EBP+0FFFFFFFCH]
	PUSH	DWORD [EBP+0FFFFFFC0H]
	MOVZX	EAX,WORD [EBP+0FFFFFFC6H]
	PUSH	EAX
	PUSH	ESI
	CALL	_dpmi_copy_to_ds
	ADD	ESP,BYTE 010H
	JMP	L_3
L_2:
;
; Line 50:			dpmi_copy_to_ds(buf+2,sel,(ULONG) pos,len);
;
	PUSH	DWORD [EBP+0FFFFFFFCH]
	PUSH	DWORD [EBP+0FFFFFFC0H]
	MOVZX	EAX,WORD [EBP+0FFFFFFC6H]
	PUSH	EAX
	LEA	EAX,[ESI+02H]
	PUSH	EAX
	CALL	_dpmi_copy_to_ds
	ADD	ESP,BYTE 010H
L_3:
;
; Line 53:	}
;
	POP	ESI
	MOV	ESP,EBP
	POP	EBP
	RET
;
; Line 55:	{
;
_argset:
	PUSH	EBP
	MOV	EBP,ESP
	SUB	ESP,0260H
	PUSH	EBX
	PUSH	ESI
	PUSH	EDI
	MOV	EDI,DWORD __argv_arr
;
; Line 58:		int inquote = 0;
;
	MOV	EBX,00H
;
; Line 59:		ocl = _cmdline = malloc(128);
;
	PUSH	DWORD 080H
	CALL	_malloc
	POP	ECX
	MOV	ESI,EAX
	MOV	DWORD [EBP+0FFFFFFFCH],EAX
;
; Line 60:		dpmi_copy_to_ds(_cmdline,_pspseg,0x80,128);
;
	PUSH	DWORD 080H
	PUSH	DWORD 080H
	MOVSX	EAX,WORD [__pspseg]
	PUSH	EAX
	PUSH	ESI
	CALL	_dpmi_copy_to_ds
	ADD	ESP,BYTE 010H
;
; Line 61:	  _cmdline[_cmdline[0]+1] = 0;
;
	MOVSX	EAX,BYTE [ESI+00H]
	MOV	BYTE [ESI+EAX+01H+00H],00H
;
; Line 62:		_cmdline++;
;
	INC	ESI
;
; Line 63:		_argc = 1;
;
	MOV	DWORD [__argc],01H
	JMP	L_4
L_6:
	JMP	L_7
L_9:
	INC	ESI
L_7:
;
; Line 65:			while ((_ctype[ (*_cmdline) ] & (1            ))) _cmdline++;
;
	MOVSX	EAX,BYTE [ESI+00H]
	MOVZX	EAX,BYTE [EAX+__ctype+00H]
	AND	EAX,BYTE 01H
	JNE	SHORT	L_9
L_8:
;
; Line 66:			if (*_cmdline) {
;
	CMP	BYTE [ESI+00H],BYTE 00H
	JE	NEAR	L_10
;
; Line 67:				int i = 0;
;
	MOV	DWORD [EBP+0FFFFFDA0H],00H
	JMP	L_12
L_14:
;
; Line 69:					if (*_cmdline == '"') {
;
	MOVSX	EAX,BYTE [ESI+00H]
	CMP	EAX,BYTE 022H
	JNE	SHORT	L_15
;
; Line 70:						inquote = !inquote ;
;
	TEST	EBX,EBX
	SETE	AL
	MOVZX	EAX,AL
	MOV	EBX,EAX
;
; Line 71:						_cmdline++ ;
;
	INC	ESI
;
; Line 72:						continue ;
;
	JMP	L_12
L_15:
;
; Line 74:					buf[i++] = *_cmdline++;
;
	MOV	EAX,ESI
	INC	ESI
	MOV	ECX,DWORD [EBP+0FFFFFDA0H]
	INC	DWORD [EBP+0FFFFFDA0H]
	MOV	AL,BYTE [EAX+00H]
	MOV	BYTE [EBP+ECX+0FFFFFDA4H],AL
;
; Line 75:				}
;
L_12:
;
; Line 68:				while ((inquote || !(_ctype[ (*_cmdline) ] & (1            ))) && *_cmdline)  {
;
	TEST	EBX,EBX
	JNE	SHORT	L_18
	MOVSX	EAX,BYTE [ESI+00H]
	MOVZX	EAX,BYTE [EAX+__ctype+00H]
	AND	EAX,BYTE 01H
	JNE	SHORT	L_17
L_18:
	CMP	BYTE [ESI+00H],BYTE 00H
	JNE	NEAR	L_14
L_17:
L_13:
;
; Line 76:				buf[i++] = 0;
;
	MOV	EAX,DWORD [EBP+0FFFFFDA0H]
	INC	DWORD [EBP+0FFFFFDA0H]
	MOV	BYTE [EBP+EAX+0FFFFFDA4H],00H
;
; Line 77:				bufp[_argc++] = strdup(buf) ;
;
	LEA	EAX,[EBP+0FFFFFDA4H]
	PUSH	EAX
	CALL	_strdup
	POP	ECX
	MOV	ECX,DWORD [__argc]
	INC	DWORD [__argc]
	MOV	DWORD [EBP+ECX*4+0FFFFFE6CH],EAX
;
; Line 78:			}
;
L_10:
;
; Line 79:		}
;
L_4:
;
; Line 64:		while (*_cmdline) {
;
	CMP	BYTE [ESI+00H],BYTE 00H
	JNE	NEAR	L_6
L_5:
;
; Line 80:		_argv_arr = calloc((_argc+1),sizeof(char *));
;
	PUSH	BYTE 04H
	MOV	EAX,DWORD [__argc]
	INC	EAX
	PUSH	EAX
	CALL	_calloc
	ADD	ESP,BYTE 08H
	MOV	DWORD [EDI+00H],EAX
;
; Line 81:		memcpy(_argv_arr,bufp,_argc*sizeof(char *));
;
	MOV	ECX,DWORD [__argc]
	SAL	ECX,02H
	LEA	EAX,[EBP+0FFFFFE6CH]
	PUSH	ESI
	PUSH	EDI
	MOV	ESI,EAX
	MOV	EDI,DWORD [EDI+00H]
	CLD
	REPNZ	MOVSB
	POP	EDI
	POP	ESI
;
; Line 82:		_cmdline = ocl;
;
	MOV	ESI,DWORD [EBP+0FFFFFFFCH]
;
; Line 83:		get_progname(_cmdline);
;
	PUSH	ESI
	CALL	_get_progname
	POP	ECX
;
; Line 84:		_argv_arr[0] = _cmdline;
;
	MOV	EAX,DWORD [EDI+00H]
	MOV	DWORD [EAX+00H],ESI
;
; Line 85:	}
;
	POP	EDI
	POP	ESI
	POP	EBX
	MOV	ESP,EBP
	POP	EBP
	RET

SECTION _DATA
SECTION _BSS
[GLOBAL	__argc]

__argc	RESB	04H
[GLOBAL	__argv_arr]

__argv_arr	RESB	04H
SECTION cstartup
	DD	_argset,15

SECTION _TEXT
[EXTERN	___doscall]
[EXTERN	_calloc]
[EXTERN	_malloc]
[EXTERN	_dpmi_copy_to_ds]
[EXTERN	_strdup]

SECTION _DATA
[EXTERN	__pspseg]
[EXTERN	__ctype]
