#include "lidia_elf.h"

	.text
	.align 4
	.globl USCORE(DigitDiv)
USCORE(DigitDiv):
	pushl	%ebx
	movl    8(%esp), %ebx
	movl	12(%esp), %edx
	movl	20(%esp),%ecx
	cmpl	%edx, %ecx
	jbe L2
	movl	16(%esp), %eax
	divl	%ecx
	movl	%eax, (%ebx)
	movl	%edx, %eax
	popl	%ebx
	ret
L2:

	movl	%edx, %eax
	xorl	%edx, %edx
        divl	%ecx
        movl	16(%esp), %eax
        divl	%ecx
        movl	%eax, (%ebx)
        movl	%edx, %eax
	popl	%ebx
	ret
