> For the complete documentation index, see [llms.txt](https://docs.r.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.r.xyz/glider-ide/api/instruction/instruction.previous_instructions_recursive.md).

# Instruction.previous\_instructions\_recursive()

Returns the set of all instructions preceding the current node in the control flow graph.

`previous_instructions_recursive() →` [`APISet`](/glider-ide/api/iterables/apiset.md)`[`[`Instruction`](/glider-ide/api/instruction.md)`]`

The function returns all instructions that are previous to the instruction in the CFG (control flow graph).

The difference between the extended\_previous\_instructions() function and [previous\_instructions()](/glider-ide/api/instruction/instruction.previous_instructions.md) is that the former works in an inter-procedural manner.

*The function is inter-procedural, and follows function calls; for the **intra**-procedural variant of this function, use* [*previous\_instructions()*](/glider-ide/api/instruction/instruction.previous_instructions.md)*.*

For example, in the function:

```solidity
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }
```

for the instruction:

```solidity
require(c / a == b, "SafeMath: multiplication overflow")
```

having that the mul() is being called inside the function:

```solidity
function _transfer(address from, address to, uint256 amount) private {
        uint256 taxAmount=0;
        if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
            require(tradeOpen, "Trading not open");
            taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100);

            if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
                require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the limit");
                _buyCount++;
            }

            if (to != uniswapV2Pair) {
                require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the limit");
            }

            if(to == uniswapV2Pair && from!= address(this) ){
                taxAmount = amount.mul((_buyCount>_reduceSellTaxAt)?_finalSellTax:_initialSellTax).div(100);
            }

        //....
    }
```

the function will return previous instructions from mul():

```solidity
       if (a == 0) {
            return 0;
        }
        uint256 c = a * b;
```

as well as from \_transfer():

```solidity
        uint256 taxAmount=0;
        if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
            require(tradeOpen, "Trading not open");
            taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100);

            if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
                require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the limit");
                _buyCount++;
            }

            if (to != uniswapV2Pair) {
                require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the limit");
            }

            if(to == uniswapV2Pair && from!= address(this) ){
                taxAmount = amount.mul((_buyCount>_reduceSellTaxAt)?_finalSellTax:_initialSellTax).div(100);
            }
```

Furthermore, it will also return instructions from transferFrom() function as the \_transfer() is being called from there as well:

```solidity
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }
```

## Query Example

```python
from glider import *


def query():
  instructions = Functions().with_all_properties([MethodProp.INTERNAL]).instructions().with_callee_name('require').exec(1, 2)

  return instructions + list(instructions[0].previous_instructions_recursive())
```

## Example Output

<figure><img src="https://2237101709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDX4Ojc4j1ef51TUAtYOx%2Fuploads%2FR4eUNlXUpxuqnl12kiRd%2Fimage.png?alt=media&amp;token=66961f73-87af-4b22-81b7-4edb9033ed3c" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2237101709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDX4Ojc4j1ef51TUAtYOx%2Fuploads%2FepCrHRmywqt5iSUgC97V%2Fimage.png?alt=media&amp;token=9ebdc648-8ce9-48d1-b2e5-c1f2e0da8a89" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2237101709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDX4Ojc4j1ef51TUAtYOx%2Fuploads%2FRZyrEZ02oL2dMZsT5nGg%2Fimage.png?alt=media&amp;token=2d843463-8216-49db-8640-fffae96dd2f9" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2237101709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDX4Ojc4j1ef51TUAtYOx%2Fuploads%2FybNSnGu5QB9A9YHLausQ%2Fimage.png?alt=media&amp;token=959db8a0-0db6-4c47-99cb-9ab5ad5a320d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2237101709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDX4Ojc4j1ef51TUAtYOx%2Fuploads%2F19ehn5zf1llZVdNk63qf%2Fimage.png?alt=media&amp;token=bd36a0d5-cb0b-4425-bd0f-d23cbaa9b8dc" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The function returns APISet, instead of APIList, in case the result of the function is used as the return value of the query it must be casted to `list()`
{% endhint %}
