Download as pdf or txt
Download as pdf or txt
You are on page 1of 48

Compiler Construction CS F363

Class and Lab Notes


Ramprasad S. Joshi
Associate Professor
Department of Computer Science and Information Systems
Birla Institute of Techonogy and Science, Pilani
K K Birla Goa Campus

Semester II, 2023-24


Contents

1 Introduction 1

1.1 What is Compilation? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 A Top Level View of Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.3 Syntax Directed Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.3.1 The Lexer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.3.2 The Parser Evaluator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 Lexical Analysis 6

3 Top Down Parsing 7

A The Assignment Specification 8

A.1 The Lexicon and the Lexer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

A.2 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

A.2.1 Function Definition (Section2) Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

A.2.2 Primitives (Section1) Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

A.2.3 Game Engine (Section3) Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

A.2.4 All Together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

A.3 Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

B Do It Yourselves Examples 11

B.1 Division of Labour in gcc’s Working . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

B.1.1 The Preprocessed Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

B.1.2 The Assembly Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41


Abstract

These notes are written only to augment slides, lectures, labs and the course page. These must be read
with the cited reference materials and slides and other materials shared on the course page, all the materials
produced and used in the lab, etc. They cannot replace so many sources even for a small-credit exam of
short duration. At the best, they will serve as demystifying and mnemonic references to the more elaborate
materials.
Above all, nothing can replace Doing-It-Yourselves.
Do it Yourself

DiY1: Throughout, there will be such "Do It Yourselves" suggestions interspersed. They
are like exercises but have no particular tangible aim. They are observation experiments to
illuminate several neglected but important aspects of language processors that are otherwise
not highlighted in texts.
The course is a hands-on course, and the engagements in lectures and labs are in equal measure. Therefore,
we use the expository DiY experiments to illustrate theory followed by exercises. Throughout, there will be
exercises also interspersed. These are concrete tasks to be carried out by developing programs with specific
toolchains.
Exercise
Exercise1: Exercises are similar to DiY suggestions, with a different color scheme.
Chapter 1

Introduction

This course is about building programming language processors. Though the skills needed (and learnt)
are useful in many areas of applications from systems programming to natural language processing and
computational linguistics, here and now we focus on translation of useful valid source code into effective
executable code. This may be done in an interactive shell (interpreter) mode or shippable bundle (compiler)
mode. Again, we focus on the latter.
Our textbook ([T1, Chapter 1]) says:
Programming languages are notations for describing computations to people and to machines. The
world as we know it depends on programming languages, because all the software running on all the
computers was written in some programming language. But, before a program can be run, it first
must be translated into a form in which it can be executed by a computer.
The software systems that do this translation are called compilers.
This book is about how to design and implement compilers. We shall discover that a few basic
ideas can be used to construct translators for a wide variety of languages and machines. Besides
compilers, the principles and techniques for compiler design are applicable to so many other
domains that they are likely to be reused many times in the career of a computer scientist. The
study of compiler writing touches upon programming languages, machine architecture, language
theory, algorithms, and software engineering.

1.1 What is Compilation?


Compilation is the process of translation from a source code text (supposedly in a “higher language”, or in
some abstraction paradigm that’s closer to human perceptions and operations than the target machine) into
some target machine’s mnemonic or numerical code equipotent to the original source code. If the source
code is lacking in conformance to the intended paradigm and language, the process of compilation may not
yield a complete (or any) translation; in such cases it is expected to provide diagnostics into the issues
hampering conformance.
The paragraph above may look too technical and with multiple interpretations. However, it is not so.
There is no strict technicality to it, it tries to apply the idea of compilation from its original meaning
sans computers to programming language processing. Compilation in general means collecting, selecting,
transforming, collating and curating information from multiple and loosely related sources so as to make
some structured, comprehensive and self-contained reference text. Just word to word or sentence to sentence
translation in human languages cannot be called compilation. But translation of programming language
source code into some machine language needs compilation from multiple sources of data and code and needs
much more than unit-to-unit translation.
The simplified view in [T1, Chapter 2] of syntax-directed translation hides the complexity of the actual
process of compilation (and of compilers). We will still use those ideas for sub-tasks in compilation, because
that is what makes the complexity tractable and manageable.

1.2 A Top Level View of Compilation


Do it Yourself

DiY2: Use the intermediate output options and the verbose option of gcc to get a complete
cross-section view of the whole compilation process from C source code to a binary (ELF)
executable.
In order to see more than what gcc reports on its own in the verbose mode, and to interpret the terse
technical messages, we can directly try to observe the correspondences between the input and output at each
stage.
We take a simple program that has a recursive function (computing gcd by the basic Euclidean method
by repeated subtraction) and a main function that calls it. We also keep a global variable, formal parameters
to the recursive function, local variables in the main function–all to demonstrate all relevant components of
a program and then the differences in handling them in compilation.
In the remaining part of this section, we give the program. You will find the corresponding outputs in
Appendix B.1. They are all the stage outputs of the important compilation stages. An exercise to answer
based on these outputs follows the program listing here.
Syntax Directed Translation

Program 1

//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− e u c l i d . c−−−−−−−−−−−−−−−−−−−−−−−−−−−−
#i n c l u d e <s t d i o . h>
#i n c l u d e <s t d l i b . h>
i n t globalCount = 0 ;
i n t gcd ( i n t a , i n t b ) {
g l o b a l C o u n t++;
i f ( a>0 && b>0) {
i f ( a>b ) r e t u r n gcd ( b , a−b ) ;
e l s e i f ( b>a ) r e t u r n gcd ( a , b−a ) ;
e l s e return a ;
}
e l s e return a ;
}
i n t main ( i n t argc , c h a r ∗ argv [ ] ) {
i n t a = 10 , b = 15;
i f ( argc >1) {
a = a t o i ( argv [ 1 ] ) ;
i f ( argc >2) b = a t o i ( argv [ 2 ] ) ;
}
p r i n t f ( ” gcd ( a = %d , b = %d ) = %d ; ” , a , b , gcd ( a , b ) ) ;
p r i n t f ( ” o b t a i n e d i n %d i t e r a t i o n s . \ n ” , g l o b a l C o u n t ) ;
return 0;
}
//−−−−−−−−−−−−−−−−End o f e u c l i d . c−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Exercise
Exercise2: Using the various gcc options for stopping at various stages in the process from
source to executable on various programs (including the example one given below), determine
the following:
1. What is the basic indivisible unit in which all executable code resides, in all stages from
C source to binary executable?
2. Which identifiers are retained intact through which stages? Why?
3. What happens to all the information associated with identifiers when they disappear after a
stage in the compilation process?
4. How are composite expressions translated? (hint: To answer this, try expressions involving
a mix of identifiers and constants, and see the different translations.)
5. How are function calls prepared and placed?
Try to not just describe, but exactly specify these points in detail covering, as much as you
can, all possibilities. You may use (and modify and use repeatedly to experiment) the program
in 2.

1.3 Syntax Directed Translation


We demonstrate an end-to-end minimal syntax-directed translation (SDT) scheme for a simple example
language. We take an extension of the usual arithmetic expression grammar, extended from scalars to
vectors. The usual example grammar is [T1, Grammar 4.1, p.193]:

We extend this to:

E→E + T |T (1.1)
T →T ∗ F |F (1.2)
F → ( E ) | num | [ L ] (1.3)
L→E X (1.4)
X→L|ϵ (1.5)
This grammar extends the expressions to those on vectors thus:

F ⇒ [L] ⇒ [E X] ⇒ ∗[num L] ⇒∗ [num num num] ⇒∗ ...


Page 2 of 45
Syntax Directed Translation

producing a list of numbers that can fit wherever factors (scalars and parenthesized expressions) fit. Note
that in the textbook grammar (4.1) there is the id token (identifiers) that is replaced by num in our extended
grammar. This change is made because we want to demonstrate the SDT scheme not by code-to-code
translation, but by carrying out expresion evaluation as the result of the translation process. Thus, we
“translate” expressions into their values.

A Typical Expression Tree and its Evaluation

The Control Flow The previous diagram depicted the data flow of expression evaluation in a sense. The
execution process is obviously sequential, operating on one node of the expression tree in one step. The
control flow of this process is akin to the following diagram from the textbook([T1, Figure 2.3, page 41]):

except that the “three address code” in the output at the right end is replaced by the value of the expression.
We can call this scheme Syntex Directed Evaluation. Moreover, we omit intermediate code generation
(instead doing subtree–or sub-expression-tree–evaluation) and symbol table construction. We don’t have
identifiers of any kind, the first class citizens (i.e. factors generated by F in the grammar) of our small world
are only numbers and vectors. Thus there are no symbols to be tabulated.

1.3.1 The Lexer


Since our terminals are only seven–numbers (positive reals), two operators, four brackets–the lexer design is
easy. We only give the pattern-action rules here.
[0 −9][0 −9]∗ { y y l v a l = NewNode ( ) ; y y l v a l −>v a l u e = a t o f ( y y t e x t ) ;
return NUM; }
[0 −9][0 −9]∗\.[0 −9]+ { y y l v a l = NewNode ( ) ; y y l v a l −>v a l u e = a t o f ( y y t e x t ) ;
return NUM; }
\n { return ∗ y y t e x t ; }
[ \t ]∗ { /∗ Do n o t h i n g , drop them . ∗/ }
. { return ∗ y y t e x t ; }
In this design, the yylval is of a struct (pointer) type. That struct will contain all the relevant information
related to a terminal typically contained in a symbol table entry. Since this is initialised for each number
token, the operators and the brackets are returned as the characters themselves (to the parser): see the last
default (explicit) rule on the wildcard dot.
Page 3 of 45
Syntax Directed Translation

1.3.2 The Parser Evaluator


EXPR : EXPR ’+ ’ TERM { $$ = Add( $1 , $3 ) ; }
| TERM { $$ = $1 ; }
;
TERM : TERM ’∗ ’ FACTOR { $$ = M u l t i p l y ( $1 , $3 ) ; }
| FACTOR { $$ = $1 ; }
;
FACTOR : ’( ’ EXPR ’) ’ { $$ = $2 ; }
| NUM { $$ = y y l v a l ; }
| ’[ ’ LIST ’] ’ { $$ = $2 ; }
;
LIST : ’( ’ EXPR ’) ’ EXTEND { $$ = NewNode ( ) ;
$$−> f i r s t = $2 ; $$−>r e s t = $4 ; }
| FACTOR EXTEND { $$ = NewNode ( ) ; $$−> f i r s t = $1 ;
$$−>r e s t = $2 ; }
;
EXTEND : LIST { $$ = $1 ; }
| { $$ = NULL; }
;

In this design, each nonterminal in the body of a production has a positional “dollar” variable associated with
it. It will be assigned a yylval initialised by the lexer for NUM tokens or assigned a subtree value evaluated
and backed up by the parser. For each of the LIST productions, a new node has to be created to hold the
aggregate structure that becomes the evaluation of its RHS body. Other than assignment and new node
creations, the real arithmetic evaluation operations happen in the two functions Add, Multiply. These are
given below.
void AddAtomToList ( double num , l i s t ∗ l ) {
if ( l ) {
i f ( l −> f i r s t ) {
AddAtomToList (num , l −> f i r s t ) ;
AddAtomToList (num , l −>r e s t ) ;
}
e l s e l −>v a l u e += num ;
}
}

l i s t ∗Add( l i s t ∗ one , l i s t ∗two ) {


i f ( ! ( one | | two ) ) return NULL;
i f ( one && ! two ) return one ;
i f ( ! one && two ) return two ;
i f ( one−> f i r s t ) {
i f ( two−> f i r s t ) {
one−> f i r s t = Add( one−>f i r s t , two−> f i r s t ) ;
one−>r e s t = Add( one−>r e s t , two−>r e s t ) ;
return one ;
}
else {
AddAtomToList ( two−>val ue , one−> f i r s t ) ;
f r e e ( two ) ;
return one ;
}
}
else {
AddAtomToList ( one−>val ue , two ) ;
f r e e ( one ) ;
return two ;
}
}

void MultiplyAtomToList ( double num , l i s t ∗ l ) {


if ( l ) {
i f ( l −> f i r s t ) {
MultiplyAtomToList (num , l −> f i r s t ) ;
MultiplyAtomToList (num , l −>r e s t ) ;
}
e l s e l −>v a l u e ∗= num ;
}
}
Page 4 of 45
Syntax Directed Translation

l i s t ∗ M u l t i p l y ( l i s t ∗ one , l i s t ∗two ) {
i f ( ! ( one | | two ) ) return NULL;
i f ( one && ! two ) return one ;
i f ( ! one && two ) return two ;
i f ( one−> f i r s t ) {
i f ( two−> f i r s t ) {
one−> f i r s t = M u l t i p l y ( one−>f i r s t , two−> f i r s t ) ;
one−>r e s t = M u l t i p l y ( one−>r e s t , two−>r e s t ) ;
return one ;
}
else {
MultiplyAtomToList ( two−>val ue , one−> f i r s t ) ;
f r e e ( two ) ;
return one ;
}
}
else {
MultiplyAtomToList ( one−>val ue , two ) ;
f r e e ( one ) ;
return two ;
}
}

Design Notes: In the code listed above, the recursive evaluation of binary operations is intended to go
like this:
1. If both the operands are atoms (scalars), that mean their first members are both empty, their values
are operated upon directly using the corresponding native C operators.

2. If any one operand is a scalar and the other a vector, then the operation is distributed on the vector
keeping the scalar operand common.
3. If both are vectors, then their first and rest components are recursively operated upon respectively.
Some interaction with the calculator generated from this code is given below:

(1+2)*3
===> 9
[1 2]*[3 4]
===> [3 [8 ]]
[1 (2+[3 4])]*(5+6)
===> [11 [[5 [6 ]]]]
[1 2]+3
===> [4 [2 ]]
3+[1 2]
===> [4 [5 ]]
[1 2]*3
===> [3 [2 ]]
3*[1 2]
===> [3 [6 ]]
See the video (https://quantaaws.bits-goa.ac.in/mod/resource/view.php?id=20961) also. We see
that the operations involving a scalar and a list (vector) are not commutative. Can you find the bug in
the code given above?

Page 5 of 45
Chapter 2

Lexical Analysis

This is the stuff of [T1, Chapter 3].


Chapter 3

Top Down Parsing

This is the stuff of [T1, Sections 4.1-4.4]


Appendix A

The Assignment Specification

The task is to design a game programming language for a programmer who would want to create a game of
“extetrominoes” (a set of four-block figures like tetrominoes, the original idea of having the blocks connected
only on edges extended to blocks connected on corners as well). Thus, the number of possible blocks is larger
than 7. Some examples are shown in the following figure.

A matrix representation for the first two two extetrominoes


0 1 0 1
1 0 1 0
1 0 1 0
1 0 0 1

The suggested matrix representation is self-evident.

A.1 The Lexicon and the Lexer


Overall specifications for the lexer:

1. Processes sections of a source code file (belonging to a programming language not yet specified) in
different ways. The sections are marked by special keywords. Currently the keywords are “Section1”,
“Section2”, “Section3”.

2. These sections should appear exactly once each, and in this sequence only in the source file, but if that
doesn’t happen, your scanner needs to detect and exit with an error message.

3. You will be given a list of delimiters (which may change for each section) which separate words (tokens)
in the source. The delimiters are to be ignored, not to be reproduced in the output. The scanner
recognises tokens between delimiters.
Syntax

4. Token types are: numbers (the usual signed integers), the usual identifiers, five arithmetic operators
+,-,*,/,=and parentheses “()”.

5. Any other characters than 3,4 above are to be treated as an error, but it is to be recovered from and
scanning to be continued.

6. Apart from scanning and giving the usual token stream, the scanner should output a list of identifiers
with their occurrence positions (identifier sequence number, section-wise) for each section. The sequence
of identifiers in this list should be alphanumeric (dictionary).

7. Identifiers that occur afresh in Section2 or Section3 (without occurring in any previous section) should
be caught at a later stage. In fact, they should be treated as strings (without quotes as delimiters).

8. Sectional and global delimiters:

• In Section 2, square brackets [] and curly braces {} can be used to surround separable units. In
syntax and semantics later, we will introduce scope rules for identifiers within such units. In the
other two sections, these two types of brackets are neither delimiters nor to be ignored silently:
they should provoke lexical error messages (and then ignored).
• Other than alphanumeric characters, underscore, the decimal point, delimiters and the 7 “opera-
tors” +-*/=() all other characters are to be caught as errors.
• We are extending the class of numbers to signed reals (floating point) too. Whether to use the
lookahead operator to distinguish between integers and reals with one rule each for them or to
relegate the distinction to the action part for a single rule for both – that’s your choice.
• Whitespace characters are delimiters in all sections.
• How to allow these sectional differences is your choice. You may use global flags, switches in the
action parts, changes in the main driver for each section detection, etc.

Remember that the extetrominoes are to be represented in a program by special long integers: thus, the
two extetrominoes of which the matrix representation is shown in the diagram above will be represented
as 4201101010 and 4201101001 respectively. The first digit in each is the number of rows of the matrix
representation, the second is the columns, followed by the rows of bits.

A.2 Syntax
The game program is to be contained mainly in Section2. Section2 consists entirely of function bodies. A
Play function is a must, and that will be treated as the “main” function of the game engine generated.

A.2.1 Function Definition (Section2) Syntax


FUNCTIONS→FUNCTION newline FUNCTIONS | ϵ
FUNCTION→{id BODY}
BODY→STATEMENT BODY | STATEMENT
STATEMENT→IFSTATEMENT | WHILELOOP | id = EXPR
IFSTATEMENT→if ( EXPR ) then STATEMENT end | if ( EXPR ) then STATEMENT else STATEMENT
end
WHILELOOP→while ( EXPR ) STATEMENT end
EXPR→ARITHLOGIC | [call id] | [call id with PARAM PARAMLIST]
ARITHLOGIC→TERM ARITH1
TERM→FACTOR TERM1
ARITH1→+ TERM ARITH1 | - TERM ARITH1 | or TERM ARITH1 | ϵ
FACTOR→id | num | ( EXPR ) | ( neg EXPR ) | ( not EXPR )
TERM1→* FACTOR TERM1 | and FACTOR TERM1 | ϵ
PARAM→id = EXPR
PARAMLIST→PARAM PARAMLIST | ϵ

A.2.2 Primitives (Section1) Syntax


PRIMITIVE→id=EXPR newline PRIMITIVE | ϵ

A.2.3 Game Engine (Section3) Syntax


ENGINE→[play] — [play with PARAM PARAMLIST]

A.2.4 All Together


START→VERBATIM newline Section1 newline PRIMITIVE Section2 newline FUNCTIONS Section3
ENGINE VERBATIM
Page 9 of 45
Semantics

A.3 Semantics
We want the compiler to generate Python code. If you want something else, you need to be clear about the
design specifications and the rationale, but in the implementation we will help you.

Page 10 of 45
Appendix B

Do It Yourselves Examples

B.1 Division of Labour in gcc’s Working


We present the observations in DiY 2. The euclid.c source file:
#include<s t d i o . h>
#include<s t d l i b . h>
int g l o b a l C o u n t = 0 ;
int gcd ( int a , int b ) {
g l o b a l C o u n t++;
i f ( a>0 && b>0) {
i f ( a>b ) return gcd ( b , a−b ) ;
e l s e i f ( b>a ) return gcd ( a , b−a ) ;
e l s e return a ;
}
e l s e return a ;
}
int main ( int argc , char ∗ argv [ ] ) {
int a = 1 0 , b = 1 5 ;
i f ( argc >1) {
a = a t o i ( argv [ 1 ] ) ;
i f ( argc >2) b = a t o i ( argv [ 2 ] ) ;
}
p r i n t f ( ” gcd ( a = %d , b = %d ) = %d ; ” , a , b , gcd ( a , b ) ) ;
p r i n t f ( ” o b t a i n e d i n %d i t e r a t i o n s . \ n” , g l o b a l C o u n t ) ;
return 0 ;
}
This was how the source euclid.c was compiled (in verbose mode, keeping the intermediate stage outputs
too): gcc -v -save-temps euclid.c.

Using built-in specs.


COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with:
../src/configure -v
--with-pkgversion=’Ubuntu 11.4.0-1ubuntu1~22.04’
--with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2
--prefix=/usr --with-gcc-major-version-only --program-suffix=-11
--program-prefix=x86_64-linux-gnu-
--enable-shared --enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --libdir=/usr/lib
--enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie
--with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto
--enable-multiarch --disable-werror --enable-cet --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/
Division of Labour in gcc’s Working

gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=
/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr
--without-cuda-driver --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean
--enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
COLLECT_GCC_OPTIONS=’-v’ ’-fverbose-asm’ ’-save-temps’
’-mtune=generic’ ’-march=x86-64’ ’-dumpdir’ ’a-’
/usr/lib/gcc/x86_64-linux-gnu/11/cc1 -E -quiet -v
-imultiarch x86_64-linux-gnu euclid.c -mtune=generic -march=x86-64
-fverbose-asm -fpch-preprocess -fasynchronous-unwind-tables
-fstack-protector-strong -Wformat -Wformat-security
-fstack-clash-protection -fcf-protection -o a-euclid.i
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-linux-gnu/11/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
COLLECT_GCC_OPTIONS=’-v’ ’-fverbose-asm’ ’-save-temps’ ’-mtune=generic’
’-march=x86-64’ ’-dumpdir’ ’a-’
/usr/lib/gcc/x86_64-linux-gnu/11/cc1 -fpreprocessed a-euclid.i -quiet
-dumpdir a- -dumpbase euclid.c -dumpbase-ext .c -mtune=generic
-march=x86-64 -version -fverbose-asm -fasynchronous-unwind-tables
-fstack-protector-strong -Wformat -Wformat-security
-fstack-clash-protection -fcf-protection -o a-euclid.s
GNU C17 (Ubuntu 11.4.0-1ubuntu1~22.04) version 11.4.0 (x86_64-linux-gnu)
compiled by GNU C version 11.4.0, GMP version 6.2.1,
MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072


GNU C17 (Ubuntu 11.4.0-1ubuntu1~22.04) version 11.4.0 (x86_64-linux-gnu)
compiled by GNU C version 11.4.0, GMP version 6.2.1,
MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072


Compiler executable checksum: 50eaa2331df977b8016186198deb2d18
COLLECT_GCC_OPTIONS=’-v’ ’-fverbose-asm’ ’-save-temps’ ’-mtune=generic’
’-march=x86-64’ ’-dumpdir’ ’a-’
as -v --64 -o a-euclid.o a-euclid.s
GNU assembler version 2.38 (x86_64-linux-gnu) using BFD version
(GNU Binutils for Ubuntu) 2.38
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:
/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/
:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/
:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/
:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/
:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/
:/usr/lib/../lib/
:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS=’-v’ ’-fverbose-asm’ ’-save-temps’ ’-mtune=generic’
’-march=x86-64’ ’-dumpdir’ ’a.’
/usr/lib/gcc/x86_64-linux-gnu/11/collect2
-plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
-plugin-opt=-fresolution=a.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
--build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed
-dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie
-z now
-z relro
/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o
/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o
Page 12 of 45
Division of Labour in gcc’s Working

/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o
-L/usr/lib/gcc/x86_64-linux-gnu/11
-L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib
-L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu
-L/usr/lib/../lib
-L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. a-euclid.o
-lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc
--push-state --as-needed -lgcc_s
--pop-state /usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o
/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o
COLLECT_GCC_OPTIONS=’-v’ ’-fverbose-asm’ ’-save-temps’
’-mtune=generic’ ’-march=x86-64’ ’-dumpdir’ ’a.’

B.1.1 The Preprocessed Source

# 0 ” euclid . c”
# 0 ”<b u i l t −in>”
# 0 ”<command−l i n e >”
# 1 ” / u s r / i n c l u d e / s t d c −p r e d e f . h” 1 3 4
# 0 ”<command−l i n e >” 2
# 1 ” euclid . c”
# 1 ” / u s r / i n c l u d e / s t d i o . h” 1 3 4
# 27 ” / u s r / i n c l u d e / s t d i o . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / l i b c −header−s t a r t . h” 1 3 4
# 33 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / l i b c −header−s t a r t . h” 3 4
# 1 ” / u s r / i n c l u d e / f e a t u r e s . h” 1 3 4
# 392 ” / u s r / i n c l u d e / f e a t u r e s . h” 3 4
# 1 ” / u s r / i n c l u d e / f e a t u r e s −time64 . h” 1 3 4
# 20 ” / u s r / i n c l u d e / f e a t u r e s −time64 . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / w o r d s i z e . h” 1 3 4
# 21 ” / u s r / i n c l u d e / f e a t u r e s −time64 . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t i m e s i z e . h” 1 3 4
# 19 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t i m e s i z e . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / w o r d s i z e . h” 1 3 4
# 20 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t i m e s i z e . h” 2 3 4
# 22 ” / u s r / i n c l u d e / f e a t u r e s −time64 . h” 2 3 4
# 393 ” / u s r / i n c l u d e / f e a t u r e s . h” 2 3 4
# 486 ” / u s r / i n c l u d e / f e a t u r e s . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / c d e f s . h” 1 3 4
# 559 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / c d e f s . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / w o r d s i z e . h” 1 3 4
# 560 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / c d e f s . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / long−d o u b l e . h” 1 3 4
# 561 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / c d e f s . h” 2 3 4
# 487 ” / u s r / i n c l u d e / f e a t u r e s . h” 2 3 4
# 510 ” / u s r / i n c l u d e / f e a t u r e s . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/gnu/ s t u b s . h” 1 3 4
# 10 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/gnu/ s t u b s . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/gnu/ s t u b s −64.h” 1 3 4
# 11 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/gnu/ s t u b s . h” 2 3 4
# 511 ” / u s r / i n c l u d e / f e a t u r e s . h” 2 3 4
# 34 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / l i b c −header−s t a r t . h” 2 3 4
# 28 ” / u s r / i n c l u d e / s t d i o . h” 2 3 4

# 1 ” / u s r / l i b / g c c / x86 64−l i n u x −gnu /11/ i n c l u d e / s t d d e f . h” 1 3 4


# 209 ” / u s r / l i b / g c c / x86 64−l i n u x −gnu /11/ i n c l u d e / s t d d e f . h” 3 4

# 209 ” / u s r / l i b / g c c / x86 64−l i n u x −gnu /11/ i n c l u d e / s t d d e f . h” 3 4


typedef long unsigned int s i z e t ;
# 34 ” / u s r / i n c l u d e / s t d i o . h” 2 3 4

# 1 ” / u s r / l i b / g c c / x86 64−l i n u x −gnu /11/ i n c l u d e / s t d a r g . h” 1 3 4


Page 13 of 45
Division of Labour in gcc’s Working

# 40 ” / u s r / l i b / g c c / x86 64−l i n u x −gnu /11/ i n c l u d e / s t d a r g . h” 3 4


typedef builtin va list gnuc va list ;
# 37 ” / u s r / i n c l u d e / s t d i o . h” 2 3 4

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s . h” 1 3 4


# 27 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / w o r d s i z e . h” 1 3 4
# 28 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t i m e s i z e . h” 1 3 4
# 19 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t i m e s i z e . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / w o r d s i z e . h” 1 3 4
# 20 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t i m e s i z e . h” 2 3 4
# 29 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s . h” 2 3 4

typedef unsigned char u char ;


typedef unsigned short int u short ;
typedef unsigned int u int ;
typedef unsigned long int u long ;

typedef signed char int8 t ;


typedef unsigned char uint8 t ;
typedef signed short int int16 t ;
typedef unsigned short int uint16 t ;
typedef signed int int32 t ;
typedef unsigned int uint32 t ;

typedef signed long int int64 t ;


typedef unsigned long int uint64 t ;

typedef int8 t int least8 t ;


typedef uint8 t uint least8 t ;
typedef int16 t int least16 t ;
typedef uint16 t uint least16 t ;
typedef int32 t int least32 t ;
typedef uint32 t uint least32 t ;
typedef int64 t int least64 t ;
typedef uint64 t uint least64 t ;

typedef long int quad t ;


typedef unsigned long int u quad t ;

typedef long int intmax t ;


typedef unsigned long int uintmax t ;
# 141 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s i z e s . h” 1 3 4
# 142 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / time64 . h” 1 3 4
# 143 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s . h” 2 3 4

typedef unsigned long int dev t ;


typedef unsigned int uid t ;
typedef unsigned int gid t ;
typedef unsigned long int ino t ;
Page 14 of 45
Division of Labour in gcc’s Working

typedef unsigned long int ino64 t ;


typedef unsigned int mode t ;
typedef unsigned long int nlink t ;
typedef long int off t ;
typedef long int off64 t ;
typedef int pid t ;
typedef struct { int val [ 2 ] ; } fsid t ;
typedef long int clock t ;
typedef unsigned long int rlim t ;
typedef unsigned long int rlim64 t ;
typedef unsigned int id t ;
typedef long int time t ;
typedef unsigned int useconds t ;
typedef long int suseconds t ;
typedef long int suseconds64 t ;

typedef int daddr t ;


typedef int key t ;

typedef int clockid t ;

typedef void ∗ timer t ;

typedef long int blksize t ;

typedef long int blkcnt t ;


typedef long int blkcnt64 t ;

typedef unsigned long int fsblkcnt t ;


typedef unsigned long int fsblkcnt64 t ;

typedef unsigned long int fsfilcnt t ;


typedef unsigned long int fsfilcnt64 t ;

typedef long int fsword t ;

typedef long int ssize t ;

typedef long int syscall slong t ;

typedef unsigned long int syscall ulong t ;

typedef off64 t loff t ;


typedef char ∗ c a d d r t ;

typedef long int intptr t ;

typedef unsigned int socklen t ;

typedef int sig atomic t ;


# 39 ” / u s r / i n c l u d e / s t d i o . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / f p o s t . h” 1 3 4
Page 15 of 45
Division of Labour in gcc’s Working

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / m b s t a t e t . h” 1 3 4


# 13 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / m b s t a t e t . h” 3 4
typedef struct
{
int count ;
union
{
unsigned int wch ;
char wchb [ 4 ] ;
} value ;
} mbstate t ;
# 6 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / f p o s t . h” 2 3 4

typedef struct G f p o s t
{
off t pos ;
mbstate t state ;
} fpos t ;
# 40 ” / u s r / i n c l u d e / s t d i o . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / f p o s 6 4 t . h” 1 3 4
# 10 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / f p o s 6 4 t . h” 3 4
typedef struct G f p o s 6 4 t
{
off64 t pos ;
mbstate t state ;
} fpos64 t ;
# 41 ” / u s r / i n c l u d e / s t d i o . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / FILE . h” 1 3 4

struct IO FILE ;
typedef struct IO FILE FILE ;
# 42 ” / u s r / i n c l u d e / s t d i o . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s /FILE . h” 1 3 4

struct IO FILE ;

typedef struct IO FILE FILE ;


# 43 ” / u s r / i n c l u d e / s t d i o . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / s t r u c t F I L E . h” 1 3 4
# 35 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / s t r u c t F I L E . h” 3 4
struct IO FILE ;
struct IO marker ;
struct I O c o d e c v t ;
struct I O w i d e d a t a ;

typedef void IO lock t ;

struct IO FILE
{
int f l a g s ;
Page 16 of 45
Division of Labour in gcc’s Working

char ∗ IO read ptr ;


char ∗ IO read end ;
char ∗ IO read base ;
char ∗ IO write base ;
char ∗ IO write ptr ;
char ∗ IO write end ;
char ∗ IO buf base ;
char ∗ IO buf end ;

char ∗ I O s a v e b a s e ;
char ∗ I O b a c k u p b a s e ;
char ∗ I O s a v e e n d ;

struct IO marker ∗ m a r k e r s ;

struct IO FILE ∗ c h a i n ;

int f i l e n o ;
int f l a g s 2 ;
off t old offset ;

unsigned short c u r c o l u m n ;
signed char v t a b l e o f f s e t ;
char s h o r t b u f [ 1 ] ;

IO lock t ∗ lock ;

off64 t offset ;

struct I O c o d e c v t ∗ c o d e c v t ;
struct I O w i d e d a t a ∗ w i d e d a t a ;
struct IO FILE ∗ f r e e r e s l i s t ;
void ∗ f r e e r e s b u f ;
size t pad5 ;
int mode ;

char unused2 [ 1 5 ∗ s i z e o f ( int ) − 4 ∗ s i z e o f ( void ∗ ) − s i z e o f ( s i z e t ) ] ;


};
# 44 ” / u s r / i n c l u d e / s t d i o . h” 2 3 4
# 52 ” / u s r / i n c l u d e / s t d i o . h” 3 4
typedef gnuc va list va list ;
# 63 ” / u s r / i n c l u d e / s t d i o . h” 3 4
typedef off t off t ;
# 77 ” / u s r / i n c l u d e / s t d i o . h” 3 4
typedef ssize t ssize t ;

typedef fpos t fpos t ;


# 133 ” / u s r / i n c l u d e / s t d i o . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / s t d i o l i m . h” 1 3 4
# 134 ” / u s r / i n c l u d e / s t d i o . h” 2 3 4
# 143 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern FILE ∗ s t d i n ;
extern FILE ∗ s t d o u t ;
extern FILE ∗ s t d e r r ;
Page 17 of 45
Division of Labour in gcc’s Working

extern int remove ( const char ∗ filename ) attribute (( nothrow ,


leaf )) ;

extern int rename ( const char ∗ o l d , const char ∗ new ) attribute ((


nothrow , leaf )) ;

extern int renameat ( int o l d f d , const char ∗ o l d , int n ew f d ,


const char ∗ new ) attribute (( nothrow , leaf )) ;
# 178 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern int f c l o s e ( FILE ∗ s t r e a m ) ;
# 188 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern FILE ∗ t m p f i l e ( void )
attribute (( malloc ) ) attribute (( malloc ( f c l o s e , 1) ) ) ;
# 205 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern char ∗tmpnam ( char [ 2 0 ] ) attribute (( nothrow , leaf )) ;

extern char ∗tmpnam r ( char s [20]) attribute (( nothrow , leaf ))


;
# 222 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern char ∗tempnam ( const char ∗ d i r , const char ∗ p f x )
attribute (( nothrow , leaf )) attribute (( malloc ) )
attribute (( malloc ( b u i l t i n f r e e , 1) ) ) ;

extern int f f l u s h ( FILE ∗ s t r e a m ) ;


# 239 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern int f f l u s h u n l o c k e d ( FILE ∗ s t r e a m ) ;
# 258 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern FILE ∗ f o p e n ( const char ∗ r e s t r i c t filename ,
const char ∗ r e s t r i c t modes )
attribute (( malloc ) ) attribute (( malloc ( f c l o s e , 1) ) ) ;

extern FILE ∗ f r e o p e n ( const char ∗ r e s t r i c t filename ,


const char ∗ r e s t r i c t modes ,
FILE ∗ r e s t r i c t stream ) ;
# 293 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern FILE ∗ fdopen ( int f d , const char ∗ modes ) attribute ((
nothrow , leaf ))
attribute (( malloc ) ) attribute (( malloc ( f c l o s e , 1) ) ) ;
# 308 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern FILE ∗fmemopen ( void ∗ s , s i z e t l e n , const char ∗ modes )
attribute (( nothrow , leaf )) attribute (( malloc ) )
attribute (( malloc ( f c l o s e , 1) ) ) ;

extern FILE ∗ open memstream ( char ∗∗ b u f l o c , s i z e t ∗ s i z e l o c ) attribute


(( nothrow , leaf ))
attribute (( malloc ) ) attribute (( malloc ( f c l o s e , 1) ) ) ;
# 328 ” / u s r / i n c l u d e / s t d i o . h” 3 4
Page 18 of 45
Division of Labour in gcc’s Working

extern void s e t b u f ( FILE ∗ r e s t r i c t s t r e a m , char ∗ restrict buf )


attribute (( nothrow , leaf )) ;

extern int s e t v b u f ( FILE ∗ restrict s t r e a m , char ∗ r e s t r i c t buf ,


int modes , s i z e t n) attribute (( nothrow , leaf )) ;

extern void s e t b u f f e r ( FILE ∗ r e s t r i c t s t r e a m , char ∗ r e s t r i c t buf ,


size t size ) attribute (( nothrow , leaf )) ;

extern void s e t l i n e b u f ( FILE ∗ stream ) attribute (( nothrow , leaf


));

extern int f p r i n t f ( FILE ∗ r e s t r i c t stream ,


const char ∗ r e s t r i c t format , . . . ) ;

extern int p r i n t f ( const char ∗ restrict format , . . . ) ;

extern int s p r i n t f ( char ∗ r e s t r i c t s ,


const char ∗ r e s t r i c t format , . . . ) attribute (( nothrow ));

extern int v f p r i n t f ( FILE ∗ r e s t r i c t s , const char ∗ restrict format ,


gnuc va list arg ) ;

extern int v p r i n t f ( const char ∗ restrict format , gnuc va list arg ) ;

extern int v s p r i n t f ( char ∗ r e s t r i c t s , const char ∗ r e s t r i c t format ,


gnuc va list arg ) attribute (( nothrow ) ) ;

extern int s n p r i n t f ( char ∗ r e s t r i c t s , size t maxlen ,


const char ∗ r e s t r i c t format , . . . )
attribute (( nothrow ) ) attribute (( format ( printf , 3,
4) ) ) ;

extern int v s n p r i n t f ( char ∗ r e s t r i c t s , size t maxlen ,


const char ∗ r e s t r i c t format , gnuc va list arg )
attribute (( nothrow ) ) attribute (( format ( printf , 3,
0) ) ) ;
# 403 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern int v d p r i n t f ( int f d , const char ∗ r e s t r i c t fmt ,
gnuc va list arg )
attribute (( format ( printf , 2 , 0) ) ) ;
extern int d p r i n t f ( int f d , const char ∗ r e s t r i c t fmt , . . . )
attribute (( format ( printf , 2 , 3) ) ) ;

Page 19 of 45
Division of Labour in gcc’s Working

extern int f s c a n f ( FILE ∗ r e s t r i c t stream ,


const char ∗ r e s t r i c t format , . . . ) ;

extern int s c a n f ( const char ∗ restrict format , . . . ) ;

extern int s s c a n f ( const char ∗ r e s t r i c t s ,


const char ∗ r e s t r i c t format , . . . ) attribute (( nothrow ,
leaf )) ;

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / f l o a t n . h” 1 3 4


# 119 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / f l o a t n . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / f l o a t n −common . h” 1 3 4
# 24 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / f l o a t n −common . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / long−d o u b l e . h” 1 3 4
# 25 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / f l o a t n −common . h” 2 3 4
# 120 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / f l o a t n . h” 2 3 4
# 431 ” / u s r / i n c l u d e / s t d i o . h” 2 3 4

extern int f s c a n f ( FILE ∗ r e s t r i c t s t r e a m , const char ∗ restrict format ,


...) asm ( ”” ” i s o c 9 9 f s c a n f ” )

;
extern int s c a n f ( const char ∗ restrict format , . . . ) asm ( ”” ”
isoc99 scanf ”)
;
extern int s s c a n f ( const char ∗ r e s t r i c t s , const char ∗ r e s t r i c t format
, ...) asm ( ”” ” i s o c 9 9 s s c a n f ” ) attribute (( nothrow ,
leaf ))

;
# 459 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern int v f s c a n f ( FILE ∗ r e s t r i c t s , const char ∗ restrict format ,
gnuc va list arg )
attribute (( format ( scanf , 2 , 0) ) ) ;

extern int v s c a n f ( const char ∗ r e s t r i c t format , gnuc va list arg )


attribute (( format ( scanf , 1 , 0) ) ) ;

extern int v s s c a n f ( const char ∗ r e s t r i c t s ,


const char ∗ r e s t r i c t format , gnuc va list arg )
attribute (( nothrow , leaf )) attribute (( format (
scanf , 2 , 0) ) ) ;

extern int v f s c a n f ( FILE ∗ r e s t r i c t s , const char ∗ r e s t r i c t format ,


gnuc va list arg ) asm ( ”” ” i s o c 9 9 v f s c a n f ” )

Page 20 of 45
Division of Labour in gcc’s Working

attribute (( format ( scanf , 2 , 0) ) ) ;


extern int v s c a n f ( const char ∗ r e s t r i c t format , gnuc va list arg )
asm ( ”” ” i s o c 9 9 v s c a n f ” )

attribute (( format ( scanf , 1 , 0) ) ) ;


extern int v s s c a n f ( const char ∗ r e s t r i c t s , const char ∗ r e s t r i c t
format , gnuc va list arg ) asm ( ”” ” i s o c 9 9 v s s c a n f ” )
attribute (( nothrow , leaf ))

attribute (( format ( scanf , 2 , 0) ) ) ;


# 513 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern int f g e t c ( FILE ∗ s t r e a m ) ;
extern int g e t c ( FILE ∗ s t r e a m ) ;

extern int g e t c h a r ( void ) ;

extern int g e t c u n l o c k e d ( FILE ∗ s t r e a m ) ;


extern int g e t c h a r u n l o c k e d ( void ) ;
# 538 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern int f g e t c u n l o c k e d ( FILE ∗ s t r e a m ) ;
# 549 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern int f p u t c ( int c , FILE ∗ s t r e a m ) ;
extern int putc ( int c , FILE ∗ s t r e a m ) ;

extern int p u t c h a r ( int c);


# 565 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern int f p u t c u n l o c k e d ( int c , FILE ∗ stream ) ;

extern int p u t c u n l o c k e d ( int c , FILE ∗ stream ) ;


extern int p u t c h a r u n l o c k e d ( int c);

extern int getw ( FILE ∗ stream ) ;

extern int putw ( int w , FILE ∗ stream ) ;

Page 21 of 45
Division of Labour in gcc’s Working

extern char ∗ f g e t s ( char ∗ r e s t r i c t s , int n , FILE ∗ r e s t r i c t stream )


attribute (( access ( write only , 1 , 2) ) ) ;
# 632 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern ssize t g e t d e l i m ( char ∗∗ r e s t r i c t lineptr ,
size t ∗ restrict n , int delimiter ,
FILE ∗ r e s t r i c t stream ) ;
extern s s i z e t g e t d e l i m ( char ∗∗ r e s t r i c t lineptr ,
size t ∗ restrict n , int delimiter ,
FILE ∗ r e s t r i c t stream ) ;

extern s s i z e t g e t l i n e ( char ∗∗ r e s t r i c t lineptr ,


size t ∗ restrict n,
FILE ∗ r e s t r i c t stream ) ;

extern int f p u t s ( const char ∗ restrict s , FILE ∗ restrict stream ) ;

extern int p u t s ( const char ∗ s);

extern int u n g e t c ( int c , FILE ∗ stream ) ;

extern s i z e t f r e a d ( void ∗ r e s t r i c t ptr , s i z e t size ,


size t n , FILE ∗ r e s t r i c t stream ) ;

extern s i z e t f w r i t e ( const void ∗ r e s t r i c t ptr , s i z e t size ,


size t n , FILE ∗ r e s t r i c t s);
# 702 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern s i z e t f r e a d u n l o c k e d ( void ∗ r e s t r i c t ptr , s i z e t size ,
size t n , FILE ∗ r e s t r i c t stream ) ;
extern s i z e t f w r i t e u n l o c k e d ( const void ∗ r e s t r i c t ptr , s i z e t size ,
size t n , FILE ∗ r e s t r i c t stream ) ;

extern int f s e e k ( FILE ∗ s t r e a m , long int o f f , int whence ) ;

Page 22 of 45
Division of Labour in gcc’s Working

extern long int f t e l l ( FILE ∗ stream ) ;

extern void rewind ( FILE ∗ s t r e a m ) ;


# 736 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern int f s e e k o ( FILE ∗ s t r e a m , off t o f f , int whence ) ;

extern o f f t f t e l l o ( FILE ∗ s t r e a m ) ;
# 760 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern int f g e t p o s ( FILE ∗ r e s t r i c t stream , f p o s t ∗ restrict pos ) ;

extern int f s e t p o s ( FILE ∗ s t r e a m , const f p o s t ∗ pos ) ;


# 786 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern void c l e a r e r r ( FILE ∗ s t r e a m ) attribute (( nothrow , leaf ))
;

extern int f e o f ( FILE ∗ stream ) attribute (( nothrow , leaf )) ;

extern int f e r r o r ( FILE ∗ stream ) attribute (( nothrow , leaf )) ;

extern void c l e a r e r r u n l o c k e d ( FILE ∗ s t r e a m ) attribute (( nothrow ,


leaf )) ;
extern int f e o f u n l o c k e d ( FILE ∗ s t r e a m ) attribute (( nothrow ,
leaf )) ;
extern int f e r r o r u n l o c k e d ( FILE ∗ s t r e a m ) attribute (( nothrow ,
leaf )) ;

extern void p e r r o r ( const char ∗ s);

extern int f i l e n o ( FILE ∗ stream ) attribute (( nothrow , leaf )) ;

extern int f i l e n o u n l o c k e d ( FILE ∗ s t r e a m ) attribute (( nothrow ,


leaf )) ;
# 823 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern int p c l o s e ( FILE ∗ s t r e a m ) ;

extern FILE ∗ popen ( const char ∗ command , const char ∗ modes )


attribute (( malloc ) ) attribute (( malloc ( pclose , 1) ) ) ;

Page 23 of 45
Division of Labour in gcc’s Working

extern char ∗ c t e r m i d ( char ∗ s ) attribute (( nothrow , leaf ))


attribute (( access ( write only , 1) ) ) ;
# 867 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern void f l o c k f i l e ( FILE ∗ s t r e a m ) attribute (( nothrow , leaf )
);

extern int f t r y l o c k f i l e ( FILE ∗ stream ) attribute (( nothrow ,


leaf )) ;

extern void f u n l o c k f i l e ( FILE ∗ s t r e a m ) attribute (( nothrow ,


leaf )) ;
# 885 ” / u s r / i n c l u d e / s t d i o . h” 3 4
extern int u f l o w ( FILE ∗ ) ;
extern int o v e r f l o w ( FILE ∗ , int ) ;
# 902 ” / u s r / i n c l u d e / s t d i o . h” 3 4

# 2 ” euclid . c” 2
# 1 ” / u s r / i n c l u d e / s t d l i b . h” 1 3 4
# 26 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / l i b c −header−s t a r t . h” 1 3 4
# 27 ” / u s r / i n c l u d e / s t d l i b . h” 2 3 4

# 1 ” / u s r / l i b / g c c / x86 64−l i n u x −gnu /11/ i n c l u d e / s t d d e f . h” 1 3 4


# 321 ” / u s r / l i b / g c c / x86 64−l i n u x −gnu /11/ i n c l u d e / s t d d e f . h” 3 4
typedef int w c h a r t ;
# 33 ” / u s r / i n c l u d e / s t d l i b . h” 2 3 4

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / w a i t f l a g s . h” 1 3 4


# 41 ” / u s r / i n c l u d e / s t d l i b . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / w a i t s t a t u s . h” 1 3 4
# 42 ” / u s r / i n c l u d e / s t d l i b . h” 2 3 4
# 59 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
typedef struct
{
int quot ;
int rem ;
} div t ;

typedef struct
{
long int quot ;
long int rem ;
} ldiv t ;

extension typedef struct


{
Page 24 of 45
Division of Labour in gcc’s Working

long long int quot ;


long long int rem ;
} lldiv t ;
# 98 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern s i z e t c t y p e g e t m b c u r m a x ( void ) attribute (( nothrow ,
leaf )) ;

extern double a t o f ( const char ∗ n p t r )


attribute (( nothrow , leaf )) attribute (( pure ))
attribute (( nonnull (1) ) ) ;

extern int a t o i ( const char ∗ n p t r )


attribute (( nothrow , leaf )) attribute (( pure ))
attribute (( nonnull (1) ) ) ;

extern long int a t o l ( const char ∗ nptr )


attribute (( nothrow , leaf )) attribute (( pure ))
attribute (( nonnull (1) ) ) ;

extension extern long long int a t o l l ( const char ∗ n p t r )


attribute (( nothrow , leaf )) attribute (( pure ))
attribute (( nonnull (1) ) ) ;

extern double s t r t o d ( const char ∗ r e s t r i c t nptr ,


char ∗∗ r e s t r i c t endptr )
attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);

extern f l o a t s t r t o f ( const char ∗ r e s t r i c t nptr ,


char ∗∗ r e s t r i c t endptr ) attribute (( nothrow , leaf ))
attribute (( nonnull (1) ) ) ;

extern long double s t r t o l d ( const char ∗ r e s t r i c t nptr ,


char ∗∗ r e s t r i c t endptr )
attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);
# 177 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern long int s t r t o l ( const char ∗ r e s t r i c t nptr ,
char ∗∗ r e s t r i c t e n d p t r , int base )
attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);

extern unsigned long int s t r t o u l ( const char ∗ restrict nptr ,


char ∗∗ r e s t r i c t e n d p t r , int base )
attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);

extension
extern long long int s t r t o q ( const char ∗ r e s t r i c t nptr ,
char ∗∗ r e s t r i c t e n d p t r , int base )
attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);

extension
extern unsigned long long int s t r t o u q ( const char ∗ r e s t r i c t nptr ,
char ∗∗ r e s t r i c t e n d p t r , int base )
attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);

Page 25 of 45
Division of Labour in gcc’s Working

extension
extern long long int s t r t o l l ( const char ∗ r e s t r i c t nptr ,
char ∗∗ r e s t r i c t e n d p t r , int base )
attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);

extension
extern unsigned long long int s t r t o u l l ( const char ∗ r e s t r i c t nptr ,
char ∗∗ r e s t r i c t e n d p t r , int base )
attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);
# 386 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern char ∗ l 6 4 a ( long int n) attribute (( nothrow , leaf )) ;

extern long int a 6 4 l ( const char ∗ s)


attribute (( nothrow , leaf )) attribute (( pure ))
attribute (( nonnull (1) ) ) ;

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 1 3 4


# 27 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 3 4

typedef u char u char ;


typedef u short u short ;
typedef u int u int ;
typedef u long u long ;
typedef q u a d t quad t ;
typedef u quad t u quad t ;
typedef fsid t fsid t ;

typedef loff t loff t ;

typedef ino t ino t ;


# 59 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 3 4
typedef dev t dev t ;

typedef gid t gid t ;

typedef m o d e t mode t ;

typedef nlink t nlink t ;

Page 26 of 45
Division of Labour in gcc’s Working

typedef uid t uid t ;


# 97 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 3 4
typedef pid t pid t ;

typedef id t id t ;
# 114 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 3 4
typedef daddr t daddr t ;
typedef caddr t caddr t ;

typedef key t key t ;

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / c l o c k t . h” 1 3 4

typedef clock t clock t ;


# 127 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 2 3 4

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / c l o c k i d t . h” 1 3 4

typedef clockid t clockid t ;


# 129 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / t i m e t . h” 1 3 4
# 10 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / t i m e t . h” 3 4
typedef time t time t ;
# 130 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / t i m e r t . h” 1 3 4

typedef timer t timer t ;


# 131 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 2 3 4
# 144 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 3 4
# 1 ” / u s r / l i b / g c c / x86 64−l i n u x −gnu /11/ i n c l u d e / s t d d e f . h” 1 3 4
# 145 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 2 3 4

typedef unsigned long int u l o n g ;


typedef unsigned short int u s h o r t ;
typedef unsigned int u i n t ;

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / s t d i n t −i n t n . h” 1 3 4


# 24 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / s t d i n t −i n t n . h” 3 4
Page 27 of 45
Division of Labour in gcc’s Working

typedef int8 t int8 t ;


typedef int16 t int16 t ;
typedef int32 t int32 t ;
typedef int64 t int64 t ;
# 156 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 2 3 4

typedef uint8 t u int8 t ;


typedef uint16 t u int16 t ;
typedef uint32 t u int32 t ;
typedef uint64 t u int64 t ;

typedef int r e g i s t e r t attribute (( mode ( word ) ) ) ;


# 176 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 3 4
# 1 ” / u s r / i n c l u d e / e n d i a n . h” 1 3 4
# 24 ” / u s r / i n c l u d e / e n d i a n . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / e n d i a n . h” 1 3 4
# 35 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / e n d i a n . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / e n d i a n n e s s . h” 1 3 4
# 36 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / e n d i a n . h” 2 3 4
# 25 ” / u s r / i n c l u d e / e n d i a n . h” 2 3 4
# 35 ” / u s r / i n c l u d e / e n d i a n . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / byteswap . h” 1 3 4
# 33 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / byteswap . h” 3 4
static inline uint16 t
bswap 16 ( u i n t 1 6 t bsx )
{

return builtin bswap16 ( bsx ) ;

static inline uint32 t


bswap 32 ( u i n t 3 2 t bsx )
{

return builtin bswap32 ( bsx ) ;

}
# 69 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / byteswap . h” 3 4
extension static inline uint64 t
bswap 64 ( u i n t 6 4 t bsx )
{

return builtin bswap64 ( bsx ) ;

}
# 36 ” / u s r / i n c l u d e / e n d i a n . h” 2 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / uintn −i d e n t i t y . h” 1 3 4
# 32 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / uintn −i d e n t i t y . h” 3 4
static inline uint16 t
uint16 identity ( uint16 t x)
{
return x;
}

static inline uint32 t


Page 28 of 45
Division of Labour in gcc’s Working

uint32 identity ( uint32 t x)


{
return x;
}

static inline uint64 t


uint64 identity ( uint64 t x)
{
return x;
}
# 37 ” / u s r / i n c l u d e / e n d i a n . h” 2 3 4
# 177 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 2 3 4

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / s e l e c t . h” 1 3 4


# 30 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / s e l e c t . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / s e l e c t . h” 1 3 4
# 31 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / s e l e c t . h” 2 3 4

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / s i g s e t t . h” 1 3 4

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / s i g s e t t . h” 1 3 4

typedef struct
{
unsigned long int v a l [ ( 1 0 2 4 / ( 8 ∗ s i z e o f ( unsigned long int ) ) ) ] ;
} sigset t ;
# 5 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / s i g s e t t . h” 2 3 4

typedef sigset t sigset t ;


# 34 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / s e l e c t . h” 2 3 4

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / s t r u c t t i m e v a l . h” 1 3 4

struct t i m e v a l
{

time t tv sec ;
suseconds t tv usec ;

};
# 38 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / s e l e c t . h” 2 3 4

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / s t r u c t t i m e s p e c . h” 1 3 4


# 11 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / s t r u c t t i m e s p e c . h” 3 4
struct t i m e s p e c
{

time t tv sec ;
Page 29 of 45
Division of Labour in gcc’s Working

s y s c a l l s l o n g t tv nsec ;
# 31 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / t y p e s / s t r u c t t i m e s p e c . h” 3 4
};
# 40 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / s e l e c t . h” 2 3 4

typedef suseconds t suseconds t ;

typedef long int fd mask ;


# 59 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / s e l e c t . h” 3 4
typedef struct
{

fd mask f d s b i t s [ 1 0 2 4 / ( 8 ∗ ( int ) s i z e o f ( fd mask ) ) ] ;

} fd set ;

typedef f d m a s k fd mask ;
# 91 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / s e l e c t . h” 3 4

# 102 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / s e l e c t . h” 3 4


extern int s e l e c t ( int nfds , fd set ∗ r e s t r i c t readfds ,
fd set ∗ restrict writefds ,
fd set ∗ restrict exceptfds ,
struct t i m e v a l ∗ r e s t r i c t timeout ) ;
# 127 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / s e l e c t . h” 3 4
extern int p s e l e c t ( int nfds , fd set ∗ r e s t r i c t readfds ,
fd set ∗ restrict writefds ,
fd set ∗ restrict exceptfds ,
const struct t i m e s p e c ∗ r e s t r i c t timeout ,
const sigset t ∗ restrict sigmask ) ;
# 153 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / s e l e c t . h” 3 4

# 180 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 2 3 4

typedef blksize t blksize t ;

typedef blkcnt t blkcnt t ;

Page 30 of 45
Division of Labour in gcc’s Working

typedef fsblkcnt t fsblkcnt t ;

typedef fsfilcnt t fsfilcnt t ;


# 227 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / p t h r e a d t y p e s . h” 1 3 4
# 23 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / p t h r e a d t y p e s . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / thread −shared −t y p e s . h” 1 3 4
# 44 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / thread −shared −t y p e s . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / p t h r e a d t y p e s −a r c h . h” 1 3 4
# 21 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / p t h r e a d t y p e s −a r c h . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / w o r d s i z e . h” 1 3 4
# 22 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / p t h r e a d t y p e s −a r c h . h” 2 3 4
# 45 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / thread −shared −t y p e s . h” 2 3 4

# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / a t o m i c w i d e c o u n t e r . h” 1 3 4


# 25 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / a t o m i c w i d e c o u n t e r . h” 3 4
typedef union
{
extension unsigned long long int value64 ;
struct
{
unsigned int low ;
unsigned int high ;
} value32 ;
} atomic wide counter ;
# 47 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / thread −shared −t y p e s . h” 2 3 4

typedef struct pthread internal list


{
struct pthread internal list ∗ prev ;
struct pthread internal list ∗ next ;
} pthread list t ;

typedef struct pthread internal slist


{
struct pthread internal slist ∗ next ;
} pthread slist t ;
# 76 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / thread −shared −t y p e s . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / s t r u c t m u t e x . h” 1 3 4
# 22 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / s t r u c t m u t e x . h” 3 4
struct pthread mutex s
{
int lock ;
unsigned int count ;
int owner ;

unsigned int nusers ;

int kind ;

short spins ;
short elision ;
pthread list t list ;
# 53 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / s t r u c t m u t e x . h” 3 4
};
# 77 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / thread −shared −t y p e s . h” 2 3 4
# 89 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / thread −shared −t y p e s . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / s t r u c t r w l o c k . h” 1 3 4
# 23 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / s t r u c t r w l o c k . h” 3 4
struct pthread rwlock arch t
{
Page 31 of 45
Division of Labour in gcc’s Working

unsigned int readers ;


unsigned int writers ;
unsigned int wrphase futex ;
unsigned int writers futex ;
unsigned int pad3 ;
unsigned int pad4 ;

int cur writer ;


int shared ;
signed char rwelision ;

unsigned char pad1 [ 7 ] ;

unsigned long int pad2 ;

unsigned int flags ;


# 55 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / s t r u c t r w l o c k . h” 3 4
};
# 90 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / thread −shared −t y p e s . h” 2 3 4

struct pthread cond s


{
atomic wide counter wseq ;
atomic wide counter g1 start ;
unsigned int g refs [2] ;
unsigned int g size [2];
unsigned int g1 orig size ;
unsigned int wrefs ;
unsigned int g signals [2];
};

typedef unsigned int tss t ;


typedef unsigned long int thrd t ;

typedef struct
{
int data ;
} once flag ;
# 24 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / p t h r e a d t y p e s . h” 2 3 4

typedef unsigned long int p t h r e a d t ;

typedef union
{
char size [4];
int align ;
} pthread mutexattr t ;

typedef union
{
char size [4];
int align ;
} pthread condattr t ;
Page 32 of 45
Division of Labour in gcc’s Working

typedef unsigned int p t h r e a d k e y t ;

typedef int p t h r e a d o n c e t ;

union p t h r e a d a t t r t
{
char size [56];
long int align ;
};

typedef union p t h r e a d a t t r t p t h r e a d a t t r t ;

typedef union
{
struct pthread mutex s data ;
char size [40];
long int align ;
} pthread mutex t ;

typedef union
{
struct pthread cond s data ;
char size [48];
extension long long int align ;
} pthread cond t ;

typedef union
{
struct pthread rwlock arch t data ;
char size [56];
long int align ;
} pthread rwlock t ;

typedef union
{
char size [8];
long int align ;
} pthread rwlockattr t ;

typedef v o l a t i l e int p t h r e a d s p i n l o c k t ;

typedef union
{
char size [32];
long int align ;
} pthread barrier t ;

typedef union
Page 33 of 45
Division of Labour in gcc’s Working

{
char size [4];
int align ;
} pthread barrierattr t ;
# 228 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ s y s / t y p e s . h” 2 3 4

# 396 ” / u s r / i n c l u d e / s t d l i b . h” 2 3 4

extern long int random ( void ) attribute (( nothrow , leaf ));

extern void srandom ( unsigned int seed ) attribute (( nothrow ,


leaf )) ;

extern char ∗ i n i t s t a t e ( unsigned int s e e d , char ∗ statebuf ,


size t statelen ) attribute (( nothrow , leaf )) attribute
(( nonnull (2) ) ) ;

extern char ∗ s e t s t a t e ( char ∗ s t a t e b u f ) attribute (( nothrow ,


leaf )) attribute (( nonnull (1) ) ) ;

struct random data


{
int32 t ∗ fptr ;
int32 t ∗ rptr ;
int32 t ∗ state ;
int r a n d t y p e ;
int r a n d d e g ;
int r a n d s e p ;
i nt 32 t ∗ end ptr ;
};

extern int random r ( struct random data ∗ r e s t r i c t buf ,


int32 t ∗ restrict result ) attribute (( nothrow , leaf ))
attribute (( nonnull (1 , 2) ) ) ;

extern int srandom r ( unsigned int s e e d , struct random data ∗ b u f )


attribute (( nothrow , leaf )) attribute (( nonnull (2) )
);

extern int i n i t s t a t e r ( unsigned int s e e d , char ∗ r e s t r i c t statebuf ,


size t statelen ,
struct random data ∗ r e s t r i c t buf )
attribute (( nothrow , leaf )) attribute (( nonnull (2 ,
4) ) ) ;

extern int s e t s t a t e r ( char ∗ r e s t r i c t statebuf ,


struct random data ∗ r e s t r i c t buf )
attribute (( nothrow , leaf )) attribute (( nonnull (1 ,
2) ) ) ;
Page 34 of 45
Division of Labour in gcc’s Working

extern int rand ( void ) attribute (( nothrow , leaf ));

extern void s r a n d ( unsigned int seed ) attribute (( nothrow , leaf


));

extern int r a n d r ( unsigned int ∗ seed ) attribute (( nothrow ,


leaf )) ;

extern double drand48 ( void ) attribute (( nothrow , leaf ));


extern double erand48 ( unsigned short int xsubi [ 3 ] ) attribute ((
nothrow , leaf )) attribute (( nonnull (1) ) ) ;

extern long int l r a n d 4 8 ( void ) attribute (( nothrow , leaf ));


extern long int nrand48 ( unsigned short int xsubi [ 3 ] )
attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);

extern long int mrand48 ( void ) attribute (( nothrow , leaf ));


extern long int j r a n d 4 8 ( unsigned short int xsubi [ 3 ] )
attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);

extern void s r a n d 4 8 ( long int seedval ) attribute (( nothrow ,


leaf )) ;
extern unsigned short int ∗ s e e d 4 8 ( unsigned short int seed16v [ 3 ] )
attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);
extern void l c o n g 4 8 ( unsigned short int param [ 7 ] ) attribute ((
nothrow , leaf )) attribute (( nonnull (1) ) ) ;

struct d r a n d 4 8 d a t a
{
unsigned short int x [3];
unsigned short int old x [ 3 ] ;
unsigned short int c;
unsigned short int init ;
extension unsigned long long int a;

};

extern int d r a n d 4 8 r ( struct d r a n d 4 8 d a t a ∗ r e s t r i c t buffer ,


double ∗ r e s t r i c t result ) attribute (( nothrow , leaf ))
attribute (( nonnull (1 , 2) ) ) ;
extern int e r a n d 4 8 r ( unsigned short int xsubi [3] ,
struct d r a n d 4 8 d a t a ∗ r e s t r i c t buffer ,
double ∗ r e s t r i c t result ) attribute (( nothrow , leaf ))
attribute (( nonnull (1 , 2) ) ) ;

Page 35 of 45
Division of Labour in gcc’s Working

extern int l r a n d 4 8 r ( struct d r a n d 4 8 d a t a ∗ r e s t r i c t buffer ,


long int ∗ r e s t r i c t result )
attribute (( nothrow , leaf )) attribute (( nonnull (1 ,
2) ) ) ;
extern int n r a n d 4 8 r ( unsigned short int xsubi [3] ,
struct d r a n d 4 8 d a t a ∗ r e s t r i c t buffer ,
long int ∗ r e s t r i c t result )
attribute (( nothrow , leaf )) attribute (( nonnull (1 ,
2) ) ) ;

extern int mrand48 r ( struct d r a n d 4 8 d a t a ∗ r e s t r i c t buffer ,


long int ∗ r e s t r i c t result )
attribute (( nothrow , leaf )) attribute (( nonnull (1 ,
2) ) ) ;
extern int j r a n d 4 8 r ( unsigned short int xsubi [3] ,
struct d r a n d 4 8 d a t a ∗ r e s t r i c t buffer ,
long int ∗ r e s t r i c t result )
attribute (( nothrow , leaf )) attribute (( nonnull (1 ,
2) ) ) ;

extern int s r a n d 4 8 r ( long int s e e d v a l , struct d r a n d 4 8 d a t a ∗ b u f f e r )


attribute (( nothrow , leaf )) attribute (( nonnull (2) )
);

extern int s e e d 4 8 r ( unsigned short int seed16v [ 3 ] ,


struct d r a n d 4 8 d a t a ∗ b u f f e r ) attribute (( nothrow , leaf ))
attribute (( nonnull (1 , 2) ) ) ;

extern int l c o n g 4 8 r ( unsigned short int param [ 7 ] ,


struct d r a n d 4 8 d a t a ∗ b u f f e r )
attribute (( nothrow , leaf )) attribute (( nonnull (1 ,
2) ) ) ;

extern void ∗ m a l l o c ( s i z e t size ) attribute (( nothrow , leaf ))


attribute (( malloc ) )
attribute (( a l l o c s i z e (1) ) ) ;

extern void ∗ c a l l o c ( s i z e t nmemb , s i z e t size )


attribute (( nothrow , leaf )) attribute (( malloc ))
attribute (( a l l o c s i z e (1 , 2) ) ) ;

extern void ∗ r e a l l o c ( void ∗ p t r , s i z e t size )


attribute (( nothrow , leaf )) attribute ((
warn unused result ) ) attribute (( a l l o c s i z e (2) ) ) ;

extern void f r e e ( void ∗ ptr ) attribute (( nothrow , leaf ));

extern void ∗ r e a l l o c a r r a y ( void ∗ p t r , s i z e t nmemb , s i z e t size )


attribute (( nothrow , leaf )) attribute ((
warn unused result ) )
attribute (( a l l o c s i z e (2 , 3) ) )
Page 36 of 45
Division of Labour in gcc’s Working

attribute (( malloc ( b u i l t i n f r e e , 1) ) ) ;

extern void ∗ r e a l l o c a r r a y ( void ∗ p t r , s i z e t nmemb , s i z e t size )


attribute (( nothrow , leaf )) attribute (( malloc (
r e a l l o c a r r a y , 1) ) ) ;

# 1 ” / u s r / i n c l u d e / a l l o c a . h” 1 3 4
# 24 ” / u s r / i n c l u d e / a l l o c a . h” 3 4
# 1 ” / u s r / l i b / g c c / x86 64−l i n u x −gnu /11/ i n c l u d e / s t d d e f . h” 1 3 4
# 25 ” / u s r / i n c l u d e / a l l o c a . h” 2 3 4

extern void ∗ a l l o c a ( s i z e t size ) attribute (( nothrow , leaf ));

# 575 ” / u s r / i n c l u d e / s t d l i b . h” 2 3 4

extern void ∗ v a l l o c ( s i z e t size ) attribute (( nothrow , leaf ))


attribute (( malloc ) )
attribute (( a l l o c s i z e (1) ) ) ;

extern int p o s i x m e m a l i g n ( void ∗∗ memptr , s i z e t alignment , s i z e t size )


attribute (( nothrow , leaf )) attribute (( nonnull (1) )
) ;

extern void ∗ a l i g n e d a l l o c ( s i z e t alignment , s i z e t size )


attribute (( nothrow , leaf )) attribute (( malloc ))
attribute (( a l l o c a l i g n (1) ) )
attribute (( a l l o c s i z e (2) ) ) ;

extern void a b o r t ( void ) attribute (( nothrow , leaf ))


attribute (( noreturn ) ) ;

extern int a t e x i t ( void ( ∗ f u n c ) ( void ) ) attribute (( nothrow ,


leaf )) attribute (( nonnull (1) ) ) ;

extern int a t q u i c k e x i t ( void ( ∗ f u n c ) ( void ) ) attribute (( nothrow ,


Page 37 of 45
Division of Labour in gcc’s Working

leaf )) attribute (( nonnull (1) ) ) ;

extern int o n e x i t ( void ( ∗ f u n c ) ( int s t a t u s , void ∗ a r g ) , void ∗ a r g )


attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);

extern void e x i t ( int status ) attribute (( nothrow , leaf ))


attribute (( noreturn ) ) ;

extern void q u i c k e x i t ( int status ) attribute (( nothrow , leaf ))


attribute (( noreturn ) ) ;

extern void E x i t ( int status ) attribute (( nothrow , leaf ))


attribute (( noreturn ) ) ;

extern char ∗ g e t e n v ( const char ∗ name ) attribute (( nothrow ,


leaf )) attribute (( nonnull (1) ) ) ;
# 654 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern int putenv ( char ∗ s t r i n g ) attribute (( nothrow , leaf ))
attribute (( nonnull (1) ) ) ;

extern int s e t e n v ( const char ∗ name , const char ∗ v a l u e , int replace )


attribute (( nothrow , leaf )) attribute (( nonnull (2) )
);

extern int u n s e t e n v ( const char ∗ name ) attribute (( nothrow ,


leaf )) attribute (( nonnull (1) ) ) ;

extern int c l e a r e n v ( void ) attribute (( nothrow , leaf )) ;


# 682 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern char ∗mktemp ( char ∗ t e m p l a t e ) attribute (( nothrow , leaf )
) attribute (( nonnull (1) ) ) ;
# 695 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern int mkstemp ( char ∗ t e m p l a t e ) attribute (( nonnull (1) ) ) ;
# 717 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern int mkstemps ( char ∗ t e m p l a t e , int suffixlen ) attribute ((
nonnull (1) ) ) ;
# 738 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern char ∗mkdtemp ( char ∗ t e m p l a t e ) attribute (( nothrow , leaf
Page 38 of 45
Division of Labour in gcc’s Working

)) attribute (( nonnull (1) ) ) ;


# 791 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern int system ( const char ∗ command ) ;
# 808 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern char ∗ r e a l p a t h ( const char ∗ r e s t r i c t name ,
char ∗ r e s t r i c t resolved ) attribute (( nothrow , leaf ))
;

typedef int ( ∗ c o m p a r f n t ) ( const void ∗ , const void ∗ ) ;


# 828 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern void ∗ b s e a r c h ( const void ∗ k e y , const void ∗ b a s e ,
size t nmemb , s i z e t size , compar fn t compar )
attribute (( nonnull (1 , 2 , 5) ) ) ;

extern void q s o r t ( void ∗ b a s e , s i z e t nmemb , s i z e t size ,


compar fn t compar ) attribute (( nonnull (1 , 4) ) ) ;
# 848 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern int abs ( int x) attribute (( nothrow , leaf ))
attribute (( const ) ) ;
extern long int l a b s ( long int x) attribute (( nothrow , leaf ))
attribute (( const ) ) ;

extension extern long long int l l a b s ( long long int x)


attribute (( nothrow , leaf )) attribute (( const )) ;

extern d i v t d i v ( int numer , int denom )


attribute (( nothrow , leaf )) attribute (( const )) ;
extern l d i v t l d i v ( long int numer , long int denom )
attribute (( nothrow , leaf )) attribute (( const )) ;

extension extern l l d i v t l l d i v ( long long int numer ,


long long int denom )
attribute (( nothrow , leaf )) attribute (( const ) ) ;
# 880 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern char ∗ e c v t ( double v a l u e , int n d i g i t , int ∗ r e s t r i c t decpt ,
int ∗ r e s t r i c t sign ) attribute (( nothrow , leaf ))
attribute (( nonnull (3 , 4) ) ) ;

extern char ∗ f c v t ( double v a l u e , int n d i g i t , int ∗ restrict decpt ,


int ∗ r e s t r i c t sign ) attribute (( nothrow , leaf ))
attribute (( nonnull (3 , 4) ) ) ;

extern char ∗ g c v t ( double v a l u e , int n d i g i t , char ∗ b u f )


attribute (( nothrow , leaf )) attribute (( nonnull (3) )
) ;
Page 39 of 45
Division of Labour in gcc’s Working

extern char ∗ q e c v t ( long double v a l u e , int ndigit ,


int ∗ r e s t r i c t d e c p t , int ∗ r e s t r i c t sign )
attribute (( nothrow , leaf )) attribute (( nonnull (3 ,
4) ) ) ;
extern char ∗ q f c v t ( long double v a l u e , int ndigit ,
int ∗ r e s t r i c t d e c p t , int ∗ r e s t r i c t sign )
attribute (( nothrow , leaf )) attribute (( nonnull (3 ,
4) ) ) ;
extern char ∗ q g c v t ( long double v a l u e , int n d i g i t , char ∗ b u f )
attribute (( nothrow , leaf )) attribute (( nonnull (3) )
) ;

extern int e c v t r ( double v a l u e , int ndigit , int ∗ r e s t r i c t decpt ,


int ∗ r e s t r i c t s i g n , char ∗ r e s t r i c t buf ,
size t len ) attribute (( nothrow , leaf )) attribute ((
nonnull (3 , 4 , 5) ) ) ;
extern int f c v t r ( double v a l u e , int ndigit , int ∗ r e s t r i c t decpt ,
int ∗ r e s t r i c t s i g n , char ∗ r e s t r i c t buf ,
size t len ) attribute (( nothrow , leaf )) attribute ((
nonnull (3 , 4 , 5) ) ) ;

extern int q e c v t r ( long double v a l u e , int ndigit ,


int ∗ r e s t r i c t d e c p t , int ∗ r e s t r i c t sign ,
char ∗ r e s t r i c t buf , s i z e t len )
attribute (( nothrow , leaf )) attribute (( nonnull (3 ,
4 , 5) ) ) ;
extern int q f c v t r ( long double v a l u e , int ndigit ,
int ∗ r e s t r i c t d e c p t , int ∗ r e s t r i c t sign ,
char ∗ r e s t r i c t buf , s i z e t len )
attribute (( nothrow , leaf )) attribute (( nonnull (3 ,
4 , 5) ) ) ;

extern int mblen ( const char ∗ s , size t n) attribute (( nothrow ,


leaf )) ;

extern int mbtowc ( w c h a r t ∗ restrict pwc ,


const char ∗ r e s t r i c t s , size t n) attribute (( nothrow ,
leaf )) ;

extern int wctomb ( char ∗ s , wchar t wchar ) attribute (( nothrow ,


leaf )) ;

extern s i z e t mbstowcs ( w c h a r t ∗ r e s t r i c t pwcs ,


const char ∗ r e s t r i c t s , size t n) attribute (( nothrow ,
leaf ))
attribute (( access ( read only , 2) ) ) ;

extern s i z e t wcstombs ( char ∗ r e s t r i c t s ,


const w c h a r t ∗ r e s t r i c t pwcs , s i z e t n)
attribute (( nothrow , leaf ))
attribute (( access ( write only , 1 , 3) ) )
attribute (( access ( r e a d o n l y , 2) ) ) ;

Page 40 of 45
Division of Labour in gcc’s Working

extern int rpmatch ( const char ∗ r e s p o n s e ) attribute (( nothrow ,


leaf )) attribute (( nonnull (1) ) ) ;
# 967 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern int g e t s u b o p t ( char ∗∗ r e s t r i c t optionp ,
char ∗ const ∗ r e s t r i c t tokens ,
char ∗∗ r e s t r i c t valuep )
attribute (( nothrow , leaf )) attribute (( nonnull (1 ,
2 , 3) ) ) ;
# 1013 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
extern int g e t l o a d a v g ( double l o a d a v g [ ] , int nelem )
attribute (( nothrow , leaf )) attribute (( nonnull (1) )
);
# 1023 ” / u s r / i n c l u d e / s t d l i b . h” 3 4
# 1 ” / u s r / i n c l u d e / x86 64−l i n u x −gnu/ b i t s / s t d l i b −f l o a t . h” 1 3 4
# 1024 ” / u s r / i n c l u d e / s t d l i b . h” 2 3 4
# 1035 ” / u s r / i n c l u d e / s t d l i b . h” 3 4

# 3 ” euclid . c” 2

# 3 ” euclid . c”
int g l o b a l C o u n t = 0 ;
int gcd ( int a , int b ) {
g l o b a l C o u n t++;
i f ( a>0 && b>0) {
i f ( a>b ) return gcd ( b , a−b ) ;
e l s e i f ( b>a ) return gcd ( a , b−a ) ;
e l s e return a ;
}
e l s e return a ;
}
int main ( int argc , char ∗ argv [ ] ) {
int a = 1 0 , b = 1 5 ;
i f ( argc >1) {
a = a t o i ( argv [ 1 ] ) ;
i f ( argc >2) b = a t o i ( argv [ 2 ] ) ;
}
p r i n t f ( ” gcd ( a = %d , b = %d ) = %d ; ” , a , b , gcd ( a , b ) ) ;
p r i n t f ( ” o b t a i n e d i n %d i t e r a t i o n s . \ n” , g l o b a l C o u n t ) ;
return 0 ;
}

B.1.2 The Assembly Output


Typically obtained by cc1. Actually all the outputs in this appendix were generated by a single command

gcc -v -fverbose-asm -save-temps euclid.c 2>&1 | tee euclid-gcc-output.txt

The -fverbose-asm option puts extra commentary information in the generated assembly code to make it
more readable. This option is generally only of use to those who actually need to read the generated assembly
code (perhaps while debugging the compiler itself). The added comments include:

* information on the compiler version and command-line options,

* the source code lines associated with the assembly instructions, in the form
FILENAME:LINENUMBER:CONTENT OF LINE,

* hints on which high-level expressions correspond to the various assembly instruction operands.

.file ”euclid.c”
# GNU C17 ( Ubuntu 11 . 4 . 0 −1ubuntu1 ˜22 . 0 4 ) v e r s i o n 11 . 4 . 0 ( x86 64−l i n u x −gnu )
# c o m p i l e d by GNU C v e r s i o n 11 . 4 . 0 , GMP v e r s i o n 6 . 2 . 1 , MPFR v e r s i o n 4
. 1 . 0 , MPC v e r s i o n 1 . 2 . 1 , i s l v e r s i o n i s l −0. 2 4 −GMP

# GGC h e u r i s t i c s : −−param ggc−min−expand=100 −−param ggc−min−h e a p s i z e =131072


# o p t i o n s p a s s e d : −mtune=g e n e r i c −march=x86 −64 −f a s y n c h r o n o u s −unwind−t a b l e s −
f s t a c k −p r o t e c t o r −s t r o n g −f s t a c k −c l a s h −p r o t e c t i o n −f c f −p r o t e c t i o n
.text
Page 41 of 45
Division of Labour in gcc’s Working

. g l o b l globalCount
.bss
.align 4
.type globalCount , @object
.size globalCount , 4
globalCount :
.zero 4
.text
. g l o b l gcd
.type gcd , @ f u n c t i o n
gcd :
.LFB6 :
.cfi startproc
endbr64
pushq %rbp #
. c f i d e f c f a o f f s e t 16
. c f i o f f s e t 6 , −16
movq %rsp , %rbp #,
.cfi def cfa register 6
subq $16 , %r s p #,
movl %edi , −4(%rbp ) # a , a
movl %e s i , −8(%rbp ) # b , b
# euclid.c :5: g l o b a l C o u n t++;
movl g l o b a l C o u n t(% r i p ) , %eax # globalCount , g l o b a l C o u n t . 0 1
addl $1 , %eax #, 2
movl %eax , g l o b a l C o u n t(% r i p ) # 2 , g l o b a l C o u n t
# euclid.c :6: i f ( a>0 && b>0) {
cmpl $0 , −4(%rbp ) #, a
jle .L 2 #,
# euclid.c :6: i f ( a>0 && b>0) {
cmpl $0 , −8(%rbp ) #, b
jle .L 2 #,
# euclid.c :7: i f ( a>b ) r e t u r n gcd ( b , a−b ) ;
movl −4(%rbp ) , %eax # a , tmp88
cmpl −8(%rbp ) , %eax # b , tmp88
jle .L 3 #,
# euclid.c :7: i f ( a>b ) r e t u r n gcd ( b , a−b ) ;
movl −4(%rbp ) , %eax # a , tmp89
subl −8(%rbp ) , %eax # b , tmp89
movl %eax , %edx # tmp89 , 3
movl −8(%rbp ) , %eax # b , tmp90
movl %edx , %e s i # 3,
movl %eax , %edi # tmp90 ,
call gcd #
jmp .L 4 #
.L 3 :
# euclid.c :8: e l s e i f ( b>a ) r e t u r n gcd ( a , b−a ) ;
movl −8(%rbp ) , %eax # b , tmp91
cmpl −4(%rbp ) , %eax # a , tmp91
jle .L 5 #,
# euclid.c :8: e l s e i f ( b>a ) r e t u r n gcd ( a , b−a ) ;
movl −8(%rbp ) , %eax # b , tmp92
subl −4(%rbp ) , %eax # a , tmp92
movl %eax , %edx # tmp92 , 4
movl −4(%rbp ) , %eax # a , tmp93
movl %edx , %e s i # 4,
movl %eax , %edi # tmp93 ,
call gcd #
jmp .L 4 #
.L 5 :
# euclid.c :9: else return a ;
movl −4(%rbp ) , %eax # a , 5
jmp .L 4 #
.L 2 :
# e u c l i d . c : 1 1 : else return a ;
movl −4(%rbp ) , %eax # a , 5
.L 4 :
# euclid.c :12: }
leave
Page 42 of 45
Division of Labour in gcc’s Working

.cfi def cfa 7, 8


ret
.cfi endproc
.LFE6 :
.size gcd , . −gcd
.section .rodata
.LC0 :
. s t r i n g ” gcd ( a = %d , b = %d ) = %d ; ”
.LC1 :
. s t r i n g ” o b t a i n e d i n %d i t e r a t i o n s . \n”
.text
. g l o b l main
.type main , @ f u n c t i o n
main :
.LFB7 :
.cfi startproc
endbr64
pushq %rbp #
. c f i d e f c f a o f f s e t 16
. c f i o f f s e t 6 , −16
movq %rsp , %rbp #,
.cfi def cfa register 6
subq $32 , %r s p #,
movl %edi , −20(%rbp ) # argc , a r g c
movq %r s i , −32(%rbp ) # argv , argv
# e u c l i d . c : 1 4 : int a = 1 0 , b = 15 ;
movl $10 , −8(%rbp ) #, a
# e u c l i d . c : 1 4 : int a = 1 0 , b = 15 ;
movl $15 , −4(%rbp ) #, b
# euclid.c :15: i f ( argc >1) {
cmpl $1 , −20(%rbp ) #, a r g c
jle .L 7 #,
# euclid.c :16: a = a t o i ( argv [ 1 ] ) ;
movq −32(%rbp ) , %rax # argv , tmp90
addq $8 , %rax #, 1
# euclid.c :16: a = a t o i ( argv [ 1 ] ) ;
movq (%rax ) , %rax # ∗ 1, 2
movq %rax , %r d i # 2,
call atoi@PLT #
movl %eax , −8(%rbp ) # tmp91 , a
# euclid.c :17: i f ( argc >2) b = a t o i ( argv [ 2 ] ) ;
cmpl $2 , −20(%rbp ) #, a r g c
jle .L 7 #,
# euclid.c :17: i f ( argc >2) b = a t o i ( argv [ 2 ] ) ;
movq −32(%rbp ) , %rax # argv , tmp92
addq $16 , %rax #, 3
# euclid.c :17: i f ( argc >2) b = a t o i ( argv [ 2 ] ) ;
movq (%rax ) , %rax # ∗ 3, 4
movq %rax , %r d i # 4,
call atoi@PLT #
movl %eax , −4(%rbp ) # tmp93 , b
.L 7 :
# euclid.c :19: p r i n t f ( ” gcd ( a = %d , b = %d ) = %d ; ” , a , b , gcd ( a , b ) ) ;
movl −4(%rbp ) , %edx # b , tmp94
movl −8(%rbp ) , %eax # a , tmp95
movl %edx , %e s i # tmp94 ,
movl %eax , %edi # tmp95 ,
call gcd #
movl %eax , %ecx #, 5
movl −4(%rbp ) , %edx # b , tmp96
movl −8(%rbp ) , %eax # a , tmp97
movl %eax , %e s i # tmp97 ,
leaq .LC0(% r i p ) , %rax #, tmp98
movq %rax , %r d i # tmp98 ,
movl $0 , %eax #,
call printf@PLT #
# euclid.c :20: p r i n t f ( ” o b t a i n e d i n %d i t e r a t i o n s . \n” , g l o b a l C o u n t ) ;
movl g l o b a l C o u n t(% r i p ) , %eax # globalCount , g l o b a l C o u n t . 1 6
movl %eax , %e s i # globalCount.1 6 ,
Page 43 of 45
Division of Labour in gcc’s Working

leaq .LC1(% r i p ) , %rax #, tmp99


movq %rax , %r d i # tmp99 ,
movl $0 , %eax #,
call printf@PLT #
# e u c l i d . c : 2 1 : return 0 ;
movl $0 , %eax #, 1 9
# euclid.c :22: }
leave
.cfi def cfa 7, 8
ret
.cfi endproc
.LFE7 :
.size main , . −main
. i d e n t ”GCC: ( Ubuntu 11 . 4 . 0 −1ubuntu1 ˜22 . 0 4 ) 11 . 4 . 0 ”
.section .note.GNU−s t a c k , ” ” , @ p r o g b i t s
.section . n o t e . g n u . p r o p e r t y , ”a”
.align 8
.long 1f − 0f
.long 4f − 1f
.long 5
0:
. s t r i n g ”GNU”
1:
.align 8
.long 0 xc0000002
.long 3f − 2f
2:
.long 0 x3
3:
.align 8
4:

Page 44 of 45
Bibliography

[T1] Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman. 2006. Compilers: Principles, Tech-
niques, and Tools (2nd Edition). Addison-Wesley Longman Publishing Co., Inc., USA.
[R1] Niklaus Wirth. 1996. Compiler construction. Addison Wesley Longman Publishing Co., Inc., USA.

[R2] Dick Grune, Kees van Reeuwijk, Henri E. Bal, Ceriel J.H. Jacobs, and Koen Langendoen. 2012. Modern
Compiler Design (2nd. ed.). Springer Publishing Company, Incorporated.
[M1] Thomas Niemann. A Guide to Lex & Yacc.
E-book, available at https://arcb.csc.ncsu.edu/m̃ueller/codeopt/codeopt00/y man.pdf

[M2] Info pages or pdf manuals from the SourceForge or other GNU-FSF sources for gcc, lex (flex),
yacc (bison), binutils, findutils, Common Lisp or Python.

You might also like