I don't know if this is the correct place to post this, but here goes...
I am trying to get this program:
Code:
#include <stdio.h>
int main() {
int A[4]={1,2,3,4};
int B[4]={4,3,2,1};
int dot;
dot=A[0]*B[0]+A[1]*B[1]+A[2]*B[2]+A[3]*B[3];
printf("%d", dot);
}
to y86. This is what I have:
Code:
.pos 0
.LC0:
.string "%d\n"
.text
.globl main
.type main, @function
main:
pushl %ebp
rrmovl %esp, %ebp
andl $-16, %esp
pushl %ebx
subl $76, %esp
irmovl $1, 44(%esp)
irmovl $2, 48(%esp)
irmovl $3, 52(%esp)
irmovl $4, 56(%esp)
irmovl $4, 28(%esp)
irmovl $3, 32(%esp)
irmovl $2, 36(%esp)
irmovl $1, 40(%esp)
mrmovl 44(%esp), %edx
mrmovl 28(%esp), %eax
imull %eax, %edx
mrmovl 48(%esp), %ecx
mrmovl 32(%esp), %eax
imull %ecx, %eax
leal (%edx,%eax), %ebx
mrmovl 56(%esp), %edx
mrmovl 40(%esp), %eax
imull %eax, %edx
mrmovl 52(%esp), %ecx
mrmovl 36(%esp), %eax
imull %ecx, %eax
leal (%edx,%eax), %eax
leal (%ebx,%eax), %eax
rmmovl %eax, 60(%esp)
irmovl $.LC0, %eax
mrmovl 60(%esp), %edx
rmmovl %edx, 4(%esp)
rmmovl %eax, (%esp)
call printf
addl $76, %esp
popl %ebx
rrmovl %ebp, %esp
popl %ebp
ret
.pos 0x100
Stack:
But I am getting missing colon errors on my simulator. There aren't colons in y86 other than the loops, any suggestions?