Convert the following C program to inline assembly
int main(){
int i;
printf("Hex Dec Oct Ch\n");
for (i = 32; i < 256; i++){
printf("%2x %3d %3o %c\n",i,i,i,i);
}
return 0;
}
the code below shows where to do the assembly at:
int main(){
int i = 0;
char *hdr = "Hex Dec Oct Ch\n";
char *msg = " %2x %3d %3o %c\n";
printf("%s\n",hdr);
———asm{
// DO ASSEMBLY HERE
}
system("pause");
}
.LC0:
.string "Hex Dec Oct Ch"
.LC1:
.string "%2x %3d %3o %c\n"
main:
push rbp
mov rbp, rsp
sub rsp, 16
mov edi, OFFSET FLAT:.LC0
call puts
mov DWORD PTR [rbp-4], 32
jmp .L2
.L3:
mov esi, DWORD PTR [rbp-4]
mov ecx, DWORD PTR [rbp-4]
mov edx, DWORD PTR [rbp-4]
mov eax, DWORD PTR [rbp-4]
mov r8d, esi
mov esi, eax
mov edi, OFFSET FLAT:.LC1
mov eax, 0
call printf
add DWORD PTR [rbp-4], 1
.L2:
cmp DWORD PTR [rbp-4], 255
jle .L3
mov eax, 0
leave
ret
Get Answers For Free
Most questions answered within 1 hours.