Just decrement both in a loop until one of them gets to be zero. The other is obviously the result.
inc a
inc b ; make sure input is not zero
loop:
dec a
jnz skip
dec b
mov eax, b ; return b as answer
ret
skip:
dec b
jnz loop
mov eax, a ; return a as answer
ret