I will provide you disassembly from a computer game that runs in MS-DOS. The game was written in C with a Watcom compiler. Some library function calls are already identified. Explain the functions I give to you and suggest names and C-language function signatures for them, including which parameters map to which registers or stack values. Also suggest names for global values (variables beginning with "DAT").

The values for the global values at the start of program execution (not necessarily at the time FUN_0012b136 is called) are as follows:
DAT_0012ac04 = A0h
DAT_0012af36 = 13Fh
DAT_0012af3a = C7h
DAT_0012ac06 = 64h
All others = 0h

Note that DAT_0000046c refers to the four bytes of memory at 0x46C. These bytes stored as two 2-byte words provide the master clock count.

FUN_0012b136
PUSHAD
CALL FUN_0012b196
MOV AX,[DAT_0012ac04]
CMP AX,word ptr [DAT_0012af34]
JGE LAB_0012b153
MOV AX,[DAT_0012af34]
JMP LAB_0012b162
LAB_0012b153
CMP AX,word ptr [DAT_0012af36]
JLE LAB_0012b162
MOV AX,[DAT_0012af36]
LAB_0012b162
MOV [DAT_0012ac04],AX
MOV AX,[DAT_0012ac06]
CMP AX,word ptr [DAT_0012af38]
JGE LAB_0012b17f
MOV AX,[DAT_0012af38]
JMP LAB_0012b18e
LAB_0012b17f
CMP AX,word ptr [DAT_0012af3a]
JLE LAB_0012b18e
MOV AX,[DAT_0012af3a]
LAB_0012b18e
MOV [DAT_0012ac06],AX
POPAD
RET

FUN_0012b196
PUSH DS
POP FS
MOV AL,[DAT_0012ac00]
MOV [DAT_0012ac01],AL
MOV EAX,0x3
INT 0x33
MOV byte ptr [DAT_0012ac00],BL
MOV word ptr [DAT_0012ac04],CX
MOV word ptr [DAT_0012ac06],DX
MOV word ptr [DAT_0012ac02],0x0
MOV EDX,0x46c
MOV EDX=>DAT_0000046c,dword ptr [EDX]
MOV AL,[DAT_0012ac00]
MOV AH,byte ptr [DAT_0012ac01]
AND AX,0x101
CMP AX,0x1
JNZ LAB_0012b250
NOP
NOP
NOP
NOP
MOV EAX,EDX
SUB EAX,dword ptr [DAT_0012af24]
OR EAX,EAX
JNS LAB_0012b1f5
NEG EAX
LAB_0012b1f5
CMP EAX,0x8
JGE LAB_0012b232
MOV AX,[DAT_0012af28]
SUB AX,word ptr [DAT_0012ac04]
JNS LAB_0012b20c
NEG AX
LAB_0012b20c
CMP AX,0x4
JGE LAB_0012b232
MOV AX,[DAT_0012af2a]
SUB AX,word ptr [DAT_0012ac06]
JNS LAB_0012b224
NEG AX
LAB_0012b224
CMP AX,0x4
JGE LAB_0012b232
word ptr [DAT_0012ac02],0x1
LAB_0012b232
MOV dword ptr [DAT_0012af24],EDX
MOV AX,[DAT_0012ac04]
MOV [DAT_0012af28],AX
MOV AX,[DAT_0012ac06]
MOV [DAT_0012af2a],AX
LAB_0012b250
MOV AL,[DAT_0012ac00]
MOV AH,byte ptr [DAT_0012ac01]
AND AX,0x202
CMP AX,0x2
JNZ LAB_0012b2d2
NOP
NOP
NOP
NOP
MOV EAX,EDX
SUB EAX,dword ptr [DAT_0012af2c]
OR EAX,EAX
JNS LAB_0012b277
NEG EAX
LAB_0012b277
CMP EAX,0x8
JGE LAB_0012b2b4
MOV AX,[DAT_0012af30]
SUB AX,word ptr [DAT_0012ac04]
JNS LAB_0012b28e
NEG AX
LAB_0012b28e
CMP AX,0x4
JGE LAB_0012b2b4
MOV AX,[DAT_0012af32]
SUB AX,word ptr [DAT_0012ac06]
JNS LAB_0012b2a6
NEG AX
LAB_0012b2a6
CMP AX,0x4
JGE LAB_0012b2b4
OR word ptr [DAT_0012ac02],0x2
LAB_0012b2b4
MOV dword ptr [DAT_0012af2c],EDX
MOV AX,[DAT_0012ac04]
MOV [DAT_0012af30],AX
MOV AX,[DAT_0012ac06]
MOV [DAT_0012af32],AX
LAB_0012b2d2
RET