Question: I would like to convert this C + + code into NASM assembly code for my Linux VM . Please do it in terms of

I would like to convert this C++ code into NASM assembly code for my Linux VM. Please do it in terms of eax,ebx,ecx,edx, etc. Also please do not use any macros or libraries as I am not allowed to use any.
Here is the C++ code:
#include
#include
int is_palindrome(char * buf, int len);
int main(){
char buf[1024];
int count;
write(1, "Please enter a string:
",23);
count = read(0, buf, 1024);
while (buf[0]!='
'){
count--;
if (is_palindrome(buf, count)){
write(1,"It is a palindrome
",20);
} else {
write(1,"It is NOT a palindrome
",23);
}
write(1, "Please enter a string:
",23);
count = read(0, buf, 1024);
}
return 0;
}
int is_palindrome(char *buf, int len){
int i, j;
for (i =0, j = len -1; i < len/2; i++, j--)
if (buf[i]!= buf[j]) return 0;
return 1;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!