Basic Assembly Language HW assignemtn

Job ID: 33457535

Budget: $80 – $130 USD

The instructions are below:
Take the assembly code for the unrolled add function and modify it to satisfy the following:
Use adcl to add the elements of the array. By using adcl, you can use the carry flag instead of representing the carry using a separate variable. Note: The add function must still work correctly.
Put the value of the carry flag into the %eax register before the function returns.
Do not use any jumps or branches or calls at all in the code. That is, you should get rid of all the branches (e.g. ja, jbe, etc.) in the original assembly file and don't put in any new branches. (ret is technically a branch but you must leave that in so that the function can return.) Why this requirement? Because if you do the assignment the right way, there won't be any need for branches; so if you have branches, then you know you're not doing it right.
Call your new assembly file add-adcl.S.
Hints
Make sure to use addl instead of adcl just for the first addition (i.e. A[0] + B[0]) since there is no carry-in to this addition.
To put the value of the carry flag into %eax without using branches, you can do this: set %eax equal to zero, then add %eax to itself using the adcl instruction. It will add the carry flag to 0 + 0, so %eax will be 1 if and only if the carry flag is 1, or 0 otherwise.
You will have to understand (more or less) the assembly code for the unrolled add function, then rewrite a large part of it using adcl and some movl instructions to accomplish the same task.
Make sure you understand which instructions modify the carry flag and which don't. For example, movl and leal don't modify the carry flag, but xorl, addl, and adcl do.
Understanding adcl is important, but you also need to understand how to work with arrays of integers in assembly to get this done. You will need to use movl with addressing modes to load and store values to and from the memory that the three arrays occupy.