SlideShare a Scribd company logo
1 of 2
In the following code, A and B are constants defined with #define:
1 typedef struct {
2 int x[A][B]; /* Unknown constants A and B */
3 long y;
4 } str1;
5
6 typedef struct {
7 char array[B];
8 int t;
9 short s[A];
10 long u;
11 } str2;
12
13 void setVal(str1 *p, str2 *q) {
14 long v1 = q-<t;
15 long v2 = q-<u;
16 p-<y = v1+v2;
17 }
gcc generates the following code for setVal:
void setVal(str1 *p, str2 *q) p in %rdi, q in %rsi
1 setVal:
2 movslq 8(%rsi), %rax
3 addq 32(%rsi), %rax
4 movq %rax, 184(%rdi)
5 ret
What are the values of A and B?
Solution
The answer is: A = 9, B = 5

More Related Content

More from rtodd972

More from rtodd972 (18)

In what way (or ways) is the current Knowledge Revolution a child of t.docx
In what way (or ways) is the current Knowledge Revolution a child of t.docxIn what way (or ways) is the current Knowledge Revolution a child of t.docx
In what way (or ways) is the current Knowledge Revolution a child of t.docx
 
In the Lewis structures listed below- M and X represent various elemen.docx
In the Lewis structures listed below- M and X represent various elemen.docxIn the Lewis structures listed below- M and X represent various elemen.docx
In the Lewis structures listed below- M and X represent various elemen.docx
 
In the independent data marts architecture- the independent data marts.docx
In the independent data marts architecture- the independent data marts.docxIn the independent data marts architecture- the independent data marts.docx
In the independent data marts architecture- the independent data marts.docx
 
iron (III) chloride + sodium thiosulfate - write the half reactions an.docx
iron (III) chloride + sodium thiosulfate - write the half reactions an.docxiron (III) chloride + sodium thiosulfate - write the half reactions an.docx
iron (III) chloride + sodium thiosulfate - write the half reactions an.docx
 
It has been said that the advantage that leading-edge retailers such a.docx
It has been said that the advantage that leading-edge retailers such a.docxIt has been said that the advantage that leading-edge retailers such a.docx
It has been said that the advantage that leading-edge retailers such a.docx
 
ISP who has allowed them the use of 4 externally routable IP addresses.docx
ISP who has allowed them the use of 4 externally routable IP addresses.docxISP who has allowed them the use of 4 externally routable IP addresses.docx
ISP who has allowed them the use of 4 externally routable IP addresses.docx
 
Is TOD a input or output-- Is this correct--- Inputs- start- stop- fl.docx
Is TOD a input or output--  Is this correct--- Inputs- start- stop- fl.docxIs TOD a input or output--  Is this correct--- Inputs- start- stop- fl.docx
Is TOD a input or output-- Is this correct--- Inputs- start- stop- fl.docx
 
Is there a universal code for ethical business behavior- (Check the De.docx
Is there a universal code for ethical business behavior- (Check the De.docxIs there a universal code for ethical business behavior- (Check the De.docx
Is there a universal code for ethical business behavior- (Check the De.docx
 
In the following search function for a linked list (using the Node and.docx
In the following search function for a linked list (using the Node and.docxIn the following search function for a linked list (using the Node and.docx
In the following search function for a linked list (using the Node and.docx
 
Is it easier to perform a computer forensic investigation if the suspe.docx
Is it easier to perform a computer forensic investigation if the suspe.docxIs it easier to perform a computer forensic investigation if the suspe.docx
Is it easier to perform a computer forensic investigation if the suspe.docx
 
Is a public park considered to be a public good- Why or why not-Soluti.docx
Is a public park considered to be a public good- Why or why not-Soluti.docxIs a public park considered to be a public good- Why or why not-Soluti.docx
Is a public park considered to be a public good- Why or why not-Soluti.docx
 
Is a firm-'s 10-K an unbiased perspective on its strengths and weaknes.docx
Is a firm-'s 10-K an unbiased perspective on its strengths and weaknes.docxIs a firm-'s 10-K an unbiased perspective on its strengths and weaknes.docx
Is a firm-'s 10-K an unbiased perspective on its strengths and weaknes.docx
 
Iron(II) ion reacts with water to a small extent by a hydrolysis react.docx
Iron(II) ion reacts with water to a small extent by a hydrolysis react.docxIron(II) ion reacts with water to a small extent by a hydrolysis react.docx
Iron(II) ion reacts with water to a small extent by a hydrolysis react.docx
 
Investors require a 17- rate of return on Levine Company-'s stock (tha.docx
Investors require a 17- rate of return on Levine Company-'s stock (tha.docxInvestors require a 17- rate of return on Levine Company-'s stock (tha.docx
Investors require a 17- rate of return on Levine Company-'s stock (tha.docx
 
ionic compounds crystallize in a cubic closest packed array of anions.docx
ionic compounds crystallize in a cubic closest packed array of anions.docxionic compounds crystallize in a cubic closest packed array of anions.docx
ionic compounds crystallize in a cubic closest packed array of anions.docx
 
Invoke Netbeans and create a project Exercise 7- Enter the following.docx
Invoke Netbeans and create a project Exercise 7-  Enter the following.docxInvoke Netbeans and create a project Exercise 7-  Enter the following.docx
Invoke Netbeans and create a project Exercise 7- Enter the following.docx
 
Investors and management use the statement of cash flows to evaluate a.docx
Investors and management use the statement of cash flows to evaluate a.docxInvestors and management use the statement of cash flows to evaluate a.docx
Investors and management use the statement of cash flows to evaluate a.docx
 
In the short run- what distinguishes liquidity from profitability- 1-.docx
In the short run- what distinguishes liquidity from profitability- 1-.docxIn the short run- what distinguishes liquidity from profitability- 1-.docx
In the short run- what distinguishes liquidity from profitability- 1-.docx
 

Recently uploaded

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Recently uploaded (20)

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 

In the following code- A and B are constants defined with #define- 1 t.docx

  • 1. In the following code, A and B are constants defined with #define: 1 typedef struct { 2 int x[A][B]; /* Unknown constants A and B */ 3 long y; 4 } str1; 5 6 typedef struct { 7 char array[B]; 8 int t; 9 short s[A]; 10 long u; 11 } str2; 12 13 void setVal(str1 *p, str2 *q) { 14 long v1 = q-<t; 15 long v2 = q-<u; 16 p-<y = v1+v2; 17 } gcc generates the following code for setVal: void setVal(str1 *p, str2 *q) p in %rdi, q in %rsi 1 setVal: 2 movslq 8(%rsi), %rax 3 addq 32(%rsi), %rax
  • 2. 4 movq %rax, 184(%rdi) 5 ret What are the values of A and B? Solution The answer is: A = 9, B = 5