---
documentID: "f71a2b4d7dee613bef0c375fd7fbf8f49ce2bb954525270333626c48d70322ec"
docname: "extended/disassembler/python/arch/x86"
title: "x86/x86-64 - Python Disassembler - LIEF Documentation"
description: "x86/x86-64 Python Disassembler. See: lief.assembly.x86.OPCODE"
canonical: "https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html"
markdownURL: "https://lief.re/doc/latest/extended/disassembler/python/arch/x86.md"
documentationVersion: "2.0.0"
documentationChannel: "latest"
language: "en"
contentHash: "671a15857ef6d1134d074bc8e189d5a95fc13ff9be6fe3832bff6e993c82d187"
---

# [x86/x86-64](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#x86-x86-64>)

## [Instruction](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#instruction>)

![Inheritance diagram of lief._lief.assembly.x86.Instruction](https://lief.re/doc/latest/_images/inheritance-d12d9319acedc4858e638f1faa8a3021b9ec4229.png)

### [` lief.assembly.x86.Instruction `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Instruction>)

class lief.assembly.x86.Instruction

Bases: [`Instruction`](<https://lief.re/doc/latest/extended/disassembler/python/index.html#lief.assembly.Instruction> "lief._lief.assembly.Instruction")

This class represents a x86/x86-64 instruction

#### [` has_lock_prefix `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Instruction.has_lock_prefix>)

property has\_lock\_prefix → bool

True if this instruction has a `LOCK` prefix

#### [` is_atomic `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Instruction.is_atomic>)

property is\_atomic → bool

True if this instruction executes as an atomic read-modify-write

#### [` is_lockable `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Instruction.is_lockable>)

property is\_lockable → bool

True if the `LOCK` prefix is architecturally valid on this instruction

#### [` lock `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Instruction.lock>)

lock(*self*) → [lief.\_lief.assembly.x86.Instruction](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Instruction> "lief._lief.assembly.x86.Instruction") | None

Re-encoded copy of this instruction with a `LOCK` prefix added.

If the instruction already has a `LOCK` prefix, it returns a plain copy.

#### [` opcode `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Instruction.opcode>)

property opcode → lief.assembly.x86.OPCODE

The instruction opcode as defined in LLVM

#### [` operands `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Instruction.operands>)

property operands → Iterator[[lief.assembly.x86.Operand](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Operand> "lief.assembly.x86.Operand") | None]

Iterator over the operands of the current instruction

#### [` unlock `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Instruction.unlock>)

unlock(*self*) → [lief.\_lief.assembly.x86.Instruction](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Instruction> "lief._lief.assembly.x86.Instruction") | None

Re-encoded copy of this instruction with the `LOCK` prefix removed.

If the instruction does not have a `LOCK` prefix, it returns a plain copy or `None` if the `LOCK` semantic can’t be removed.

## [Opcodes](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#opcodes>)

See: `lief.assembly.x86.OPCODE`

## [Operands](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#operands>)

![Inheritance diagram of lief._lief.assembly.x86.Operand, lief._lief.assembly.x86.operands.Register, lief._lief.assembly.x86.operands.Immediate, lief._lief.assembly.x86.operands.Memory, lief._lief.assembly.x86.operands.PCRelative](https://lief.re/doc/latest/_images/inheritance-ddd280ef5216fa25409e1ebc8394abd2ac39a95e.png)

### [` lief.assembly.x86.Operand `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Operand>)

class lief.assembly.x86.Operand

Bases: `object`

This class represents an operand for an x86/x86-64 instruction

#### [` to_string `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Operand.to_string>)

property to\_string → str

Pretty representation of the operand

### [Immediate](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#immediate>)

![Inheritance diagram of lief._lief.assembly.x86.operands.Immediate](https://lief.re/doc/latest/_images/inheritance-b1482de3d93c84677df3546912e10d7c891160a7.png)

#### [` lief.assembly.x86.operands.Immediate `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.Immediate>)

class lief.assembly.x86.operands.Immediate

Bases: [`Operand`](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Operand> "lief._lief.assembly.x86.Operand")

This class represents an immediate operand (i.e. a constant)

For instance:

```text
mov edi, 1;
         |
         +---> Immediate(1)
```

##### [` value `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.Immediate.value>)

property value → int

The constant value wrapped by this operand

### [Register](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#register>)

![Inheritance diagram of lief._lief.assembly.x86.operands.Register](https://lief.re/doc/latest/_images/inheritance-fed19cbfb5412844851cfcb8d04c6406ab1b09c4.png)

#### [` lief.assembly.x86.operands.Register `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.Register>)

class lief.assembly.x86.operands.Register

Bases: [`Operand`](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Operand> "lief._lief.assembly.x86.Operand")

This class represents a register operand.

For instance:

```text
mov r15d, edi
     |     |
     |     +---------> Register(EDI)
     |
     +---------------> Register(R15D)
```

##### [` value `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.Register.value>)

property value → lief.assembly.x86.REG

The effective `lief.assembly.x86.REG` wrapped by this operand

### [Memory](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#memory>)

![Inheritance diagram of lief._lief.assembly.x86.operands.Memory](https://lief.re/doc/latest/_images/inheritance-c2d749f6d3db7401e86b4b70e0d84b4d2775e998.png)

#### [` lief.assembly.x86.operands.Memory `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.Memory>)

class lief.assembly.x86.operands.Memory

Bases: [`Operand`](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Operand> "lief._lief.assembly.x86.Operand")

This class represents a memory operand.

For instance:

```text
movq xmm3, qword ptr [rip + 823864];

                     |
                     |
                   Memory
                     |
         +-----------+-----------+
         |           |           |
     Base: rip    Scale: 1    Displacement: 823864
```

##### [` base `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.Memory.base>)

property base → lief.assembly.x86.REG

The base register.

For `lea rdx, [rip + 244634]` it would return `rip`

##### [` displacement `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.Memory.displacement>)

property displacement → int

The displacement value.

For `call qword ptr [rip + 248779]` it would return `248779`

##### [` scale `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.Memory.scale>)

property scale → int

The scale value associated with the [`scaled_register`](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.Memory.scaled_register> "lief.assembly.x86.operands.Memory.scaled_register"):

For `mov rdi, qword ptr [r13 + 8*r14]` it would return `8`

##### [` scaled_register `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.Memory.scaled_register>)

property scaled\_register → lief.assembly.x86.REG

The scaled register.

For `mov rdi, qword ptr [r13 + 8*r14]` it would return `r14`

##### [` segment_register `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.Memory.segment_register>)

property segment\_register → lief.assembly.x86.REG

The segment register associated with the memory operation.

For `mov eax, dword ptr gs:[0]` it would return `gs`

### [PCRelative](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#pcrelative>)

![Inheritance diagram of lief._lief.assembly.x86.operands.PCRelative](https://lief.re/doc/latest/_images/inheritance-d75f438477a603803dd0331b2a934c3c72f4ca6f.png)

#### [` lief.assembly.x86.operands.PCRelative `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.PCRelative>)

class lief.assembly.x86.operands.PCRelative

Bases: [`Operand`](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.Operand> "lief._lief.assembly.x86.Operand")

This class represents a RIP/EIP-relative operand.

For instance:

```text
jmp 67633;
    |
    +----------> PCRelative(67633)
```

##### [` value `](<https://lief.re/doc/latest/extended/disassembler/python/arch/x86.html#lief.assembly.x86.operands.PCRelative.value>)

property value → int

The effective value that is relative to the current `rip/eip` register
