memcmp32:
        mov   ecx, ebp
        mov   edx, edi
        sub   edx, 4 * 4
        mov   ebp, edx
        add   edi, 4 * 9
        add   edx, 4 * 8
        mov   [edx], ecx

        mov   ecx, [ebp + 12] ; ecx = size

        mov   eax, [ebp + 4] ; offset1
        mov   ebx, [ebp] ; mem
        add   eax, ebx
        add   eax, ecx
        shl   eax, 2 ; eax = eax * 4
        mov   edi, eax ; edi = &(mem + offset1 + size)
        add   edi, esi

        mov   edx, [ebp + 8] ; offset2
        add   ebx, edx ; mem
        add   ebx, ecx
        shl   ebx, 2 ; ebx = ebx * 4
        mov   edx, ebx ; edx = &(mem + offset2 + size)
        add   edx, esi

memcmp32_loop:
        mov   eax, [edi]
        mov   ebx, [edx]
        cmp   eax, ebx 
        jg    memcmp32_negone
        jl    memcmp32_one
        sub   edi, 4
        sub   edx, 4
        dec   ecx
        jge   memcmp32_loop

        ; the memory is equal

        xor   eax, eax
        jmp   memcmp32_return

memcmp32_negone:
        mov   eax, 1
        neg   eax
        jmp   memcmp32_return

memcmp32_one:
        mov   eax, 1

memcmp32_return:
; memcmp32 RETURN 1
; (stack-set-n 0)
        mov   [ebp], eax
; = OPERATOR 0

; (function-end 8)
        mov   ecx, ebp
        mov   edi, ecx
        add   edi, 4
        add   ecx, 4 * 8
        mov   ebp, [ecx]
; (return)
        ret   
