global asm_gcd

; uint32_t asm_gcd(uint32_t a, uint32_t b)
asm_gcd:
        push ebp
        mov ebp, esp

        mov eax, [ebp+8]        ; eax = a
        mov edx, [ebp+12]

.loop:
        cmp eax, edx
        jle .eloop
        xchg eax, edx
.eloop:
        sub edx, eax
        test eax, eax
        jnz .loop

.end:
        xchg eax, edx

        leave
        ret