The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Here are some sample functions that work with complex data and that call some of the associated library functions.
#include <complex.h>
double c_imag(double complex x) {
return cimag(x);
}
double complex c_sub(double complex x, double complex y) {
return x - y;
}
When compiled, GCC generates the following assembly code for these functions:
double c_imag(double complex)
c_imag:
movapd %xmm1, %xmm0
ret
double c_real(double complex x)
c_real:
rep; ret
double complex c_sub(double complex x, double complex y)
c_sub:
subsd %xmm2, %xmm0
subsd %xmm3, %xmm1
ret
Based on these examples, determine the following:
A. How are complex arguments passed to  a function?
B. How are complex values returned from a function?
-----------