// BENCHFN_n.c
// Generated by decompiling BENCHFN.EXE
// using Reko decompiler version 0.11.6.0.

#include "BENCHFN.h"

struct seg0800_t * g_ptr8000 = &g_tFFFFDBBA; // 00008000
// 0800:0121: void __exit()
// Called from:
//      fn0800-01E9
//      _exit
void __exit()
{
	selector seg0800;
	struct Eq_n * ds_n = seg0800->ptr01F8;
	__restorezero(ds_n);
	(seg0800->*ds_n->ptr05DC)();
	uint8 Eq_n::* si_n = Eq_n::a0000;
	word16 cx_n;
	uint16 ah_al_n = 0x00;
	for (cx_n = 0x2F; cx_n != 0x00; --cx_n)
	{
		ah_al_n += (uint16) (ds_n->*si_n);
		++si_n;
	}
	if (ah_al_n != 3383)
		fn0800-01DA(&ds_n->b002F, 0x19);
	selector ss;
	struct Eq_n Eq_n::* sp_n;
	msdos_terminate((ss->*sp_n).b0002);
}

// 0800:0162: void fn0800-0162(Register (ptr16 Eq_n) ds)
void fn0800-0162(struct Eq_n * ds)
{
	ds->dw0074 = msdos_get_interrupt_vector(0x00);
	ds->dw0078 = msdos_get_interrupt_vector(0x04);
	ds->dw007C = msdos_get_interrupt_vector(0x05);
	ds->dw0080 = msdos_get_interrupt_vector(0x06);
	struct Eq_n * cs;
	msdos_set_interrupt_vector(0x00, &cs->t0158);
}

// 0800:01A5: void __restorezero(Register (ptr16 Eq_n) ds)
// Called from:
//      __exit
void __restorezero(struct Eq_n * ds)
{
	msdos_set_interrupt_vector(0x00, ds->ptr0074);
	msdos_set_interrupt_vector(0x04, ds->ptr0078);
	msdos_set_interrupt_vector(0x05, ds->ptr007C);
	msdos_set_interrupt_vector(0x06, ds->ptr0080);
}

// 0800:01DA: void fn0800-01DA(Sequence (ptr32 char) ds_dx, Register word16 cx)
// Called from:
//      __exit
//      fn0800-01E9
void fn0800-01DA(char * ds_dx, word16 cx)
{
	word16 ax_n;
	msdos_write_file(0x02, cx, ds_dx, out ax_n);
}

// 0800:01E2: void _abort()
// Called from:
//      __setargv
//      __setenvp
void _abort()
{
	word16 cx;
	char Eq_n::* dx;
	fn0800-01E9(cx, dx);
}

// 0800:01E9: void fn0800-01E9(Register word16 cx, Register (memptr (ptr16 Eq_n) char) dx)
// Called from:
//      __setenvp
void fn0800-01E9(word16 cx, char Eq_n::* dx)
{
	selector seg0800;
	fn0800-01DA(&(seg0800->ptr01F8->*dx), cx);
	__exit();
}

struct Eq_n * g_ptr01F8 = null; // 0800:01F8
// 0800:01FA: void _f3()
// Called from:
//      fn0800-01E9
//      _f2
void _f3()
{
}

// 0800:01FF: void _f2()
// Called from:
//      f1_name_overridden
void _f2()
{
	_f3();
	_f3();
	_f3();
	_f3();
	_f3();
	_f3();
	_f3();
	_f3();
	_f3();
	_f3();
}

// 0800:0222: void f1_name_overridden()
// Called from:
//      _f0
void f1_name_overridden()
{
	_f2();
	_f2();
	_f2();
	_f2();
	_f2();
	_f2();
	_f2();
	_f2();
	_f2();
	_f2();
}

// 0800:0245: void _f0()
// Called from:
//      _main
void _f0()
{
	f1_name_overridden();
	f1_name_overridden();
	f1_name_overridden();
	f1_name_overridden();
	f1_name_overridden();
	f1_name_overridden();
	f1_name_overridden();
	f1_name_overridden();
	f1_name_overridden();
}

// 0800:0265: void _main(Register Eq_n cx, Register Eq_n dx, Register Eq_n bx, Register (ptr16 Eq_n) es, Register Eq_n ds)
void _main(Eq_n cx, Eq_n dx, Eq_n bx, struct Eq_n * es, Eq_n ds)
{
	struct Eq_n Eq_n::* bp_n;
	Eq_n bx_n;
	Eq_n dx_n = _scanf(_printf(cx, dx, bx, ds, 404), es, ds, 0x01B0, out bx_n, out bp_n);
	struct Eq_n Eq_n::* sp_n = &Eq_n::tBADDCAFE;
	Eq_n cx_n;
	selector ss;
	cx_n.u2 = (ss->*sp_n).t0002.u2;
	(ss->*sp_n).t0002.u2 = (ss->*bp_n).tFFFFFFFE.u2;
	(ss->*sp_n).t0000.u1 = (ss->*bp_n).tFFFFFFFC.u1;
	(ss->*sp_n).tFFFFFFFE.u2 = (struct Eq_n *) 0x01B4;
	_printf(cx_n, dx_n, bx_n, ds, (ss->*sp_n).tFFFFFFFE.u2);
	(ss->*bp_n).tFFFFFFFA.u2 = (struct Eq_n *) 0x00;
	(ss->*bp_n).tFFFFFFF8.u1 = (cup16) 0x01;
	Eq_n dx_n;
	while (true)
	{
		dx_n.u2 = (ss->*bp_n).tFFFFFFFA.u2;
		Eq_n ax_n;
		ax_n.u1 = (ss->*bp_n).tFFFFFFF8.u1;
		if (dx_n >= ((ss->*bp_n).tFFFFFFFE).u2 && (dx_n > ((ss->*bp_n).tFFFFFFFE).u2 || ax_n > ((ss->*bp_n).tFFFFFFFC).u1))
			break;
		_f0();
		(ss->*bp_n).tFFFFFFF8.u0 = (ui32) ((ss->*bp_n).tFFFFFFF8.u0 + 0x01);
	}
	(ss->*sp_n).t0002.u2 = (struct Eq_n *) 0x01CE;
	_printf(cx_n, dx_n, bx_n, ds, (ss->*sp_n).t0002.u2);
}

// 0800:02C5: Register word16 __IOERROR(Register (ptr16 Eq_n) ds, Stack Eq_n wArg02)
// Called from:
//      __read
//      __write
//      _lseek
//      _eof
word16 __IOERROR(struct Eq_n * ds, Eq_n wArg02)
{
	Eq_n si_n = wArg02;
	Eq_n si_n;
	if (wArg02 >= 0x00)
	{
		if (wArg02 <= 88)
			goto l0800_nD8;
	}
	else
	{
		si_n = -wArg02;
		if (si_n <= 0x23)
		{
			ds->t01D8.u0 = ~0x00;
l0800_nF1:
			ds->t0094 = si_n;
			return ~0x00;
		}
	}
	si_n.u0 = 0x57;
l0800_nD8:
	ds->t01D8 = si_n;
	si_n.u1 = (int16) (ds->*((word16) si_n + 474));
	goto l0800_nF1;
}

// 0800:0301: void _exit(Register (ptr16 Eq_n) ds, Stack word16 wArg02)
void _exit(struct Eq_n * ds, word16 wArg02)
{
	selector seg0800;
	while (true)
	{
		ui16 ax_n = ds->w023E;
		--ds->w023E;
		if (ax_n == 0x00)
			break;
		ui16 bx_n = ds->w023E;
		(seg0800->*((ds->a05E8))[0][bx_n])();
	}
	(seg0800->*ds->ptr0234)();
	(seg0800->*ds->ptr0236)();
	(seg0800->*ds->ptr0238)();
	selector ss;
	struct Eq_n Eq_n::* sp_n;
	(ss->*sp_n).wFFFFFFFE = wArg02;
	__exit();
}

Eq_n g_t0330 = // 0800:0330
	{
		0x00
	};
struct Eq_n * g_ptr0332 = null; // 0800:0332
// 0800:0336: void __setargv(Register (ptr16 Eq_n) ds, Stack Eq_n wArg00)
void __setargv(struct Eq_n * ds, Eq_n wArg00)
{
	mp16 fp;
	selector seg0800;
	seg0800->t0330 = wArg00;
	seg0800->ptr0332 = ds;
	struct Eq_n * es_n = ds->ptr0090;
	uint16 ax_n = (uint16) es_n->b0080;
	word16 si_n = ds->w008A;
	word16 cx_n = 0x01;
	struct Eq_n * es_n = es_n;
	if (ds->b0092 >= 0x03)
	{
		es_n = ds->ptr008C;
		byte Eq_n::* di_n = si_n + 0x02;
		cui16 cx_n = 0x7F;
		while (cx_n != 0x00)
		{
			byte Eq_n::* di_n;
			di_n = di_n + 1;
			--cx_n;
			di_n = di_n;
			if (es_n->*di_n != 0x00)
				break;
		}
		byte cl_n = (byte) cx_n;
		byte ch_n = SLICE(cx_n, byte, 8);
		if (cx_n == 0x00)
		{
l0800_nE7:
			_abort();
			return;
		}
		cx_n = SEQ(ch_n, cl_n ^ 0x7F);
	}
	<unknown>* di_n = fp - ((ax_n + 0x02) + cx_n & ~0x01);
	if (di_n >= 0x00)
	{
		struct Eq_n * ss;
		ss->*((word16) di_n - 2) = cx_n;
		Eq_n cx_n = cx_n - 0x01;
		memcpy(di_n, si_n + 0x02, (uint32) cx_n);
		Eq_n di_n = di_n + cx_n;
		ss->*di_n = 0x00;
		word16 si_n = 0x81;
		uint16 cx_n = ax_n + 0x01;
		word16 ax_n = 0x00;
		byte ah_n;
		byte al_n;
		do
		{
l0800_nA3:
			word16 ax_n;
			fn0800-03BF(si_n, (word16) di_n + 1, ax_n, cx_n, out ax_n, out cx_n, out si_n);
			Eq_n C_n;
			C_n.u0 = <invalid>;
			Eq_n Z_n;
			Z_n.u0 = <invalid>;
			Eq_n v36_n = C_n;
			if ((Z_n | C_n) == 0x00)
			{
				Eq_n C_n;
				Eq_n Z_n;
				do
				{
					if (v36_n)
					{
						word16 cx_n = (word16) (ss->*((char *) di_n - 2));
						struct Eq_n * ds_n = seg0800->ptr0332;
						ds_n->w0084 = 0x01;
						Eq_n si_n = di_n;
						Eq_n bp_n = di_n - 0x04;
						if (di_n < 0x04)
							goto l0800_nE7;
						ds_n->t0086 = di_n - 0x04;
						while (cx_n != 0x00)
						{
							ss->*bp_n = si_n;
							bp_n = (word16) bp_n + 2;
							byte al_n;
							do
							{
								al_n = (byte) (ss->*si_n);
								si_n = (word16) si_n + 1;
								--cx_n;
							} while (al_n != 0x00 && cx_n != 0x00);
							if (al_n != 0x00)
								break;
						}
						ss->*bp_n = 0x00;
						seg0800->t0330();
						return;
					}
					fn0800-03BF(si_n, (word16) di_n + 1, ax_n, cx_n, out ax_n, out cx_n, out si_n);
					C_n.u0 = <invalid>;
					Z_n.u0 = <invalid>;
					v36_n = C_n;
				} while ((Z_n | C_n) != 0x00);
			}
			ah_n = SLICE(ax_n, byte, 8);
			al_n = (byte) ax_n;
			if (al_n == 0x20 || al_n == 0x0D)
				break;
			ax_n = ax_n;
		} while (al_n != 0x09);
		ax_n = SEQ(ah_n, 0x00);
		goto l0800_nA3;
	}
	goto l0800_nE7;
}

// 0800:03BF: FlagGroup ui32 fn0800-03BF(Sequence (ptr32 Eq_n) ds_si, Sequence (ptr32 byte) es_di, Register word16 ax, Register uint16 cx, Register out word16 axOut, Register out uint16 cxOut, Register out word16 siOut)
// Called from:
//      __setargv
ui32 fn0800-03BF(struct Eq_n * ds_si, byte * es_di, word16 ax, uint16 cx, word16 & axOut, uint16 & cxOut, word16 & siOut)
{
	word16 si = (word16) ds_si;
	byte al_n = (byte) ax;
	if (ax != 0x00)
		*es_di = al_n;
	ui32 Z_n = cond(0x00) & 0x04;
	ui32 C_n = 0x02;
	word16 ax_n = SEQ(al_n, 0x00);
	if (cx != 0x00)
	{
		byte al_n = ds_si->b0000;
		Eq_n SCZO_n;
		SCZO_n.u1 = cond(al_n - 0x22);
		++si;
		--cx;
		Z_n = SCZO_n & 0x04;
		ax_n = SEQ(al_n, al_n - 0x22);
		C_n = SCZO_n & 0x02;
		if (al_n != 0x22)
		{
			ax_n = SEQ(al_n, al_n);
			if (al_n == 0x5C && ds_si->b0001 == 0x22)
			{
				si += 2;
				cx -= 0x02;
				ax_n = SEQ(al_n, ds_si->b0001);
			}
			Z_n = cond(si) & 0x04;
			C_n = 0x00;
		}
	}
	axOut = ax_n;
	cxOut = cx;
	siOut = si;
	return C_n | Z_n;
}

// 0800:0421: void __setenvp(Register (ptr16 Eq_n) ds)
void __setenvp(struct Eq_n * ds)
{
	cu16 cx_n = ds->w008A;
	<unknown>* ax_n = _malloc(ds, cx_n);
	if (ax_n != 0x00)
	{
		memcpy(ax_n, *ds->ptr008C, (uint32) cx_n);
		Eq_n ax_n = _malloc(ds, ds->w008E);
		ds->t0088 = ax_n;
		Eq_n di_n = ax_n;
		Eq_n bx_n = ax_n;
		if (ax_n != 0x00)
		{
			word16 cx_n = ~0x00;
			do
			{
				ds->*bx_n = di_n;
				bx_n = (word16) bx_n + 2;
				while (cx_n != 0x00)
				{
					di_n = (word16) di_n + 1;
					--cx_n;
					if (ds->*di_n != 0x00)
						break;
				}
			} while (ds->*di_n != 0x00);
			ds->*bx_n = 0x00;
			return;
		}
	}
	_abort();
}

// 0800:0491: void ___pull_free_block(Register (ptr16 Eq_n) ds, Stack Eq_n wArg02)
// Called from:
//      _malloc
//      fn0800-15CF
//      fn0800-1606
void ___pull_free_block(struct Eq_n * ds, Eq_n wArg02)
{
	Eq_n ax_n = ds->*((word16) wArg02 + 6);
	ds->t062A = ax_n;
	if (ax_n == wArg02)
		ds->t062A.u0 = 0x00;
	else
	{
		struct Eq_n Eq_n::* si_n = (struct Eq_n Eq_n::*) (ds->*((word16) wArg02 + 4));
		ds->*((word16) ds->t062A + 4) = si_n;
		(ds->*si_n).t0006.u0 = (uint16) ds->t062A;
	}
}

// 0800:04BF: Register (memptr (ptr16 Eq_n) Eq_n) fn0800-04BF(Register (ptr16 Eq_n) ds, Stack Eq_n wArg02, Stack Eq_n wArg04)
// Called from:
//      _malloc
struct Eq_n Eq_n::* fn0800-04BF(struct Eq_n * ds, Eq_n wArg02, Eq_n wArg04)
{
	ds->*wArg02 -= wArg04;
	Eq_n si_n = ds->*wArg02 + wArg02;
	ds->*si_n = (word16) wArg04.u0 + 1;
	ds->*((word16) si_n + 2) = wArg02;
	if (ds->t0628 == wArg02)
		ds->t0628 = si_n;
	else
		ds->*((word16) (si_n + wArg04) + 2) = (word16) si_n;
	return (word16) si_n + 4;
}

// 0800:04F9: Register word16 fn0800-04F9(Register (ptr16 Eq_n) ds, Stack Eq_n wArg02)
// Called from:
//      _malloc
word16 fn0800-04F9(struct Eq_n * ds, Eq_n wArg02)
{
	Eq_n ax_n = ___sbrk(ds, (uint32) wArg02);
	word16 ax_n;
	if (ax_n == ~0x00)
		ax_n = 0x00;
	else
	{
		ds->*((word16) ax_n + 2) = ds->t0628;
		ds->*ax_n = (word16) wArg02.u1 + 1;
		ds->t0628 = ax_n;
		ax_n = (word16) ds->t0628 + 4;
	}
	return ax_n;
}

// 0800:0536: Register (memptr (ptr16 Eq_n) Eq_n) fn0800-0536(Register (ptr16 Eq_n) ds, Stack Eq_n wArg02)
// Called from:
//      _malloc
union Eq_n Eq_n::* fn0800-0536(struct Eq_n * ds, Eq_n wArg02)
{
	Eq_n ax_n = ___sbrk(ds, (uint32) wArg02);
	union Eq_n Eq_n::* ax_n;
	if (ax_n == ~0x00)
		ax_n = &Eq_n::t0000;
	else
	{
		ds->t062C = ax_n;
		ds->t0628 = ax_n;
		ds->*ax_n = (word16) wArg02.u1 + 1;
		ax_n = (word16) ax_n + 4;
	}
	return ax_n;
}

// 0800:0570: Register (memptr (ptr16 Eq_n) Eq_n) _malloc(Register (ptr16 Eq_n) ds, Stack cu16 wArg02)
// Called from:
//      __setenvp
//      _setvbuf
struct Eq_n Eq_n::* _malloc(struct Eq_n * ds, cu16 wArg02)
{
	struct Eq_n Eq_n::* ax_n;
	if (wArg02 != 0x00 && wArg02 <= ~0x0B)
	{
		Eq_n ax_n = wArg02 + 11 & ~0x07;
		if (ds->t062C == 0x00)
			ax_n = fn0800-0536(ds, ax_n);
		else
		{
			Eq_n si_n = ds->t062A;
			if (si_n != 0x00)
			{
				do
				{
					if (ds->*si_n >= (word16) ax_n + 40)
					{
						ax_n = fn0800-04BF(ds, si_n, ax_n);
						return ax_n;
					}
					if (ds->*si_n >= ax_n)
					{
						___pull_free_block(ds, si_n);
						ds->*si_n = (word16) (ds->*si_n) + 1;
						ax_n = (word16) si_n + 4;
						return ax_n;
					}
					si_n = ds->*((word16) si_n + 6);
				} while (si_n != ds->t062A);
			}
			ax_n = fn0800-04F9(ds, ax_n);
		}
	}
	else
		ax_n = &Eq_n::t0000;
	return ax_n;
}

// 0800:05E3: void ___brk(Register (ptr16 Eq_n) ds, Stack Eq_n wArg02)
// Called from:
//      _brk
void ___brk(struct Eq_n * ds, Eq_n wArg02)
{
	Eq_n fp;
	if (wArg02 < fp - 0x0102)
		ds->t009E = wArg02;
	else
		ds->t0094.u0 = 0x08;
}

// 0800:0607: Register Eq_n ___sbrk(Register (ptr16 Eq_n) ds, Stack uint32 dwArg02)
// Called from:
//      fn0800-04F9
//      fn0800-0536
Eq_n ___sbrk(struct Eq_n * ds, uint32 dwArg02)
{
	ui32 dx_ax_n = dwArg02 + (uint32) ds->t009E;
	Eq_n ax_n = (word16) dx_ax_n;
	Eq_n cx_n = (word16) dx_ax_n + 0x0100;
	Eq_n fp;
	Eq_n ax_n;
	if (SLICE(dx_ax_n + 0x0100, word16, 16) == 0x00 && cx_n < fp - 2)
	{
		Eq_n v15_n = ds->t009E;
		ds->t009E = ax_n;
		ax_n = v15_n;
	}
	else
	{
		ds->t0094.u0 = 0x08;
		ax_n.u0 = ~0x00;
	}
	return ax_n;
}

// 0800:063B: void _brk(Register (ptr16 Eq_n) ds, Stack Eq_n wArg02)
// Called from:
//      fn0800-1606
void _brk(struct Eq_n * ds, Eq_n wArg02)
{
	___brk(ds, wArg02);
}

// 0800:065B: Register ci16 fn0800-065B(Register (ptr16 Eq_n) ds, Stack (memptr (ptr16 Eq_n) Eq_n) wArg02)
// Called from:
//      _fseek
ci16 fn0800-065B(struct Eq_n * ds, struct Eq_n Eq_n::* wArg02)
{
	ci16 si_n = (ds->*wArg02).w0000;
	ci16 wLoc04_n = si_n;
	ci16 ax_n;
	if (((ds->*wArg02).w0002 & 0x40) != 0x00)
		ax_n = si_n;
	else
	{
		Eq_n di_n;
		di_n.u0 = (ds->*wArg02).t000A.u0;
		while (true)
		{
			--si_n;
			if (si_n == 0x00)
				break;
			Eq_n di_n;
			di_n = (word16) di_n + 1;
			di_n = di_n;
			if (ds->*di_n == 0x0A)
				++wLoc04_n;
		}
		ax_n = wLoc04_n;
	}
	return ax_n;
}

// 0800:06A2: void _fseek(Register (ptr16 Eq_n) ds, Stack (memptr (ptr16 Eq_n) Eq_n) wArg02, Stack (ptr32 int32) dwArg04, Stack word16 wArg08)
// Called from:
//      _setvbuf
void _fseek(struct Eq_n * ds, struct Eq_n Eq_n::* wArg02, int32 * dwArg04, word16 wArg08)
{
	word16 dx_n;
	if (_fflush(ds, wArg02) == 0x00)
	{
		if (wArg08 == 0x01 && (ds->*wArg02).w0000 > 0x00)
			dwArg04 -= (uint32) fn0800-065B(ds, wArg02);
		(ds->*wArg02).w0002 &= ~0x01A0;
		(ds->*wArg02).w0000 = 0x00;
		(ds->*wArg02).t000A.u0 = (ds->*wArg02).t0008.u0;
		word16 ax_n = _lseek(ds, (int16) (ds->*wArg02).b0004, dwArg04, (byte) wArg08, out dx_n);
		if (dx_n != ~0x00 || ax_n != ~0x00)
			;
	}
}

// 0800:075B: void fn0800-075B(Register (ptr16 Eq_n) ds)
// Called from:
//      fn0800-0782
//      _fgetc
void fn0800-075B(struct Eq_n * ds)
{
	word16 di_n = 0x14;
	struct Eq_n Eq_n::* si_n = &Eq_n::t0342;
	while (true)
	{
		--di_n;
		if (di_n == 0x00)
			break;
		if (((ds->*si_n).w0002 & 0x0300) == 0x0300)
			_fflush(ds, si_n);
		++si_n;
	}
}

// 0800:0782: Register word16 fn0800-0782(Register (ptr16 Eq_n) ds, Stack (memptr (ptr16 Eq_n) Eq_n) wArg02)
// Called from:
//      _fgetc
word16 fn0800-0782(struct Eq_n * ds, struct Eq_n Eq_n::* wArg02)
{
	if (((ds->*wArg02).w0002 & 0x0200) != 0x00)
		fn0800-075B(ds);
	cu16 v12_n = (ds->*wArg02).w0006;
	Eq_n ax_n;
	ax_n.u0 = (ds->*wArg02).t0008.u0;
	(ds->*wArg02).t000A.u0 = (int16) ax_n;
	ci16 ax_n = _read(ds, (int16) (ds->*wArg02).b0004, ax_n, v12_n);
	(ds->*wArg02).w0000 = ax_n;
	word16 ax_n;
	if (ax_n > 0x00)
	{
		(ds->*wArg02).w0002 &= ~0x20;
		ax_n = 0x00;
	}
	else
	{
		if ((ds->*wArg02).w0000 == 0x00)
			(ds->*wArg02).w0002 = (ds->*wArg02).w0002 & 65151 | 0x20;
		else
		{
			(ds->*wArg02).w0000 = 0x00;
			(ds->*wArg02).w0002 |= 0x10;
		}
		ax_n = ~0x00;
	}
	return ax_n;
}

// 0800:07F2: void _fgetc(Register (ptr16 Eq_n) ds, Stack (memptr (ptr16 Eq_n) Eq_n) wArg02)
void _fgetc(struct Eq_n * ds, struct Eq_n Eq_n::* wArg02)
{
	do
	{
		ci16 v9_n = (ds->*wArg02).w0000 - 0x01;
		(ds->*wArg02).w0000 = v9_n;
		if (v9_n >= 0x00)
		{
			(ds->*wArg02).t000A.u0 = (int16) ((ds->*wArg02).t000A.u0 + 0x01);
			return;
		}
		ci16 v16_n = (ds->*wArg02).w0000 + 0x01;
		(ds->*wArg02).w0000 = v16_n;
		if (v16_n < 0x00 || ((ds->*wArg02).w0002 & 0x0110) != 0x00)
		{
			(ds->*wArg02).w0002 |= 0x10;
			return;
		}
		while (true)
		{
			(ds->*wArg02).w0002 |= 0x80;
			if ((ds->*wArg02).w0006 != 0x00)
				break;
			if (ds->w04AA != 0x00 || wArg02 != &Eq_n::t0342)
			{
				byte bLoc03;
				do
				{
					if (((ds->*wArg02).w0002 & 0x0200) != 0x00)
						fn0800-075B(ds);
					mp16 fp;
					if (__read(ds, (int16) (ds->*wArg02).b0004, fp - 3, 0x01) != 0x01)
					{
						if (_eof(ds, (int16) (ds->*wArg02).b0004) != 0x01)
							(ds->*wArg02).w0002 |= 0x10;
						else
							(ds->*wArg02).w0002 = (ds->*wArg02).w0002 & 65151 | 0x20;
						return;
					}
				} while (bLoc03 == 0x0D && ((ds->*wArg02).w0002 & 0x40) == 0x00);
				(ds->*wArg02).w0002 &= ~0x20;
				return;
			}
			if (_isatty((int16) (ds->*wArg02).b0004) == 0x00)
				(ds->*wArg02).w0002 &= ~0x0200;
			ci16 ax_n;
			if (((ds->*wArg02).w0002 & 0x0200) != 0x00)
				ax_n = 0x01;
			else
				ax_n = 0x00;
			_setvbuf(ds, wArg02, 0x00, ax_n, 0x0200);
		}
	} while (fn0800-0782(ds, wArg02) == 0x00);
}

// 0800:08F2: Register cui16 _isatty(Stack int16 wArg02)
// Called from:
//      _fgetc
cui16 _isatty(int16 wArg02)
{
	cui16 dx_n;
	msdos_ioctl_get_device_info(wArg02, out dx_n);
	return dx_n & 0x80;
}

// 0800:0904: void _setvbuf(Register (ptr16 Eq_n) ds, Stack (memptr (ptr16 Eq_n) Eq_n) wArg02, Stack Eq_n wArg04, Stack ci16 wArg06, Stack cu16 wArg08)
// Called from:
//      _fgetc
void _setvbuf(struct Eq_n * ds, struct Eq_n Eq_n::* wArg02, Eq_n wArg04, ci16 wArg06, cu16 wArg08)
{
	if ((ds->*wArg02).ptr000E != wArg02 || (wArg06 > 0x02 || wArg08 > 0x7FFF))
		return;
	if (ds->w04AC == 0x00 && wArg02 == &Eq_n::t0352)
		ds->w04AC = 0x01;
	else if (ds->w04AA == 0x00 && wArg02 == &Eq_n::t0342)
		ds->w04AA = 0x01;
	if ((ds->*wArg02).w0000 != 0x00)
		_fseek(ds, wArg02, 0x00, 0x01);
	if (((ds->*wArg02).w0002 & 0x04) != 0x00)
		_free(ds, (ds->*wArg02).t0008.u0);
	(ds->*wArg02).w0002 &= ~0x0C;
	(ds->*wArg02).w0006 = 0x00;
	(ds->*wArg02).t0008.u0 = (int16) (&wArg02->b0004 + 1);
	(ds->*wArg02).t000A.u0 = (int16) (&wArg02->b0004 + 1);
	if (wArg06 == 0x02 || wArg08 <= 0x00)
		return;
	ds->w0234 = 0x09D6;
	if (wArg04 == 0x00)
	{
		Eq_n ax_n = _malloc(ds, wArg08);
		wArg04 = ax_n;
		if (ax_n == 0x00)
			return;
		(ds->*wArg02).w0002 |= 0x04;
	}
	(ds->*wArg02).t000A.u0 = (int16) wArg04;
	(ds->*wArg02).t0008.u0 = (int16) wArg04;
	(ds->*wArg02).w0006 = wArg08;
	if (wArg06 == 0x01)
		(ds->*wArg02).w0002 |= 0x08;
}

// 0800:09F7: Register Eq_n _read(Register (ptr16 Eq_n) ds, Stack int16 wArg02, Stack Eq_n wArg04, Stack cu16 wArg06)
// Called from:
//      fn0800-0782
Eq_n _read(struct Eq_n * ds, int16 wArg02, Eq_n wArg04, cu16 wArg06)
{
	Eq_n ax_n;
	if (wArg06 >= 0x01 && (((ds->a0482))[0][wArg02] & 0x0200) == 0x00)
	{
		Eq_n di_n;
		do
		{
			Eq_n ax_n = __read(ds, wArg02, wArg04, wArg06);
			if (ax_n < 0x01 || (((ds->a0482))[0][wArg02] & 0x8000) != 0x00)
			{
				ax_n = ax_n;
				return ax_n;
			}
			Eq_n cx_n = ax_n;
			Eq_n si_n = wArg04;
			di_n = wArg04;
			do
			{
				byte al_n = (byte) (ds->*si_n);
				si_n = (word16) si_n + 1;
				if (al_n == 0x1A)
				{
					word16 dx_n;
					_lseek(ds, wArg02, SEQ(0x00 - (word16) (cx_n != 0x00), -cx_n), 0x02, out dx_n);
					ds->a0482[0][wArg02] = ds->a0482[0][wArg02] | 0x0200;
					goto l0800_nAA7;
				}
				if (al_n != 0x0D)
				{
					ds->*di_n = al_n;
					di_n = (word16) di_n + 1;
					--cx_n;
					if (cx_n == 0x00)
						goto l0800_nA7F;
					continue;
				}
				--cx_n;
			} while (cx_n != 0x00);
			mp16 fp;
			__read(ds, wArg02, fp - 3, 0x01);
			byte bLoc03;
			ds->*di_n = bLoc03;
			di_n = (word16) di_n + 1;
l0800_nA7F:
		} while (di_n == wArg04);
l0800_nAA7:
		ax_n = di_n - wArg04;
	}
	else
		ax_n.u0 = 0x00;
	return ax_n;
}

// 0800:0AB3: Register Eq_n __read(Register (ptr16 Eq_n) ds, Stack int16 wArg02, Stack Eq_n wArg04, Stack cu16 wArg06)
// Called from:
//      _fgetc
//      _read
Eq_n __read(struct Eq_n * ds, int16 wArg02, Eq_n wArg04, cu16 wArg06)
{
	Eq_n ax_n;
	if (msdos_read_file(wArg02, wArg06, wArg04, out ax_n))
		ax_n = __IOERROR(ds, ax_n);
	return ax_n;
}

// 0800:0ACF: Register Eq_n _write(Register (ptr16 Eq_n) ds, Stack int16 wArg02, Stack Eq_n wArg04, Stack Eq_n wArg06)
// Called from:
//      _fflush
Eq_n _write(struct Eq_n * ds, int16 wArg02, Eq_n wArg04, Eq_n wArg06)
{
	Eq_n fp;
	Eq_n ax_n;
	if (wArg06 >= 0x01)
	{
		if ((ds->a0482[0][wArg02] & 0x8000) == 0x00)
		{
			ds->a0482[0][wArg02] = ds->a0482[0][wArg02] & ~0x0200;
			Eq_n wLoc86_n = wArg04;
			Eq_n wLoc8A_n = wArg06;
			Eq_n si_n = fp - 0x84;
			while (wLoc8A_n != 0x00)
			{
				Eq_n v24_n = wLoc8A_n - 0x01;
				wLoc8A_n = v24_n;
				wLoc86_n = (word16) wLoc86_n + 1;
				byte al_n = (byte) (ds->*wLoc86_n);
				if (al_n == 0x0A)
				{
					ds->*si_n = 0x0D;
					si_n = (word16) si_n + 1;
				}
				ds->*si_n = al_n;
				si_n = (word16) si_n + 1;
				if (si_n - (fp - 0x84) < 0x80)
					continue;
				Eq_n di_n = si_n - (fp - 0x84);
				Eq_n ax_n = __write(ds, wArg02, fp - 0x84, di_n);
				if (ax_n != di_n)
				{
					if (ax_n < 0x00)
						ax_n.u0 = ~0x00;
					else
						ax_n = (word16) ax_n + (wArg06 - v24_n) - di_n;
					return ax_n;
				}
				si_n = fp - 0x84;
			}
			Eq_n di_n = si_n - (fp - 0x84);
			if (di_n > 0x00)
			{
				Eq_n ax_n = __write(ds, wArg02, fp - 0x84, di_n);
				if (ax_n != di_n)
				{
					if (ax_n < 0x00)
						ax_n.u0 = ~0x00;
					else
						ax_n = wArg06 + ax_n - di_n;
					return ax_n;
				}
			}
			ax_n = wArg06;
			return ax_n;
		}
		else
		{
			ax_n = __write(ds, wArg02, wArg04, wArg06);
			return ax_n;
		}
	}
	else
	{
		ax_n.u0 = 0x00;
		return ax_n;
	}
}

// 0800:0BE2: Register Eq_n __write(Register (ptr16 Eq_n) ds, Stack int16 wArg02, Stack Eq_n wArg04, Stack Eq_n wArg06)
// Called from:
//      _write
//      _fputc
Eq_n __write(struct Eq_n * ds, int16 wArg02, Eq_n wArg04, Eq_n wArg06)
{
	if ((ds->a0482[0][wArg02] & 0x0800) != 0x00)
	{
		word16 dx_n;
		_lseek(ds, wArg02, 0x00, 0x02, out dx_n);
	}
	Eq_n ax_n;
	Eq_n ax_n;
	if (!msdos_write_file(wArg02, wArg06, wArg04, out ax_n))
	{
		ds->a0482[0][wArg02] = ds->a0482[0][wArg02] | 0x1000;
		ax_n = ax_n;
	}
	else
		ax_n = __IOERROR(ds, ax_n);
	return ax_n;
}

// 0800:0C28: Register Eq_n _lseek(Register (ptr16 Eq_n) ds, Stack int16 wArg02, Stack (ptr32 int32) dwArg04, Stack byte bArg08, Register out word16 dxOut)
// Called from:
//      _fseek
//      _read
//      __write
//      _tell
Eq_n _lseek(struct Eq_n * ds, int16 wArg02, int32 * dwArg04, byte bArg08, word16 & dxOut)
{
	int32 * dx_ax_n;
	ds->a0482[0][wArg02] = ds->a0482[0][wArg02] & ~0x0200;
	Eq_n ax_n = (word16) dx_ax_n;
	word16 dx_n = SLICE(dx_ax_n, word16, 16);
	if (msdos_set_file_position(wArg02, dwArg04, bArg08, out dx_ax_n))
	{
		int32 * dx_ax_n = (int32 *) __IOERROR(ds, ax_n);
		ax_n = (word16) dx_ax_n;
		dx_n = SLICE(dx_ax_n, word16, 16);
	}
	dxOut = dx_n;
	return ax_n;
}

// 0800:0C53: void __LONGTOA(Register Eq_n ds, Stack Eq_n bArg02, Stack Eq_n bArg04, Stack Eq_n wArg06, Stack (memptr Eq_n byte) wArg08, Stack Eq_n dwArg0A)
// Called from:
//      __VPRINTER
void __LONGTOA(Eq_n ds, Eq_n bArg02, Eq_n bArg04, Eq_n wArg06, byte Eq_n::* wArg08, Eq_n dwArg0A)
{
	Eq_n fp;
	uint16 wArg0A = (word16) dwArg0A;
	Eq_n wArg0C = SLICE(dwArg0A, word16, 16);
	byte Eq_n::* di_n = wArg08;
	cu8 bl_n = (byte) wArg06;
	if (wArg06 > 0x24 || bl_n < 0x02)
	{
l0800_nCC1:
		ds->*di_n = 0x00;
		return;
	}
	uint16 ax_n = wArg0A;
	Eq_n cx_n = wArg0C;
	if (wArg0C < 0x00 && bArg04 != 0x00)
	{
		ds->*wArg08 = 0x2D;
		ui32 cx_ax_n = -dwArg0A;
		di_n = wArg08 + 1;
		ax_n = (word16) cx_ax_n;
		cx_n = SLICE(cx_ax_n, word16, 16);
	}
	byte Eq_n::* si_n = fp - 36;
	if (cx_n != 0x00)
	{
		Eq_n ax_n;
		do
		{
			uint32 dx_ax_n = (uint32) cx_n;
			uint32 dx_ax_n = SEQ(dx_ax_n % wArg06, ax_n);
			ds->*si_n = (byte) (dx_ax_n % wArg06);
			ax_n = dx_ax_n /u wArg06;
			cx_n = ax_n;
			ax_n = dx_ax_n /u wArg06;
			++si_n;
		} while (ax_n != 0x00);
l0800_nCA4:
		if (ax_n == 0x00)
		{
			int16 cx_n = (int16) (si_n + (36 - fp));
			do
			{
				--si_n;
				cu8 al_n = ds->*si_n;
				byte al_n;
				if (al_n < 0x0A)
					al_n = al_n + 0x30;
				else
					al_n = (byte) bArg02.u0 + (al_n - 0x0A);
				ds->*di_n = al_n;
				++di_n;
				--cx_n;
			} while (cx_n != 0x00);
			goto l0800_nCC1;
		}
	}
	uint32 dx_ax_n = (uint32) ax_n;
	ds->*si_n = (byte) (dx_ax_n % wArg06);
	ax_n = dx_ax_n /u wArg06;
	++si_n;
	goto l0800_nCA4;
}

// 0800:0D5F: Register Eq_n _eof(Register (ptr16 Eq_n) ds, Stack int16 wArg02)
// Called from:
//      _fgetc
Eq_n _eof(struct Eq_n * ds, int16 wArg02)
{
	word16 dx_n;
	Eq_n ax_n;
	if ((ds->a0482[0][wArg02] & 0x0200) != 0x00)
	{
		ax_n.u0 = 0x01;
		return ax_n;
	}
	Eq_n ax_n;
	ax_n.u0 = 0x4400;
	byte dl_n = (byte) dx_n;
	if (!msdos_ioctl_get_device_info(wArg02, out dx_n))
	{
		if ((dl_n & 0x80) != 0x00)
		{
l0800_nDBF:
			ax_n.u0 = 0x00;
			return ax_n;
		}
		int32 * dx_ax_n;
		ax_n = (word16) dx_ax_n;
		if (!msdos_set_file_position(wArg02, 0x00, 0x01, out dx_ax_n))
		{
			int32 * dx_ax_n;
			ax_n = (word16) dx_ax_n;
			cup16 dx_n = SLICE(dx_ax_n, word16, 16);
			if (!msdos_set_file_position(wArg02, 0x00, 0x02, out dx_ax_n))
			{
				int32 * dx_ax_n;
				ax_n = (word16) dx_ax_n;
				cup16 dx_n = SLICE(dx_ax_n, word16, 16);
				if (!msdos_set_file_position(wArg02, dx_ax_n, 0x00, out dx_ax_n))
				{
					if (dx_n >= dx_n && (dx_n > dx_n || ax_n >= ax_n))
					{
						ax_n.u0 = 0x01;
						return ax_n;
					}
					goto l0800_nDBF;
				}
			}
		}
	}
	ax_n = __IOERROR(ds, ax_n);
	return ax_n;
}

// 0800:0DCD: Register word16 _fflush(Register (ptr16 Eq_n) ds, Stack (memptr (ptr16 Eq_n) Eq_n) wArg02)
// Called from:
//      _fseek
//      fn0800-075B
//      _fputc
word16 _fflush(struct Eq_n * ds, struct Eq_n Eq_n::* wArg02)
{
	word16 ax_n;
	if ((ds->*wArg02).ptr000E != wArg02)
		ax_n = ~0x00;
	else if ((ds->*wArg02).w0000 >= 0x00)
	{
		if (((ds->*wArg02).w0002 & 0x08) != 0x00 || ((ds->*wArg02).t000A).u0 == &wArg02->b0004 + 1)
		{
			(ds->*wArg02).w0000 = 0x00;
			if ((ds->*wArg02).t000A.u0 == &wArg02->b0004 + 1)
				(ds->*wArg02).t000A.u0 = (ds->*wArg02).t0008.u0;
		}
		ax_n = 0x00;
	}
	else
	{
		word16 di_n = (ds->*wArg02).w0006 + (ds->*wArg02).w0000;
		(ds->*wArg02).w0000 -= di_n + 0x01;
		Eq_n ax_n;
		ax_n.u0 = (ds->*wArg02).t0008.u0;
		(ds->*wArg02).t000A.u0 = (int16) ax_n;
		if (_write(ds, (int16) (ds->*wArg02).b0004, ax_n, di_n + 0x01) != di_n + 0x01 && ((ds->*wArg02).w0002 & 0x0200) == 0x00)
		{
			(ds->*wArg02).w0002 |= 0x10;
			ax_n = ~0x00;
		}
		else
			ax_n = 0x00;
	}
	return ax_n;
}

// 0800:0E4B: Register word16 _printf(Register Eq_n cx, Register Eq_n dx, Register Eq_n bx, Register Eq_n ds, Stack Eq_n wArg02)
// Called from:
//      _main
word16 _printf(Eq_n cx, Eq_n dx, Eq_n bx, Eq_n ds, Eq_n wArg02)
{
	mp16 fp;
	word16 di_n = __VPRINTER(cx, dx, bx, ds, fp + 4, wArg02);
	return di_n;
}

// 0800:0E64: void __fputc(Register (ptr16 Eq_n) ds, Stack byte bArg02, Stack (memptr (ptr16 Eq_n) Eq_n) wArg04)
void __fputc(struct Eq_n * ds, byte bArg02, struct Eq_n Eq_n::* wArg04)
{
	--(ds->*wArg04).w0000;
	_fputc(ds, bArg02, wArg04);
}

// 0800:0E7D: void _fputc(Register (ptr16 Eq_n) ds, Stack byte bArg02, Stack (memptr (ptr16 Eq_n) Eq_n) wArg04)
// Called from:
//      __fputc
void _fputc(struct Eq_n * ds, byte bArg02, struct Eq_n Eq_n::* wArg04)
{
	while (true)
	{
		ci16 v10_n = (ds->*wArg04).w0000 + 0x01;
		(ds->*wArg04).w0000 = v10_n;
		if (v10_n < 0x00)
			break;
		--(ds->*wArg04).w0000;
		if (((ds->*wArg04).w0002 & 0x90) != 0x00 || ((ds->*wArg04).w0002 & 0x02) == 0x00)
		{
			(ds->*wArg04).w0002 |= 0x10;
			return;
		}
		(ds->*wArg04).w0002 |= 0x0100;
		if ((ds->*wArg04).w0006 == 0x00)
		{
			mp16 fp;
			if ((bArg02 == 0x0A && (((ds->*wArg04).w0002 & 0x40) == 0x00 && __write(ds, (int16) (ds->*wArg04).b0004, 0x04E0, 0x01) != 0x01) || __write(ds, (int16) (ds->*wArg04).b0004, fp + 2, 0x01) != 0x01) && ((ds->*wArg04).w0002 & 0x0200) == 0x00)
				(ds->*wArg04).w0002 |= 0x10;
			return;
		}
		if ((ds->*wArg04).w0000 != 0x00)
		{
			if (_fflush(ds, wArg04) != 0x00)
				return;
		}
		else
			(ds->*wArg04).w0000 = ~0x00 - (ds->*wArg04).w0006;
	}
	(ds->*wArg04).t000A.u0 = (int16) ((ds->*wArg04).t000A.u0 + 0x01);
	ds->*((word16) ((ds->*wArg04).t000A).u0 - 1) = (int16) bArg02;
	if (((ds->*wArg04).w0002 & 0x08) == 0x00 || bArg02 != 0x0A && bArg02 != 0x0D || _fflush(ds, wArg04) == 0x00)
		;
}

// 0800:1044: void __REALCVT(Register Eq_n ds)
// Called from:
//      __VPRINTER
void __REALCVT(Eq_n ds)
{
	Mem0[ds:0x05E0:word16]();
}

// 0800:1048: Register word16 fn0800-1048(Sequence (ptr32 Eq_n) es_di, Register Eq_n ds, Stack Eq_n wArg02)
// Called from:
//      __VPRINTER
word16 fn0800-1048(struct Eq_n * es_di, Eq_n ds, Eq_n wArg02)
{
	word16 di = (word16) es_di;
	bcu8 dh_n = SLICE(wArg02, byte, 8);
	Mem21[es_di + 0x00:byte] = Mem7[ds:CONVERT(dh_n >>u 0x04, uint8, uint16) + 0x04E9:byte];
	Mem27[es_di + 1:byte] = Mem21[ds:CONVERT(dh_n & 0x0F, uint8, uint16) + 0x04E9:byte];
	bcu8 dl_n = (byte) wArg02;
	Mem33[es_di + 2:byte] = Mem27[ds:CONVERT(dl_n >>u 0x04, uint8, uint16) + 0x04E9:byte];
	Mem41[es_di + 3:byte] = Mem33[ds:CONVERT(dl_n & 0x0F, uint8, uint16) + 0x04E9:byte];
	return di + 4;
}

// 0800:1073: Register word16 __VPRINTER(Register Eq_n cx, Register Eq_n dx, Register Eq_n bx, Register Eq_n ds, Stack Eq_n wArg02, Stack Eq_n wArg04)
// Called from:
//      _printf
word16 __VPRINTER(Eq_n cx, Eq_n dx, Eq_n bx, Eq_n ds, Eq_n wArg02, Eq_n wArg04)
{
	Eq_n fp;
	Eq_n bLoc57_n;
	bLoc57_n.u0 = 0x50;
	struct Eq_n Eq_n::* sp_n = fp - 0xA0;
	byte Eq_n::* wLoc98_n = fp - 86;
l0800_nD6:
	byte Eq_n::* di_n = wLoc98_n;
l0800_nDA:
	Eq_n si_n = wArg04;
	Eq_n ss;
	while (true)
	{
		Eq_n al_n = ds->*si_n;
		si_n.u1 = (word32) si_n + 1;
		Eq_n al_n = al_n;
		if (al_n == 0x00)
			break;
		if (al_n == 0x25)
		{
			al_n = ds->*si_n;
			si_n.u1 = (word32) si_n + 1;
			if (al_n != 0x25)
			{
				wLoc98_n = di_n;
				cu8 ch_n = 0x00;
				Eq_n wLoc8E_n;
				wLoc8E_n.u0 = 0x00;
				cui16 wLoc9A_n = 0x00;
				Eq_n bLoc8F_n;
				bLoc8F_n.u0 = 0x00;
				Eq_n wLoc94_n;
				wLoc94_n.u0 = ~0x00;
				Eq_n wLoc92_n;
				wLoc92_n.u0 = ~0x00;
				byte ah_n;
				while (true)
				{
					Eq_n ax_n = (uint16) al_n;
					uint8 bl_n = al_n - 0x20;
					dx = ax_n;
					bx = (uint16) bl_n;
					cx = SEQ(ch_n, 0x00);
					if (bl_n >= 0x60)
						break;
					uint8 bl_n = (uint8) (ds->*((word32) bx + 0x04F9));
					bx = (uint16) bl_n;
					ah_n = 0x00;
					cx = SEQ(ch_n, 0x00);
					if (bx > 0x17)
						goto l0800_n;
					bx <<= 0x01;
					cx = SEQ(ch_n, 0x00);
					switch (bx)
					{
					case 0x00:
						cx = SEQ(ch_n, 0x00);
						if (ch_n > 0x00)
							goto l0800_n;
						if (bLoc8F_n != 0x2B)
							bLoc8F_n = al_n;
						break;
					case 0x01:
						cx = SEQ(ch_n, 0x00);
						if (ch_n > 0x00)
							goto l0800_n;
						wLoc9A_n |= 0x01;
						break;
					case 0x02:
						Eq_n ax_n = ds->*wArg02;
						ah_n = SLICE(ax_n, byte, 8);
						wArg02.u1 = (word32) wArg02 + 2;
						if (ch_n < 0x02)
						{
							wLoc94_n = ax_n;
							ch_n = 0x03;
							goto l0800_nE5;
						}
						cx = SEQ(ch_n, 0x00);
						if (ch_n != 0x04)
							goto l0800_nCE;
						wLoc92_n = ax_n;
						++ch_n;
						break;
					case 0x03:
						cx = SEQ(ch_n, 0x00);
						if (ch_n > 0x00)
							goto l0800_n;
						wLoc9A_n |= 0x02;
						break;
					case 0x04:
						cx = SEQ(ch_n, 0x00);
						if (ch_n >= 0x04)
							goto l0800_nCE;
						ch_n = 0x04;
						break;
					case 0x05:
						goto l0800_n;
					case 0x06:
						wLoc9A_n |= 0x10;
						ch_n = 0x05;
						break;
					case 0x07:
						wLoc9A_n = (wLoc9A_n | 0x0100) & ~0x10;
						ch_n = 0x05;
						break;
					case 0x08:
						wLoc9A_n = wLoc9A_n & ~0x10 | 0x80;
						ch_n = 0x05;
						break;
					case 0x09:
						if (ch_n <= 0x00)
						{
							if ((wLoc9A_n & 0x02) != 0x00)
								goto l0800_nE5;
							wLoc9A_n |= 0x08;
							ch_n = 0x01;
						}
						else
						{
l0800_n:
							dx = bx;
							Eq_n ax_n = (int16) (al_n - 0x30);
							ah_n = 0x00;
							if (ch_n <= 0x02)
							{
								ch_n = 0x02;
								wLoc94_n = ax_n;
								if (wLoc94_n < 0x00)
									goto l0800_nE5;
								wLoc94_n.u1 = (word32) ax_n + wLoc94_n *16 0x0A;
							}
							else
							{
								cx = SEQ(ch_n, 0x00);
								if (ch_n != 0x04)
								{
l0800_nCE:
									goto l0800_n;
								}
								wLoc92_n = ax_n;
								if (wLoc92_n >= 0x00)
									wLoc92_n.u1 = (word32) ax_n + wLoc92_n *16 0x0A;
								else
								{
l0800_nE5:
								}
							}
						}
						break;
					case 0x0A:
						uint8 bLoc95_n = 0x01;
						Eq_n ax_n = ds->*wArg02;
						Eq_n bx_n = SEQ(0x0A, bl_n << 0x01);
						goto l0800_nA2;
					case 11:
						Eq_n bx_n = SEQ(0x08, bl_n << 0x01);
						goto l0800_nA;
					case 0x0C:
						Eq_n bx_n = SEQ(0x0A, bl_n << 0x01);
						goto l0800_nF;
					case 0x0D:
						bx_n = SEQ(0x10, (byte) al_n + 233);
l0800_nA:
						bLoc8F_n.u0 = 0x00;
						bx_n = bx_n;
l0800_nF:
						bLoc95_n = 0x00;
						ax_n = ds->*wArg02;
						bx_n = bx_n;
l0800_nA2:
						struct Eq_n Eq_n::* di_n = (struct Eq_n Eq_n::*) ((word32) wArg02 + 1);
						int8 bh_n = SLICE(bx_n, byte, 8);
						Eq_n dx_n;
						dx_n.u0 = 0x00;
						Eq_n di_n = &di_n->t0001.u0;
						wArg04 = si_n;
						if ((wLoc9A_n & 0x10) != 0x00)
						{
							dx_n.u2 = (ds->*di_n).t0001.u2;
							di_n = (char *) &di_n->t0001 + 2;
						}
						wArg02 = di_n;
						if (ax_n == 0x00)
						{
							dx = dx_n;
							byte dh_n = SLICE(dx_n, byte, 8);
							if (dx_n != 0x00)
								goto l0800_nF1;
							bx = bx_n;
							if (wLoc92_n == 0x00)
							{
								cx = wLoc94_n;
								if (wLoc94_n != 0x00 && wLoc94_n != ~0x00)
								{
									uint16 ah_dl_n;
									if ((wLoc9A_n & 0x08) != 0x00)
										ah_dl_n = 0x30;
									else
										ah_dl_n = 0x20;
									do
									{
										uint8 dl_n = (byte) ah_dl_n;
										dx = SEQ(dh_n, dl_n);
										fn0800-1099(SEQ(ds, di_n), SEQ(ss, fp - 2), (byte) ah_dl_n, cx, dx, bx_n, out di_n);
										--cx;
										ah_dl_n = (uint16) dl_n;
									} while (cx != 0x00);
								}
								goto l0800_nDA;
							}
						}
						else
						{
l0800_nF1:
							wLoc9A_n |= 0x04;
						}
						struct Eq_n Eq_n::* sp_n = sp_n - 2;
						(ss->*sp_n).t0000.u2 = (struct Eq_n *) dx_n;
						(ss->*sp_n).tFFFFFFFE.u2 = (struct Eq_n *) ax_n;
						(ss->*sp_n).ptrFFFFFFFC = fp - 0x89;
						(ss->*sp_n).tFFFFFFFA.u2 = (int16) bh_n;
						(ss->*sp_n).tFFFFFFF8.u0 = (uint16) bLoc95_n;
						(ss->*sp_n).tFFFFFFF6.u2 = (struct Eq_n *) bx_n;
						__LONGTOA(ds, (ss->*sp_n).tFFFFFFF6.u0, (ss->*sp_n).tFFFFFFF8.u1, (ss->*sp_n).tFFFFFFFA.u2, (ss->*sp_n).ptrFFFFFFFC, (ss->*sp_n).tFFFFFFFE.u1);
						(ss->*sp_n).t0000.u2 = (struct Eq_n *) ss;
						Eq_n es_n;
						es_n.u2 = (ss->*sp_n).t0000.u2;
						sp_n = (struct Eq_n Eq_n::*) ((char *) &sp_n->t0000 + 2);
						dx = wLoc92_n;
						byte * es_di_n;
						byte * es_di_n;
						if (wLoc92_n > 0x00)
						{
							es_di_n = SEQ(es_n, fp - 0x89);
							goto l0800_n;
						}
						else
						{
							es_di_n = SEQ(es_n, fp - 0x89);
							goto l0800_n;
						}
					case 0x0E:
						struct Eq_n Eq_n::* sp_n = sp_n - 2;
						(ss->*sp_n).t0000.u2 = (struct Eq_n *) (ds->*wArg02);
						byte Eq_n::* di_n = fp - 0x8A;
						wArg02.u1 = (word32) wArg02 + 2;
						if ((wLoc9A_n & 0x20) != 0x00)
						{
							(ss->*sp_n).tFFFFFFFE.u2 = (struct Eq_n *) (ds->*((word32) wArg02 + 2));
							(ss->*sp_n).tFFFFFFFC.u2 = (struct Eq_n *) ss;
							Eq_n es_n;
							es_n.u2 = (ss->*sp_n).tFFFFFFFC.u2;
							byte Eq_n::* di_n = fn0800-1048(SEQ(es_n, fp - 0x8A), ds, (ss->*sp_n).tFFFFFFFE.u2);
							es_n->*di_n = 0x3A;
							wArg02.u1 = (word32) wArg02 + 4;
							di_n = di_n + 1;
						}
						(ss->*sp_n).tFFFFFFFE.u2 = (struct Eq_n *) ss;
						Eq_n es_n;
						es_n.u2 = (ss->*sp_n).tFFFFFFFE.u2;
						byte Eq_n::* di_n = fn0800-1048(SEQ(es_n, di_n), ds, (ss->*sp_n).t0000.u2);
						ds->*di_n = 0x00;
						sp_n = (struct Eq_n Eq_n::*) ((char *) &sp_n->t0000 + 2);
						wLoc9A_n &= ~0x04;
						Eq_n di_n = di_n - (fp - 0x8A);
						dx = wLoc92_n;
						if (wLoc92_n <= di_n)
							dx = di_n;
						es_di_n = SEQ(es_n, fp - 0x8A);
						goto l0800_n;
					case 0x0F:
						Eq_n cx_n = wLoc92_n;
						if (wLoc92_n < 0x00)
							cx_n.u0 = 0x06;
						struct Eq_n Eq_n::* sp_n = sp_n - 2;
						(ss->*sp_n).t0000.u2 = (struct Eq_n *) wArg02;
						(ss->*sp_n).tFFFFFFFE.u2 = (struct Eq_n *) cx_n;
						(ss->*sp_n).ptrFFFFFFFC = fp - 0x89;
						(ss->*sp_n).tFFFFFFFA.u2 = (struct Eq_n *) ax_n;
						(ss->*sp_n).tFFFFFFF8.u0 = (uint16) (wLoc9A_n & 0x01);
						Eq_n ax_n;
						int16 wLoc06_n;
						if ((wLoc9A_n & 0x80) != 0x00)
						{
							ax_n.u0 = 0x02;
							wLoc06_n = 0x04;
						}
						else if ((wLoc9A_n & 0x0100) != 0x00)
						{
							ax_n.u0 = 0x08;
							wLoc06_n = 0x0A;
						}
						else
						{
							wLoc06_n = 0x08;
							ax_n.u0 = 0x06;
						}
						(ss->*sp_n).tFFFFFFF6.u2 = (struct Eq_n *) ax_n;
						__REALCVT(ds);
						(ss->*sp_n).tFFFFFFF4.u2 = (struct Eq_n *) ss;
						wArg02.u1 = (word32) wArg02 + wLoc06_n;
						sp_n = sp_n - 0x0A;
						es_di_n = (byte *) (fp - 0x89);
l0800_n:
						Eq_n es_n = SLICE(es_di_n, selector, 16);
						byte Eq_n::* di_n = (word16) es_di_n;
						if ((wLoc9A_n & 0x08) != 0x00)
						{
							dx = wLoc94_n;
							es_di_n = es_di_n;
							if (wLoc94_n > 0x00)
							{
l0800_n:
								es_n = SLICE(es_di_n, selector, 16);
								di_n = (word16) es_di_n;
								Eq_n cx_n = fn0800-108C(di_n, es_n);
								if (*es_di_n == 0x2D)
									--cx_n;
								dx -= cx_n;
								if (dx > 0x00)
									wLoc8E_n = dx;
							}
						}
						if (bLoc8F_n != 0x00 && es_n->*di_n != 0x2D)
						{
							--di_n;
							es_n->*di_n = (byte) bLoc8F_n;
							Eq_n v45_n = wLoc8E_n - 0x01;
							wLoc8E_n = (word16) v45_n + (word16) (v45_n < 0x00);
						}
						Eq_n cx_n = fn0800-108C(di_n, es_n);
						goto l0800_n;
					case 0x10:
						union Eq_n Eq_n::* sp_n = sp_n - 2;
						(ss->*sp_n).u2 = (struct Eq_n *) ss;
						wArg02.u1 = (word32) wArg02 + 2;
						es_n.u2 = (ss->*sp_n).u2;
						sp_n = (struct Eq_n Eq_n::*) ((char *) sp_n + 2);
						di_n = fp - 0x89;
						cx_n.u0 = 0x01;
						goto l0800_n;
					case 0x11:
						bool v74_n;
						if ((wLoc9A_n & 0x20) == 0x00)
						{
							byte Eq_n::* di_n = (byte Eq_n::*) (ds->*wArg02);
							union Eq_n Eq_n::* sp_n = sp_n - 2;
							(ss->*sp_n).u2 = (struct Eq_n *) ds;
							wArg02.u1 = (word32) wArg02 + 2;
							es_n.u2 = (ss->*sp_n).u2;
							di_n = di_n;
							v74_n = di_n != 0x00;
						}
						else
						{
							Eq_n es_di_n = ds->*wArg02;
							es_n = SLICE(es_di_n, selector, 16);
							di_n = (word16) es_di_n;
							wArg02.u1 = (word32) wArg02 + 4;
							v74_n = es_di_n != 0x00;
						}
						if (!v74_n)
						{
							union Eq_n Eq_n::* sp_n = sp_n - 2;
							(ss->*sp_n).u2 = (struct Eq_n *) ds;
							es_n.u2 = (ss->*sp_n).u2;
							di_n = 0x04E2;
						}
						cx_n = fn0800-108C(di_n, es_n);
						if (cx_n > wLoc92_n)
							cx_n = wLoc92_n;
l0800_n:
						wArg04 = si_n;
						byte Eq_n::* si_n = di_n;
						Eq_n bx_n = wLoc94_n;
						if ((wLoc9A_n & 0x05) == 0x05)
						{
							if (al_n != 111)
							{
								if (al_n == 0x78 || al_n == 88)
								{
									Eq_n v42_n = wLoc8E_n - 0x02;
									wLoc9A_n |= 0x40;
									bx_n = wLoc94_n - 0x02;
									wLoc8E_n = v42_n;
									if (v42_n < 0x00)
										wLoc8E_n.u0 = 0x00;
								}
l0800_nB5:
								cx = cx_n + wLoc8E_n;
								if ((wLoc9A_n & 0x02) == 0x00)
								{
									for (; bx_n > cx; --bx_n)
										fn0800-1099(SEQ(ds, di_n), SEQ(ss, fp - 2), 0x20, cx, dx, bx_n, out di_n);
								}
								if ((wLoc9A_n & 0x40) != 0x00)
								{
									word16 di_n;
									fn0800-1099(SEQ(ds, di_n), SEQ(ss, fp - 2), 0x30, cx, dx, bx_n, out di_n);
									fn0800-1099(SEQ(ds, di_n), SEQ(ss, fp - 2), al_n, cx, dx, bx_n, out di_n);
								}
								dx = wLoc8E_n;
								if (wLoc8E_n > 0x00)
								{
									Eq_n cx_n = cx - wLoc8E_n;
									bx_n -= wLoc8E_n;
									Eq_n al_n = es_n->*di_n;
									if (al_n == 0x2D || (al_n == 0x20 || al_n == 0x2B))
									{
										fn0800-1099(SEQ(ds, di_n), SEQ(ss, fp - 2), es_n->*di_n, cx_n, wLoc8E_n, bx_n, out di_n);
										si_n = di_n + 1;
										--cx_n;
										--bx_n;
									}
									Eq_n cx_n = wLoc8E_n;
									if (wLoc8E_n != 0x00)
									{
										do
										{
											fn0800-1099(SEQ(ds, di_n), SEQ(ss, fp - 2), 0x30, cx_n, cx_n, bx_n, out di_n);
											--cx_n;
										} while (cx_n != 0x00);
									}
									dx = cx_n;
									cx = cx_n;
								}
								if (cx != 0x00)
								{
									bx_n -= cx;
									do
									{
										ds->*di_n = es_n->*si_n;
										Eq_n v47_n = bLoc57_n - 0x01;
										++si_n;
										++di_n;
										bLoc57_n = v47_n;
										if (v47_n <= 0x00)
											fn0800-10A1(SEQ(ss, fp - 2), cx, dx, bx_n, di_n, out di_n);
										--cx;
									} while (cx != 0x00);
								}
								bx = bx_n;
								if (bx_n > 0x00)
								{
									cx = bx_n;
									do
									{
										fn0800-1099(SEQ(ds, di_n), SEQ(ss, fp - 2), 0x20, cx, dx, bx_n, out di_n);
										--cx;
									} while (cx != 0x00);
								}
								goto l0800_nDA;
							}
							if (wLoc8E_n <= 0x00)
								wLoc8E_n.u0 = 0x01;
						}
						goto l0800_nB5;
					case 0x12:
						wArg04 = si_n;
						uint16 * es_di_n;
						if ((wLoc9A_n & 0x20) == 0x00)
						{
							<unknown> Eq_n::* di_n = (<unknown> Eq_n::*) (ds->*wArg02);
							union Eq_n Eq_n::* sp_n = sp_n - 2;
							(ss->*sp_n).u2 = (struct Eq_n *) ds;
							wArg02.u1 = (word32) wArg02 + 2;
							es_di_n = (uint16 *) di_n;
						}
						else
						{
							es_di_n = (uint16 *) (ds->*wArg02);
							wArg02.u1 = (word32) wArg02 + 4;
						}
						*es_di_n = (uint16) (0x50 - bLoc57_n);
						goto l0800_nD6;
					case 0x13:
					case 0x14:
					case 0x15:
						goto l0800_n;
					case 22:
						wLoc9A_n &= ~0x20;
						ch_n = 0x05;
						break;
					case 0x17:
						wLoc9A_n |= 0x20;
						ch_n = 0x05;
						break;
					}
					al_n = ds->*si_n;
					si_n.u1 = (word32) si_n + 1;
				}
l0800_n:
				ah_n = 0x00;
l0800_n:
				Eq_n si_n = si_n;
				uint16 ax_n = SEQ(ah_n, 0x25);
				uint8 al_n;
				do
				{
					uint16 ax_n = (uint16) al_n;
					fn0800-1099(SEQ(ds, di_n), SEQ(ss, fp - 2), (byte) ax_n, cx, dx, bx, out di_n);
					al_n = (uint8) (ds->*si_n);
					si_n.u1 = (word32) si_n + 1;
					ax_n = ax_n;
				} while (al_n != 0x00);
				break;
			}
		}
		ds->*di_n = (byte) al_n;
		Eq_n v18_n = bLoc57_n - 0x01;
		++di_n;
		bLoc57_n = v18_n;
		if (v18_n <= 0x00)
			fn0800-10A1(SEQ(ss, fp - 2), cx, dx, bx, di_n, out di_n);
	}
	if (bLoc57_n < 0x50)
	{
		word16 di_n;
		fn0800-10A1(SEQ(ss, fp - 2), cx, dx, bx, di_n, out di_n);
	}
	word16 Eq_n::* sp_n = (word16 Eq_n::*) ((char *) &sp_n->t0000 + 2);
	return ss->*sp_n;
}

// 0800:108C: Register word16 fn0800-108C(Register (memptr Eq_n byte) di, Register Eq_n es)
// Called from:
//      __VPRINTER
word16 fn0800-108C(byte Eq_n::* di, Eq_n es)
{
	word16 cx_n = ~0x00;
	while (cx_n != 0x00)
	{
		byte Eq_n::* di_n;
		di = di_n + 1;
		--cx_n;
		di_n = di;
		if (es->*di_n != 0x00)
			return -cx_n;
	}
	return -cx_n;
}

// 0800:1099: Register byte fn0800-1099(Sequence (ptr32 Eq_n) ds_di, Sequence (ptr32 Eq_n) ss_bp, Register Eq_n al, Register Eq_n cx, Register Eq_n dx, Register Eq_n bx, Register out (memptr Eq_n byte) diOut)
// Called from:
//      __VPRINTER
byte fn0800-1099(union Eq_n * ds_di, struct Eq_n * ss_bp, Eq_n al, Eq_n cx, Eq_n dx, Eq_n bx, byte & diOut)
{
	word16 ax;
	al = (byte) ax;
	word16 di = (word16) ds_di;
	ds_di->u0 = (int8) al;
	ci8 v10_n = ss_bp->bFFFFFFAB - 0x01;
	ss_bp->bFFFFFFAB = v10_n;
	if (v10_n <= 0x00)
	{
		diOut = di + 0x01;
		return SLICE(ax, byte, 8);
	}
	else
	{
		byte Eq_n::* di_n;
		fn0800-10A1(ss_bp, cx, dx, bx, di + 0x01, out di_n);
		diOut = di_n;
		return 0x00;
	}
}

// 0800:10A1: Register byte fn0800-10A1(Sequence (ptr32 Eq_n) ss_bp, Register Eq_n cx, Register Eq_n dx, Register Eq_n bx, Register (memptr Eq_n byte) di, Register out (memptr Eq_n byte) diOut)
// Called from:
//      __VPRINTER
//      fn0800-1099
byte fn0800-10A1(struct Eq_n * ss_bp, Eq_n cx, Eq_n dx, Eq_n bx, byte Eq_n::* di, byte & diOut)
{
	word16 bp = (word16) ss_bp;
	word16 di_n = di - (bp - 84);
	selector seg0800;
	(seg0800->*ss_bp->ptr000A)();
	word16 ax_n;
	if (ax_n == 0x00)
		ss_bp->wFFFFFFFE = 0x01;
	ss_bp->bFFFFFFAB = 0x50;
	ss_bp->wFFFFFFA8 += di_n;
	diOut = bp - 84;
	return SLICE(ax_n, byte, 8);
}

// 0800:1596: void fn0800-1596(Register (ptr16 Eq_n) ds, Stack Eq_n wArg02)
// Called from:
//      fn0800-165F
void fn0800-1596(struct Eq_n * ds, Eq_n wArg02)
{
	if (ds->t062A != 0x00)
	{
		Eq_n di_n = ds->*((word16) ds->t062A + 6);
		ds->*((word16) ds->t062A + 6) = wArg02;
		ds->*((word16) di_n + 4) = wArg02;
		ds->*((word16) wArg02 + 6) = di_n;
		ds->*((word16) wArg02 + 4) = ds->t062A;
	}
	else
	{
		ds->t062A = wArg02;
		ds->*((word16) wArg02 + 4) = wArg02;
		ds->*((word16) wArg02 + 6) = wArg02;
	}
}

// 0800:15CF: void fn0800-15CF(Register (ptr16 Eq_n) ds, Stack Eq_n wArg02, Stack Eq_n wArg04)
// Called from:
//      fn0800-165F
void fn0800-15CF(struct Eq_n * ds, Eq_n wArg02, Eq_n wArg04)
{
	ds->*wArg02 += ds->*wArg04;
	if (ds->t0628 == wArg04)
		ds->t0628 = wArg02;
	else
		ds->*((word16) (ds->*wArg04 + wArg04) + 2) = (word16) wArg02;
	___pull_free_block(ds, wArg04);
}

// 0800:1606: void fn0800-1606(Register (ptr16 Eq_n) ds)
// Called from:
//      _free
void fn0800-1606(struct Eq_n * ds)
{
	if (ds->t062C == ds->t0628)
	{
		_brk(ds, ds->t062C);
		ds->t0628.u0 = 0x00;
		ds->t062C.u0 = 0x00;
	}
	else
	{
		Eq_n si_n = ds->*((word16) ds->t0628 + 2);
		if ((ds->*si_n & 0x01) == 0x00)
		{
			___pull_free_block(ds, si_n);
			if (si_n == ds->t062C)
			{
				ds->t0628.u0 = 0x00;
				ds->t062C.u0 = 0x00;
			}
			else
				ds->t0628 = ds->*((word16) si_n + 2);
			_brk(ds, si_n);
		}
		else
		{
			_brk(ds, ds->t0628);
			ds->t0628 = si_n;
		}
	}
}

// 0800:165F: void fn0800-165F(Register (ptr16 Eq_n) ds, Stack Eq_n wArg02)
// Called from:
//      _free
void fn0800-165F(struct Eq_n * ds, Eq_n wArg02)
{
	--ds->*wArg02;
	Eq_n si_n = wArg02;
	Eq_n ax_n = ds->*wArg02 + wArg02;
	Eq_n di_n = ds->*((word16) wArg02 + 2);
	if ((ds->*di_n & 0x01) == 0x00 && wArg02 != ds->t062C)
	{
		ds->*di_n += ds->*wArg02;
		ds->*((word16) ax_n + 2) = di_n;
		si_n = di_n;
	}
	else
		fn0800-1596(ds, wArg02);
	if ((ds->*ax_n & 0x01) == 0x00)
		fn0800-15CF(ds, si_n, ax_n);
}

// 0800:16AD: void _free(Register (ptr16 Eq_n) ds, Stack Eq_n wArg02)
// Called from:
//      _setvbuf
void _free(struct Eq_n * ds, Eq_n wArg02)
{
	if (wArg02 != 0x00)
	{
		if ((word16) wArg02 + 0x0000FFFC == ds->t0628)
			fn0800-1606(ds);
		else
			fn0800-165F(ds, (word16) wArg02 + 0x0000FFFC);
	}
}

// 0800:16D4: Register word16 _scanf(Register Eq_n di, Register (ptr16 Eq_n) es, Register Eq_n ds, Stack (memptr Eq_n Eq_n) wArg02, Register out word16 bxOut, Register out word16 bpOut)
// Called from:
//      _main
word16 _scanf(Eq_n di, struct Eq_n * es, Eq_n ds, struct Eq_n Eq_n::* wArg02, word16 & bxOut, word16 & bpOut)
{
	selector ss;
	word16 Eq_n::* bp_n;
	word16 bx_n;
	word16 dx_n = __scanner(di, es, ds, &seg0800_t::t07F2, &seg0800_t::t1D65, 0x0342, wArg02, out bx_n, out bp_n);
	word16 bp_n = ss->*bp_n;
	bxOut = bx_n;
	bpOut = bp_n;
	return dx_n;
}

// 0800:16F3: Register Eq_n __scanner(Register Eq_n di, Register (ptr16 Eq_n) es, Register Eq_n ds, Stack (memptr (ptr16 Eq_n) code) wArg02, Stack (memptr (ptr16 Eq_n) code) wArg04, Stack Eq_n wArg06, Stack (memptr Eq_n Eq_n) wArg08, Register out uint16 bxOut, Register out word16 bpOut)
// Called from:
//      _scanf
Eq_n __scanner(Eq_n di, struct Eq_n * es, Eq_n ds, <anonymous> seg0800_t::* wArg02, <anonymous> seg0800_t::* wArg04, Eq_n wArg06, struct Eq_n Eq_n::* wArg08, uint16 & bxOut, word16 & bpOut)
{
	struct Eq_n Eq_n::* sp_n;
	struct Eq_n Eq_n::* sp_n;
	ci16 ax_n;
	Eq_n wLoc28_n;
	wLoc28_n.u1 = 0x00;
l0800_n:
	struct Eq_n Eq_n::* si_n = wArg08;
	byte Eq_n::* fp;
	selector seg0800;
	struct Eq_n * ss;
	Eq_n ax_n;
	struct Eq_n Eq_n::* sp_n;
	Eq_n ax_n;
	do
	{
l0800_n:
		Eq_n al_n;
		al_n.u0 = (ds->*si_n).t0000.u0;
		++si_n;
		Eq_n al_n = al_n;
		uint16 bx;
		Eq_n dx;
		if (al_n == 0x00)
		{
			word16 bp_n = fn0800-1AEB(fp - 2);
			bxOut = bx;
			bpOut = bp_n;
			return dx;
		}
		if (al_n == 0x25)
		{
			Eq_n wLoc24_n;
			wLoc24_n.u0 = ~0x00;
			byte bLoc2B_n = 0x00;
			while (true)
			{
				++si_n;
				Eq_n ax_n = (int16) (ds->*si_n).t0000.u0;
				byte dh_n = SLICE(dx, byte, 8);
				wArg08 = si_n;
				di = ax_n;
				if (ax_n < 0x00)
					break;
				Eq_n bl_n = ds->*((word16) ax_n + 0x055A);
				uint16 bx_n = (uint16) bl_n;
				al_n = bl_n;
				if (bx_n > 0x15)
				{
					word16 bp_n = fn0800-1AEB(fp - 2);
					bxOut = bx_n;
					bpOut = bp_n;
					return dx;
				}
				bx = bx_n << 0x01;
				switch (bx_n)
				{
				case 0x00:
				case 0x01:
				case 0x02:
					goto l0800_nE6;
				case 0x03:
					goto l0800_nF;
				case 0x04:
					bLoc2B_n |= 0x01;
					break;
				case 0x05:
					wLoc24_n = ax_n - 0x30;
					Eq_n wLoc24_n = wLoc24_n;
					if (wLoc24_n >= 0x00)
					{
						dx.u1 = SLICE(wLoc24_n *32 0x0A, word16, 16);
						wLoc24_n = ax_n - 0x30 + wLoc24_n * 0x0A;
					}
					break;
				case 0x06:
					if ((bLoc2B_n & 0x01) == 0x00)
					{
						struct Eq_n * es_di_n = fn0800-1708(fp - 2, ds);
						di = (word16) es_di_n;
						es = SLICE(es_di_n, selector, 16);
					}
					Eq_n si_n = wLoc24_n;
					if (wLoc24_n < 0x00)
						si_n.u0 = 0x01;
					Eq_n wLoc04;
					if (wLoc24_n != 0x00)
					{
						do
						{
							(seg0800->*wArg02)();
							wLoc28_n.u1 = (word16) wLoc28_n.u1 + 1;
							wLoc04 = wArg06;
							byte al_n = (byte) ax_n;
							if ((bLoc2B_n & 0x01) == 0x00)
							{
								es->*di = al_n;
								di = (word16) di + 1;
							}
							uint16 bx_n;
							Eq_n dx_n;
							if (ax_n < 0x00)
							{
								word16 bp_n = fn0800-1AEB(fp - 2);
								bxOut = bx_n;
								bpOut = bp_n;
								return dx_n;
							}
							--si_n;
							dx = dx_n;
							bx = bx_n;
						} while (si_n > 0x00);
					}
					goto l0800_n;
				case 0x07:
				case 0x08:
					uint16 si_n = 0x0A;
					goto l0800_n;
				case 0x09:
					si_n = 0x00;
					goto l0800_n;
				case 0x0A:
					__scantod(ds);
					wLoc04 = fp - 40;
					ci16 wLoc26;
					if (wLoc26 > 0x00)
					{
						if ((bLoc2B_n & 0x01) != 0x00)
							__scanpop(ds);
						else
						{
							struct Eq_n * es_di_n = fn0800-1708(&(ss->*(fp - 2)), ds);
							di = (word16) es_di_n;
							es = SLICE(es_di_n, selector, 16);
							__scanrslt(ds);
							wLoc04 = di;
						}
						goto l0800_n;
					}
					__scanpop(ds);
					if (wLoc26 < 0x00)
					{
						word16 bp_n = fn0800-1AEB(&(ss->*(fp - 2)));
						bxOut = bx_n << 0x01;
						bpOut = bp_n;
						return dx;
					}
					else
					{
						word16 bp_n = fn0800-1AFF(&(ss->*(fp - 2)));
						bxOut = bx_n << 0x01;
						bpOut = bp_n;
						return dx;
					}
				case 11:
					bLoc2B_n |= 0x08;
					break;
				case 0x0C:
					bLoc2B_n |= 0x02;
					break;
				case 0x0D:
					bLoc2B_n |= 0x04;
					break;
				case 0x0E:
					si_n = 0x08;
					goto l0800_n;
				case 0x0F:
					word16 bp_n;
					fn0800-196F(fp - 2, ds, out bp_n);
					word16 bp_n;
					bxOut = fn0800-196F(bp_n, ds, out bp_n);
					bpOut = bp_n;
					return dx;
				case 0x10:
					word16 Eq_n::* di_n = fp - 0x0022;
					word16 cx_n;
					for (cx_n = 0x10; cx_n != 0x00; --cx_n)
					{
						ss->*di_n = 0x00;
						++di_n;
					}
					byte v47_n = bLoc2B_n & ~0x10;
					uint8 al_n = (uint8) (ds->*si_n).t0000.u0;
					struct Eq_n Eq_n::* si_n = si_n + 1;
					byte bLoc2B_n = v47_n;
					if (al_n == 0x5E)
					{
						bLoc2B_n = v47_n | 0x10;
						al_n = (uint8) si_n[1];
						si_n = si_n + 2;
					}
l0800_nA23:
					uint16 ax_n = (uint16) al_n;
					ui8 ch_n = 0x01 << (al_n & 0x07);
					ss->*((fp - 0x0022) + (ax_n >> 0x03)) = (word16) (ss->*((fp - 0x0022) + (ax_n >> 0x03)) | ch_n);
					uint8 dl_n = al_n;
					Eq_n di_n = ax_n >> 0x03;
					Eq_n dx_n;
					while (true)
					{
						al_n = (uint8) (ds->*si_n).t0000.u0;
						++si_n;
						dx_n = SEQ(dh_n, dl_n);
						if (al_n == 0x00)
							break;
						dx = SEQ(dh_n, dl_n);
						if (al_n == 0x5D)
						{
							ci16 v65_n = wLoc24_n & 0x7FFF;
							wArg08 = si_n;
							ci16 si_n = v65_n;
							struct Eq_n * es_di_n = (struct Eq_n *) di_n;
							if ((bLoc2B_n & 0x01) == 0x00)
								es_di_n = fn0800-1708(&(ss->*(fp - 2)), ds);
							while (true)
							{
								struct Eq_n * es_di_n;
								di = (word16) es_di_n;
								es = SLICE(es_di_n, selector, 16);
								ci16 si_n = si_n - 0x01;
								if (si_n < 0x00)
									break;
								(seg0800->*wArg02)();
								wLoc28_n.u1 = (word16) wLoc28_n.u1 + 1;
								wLoc04 = wArg06;
								wchar_t ax_n;
								Eq_n dx_n;
								if (ax_n < 0x00)
								{
									uint16 bx_n;
									if (si_n + 0x01 >= v65_n)
									{
										word16 bp_n = fn0800-1AEB(&(ss->*(fp - 2)));
										bxOut = bx_n;
										bpOut = bp_n;
										return dx_n;
									}
									if ((bLoc2B_n & 0x01) != 0x00)
									{
										word16 bp_n = fn0800-1AEB(&(ss->*(fp - 2)));
										bxOut = bx_n;
										bpOut = bp_n;
										return dx_n;
									}
									else
									{
										es_di_n->t0000.u0 = 0x00;
										word16 bp_n = fn0800-1AEB(&(ss->*(fp - 2)));
										bxOut = bx_n;
										bpOut = bp_n;
										return dx_n;
									}
								}
								si_n = si_n;
								bx = ax_n >> 0x03;
								Eq_n al_n = (byte) ax_n;
								if ((ss->*((fp - 0x0022) + (ax_n >> 0x03)) & 0x01 << ((byte) ax_n & 0x07)) != 0x00)
								{
									if ((bLoc2B_n & 0x10) != 0x00)
										goto l0800_nAB6;
								}
								else if ((bLoc2B_n & 0x10) == 0x00)
								{
l0800_nAB6:
									(seg0800->*wArg04)();
									wLoc04 = wArg06;
									word16 cx_n = (ss->*sp_n).w0002;
									es = (ss->*sp_n).ptr0004;
									Eq_n dx_n;
									dx = dx_n;
									dx = dx_n;
									uint16 bx_n;
									bx = bx_n;
									bx = bx_n;
									if (si_n + 0x01 < v65_n)
										break;
									goto l0800_nAD3;
								}
								es_di_n = es_di_n;
								dx = dx_n;
								es_di_n = es_di_n;
								if ((bLoc2B_n & 0x01) == 0x00)
								{
									es_di_n->t0000.u0 = (byte) al_n;
									es_di_n = (struct Eq_n *) ((word16) di + 1);
									dx = dx_n;
								}
							}
							if ((bLoc2B_n & 0x01) == 0x00)
							{
l0800_nAD3:
								es->*di = 0x00;
								di = (word16) di + 1;
							}
							goto l0800_n;
						}
						if (al_n != 0x2D || (dl_n > ((ds->*si_n).t0000).u0 || ((ds->*si_n).t0000).u0 == 0x5D))
							goto l0800_nA23;
						++si_n;
						byte al_n = (ds->*si_n).t0000.u0 - dl_n;
						if (al_n != 0x00)
						{
							dl_n += al_n;
							do
							{
								ch_n = __rol<byte,byte>(ch_n, 0x01);
								di_n = (word16) di_n + (word16) ((ch_n & 0x80) != 0x00);
								ss->*((fp - 0x0022) + di_n) = (word16) (ss->*((fp - 0x0022) + di_n) | ch_n);
								--al_n;
							} while (al_n != 0x00);
						}
					}
					word16 bp_n = fn0800-1AFF(&(ss->*(fp - 2)));
					bxOut = bx_n << 0x01;
					bpOut = bp_n;
					return dx_n;
				case 0x11:
					Eq_n ax_n = wLoc28_n;
					dx.u1 = 0x00;
					if ((bLoc2B_n & 0x01) == 0x00)
						goto l0800_nE;
					break;
				case 0x12:
					si_n = 0x10;
l0800_n:
					if ((ax_n & 0x20) == 0x00)
						bLoc2B_n |= 0x04;
					wLoc04 = fp - 40;
					ax_n = __scantol(ds, wArg02, wArg04, wArg06, si_n, wLoc24_n & 0x7FFF, fp - 40, fp - 38, out dx, out bx, out di, out es);
					if (wLoc26 > 0x00)
					{
						if ((bLoc2B_n & 0x01) == 0x00)
						{
l0800_nE:
							struct Eq_n * es_di_n = fn0800-1708(fp - 2, ds);
							es_di_n->t0000.u1 = (word16) ax_n;
							word16 di_n = (word16) es_di_n;
							es = SLICE(es_di_n, selector, 16);
							di = di_n + 2;
							if ((bLoc2B_n & 0x04) != 0x00)
							{
								es_di_n->t0002.u1 = (word16) dx;
								dx = ax_n;
								di = di_n + 4;
							}
						}
						goto l0800_n;
					}
					if (wLoc26 < 0x00)
					{
						word16 bp_n = fn0800-1AEB(fp - 2);
						bxOut = bx;
						bpOut = bp_n;
						return dx;
					}
					else
					{
						word16 bp_n = fn0800-1AFF(fp - 2);
						bxOut = bx;
						bpOut = bp_n;
						return dx;
					}
				case 0x13:
					word16 bp_n;
					fn0800-1898(fp - 2, ds, out bp_n);
					word16 bp_n;
					bxOut = fn0800-1898(bp_n, ds, out bp_n);
					bpOut = bp_n;
					return dx;
				case 0x14:
					bLoc2B_n &= 223;
					break;
				case 0x15:
					bLoc2B_n |= 0x20;
					break;
				}
			}
l0800_nE6:
			word16 bp_n = fn0800-1AEB(fp - 2);
			bxOut = bx;
			bpOut = bp_n;
			return dx;
		}
l0800_nF:
		(seg0800->*wArg02)();
		ax_n = (int16) al_n;
		wLoc28_n.u1 = (word16) wLoc28_n.u1 + 1;
		Eq_n cx_n;
		cx_n.u0 = (ss->*sp_n).t0000.u0;
		struct Eq_n Eq_n::* sp_n = (struct Eq_n Eq_n::*) ((char *) &sp_n->t0000 + 2);
		Eq_n ax_n = ax_n;
		uint16 bx_n;
		Eq_n dx_n;
		if (ax_n < 0x00)
		{
l0800_n:
			word16 bp_n = fn0800-1AEB(fp - 2);
			bxOut = bx_n;
			bpOut = bp_n;
			return dx_n;
		}
		di = ax_n;
		if (ax_n >= 0x00 && ds->*((word16) ax_n + 0x055A) == 0x01)
		{
			Eq_n ax_n;
			do
			{
				if ((byte) ax_n < 0x00 || ds->*((word16) ax_n + 0x055A) != 0x01)
				{
					struct Eq_n Eq_n::* sp_n = sp_n - 2;
					(ss->*sp_n).t0000.u0 = (struct Eq_n *) wArg06;
					(ss->*sp_n).tFFFFFFFE.u0 = (struct Eq_n *) ax_n;
					(seg0800->*wArg04)();
					word16 cx_n = (ss->*sp_n).w0002;
					--wLoc28_n;
					uint16 bx_n;
					bx = bx_n;
					Eq_n dx_n;
					dx = dx_n;
					goto l0800_n;
				}
				(ss->*sp_n).tFFFFFFFE.u0 = (struct Eq_n *) wArg06;
				(seg0800->*wArg02)();
				wLoc28_n.u1 = (word16) wLoc28_n.u1 + 1;
				Eq_n cx_n;
				union Eq_n Eq_n::* sp_n;
				cx_n.u0 = (ss->*sp_n).u0;
				sp_n = (struct Eq_n Eq_n::*) ((char *) sp_n + 2);
				ax_n = ax_n;
			} while (ax_n > 0x00);
			goto l0800_n;
		}
		bx = bx_n;
		dx = dx_n;
	} while (ax_n == ax_n);
	(ss->*sp_n).t0000.u0 = (struct Eq_n *) wArg06;
	(ss->*sp_n).tFFFFFFFE.u0 = (struct Eq_n *) ax_n;
	(seg0800->*wArg04)();
	word16 bp_n = fn0800-1AEB(fp - 2);
	uint16 bx_n;
	bxOut = bx_n;
	bpOut = bp_n;
	Eq_n dx_n;
	return dx_n;
}

// 0800:1708: Sequence Eq_n fn0800-1708(Sequence (ptr32 Eq_n) ss_bp, Register Eq_n ds)
// Called from:
//      __scanner
Eq_n fn0800-1708(struct Eq_n * ss_bp, Eq_n ds)
{
	union Eq_n Eq_n::* di_n = ss_bp->ptr000C;
	if ((ss_bp->bFFFFFFD7 & 0x20) == 0x00)
	{
		Eq_n di_n;
		di_n.u1 = (ds->*di_n).u1;
		ss_bp->ptr000C = (union Eq_n Eq_n::*) ((char *) ss_bp->ptr000C + 2);
		return SEQ(ds, di_n);
	}
	else
	{
		Eq_n es_di_n;
		es_di_n.u0 = (ds->*di_n).u0;
		ss_bp->ptr000C = (union Eq_n Eq_n::*) ((char *) ss_bp->ptr000C + 4);
		return es_di_n;
	}
}

// 0800:1898: Register word16 fn0800-1898(Sequence (ptr32 Eq_n) ss_bp, Register Eq_n ds, Register out word16 bpOut)
// Called from:
//      __scanner
word16 fn0800-1898(struct Eq_n * ss_bp, Eq_n ds, word16 & bpOut)
{
	word16 bp_n;
	word16 bx_n = fn0800-1B06(ss_bp, ds, out bp_n);
	bpOut = bp_n;
	return bx_n;
}

// 0800:18AF: void fn0800-18AF(Sequence (ptr32 Eq_n) ss_bp)
void fn0800-18AF(struct Eq_n * ss_bp)
{
	fn0800-1B2C(ss_bp);
}

// 0800:18CF: void fn0800-18CF(Sequence (ptr32 Eq_n) ss_bp)
void fn0800-18CF(struct Eq_n * ss_bp)
{
	fn0800-1B2C(ss_bp);
}

// 0800:196F: Register word16 fn0800-196F(Sequence (ptr32 Eq_n) ss_bp, Register Eq_n ds, Register out word16 bpOut)
// Called from:
//      __scanner
word16 fn0800-196F(struct Eq_n * ss_bp, Eq_n ds, word16 & bpOut)
{
	word16 bp_n;
	word16 bx_n = fn0800-1B06(ss_bp, ds, out bp_n);
	bpOut = bp_n;
	return bx_n;
}

// 0800:1AEB: Register word16 fn0800-1AEB(Sequence (ptr32 Eq_n) ss_bp)
// Called from:
//      __scanner
//      fn0800-1898
//      fn0800-1B2C
word16 fn0800-1AEB(struct Eq_n * ss_bp)
{
	selector seg0800;
	(seg0800->*ss_bp->ptr0006)();
	ss_bp->wFFFFFFD8 -= (word16) (ss_bp->wFFFFFFD8 < 0x01);
	return fn0800-1AFF(ss_bp);
}

// 0800:1AFF: Register word16 fn0800-1AFF(Sequence (ptr32 Eq_n) ss_bp)
// Called from:
//      __scanner
//      fn0800-1AEB
word16 fn0800-1AFF(struct Eq_n * ss_bp)
{
	return ss_bp->w0000;
}

// 0800:1B06: Register word16 fn0800-1B06(Sequence (ptr32 Eq_n) ss_bp, Register Eq_n ds, Register out word16 bpOut)
// Called from:
//      fn0800-1898
//      fn0800-196F
word16 fn0800-1B06(struct Eq_n * ss_bp, Eq_n ds, word16 & bpOut)
{
	struct Eq_n Eq_n::* fp;
	struct Eq_n * ss = SLICE(ss_bp, selector, 16);
	word16 bp = (word16) ss_bp;
	struct Eq_n Eq_n::* sp_n = fp;
	ci8 al_n;
	Eq_n ax_n;
	do
	{
		++ss_bp->wFFFFFFDA;
		(ss->*sp_n).wFFFFFFFE = ss_bp->w0008;
		selector seg0800;
		(seg0800->*ss_bp->ptr0004)();
		sp_n = fp - 2;
		al_n = (byte) ax_n;
		if (ax_n <= 0x00)
		{
			if (ax_n == 0x00)
				break;
			bpOut = fn0800-1AEB(ss_bp);
			word16 bx_n;
			return bx_n;
		}
	} while (al_n >= 0x00 && ds->*((word16) ax_n + 0x055A) == 0x01);
	Eq_n wLoc02;
	(*((word32) wLoc02 + 3))();
	bpOut = bp;
	word16 bx_n;
	return bx_n;
}

// 0800:1B2C: void fn0800-1B2C(Sequence (ptr32 Eq_n) ss_bp)
// Called from:
//      fn0800-18AF
//      fn0800-18CF
void fn0800-1B2C(struct Eq_n * ss_bp)
{
	ci16 ax_n;
	struct Eq_n Eq_n::* fp;
	struct Eq_n * ss = SLICE(ss_bp, selector, 16);
	struct Eq_n Eq_n::* sp_n = fp;
	word16 dx_n = 0x00;
	word16 cx_n = 0x04;
	ci8 cl_n;
	while (true)
	{
		ci16 v9_n = ss_bp->wFFFFFFDE - 0x01;
		ss_bp->wFFFFFFDE = v9_n;
		cl_n = (byte) cx_n;
		if (v9_n < 0x00)
			break;
		struct Eq_n Eq_n::* sp_n = sp_n - 2;
		(ss->*sp_n).w0000 = dx_n;
		(ss->*sp_n).wFFFFFFFE = cx_n;
		++ss_bp->wFFFFFFDA;
		(ss->*sp_n).wFFFFFFFC = ss_bp->w0008;
		selector seg0800;
		(seg0800->*ss_bp->ptr0004)();
		struct Eq_n Eq_n::* sp_n;
		cl_n = (ss->*sp_n).b0002;
		cui16 dx_n = (ss->*sp_n).w0004;
		sp_n = (struct Eq_n Eq_n::*) (&sp_n->w0004 + 1);
		cu8 al_n = (byte) ax_n;
		if (ax_n <= 0x00)
			break;
		--cl_n;
		if (cl_n < 0x01)
			break;
		cu8 ch_n = al_n - 0x30;
		if (al_n < 0x30)
			break;
		if (al_n >= 0x3A)
		{
			cu8 ch_n = al_n - 0x41;
			if (al_n < 0x41)
				break;
			if (al_n >= 0x47)
			{
				ch_n = al_n - 0x61;
				if (al_n < 0x61 || al_n >= 0x67)
					break;
			}
			ch_n = ch_n + 0x0A;
		}
		dx_n = SEQ(SLICE(dx_n << 0x04, byte, 8), ((byte) dx_n << 0x04) + ch_n);
		cx_n = SEQ(ch_n, cl_n - 0x01);
	}
	if (cl_n == 0x04)
		fn0800-1AEB(ss_bp);
	else
	{
		Eq_n wLoc02;
		(*((word32) wLoc02 + 3))();
	}
}

// 0800:1B92: void __scantod(Register Eq_n ds)
// Called from:
//      __scanner
void __scantod(Eq_n ds)
{
	Mem0[ds:0x05E2:word16]();
}

// 0800:1B96: void __scanrslt(Register Eq_n ds)
// Called from:
//      __scanner
void __scanrslt(Eq_n ds)
{
	Mem0[ds:0x05E4:word16]();
}

// 0800:1B9A: void __scanpop(Register Eq_n ds)
// Called from:
//      __scanner
void __scanpop(Eq_n ds)
{
	Mem0[ds:1510:word16]();
}

// 0800:1B9E: FlagGroup bool fn0800-1B9E(Register cu8 cl, Register byte bl)
// Called from:
//      __scantol
bool fn0800-1B9E(cu8 cl, byte bl)
{
	word16 bx;
	cu8 bl_n = (byte) bx;
	cu8 bl_n = bl_n - 0x30;
	word32 C_n;
	if (bl_n >= 0x30)
	{
		if (bl_n <= 0x39)
		{
l0800_nBBB:
			if (bl_n < cl)
			{
				C_n = 0x00;
				return C_n != 0x00;
			}
			goto l0800_nBC7;
		}
		if (bl_n <= 0x5A && bl_n >= 0x30)
			bl_n = bl_n - 55;
		else
			bl_n = bl_n - 0x57;
		if (bl_n > 0x09)
			goto l0800_nBBB;
	}
l0800_nBC7:
	C_n = 0x02;
	return C_n != 0x00;
}

// 0800:1BCC: Register uint16 __scantol(Register Eq_n ds, Stack (memptr (ptr16 Eq_n) code) wArg02, Stack (memptr (ptr16 Eq_n) code) wArg04, Stack Eq_n wArg06, Stack uint16 wArg08, Stack ci16 wArg0A, Stack (memptr Eq_n word16) wArg0C, Stack (memptr Eq_n ui16) wArg0E, Register out Eq_n dxOut, Register out ui16 bxOut, Register out Eq_n diOut, Register out Eq_n esOut)
// Called from:
//      __scanner
uint16 __scantol(Eq_n ds, <anonymous> seg0800_t::* wArg02, <anonymous> seg0800_t::* wArg04, Eq_n wArg06, uint16 wArg08, ci16 wArg0A, word16 Eq_n::* wArg0C, ui16 Eq_n::* wArg0E, union Eq_n & dxOut, ui16 & bxOut, union Eq_n & diOut, union Eq_n & esOut)
{
	uint16 ax_n;
	uint16 ax_n;
	mp16 fp;
	uint8 bLoc07_n = 0x00;
	word16 wLoc06_n = 0x00;
	struct Eq_n Eq_n::* sp_n = fp - 0x0E;
	selector ss;
	selector seg0800;
	word16 v10_n;
	union Eq_n Eq_n::* sp_n;
	Eq_n ax_n;
	Eq_n al_n;
	Eq_n ax_n;
	do
	{
		(ss->*sp_n).tFFFFFFFE.u0 = (struct Eq_n *) wArg06;
		(seg0800->*wArg02)();
		v10_n = wLoc06_n + 0x01;
		wLoc06_n = v10_n;
		sp_n = (struct Eq_n Eq_n::*) ((char *) sp_n + 2);
		Eq_n ax_n;
		ax_n = ax_n;
		al_n = (byte) ax_n;
		if (ax_n < 0x00)
			goto l0800_nC5A;
		ax_n = (int16) al_n;
	} while ((al_n & 0x80) == 0x00 && (ds->*((word16) ax_n + 577) & 0x01) != 0x00);
	ax_n = ax_n;
	ci16 wArg0A_n = wArg0A - 0x01;
	ui16 wLoc04_n;
	uint16 ax_n;
	Eq_n dx_n;
	if (wArg0A < 0x01)
	{
l0800_nC61:
		wLoc04_n = 0x00;
l0800_nC66:
		struct Eq_n Eq_n::* sp_n = sp_n - 2;
		(ss->*sp_n).t0000.u0 = (struct Eq_n *) wArg06;
		(ss->*sp_n).tFFFFFFFE.u0 = (struct Eq_n *) ax_n;
		(seg0800->*wArg04)();
		word16 sp_n;
		sp_n = sp_n + 4;
		--wLoc06_n;
		ax_n = 0x00;
		dx_n.u1 = 0x00;
		goto l0800_nD1F;
	}
	Eq_n ax_n;
	if (al_n != 0x2B)
	{
		ax_n = (uint16) al_n;
		if (al_n != 0x2D)
			goto l0800_nC24;
		bLoc07_n = 0x01;
	}
	wArg0A_n = wArg0A - 0x02;
	if (wArg0A < 0x02)
		goto l0800_nC61;
	(ss->*sp_n).u0 = (struct Eq_n *) wArg06;
	(seg0800->*wArg02)();
	wLoc06_n = v10_n + 0x01;
	word16 sp_n;
	sp_n = sp_n + 2;
	ax_n = ax_n;
	if (ax_n < 0x00)
	{
l0800_nC5A:
		wLoc04_n = ~0x00;
		goto l0800_nC66;
	}
l0800_nC24:
	byte al_n = (byte) ax_n;
	uint16 si_n = 0x00;
	cu8 cl_n = (byte) wArg08;
	uint32 di_ax_n;
	uint32 di_si_n;
	uint32 di_si_n;
	if (wArg08 == 0x00)
	{
		wArg08 = 0x0A;
		if (al_n == 0x30)
		{
			ci16 v66_n = wArg0A_n - 0x01;
			wArg0A_n = v66_n;
			if (v66_n >= 0x00)
			{
				(ss->*sp_n).tFFFFFFFE.u0 = (struct Eq_n *) wArg06;
				(seg0800->*wArg02)();
				++wLoc06_n;
				byte al_n = (byte) ax_n;
				word16 sp_n;
				sp_n = sp_n + 2;
				wArg08 = 0x08;
				if (al_n != 0x78)
				{
					di_ax_n = (uint32) ax_n;
					if (al_n != 88)
					{
l0800_nCCD:
						Eq_n ax_n = (word16) di_ax_n;
						ui16 di_n = SLICE(di_ax_n, word16, 16);
						Eq_n ax_n = ax_n;
						uint32 di_si_n;
						if (!fn0800-1B9E((byte) wArg08, (byte) ax_n))
						{
							di_si_n = SEQ(di_n, si_n);
l0800_nD03:
							struct Eq_n Eq_n::* sp_n = sp_n - 2;
							(ss->*sp_n).t0000.u0 = (struct Eq_n *) wArg06;
							(ss->*sp_n).tFFFFFFFE.u0 = (struct Eq_n *) ax_n;
							(seg0800->*wArg04)();
							word16 sp_n;
							sp_n = sp_n + 4;
							--wLoc06_n;
							di_si_n = di_si_n;
l0800_nD0F:
							wLoc04_n = 0x01;
							dx_n.u1 = SLICE(di_si_n, word16, 16);
							ax_n = (word16) di_si_n;
							if (bLoc07_n != 0x00)
							{
								Eq_n dx_ax_n = -di_si_n;
								ax_n = (word16) dx_ax_n;
								dx_n.u1 = SLICE(dx_ax_n, word16, 16);
							}
							goto l0800_nD1F;
						}
						di_si_n = di_ax_n + wArg08 *32 si_n;
						if (SLICE(di_si_n, word16, 16) != 0x00)
						{
							Eq_n dx_ax_n;
							uint32 ax_si_n;
							do
							{
								ci16 v51_n = wArg0A_n - 0x01;
								uint16 di_n = SLICE(di_si_n, word16, 16);
								uint16 si_n = (word16) di_si_n;
								wArg0A_n = v51_n;
								di_si_n = di_si_n;
								if (v51_n < 0x00)
									goto l0800_nD0F;
								(ss->*sp_n).tFFFFFFFE.u0 = (struct Eq_n *) wArg06;
								(seg0800->*wArg02)();
								++wLoc06_n;
								word16 sp_n;
								sp_n = sp_n + 2;
								Eq_n ax_n;
								ax_n = ax_n;
								di_si_n = di_si_n;
								if (!fn0800-1B9E((byte) wArg08, (byte) ax_n))
									goto l0800_nD03;
								dx_ax_n = wArg08 *32 di_n;
								ax_si_n = SEQ((word16) dx_ax_n, ax_n) + wArg08 *32 si_n;
								di_si_n = ax_si_n;
							} while (SLICE(dx_ax_n, byte, 16) + SLICE(dx_ax_n, byte, 24) + (byte) (SLICE(ax_si_n, word16, 16) < 0x00) == 0x00);
							uint16 ah_al_n = (uint16) bLoc07_n + ~0x00;
							dx_n = (cond(SLICE(ah_al_n, byte, 8)) & 0x02) + 0x7FFF;
							wLoc04_n = 0x02;
							ax_n = ah_al_n;
l0800_nD1F:
							ds->*wArg0C += wLoc06_n;
							ds->*wArg0E = wLoc04_n;
							Eq_n es_n;
							es_n.u0 = (ss->*sp_n).t0000.u0;
							struct Eq_n Eq_n::* sp_n = (struct Eq_n Eq_n::*) ((char *) &sp_n->t0000 + 2);
							Eq_n di_n;
							di_n.u0 = (ss->*sp_n).t0000.u0;
							dxOut = dx_n;
							bxOut = wLoc04_n;
							diOut = di_n;
							esOut = es_n;
							return ax_n;
						}
l0800_nCBE:
						ci16 v43_n = wArg0A_n - 0x01;
						word16 di_n = SLICE(di_si_n, word16, 16);
						si_n = (word16) di_si_n;
						wArg0A_n = v43_n;
						di_si_n = di_si_n;
						if (v43_n < 0x00)
							goto l0800_nD0F;
						(ss->*sp_n).tFFFFFFFE.u0 = (struct Eq_n *) wArg06;
						(seg0800->*wArg02)();
						++wLoc06_n;
						word16 sp_n;
						sp_n = sp_n + 2;
						word16 ax_n;
						di_ax_n = SEQ(di_n, ax_n);
						goto l0800_nCCD;
					}
				}
				wArg08 = 0x10;
l0800_nCA5:
				di_si_n = 0x00;
				goto l0800_nCBE;
			}
			goto l0800_nC78;
		}
		goto l0800_nCA7;
	}
	ax_n = ax_n;
	if (wArg08 > 0x24)
		goto l0800_nC61;
	ax_n = ax_n;
	if (cl_n >= 0x02)
	{
		if (al_n == 0x30)
		{
			if (cl_n != 0x10)
				goto l0800_nCA5;
			ci16 v34_n = wArg0A_n - 0x01;
			wArg0A_n = v34_n;
			if (v34_n >= 0x00)
			{
				(ss->*sp_n).tFFFFFFFE.u0 = (struct Eq_n *) wArg06;
				(seg0800->*wArg02)();
				++wLoc06_n;
				byte al_n = (byte) ax_n;
				word16 sp_n;
				sp_n = sp_n + 2;
				if (al_n != 0x78 && al_n != 88)
				{
					di_ax_n = (uint32) ax_n;
					goto l0800_nCCD;
				}
				goto l0800_nCA5;
			}
l0800_nC78:
			di_si_n = 0x00;
			goto l0800_nD0F;
		}
l0800_nCA7:
		ax_n = ax_n;
		if (!fn0800-1B9E((byte) wArg08, (byte) ax_n))
		{
			di_si_n = (uint32) ax_n;
			goto l0800_nCBE;
		}
		goto l0800_nC61;
	}
	goto l0800_nC61;
}

// 0800:1D4E: void _tell(Register (ptr16 Eq_n) ds, Stack int16 wArg02)
void _tell(struct Eq_n * ds, int16 wArg02)
{
	word16 dx_n;
	_lseek(ds, wArg02, 0x00, 0x01, out dx_n);
}

<anonymous> g_t1D65 = <code>; // 0800:1D65
