Let's assign the two numbers that we want to multiply to two integer variables, var1 and var2. Thereafter, we will load the contents of the var1 variable into the eax register and the contents of the var2 variable into the ebx register. We will multiply the contents of the eax and ebx registers and store the result in the eax register.
The content of the eax register is assigned to the multi variable. The content in this variable, which contains the multiplication of two variables, is displayed on the screen.
Let's use GCC to compile the multiasm.c program as follows:
D:\CBook>gcc multiasm.c -o multiasm
If you get no errors or warnings, that means the multiasm.c program has compiled into an executable file, multiasm.exe. Let's run this executable file as follows:
D:\CBook>multiasm
Multiplication = 200
Voilà! We've successfully multiplied two numbers using the inline assembly language in C. Now, let's move on to the next recipe!