<s>
A	O
decompiler	B-Application
is	O
a	O
computer	B-Application
program	I-Application
that	O
translates	O
an	O
executable	B-Application
file	I-Application
to	O
high-level	O
source	O
code	O
.	O
</s>
<s>
It	O
does	O
therefore	O
the	O
opposite	O
of	O
a	O
typical	O
compiler	B-Language
,	O
which	O
translates	O
a	O
high-level	B-Language
language	I-Language
to	O
a	O
low-level	O
language	O
.	O
</s>
<s>
While	O
disassemblers	O
translate	B-Application
an	O
executable	B-Application
into	O
assembly	B-Language
language	I-Language
,	O
decompilers	B-Application
go	O
a	O
step	O
further	O
and	O
translate	B-Application
the	O
code	O
into	O
a	O
higher	O
level	O
language	O
such	O
as	O
C	B-Language
or	O
Java	B-Language
,	O
requiring	O
more	O
sophisticated	O
techniques	O
.	O
</s>
<s>
Decompilers	B-Application
are	O
usually	O
unable	O
to	O
perfectly	O
reconstruct	O
the	O
original	O
source	O
code	O
,	O
thus	O
will	O
frequently	O
produce	O
obfuscated	O
code	O
.	O
</s>
<s>
Nonetheless	O
,	O
they	O
remain	O
an	O
important	O
tool	O
in	O
the	O
reverse	O
engineering	O
of	O
computer	B-Application
software	I-Application
.	O
</s>
<s>
The	O
term	O
decompiler	B-Application
is	O
most	O
commonly	O
applied	O
to	O
a	O
program	O
which	O
translates	O
executable	B-Application
programs	I-Application
(	O
the	O
output	O
from	O
a	O
compiler	B-Language
)	O
into	O
source	O
code	O
in	O
a	O
(	O
relatively	O
)	O
high	B-Language
level	I-Language
language	I-Language
which	O
,	O
when	O
compiled	B-Language
,	O
will	O
produce	O
an	O
executable	B-Application
whose	O
behavior	O
is	O
the	O
same	O
as	O
the	O
original	O
executable	B-Application
program	I-Application
.	O
</s>
<s>
By	O
comparison	O
,	O
a	O
disassembler	O
translates	O
an	O
executable	B-Application
program	I-Application
into	O
assembly	B-Language
language	I-Language
(	O
and	O
an	O
assembler	B-Language
could	O
be	O
used	O
for	O
assembling	O
it	O
back	O
into	O
an	O
executable	B-Application
program	I-Application
)	O
.	O
</s>
<s>
Decompilation	B-Application
is	O
the	O
act	O
of	O
using	O
a	O
decompiler	B-Application
,	O
although	O
the	O
term	O
can	O
also	O
refer	O
to	O
the	O
output	O
of	O
a	O
decompiler	B-Application
.	O
</s>
<s>
It	O
can	O
be	O
used	O
for	O
the	O
recovery	O
of	O
lost	O
source	O
code	O
,	O
and	O
is	O
also	O
useful	O
in	O
some	O
cases	O
for	O
computer	O
security	O
,	O
interoperability	O
and	O
error	B-Error_Name
correction	I-Error_Name
.	O
</s>
<s>
The	O
success	O
of	O
decompilation	B-Application
depends	O
on	O
the	O
amount	O
of	O
information	O
present	O
in	O
the	O
code	O
being	O
decompiled	B-Application
and	O
the	O
sophistication	O
of	O
the	O
analysis	O
performed	O
on	O
it	O
.	O
</s>
<s>
The	O
bytecode	O
formats	O
used	O
by	O
many	O
virtual	O
machines	O
(	O
such	O
as	O
the	O
Java	B-Language
Virtual	I-Language
Machine	I-Language
or	O
the	O
.NET	B-Application
Framework	I-Application
Common	O
Language	O
Runtime	O
)	O
often	O
include	O
extensive	O
metadata	O
and	O
high-level	O
features	O
that	O
make	O
decompilation	B-Application
quite	O
feasible	O
.	O
</s>
<s>
The	O
application	O
of	O
debug	B-Application
data	I-Application
,	O
i.e.	O
</s>
<s>
Machine	B-Language
language	I-Language
without	O
such	O
metadata	O
or	O
debug	B-Application
data	I-Application
is	O
much	O
harder	O
to	O
decompile	B-Application
.	O
</s>
<s>
Some	O
compilers	B-Language
and	O
post-compilation	O
tools	O
produce	O
obfuscated	O
code	O
(	O
that	O
is	O
,	O
they	O
attempt	O
to	O
produce	O
output	O
that	O
is	O
very	O
difficult	O
to	O
decompile	B-Application
,	O
or	O
that	O
decompiles	B-Application
to	O
confusing	O
output	O
)	O
.	O
</s>
<s>
This	O
is	O
done	O
to	O
make	O
it	O
more	O
difficult	O
to	O
reverse	O
engineer	O
the	O
executable	B-Application
.	O
</s>
<s>
While	O
decompilers	B-Application
are	O
normally	O
used	O
to	O
(	O
re	O
-	O
)	O
create	O
source	O
code	O
from	O
binary	B-Application
executables	I-Application
,	O
there	O
are	O
also	O
decompilers	B-Application
to	O
turn	O
specific	O
binary	O
data	O
files	O
into	O
human-readable	O
and	O
editable	O
sources	O
.	O
</s>
<s>
Decompilers	B-Application
can	O
be	O
thought	O
of	O
as	O
composed	O
of	O
a	O
series	O
of	O
phases	O
each	O
of	O
which	O
contributes	O
specific	O
aspects	O
of	O
the	O
overall	O
decompilation	B-Application
process	O
.	O
</s>
<s>
The	O
first	O
decompilation	B-Application
phase	O
loads	O
and	O
parses	O
the	O
input	O
machine	B-Language
code	I-Language
or	O
intermediate	O
language	O
program	O
's	O
binary	O
file	O
format	O
.	O
</s>
<s>
It	O
should	O
be	O
able	O
to	O
discover	O
basic	O
facts	O
about	O
the	O
input	O
program	O
,	O
such	O
as	O
the	O
architecture	O
(	O
Pentium	B-General_Concept
,	O
PowerPC	O
,	O
etc	O
.	O
)	O
</s>
<s>
In	O
many	O
cases	O
,	O
it	O
should	O
be	O
able	O
to	O
find	O
the	O
equivalent	O
of	O
the	O
main	O
function	O
of	O
a	O
C	B-Language
program	I-Language
,	O
which	O
is	O
the	O
start	O
of	O
the	O
user	O
written	O
code	O
.	O
</s>
<s>
This	O
excludes	O
the	O
runtime	O
initialization	O
code	O
,	O
which	O
should	O
not	O
be	O
decompiled	B-Application
if	O
possible	O
.	O
</s>
<s>
If	O
available	O
the	O
symbol	O
tables	O
and	O
debug	B-Application
data	I-Application
are	O
also	O
loaded	O
.	O
</s>
<s>
If	O
it	O
can	O
determine	O
the	O
compiler	B-Language
or	O
compilers	B-Language
used	O
it	O
may	O
provide	O
useful	O
information	O
in	O
identifying	O
code	O
idioms	O
.	O
</s>
<s>
The	O
next	O
logical	O
phase	O
is	O
the	O
disassembly	O
of	O
machine	B-Language
code	I-Language
instructions	O
into	O
a	O
machine	O
independent	O
intermediate	O
representation	O
(	O
IR	O
)	O
.	O
</s>
<s>
Idiomatic	O
machine	B-Language
code	I-Language
sequences	O
are	O
sequences	O
of	O
code	O
whose	O
combined	O
semantics	O
are	O
not	O
immediately	O
apparent	O
from	O
the	O
instructions	O
 '	O
individual	O
semantics	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
x86	B-Language
assembly	I-Language
code	I-Language
:	O
</s>
<s>
For	O
example	O
,	O
the	O
instruction	O
scheduling	O
phase	O
of	O
a	O
compiler	B-Language
may	O
insert	O
other	O
instructions	O
into	O
an	O
idiomatic	O
sequence	O
,	O
or	O
change	O
the	O
ordering	O
of	O
instructions	O
in	O
the	O
sequence	O
.	O
</s>
<s>
Later	O
phases	O
group	O
instruction	O
expressions	O
into	O
more	O
complex	O
expressions	O
,	O
and	O
modify	O
them	O
into	O
a	O
canonical	O
(	O
standardized	O
)	O
form	O
,	O
making	O
it	O
more	O
likely	O
that	O
even	O
the	O
altered	O
idiom	O
will	O
match	O
a	O
higher	O
level	O
pattern	O
later	O
in	O
the	O
decompilation	B-Application
.	O
</s>
<s>
It	O
is	O
particularly	O
important	O
to	O
recognize	O
the	O
compiler	B-Language
idioms	O
for	O
subroutine	O
calls	O
,	O
exception	B-General_Concept
handling	I-General_Concept
,	O
and	O
switch	O
statements	O
.	O
</s>
<s>
The	O
resulting	O
expression	O
is	O
more	O
like	O
high	B-Language
level	I-Language
language	I-Language
,	O
and	O
has	O
also	O
eliminated	O
the	O
use	O
of	O
the	O
machine	O
register	O
eax	O
.	O
</s>
<s>
The	O
decompiler	B-Application
may	O
allow	O
the	O
user	O
to	O
explicitly	O
break	O
such	O
unnatural	O
dependencies	O
which	O
will	O
lead	O
to	O
clearer	O
code	O
.	O
</s>
<s>
A	O
good	O
machine	B-Language
code	I-Language
decompiler	B-Application
will	O
perform	O
type	O
analysis	O
.	O
</s>
<s>
For	O
example	O
,	O
an	O
and	O
instruction	O
implies	O
that	O
the	O
operand	O
is	O
an	O
integer	O
;	O
programs	O
do	O
not	O
use	O
such	O
an	O
operation	O
on	O
floating	B-Algorithm
point	I-Algorithm
values	I-Algorithm
(	O
except	O
in	O
special	O
library	O
code	O
)	O
or	O
on	O
pointers	O
.	O
</s>
<s>
However	O
,	O
it	O
is	O
difficult	O
to	O
distinguish	O
many	O
of	O
the	O
possibilities	O
,	O
because	O
of	O
the	O
freedom	O
that	O
machine	B-Language
code	I-Language
or	O
even	O
some	O
high	B-Language
level	I-Language
languages	I-Language
such	O
as	O
C	B-Language
allow	O
with	O
casts	O
and	O
pointer	O
arithmetic	O
.	O
</s>
<s>
The	O
penultimate	O
decompilation	B-Application
phase	O
involves	O
structuring	O
of	O
the	O
IR	O
into	O
higher	O
level	O
constructs	O
such	O
as	O
while	O
loops	O
and	O
if/then/else	O
conditional	O
statements	O
.	O
</s>
<s>
Unstructured	O
code	O
is	O
more	O
difficult	O
to	O
translate	B-Application
into	O
structured	O
code	O
than	O
already	O
structured	O
code	O
.	O
</s>
<s>
The	O
final	O
phase	O
is	O
the	O
generation	O
of	O
the	O
high	O
level	O
code	O
in	O
the	O
back	O
end	O
of	O
the	O
decompiler	B-Application
.	O
</s>
<s>
Just	O
as	O
a	O
compiler	B-Language
may	O
have	O
several	O
back	O
ends	O
for	O
generating	O
machine	B-Language
code	I-Language
for	O
different	O
architectures	O
,	O
a	O
decompiler	B-Application
may	O
have	O
several	O
back	O
ends	O
for	O
generating	O
high	O
level	O
code	O
in	O
different	O
high	B-Language
level	I-Language
languages	I-Language
.	O
</s>
<s>
Just	O
before	O
code	O
generation	O
,	O
it	O
may	O
be	O
desirable	O
to	O
allow	O
an	O
interactive	O
editing	O
of	O
the	O
IR	O
,	O
perhaps	O
using	O
some	O
form	O
of	O
graphical	B-Application
user	I-Application
interface	I-Application
.	O
</s>
<s>
However	O
,	O
these	O
are	O
almost	O
as	O
easily	O
entered	O
in	O
a	O
post	O
decompilation	B-Application
edit	O
.	O
</s>
<s>
Decompilers	B-Application
using	O
neural	B-Architecture
networks	I-Architecture
have	O
been	O
developed	O
.	O
</s>
<s>
Such	O
a	O
decompiler	B-Application
may	O
be	O
trained	O
by	O
machine	O
learning	O
to	O
improve	O
its	O
accuracy	O
over	O
time	O
.	O
</s>
<s>
The	O
majority	O
of	O
computer	B-Application
programs	I-Application
are	O
covered	O
by	O
copyright	O
laws	O
.	O
</s>
<s>
These	O
rights	O
include	O
the	O
right	O
to	O
make	O
copies	O
,	O
including	O
copies	O
made	O
into	O
the	O
computer	O
’s	O
RAM	B-Architecture
(	O
unless	O
creating	O
such	O
a	O
copy	O
is	O
essential	O
for	O
using	O
the	O
program	O
)	O
.	O
</s>
<s>
Since	O
the	O
decompilation	B-Application
process	O
involves	O
making	O
multiple	O
such	O
copies	O
,	O
it	O
is	O
generally	O
prohibited	O
without	O
the	O
authorization	O
of	O
the	O
copyright	O
holder	O
.	O
</s>
<s>
However	O
,	O
because	O
decompilation	B-Application
is	O
often	O
a	O
necessary	O
step	O
in	O
achieving	O
software	O
interoperability	O
,	O
copyright	O
laws	O
in	O
both	O
the	O
United	O
States	O
and	O
Europe	O
permit	O
decompilation	B-Application
to	O
a	O
limited	O
extent	O
.	O
</s>
<s>
In	O
the	O
United	O
States	O
,	O
the	O
copyright	O
fair	O
use	O
defence	O
has	O
been	O
successfully	O
invoked	O
in	O
decompilation	B-Application
cases	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Sega	O
v	O
.	O
Accolade	O
,	O
the	O
court	O
held	O
that	O
Accolade	O
could	O
lawfully	O
engage	O
in	O
decompilation	B-Application
in	O
order	O
to	O
circumvent	O
the	B-Application
software	I-Application
locking	O
mechanism	O
used	O
by	O
Sega	O
's	O
game	O
consoles	O
.	O
</s>
<s>
In	O
Europe	O
,	O
the	O
1991	O
Software	O
Directive	O
explicitly	O
provides	O
for	O
a	O
right	O
to	O
decompile	B-Application
in	O
order	O
to	O
achieve	O
interoperability	O
.	O
</s>
<s>
The	O
result	O
of	O
a	O
heated	O
debate	O
between	O
,	O
on	O
the	O
one	O
side	O
,	O
software	O
protectionists	O
,	O
and	O
,	O
on	O
the	O
other	O
,	O
academics	O
as	O
well	O
as	O
independent	O
software	O
developers	O
,	O
Article	O
6	O
permits	O
decompilation	B-Application
only	O
if	O
a	O
number	O
of	O
conditions	O
are	O
met	O
:	O
</s>
<s>
First	O
,	O
a	O
person	O
or	O
entity	O
must	O
have	O
a	O
licence	O
to	O
use	O
the	O
program	O
to	O
be	O
decompiled	B-Application
.	O
</s>
<s>
Second	O
,	O
decompilation	B-Application
must	O
be	O
necessary	O
to	O
achieve	O
interoperability	O
with	O
the	O
target	O
program	O
or	O
other	O
programs	O
.	O
</s>
<s>
Interoperability	O
information	O
should	O
therefore	O
not	O
be	O
readily	O
available	O
,	O
such	O
as	O
through	O
manuals	O
or	O
API	B-Application
documentation	I-Application
.	O
</s>
<s>
The	O
necessity	O
must	O
be	O
proven	O
by	O
the	O
decompiler	B-Application
.	O
</s>
<s>
Third	O
,	O
the	O
decompilation	B-Application
process	O
must	O
,	O
if	O
possible	O
,	O
be	O
confined	O
to	O
the	O
parts	O
of	O
the	O
target	O
program	O
relevant	O
to	O
interoperability	O
.	O
</s>
<s>
Since	O
one	O
of	O
the	O
purposes	O
of	O
decompilation	B-Application
is	O
to	O
gain	O
an	O
understanding	O
of	O
the	O
program	O
structure	O
,	O
this	O
third	O
limitation	O
may	O
be	O
difficult	O
to	O
meet	O
.	O
</s>
<s>
Again	O
,	O
the	O
burden	O
of	O
proof	O
is	O
on	O
the	O
decompiler	B-Application
.	O
</s>
<s>
In	O
addition	O
,	O
Article	O
6	O
prescribes	O
that	O
the	O
information	O
obtained	O
through	O
decompilation	B-Application
may	O
not	O
be	O
used	O
for	O
other	O
purposes	O
and	O
that	O
it	O
may	O
not	O
be	O
given	O
to	O
others	O
.	O
</s>
<s>
Overall	O
,	O
the	O
decompilation	B-Application
right	O
provided	O
by	O
Article	O
6	O
codifies	O
what	O
is	O
claimed	O
to	O
be	O
common	O
practice	O
in	O
the	B-Application
software	I-Application
industry	O
.	O
</s>
<s>
Few	O
European	O
lawsuits	O
are	O
known	O
to	O
have	O
emerged	O
from	O
the	O
decompilation	B-Application
right	O
.	O
</s>
<s>
)	O
the	O
decompilation	B-Application
right	O
is	O
not	O
used	O
frequently	O
and	O
the	O
decompilation	B-Application
right	O
may	O
therefore	O
have	O
been	O
unnecessary	O
,	O
</s>
<s>
)	O
illegal	O
decompilation	B-Application
goes	O
largely	O
undetected	O
.	O
</s>
<s>
In	O
a	O
report	O
of	O
2000	O
regarding	O
implementation	O
of	O
the	B-Application
Software	I-Application
Directive	O
by	O
the	O
European	O
member	O
states	O
,	O
the	O
European	O
Commission	O
seemed	O
to	O
support	O
the	O
second	O
interpretation	O
.	O
</s>
