Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C code: int getNumOfDaysInMonth(int mon, int year) { if (mon == 2) if ( (year % 400 == 0) || ((year % 4 == 0)

C code:

int getNumOfDaysInMonth(int mon, int year) {

if (mon == 2) if ( (year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) return 29; else return 28;

else if (mon == 4 || mon == 6 || mon == 9 || mon == 11) return 30;

else if (mon == 1 || mon==3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12) return 31; return 0; }

x86 assembly

.global getNumOfDaysInMonth

.data #TODO: Put strings here

.text

getNumOfDaysInMonth: 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. Please 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions

Question

If f(x) = 2x + In x, find f1(2).

Answered: 1 week ago

Question

Give an example of hierarchical planning in an organization.

Answered: 1 week ago

Question

2. What is the impact of information systems on organizations?

Answered: 1 week ago

Question

Evaluate the impact of technology on HR employee services.

Answered: 1 week ago