// unarcz13_code.c
// Generated by decompiling unarcz13.com
// using Reko decompiler version 0.11.6.0.

#include "unarcz13.h"

// 0100: void CpmCom_Start()
// Called from:
//      fn01BF
void CpmCom_Start()
{
	Eq_n hl_n;
	word16 de_n;
	byte b_n;
	word16 de_n;
	byte b_n;
	word16 hl_n;
	word16 de_n;
	byte b_n;
	struct Eq_n * fp;
	g_ptr01CA = fp;
	fn01FB();
	word16 hl_n;
	fn0F2A(0x00, 0x12, (byte *) 5954, out hl_n);
	uint8 f;
	fn0226(f);
	// Failed to bind call argument.
	// Please report this issue at https://github.com/uxmal/reko
	byte stackArg0 = <invalid>;
	byte b;
	fn0602(b, stackArg0);
	struct Eq_n * sp_n;
	byte b_n;
	do
	{
		struct Eq_n * bc_n = (struct Eq_n *) <invalid>;
		sp_n = (struct Eq_n *) 5954;
		b_n = SLICE(bc_n, byte, 8);
		byte b_n;
		word16 de_n;
		word16 hl_n;
		if (SLICE(fn052E(out b_n, out de_n, out hl_n), byte, 8) == 0x1A)
			goto l0187;
	} while (b_n != 0x01);
	byte b_n;
	word16 de_n;
	Eq_n hl_n;
	struct Eq_n * sp_n;
	while (SLICE(fn052E(out b_n, out de_n, out hl_n), byte, 8) == 0x1A)
	{
l0187:
		word16 af_n = fn052E(out b_n, out de_n, out hl_n);
		sp_n = fp;
		uint8 f_n = (byte) af_n;
		if (SLICE(af_n, byte, 8) == 0x00)
		{
			Eq_n hl_n = *(union Eq_n *) 5954;
			byte h_n = SLICE(hl_n, byte, 8);
			byte l_n = (byte) hl_n;
			bool v28_n = h_n == 0x00;
			if (h_n == 0x00)
			{
				byte a_n = h_n | l_n;
				if (a_n == 0x00)
				{
					fn021B();
					return;
				}
				v28_n = a_n == 0x01;
			}
			if (v28_n)
			{
				fn01BF();
				return;
			}
			else
			{
				fn0C6C(f_n);
				fn01BF();
				return;
			}
		}
l018D:
		byte a;
		fn05A3(a);
		if (!fn05C2())
		{
			fn0BFD(f);
			ui16 hl';
			fn06B0(f, hl');
			if (fn06A5())
			{
				fn01BF();
				return;
			}
		}
		word16 de_n;
		fn0F13((struct Eq_n *) 0x17A7, out de_n);
		byte c;
		byte d;
		uint8 e;
		fn0563(SEQ(c, d), b, e);
		sp_n = sp_n;
	}
	while (true)
	{
		fn055D(hl_n);
		byte a_n = SLICE(fn052E(out b_n, out de_n, out hl_n), byte, 8);
		while (a_n == 0x1A)
		{
			word16 af_n = fn052E(out b_n, out de_n, out hl_n);
			sp_n->wFFFFFFFE = af_n;
			uint8 f_n = (byte) af_n;
			if (SLICE(af_n, byte, 8) < 0x0A)
			{
				byte * hl_n;
				fn0EBB(f_n, 0x00, hl_n, &g_b13B8, out hl_n);
				*hl_n = 0x00;
				fn0CDB();
				sp_n = sp_n;
				goto l018D;
			}
			hl_n = fn055D(hl_n);
			a_n = sp_n->b0003;
		}
	}
}

struct Eq_n * g_ptr0109 = null; // 0109
byte g_b0115 = 0x08; // 0115
byte g_b0116 = 0x00; // 0116
byte g_b0117 = ~0x00; // 0117
byte g_b0118 = 0x00; // 0118
byte g_b0119 = 0x00; // 0119
byte g_b011A = ~0x00; // 011A
byte g_b011B = 0x00; // 011B
byte g_b011C = 0x00; // 011C
byte g_b011D = 0x43; // 011D
// 01BF: void fn01BF()
// Called from:
//      CpmCom_Start
//      fn021E
//      fn0221
//      fn0A8F
void fn01BF()
{
	fn04B8();
	if (g_b0115 != 0x00)
		return;
	CpmCom_Start();
}

struct Eq_n * g_ptr01CA = null; // 01CA
// 01FB: void fn01FB()
// Called from:
//      CpmCom_Start
void fn01FB()
{
	g_b04BF = 0x00;
	g_b04CB = 0x00;
	g_b0CF1 = 0x00;
	*(ui8 *) 5994 = 0x00;
	g_b0215 = g_b0007 - g_b0115;
	if (false)
		return;
	fn0217();
}

// 0214: Register word16 fn0214(Register cu8 a)
// Called from:
//      fn0602
//      fn06B0
word16 fn0214(cu8 a)
{
	if (a >= 0x00)
		return fn0217();
	word16 hl;
	return hl;
}

cu8 g_b0215 = 0x00; // 0215
// 0217: Register word16 fn0217()
// Called from:
//      fn01FB
//      fn0214
word16 fn0217()
{
	fn021B();
	word16 wArg00;
	return wArg00;
}

// 021B: void fn021B()
// Called from:
//      CpmCom_Start
//      fn01FB
//      fn0226
//      fn0540
//      fn0602
//      fn06B0
//      fn0A8F
//      fn0AB3
void fn021B()
{
	byte * de;
	fn0D12(de);
	word16 af_n;
	fn021E(out af_n);
}

// 021E: FlagGroup byte fn021E(Register out (ptr16 Eq_n) afOut)
// Called from:
//      fn01FB
//      fn0226
//      fn04F3
byte fn021E(struct Eq_n & afOut)
{
	byte * de;
	fn0221(de);
	afOut = (struct Eq_n *) <invalid>;
	return <invalid>;
}

// 0221: void fn0221(Register (ptr16 byte) de)
// Called from:
//      fn021E
//      fn0226
void fn0221(byte * de)
{
	fn0D15(de);
	fn01BF();
}

// 0226: void fn0226(Register uint8 f)
// Called from:
//      CpmCom_Start
void fn0226(uint8 f)
{
	struct Eq_n * hl_n;
	word16 bc_n;
	byte * hl_n;
	uint16 bc_n;
	byte * hl_n;
	uint16 bc_n;
	struct Eq_n * hl_n = g_ptr0109;
	((union Eq_n *) 0x1754)->u0 = hl_n->t0029.u0;
	*(byte *) 0x1755 = hl_n->b002A;
	byte a_n = g_ptr0109->b0032;
	*(ui8 *) 5994 = a_n - 0x01;
	g_b0CF1 = a_n - 0x01;
	*(ui8 *) 5995 = a_n - 0x01;
	byte a_n = g_b011C;
	byte a_n = a_n;
	if (a_n != 0x00)
	{
		g_b0CF1 = 0x00;
		*(ui8 *) 5995 = 0x00;
		a_n = 0x00;
	}
	*(byte *) 5993 = a_n;
	if (g_b011B != 0x00)
		*(byte *) 5993 = ~0x00;
	uint8 a_n = g_b0080;
	if (a_n == 0x00)
	{
l03D0:
		fn0D15(&g_b0F48);
		fn0CB5();
		fn0D15(&g_b0F89);
		byte a_n;
		fn04AB(out a_n);
		struct Eq_n * sp_n = (struct Eq_n *) <invalid>;
		sp_n->wFFFFFFFE = SEQ(a_n, f);
		if (a_n == 0x00)
			fn0D15(&g_b0F9F);
		fn0D15(&g_b0FA6);
		word16 af_n = sp_n->wFFFFFFFE;
		sp_n->wFFFFFFFE = af_n;
		if (SLICE(af_n, byte, 8) == 0x00)
			fn0D15(&g_b1013);
		if (g_b0117 == 0x00)
		{
			word16 af_n = sp_n->wFFFFFFFE;
			sp_n->wFFFFFFFE = af_n;
			if (SLICE(af_n, byte, 8) != 0x00)
			{
l040A:
				fn0D15(&g_b1067);
				if (g_b011C == 0x00)
					fn0D15(&g_b1101);
				fn0D15(&g_b1079);
				word16 af_n = sp_n->wFFFFFFFE;
				sp_n->wFFFFFFFE = af_n;
				if (SLICE(af_n, byte, 8) == 0x00)
				{
					fn0D15(&g_b108F);
					if (g_b011B != 0x00)
						fn0D15(&g_b1101);
					fn0D15(&g_b10BA);
				}
				fn0D15(&g_b1108);
				fn0CB5();
				fn0D15(&g_b111A);
				fn0CB5();
				fn0D15(&g_b115B);
				struct Eq_n * sp_n = (struct Eq_n *) <invalid>;
				struct Eq_n * sp_n;
				if (g_b0117 == 0x00)
				{
					word16 af_n = sp_n->w0000;
					sp_n->w0000 = af_n;
					sp_n = sp_n;
					if (SLICE(af_n, byte, 8) != 0x00)
					{
l0471:
						if (sp_n->b0001 == 0x00)
						{
							fn0D15(&g_b11D5);
							fn0CB5();
							fn0D15(&g_b11DC);
							fn0CB5();
							fn0D15(&g_b121A);
							fn0D15(&g_b1252);
							fn0CB5();
							fn0D15(&g_b1259);
							fn0CB5();
							fn0D15(&g_b129A);
						}
						byte * de;
						fn0221(de);
						return;
					}
				}
				fn0D15(&g_b1194);
				fn0CB5();
				fn0D15(&g_b119B);
				sp_n = (struct Eq_n *) <invalid>;
				goto l0471;
			}
		}
		fn0D15(&g_b103B);
		goto l040A;
	}
	byte a_n = fn0EE5((uint16) a_n, &g_b0081, out bc_n, out hl_n);
	if (a_n == 0x00 || a_n == 0x2F)
		goto l03D0;
	byte * hl_n;
	do
	{
		hl_n = hl_n + 1;
		--bc_n;
		if (bc_n == 0x00)
			break;
		hl_n = hl_n;
	} while (*hl_n != 0x20);
	if (*hl_n == 0x20)
	{
		byte a_n = fn0EE5(bc_n, hl_n, out bc_n, out hl_n);
		byte a_n;
		if (a_n == 0x2F)
		{
l029C:
			++hl_n;
			a_n = *hl_n;
			goto l029E;
		}
		if (a_n == 0x00)
			goto l02B7;
		byte * hl_n;
		do
		{
			hl_n = hl_n + 1;
			--bc_n;
			if (bc_n == 0x00)
				break;
			hl_n = hl_n;
		} while (*hl_n != 0x20);
		if (*hl_n == 0x20)
		{
			byte a_n = fn0EE5(bc_n, hl_n, out bc_n, out hl_n);
			a_n = a_n;
			if (a_n == 0x00)
				goto l02B7;
			if (a_n != 0x2F)
			{
l029E:
				if (a_n != 0x00)
				{
					if (a_n == 0x4E)
						fn03A2();
					if (a_n == 0x50)
						fn03BD(a_n);
					if (a_n == 0x43)
						fn03C1(a_n);
					if (a_n == 0x45)
						fn03C5();
					goto l029C;
				}
				goto l02B7;
			}
			goto l029C;
		}
	}
l02B7:
	uint8 a_n = g_b0069;
	*(uint8 *) 5989 = a_n;
	uint8 f_n = (byte) fn0EB8(a_n, f, 0x0200, &g_b144A, out hl_n);
	hl_n->b0000 = 0x3A;
	hl_n->b0001 = 0x00;
	uint8 a_n = g_b005C;
	uint8 a_n = a_n;
	if (a_n == 0x00)
		a_n = DRV_GET() + 0x01;
	g_b1449 = a_n + 0x40;
	if (g_b007B != 0x00)
	{
		fn021B();
		return;
	}
	uint8 a_n = g_b0079;
	*(uint8 *) 0x1766 = a_n;
	struct Eq_n * hl_n;
	f = (byte) fn0EB8(a_n, f_n, 0x0200, &g_b1471, out hl_n);
	hl_n->b0000 = 0x3A;
	hl_n->b0001 = 0x00;
	*(byte *) 0x1778 = g_b006C;
	byte * hl_n = &g_b006D;
	byte * de_n = (byte *) 5997;
	word16 bc_n = 11;
	byte a_n = 0x20;
	if (g_b006D == 0x2F || g_b006D == 0x20)
	{
		*(byte *) 5997 = 0x3F;
		hl_n = (byte *) 5997;
		de_n = (byte *) 5998;
		bc_n = 0x0A;
	}
	do
	{
		*de_n = *hl_n;
		++hl_n;
		++de_n;
		--bc_n;
	} while (bc_n != 0x00);
	if (g_b0065 == 0x20)
	{
		g_b0065 = 0x41;
		g_b0066 = 0x52;
		g_b0067 = 0x4B;
		*(byte *) 0x1751 = 0x20;
	}
	while (a_n != g_b005D)
	{
		Eq_n v27_n = fn06A8(&g_b005D);
		do
		{
			if (v27_n)
			{
				fn021B();
				return;
			}
			*fn0D4F(0x20, &g_b005D, &g_b144E) = 0x00;
			((union Eq_n *) 0x1767)->u0 = ~0x00;
			if (g_b006B != 0x00)
			{
				fn021B();
				return;
			}
			fn0AC9();
			byte a_n;
			if (fn04E9(&g_b005C, out a_n))
			{
				g_b04BF = a_n;
				fn0D15(&g_b1438);
				fn0CDE(&g_b144E);
				byte a_n = g_b0116;
				bool v30_n = a_n != 0x00;
				if (a_n == 0x00)
				{
					byte a_n;
					v30_n = fn04AB(out a_n);
				}
				if (v30_n)
				{
					fn0391();
					return;
				}
				else
				{
					fn0391();
					return;
				}
			}
			a_n = a_n | *((byte *) 0x1751);
			v27_n = a_n == 0x00;
		} while (a_n == 0x00);
		*(byte *) 0x1751 = 0x00;
		g_b0067 = 0x43;
	}
	goto l03D0;
}

// 0391: FlagGroup bool fn0391()
// Called from:
//      fn0226
//      fn0602
bool fn0391()
{
	byte a_n = DRV_DPB()->b0003;
	byte SZP_n = cond(a_n + 0x01);
	uint8 a_n = __ror<byte,byte>(a_n + 0x01, 0x03);
	*(uint8 *) 5996 = a_n;
	return (SZP_n & 0x40) != 0x00;
}

// 03A2: void fn03A2()
// Called from:
//      fn0226
void fn03A2()
{
	if (g_b0CF1 == 0x00)
	{
		ui8 a_n = *(ui8 *) 5994;
		g_b0CF1 = a_n;
		*(ui8 *) 5995 = a_n;
	}
	else
	{
		g_b0CF1 = 0x00;
		*(ui8 *) 5995 = 0x00;
	}
}

// 03BD: void fn03BD(Register byte a)
// Called from:
//      fn0226
void fn03BD(byte a)
{
	*(byte *) 0x1752 = a;
}

// 03C1: void fn03C1(Register byte a)
// Called from:
//      fn0226
void fn03C1(byte a)
{
	*(byte *) 0x1753 = a;
}

// 03C5: void fn03C5()
// Called from:
//      fn0226
void fn03C5()
{
	*(byte *) 5993 = ~*(byte *) 5993;
}

// 04AB: FlagGroup bool fn04AB(Register out byte aOut)
// Called from:
//      fn0226
//      fn0602
//      fn06B0
//      fn0A8F
bool fn04AB(byte & aOut)
{
	byte a_n = *((union Eq_n *) 0x1754)->u1;
	if (a_n != 0x00)
	{
		aOut = 0x00;
		return (cond(0x00) & 0x40) != 0x00;
	}
	else
	{
		aOut = a_n + 0x01;
		return (cond(a_n + 0x01) & 0x40) != 0x00;
	}
}

// 04B8: void fn04B8()
// Called from:
//      fn01BF
void fn04B8()
{
	fn0AC9();
	if (true)
		fn04C4();
	else
	{
		fn04DC(&g_b005C);
		fn04C4();
	}
}

byte g_b04BF = 0x00; // 04BF
// 04C4: FlagGroup bool fn04C4()
// Called from:
//      fn04B8
//      fn06B0
bool fn04C4()
{
	fn0AD2();
	byte a_n = 0x00;
	if (false)
		a_n = fn04DC((Fcb *) 0x1778);
	byte a_n = a_n + 0x01;
	byte SZP_n = cond(a_n);
	if (a_n == 0x00)
		return (SZP_n & 0x40) != 0x00;
	if (g_b04CB != 0x00)
	{
		byte e;
		word16 hl;
		fn0B4F(e, hl);
	}
	return (cond(0x01) & 0x40) != 0x00;
}

byte g_b04CB = 0x00; // 04CB
// 04DC: Register uint8 fn04DC(Register (ptr16 Eq_n) de)
// Called from:
//      fn04B8
uint8 fn04DC(Fcb * de)
{
	return F_CLOSE(de) + 0x01;
}

// 04E3: FlagGroup bool fn04E3(Register out byte aOut)
// Called from:
//      fn06B0
//      fn0AB3
bool fn04E3(byte & aOut)
{
	byte a_n;
	fn0AD2();
	Eq_n Z_n = fn04E9((Fcb *) 0x1778, out a_n);
	aOut = a_n;
	return Z_n != 0x00;
}

// 04E9: FlagGroup bool fn04E9(Register (ptr16 Eq_n) de, Register out uint8 aOut)
// Called from:
//      fn0226
//      fn04E3
bool fn04E9(Fcb * de, uint8 & aOut)
{
	uint8 a_n = F_OPEN(de);
	aOut = a_n + 0x01;
	return (cond(a_n + 0x01) & 0x40) != 0x00;
}

// 04EE: Register byte fn04EE(Register (ptr16 byte) de, Register out byte bOut, Register out (ptr16 Eq_n) hlOut, Register out (ptr16 Eq_n) hl'Out)
// Called from:
//      fn0540
//      fn0542
//      fn06B0
//      fn0AB3
//      fn0B4F
byte fn04EE(byte * de, byte & bOut, struct Eq_n & hlOut, struct Eq_n & hl'Out)
{
	F_DMAOFF(de);
	word16 af_n;
	fn04F3(out af_n);
	bOut = <invalid>;
	hlOut = (struct Eq_n *) <invalid>;
	hl'Out = (struct Eq_n *) <invalid>;
	return <invalid>;
}

// 04F3: FlagGroup byte fn04F3(Register out (ptr16 Eq_n) afOut)
// Called from:
//      fn04EE
//      fn06B0
//      fn0A8F
//      fn0CE1
byte fn04F3(struct Eq_n & afOut)
{
	word16 af_n;
	uint8 a_n = C_STAT();
	byte SZ_n = cond(a_n);
	if (a_n != 0x00)
	{
		char a_n = C_READ();
		char a_n = a_n + 0x7F;
		if (a_n == 0x94)
			a_n = C_READ();
		char a_n = a_n + 0x7F;
		if (a_n != 0x03)
		{
			byte SZPC_n = cond(a_n - 11);
			if (a_n != 11)
			{
				afOut = (struct Eq_n *) <invalid>;
				return SZPC_n & 0x40 | SZPC_n & 0x80 | SZPC_n & 0x04 | SZPC_n & 0x01;
			}
		}
		byte SZPC_n = fn021E(out af_n);
		afOut = (struct Eq_n *) <invalid>;
		return SZPC_n & 0x40 | SZPC_n & 0x80 | SZPC_n & 0x04 | SZPC_n & 0x01;
	}
	else
	{
		afOut = (struct Eq_n *) <invalid>;
		byte P;
		return SZ_n & 0x40 | SZ_n & 0x80 | P;
	}
}

// 0514: FlagGroup byte fn0514(Register out byte aOut, Register out byte bOut, Register out word16 deOut, Register out word16 hlOut)
// Called from:
//      fn06B0
byte fn0514(byte & aOut, byte & bOut, word16 & deOut, word16 & hlOut)
{
	word16 af_n;
	word16 bc_n;
	word16 de_n;
	word16 hl_n;
	word16 hl'_33;
	fn0515(out af_n, out bc_n, out de_n, out hl_n, out hl'_33);
	aOut = <invalid>;
	bOut = <invalid>;
	deOut = de_n;
	hlOut = hl_n;
	return <invalid>;
}

// 0515: FlagGroup byte fn0515(Register out (ptr16 Eq_n) afOut, Register out word16 bcOut, Register out word16 deOut, Register out word16 hlOut, Register out (ptr16 Eq_n) hl'Out)
// Called from:
//      fn0514
//      fn06B0
byte fn0515(struct Eq_n & afOut, word16 & bcOut, word16 & deOut, word16 & hlOut, struct Eq_n & hl'Out)
{
	word16 bc;
	byte c_n = (byte) bc;
	byte * hl_n = (byte *) 0x17A7;
	word16 bc_n = SEQ(0x04, c_n);
	byte a_n;
	byte b_n;
	do
	{
		a_n = *hl_n;
		--*hl_n;
		b_n = SLICE(bc_n, byte, 8);
		byte c_n = (byte) bc_n;
		if (a_n != 0x00)
		{
			word16 bc_n;
			word16 de_n;
			word16 hl_n;
			fn0531(out bc_n, out de_n, out hl_n);
			afOut = (struct Eq_n *) <invalid>;
			bcOut = bc_n;
			deOut = de_n;
			hlOut = hl_n;
			hl'Out = (struct Eq_n *) <invalid>;
			byte SZPC_n = <invalid>;
			return SZPC_n & 0x40 | SZPC_n & 0x80 | SZPC_n & 0x04 | SZPC_n & 0x01;
		}
		++hl_n;
		bc_n = SEQ(b_n - 0x01, c_n);
	} while (b_n != 0x01);
	byte b_n;
	byte SZP_n;
	for (b_n = 0x04; b_n != 0x00; --b_n)
	{
		--hl_n;
		*hl_n = a_n;
		SZP_n = cond(hl_n);
	}
	byte C_n = cond(true);
	afOut = (struct Eq_n *) <invalid>;
	bcOut = bc;
	word16 de;
	deOut = de;
	word16 hl;
	hlOut = hl;
	hl'Out = (struct Eq_n *) <invalid>;
	return SZP_n & 0x40 | SZP_n & 0x80 | SZP_n & 0x04 | C_n;
}

// 052E: Register (ptr16 Eq_n) fn052E(Register out byte bOut, Register out (ptr16 byte) deOut, Register out word16 hlOut)
// Called from:
//      CpmCom_Start
//      fn05A3
struct Eq_n * fn052E(byte & bOut, byte & deOut, word16 & hlOut)
{
	word16 bc_n;
	byte * de_n;
	word16 hl_n;
	fn0531(out bc_n, out de_n, out hl_n);
	bOut = <invalid>;
	deOut = de_n;
	hlOut = hl_n;
	return (struct Eq_n *) <invalid>;
}

// 0531: Register (ptr16 Eq_n) fn0531(Register out word16 bcOut, Register out word16 deOut, Register out word16 hlOut)
// Called from:
//      fn0515
//      fn052E
struct Eq_n * fn0531(word16 & bcOut, word16 & deOut, word16 & hlOut)
{
	Eq_n hl_n = *(union Eq_n *) 0x1767;
	byte l_n = (byte) hl_n;
	Eq_n hl_n = SEQ(SLICE(hl_n, byte, 8), l_n + 0x01);
	if (l_n != ~0x00)
	{
		word16 bc_n;
		word16 de_n;
		word16 hl_n;
		fn0538(hl_n, out bc_n, out de_n, out hl_n);
		bcOut = bc_n;
		deOut = de_n;
		hlOut = hl_n;
		return (struct Eq_n *) <invalid>;
	}
	else
	{
		Eq_n hl_n = fn0540();
		word16 bc_n;
		word16 de_n;
		word16 hl_n;
		fn0538(hl_n, out bc_n, out de_n, out hl_n);
		bcOut = bc_n;
		deOut = de_n;
		hlOut = hl_n;
		return (struct Eq_n *) <invalid>;
	}
}

// 0538: Register (ptr16 Eq_n) fn0538(Register Eq_n hl, Register out word16 bcOut, Register out word16 deOut, Register out word16 hlOut)
// Called from:
//      fn052E
//      fn0531
struct Eq_n * fn0538(Eq_n hl, word16 & bcOut, word16 & deOut, word16 & hlOut)
{
	*(union Eq_n *) 0x1767 = hl;
	word16 wArg04;
	bcOut = wArg04;
	word16 wArg02;
	deOut = wArg02;
	word16 wArg00;
	hlOut = wArg00;
	return (struct Eq_n *) <invalid>;
}

// 0540: Register word16 fn0540()
// Called from:
//      fn052E
//      fn0531
word16 fn0540()
{
	byte b_n;
	word16 hl_n;
	word16 hl'_43;
	fn04EE(&g_b0080, out b_n, out hl_n, out hl'_43);
	fn0AC9();
	if (F_READ(&g_b005C) == 0x00)
		return;
	fn0557();
	return;
}

// 0542: void fn0542(Register word16 bc)
// Called from:
//      fn0563
void fn0542(word16 bc)
{
	byte b_n;
	word16 hl_n;
	word16 hl'_46;
	fn04EE(&g_b0080, out b_n, out hl_n, out hl'_46);
	fn0AC9();
	BDOS();
	byte a_n;
	if (a_n == 0x00)
		return;
	fn0557();
}

// 0557: void fn0557()
// Called from:
//      fn0540
//      fn0542
//      fn055D
//      fn0563
void fn0557()
{
	fn021B();
}

// 055D: Register Eq_n fn055D(Register Eq_n hl)
// Called from:
//      CpmCom_Start
Eq_n fn055D(Eq_n hl)
{
	if ((SLICE((word16) hl + 1, byte, 8) | (byte) hl + 0x01) != 0x00)
		return;
	fn0557();
	return;
}

// 0563: void fn0563(Sequence ui16 c_d, Register byte b, Register uint8 e)
// Called from:
//      CpmCom_Start
void fn0563(ui16 c_d, byte b, uint8 e)
{
	if (b != 0x00)
		fn0557();
	else
	{
		ui24 hl_a_n = SEQ(c_d, e) + SEQ(c_d, e);
		Eq_n hl_n = SLICE(hl_a_n, word16, 8);
		cu8 a_n = (byte) hl_a_n;
		byte SZPC_n = cond(hl_n);
		if (hl_n < 0x00)
			fn0557();
		else
		{
			Eq_n a_n;
			a_n.u1 = (word16) *(union Eq_n *) 0x1767 + __rcr<byte,byte>(a_n, 0x01, SZPC_n & 0x01);
			*(union Eq_n *) 0x1767 = a_n;
			Eq_n de_n = hl_n;
			if (a_n < ~0x00)
			{
				if (hl_n == 0x00)
					return;
				de_n = hl_n - 0x01;
			}
			else
				*(union Eq_n *) 0x1767 = (byte) a_n.u0 + 0x0080;
			fn0AC9();
			BDOS();
			cup16 hl_n = (word16) de_n.u1 + g_w007D;
			if (hl_n < 0x00)
				fn0557();
			else
			{
				g_w007D = hl_n;
				word16 bc;
				fn0542(bc);
				++g_b007C;
			}
		}
	}
}

// 05A3: void fn05A3(Register byte a)
// Called from:
//      CpmCom_Start
void fn05A3(byte a)
{
	word16 af;
	a = SLICE(af, byte, 8);
	byte * de_n = (byte *) 0x1799;
	byte b_n = 0x1C;
	if (a == 0x01)
		b_n = 0x18;
	byte * de_n;
	byte b_n;
	while (true)
	{
		*de_n = a;
		de_n = de_n + 1;
		b_n = b_n - 0x01;
		if (b_n == 0x00)
			break;
		struct Eq_n * bc_n = (struct Eq_n *) <invalid>;
		byte b_n;
		word16 hl_n;
		a = SLICE(fn052E(out b_n, out de_n, out hl_n), byte, 8);
		b_n = SLICE(bc_n, byte, 8);
	}
	if (de_n != null)
		return;
	byte * hl_n = (byte *) 0x17A7;
	word16 bc_n = SEQ(b_n, 0x04);
	do
	{
		*de_n = *hl_n;
		++hl_n;
		++de_n;
		--bc_n;
	} while (bc_n != 0x00);
}

// 05C2: FlagGroup bool fn05C2()
// Called from:
//      CpmCom_Start
bool fn05C2()
{
	cu8 * de_n;
	cu8 * de_n = (cu8 *) 0x179A;
	byte * hl_n = (byte *) 0x1779;
	byte * ix_n = (byte *) 5997;
	cu8 b_n;
	for (b_n = 11; b_n != 0x00; --b_n)
	{
		cu8 a_n = *de_n;
		cu8 a_n = a_n + 0x7F;
		byte a_n;
		if (a_n != 0x81)
		{
			de_n = de_n + 1;
			if (a_n < 0xA2 || a_n == 0x00)
				a_n = 0x24;
			a_n = fn0F2F(a_n);
			if (a_n != 0x2E)
				goto l05ED;
			de_n = de_n;
			if (b_n < 0x04)
				continue;
		}
		de_n = de_n;
		a_n = 0x20;
l05ED:
		*hl_n = a_n;
		byte a_n = *ix_n;
		++ix_n;
		if (a_n != 0x3F)
		{
			byte SZPC_n = cond(a_n - *hl_n);
			if (a_n != *hl_n)
				return (SZPC_n & 0x40) != 0x00;
		}
		++hl_n;
	}
	word16 hl_n;
	return fn0F2A(0x00, 0x15, hl_n, out hl_n) != 0x00;
}

// 0602: void fn0602(Register byte b, Stack byte bArg00)
// Called from:
//      CpmCom_Start
void fn0602(byte b, byte bArg00)
{
	word16 wArg00;
	byte a_n;
	fn04AB(out a_n);
	word16 b_a_n = SEQ(b, a_n - 0x01);
	if (a_n == 0x01)
	{
		*(byte *) 0x1753 = a_n - 0x01;
		*(byte *) 0x1752 = a_n - 0x01;
		b_a_n = SEQ(a_n - 0x01, g_b0117);
	}
	byte b_n = SLICE(b_a_n, byte, 8);
	byte a_n = (byte) b_a_n;
	byte a_n = *(byte *) 0x1778;
	if (a_n == 0x00)
	{
		byte a_n = a_n | *((byte *) 0x1753);
		if (a_n == 0x00)
		{
			byte a_n = a_n | a_n;
			bool v26_n = a_n != 0x00;
			if (a_n != 0x00)
				v26_n = fn06A5();
			if (!v26_n)
				return;
			byte * de_n = &g_b011D;
			byte a_n;
			while (true)
			{
				byte b_n = 0x03;
l068C:
				a_n = *de_n;
				if (a_n == 0x00)
					break;
				do
				{
					++de_n;
					if (de_n == null)
					{
						--b_n;
						if (b_n != 0x00)
							goto l068C;
						return;
					}
					--b_n;
				} while (b_n != 0x00);
			}
			*(byte *) 0x1778 = a_n - 0x01;
			return;
		}
		fn0CDE(&g_b1475);
		*(byte *) 0x1778 = ~0x01;
	}
	else
	{
		if (b_n == 0x00)
		{
			fn021B();
			return;
		}
		g_b0CF1 = 0x00;
		g_b1470 = a_n + 0x40;
		fn0CDE(&g_b145B);
		uint8 a_n = DRV_GET();
		if (a_n != a_n - 0x01)
			DRV_SET(a_n);
		uint8 a_n = SLICE(wArg00, byte, 8);
		if (!fn0391())
			DRV_SET(a_n);
	}
	word16 hl_n = fn0214(0x19);
	uint8 l_n = (byte) hl_n;
	byte h_n = SLICE(hl_n, byte, 8);
	uint8 l_n;
	do
	{
		byte * hl_n = SEQ(h_n, l_n);
		byte b_n;
		uint16 c_a_n = (uint16) l_n;
		byte a_n;
		byte c_n;
		for (b_n = 0x08; b_n != 0x00; --b_n)
		{
			uint16 c_a_n = c_a_n >> 0x01;
			if ((byte) c_a_n < 0x00)
				c_a_n = c_a_n ^ 0xA001;
			a_n = (byte) c_a_n;
			c_n = SLICE(c_a_n, byte, 8);
			c_a_n = c_a_n;
		}
		*hl_n = c_n;
		*SEQ(h_n - 0x01, l_n) = a_n;
		l_n = l_n + 0x01;
		l_n = l_n;
	} while (l_n != ~0x00);
}

// 06A5: FlagGroup bool fn06A5()
// Called from:
//      CpmCom_Start
//      fn0602
bool fn06A5()
{
	return fn06A8((byte *) 5997) != 0x00;
}

// 06A8: FlagGroup bool fn06A8(Register (ptr16 byte) hl)
// Called from:
//      fn0226
//      fn06A5
bool fn06A8(byte * hl)
{
	word16 bc_n = 11;
	byte Z_n;
	byte * hl_n;
	do
	{
		Z_n = cond(0x3F - *hl_n);
		hl = hl_n + 1;
		--bc_n;
		if (bc_n == 0x00)
			return Z_n != 0x00;
		hl_n = hl;
	} while (*hl_n != 0x3F);
	return Z_n != 0x00;
}

// 06B0: void fn06B0(Register uint8 f, Register ui16 hl')
// Called from:
//      CpmCom_Start
void fn06B0(uint8 f, ui16 hl')
{
	word16 hl_n;
	word16 de_n;
	word16 bc_n;
	word16 af_n;
	word16 de_n;
	byte * de_n;
	uint16 hl_n;
	byte a_n = *(byte *) 0x1778;
	if (a_n == 0x00)
		return;
	uint8 a_n = *(uint8 *) 0x1799;
	if (a_n >= 0x0A)
	{
		fn021B();
		return;
	}
	cu8 a_n = g_a0A33[(uint16) a_n];
	fn0214(a_n);
	*(cu8 *) 6069 = a_n;
	*(cu8 *) 6070 = g_b0215;
	switch (a_n)
	{
	case ~0x00:
		byte a_n = g_b0118;
		byte a_n = a_n;
		bool v47_n = a_n == 0x00;
		if (a_n == 0x00)
			v47_n = fn04AB(out a_n);
		if (!v47_n)
		{
			cu8 a_n = a_n + a_n;
			if (a_n >= 0x00 && a_n < *((cu8 *) 6070))
				*(cu8 *) 6070 = a_n;
		}
		if (*(byte *) 0x1752 == 0x00)
		{
			byte * hl_n;
			fn0F2A(0x2D, 0x4E, &g_b16AD, out hl_n);
			fn0C67(hl_n);
		}
		break;
	case ~0x01:
	default:
		byte b_n;
		word16 hl_n;
		f = fn04EE((byte *) 6656, out b_n, out hl_n, out hl');
		byte a_n;
		if (!fn04E3(out a_n))
		{
			if (*(byte *) 5993 == 0x00)
			{
				fn0D15(&g_b14C0);
				word16 af_n;
				while (fn04F3(out af_n) & 0x40)
					;
				word16 de_n;
				f = fn0CE1(f, out de_n, out hl');
				if (fn0F2F((byte) de_n) != 0x59)
					return;
			}
			byte a_n;
			fn04E3(out a_n);
		}
		byte a_n;
		if (fn04E3(out a_n))
		{
			fn021B();
			return;
		}
		g_b04CB = a_n;
		break;
	}
	uint8 a_n = *(uint8 *) 0x1799;
	byte * de_n;
	uint16 hl_n;
	Eq_n a;
	if (a_n < 0x04)
	{
		word16 de_n;
		word16 hl_n;
		fn0A2A(out de_n, out hl_n);
		if (a_n != 0x03)
		{
			word16 af_n;
			word16 bc_n;
			word16 hl'_1061;
			while (!(fn0515(out af_n, out bc_n, out de_n, out hl_n, out hl'_1061) & 0x01))
			{
				union Eq_n * de_n;
				word16 hl_n;
				fn0A56(a, de_n, (byte) hl_n, SLICE(hl_n, byte, 8), out de_n, out hl_n);
			}
		}
		else
		{
			word16 af_n;
			word16 bc_n;
			word16 hl'_1058;
			while (fn0515(out af_n, out bc_n, out de_n, out hl_n, out hl'_1058) & 0x01)
			{
				word16 de_n;
				word16 hl_n;
				fn0A3D(a, 0x00, out de_n, out hl_n);
			}
		}
		goto l075C;
	}
	byte * de'_290;
	uint16 hl'_295;
	if (a_n == 0x04)
	{
		fn07E6(0x03FF);
		word16 af_n;
		word16 bc_n;
		word16 de_n;
		word16 hl_n;
		word16 hl'_1067;
		fn0515(out af_n, out bc_n, out de_n, out hl_n, out hl'_1067);
		word16 af_n;
		word16 bc_n;
		word16 de_n;
		word16 hl_n;
		struct Eq_n * hl'_463;
		fn0515(out af_n, out bc_n, out de_n, out hl_n, out hl'_463);
		byte c_n = (byte) bc_n;
		if ((SLICE(af_n, byte, 8) | c_n) != 0x00)
		{
			byte c_n;
			do
			{
				word16 bc_n;
				do
				{
					word16 af_n;
					byte * de_n;
					word16 hl_n;
					fn0515(out af_n, out bc_n, out de_n, out hl_n, out hl'_463);
					*de_n = SLICE(af_n, byte, 8);
					c_n = (byte) bc_n;
				} while (SLICE(bc_n, byte, 8) != 0x01);
				c_n = c_n - 0x01;
			} while (c_n != 0x01);
		}
		uint16 wLoc02_n = hl_n;
		struct Eq_n * bc_n = SEQ(fn0A2A(out de_n, out hl_n), c_n);
l07B6:
		struct Eq_n * bc'_513 = bc_n;
		de'_290 = de_n;
		hl'_295 = hl_n;
		word16 h_a_n = SEQ(SLICE(hl'_463, byte, 8), 0x00);
		byte a_n;
		do
		{
			bcu8 a_n = SLICE(wLoc02_n, byte, 8);
			byte l_n = (byte) h_a_n;
			uint16 af_n = SEQ(a_n >> 0x01, (byte) wLoc02_n);
			bool v60_n = a_n >> 0x01 >= 0x00;
			if (a_n >> 0x01 == 0x00)
			{
				struct Eq_n * af_n = (struct Eq_n *) <invalid>;
				struct Eq_n * bc_n = (struct Eq_n *) <invalid>;
				cu8 a_n = SLICE(af_n, byte, 8);
				byte f_n = (byte) af_n;
				bc'_513 = bc_n;
				byte * de_n;
				de'_290 = de_n;
				uint16 hl_n;
				hl'_295 = hl_n;
				byte a_n;
				byte b_n;
				if (fn0514(out a_n, out b_n, out de_n, out hl_n) & 0x01)
					break;
				cu8 a_n = __rcr<byte,byte>(a_n, 0x01, cond(true));
				l_n = (byte) h_a_n;
				v60_n = a_n >= 0x00;
				af_n = SEQ(a_n, f_n);
			}
			wLoc02_n = af_n;
			byte * hl_n = SEQ(0x1A, l_n);
			if (!v60_n)
				hl_n = SEQ(0x1C, l_n);
			byte h_n = SLICE(hl_n, byte, 8);
			a_n = *hl_n;
			byte b_n = *SEQ(h_n + 0x01, (byte) hl_n);
			if (b_n == ~0x00)
			{
				bc_n = (uint16) fn0A3D(a, SLICE(bc'_513, byte, 8), out de_n, out hl_n);
				hl'_463 = (struct Eq_n *) <invalid>;
				goto l07B6;
			}
			if (b_n != 0x00)
				break;
			h_a_n = SEQ(h_n + 0x01, a_n);
		} while (a_n != 0x00);
l07E2:
		de_n = de'_290;
		hl_n = hl'_295;
l075C:
		fn0A68(de_n);
		if (*(byte *) 0x1778 == ~0x00)
			return;
		if (*(uint16 *) 6063 != hl_n)
			fn0D1E();
		ui16 bc_n = fn0F13((struct Eq_n *) 0x17B1, out de_n);
		byte d_n = <invalid>;
		byte e_n = <invalid>;
		if ((SLICE(bc_n, byte, 8) | (byte) bc_n | d_n | e_n) != 0x00)
			fn0D1E();
		Eq_n Z_n = fn04C4();
		g_b04CB = 0x00;
		if (!Z_n)
			return;
		fn021B();
		return;
	}
	g_b08D3 = 100;
	Eq_n v50_n = a_n == 0x08;
	word16 de_n;
	byte b_n;
	word16 hl_n;
	byte a_n;
	word16 ix_n;
	if (a_n < 0x08)
	{
		de_n = 2555;
		b_n = 0x4F;
		hl_n = 0x0985;
		a_n = 0x55;
		if (a_n == 0x06)
			goto l0845;
		if (a_n >= 0x06)
		{
			hl_n = 0x09B0;
			goto l0845;
		}
	}
	else
	{
		byte a_n;
		if (a_n != 0x08)
		{
			g_b08D3 = 0x6C;
			b_n = 0x5F;
			a_n = 0x20;
		}
		else
		{
			byte SZPC_n = fn0515(out af_n, out bc_n, out de_n, out hl_n, out hl');
			byte a_n = SLICE(af_n, byte, 8);
			v50_n = SZPC_n & 0x40;
			f = (byte) af_n;
			if (!(SZPC_n & 0x01))
			{
				v50_n = a_n == 0x0C;
				if (a_n != 0x0C)
				{
					fn021B();
					return;
				}
			}
			b_n = 0x2F;
			a_n = 0x10;
		}
		g_b08F9 = a_n;
		*(word16 *) 0x17B7 = 0x00;
		de_n = 0x090E;
		hl_n = 2284;
		a_n = 0x09;
		if (v50_n)
		{
l0845:
			ix_n = 2621;
			goto l0849;
		}
	}
	ix_n = 2646;
l0849:
	g_w0A28 = ix_n;
	g_w08DC = hl_n;
	g_w0876 = de_n;
	*(byte *) 0x17B9 = a_n;
	g_b0957 = b_n - 0x03;
	struct Eq_n * bc_n = fn07E6(SEQ(b_n, ~0x00));
	*(struct Eq_n **) 0x17BA = bc_n;
	Eq_n C_n;
	C_n.u0 = false;
	uint16 af_n = (uint16) f;
	byte a_n;
	byte f_n;
	ui16 wLoc02_n;
	do
	{
		uint16 af_n = SEQ(a_n + 0x01, f_n);
		fn08CF((byte) af_n, bc_n - 0x01);
		wLoc02_n = bc_n - 0x01;
		a_n = SLICE(af_n, byte, 8);
		f_n = (byte) af_n;
		af_n = af_n;
	} while (a_n != ~0x00);
	byte * de_n;
	uint16 hl_n;
	fn0A2A(out de_n, out hl_n);
	while (true)
	{
		de'_290 = de_n;
		ui16 hl_n = hl';
		hl'_295 = hl_n;
		byte h_n;
		do
		{
			cpm_warm_boot();
			byte b_n = SLICE(wLoc02_n, byte, 8);
			if (C_n)
				goto l07E2;
			struct Eq_n * de_n = (struct Eq_n *) <invalid>;
			wLoc02_n = hl_n;
			byte e_n;
			struct Eq_n * hl_n;
			C_n = fn0905(hl_n, out e_n, out hl_n);
			byte e_n = (byte) de_n;
			if (b_n == ~0x00)
				break;
			if (hl_n->b0000 == 0x00)
			{
				byte e_n;
				fn0905(wLoc02_n, out e_n, out hl_n);
				struct Eq_n * de_n = (struct Eq_n *) <invalid>;
				e_n = (byte) de_n;
			}
			struct Eq_n * de_n = SEQ(0x01, e_n);
			while (true)
			{
				cu8 a_n = hl_n->b0000;
				byte d_n = SLICE(de_n, byte, 8);
				byte e_n = (byte) de_n;
				C_n = a_n < 0x1A;
				if (a_n < 0x1A)
					break;
				hl_n->b0000 = d_n;
				byte * hl_n = hl_n - 0x01;
				byte a_n = *hl_n;
				*hl_n = e_n;
				de_n = (struct Eq_n *) (hl_n + 1);
				hl_n = SEQ(a_n, a_n);
			}
			fn08CF(f_n, wLoc02_n);
			struct Eq_n * wLoc06_n = de_n;
			struct Eq_n * hl_n = hl_n;
			while (true)
			{
				h_n = SLICE(wLoc06_n, byte, 8);
				ptr16 hl_n = hl_n + 1;
				uint16 hl_n;
				word16 hl'_1081;
				de'_290 = fn0A26(out hl_n, out hl'_1081);
				hl'_295 = hl_n;
				hl_n = SEQ(h_n - 0x01, (byte) wLoc06_n);
				if (h_n == 0x01)
					break;
				byte a_n = wLoc06_n->b0000;
				wLoc06_n->b0000 = SLICE(hl_n - 0x01, byte, 8);
				byte a_n = wLoc06_n->bFFFFFFFF;
				wLoc06_n->bFFFFFFFF = (byte) hl_n - 0x01;
				hl_n = wLoc06_n;
				wLoc06_n = SEQ(a_n, a_n);
			}
		} while (h_n != 0x01);
		de_n = fn0A26(out hl_n, out hl');
	}
}

// 07E6: Register word16 fn07E6(Register word16 bc)
// Called from:
//      fn06B0
word16 fn07E6(word16 bc)
{
	*(byte *) 6656 = 0x00;
	byte * hl_n = (byte *) 6656;
	byte * de_n = (byte *) 0x1A01;
	do
	{
		*de_n = *hl_n;
		++hl_n;
		++de_n;
		--bc;
	} while (bc != 0x00);
	return bc;
}

word16 g_w0876 = 0x00; // 0876
// 08CF: void fn08CF(Register byte a, Register ui16 bc)
// Called from:
//      fn06B0
void fn08CF(byte a, ui16 bc)
{
	struct Eq_n * hl_n = *(struct Eq_n **) 0x17BA;
	if (__bit(SLICE(hl_n, byte, 8), 0x04))
		return;
	*(struct Eq_n **) 0x17BA = (struct Eq_n *) ((char *) &hl_n->w0000 + 1);
	cpm_warm_boot();
	byte e_n;
	word16 hl_n;
	fn0905(bc, out e_n, out hl_n);
	hl_n->w0000 = hl_n;
	word16 af;
	hl_n->b0002 = SLICE(af, byte, 8);
}

byte g_b08D3 = 100; // 08D3
word16 g_w08DC = 0x00; // 08DC
byte g_b08F9 = 0x10; // 08F9
// 0905: FlagGroup bool fn0905(Register ui16 hl, Register out byte eOut, Register out (ptr16 byte) hlOut)
// Called from:
//      fn06B0
//      fn08CF
bool fn0905(ui16 hl, byte & eOut, byte & hlOut)
{
	eOut = <invalid>;
	hlOut = hl * 0x03 + 0x1A01;
	return (cond(hl * 0x03 + 0x1A01) & 0x01) != 0x00;
}

byte g_b0957 = 44; // 0957
// 0A26: Register word16 fn0A26(Register out word16 hlOut, Register out word16 hl'Out)
// Called from:
//      fn06B0
word16 fn0A26(word16 & hlOut, word16 & hl'Out)
{
	cpm_warm_boot();
	word16 hl';
	hlOut = hl';
	word16 hl;
	hl'Out = hl;
	word16 de';
	return de';
}

word16 g_w0A28 = 0x00; // 0A28
// 0A2A: Register byte fn0A2A(Register out word16 deOut, Register out cui16 hlOut)
// Called from:
//      fn06B0
byte fn0A2A(word16 & deOut, cui16 & hlOut)
{
	deOut = SEQ(*(cu8 *) 6069, 0x00);
	hlOut = 0x00;
	return 0x00;
}

cu8 g_a0A33[] = // 0A33
	{
	};
// 0A3D: Register Eq_n fn0A3D(Register Eq_n a, Register Eq_n b, Register out (ptr16 Eq_n) deOut, Register out (ptr16 Eq_n) hlOut)
// Called from:
//      fn06B0
Eq_n fn0A3D(Eq_n a, Eq_n b, struct Eq_n & deOut, struct Eq_n & hlOut)
{
	word16 hl_n;
	word16 de_n;
	word16 hl_n;
	word16 de_n;
	union Eq_n * de;
	byte l;
	byte h;
	if (b != 0x01)
	{
		if (a == 0x90)
		{
			deOut = (struct Eq_n *) <invalid>;
			hlOut = (struct Eq_n *) <invalid>;
			return (byte) b.u0 + 1;
		}
		else
		{
			Eq_n b_n = fn0A56(a, de, l, h, out de_n, out hl_n);
			deOut = (struct Eq_n *) <invalid>;
			hlOut = (struct Eq_n *) <invalid>;
			return b_n;
		}
	}
	else
	{
		Eq_n b_n = a;
		if (a != 0x00)
		{
			Eq_n b_n;
			while (true)
			{
				b_n = b_n - 0x01;
				if (b_n == 0x00)
					break;
				word16 de_n;
				word16 hl_n;
				b_n = fn0A56(a, de, l, h, out de_n, out hl_n);
			}
			deOut = (struct Eq_n *) <invalid>;
			hlOut = (struct Eq_n *) <invalid>;
			return b_n;
		}
		else
		{
			Eq_n b_n = fn0A56(a, de, l, h, out de_n, out hl_n);
			deOut = (struct Eq_n *) <invalid>;
			hlOut = (struct Eq_n *) <invalid>;
			return b_n;
		}
	}
}

// 0A56: Register (ptr16 Eq_n) fn0A56(Register Eq_n a, Register (ptr16 Eq_n) de, Register byte l, Register byte h, Register out (ptr16 byte) deOut, Register out (ptr16 Eq_n) hlOut)
// Called from:
//      fn06B0
//      fn0A3D
struct Eq_n * fn0A56(Eq_n a, union Eq_n * de, byte l, byte h, byte & deOut, struct Eq_n & hlOut)
{
	byte e_n = (byte) de;
	byte d_n = SLICE(de, byte, 8);
	de->u0 = (byte) a;
	byte * de_n = SEQ(d_n, e_n + 0x01);
	if (e_n == ~0x00)
	{
		byte * de_n = SEQ(d_n + 0x01, e_n + 0x01);
		if (*(cu8 *) 6070 == d_n + 0x01)
		{
			deOut = fn0A68(de_n);
			hlOut = (struct Eq_n *) <invalid>;
			return (struct Eq_n *) <invalid>;
		}
		else
		{
			deOut = de_n;
			hlOut = (struct Eq_n *) <invalid>;
			return (struct Eq_n *) <invalid>;
		}
	}
	else
	{
		deOut = de_n;
		hlOut = (struct Eq_n *) <invalid>;
		return (struct Eq_n *) <invalid>;
	}
}

// 0A68: Register (ptr16 byte) fn0A68(Register (ptr16 byte) de)
// Called from:
//      fn06B0
//      fn0A56
byte * fn0A68(byte * de)
{
	byte * hl_n = SEQ(*(cu8 *) 6069, 0x00);
	cup16 hl_n = de - hl_n;
	if (hl_n != 0x00)
	{
		uint16 hl_n = *(uint16 *) 0x17B1 - hl_n - (word16) (hl_n < 0x00);
		*(uint16 *) 0x17B1 = hl_n;
		if (hl_n < 0x00)
			--*(union Eq_n *) 6067;
		byte * bc;
		fn0A8F(bc, de);
	}
	return hl_n;
}

// 0A8F: void fn0A8F(Register (ptr16 byte) bc, Register (ptr16 byte) de)
// Called from:
//      fn0A56
void fn0A8F(byte * bc, byte * de)
{
	byte c_n;
	if (g_b04CB == 0x00)
	{
		if (*(byte *) 0x1753 != 0x00)
			return;
		if (*(byte *) 0x1752 != 0x00)
		{
			byte * hl_n = de;
			byte * bc_n;
			do
			{
				L_WRITE(*hl_n);
				word16 af_n;
				fn04F3(out af_n);
				++hl_n;
				bc = bc_n - 0x01;
				bc_n = bc;
			} while ((SLICE(bc_n - 0x01, byte, 8) | (byte) bc_n - 0x01) != 0x00);
		}
		else
		{
			byte * bc_n;
			do
			{
				cu8 a_n = *de;
				if (a_n == 0x1A)
				{
					fn01BF();
					return;
				}
				if (a_n >= 161 || a_n == 0x8A)
					fn0CA3(a_n + 0x7F);
				else if (a_n >= 0x8A && a_n < 0x8E)
				{
					uint8 f;
					word16 de_n;
					word16 hl'_268;
					fn0CE1(f, out de_n, out hl'_268);
					word16 af_n;
					fn04F3(out af_n);
					++*(byte *) 0x1750;
					de = bc_n;
					byte a_n;
					if (*(byte *) 0x1750 != 0x00 && (g_b0119 == *((byte *) 0x1750) && !fn04AB(out a_n)))
					{
						fn021B();
						return;
					}
				}
				++de;
				bc = bc_n - 0x01;
				bc_n = bc;
			} while ((SLICE(bc_n - 0x01, byte, 8) | (byte) bc_n - 0x01) != 0x00);
		}
	}
	else
	{
		byte * hl_n = de + bc;
		byte b_n;
		byte l_n;
		while (true)
		{
			b_n = SLICE(bc, byte, 8);
			l_n = (byte) hl_n;
			if (l_n == 0x81)
				break;
			*hl_n = 0x1A;
			++bc;
			hl_n = SEQ(SLICE(hl_n + 1, byte, 8), l_n + 0x01);
		}
		byte a_n = l_n + 0x7F | b_n;
		if (a_n != 0x00)
		{
			byte b_n;
			do
			{
				byte * bc_n = SEQ(b_n - 0x01, c_n);
				byte * de_n;
				fn0AB3(de, out de_n);
				b_n = SLICE(bc, byte, 8);
				c_n = (byte) bc;
				a_n = fn0AB3(de_n, out de);
				bc = SEQ(b_n - 0x01, c_n);
				bc = bc_n;
			} while (b_n != 0x01);
		}
		if ((a_n | (byte) bc) == 0x00)
			return;
		word16 de_n;
		fn0AB3(de, out de_n);
	}
}

// 0AB3: Register byte fn0AB3(Register (ptr16 byte) de, Register out word16 deOut)
// Called from:
//      fn0A8F
byte fn0AB3(byte * de, word16 & deOut)
{
	byte b_n;
	word16 hl_n;
	word16 hl'_45;
	fn04EE(de, out b_n, out hl_n, out hl'_45);
	byte a_n;
	fn04E3(out a_n);
	if (a_n != 0x01)
	{
		fn021B();
		deOut = 5352;
		return <invalid>;
	}
	else
	{
		deOut = de + 0x0080;
		return <invalid>;
	}
}

// 0AC9: void fn0AC9()
// Called from:
//      fn0226
//      fn04B8
//      fn0540
//      fn0542
//      fn0563
void fn0AC9()
{
	uint8 a_n = *(uint8 *) 5989;
	F_USERNUM(a_n);
}

// 0AD2: void fn0AD2()
// Called from:
//      fn04B8
//      fn04E3
//      fn0B4F
void fn0AD2()
{
	uint8 a_n = *(uint8 *) 0x1766;
	F_USERNUM(a_n);
}

// 0AE4: void fn0AE4(Register (ptr16 Eq_n) de, Register (ptr16 Eq_n) hl)
// Called from:
//      fn0BFD
void fn0AE4(struct Eq_n * de, struct Eq_n * hl)
{
	cu8 c_n = hl->b0000;
	cu8 b_n = hl->b0001;
	if ((b_n | c_n) == 0x00 || b_n >> 0x01 >= 0x62)
	{
		struct Eq_n * de_n = de;
		byte b_n;
		for (b_n = 0x05; b_n != 0x00; --b_n)
		{
			de_n->b0000 = 0x00;
			++de_n;
		}
	}
	else
	{
		uint8 a_n = (b_n >> 0x01) - 0x14;
		Eq_n C_n = cond(a_n) & 0x01;
		if (a_n < 0x00)
		{
			a_n += 100;
			C_n = cond(a_n + 100) & 0x01;
		}
		de->b0000 = a_n;
		cu8 a_n = __rcl<byte,byte>(c_n, 0x01, cond(__rcr<byte,byte>(b_n, 0x01, C_n)));
		cu8 a_n = __rcl<byte,byte>(a_n, 0x01, cond(a_n));
		cu8 a_n = __rcl<byte,byte>(a_n, 0x01, cond(a_n));
		de[1] = (struct Eq_n) (__rcl<byte,byte>(a_n, 0x01, cond(a_n)) + 0x0F);
		de[2] = (struct Eq_n) (c_n + 0x1F);
		cu8 b_n = hl->b0003;
		cu8 c_n = hl->b0002;
		cu8 a_n = __rcr<byte,byte>(b_n, 0x01, cond(c_n + 0x1F) & 0x01);
		cu8 a_n = __rcr<byte,byte>(a_n, 0x01, cond(a_n));
		de[3] = (struct Eq_n) (__rcr<byte,byte>(a_n, 0x01, cond(a_n)) + 0x1F);
		cu8 c_n = __rcl<byte,byte>(c_n, 0x01, cond(b_n + 0x07) & 0x01);
		cu8 a_n = __rcl<byte,byte>(b_n + 0x07, 0x01, cond(c_n));
		cu8 c_n = __rcl<byte,byte>(c_n, 0x01, cond(a_n));
		cu8 a_n = __rcl<byte,byte>(a_n, 0x01, cond(c_n));
		de[4] = (struct Eq_n) __rcl<byte,byte>(a_n, 0x01, cond(__rcl<byte,byte>(c_n, 0x01, cond(a_n))));
		struct Eq_n * de_n = de;
		byte b_n;
		for (b_n = 0x05; b_n != 0x00; --b_n)
		{
			de_n->b0000 = fn0B3C(de_n->b0000);
			++de_n;
		}
	}
}

// 0B3C: Register uint8 fn0B3C(Register uint8 a)
// Called from:
//      fn0AE4
uint8 fn0B3C(uint8 a)
{
	bui8 b_n = ~0x00;
	do
	{
		++b_n;
		a -= 0x0A;
	} while (a >= 0x00);
	return b_n * 0x10 + (a + 0x0A);
}

// 0B4F: void fn0B4F(Register byte e, Register word16 hl)
// Called from:
//      fn04B8
void fn0B4F(byte e, word16 hl)
{
	word16 de;
	uint8 e_n = (byte) de;
	byte l_n = (byte) hl;
	byte h_n = SLICE(hl, byte, 8);
	if (*(union Eq_n *) 0x17AB == 0x00)
		return;
	DRV_FLUSH(e_n);
	if (l_n != 0x00 && (h_n == 0x53 || h_n == 0x44))
	{
		word16 hl_n;
		fn0F2A(0x00, 0x05, (byte *) 5979, out hl_n);
		byte * hl_n = (byte *) 0x1756;
		byte * de_n = (byte *) 0x1760;
		word16 bc_n;
		for (bc_n = 0x05; bc_n != 0x00; --bc_n)
		{
			*de_n = *hl_n;
			++hl_n;
			++de_n;
		}
		byte b_n;
		word16 hl_n;
		word16 hl'_125;
		fn04EE((byte *) 0x1756, out b_n, out hl_n, out hl'_125);
		fn0AD2();
		*(byte *) 6020 = 0x00;
		*(byte *) 6040 = 0x00;
		struct Eq_n * bc_n = (struct Eq_n *) <invalid>;
		BDOS();
	}
}

// 0BFD: void fn0BFD(Register uint8 f)
// Called from:
//      CpmCom_Start
void fn0BFD(uint8 f)
{
	byte * hl_n;
	byte * hl_n;
	byte * hl_n;
	byte * hl_n;
	Eq_n hl_n = *(union Eq_n *) 5954;
	*(union Eq_n *) 5954 = (word16) hl_n + 1;
	if (hl_n == ~0x00)
		fn0D28();
	fn0F1B((byte *) 0x17A7, (byte *) 0x174A);
	fn0F1B((byte *) 0x17B1, (byte *) 0x1744);
	uint8 f_n = (byte) fn0DC0(fn0D94(fn0D62(fn0EA8(f, (struct Eq_n *) 0x17B1, fn0D4F(0x00, (byte *) 0x1779, &g_b16AD), out hl_n), hl_n, out hl_n), hl_n, out hl_n), (struct Eq_n *) 0x17B1, (struct Eq_n *) 0x17A7, hl_n, out hl_n);
	Eq_n a_n = *(union Eq_n *) 0x17AB;
	Eq_n a_n = a_n;
	byte * hl_n;
	if (a_n == 0x00)
	{
		byte * hl_n = fn0F28(0x12, hl_n);
		word16 hl_n;
		fn0F2A(0x00, 0x0F, (byte *) 0x1756, out hl_n);
		hl_n = hl_n;
	}
	else
	{
		fn0AE4((struct Eq_n *) 0x1756, (struct Eq_n *) 0x17AB);
		byte * hl_n;
		fn0E47(fn0E11(f_n, hl_n, out hl_n), hl_n, out hl_n);
		a_n.u1 = 0x00;
	}
	byte * hl_n = fn0E77(a_n, hl_n);
	fn0C9F(hl_n);
}

// 0C67: void fn0C67(Register (ptr16 byte) hl)
// Called from:
//      fn06B0
void fn0C67(byte * hl)
{
	fn0C9F(hl);
}

// 0C6C: void fn0C6C(Register uint8 f)
// Called from:
//      CpmCom_Start
void fn0C6C(uint8 f)
{
	Eq_n a_n;
	byte * hl_n;
	byte * hl_n;
	byte * hl_n;
	byte * hl_n;
	a_n.u1 = SLICE(fn0DC0(fn0D8D(fn0EA8(fn0E9C(f, *(union Eq_n *) 5954, &g_b16AD, out hl_n), (struct Eq_n *) 0x1744, hl_n, out hl_n), *(union Eq_n *) 0x1748, hl_n, out hl_n), (struct Eq_n *) 0x1744, (struct Eq_n *) 0x174A, fn0F28(0x0D, hl_n), out hl_n), byte, 8);
	byte * hl_n = fn0F28(0x14, hl_n);
	word16 de_n = *(word16 *) 5966;
	byte * hl_n = fn0E87(a_n, SLICE(de_n, byte, 8), (byte) de_n, hl_n);
	fn0C9F(hl_n);
}

// 0C9F: void fn0C9F(Register (ptr16 byte) hl)
// Called from:
//      fn0BFD
//      fn0C67
//      fn0C6C
void fn0C9F(byte * hl)
{
	*hl = 0x00;
	byte * de;
	fn0CDE(de);
}

// 0CA3: void fn0CA3(Register char a)
// Called from:
//      fn0A8F
//      fn0CE1
//      fn0D28
void fn0CA3(char a)
{
	if (a != 0x07)
		fn0CAC(a);
	else
	{
		char a_n = a & g_b011A;
		if (a_n == 0x00)
			return;
		fn0CAC(a_n);
	}
}

// 0CAC: void fn0CAC(Register char a)
// Called from:
//      fn0CA3
//      fn0CB5
void fn0CAC(char a)
{
	C_WRITE(a);
}

// 0CB5: void fn0CB5()
// Called from:
//      fn0226
void fn0CB5()
{
	byte * de_n = g_a1300;
	if (g_a1300[0] == 0x20)
	{
		word16 hl_n;
		byte * hl_n;
		if (!fn0F38(out hl_n))
			hl_n = hl_n + 0x01;
		else
			hl_n = &g_b0F48;
		byte * de_n = g_a1300;
		word16 bc_n;
		for (bc_n = 0x08; bc_n != 0x00; --bc_n)
		{
			*de_n = *hl_n;
			++hl_n;
			++de_n;
		}
		de_n = g_a1300;
	}
	while (true)
	{
		char a_n = *de_n;
		if (a_n == 0x20)
			break;
		fn0CAC(a_n);
		++de_n;
	}
}

// 0CDB: void fn0CDB()
// Called from:
//      CpmCom_Start
void fn0CDB()
{
	uint8 f;
	word16 de_n;
	word16 hl'_11;
	fn0CE1(f, out de_n, out hl'_11);
	byte * de;
	fn0CDE(de);
}

// 0CDE: void fn0CDE(Register (ptr16 byte) de)
// Called from:
//      fn0226
//      fn0602
//      fn0BFD
//      fn0CDB
//      fn0D1E
void fn0CDE(byte * de)
{
	fn0D15(de);
	uint8 f;
	word16 de_n;
	word16 hl'_20;
	fn0CE1(f, out de_n, out hl'_20);
}

// 0CE1: Register uint8 fn0CE1(Register uint8 f, Register out (ptr16 Eq_n) deOut, Register out (ptr16 Eq_n) hl'Out)
// Called from:
//      fn06B0
//      fn0A8F
//      fn0CDB
//      fn0CDE
//      fn0D12
//      fn0D28
uint8 fn0CE1(uint8 f, struct Eq_n & deOut, struct Eq_n & hl'Out)
{
	fn0CA3(0x0D);
	fn0CA3(0x0A);
	--*(ui8 *) 5995;
	if (*(ui8 *) 5995 == 0x00)
	{
		if (false)
		{
			*(ui8 *) 5995 = 0x00;
			fn0D15(&g_b159A);
			word16 af_n;
			while (fn04F3(out af_n) & 0x40)
				;
			fn0D15(&g_b15A3);
			byte a_n = SLICE(af_n, byte, 8);
			uint8 f_n = (byte) af_n;
			if ((a_n ^ 0x20) == 0x00)
			{
				*(ui8 *) 5995 = (a_n ^ 0x20) + 0x01;
				deOut = (struct Eq_n *) <invalid>;
				hl'Out = (struct Eq_n *) <invalid>;
				return f_n;
			}
			else
			{
				deOut = (struct Eq_n *) <invalid>;
				hl'Out = (struct Eq_n *) <invalid>;
				return f_n;
			}
		}
		else
		{
			deOut = (struct Eq_n *) <invalid>;
			hl'Out = (struct Eq_n *) <invalid>;
			return f;
		}
	}
	else
	{
		deOut = (struct Eq_n *) <invalid>;
		hl'Out = (struct Eq_n *) <invalid>;
		return f;
	}
}

ui8 g_b0CF1 = 0x00; // 0CF1
// 0D12: void fn0D12(Register (ptr16 byte) de)
// Called from:
//      fn01FB
//      fn0226
void fn0D12(byte * de)
{
	uint8 f;
	word16 de_n;
	word16 hl'_17;
	fn0CE1(f, out de_n, out hl'_17);
	fn0D15(de);
}

// 0D15: void fn0D15(Register (ptr16 byte) de)
// Called from:
//      fn021E
//      fn0221
//      fn0226
//      fn06B0
//      fn0CDE
//      fn0CE1
//      fn0D12
//      fn0D1E
void fn0D15(byte * de)
{
	if (*de == 0x00)
		;
}

// 0D1E: void fn0D1E()
// Called from:
//      fn06B0
void fn0D1E()
{
	fn0D15(&g_b1565);
	byte * de;
	fn0CDE(de);
}

// 0D28: void fn0D28()
// Called from:
//      fn0BFD
void fn0D28()
{
	byte * de_n = &g_b1607;
	char a_n = g_b1607;
	char a_n;
	do
	{
		if (a_n == 0x3D)
			a_n = 0x20;
		fn0CA3(a_n);
		++de_n;
		a_n = *de_n;
		a_n = a_n;
	} while (a_n != 0x00);
	uint8 f;
	byte * de_n;
	word16 hl'_81;
	fn0CE1(f, out de_n, out hl'_81);
	while (true)
	{
		char a_n = *de_n;
		char a_n = a_n;
		if (a_n == 0x00)
			break;
		if (a_n != 0x20)
			a_n = 0x3D;
		fn0CA3(a_n);
		++de_n;
	}
	word16 de_n;
	word16 hl'_83;
	fn0CE1(f, out de_n, out hl'_83);
}

// 0D4F: Register (ptr16 byte) fn0D4F(Register byte c, Register (ptr16 byte) de, Register (ptr16 byte) hl)
// Called from:
//      fn0226
//      fn0BFD
byte * fn0D4F(byte c, byte * de, byte * hl)
{
	byte b_n;
	for (b_n = 0x0C; b_n != 0x00; --b_n)
	{
		byte a_n = 0x2E;
		if (b_n != 0x04)
		{
			a_n = *de;
			++de;
			if (a_n != c)
				goto l0D5D;
		}
		else
		{
l0D5D:
			*hl = a_n;
			++hl;
		}
	}
	return hl;
}

// 0D62: Register uint8 fn0D62(Register uint8 f, Register (ptr16 byte) hl, Register out ptr16 hlOut)
// Called from:
//      fn0BFD
uint8 fn0D62(uint8 f, byte * hl, ptr16 & hlOut)
{
	byte * hl_n;
	uint16 hl_n = *(uint16 *) 0x17B1;
	cu8 a_n = SLICE(SEQ(*(union Eq_n *) 6067, hl_n) + 0x03FF, byte, 16);
	cu8 a_n = __rcr<byte,byte>(a_n, 0x01, cond(a_n) & 0x01);
	cu8 h_n = __rcr<byte,byte>(SLICE(hl_n + 0x03FF, byte, 8), 0x01, cond(a_n));
	cu8 a_n = __rcr<byte,byte>(a_n, 0x01, cond(h_n));
	cu8 h_n = __rcr<byte,byte>(h_n, 0x01, cond(a_n));
	uint8 a_n = *(uint8 *) 5996;
	word16 hl_n = SEQ(a_n + 0x3F, h_n) + (uint16) (a_n - 0x01);
	Eq_n de_n = SEQ(SLICE(hl_n, byte, 8), 0x01 - a_n - 1 & (byte) hl_n);
	*(union Eq_n *) 0x1748 += de_n;
	uint16 af_n = (uint16) fn0E9C(f, de_n, hl, out hl_n);
	*hl_n = 0x6B;
	hlOut = hl_n + 1;
	return (byte) af_n;
}

// 0D8D: Register uint8 fn0D8D(Register uint8 f, Register Eq_n de, Register (ptr16 byte) hl, Register out ptr16 hlOut)
// Called from:
//      fn0C6C
uint8 fn0D8D(uint8 f, Eq_n de, byte * hl, ptr16 & hlOut)
{
	byte * hl_n;
	uint16 af_n = (uint16) fn0E9C(f, de, hl, out hl_n);
	*hl_n = 0x6B;
	hlOut = hl_n + 1;
	return (byte) af_n;
}

// 0D94: Register uint8 fn0D94(Register uint8 f, Register (ptr16 byte) hl, Register out word16 hlOut)
// Called from:
//      fn0BFD
uint8 fn0D94(uint8 f, byte * hl, word16 & hlOut)
{
	word16 hl_n;
	byte * de_n = fn0F26(hl);
	byte * hl_n = &g_b15D7;
	uint8 a_n = *(uint8 *) 0x1799;
	word16 bc_n = 0x08;
	if (a_n >= 0x03)
	{
		hl_n = &g_b15DF;
		if (true)
		{
			hl_n = &g_b15E7;
			if (a_n != 0x04)
			{
				hl_n = &g_b15EF;
				if (a_n >= 0x09)
				{
					hl_n = &g_b15F7;
					if (true)
						hl_n = &g_b15FF;
				}
			}
		}
	}
	do
	{
		*de_n = *hl_n;
		++hl_n;
		++de_n;
		--bc_n;
	} while (bc_n != 0x00);
	word16 af_n = fn0EA4(a_n, f, 0x03, de_n, out hl_n);
	hlOut = hl_n;
	return (byte) af_n;
}

// 0DBB: Register (ptr16 byte) fn0DBB(Register uint8 a, Register uint8 f, Register (ptr16 byte) hl)
// Called from:
//      fn0E47
byte * fn0DBB(uint8 a, uint8 f, byte * hl)
{
	byte * hl_n;
	fn0EA4(a, f, 0x03, hl, out hl_n);
	return hl_n;
}

// 0DC0: Register word16 fn0DC0(Register uint8 f, Register (ptr16 Eq_n) bc, Register (ptr16 Eq_n) de, Register (ptr16 byte) hl, Register out ptr16 hlOut)
// Called from:
//      fn0BFD
//      fn0C6C
word16 fn0DC0(uint8 f, struct Eq_n * bc, struct Eq_n * de, byte * hl, ptr16 & hlOut)
{
	byte * hl_n;
	ui16 de_n;
	uint16 de_n;
	byte * hl_n;
	uint8 f_n = fn0EA8(f, de, hl, out hl_n);
	ui16 bc_n = fn0F13(de, out de_n);
	ui32 hl_ix_n = (SEQ(bc_n, de_n) + SEQ(bc_n, de_n) + SEQ(bc_n, de_n)) * 0x08 + SEQ(bc_n, de_n);
	ui16 bc_n = fn0F13(bc, out de_n);
	cup16 wLoc04_n = SLICE(hl_ix_n * 0x04, word16, 16);
	uint16 hl_n = (word16) hl_ix_n * 0x04;
	uint8 a_n = SLICE(bc_n, byte, 8) | (byte) bc_n | SLICE(de_n, byte, 8) | (byte) de_n;
	if (a_n != 0x00)
	{
		a_n = 101;
		cup16 hl_n;
		do
		{
			uint16 hl_n = hl_n - de_n;
			hl_n = wLoc04_n - bc_n - (word16) (hl_n < 0x00);
			--a_n;
			wLoc04_n = hl_n;
			hl_n = hl_n;
		} while (hl_n >= 0x00);
	}
	word16 af_n = fn0EA2(a_n, f_n, hl_n, out hl_n);
	*hl_n = 0x25;
	hlOut = hl_n + 1;
	return af_n;
}

// 0E11: Register uint8 fn0E11(Register uint8 f, Register (ptr16 byte) hl, Register out word16 hlOut)
// Called from:
//      fn0BFD
uint8 fn0E11(uint8 f, byte * hl, word16 & hlOut)
{
	word16 hl_n;
	byte * hl_n;
	fn0EA2((word16) *(union Eq_n *) 0x17AB + 31, f, hl, out hl_n);
	*hl_n = 0x20;
	Eq_n hl_n = *(union Eq_n *) 0x17AB;
	cu8 h_n = SLICE(hl_n * 0x08, byte, 8);
	byte * de_n = hl_n + 1;
	uint8 a_n = h_n + 0x0F;
	if (h_n >= ~0x01)
		a_n = 0x00;
	uint16 bc_n = (uint16) a_n;
	byte * hl_n = bc_n * 0x02 + 5552 + bc_n;
	cui16 bc_n;
	for (bc_n = 0x03; bc_n != 0x00; --bc_n)
	{
		*de_n = *hl_n;
		++hl_n;
		++de_n;
	}
	*de_n = 0x20;
	uint8 f_n = (byte) hl_n;
	uint8 a_n = (SLICE(hl_n, byte, 8) >> 0x01) + 0x50;
	word16 af_n = fn0EB8(a_n, f_n, 0x0230, de_n + 1, out hl_n);
	hlOut = hl_n;
	return (byte) af_n;
}

// 0E42: Register (ptr16 byte) fn0E42(Register uint8 a, Register uint8 f, Register (ptr16 byte) hl)
// Called from:
//      fn0E47
byte * fn0E42(uint8 a, uint8 f, byte * hl)
{
	byte * hl_n;
	fn0EB8(a, f, 0x0230, hl, out hl_n);
	return hl_n;
}

// 0E47: Register byte fn0E47(Register uint8 f, Register (ptr16 byte) hl, Register out ptr16 hlOut)
// Called from:
//      fn0BFD
byte fn0E47(uint8 f, byte * hl, ptr16 & hlOut)
{
	byte c;
	Eq_n C;
	ui16 hl_n = *(ui16 *) 6061;
	cu8 a_n = __rcr<byte,byte>(SLICE(hl_n, byte, 8), 0x01, C);
	cu8 a_n = __rcr<byte,byte>(a_n, 0x01, cond(a_n));
	cu8 a_n = __rcr<byte,byte>(a_n, 0x01, cond(a_n));
	uint8 a_n = a_n + 0x1F;
	word16 bc_n = SEQ(0x61, c);
	if (a_n == 225)
	{
l0E5F:
		a_n = 0x0C;
		goto l0E61;
	}
	else
	{
		if (a_n >= ~0x12)
		{
			a_n = a_n + 0x13;
			bc_n = SEQ(0x70, c);
			if (a_n == ~0x12)
				goto l0E5F;
		}
l0E61:
		byte * hl_n = fn0DBB(a_n, f, hl);
		*hl_n = 0x3A;
		byte * hl_n = fn0E42(SLICE(hl_n * 0x08, byte, 8) + 0x3F, (byte) hl_n * 0x08, hl_n + 1);
		*hl_n = SLICE(bc_n, byte, 8);
		hlOut = hl_n + 1;
		return SLICE(bc_n, byte, 8);
	}
}

// 0E77: Register (ptr16 byte) fn0E77(Register Eq_n a, Register (ptr16 byte) hl)
// Called from:
//      fn0BFD
byte * fn0E77(Eq_n a, byte * hl)
{
	byte * hl_n;
	byte * hl_n = fn0F26(hl);
	uint16 de_n = *(uint16 *) 6063;
	*(word16 *) 5966 += de_n;
	ui8 e_n = (byte) de_n;
	Eq_n a_n = fn0E8B(a, SLICE(de_n, byte, 8), hl_n, out hl_n);
	byte * hl_n;
	fn0E8B(a_n, e_n, hl_n, out hl_n);
	return hl_n;
}

// 0E87: Register (ptr16 byte) fn0E87(Register Eq_n a, Register ui8 d, Register ui8 e, Register (ptr16 byte) hl)
// Called from:
//      fn0C6C
byte * fn0E87(Eq_n a, ui8 d, ui8 e, byte * hl)
{
	byte * hl_n;
	Eq_n a_n = fn0E8B(a, d, hl, out hl_n);
	byte * hl_n;
	fn0E8B(a_n, e, hl_n, out hl_n);
	return hl_n;
}

// 0E8B: Register Eq_n fn0E8B(Register Eq_n a, Register ui8 d, Register (ptr16 byte) hl, Register out (ptr16 byte) hlOut)
// Called from:
//      fn0E77
//      fn0E87
Eq_n fn0E8B(Eq_n a, ui8 d, byte * hl, byte & hlOut)
{
	*hl = d;
	ui8 v8_n = *hl;
	*hl = SEQ((word4) v8_n, (word4) a);
	byte * hl_n = fn0E92(SEQ(SLICE(a, word4, 4), SLICE(v8_n, word4, 4)), hl);
	hlOut = fn0E92(d, hl_n);
	Eq_n a_n;
	return a_n;
}

// 0E92: Register (ptr16 byte) fn0E92(Register ui8 a, Register (ptr16 byte) hl)
// Called from:
//      fn0E8B
byte * fn0E92(ui8 a, byte * hl)
{
	cu8 a_n = __daa(a | 0xF0);
	*hl = a_n - 0x1F - (byte) (a_n < 0x60);
	return hl + 1;
}

// 0E9C: Register uint8 fn0E9C(Register uint8 f, Register Eq_n de, Register (ptr16 byte) hl, Register out word16 hlOut)
// Called from:
//      fn0C6C
//      fn0D62
//      fn0D8D
uint8 fn0E9C(uint8 f, Eq_n de, byte * hl, word16 & hlOut)
{
	word16 hl_n;
	uint16 af_n = (uint16) fn0EBB(f, 0x0520, de, hl, out hl_n);
	hlOut = hl_n;
	return (byte) af_n;
}

// 0EA2: Register word16 fn0EA2(Register uint8 a, Register uint8 f, Register (ptr16 byte) hl, Register out word16 hlOut)
// Called from:
//      fn0DC0
//      fn0E11
word16 fn0EA2(uint8 a, uint8 f, byte * hl, word16 & hlOut)
{
	word16 hl_n;
	word16 af_n = fn0EA4(a, f, 0x04, hl, out hl_n);
	hlOut = hl_n;
	return af_n;
}

// 0EA4: Register word16 fn0EA4(Register uint8 a, Register uint8 f, Register byte b, Register (ptr16 byte) hl, Register out word16 hlOut)
// Called from:
//      fn0D94
//      fn0DBB
//      fn0EA2
word16 fn0EA4(uint8 a, uint8 f, byte b, byte * hl, word16 & hlOut)
{
	word16 hl_n;
	cui16 bc_n = SEQ(b, 0x20);
	word16 af_n = fn0EB8(a, f, bc_n, hl, out hl_n);
	hlOut = hl_n;
	return af_n;
}

// 0EA8: Register uint8 fn0EA8(Register uint8 f, Register (ptr16 Eq_n) de, Register (ptr16 byte) hl, Register out word16 hlOut)
// Called from:
//      fn0BFD
//      fn0C6C
//      fn0DC0
uint8 fn0EA8(uint8 f, struct Eq_n * de, byte * hl, word16 & hlOut)
{
	word16 hl_n;
	byte h_n = de->b0003;
	Eq_n de_n;
	de_n.u0 = de->t0000.u0;
	uint16 af_n = SEQ(de->b0002, f);
	uint16 af_n = (uint16) fn0EC0(af_n, h_n, de_n, 0x0920, hl, out hl_n);
	hlOut = hl_n;
	return (byte) af_n;
}

// 0EB8: Register uint16 fn0EB8(Register uint8 a, Register uint8 f, Register cui16 bc, Register (ptr16 byte) hl, Register out word16 hlOut)
// Called from:
//      fn0226
//      fn0D94
//      fn0E11
//      fn0E42
uint16 fn0EB8(uint8 a, uint8 f, cui16 bc, byte * hl, word16 & hlOut)
{
	word16 hl_n;
	Eq_n de_n;
	de_n.u0 = (uint16) a;
	uint16 af_n = (uint16) fn0EBB(f, bc, de_n, hl, out hl_n);
	hlOut = hl_n;
	return af_n;
}

// 0EBB: Register uint8 fn0EBB(Register uint8 f, Register cui16 bc, Register Eq_n de, Register (ptr16 byte) hl, Register out word16 hlOut)
// Called from:
//      CpmCom_Start
//      fn0E9C
//      fn0EB8
uint8 fn0EBB(uint8 f, cui16 bc, Eq_n de, byte * hl, word16 & hlOut)
{
	word16 hl_n;
	uint16 af_n = (uint16) f;
	uint16 af_n = (uint16) fn0EC0(af_n, 0x00, de, bc, hl, out hl_n);
	hlOut = hl_n;
	return (byte) af_n;
}

// 0EC0: Register byte fn0EC0(Register uint16 af, Register byte d, Register Eq_n hl, Register cui16 bc', Register (ptr16 byte) hl', Register out word16 hlOut)
// Called from:
//      fn0EA8
//      fn0EB8
//      fn0EBB
byte fn0EC0(uint16 af, byte d, Eq_n hl, cui16 bc', byte * hl', word16 & hlOut)
{
	word16 hl_n;
	byte a = SLICE(af, byte, 8);
	byte f = (byte) af;
	Eq_n de_n = SEQ(d, a);
	uint16 af_n = (uint16) fn0EC5(f, 0x0A, de_n, hl, bc', hl', out hl_n);
	hlOut = hl_n;
	return (byte) af_n;
}

// 0EC5: Register byte fn0EC5(Register byte f, Register cu8 c, Register Eq_n de, Register Eq_n hl, Register cui16 bc', Register (ptr16 byte) hl', Register out (ptr16 byte) hlOut)
// Called from:
//      fn0EB8
//      fn0EC0
byte fn0EC5(byte f, cu8 c, Eq_n de, Eq_n hl, cui16 bc', byte * hl', byte & hlOut)
{
	Eq_n hl_n;
	Eq_n de_n;
	word16 * fp;
	word16 * sp_n = fp;
	byte b_n;
	byte c_n;
	byte a_n;
	Eq_n C_n;
	byte * hl_n;
	byte a_n;
	do
	{
		byte a_n = fn0EEF(c, de, hl, out de_n, out hl_n);
		b_n = SLICE(bc', byte, 8);
		c_n = (byte) bc';
		a_n = a_n | 0x30;
		C_n.u0 = false;
		hl_n = hl';
		word16 af_n = SEQ(a_n | 0x30, f);
		cui16 bc_n = SEQ(b_n - 0x01, c_n);
		if (b_n == 0x01)
			goto l0ECD;
		sp_n -= 0x02;
		*sp_n = af_n;
		bc' = bc_n;
		de = de_n;
		hl = hl_n;
		a_n = SLICE(hl_n, byte, 8) | (byte) hl_n | SLICE(de_n, byte, 8) | (byte) de_n;
	} while (a_n != 0x00);
	byte b_n = b_n - 0x01;
	hl_n = hl';
	byte a_n = a_n | c_n;
	C_n.u0 = false;
	if (a_n != 0x00)
	{
		do
		{
			*hl_n = a_n;
			++hl_n;
			--b_n;
		} while (b_n != 0x00);
	}
	word16 wLoc02;
	while (true)
	{
		a_n = SLICE(wLoc02, byte, 8);
		if (!C_n)
			break;
l0ECD:
		*hl_n = a_n;
		++hl_n;
	}
	hlOut = hl_n;
	return (byte) wLoc02;
}

// 0EE5: Register byte fn0EE5(Register uint16 bc, Register (ptr16 byte) hl, Register out word16 bcOut, Register out (ptr16 byte) hlOut)
// Called from:
//      fn0226
byte fn0EE5(uint16 bc, byte * hl, word16 & bcOut, byte & hlOut)
{
	byte a_n;
	do
	{
		a_n = *hl;
		++hl;
		--bc;
	} while (a_n == 0x20);
	bcOut = bc + 0x01;
	hlOut = hl - 0x01;
	return a_n;
}

// 0EEF: Register cu8 fn0EEF(Register cu8 c, Register Eq_n de, Register Eq_n hl, Register out Eq_n deOut, Register out Eq_n hlOut)
// Called from:
//      fn0EB8
cu8 fn0EEF(cu8 c, Eq_n de, Eq_n hl, union Eq_n & deOut, union Eq_n & hlOut)
{
	Eq_n hl_n;
	Eq_n de_n;
	word16 hl_n;
	Eq_n de_n;
	if (de == 0x00)
	{
		Eq_n hl_n = fn0EFB(c, hl);
		deOut = de;
		hlOut = hl_n;
		cu8 a_n;
		return a_n;
	}
	else
	{
		cu8 a_n = fn0EF7(0x00, c, de, out de_n, out hl_n);
		cu8 a_n = fn0EF7(a_n, c, de_n, out de_n, out hl_n);
		deOut = de_n;
		hlOut = hl_n;
		return a_n;
	}
}

// 0EF7: Register cu8 fn0EF7(Register cu8 a, Register cu8 c, Register Eq_n de, Register out (ptr16 Eq_n) deOut, Register out Eq_n hlOut)
// Called from:
//      fn0EEF
cu8 fn0EF7(cu8 a, cu8 c, Eq_n de, struct Eq_n & deOut, union Eq_n & hlOut)
{
	if (a != 0x00)
	{
		Eq_n hl_n = fn0F00(a, c, de);
		deOut = (struct Eq_n *) <invalid>;
		hlOut = hl_n;
		cu8 a_n;
		return a_n;
	}
	else
	{
		Eq_n hl_n = fn0EFB(c, de);
		deOut = (struct Eq_n *) <invalid>;
		hlOut = hl_n;
		cu8 a_n;
		return a_n;
	}
}

// 0EFB: Register Eq_n fn0EFB(Register cu8 c, Register Eq_n hl)
// Called from:
//      fn0EEF
//      fn0EF7
Eq_n fn0EFB(cu8 c, Eq_n hl)
{
	cu8 h = SLICE(hl, byte, 8);
	byte l = (byte) hl;
	if (h >= c)
		return fn0F00(0x00, c, hl);
	Eq_n hl_n = SEQ(l, 0x00);
	return fn0F09(h, c, 0x08, hl_n);
}

// 0F00: Register Eq_n fn0F00(Register cu8 a, Register cu8 c, Register Eq_n hl)
// Called from:
//      fn0EF7
//      fn0EFB
Eq_n fn0F00(cu8 a, cu8 c, Eq_n hl)
{
	return fn0F09(a, c, 0x10, hl);
}

// 0F09: Register Eq_n fn0F09(Register cu8 a, Register cu8 c, Register byte b, Register Eq_n hl)
// Called from:
//      fn0EFB
//      fn0F00
Eq_n fn0F09(cu8 a, cu8 c, byte b, Eq_n hl)
{
	do
	{
		hl *= 0x02;
		byte l_n = (byte) hl;
		byte h_n = SLICE(hl, byte, 8);
		a = __rcl<byte,byte>(a, 0x01, cond(hl) & 0x01);
		if (a >= c)
		{
			a -= c;
			hl = SEQ(h_n, l_n + 0x01);
		}
		--b;
	} while (b != 0x00);
	return hl;
}

// 0F13: Register (ptr16 Eq_n) fn0F13(Register (ptr16 Eq_n) hl, Register out (ptr16 Eq_n) deOut)
// Called from:
//      CpmCom_Start
//      fn06B0
//      fn0DC0
struct Eq_n * fn0F13(struct Eq_n * hl, struct Eq_n & deOut)
{
	deOut = (struct Eq_n *) <invalid>;
	return (struct Eq_n *) <invalid>;
}

// 0F1B: void fn0F1B(Register (ptr16 byte) de, Register (ptr16 byte) hl)
// Called from:
//      fn0BFD
void fn0F1B(byte * de, byte * hl)
{
	byte b_n;
	for (b_n = 0x04; b_n != 0x00; --b_n)
	{
		*hl = *de + *hl;
		++hl;
		++de;
	}
}

// 0F26: Register (ptr16 byte) fn0F26(Register (ptr16 byte) hl)
// Called from:
//      fn0D94
//      fn0E77
byte * fn0F26(byte * hl)
{
	byte * hl_n;
	fn0F2A(0x20, 0x02, hl, out hl_n);
	return hl_n;
}

// 0F28: Register (ptr16 byte) fn0F28(Register byte b, Register (ptr16 byte) hl)
// Called from:
//      fn0BFD
//      fn0C6C
byte * fn0F28(byte b, byte * hl)
{
	byte * hl_n;
	fn0F2A(0x20, b, hl, out hl_n);
	return hl_n;
}

// 0F2A: FlagGroup bool fn0F2A(Register byte c, Register byte b, Register (ptr16 byte) hl, Register out (ptr16 byte) hlOut)
// Called from:
//      CpmCom_Start
//      fn05C2
//      fn06B0
//      fn0B4F
//      fn0BFD
//      fn0F26
//      fn0F28
bool fn0F2A(byte c, byte b, byte * hl, byte & hlOut)
{
	byte SZP_n;
	do
	{
		*hl = c;
		++hl;
		SZP_n = cond(hl);
		--b;
	} while (b != 0x00);
	hlOut = hl;
	return (SZP_n & 0x40) != 0x00;
}

// 0F2F: Register cu8 fn0F2F(Register cu8 a)
// Called from:
//      fn05C2
//      fn06B0
cu8 fn0F2F(cu8 a)
{
	if (a < 0x61)
		return a;
	if (a < 0x7B)
		return a + 0xE0;
	return a;
}

// 0F38: FlagGroup bool fn0F38(Register out word16 hlOut)
// Called from:
//      fn0CB5
bool fn0F38(word16 & hlOut)
{
	struct Eq_n * hl_n = g_ptr0109;
	byte a_n = hl_n->b0024;
	byte h_n = hl_n->b0025;
	hlOut = SEQ(h_n, a_n);
	return (cond(h_n | a_n) & 0x40) != 0x00;
}

byte g_b0F48 = 0x55; // 0F48
byte g_b0F89 = 0x20; // 0F89
byte g_b0F9F = 0x7B; // 0F9F
byte g_b0FA6 = 0x7B; // 0FA6
byte g_b1013 = 0x41; // 1013
byte g_b103B = 0x41; // 103B
byte g_b1067 = 0x4F; // 1067
byte g_b1079 = 0x50; // 1079
byte g_b108F = 0x20; // 108F
byte g_b10BA = 0x45; // 10BA
byte g_b1101 = 0x44; // 1101
byte g_b1108 = 0x45; // 1108
byte g_b111A = 0x20; // 111A
byte g_b115B = 0x20; // 115B
byte g_b1194 = 0x20; // 1194
byte g_b119B = 0x20; // 119B
byte g_b11D5 = 0x20; // 11D5
byte g_b11DC = 0x20; // 11DC
byte g_b121A = 0x20; // 121A
byte g_b1252 = 0x20; // 1252
byte g_b1259 = 0x20; // 1259
byte g_b129A = 0x20; // 129A
byte g_a1300[] = // 1300
	{
	};
byte g_b13B8 = 0x30; // 13B8
byte g_b1438 = 0x20; // 1438
byte g_b1449 = 0x41; // 1449
byte g_b144A = 0x30; // 144A
byte g_b144E = 0x46; // 144E
byte g_b145B = 0x20; // 145B
byte g_b1470 = 0x41; // 1470
byte g_b1471 = 0x30; // 1471
byte g_b1475 = 0x20; // 1475
byte g_b14C0 = 0x07; // 14C0
byte g_b1565 = 0x07; // 1565
byte g_b159A = 0x20; // 159A
byte g_b15A3 = 0x0D; // 15A3
byte g_b15D7 = 0x55; // 15D7
byte g_b15DF = 0x20; // 15DF
byte g_b15E7 = 0x53; // 15E7
byte g_b15EF = 0x43; // 15EF
byte g_b15F7 = 0x53; // 15F7
byte g_b15FF = 0x55; // 15FF
char g_b1607 = 'N'; // 1607
char g_a1608[] = // 1608
	{
	};
byte g_b16AD = 0x00; // 16AD
