Dividing 512 bit number by 128 bit number in C program



Hi all,
I have a huge problem finding " a mod m " using C program, when m is
128 bit number and a is 512 bit number. Can anybody suggest me a
solution.
Thanks, in advance.

.