Explain the following code line by line using comments.
#include "stdio.h" #include //using std::cout; //using std::endl; char main(void) { char temp; char r1, r2; short int r; printf(" LAB_No_03_Data_Movement_between General_Purpose_Registers "); // Lab number and lab name here printf(" Module: Embedding and in-line assembly language module into a C program "); printf(" Md Arifuzzaman, ID# 23355869 "); // Student's name here printf(" CET3510-E205 "); // Student's Class here printf(" Submission date: February 6, 2019 "); // Date of the Student's program when submitted here printf(" Due date: February 13, 2019 "); // Date of the Student's program due date printf(" Example 3.1 SwapBytes.cpp "); // Student's file name for the program here printf(" file name: SwapBytes.cpp "); // Student's file name for the program here printf("----------------------------------------- "); _asm { MOV BL, 'a'; MOV BH, 'A'; MOV r1, BL; MOV r2, BH; MOV r, CX; } std::cout << "===================================" << std::endl; std::cout << "Before swapping data" << std::endl; printf("BH = %c, BL= %c, CX = %c%c ", r2, r1, r2, r1); printf("BH = 0x%x, BL = 0x%x, CX = 0x%x ", r2, r1, r); _asm { MOV temp, BH; MOV BH, BL; MOV BL, temp MOV r1, BL; MOV r2, BH; MOV r, CX; } std::cout << "===================================" << std::endl; std::cout << "After swapping data" << std::endl; printf("BH = %c, BL= %c, CX = %c%c ", r2, r1, r2, r1); printf("BH = 0x%x, BL = 0x%x, CX = 0x%x ", r2, r1, r); /******************************************************/ _asm { MOV AL, 'b'; MOV AH, 'B'; MOV r1, AL; MOV r2, AH; MOV r, DX; } std::cout << "===================================" << std::endl; std::cout << "Before swapping data" << std::endl; printf("AH = %c, AL= %c, DX = %c%c ", r2, r1, r2, r1); printf("AH = 0x%x, AL = 0x%x, DX = 0x%x ", r2, r1, r); _asm { MOV AL, 'b'; MOV AH, 'B'; MOV temp, AH; MOV AH, AL; MOV AL, temp; MOV r1, AL; MOV r2, AH; MOV r, DX; } std::cout << "===================================" << std::endl; std::cout << "After swapping data" << std::endl; printf("AH = %c, AL= %c, DX = %c%c ", r2, r1, r2, r1); printf("AH = 0x%x, AL = 0x%x, DX = 0x%x ", r2, r1, r); system("pause"); exit(0); return 0; }