Below is decompiled assembly code from an MS-DOS program written in C and compiled with the Watcom compiler. Please explain what the functions seem to do and suggest names for the functions.

First, here is the documentation for _nheapwalk and its related functions and structure:

---

int  _heapwalk( struct _heapinfo *entry );
int _nheapwalk( struct _heapinfo *entry );
int _fheapwalk( struct _heapinfo *entry );

struct _heapinfo {
    void __far *_pentry;   /* heap pointer */
    size_t     _size;	   /* heap entry size */
    int        _useflag;   /* heap entry 'in-use' flag */
};
#define _USEDENTRY	0
#define _FREEENTRY	1

The  _heapwalk	function along with _heapchk and _heapset are provided
for debugging heap related problems in programs.

The  _heapwalk	function  walks  through the heap, one entry per call,
returning a pointer to a _heapinfo structure that contains information
on the next heap entry.   The structure is defined in \<malloc.h>.  The
_nheapwalk  function  walks  through the near heap and the  _fheapwalk
function walks through the far heap.

On 16-bit 80x86  systems, the  _heapwalk function is equivalent to the
_nheapwalk function in a small data memory model; and is equivalent to
the _fheapwalk function in a large data memory model.

---

Below is the decompiled assembly:

_nheapwalk
PUSH       EDX
MOV        EDX,dword ptr [DAT_0018d75c]
CALL       __NHeapWalk
POP        EDX
RET

__NHeapWalk
PUSH       EBX
PUSH       ECX
PUSH       EBP
MOV        EBX,EAX
TEST       EDX,EDX
JNZ        LAB_000a2a96
MOV        EAX,0x1
POP        EBP
POP        ECX
POP        EBX
RET
                             LAB_000a2a96
MOV        EAX,dword ptr [EAX]
TEST       EAX,EAX
JNZ        LAB_000a2aa1
LEA        EAX,[EDX + 0x2c]
JMP        LAB_000a2ad1
                             LAB_000a2aa1
MOV        EDX,dword ptr [DAT_0018d75c]
                             LAB_000a2aa7
MOV        ECX,dword ptr [EDX + 0x8]
TEST       ECX,ECX
JZ         LAB_000a2abb
CMP        EDX,EAX
JA         LAB_000a2ab6
CMP        EAX,ECX
JC         LAB_000a2abb
                             LAB_000a2ab6
MOV        EDX,dword ptr [EDX + 0x8]
JMP        LAB_000a2aa7
                             LAB_000a2abb  
MOV        ECX,dword ptr [EAX]
AND        CL,0xfe
ADD        ECX,EAX
CMP        ECX,EAX
JA         LAB_000a2acf
MOV        EAX,0x3
POP        EBP
POP        ECX
POP        EBX
RET
                             LAB_000a2acf
MOV        EAX,ECX
                             LAB_000a2ad1
CMP        dword ptr [EAX],-0x1
JNZ        LAB_000a2afb
MOV        EBP,dword ptr [EDX + 0x8]
TEST       EBP,EBP
JNZ        LAB_000a2af4
MOV        word ptr [EBX + 0x4],0x0
MOV        dword ptr [EBX + 0xa],EBP
MOV        dword ptr [EBX + 0x6],EBP
MOV        EAX,0x4
MOV        dword ptr [EBX],EBP
POP        EBP
POP        ECX
POP        EBX
RET
                             LAB_000a2af4
MOV        EDX,EBP
LEA        EAX,[EBP + 0x2c]
JMP        LAB_000a2ad1
                             LAB_000a2afb
MOV        dword ptr [EBX + 0xa],0x1
MOV        word ptr [EBX + 0x4],DS
MOV        dword ptr [EBX],EAX
MOV        EDX,dword ptr [EAX]
AND        DL,0xfe
MOV        dword ptr [EBX + 0x6],EDX
TEST       byte ptr [EAX],0x1
JZ         LAB_000a2b1b
MOV        dword ptr [EBX + 0xa],0x0
                             LAB_000a2b1b
XOR        EAX,EAX
POP        EBP
POP        ECX
POP        EBX
RET

FUN_000b2efd
PUSH       EBP
MOV        EBP,ESP
PUSH       EBX
SUB        ESP,0x10
MOV        EBX,EAX
TEST       byte ptr [DAT_00188ac4],0x2
JZ         LAB_000b2f16
MOV        EAX,0xffffffff
JMP        LAB_000b2f51
                             LAB_000b2f16
MOV        word ptr [EBP + local_14],0x0
MOV        dword ptr [EBP + local_18],0x0
TEST       EDX,EDX
JNZ        LAB_000b2f2e
                             LAB_000b2f27
MOV        EAX,0x1
JMP        LAB_000b2f51
                             LAB_000b2f2e
LEA        EAX=>local_18,[EBP + -0x14]
CALL       _nheapwalk
TEST       EAX,EAX
JNZ        LAB_000b2f4f
MOV        AX,DS
CMP        EBX,dword ptr [EBP + local_18]
JNZ        LAB_000b2f2e
CMP        AX,word ptr [EBP + local_14]
JNZ        LAB_000b2f2e
CMP        dword ptr [EBP + local_e],0x0
JZ         LAB_000b2f2e
JMP        LAB_000b2f27
                             LAB_000b2f4f
XOR        EAX,EAX
                             LAB_000b2f51
LEA        ESP=>local_8,[EBP + -0x4]
POP        EBX
POP        EBP
RET