Question
C code: void printDays(int mon, int year) {// declare dayOfWeeek, set to call getFirstDayOfMonth int dayOfWeek = getFirstDayOfMonth(mon,year); // for 0 to dayOfWeek: // print
C code:
void printDays(int mon, int year) {// declare dayOfWeeek, set to call getFirstDayOfMonth int dayOfWeek = getFirstDayOfMonth(mon,year); // for 0 to dayOfWeek: // print 3 spaces
int i; for (i = 0; i < dayOfWeek; ++i) { printf(" "); } // declare daysInMonth, set to call GetNumOfDaysInMonth int daysInMonth = getNumOfDaysInMonth(mon, year);
// for 1 to daysInMonth: // print the number of the day for (i = 1; i <= daysInMonth; ++i) { /* code */ printf(" %2d",i);
if ((i + dayOfWeek) % 7 == 0) printf(" "); } printf(" ");
}
x86 assembly
.global printDays
.data #TODO: Put strings here
.text
printDays: push %rbx # TODO: complete
pop %rbx ret
Registers
%rip Instruction pointer
%rsp Stack pointer
%rax Return value
%rdi 1st argument
%rsi 2nd argument
%rdx 3rd argument
%rcx 4th argument
%r8 5th argument
%r9 6th argument
%r10,%r11 Callee-owned
%rbx,%rbp,
%r12-%15 Caller-owned
Please follow the guidelines thoroughly and convert the C code into a x86 assembly language by following the #TODO. Focus on the TODO and use the provided method, register and implementation. Please do not give me the .S file which is derived directly from the command line.Need help. Thanks,
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started