Reduced it to its absolute minimum
CallDef: void on_dmain_vpan( void ):
;
and it still throws an illegal memory access.
The disassembly:
DASM on_dmain_vpan
( 00F4519B E8D2BF4CFF ) CALL 00411172
( 00F451A0 C851F400 ) ENTER F451, 00
( 00F451A4 0000 ) ADD 0 [RAX], AL
( 00F451A6 0000 ) ADD 0 [RAX], AL
( 00F451A8 EF ) OUT DX, EAX
( 00F451A9 CDAB ) INT AB
( 00F451AB 896745 ) MOV [RDI+45], ESP
( 00F451AE 2301 ) AND EAX, 0 [RCX]
( 00F451B0 50 ) PUSH RAX
( 00F451B1 51 ) PUSH RCX
( 00F451B2 F4 ) HLT
( 00F451B3 0000 ) ADD 0 [RAX], AL
( 00F451B5 0000 ) ADD 0 [RAX], AL
( 00F451B7 00E8 ) ADD AL, BPL
( 00F451B9 51 ) PUSH RCX
( 00F451BA F4 ) HLT
( 00F451BB 0000 ) ADD 0 [RAX], AL
( 00F451BD 0000 ) ADD 0 [RAX], AL
( 00F451BF 004051 ) ADD [RAX+51], AL
( 00F451C2 F4 ) HLT
( 00F451C3 0000 ) ADD 0 [RAX], AL
( 00F451C5 0000 ) ADD 0 [RAX], AL
( 00F451C7 00E8 ) ADD AL, BPL
( 00F451C9 83FFFF ) CMP EDI, # -01
( 00F451CC FFE8 ) JMP RAX
( 00F451CE 16 ) PUSH SS
( 00F451CF 0000 ) ADD 0 [RAX], AL
( 00F451D1 00E8 ) ADD AL, BPL
( 00F451D3 69FFFFFFC300 ) IMUL EDI, EDI, # 00C3FFFF
( 00F451D9 0000 ) ADD 0 [RAX], AL
( 00F451DB 0000 ) ADD 0 [RAX], AL
( 00F451DD 0000 ) ADD 0 [RAX], AL
( 00F451DF 0000 ) ADD 0 [RAX], AL
( 00F451E1 0000 ) ADD 0 [RAX], AL
( 00F451E3 0000 ) ADD 0 [RAX], AL
( 00F451E5 0000 ) ADD 0 [RAX], AL
( 00F451E7 00E8 ) ADD AL, BPL
( 00F451E9 53 ) PUSH RBX
( 00F451EA 8C4DFF ) MOV [RBP+-01], CS
( 00F451ED C3 ) RET/NEXT
( 83 bytes, 40 instructions )