Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q1:Convert the following C codes to equivalent IA-64 assembly codes as per the GCC conventions.: a) If else if else : int compare(int a, int

Q1:Convert the following C codes to equivalent IA-64 assembly codes as per the GCC conventions.: a) If else if else : int compare(int a, int *b, int c) { if (a > *b) return 1; else if (a < *b) if (c != a) return 0; else if (c > *b) return -1; else return 0; else return -1;}

=== b) Assume the functions get(), test(), and set() are already defined. char ch1, ch2; // assume their values are taken from user input switch (ch1) { case s: set(ch1); case t: ch2 = get(ch1); switch(ch2) { case 0: test(0); break; default: test(1); } break;}

====

c) Assume given a matrix A with number of rows N = 5 and number of columns M = 4. int i, j, product = 1; for (i=0; i

=== d) Factorial numbers int factorial(int n) { if (n == 1) return 1; else return n * factorial (n-1);}

____________________________

( convert these code from c to assembly ) in simply assembly like this example: pushl %rbp movl %rsp, %rbp subl $4, %rsp movl $0, -4(%rbp)

.L2: movl -4(%rbp), %rax cmpl 8(%rbp), %rax jl .L5 jmp .L3

.L5: decl 8(%rbp) movl 12(%rbp), %rdx leal -4(%rbp), %rax addl %rdx, (%rax) jmp .L2

.L3: movl 8(%rbp), %rax leave ret

and stuff pls help

(in computer system language) ASSEMBLY

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions