        ; FILE "call3.c"
extern foo, printf

        SECTION .rodata
_LC0: db "y.part1 = %d, y.part2 = %d", 10, 0

        SECTION .text
GLOBAL proc
proc: 
        push    ebp                 ; set up stack frame
        mov     ebp,esp
        sub     esp,40

        lea     eax, [ebp-24]       ; eax = address of temp location
        mov     [esp],eax           ; push temp address
        call    foo                 ;
        sub     esp,4               ; fix stack pointer after "ret 4"
        mov     eax, [ebp-24]       ; store temp return value in y
        mov     edx, [ebp-20]       ;     4 bytes at a time
        mov     [ebp-8],eax         ;     using EAX and EDX
        mov     [ebp-4],edx
        mov     eax, [ebp-4]        ; move y onto the stack
        mov     edx, [ebp-8]        ;     4 bytes at a time
        mov     [esp+8],eax         ;     using EAX and EDX
        mov     [esp+4],edx
        mov     [esp], dword _LC0   ; control string
        call    printf

        leave                       ; take down stack frame
        ret

        
GLOBAL main
main: 
        lea     ecx, [esp+4]
        and     esp,-16
        push    dword [ecx-4]
        push    ebp
        mov     ebp,esp
        push    ecx
        sub     esp,4
        call    proc
        add     esp,4
        pop     ecx
        pop     ebp
        lea     esp, [ecx-4]
        ret

